- #s #Hcurta_src #Hstart #Hnotstart % [ %
- [ @daemon
- | #s1 #Hcurta_dst #Hneqss1 -Hcomp2
- cut (tc = ta)
- [@Hcomp1 %2 %1 %1 >Hcurta_src >Hcurta_dst @(not_to_not … Hneqss1) #H destruct (H) //]
- #H destruct (H) -Hcomp1 cases Hte #_ -Hte #Hte
- cut (te = ta) [@Hte %1 %1 %{s} % //] -Hte #H destruct (H) %
- [cases Htb * #_ #Hmove #Hmove1 @(eq_vec … (niltape … ))
- #i #Hi cases (decidable_eq_nat i dst) #Hidst
- [ >Hidst >nth_change_vec // cases (current_to_midtape … Hcurta_dst)
- #ls * #rs #Hta_mid >(Hmove … Hta_mid) >Hta_mid cases rs //
- | >nth_change_vec_neq [|@sym_not_eq //] @sym_eq @Hmove1 @sym_not_eq // ]
- | whd in Htest:(??%?); >(nth_vec_map ?? (current sig)) in Hcurta_src; #Hcurta_src
- >Hcurta_src in Htest; whd in ⊢ (??%?→?);
- cases (is_endc s) // whd in ⊢ (??%?→?); #H @sym_eq //
- ]]
- |#ls #x #xs #ci #cj #rs #ls0 #rs00 #Htasrc_mid #Htadst_mid #Hnotendc #Hcicj
- cases (Hcomp2 … Htasrc_mid Htadst_mid Hnotendc) [ * #H destruct (H) ]
- * #cj' * #rs0' * #Hcjrs0 destruct (Hcjrs0) -Hcomp2 #Hcomp2
- lapply (Hcomp2 (or_intror ?? Hcicj)) -Hcomp2 #Htc %
- [ cases Hte -Hte #Hte #_ whd in Hte;
- >Htasrc_mid in Hcurta_src; whd in ⊢ (??%?→?); #H destruct (H)
- lapply (Hte ls ci (reverse ? xs) rs s ??? ls0 cj' (reverse ? xs) s rs0' (refl ??) ?) //
- [ >Htc >nth_change_vec //
- | #c0 #Hc0 @(Hnotstart c0) >Htasrc_mid cases (orb_true_l … Hc0) -Hc0 #Hc0
- [@memb_append_l2 >(\P Hc0) @memb_hd
- |@memb_append_l1 <(reverse_reverse …xs) @memb_reverse //
- ]
- | >Htc >change_vec_commute // >nth_change_vec // ] -Hte
- >Htc >change_vec_commute // >change_vec_change_vec
- >change_vec_commute [|@sym_not_eq //] >change_vec_change_vec #Hte
- >Hte in Htb; * * #_ >reverse_reverse #Htbdst1 #Htbdst2 -Hte @(eq_vec … (niltape ?))
- #i #Hi cases (decidable_eq_nat i dst) #Hidst
- [ >Hidst >nth_change_vec // >(Htbdst1 ls0 s (xs@cj'::rs0'))
- [| >nth_change_vec // ]
- >Htadst_mid cases xs //
- | >nth_change_vec_neq [|@sym_not_eq // ]
- <Htbdst2 [| @sym_not_eq // ] >nth_change_vec_neq [| @sym_not_eq // ]
- <Htasrc_mid >change_vec_same % ]
- | >Hcurta_src in Htest; whd in ⊢(??%?→?);
- >Htc >change_vec_commute //
- change with (current ? (niltape ?)) in match (None ?);
- <nth_vec_map >nth_change_vec // whd in ⊢ (??%?→?);
- cases (is_endc ci) whd in ⊢ (??%?→?); #H destruct (H) %
+ #s #Hcurta_src %
+ [ lapply (refl ? (current ? (nth dst ? ta (niltape ?))))
+ cases (current ? (nth dst ? ta (niltape ?))) in ⊢ (???%→%);
+ [| #c #_ % #Hfalse destruct (Hfalse) ]
+ #Hcurta_dst >Hcomp1 in Htest; [| %2 %2 //]
+ whd in ⊢ (??%?→?); change with (current ? (niltape ?)) in match (None ?);
+ <nth_vec_map >Hcurta_src whd in ⊢ (??%?→?); <nth_vec_map
+ >Hcurta_dst cases (is_endc s) normalize in ⊢ (%→?); #H destruct (H)
+ | #Hstart #Hnotstart %
+ [ #s1 #Hcurta_dst #Hneqss1 -Hcomp2
+ cut (tc = ta)
+ [@Hcomp1 %2 %1 %1 >Hcurta_src >Hcurta_dst @(not_to_not … Hneqss1) #H destruct (H) //]
+ #H destruct (H) -Hcomp1 cases Hte #_ -Hte #Hte
+ cut (te = ta) [@Hte %1 %1 %{s} % //] -Hte #H destruct (H) %
+ [cases Htb * #_ #Hmove #Hmove1 @(eq_vec … (niltape … ))
+ #i #Hi cases (decidable_eq_nat i dst) #Hidst
+ [ >Hidst >nth_change_vec // cases (current_to_midtape … Hcurta_dst)
+ #ls * #rs #Hta_mid >(Hmove … Hta_mid) >Hta_mid cases rs //
+ | >nth_change_vec_neq [|@sym_not_eq //] @sym_eq @Hmove1 @sym_not_eq // ]
+ | whd in Htest:(??%?); >(nth_vec_map ?? (current sig)) in Hcurta_src; #Hcurta_src
+ >Hcurta_src in Htest; whd in ⊢ (??%?→?);
+ cases (is_endc s) // whd in ⊢ (??%?→?); #H @sym_eq //
+ ]
+ |#ls #x #xs #ci #cj #rs #ls0 #rs00 #Htasrc_mid #Htadst_mid #Hnotendc #Hcicj
+ cases (Hcomp2 … Htasrc_mid Htadst_mid Hnotendc) [ * #H destruct (H) ]
+ * #cj' * #rs0' * #Hcjrs0 destruct (Hcjrs0) -Hcomp2 #Hcomp2
+ lapply (Hcomp2 (or_intror ?? Hcicj)) -Hcomp2 #Htc %
+ [ cases Hte -Hte #Hte #_ whd in Hte;
+ >Htasrc_mid in Hcurta_src; whd in ⊢ (??%?→?); #H destruct (H)
+ lapply (Hte ls ci (reverse ? xs) rs s ??? ls0 cj' (reverse ? xs) s rs0' (refl ??) ?) //
+ [ >Htc >nth_change_vec //
+ | #c0 #Hc0 @(Hnotstart c0) >Htasrc_mid cases (orb_true_l … Hc0) -Hc0 #Hc0
+ [@memb_append_l2 >(\P Hc0) @memb_hd
+ |@memb_append_l1 <(reverse_reverse …xs) @memb_reverse //
+ ]
+ | >Htc >change_vec_commute // >nth_change_vec // ] -Hte
+ >Htc >change_vec_commute // >change_vec_change_vec
+ >change_vec_commute [|@sym_not_eq //] >change_vec_change_vec #Hte
+ >Hte in Htb; * * #_ >reverse_reverse #Htbdst1 #Htbdst2 -Hte @(eq_vec … (niltape ?))
+ #i #Hi cases (decidable_eq_nat i dst) #Hidst
+ [ >Hidst >nth_change_vec // >(Htbdst1 ls0 s (xs@cj'::rs0'))
+ [| >nth_change_vec // ]
+ >Htadst_mid cases xs //
+ | >nth_change_vec_neq [|@sym_not_eq // ]
+ <Htbdst2 [| @sym_not_eq // ] >nth_change_vec_neq [| @sym_not_eq // ]
+ <Htasrc_mid >change_vec_same % ]
+ | >Hcurta_src in Htest; whd in ⊢(??%?→?);
+ >Htc >change_vec_commute //
+ change with (current ? (niltape ?)) in match (None ?);
+ <nth_vec_map >nth_change_vec // whd in ⊢ (??%?→?);
+ cases (is_endc ci) whd in ⊢ (??%?→?); #H destruct (H) %
+ ]
+ ]