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_____________________________________________________________*)
17 include "turing/universal/copy.ma".
18 include "turing/universal/move_tape.ma".
19 include "turing/universal/match_machines.ma".
25 if is_true(current) (* current state is final *)
37 if is_marked(current) = false (* match ok *)
50 case bit false: move_tape_l
51 case bit true: move_tape_r
52 case null: adv_to_grid_l; move_l; adv_to_grid_l;
59 definition init_match ≝
60 mark ? · adv_to_mark_r ? (λc:STape.is_grid (\fst c)) · move_r ? ·
61 move_r ? · mark ? · move_l ? · adv_to_mark_l ? (is_marked ?).
63 definition R_init_match ≝ λt1,t2.
64 ∀ls,l,rs,c,d. no_grids (〈c,false〉::l) → no_marks l →
65 t1 = midtape STape ls 〈c,false〉 (l@〈grid,false〉::〈bar,false〉::〈d,false〉::rs) →
66 t2 = midtape STape ls 〈c,true〉 (l@〈grid,false〉::〈bar,false〉::〈d,true〉::rs).
68 lemma sem_init_match : Realize ? init_match R_init_match.
70 cases (sem_seq ????? (sem_mark ?)
71 (sem_seq ????? (sem_adv_to_mark_r ? (λc:STape.is_grid (\fst c)))
72 (sem_seq ????? (sem_move_r ?)
73 (sem_seq ????? (sem_move_r ?)
74 (sem_seq ????? (sem_mark ?)
75 (sem_seq ????? (sem_move_l ?)
76 (sem_adv_to_mark_l ? (is_marked ?))))))) intape)
77 #k * #outc * #Hloop #HR
78 @(ex_intro ?? k) @(ex_intro ?? outc) % [@Hloop] -Hloop
79 #ls #l #rs #c #d #Hnogrids #Hnomarks #Hintape
81 #ta * whd in ⊢ (%→?); * #Hta #_ lapply (Hta … Hintape) -Hta -Hintape #Hta
82 * #tb * whd in ⊢ (%→?); * #_ #Htb cases (Htb … Hta) -Htb -Hta
83 [* #Hgridc @False_ind @(absurd … Hgridc) @eqnot_to_noteq
84 @(Hnogrids 〈c,false〉) @memb_hd ]
85 * * #Hgrdic #Htb #_ lapply (Htb l 〈grid,false〉 (〈bar,false〉::〈d,false〉::rs) (refl …) (refl …) ?)
86 [#x #membl @Hnogrids @memb_cons @membl] -Htb #Htb
87 * #tc * whd in ⊢ (%→?); * #_ #Htc lapply (Htc … Htb) -Htc -Htb #Htc
88 * #td * whd in ⊢ (%→?); * #_ #Htd lapply (Htd … Htc) -Htd -Htc #Htd
89 * #te * whd in ⊢ (%→?); * #Hte #_ lapply (Hte … Htd) -Hte -Htd #Hte
90 * #tf * whd in ⊢ (%→?); * #_ #Htf lapply (Htf … Hte) -Htf -Hte #Htf
91 whd in ⊢ (%→?); * #_ #Htg cases (Htg … Htf) -Htg -Htf
92 #_ #Htg cases (Htg (refl …)) -Htg #Htg #_
93 lapply (Htg (〈grid,false〉::reverse ? l) 〈c,true〉 ls (refl …) (refl …) ?)
94 [#x #membl @Hnomarks @daemon] -Htg #Htg >Htg >reverse_cons >reverse_reverse
100 init_current_on_match; (* no marks in current *)
107 definition init_copy ≝
108 init_current_on_match · move_r ? ·
109 adv_to_mark_r ? (is_marked ?) · adv_mark_r ?.
111 definition R_init_copy ≝ λt1,t2.
113 no_marks l1 → no_grids l1 →
114 no_marks l2 → is_grid c = false →
115 t1 = midtape STape (l1@〈c,false〉::〈grid,false〉::ls) 〈grid,false〉 (l2@〈comma,true〉::〈d,false〉::rs) →
116 t2 = midtape STape (〈comma,false〉::(reverse ? l2)@〈grid,false〉::l1@〈c,true〉::〈grid,false〉::ls) 〈d,true〉 rs.
118 lemma list_last: ∀A.∀l:list A.
119 l = [ ] ∨ ∃a,l1. l = l1@[a].
120 #A #l <(reverse_reverse ? l) cases (reverse A l)
122 |#a #l1 %2 @(ex_intro ?? a) @(ex_intro ?? (reverse ? l1)) //
126 lemma sem_init_copy : Realize ? init_copy R_init_copy.
128 cases (sem_seq ????? sem_init_current_on_match
129 (sem_seq ????? (sem_move_r ?)
130 (sem_seq ????? (sem_adv_to_mark_r ? (is_marked ?))
131 (sem_adv_mark_r ?))) intape)
132 #k * #outc * #Hloop #HR
133 @(ex_intro ?? k) @(ex_intro ?? outc) % [@Hloop] -Hloop
134 #l1 #l2 #c #ls #d #rs #Hl1marks #Hl1grids #Hl2marks #Hc #Hintape
136 #ta * whd in ⊢ (%→?); #Hta lapply (Hta … Hl1grids Hc Hintape) -Hta -Hintape #Hta
137 * #tb * whd in ⊢ (%→?); * #_ #Htb lapply (Htb … Hta) -Htb -Hta
138 generalize in match Hl1marks; -Hl1marks cases (list_last ? l1)
139 [#eql1 >eql1 #Hl1marks whd in ⊢ ((???%)→?); whd in ⊢ ((???(????%))→?); #Htb
140 * #tc * whd in ⊢ (%→?); * #_ #Htc lapply (Htc … Htb) -Htc -Htb *
141 [* whd in ⊢ ((??%?)→?); #Htemp destruct (Htemp)]
142 * * #_ #Htc #_ lapply (Htc … (refl …) (refl …) ?)
143 [#x #membx @Hl2marks @membx]
144 #Htc whd in ⊢ (%→?); * #Houtc #_ cases (Houtc (reverse ? l2@〈grid,false〉::〈c,true〉::〈grid,false〉::ls) comma)
145 -Houtc #Houtc lapply (Houtc … Htc) -Houtc -Htc #Houtc #_
147 |* #c1 * #tl #eql1 >eql1 #Hl1marks >reverse_append >reverse_single
148 whd in ⊢ ((???%)→?); whd in ⊢ ((???(????%))→?);
149 >associative_append whd in ⊢ ((???(????%))→?); #Htb
150 * #tc * whd in ⊢ (%→?); * #_ #Htc lapply (Htc … Htb) -Htc -Htb *
151 [* >Hl1marks [#Htemp destruct (Htemp)] @memb_append_l2 @memb_hd]
152 * * #_ >append_cons <associative_append #Htc lapply (Htc … (refl …) (refl …) ?)
153 [#x #membx cases (memb_append … membx) -membx #membx
154 [cases (memb_append … membx) -membx #membx
155 [@Hl1marks @memb_append_l1 @daemon
156 |>(memb_single … membx) %
160 -Htc #Htc #_ whd in ⊢ (%→?); * #Houtc #_ cases (Houtc (reverse (FinProd FSUnialpha FinBool) ((reverse STape tl@[〈grid,false〉])@l2)
161 @c1::〈c,true〉::〈grid,false〉::ls) comma)
162 -Houtc #Houtc lapply (Houtc … Htc) -Houtc -Htc #Houtc #_
163 >Houtc >reverse_append >reverse_append >reverse_single
164 >reverse_reverse >associative_append >associative_append
165 >associative_append %
169 definition init_copy ≝
171 (seq ? init_current_on_match
173 (adv_to_mark_r ? (is_marked ?)))).
175 definition R_init_copy ≝ λt1,t2.
177 no_marks l1 → no_grids l1 →
178 no_marks l2 → no_grids l2 → is_grid c = false → is_grid d =false →
179 t1 = midtape STape (l1@〈grid,false〉::l2@〈c,false〉::〈grid,false〉::l3) 〈comma,true〉 (〈d,false〉::rs) →
180 t2 = midtape STape (〈comma,false〉::l1@〈grid,false〉::l2@〈c,true〉::〈grid,false〉::l3) 〈d,true〉 rs.
182 lemma list_last: ∀A.∀l:list A.
183 l = [ ] ∨ ∃a,l1. l = l1@[a].
184 #A #l <(reverse_reverse ? l) cases (reverse A l)
186 |#a #l1 %2 @(ex_intro ?? a) @(ex_intro ?? (reverse ? l1)) //
190 lemma sem_init_copy : Realize ? init_copy R_init_copy.
192 cases (sem_seq ????? (sem_adv_mark_r ?)
193 (sem_seq ????? sem_init_current_on_match
194 (sem_seq ????? (sem_move_r ?)
195 (sem_adv_to_mark_r ? (is_marked ?)))) intape)
196 #k * #outc * #Hloop #HR
197 @(ex_intro ?? k) @(ex_intro ?? outc) % [@Hloop] -Hloop
198 #l1 #l2 #c #l3 #d #rs #Hl1marks #Hl1grids #Hl2marks #Hl2grids #Hc #Hd #Hintape
200 #ta * whd in ⊢ (%→?); #Hta lapply (Hta … Hintape) -Hta -Hintape #Hta
201 * #tb * whd in ⊢ (%→?);
202 >append_cons #Htb lapply (Htb (〈comma,false〉::l1) l2 c … Hta)
204 |#x #membx cases (orb_true_l … membx) -membx #membx
205 [>(\P membx) // | @Hl1grids @membx]
207 * #tc * whd in ⊢ (%→?); #Htc lapply (Htc … Htb) -Htc -Htb
208 >reverse_append >reverse_cons cases (list_last ? l2)
209 [#Hl2 >Hl2 >associative_append whd in ⊢ ((???(??%%%))→?); #Htc
210 whd in ⊢ (%→?); #Htd cases (Htd … Htc) -Htd -Htc
211 [* whd in ⊢ ((??%?)→?); #Habs destruct (Habs)]
212 * #_ #Htf lapply (Htf … (refl …) (refl …) ?)
213 [#x >reverse_cons #membx cases (memb_append … membx) -membx #membx
214 [@Hl1marks @daemon |>(memb_single … membx) //]
216 |#Htf >Htf >reverse_reverse >associative_append %
218 |* #a * #l21 #Heq >Heq >reverse_append >reverse_single
219 >associative_append >associative_append >associative_append whd in ⊢ ((???(??%%%))→?); #Htc
220 whd in ⊢ (%→?); #Htd cases (Htd … Htc) -Htd -Htc
221 [* >Hl2marks [#Habs destruct (Habs) |>Heq @memb_append_l2 @memb_hd]]
222 * #_ <associative_append <associative_append #Htf lapply (Htf … (refl …) (refl …) ?)
223 [#x >reverse_cons #membx cases (memb_append … membx) -membx #membx
224 [cases (memb_append … membx) -membx #membx
225 [@Hl2marks >Heq @memb_append_l1 @daemon
226 |>(memb_single … membx) //]
227 |cases (memb_append … membx) -membx #membx
228 [@Hl1marks @daemon |>(memb_single … membx) //]
230 | #Htf >Htf >reverse_append >reverse_reverse
231 >reverse_append >reverse_reverse >associative_append
232 >reverse_single >associative_append >associative_append
233 >associative_append %
238 definition exec_action ≝
239 init_copy · copy · move_r … · move_tape.
241 definition map_move ≝
242 λc,mv.match c with [ null ⇒ None ? | _ ⇒ Some ? 〈c,false,move_of_unialpha mv〉 ].
244 (* - aggiungere a legal_tape le condizioni
245 only_bits ls, rs; bit_or_null c
246 - ci vuole un lemma che dimostri
247 bit_or_null c1 = true bit_or_null mv = true
248 mv ≠ null → c1 ≠ null
249 dal fatto che c1 e mv sono contenuti nella table
251 definition R_exec_action ≝ λt1,t2.
252 ∀n,curconfig,ls,rs,c0,c1,s0,s1,table1,newconfig,mv,table2.
253 table_TM n (table1@〈comma,false〉::〈s1,false〉::newconfig@〈c1,false〉::〈comma,false〉::〈mv,false〉::table2) →
254 no_marks curconfig → only_bits (curconfig@[〈s0,false〉]) →
255 only_bits (〈s1,false〉::newconfig) → bit_or_null c1 = true →
256 |curconfig| = |newconfig| →
257 legal_tape ls 〈c0,false〉 rs →
258 t1 = midtape STape (〈c0,false〉::curconfig@〈s0,false〉::〈grid,false〉::ls) 〈grid,false〉
259 (table1@〈comma,true〉::〈s1,false〉::newconfig@〈c1,false〉::〈comma,false〉::〈mv,false〉::table2@〈grid,false〉::rs) →
260 ∀t1'.t1' = lift_tape ls 〈c0,false〉 rs →
262 t2 = midtape STape ls1 〈grid,false〉
263 (〈s1,false〉::newconfig@〈c2,false〉::〈grid,false〉::
264 table1@〈comma,false〉::〈s1,false〉::newconfig@〈c1,false〉::〈comma,false〉::〈mv,false〉::table2@〈grid,false〉::rs1) ∧
265 lift_tape ls1 〈c2,false〉 rs1 =
266 tape_move STape t1' (map_move c1 mv) ∧ legal_tape ls1 〈c2,false〉 rs1.
268 (* move the following 2 lemmata to mono.ma *)
269 lemma tape_move_left_eq :
271 tape_move ? t (Some ? 〈c,L〉) =
272 tape_move_left ? (left ? t) c (right ? t).
276 lemma tape_move_right_eq :
278 tape_move ? t (Some ? 〈c,R〉) =
279 tape_move_right ? (left ? t) c (right ? t).
283 lemma lift_tape_not_null :
284 ∀ls,c,bc,rs.c ≠ null → lift_tape ls 〈c,bc〉 rs = midtape ? ls 〈c,bc〉 rs.
285 #ls #c #bc #rs cases c //
286 #Hfalse @False_ind /2/
289 lemma merge_char_not_null :
290 ∀c1,c2.c1 ≠ null → merge_char c1 c2 ≠ null.
291 #c1 #c2 @not_to_not cases c2
292 [ #c1' normalize #Hfalse destruct (Hfalse)
294 | *: normalize #Hfalse destruct (Hfalse)
298 lemma merge_char_null : ∀c.merge_char null c = c.
302 lemma merge_char_cases : ∀c1,c2.merge_char c1 c2 = c1 ∨ merge_char c1 c2 = c2.
309 (* lemma merge_char_c_bit :
310 ∀c1,c2.is_bit c2 = true → merge_char c1 c2 = c2.
313 |*: normalize #Hfalse destruct (Hfalse) ]
316 lemma merge_char_c_bit :
317 ∀c1,c2.is_null c2 = true → merge_char c1 c2 = c1.
320 |*: normalize #Hfalse destruct (Hfalse) ]
325 lemma sem_exec_action : Realize ? exec_action R_exec_action.
327 cases (sem_seq … sem_init_copy
329 (sem_seq … (sem_move_r …) sem_move_tape )) intape)
330 #k * #outc * #Hloop #HR
331 @(ex_intro ?? k) @(ex_intro ?? outc) % [ @Hloop ] -Hloop
332 #n #curconfig #ls #rs #c0 #c1 #s0 #s1 #table1 #newconfig #mv #table2
333 #Htable #Hcurconfig1 #Hcurconfig2 #Hnewconfig #Hc1 #Hlen #Htape #Hintape #t1' #Ht1'
334 cases HR -HR #ta * whd in ⊢ (%→?); #Hta
335 lapply (Hta (〈c0,false〉::curconfig) table1 s0 ls s1
336 (newconfig@〈c1,false〉::〈comma,false〉::〈mv,false〉::table2@〈grid,false〉::rs) … Hintape) -Hta
337 [ (*Hcurconfig2*) @daemon
339 | (*bit_or_null c0 = true *) @daemon
340 | (*Hcurconfig1*) @daemon
341 | #Hta * #tb * whd in ⊢ (%→?); #Htb
342 lapply (Htb (〈grid,false〉::ls) s0 s1 c0 c1 (〈mv,false〉::table2@〈grid,false〉::rs) newconfig (〈comma,false〉::reverse ? table1) curconfig Hta ????????) -Htb
343 [9:|*:(* bit_or_null c0,c1; |curconfig| = |newconfig|*) @daemon ]
344 #Htb * #tc * whd in ⊢ (%→?); * #_ #Htc lapply (Htc … Htb) -Htc whd in ⊢(???(??%%%)→?);#Htc
345 whd in ⊢ (%→?); #Houtc whd in Htc:(???%); whd in Htc:(???(??%%%));
347 (〈comma,false〉::〈c1,false〉::reverse ? newconfig@〈s1,false〉::〈comma,false〉::reverse ? table1)
348 mv table2 (merge_char c0 c1) (reverse ? newconfig@[〈s1,false〉]) ls ????????)
349 [3: cases Htape -Htape * * #Hnomarks #Hbits #Hc0 #Hlsrs % [ % [ %
350 [ #x #Hx cases (orb_true_l … Hx) #Hx'
352 | @Hnomarks @memb_cons // ]
354 | cases (merge_char_cases c0 c1) #Hmerge >Hmerge // ]
355 | cases (true_or_false (c0 == null)) #Hc0'
358 [ >(\P Hc0') * #Hfalse @False_ind /2/
361 | % % @merge_char_not_null @(\Pf Hc0') ] ]
362 |4:>Htc @(eq_f3 … (midtape ?))
363 [ @eq_f @eq_f >associative_append >associative_append %
367 || >reverse_cons >reverse_cons >reverse_append >reverse_reverse
368 >reverse_cons >reverse_cons >reverse_reverse
369 >associative_append >associative_append >associative_append
370 >associative_append >associative_append
372 | (* well formedness of table *) @daemon
373 | (* Hnewconfig *) @daemon
374 | (* bit_or_null mv = true (well formedness of table) *) @daemon
375 | -Houtc * #ls1 * #rs1 * #newc * #Hnewtapelegal * #Houtc *
378 @(ex_intro ?? ls1) @(ex_intro ?? rs1) @(ex_intro ?? newc)
381 [ >Houtc -Houtc >reverse_append
382 >reverse_reverse >reverse_single @eq_f
383 >reverse_cons >reverse_cons >reverse_append >reverse_cons
384 >reverse_cons >reverse_reverse >reverse_reverse
385 >associative_append >associative_append
386 >associative_append >associative_append
387 >associative_append >associative_append %
388 | >Hmv >Ht1' >Htapemove
389 (* mv = bit false -→ c1 = bit ? *)
390 cut (∃c1'.c1 = bit c1') [ @daemon ] * #c1' #Hc1
391 >Hc1 >tape_move_left_eq >(legal_tape_left … Htape)
392 >(legal_tape_right … Htape) %
397 @(ex_intro ?? ls1) @(ex_intro ?? rs1) @(ex_intro ?? newc) %
399 [ >Houtc -Houtc >reverse_append
400 >reverse_reverse >reverse_single @eq_f
401 >reverse_cons >reverse_cons >reverse_append >reverse_cons
402 >reverse_cons >reverse_reverse >reverse_reverse
403 >associative_append >associative_append
404 >associative_append >associative_append
405 >associative_append >associative_append %
406 |>Hmv >Ht1' >Htapemove
407 cut (∃c1'.c1 = bit c1') [ @daemon ] * #c1' #Hc1
408 >Hc1 >tape_move_right_eq >(legal_tape_left … Htape)
409 >(legal_tape_right … Htape) %
414 | * * * #Hmv #Hlseq #Hrseq #Hnewc
415 @(ex_intro ?? ls1) @(ex_intro ?? rs1) @(ex_intro ?? newc) %
417 [ >Houtc -Houtc >reverse_append
418 >reverse_reverse >reverse_single @eq_f
419 >reverse_cons >reverse_cons >reverse_append >reverse_cons
420 >reverse_cons >reverse_reverse >reverse_reverse
421 >associative_append >associative_append
422 >associative_append >associative_append
423 >associative_append >associative_append %
424 |>Hmv >Ht1' cases c1 in Hnewc;
425 [ #c1' whd in ⊢ (??%?→?);#Hnewc <Hnewc
426 >Hlseq >Hrseq whd in ⊢ (??%%);
427 >(legal_tape_left … Htape) >(legal_tape_right … Htape) %
428 | whd in ⊢ (??%?→?); #Hnewc >Hnewc >Hlseq >Hrseq %
429 |*: whd in ⊢ (??%?→?);#Hnewc <Hnewc
430 >Hlseq >Hrseq whd in ⊢ (??%%);
431 >(legal_tape_left … Htape) >(legal_tape_right … Htape) %
442 if is_false(current) (* current state is not final *)
445 if is_marked(current) = false (* match ok *)
453 definition uni_step ≝
454 ifTM ? (test_char STape (λc.\fst c == bit false))
456 (init_match · match_tuple ·
457 (ifTM ? (test_char ? (λc.¬is_marked ? c))
458 (exec_action · move_r …)
462 definition R_uni_step_true ≝ λt1,t2.
463 ∀n,table,s0,s1,c0,c1,ls,rs,curconfig,newconfig,mv.
464 0 < |table| → table_TM (S n) table →
465 match_in_table (S n) (〈s0,false〉::curconfig) 〈c0,false〉
466 (〈s1,false〉::newconfig) 〈c1,false〉 〈mv,false〉 table →
467 legal_tape ls 〈c0,false〉 rs →
468 t1 = midtape STape (〈grid,false〉::ls) 〈s0,false〉
469 (curconfig@〈c0,false〉::〈grid,false〉::table@〈grid,false〉::rs) →
470 ∀t1'.t1' = lift_tape ls 〈c0,false〉 rs →
473 (t2 = midtape STape (〈grid,false〉::ls1) 〈s1,false〉
474 (newconfig@〈c2,false〉::〈grid,false〉::table@〈grid,false〉::rs1) ∧
475 lift_tape ls1 〈c2,false〉 rs1 =
476 tape_move STape t1' (map_move c1 mv) ∧ legal_tape ls1 〈c2,false〉 rs1).
478 definition R_uni_step_false ≝ λt1,t2.
479 ∀b. current STape t1 = Some ? 〈bit b,false〉 → b = true ∧ t2 = t1.
481 (*axiom sem_match_tuple : Realize ? match_tuple R_match_tuple.*)
483 definition us_acc : states ? uni_step ≝ (inr … (inl … (inr … start_nop))).
485 definition Pre_uni_step ≝ λt1.
486 ∃n,table,s0,s1,c0,c1,ls,rs,curconfig,newconfig,mv.
487 0 < |table| ∧ table_TM (S n) table ∧
488 match_in_table (S n) (〈s0,false〉::curconfig) 〈c0,false〉
489 (〈s1,false〉::newconfig) 〈c1,false〉 〈mv,false〉 table ∧
490 legal_tape ls 〈c0,false〉 rs ∧
491 t1 = midtape STape (〈grid,false〉::ls) 〈s0,false〉
492 (curconfig@〈c0,false〉::〈grid,false〉::table@〈grid,false〉::rs).
495 accGRealize ? uni_step us_acc Pre_uni_step
496 R_uni_step_true R_uni_step_false.
497 @(acc_sem_if_app_guarded STape … (sem_test_char ? (λc:STape.\fst c == bit false))
498 ? (test_char_inv …) (sem_nop …) …)
499 [| @(sem_seq_app_guarded … (Realize_to_GRealize … sem_init_match) ???)
501 | 3: @(sem_seq_app_guarded … sem_match_tuple
502 (Realize_to_GRealize … (sem_if ????????? (sem_test_char … (λc.¬is_marked FSUnialpha c))
503 (sem_seq … sem_exec_action (sem_move_r …))
508 ||| #t1 #t2 * #n * #table * #s0 * #s1 * #c0 * #c1 * #ls * #rs * #curconfig
509 * #newconfig * #mv * * * *
510 #Hlen1 #Htable #Hmatch #Hlegal #Ht1
512 cut (∃tup,table0.table = tup@table0 ∧ tuple_TM (S n) tup)
514 * #tup * #table0 * #Htableeq * #qin * #cin * #qout * #cout * #mv0
516 #Hqinnomarks #_ #Hqinbits #_ #_ #_ #_ #_ #Hqinlen #_ #Htupeq
517 cut (∃d,qin0.qin = 〈d,false〉::qin0)
518 [ lapply Hqinlen lapply Hqinnomarks -Hqinlen -Hqinnomarks cases qin
519 [ #_ normalize in ⊢ (%→?); #Hfalse destruct (Hfalse)
520 | * #d #bd #qin0 #Hqinnomarks #_ %{d} %{qin0}
522 @(Hqinnomarks 〈d,bd〉) @memb_hd ] ]
525 lapply (Ht2 (〈grid,false〉::ls) (curconfig@[〈c0,false〉])
526 (qin0@〈cin,false〉::〈comma,false〉::qout@〈cout,false〉::〈comma,false〉::〈mv0,false〉::table0@〈grid,false〉::rs) s0 d ???)
527 [ >Ht1 @eq_f >associative_append @eq_f @eq_f @eq_f
528 >Htableeq >Htupeq >associative_append whd in ⊢ (??%?);
529 @eq_f >Hqineq >associative_append @eq_f whd in ⊢ (??%?);
530 @eq_f whd in ⊢ (??%?); @eq_f
531 >associative_append %
535 #Ht2 % [| % [| % [| % [ @Ht2 ]
539 l1 = curconfig@[〈c0,false〉]
542 l3 = qin0@[〈cin,false〉]
543 l4 = qout@〈cout,false〉::〈comma,false〉::〈mv0,false〉::table0
547 %{ls} %{s0} %{(curconfig@[〈c0,false〉])}
548 %{([〈bar,false〉])} %{d} %{(qin0@[〈cin,false〉])}
549 %{(qout@〈cout,false〉::〈comma,false〉::〈mv0,false〉::table0)}
550 %{rs} %{n} @daemon (* TODO *)
556 #ta whd in ⊢ (%→?); #Hta #HR
557 #n #fulltable #s0 #s1 #c0 #c1 #ls #rs #curconfig #newconfig #mv
558 #Htable_len cut (∃t0,table. fulltable =〈bar,false〉::〈t0,false〉::table) [(* 0 < |table| *) @daemon]
559 * #t0 * #table #Hfulltable >Hfulltable -fulltable
560 #Htable #Hmatch #Htape #Hintape #t1' #Ht1'
561 >Hintape in Hta; * * * #c #bc *
562 whd in ⊢ (??%?→?); #HSome destruct (HSome) #Hc #Hta % [@(\P Hc)]
564 #tb * whd in ⊢ (%→?); #Htb
565 lapply (Htb (〈grid,false〉::ls) (curconfig@[〈c0,false〉]) (table@〈grid,false〉::rs) c t0 ???)
566 [ >Hta >associative_append %
570 #tc * whd in ⊢ (%→?); #Htc cases (Htc … Htable … Htb) -Htb -Htc
571 [| * #Hcurrent #Hfalse @False_ind
572 (* absurd by Hmatch *) @daemon
574 | (* Htable (con lemma) *) @daemon
575 | (* Hmatch *) @daemon
576 | (* Htable *) @daemon
577 | (* Htable, Hmatch → |config| = n
578 necessaria modifica in R_match_tuple, le dimensioni non corrispondono
581 * #table1 * #newc * #mv1 * #table2 * #Htableeq #Htc *
582 [ * #td * whd in ⊢ (%→?); >Htc -Htc * * #c2 * whd in ⊢ (??%?→?); #Hc2 destruct (Hc2)
584 cut (newc = 〈s1,false〉::newconfig@[〈c1,false〉]) [@daemon] #Hnewc
585 >Hnewc cut (mv1 = 〈mv,false〉)
587 * #te * whd in ⊢ (%→?); #Hte
588 cut (td = midtape STape (〈c0,false〉::reverse STape curconfig@〈c,false〉::〈grid,false〉::ls)
590 ((table1@〈bar,false〉::〈c,false〉::curconfig@[〈c0,false〉])@〈comma,true〉::〈s1,false〉::
591 newconfig@〈c1,false〉::〈comma,false〉::〈mv,false〉::table2@〈grid,false〉::rs))
593 [ >reverse_append >reverse_single %
594 | >associative_append >associative_append normalize
595 >associative_append >Hmv1 >Hnewc @eq_f @eq_f @eq_f @eq_f @eq_f @eq_f
596 whd in ⊢ (??%?); >associative_append %
599 -Htd #Htd lapply (Hte … (S n) … Htd … Ht1') -Htd -Hte
601 | (*|curconfig| = |newconfig|*) @daemon
602 | (* Htable → bit_or_null c1 = true *) @daemon
603 | (* only_bits (〈s1,false〉::newconfig) *) @daemon
604 | (* only_bits (curconfig@[〈s0,false〉]) *) @daemon
605 | (* no_marks (reverse ? curconfig) *) @daemon
606 | >Hmv1 in Htableeq; >Hnewc
607 >associative_append >associative_append normalize
608 >associative_append >associative_append
609 #Htableeq <Htableeq // ]
610 * #ls1 * #rs1 * #c2 * * #Hte #Hliftte #Hlegalte
611 whd in ⊢ (%→?); * #_ #Houttape lapply (Houttape … Hte) -Houttape #Houttape
612 whd in Houttape:(???%); whd in Houttape:(???(??%%%));
613 @ex_intro [| @(ex_intro ?? rs1) @ex_intro [| % [ %
614 [ >Houttape @eq_f @eq_f @eq_f @eq_f
615 change with ((〈bar,false〉::〈t0,false〉::table)@?) in ⊢ (???%);
616 >Htableeq >associative_append >associative_append
617 >associative_append normalize >associative_append
618 >associative_append normalize >Hnewc <Hmv1
619 >associative_append normalize >associative_append
627 | * #td * whd in ⊢ (%→%→?); >Htc * #Htd
628 lapply (Htd ? (refl ??)) normalize in ⊢ (%→?);
629 #Hfalse destruct (Hfalse)
632 | #t1 #t2 #t3 whd in ⊢ (%→%→?); #Ht1 #Ht2
633 #b #Hb >Hb in Ht1; * #Hc #Ht1 lapply (Hc ? (refl ??)) -Hc #Hb' %
634 // cases b in Hb'; normalize #H1 //
639 @(acc_sem_if_app STape … (sem_test_char ? (λc:STape.\fst c == bit false))
640 (sem_seq … sem_init_match
641 (sem_seq … sem_match_tuple
642 (sem_if … (* ????????? (sem_test_char … (λc.¬is_marked FSUnialpha c)) *)
643 (sem_seq … sem_exec_action (sem_move_r …))
649 #ta whd in ⊢ (%→?); #Hta #HR
650 #n #fulltable #s0 #s1 #c0 #c1 #ls #rs #curconfig #newconfig #mv
651 #Htable_len cut (∃t0,table. fulltable =〈bar,false〉::〈t0,false〉::table) [(* 0 < |table| *) @daemon]
652 * #t0 * #table #Hfulltable >Hfulltable -fulltable
653 #Htable #Hmatch #Htape #Hintape #t1' #Ht1'
654 >Hintape in Hta; * * * #c #bc *
655 whd in ⊢ (??%?→?); #HSome destruct (HSome) #Hc #Hta % [@(\P Hc)]
657 #tb * whd in ⊢ (%→?); #Htb
658 lapply (Htb (〈grid,false〉::ls) (curconfig@[〈c0,false〉]) (table@〈grid,false〉::rs) c t0 ???)
659 [ >Hta >associative_append %
663 #tc * whd in ⊢ (%→?); #Htc cases (Htc … Htable … Htb) -Htb -Htc
664 [| * #Hcurrent #Hfalse @False_ind
665 (* absurd by Hmatch *) @daemon
667 | (* Htable (con lemma) *) @daemon
668 | (* Hmatch *) @daemon
669 | (* Htable *) @daemon
670 | (* Htable, Hmatch → |config| = n
671 necessaria modifica in R_match_tuple, le dimensioni non corrispondono
674 * #table1 * #newc * #mv1 * #table2 * #Htableeq #Htc *
675 [ * #td * whd in ⊢ (%→?); >Htc -Htc * * #c2 * whd in ⊢ (??%?→?); #Hc2 destruct (Hc2)
677 cut (newc = 〈s1,false〉::newconfig@[〈c1,false〉]) [@daemon] #Hnewc
678 >Hnewc cut (mv1 = 〈mv,false〉)
680 * #te * whd in ⊢ (%→?); #Hte
681 cut (td = midtape STape (〈c0,false〉::reverse STape curconfig@〈c,false〉::〈grid,false〉::ls)
683 ((table1@〈bar,false〉::〈c,false〉::curconfig@[〈c0,false〉])@〈comma,true〉::〈s1,false〉::
684 newconfig@〈c1,false〉::〈comma,false〉::〈mv,false〉::table2@〈grid,false〉::rs))
686 [ >reverse_append >reverse_single %
687 | >associative_append >associative_append normalize
688 >associative_append >Hmv1 >Hnewc @eq_f @eq_f @eq_f @eq_f @eq_f @eq_f
689 whd in ⊢ (??%?); >associative_append %
692 -Htd #Htd lapply (Hte … (S n) … Htd … Ht1') -Htd -Hte
694 | (*|curconfig| = |newconfig|*) @daemon
695 | (* Htable → bit_or_null c1 = true *) @daemon
696 | (* only_bits (〈s1,false〉::newconfig) *) @daemon
697 | (* only_bits (curconfig@[〈s0,false〉]) *) @daemon
698 | (* no_marks (reverse ? curconfig) *) @daemon
699 | >Hmv1 in Htableeq; >Hnewc
700 >associative_append >associative_append normalize
701 >associative_append >associative_append
702 #Htableeq <Htableeq // ]
703 * #ls1 * #rs1 * #c2 * * #Hte #Hliftte #Hlegalte
704 whd in ⊢ (%→?); * #_ #Houttape lapply (Houttape … Hte) -Houttape #Houttape
705 whd in Houttape:(???%); whd in Houttape:(???(??%%%));
706 @ex_intro [| @(ex_intro ?? rs1) @ex_intro [| % [ %
707 [ >Houttape @eq_f @eq_f @eq_f @eq_f
708 change with ((〈bar,false〉::〈t0,false〉::table)@?) in ⊢ (???%);
709 >Htableeq >associative_append >associative_append
710 >associative_append normalize >associative_append
711 >associative_append normalize >Hnewc <Hmv1
712 >associative_append normalize >associative_append
720 | * #td * whd in ⊢ (%→%→?); >Htc * #Htd
721 lapply (Htd ? (refl ??)) normalize in ⊢ (%→?);
722 #Hfalse destruct (Hfalse)
725 | #t1 #t2 #t3 whd in ⊢ (%→%→?); #Ht1 #Ht2
726 #b #Hb >Hb in Ht1; * #Hc #Ht1 lapply (Hc ? (refl ??)) -Hc #Hb' %
727 // cases b in Hb'; normalize #H1 //