- |
- #l3 #c0 #Hyp >Hbs >Hb0s
- cases (IH b b0 bs l1 l2 Hlen ?????
-
- >(\P Hc') whd in ⊢ (??%?→?); #Hfalse destruct (Hfalse)
- ]
-qed.
-
-
-
-(*
-l0 x* a l1 x0* a0 l2 ------> l0 x a* l1 x0 a0* l2
- ^ ^
-
-if current (* x *) = #
- then
- else if x = 0
- then move_right; ----
- adv_to_mark_r;
- if current (* x0 *) = 0
- then advance_mark ----
- adv_to_mark_l;
- advance_mark
- else STOP
- else x = 1 (* analogo *)
-
-*)
-
-
-(*
- MARK NEXT TUPLE machine
- (partially axiomatized)
-
- marks the first character after the first bar (rightwards)
- *)
-
-axiom myalpha : FinSet.
-axiom is_bar : FinProd … myalpha FinBool → bool.
-axiom is_grid : FinProd … myalpha FinBool → bool.
-definition bar_or_grid ≝ λc.is_bar c ∨ is_grid c.
-axiom bar : FinProd … myalpha FinBool.
-axiom grid : FinProd … myalpha FinBool.
-
-definition mark_next_tuple ≝
- seq ? (adv_to_mark_r ? bar_or_grid)
- (ifTM ? (test_char ? is_bar)
- (move_r_and_mark ?) (nop ?) 1).
-
-definition R_mark_next_tuple ≝
- λt1,t2.
- ∀ls,c,rs1,rs2.
- (* c non può essere un separatore ... speriamo *)
- t1 = midtape ? ls c (rs1@grid::rs2) →
- memb ? grid rs1 = false → bar_or_grid c = false →
- (∃rs3,rs4,d,b.rs1 = rs3 @ bar :: rs4 ∧
- memb ? bar rs3 = false ∧
- Some ? 〈d,b〉 = option_hd ? (rs4@grid::rs2) ∧
- t2 = midtape ? (bar::reverse ? rs3@c::ls) 〈d,true〉 (tail ? (rs4@grid::rs2)))
- ∨
- (memb ? bar rs1 = false ∧
- t2 = midtape ? (reverse ? rs1@c::ls) grid rs2).
-
-axiom tech_split :
- ∀A:DeqSet.∀f,l.
- (∀x.memb A x l = true → f x = false) ∨
- (∃l1,c,l2.f c = true ∧ l = l1@c::l2 ∧ ∀x.memb ? x l1 = true → f c = false).
-(*#A #f #l elim l
-[ % #x normalize #Hfalse *)
-
-theorem sem_mark_next_tuple :
- Realize ? mark_next_tuple R_mark_next_tuple.
-#intape
-lapply (sem_seq ? (adv_to_mark_r ? bar_or_grid)
- (ifTM ? (test_char ? is_bar) (mark ?) (nop ?) 1) ????)
-[@sem_if //
-| //
-|||#Hif cases (Hif intape) -Hif
- #j * #outc * #Hloop * #ta * #Hleft #Hright
- @(ex_intro ?? j) @ex_intro [|% [@Hloop] ]
- -Hloop
- #ls #c #rs1 #rs2 #Hrs #Hrs1 #Hc
- cases (Hleft … Hrs)
- [ * #Hfalse >Hfalse in Hc; #Htf destruct (Htf)
- | * #_ #Hta cases (tech_split ? is_bar rs1)
- [ #H1 lapply (Hta rs1 grid rs2 (refl ??) ? ?)
- [ (* Hrs1, H1 *) @daemon
- | (* bar_or_grid grid = true *) @daemon
- | -Hta #Hta cases Hright
- [ * #tb * whd in ⊢ (%→?); #Hcurrent
- @False_ind cases(Hcurrent grid ?)
- [ #Hfalse (* grid is not a bar *) @daemon
- | >Hta % ]
- | * #tb * whd in ⊢ (%→?); #Hcurrent
- cases (Hcurrent grid ?)
- [ #_ #Htb whd in ⊢ (%→?); #Houtc
- %2 %
- [ (* H1 *) @daemon
- | >Houtc >Htb >Hta % ]
- | >Hta % ]
+ | cases (IH … Htapeb) -IH * #_ #IH #_ >(IH ? (refl ??))
+ @Htapeb
+ ]
+ | @Hl1 ]
+ | * #b' #bitb' * #b0' #bitb0' #bs' #b0s' #Hbs #Hb0s
+ generalize in match Hrs; >Hbs in ⊢ (%→?); >Hb0s in ⊢ (%→?);
+ cut (bit_or_null b' = true ∧ bit_or_null b0' = true ∧
+ bitb' = false ∧ bitb0' = false)
+ [ % [ % [ % [ >Hbs in Hbs1; #Hbs1 @(Hbs1 〈b',bitb'〉) @memb_hd
+ | >Hb0s in Hb0s1; #Hb0s1 @(Hb0s1 〈b0',bitb0'〉) @memb_hd ]
+ | >Hbs in Hbs2; #Hbs2 @(Hbs2 〈b',bitb'〉) @memb_hd ]
+ | >Hb0s in Hb0s2; #Hb0s2 @(Hb0s2 〈b0',bitb0'〉) @memb_hd ]
+ | * * * #Ha #Hb #Hc #Hd >Hc >Hd
+ #Hrs #Hleft
+ cases (Hleft b' (bs'@〈grid,false〉::l1) b0 b0'
+ (b0s'@〈comma,false〉::l2) ??) -Hleft
+ [ 3: >Hrs normalize @eq_f >associative_append %
+ | * #Hb0 #Htapeb cases (IH …Htapeb) -IH * #_ #_ #IH
+ cases (IH b' b0' bs' b0s' (l1@[〈b0,false〉]) l2 ??????? Ha ?) -IH
+ [ * #Heq #Houtc % %
+ [ >Hb0 @eq_f >Hbs in Heq; >Hb0s in ⊢ (%→?); #Heq
+ destruct (Heq) >Hb0s >Hc >Hd %
+ | >Houtc >Hbs >Hb0s >Hc >Hd >reverse_cons >associative_append
+ >associative_append %
+ ]
+ | * #la * #c' * #d' * #lb * #lc * * * #H1 #H2 #H3 #H4 %2
+ @(ex_intro … (〈b,false〉::la)) @(ex_intro … c') @(ex_intro … d')
+ @(ex_intro … lb) @(ex_intro … lc)
+ % [ % [ % // >Hbs >Hc >H2 % | >Hb0s >Hd >H3 >Hb0 % ]
+ | >H4 >Hbs >Hb0s >Hc >Hd >Hb0 >reverse_append
+ >reverse_cons >reverse_cons
+ >associative_append >associative_append
+ >associative_append >associative_append %
+ ]
+ | generalize in match Hlen; >Hbs >Hb0s
+ normalize #Hlen destruct (Hlen) @e0
+ | #c0 #Hc0 @Hbs1 >Hbs @memb_cons //
+ | #c0 #Hc0 @Hb0s1 >Hb0s @memb_cons //
+ | #c0 #Hc0 @Hbs2 >Hbs @memb_cons //
+ | #c0 #Hc0 @Hb0s2 >Hb0s @memb_cons //
+ | #c0 #Hc0 cases (memb_append … Hc0)
+ [ @Hl1 | #Hc0' >(memb_single … Hc0') % ]
+ | %
+ | >associative_append >associative_append % ]
+ | * #Hneq #Htapeb %2
+ @(ex_intro … []) @(ex_intro … b) @(ex_intro … b0)
+ @(ex_intro … bs) @(ex_intro … b0s) %
+ [ % // % // @sym_not_eq //
+ | >Hbs >Hb0s >Hc >Hd >reverse_cons >associative_append
+ >reverse_append in Htapeb; >reverse_cons
+ >associative_append >associative_append
+ #Htapeb <Htapeb
+ cases (IH … Htapeb) -Htapeb -IH * #_ #IH #_ @(IH ? (refl ??))
+ ]
+ | #c1 #Hc1 cases (memb_append … Hc1) #Hyp
+ [ @Hbs2 >Hbs @memb_cons @Hyp
+ | cases (orb_true_l … Hyp)
+ [ #Hyp2 >(\P Hyp2) %
+ | @Hl1
+ ]
+ ]