X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Flib%2Fturing%2Funiversal%2Funiversal.ma;h=3ed3015bec83c38932ce359c20faa37218c31815;hb=31cb2f0b374657eb5acb95708443e2c1b8481891;hp=5ffbc8d4e56a516bbdc56315aa7d39ad0fcef002;hpb=b0d97cd7e2c50fb1fc2d50c86f3140e226b08a81;p=helm.git diff --git a/matita/matita/lib/turing/universal/universal.ma b/matita/matita/lib/turing/universal/universal.ma index 5ffbc8d4e..3ed3015be 100644 --- a/matita/matita/lib/turing/universal/universal.ma +++ b/matita/matita/lib/turing/universal/universal.ma @@ -10,30 +10,10 @@ V_____________________________________________________________*) -include "turing/universal/trans_to_tuples.ma". include "turing/universal/uni_step.ma". (* definition zero : ∀n.initN n ≝ λn.mk_Sig ?? 0 (le_O_n n). *) -record normalTM : Type[0] ≝ -{ no_states : nat; - pos_no_states : (0 < no_states); - ntrans : trans_source no_states → trans_target no_states; - nhalt : initN no_states → bool -}. - -definition normalTM_to_TM ≝ λM:normalTM. - mk_TM FinBool (initN (no_states M)) - (ntrans M) (mk_Sig ?? 0 (pos_no_states M)) (nhalt M). - -coercion normalTM_to_TM. - -definition nconfig ≝ λn. config FinBool (initN n). - -(* -definition normalTM ≝ λn,t,h. - λk:0Ht1 whd in ⊢ (??%?); @eq_f +normalize in Hqin; destruct (Hqin) % +qed. + definition low_R ≝ λM,qstart,R,t1,t2. ∀tape1. t1 = low_config M (mk_config ?? qstart tape1) → ∃q,tape2.R tape1 tape2 ∧ halt ? M q = true ∧ t2 = low_config M (mk_config ?? q tape2). -definition R_TM ≝ λsig.λM:TM sig.λq.λt1,t2. -∃i,outc. - loop ? i (step sig M) (λc.halt sig M (cstate ?? c)) (mk_config ?? q t1) = Some ? outc ∧ - t2 = (ctape ?? outc). - -(* -definition universal_R ≝ λM,R,t1,t2. - Realize ? M R → - ∀tape1,tape2. - R tape1 tape 2 ∧ - t1 = low_config M (initc ? M tape1) ∧ - ∃q.halt ? M q = true → t2 = low_config M (mk_config ?? q tape2).*) - -axiom uni_step: TM STape. -axiom us_acc: states ? uni_step. - -axiom sem_uni_step: accRealize ? uni_step us_acc low_step_R_true low_step_R_false. +lemma sem_uni_step1: + uni_step ⊨ [us_acc: low_step_R_true, low_step_R_false]. +@(acc_Realize_to_acc_Realize … sem_uni_step) + [@unistep_true_to_low_step | @unistep_false_to_low_step ] +qed. definition universalTM ≝ whileTM ? uni_step us_acc. theorem sem_universal: ∀M:normalTM. ∀qstart. WRealize ? universalTM (low_R M qstart (R_TM FinBool M qstart)). #M #q #intape #i #outc #Hloop -lapply (sem_while … sem_uni_step intape i outc Hloop) +lapply (sem_while … sem_uni_step1 intape i outc Hloop) [@daemon] -Hloop * #ta * #Hstar generalize in match q; -q @(star_ind_l ??????? Hstar) @@ -413,15 +381,6 @@ lapply (sem_while … sem_uni_step intape i outc Hloop) ] qed. -lemma R_TM_to_R: ∀sig,M,R. ∀t1,t2. - WRealize sig M R → R_TM ? M (start ? M) t1 t2 → R t1 t2. -#sig #M #R #t1 #t2 whd in ⊢ (%→?); #HMR * #i * #outc * -#Hloop #Ht2 >Ht2 @(HMR … Hloop) -qed. - -axiom WRealize_to_WRealize: ∀sig,M,R1,R2. - (∀t1,t2.R1 t1 t2 → R2 t1 t2) → WRealize sig M R1 → WRealize ? M R2. - theorem sem_universal2: ∀M:normalTM. ∀R. WRealize ? M R → WRealize ? universalTM (low_R M (start ? M) R). #M #R #HMR lapply (sem_universal … M (start ? M)) @WRealize_to_WRealize