2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department of the University of Bologna, Italy.
8 \ / This file is distributed under the terms of the
9 \ / GNU General Public License Version 2
10 V_____________________________________________________________*)
12 include "turing/turing.ma".
13 include "turing/inject.ma".
14 include "turing/while_multi.ma".
16 definition partest_states ≝ initN 3.
18 definition partest0 : partest_states ≝ mk_Sig ?? 0 (leb_true_to_le 1 3 (refl …)).
19 definition partest1 : partest_states ≝ mk_Sig ?? 1 (leb_true_to_le 2 3 (refl …)).
20 definition partest2 : partest_states ≝ mk_Sig ?? 2 (leb_true_to_le 3 3 (refl …)).
22 definition trans_partest ≝
24 λp:partest_states × (Vector (option sig) (S n)).
26 if test a then 〈partest1,null_action sig n〉
27 else 〈partest2,null_action ? n〉.
31 mk_mTM sig n partest_states (trans_partest sig n test)
32 partest0 (λq.q == partest1 ∨ q == partest2).
34 definition R_partest_true ≝
35 λsig,n,test.λint,outt: Vector (tape sig) (S n).
36 test (current_chars ?? int) = true ∧ outt = int.
38 definition R_partest_false ≝
39 λsig,n,test.λint,outt: Vector (tape sig) (S n).
40 test (current_chars ?? int) = false ∧ outt = int.
44 test (current_chars ?? v) = true →
45 step sig n (partest sig n test)(mk_mconfig ??? partest0 v)
46 = mk_mconfig ??? partest1 v.
47 #sig #n #test #v #Htest
48 whd in ⊢ (??%?); >(eq_pair_fst_snd … (trans ????)) whd in ⊢ (??%?);
50 [ whd in ⊢ (??(???%)?); >Htest %
51 | whd in ⊢ (??(????(???%))?); >Htest @tape_move_null_action ]
56 test (current_chars ?? v) = false →
57 step sig n (partest sig n test)(mk_mconfig ??? partest0 v)
58 = mk_mconfig ??? partest2 v.
59 #sig #n #test #v #Htest
60 whd in ⊢ (??%?); >(eq_pair_fst_snd … (trans ????)) whd in ⊢ (??%?);
62 [ whd in ⊢ (??(???%)?); >Htest %
63 | whd in ⊢ (??(????(???%))?); >Htest @tape_move_null_action ]
69 [ partest1: R_partest_true sig n test, R_partest_false sig n test ].
71 cases (true_or_false (test (current_chars ?? int))) #Htest
72 [ %{2} %{(mk_mconfig ? partest_states n partest1 int)} %
73 [ % [ whd in ⊢ (??%?); >partest_q0_q1 /2/ | #_ % // ]
74 | * #H @False_ind @H %
76 | %{2} %{(mk_mconfig ? partest_states n partest2 int)} %
77 [ % [ whd in ⊢ (??%?); >partest_q0_q2 /2/
78 | whd in ⊢ (??%%→?); #H destruct (H)]