]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/lib/turing/universal/copy.ma
Progress.
[helm.git] / matita / matita / lib / turing / universal / copy.ma
1 (*
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.           
5     ||I||                                                            
6     ||T||  
7     ||A||  
8     \   /  This file is distributed under the terms of the       
9      \ /   GNU General Public License Version 2   
10       V_____________________________________________________________*)
11
12
13 include "turing/universal/tuples.ma".
14
15 definition write_states ≝ initN 2.
16
17 definition wr0 : write_states ≝ mk_Sig ?? 0 (leb_true_to_le 1 2 (refl …)).
18 definition wr1 : write_states ≝ mk_Sig ?? 1 (leb_true_to_le 2 2 (refl …)).
19
20 definition write ≝ λalpha,c.
21   mk_TM alpha write_states
22   (λp.let 〈q,a〉 ≝ p in
23     match pi1 … q with 
24     [ O ⇒ 〈wr1,Some ? 〈c,N〉〉
25     | S _ ⇒ 〈wr1,None ?〉 ])
26   wr0 (λx.x == wr1).
27   
28 definition R_write ≝ λalpha,c,t1,t2.
29   ∀ls,x,rs.t1 = midtape alpha ls x rs → t2 = midtape alpha ls c rs.
30   
31 axiom sem_write : ∀alpha,c.Realize ? (write alpha c) (R_write alpha c).
32
33 definition copy_step_subcase ≝
34   λalpha,c,elseM.ifTM ? (test_char ? (λx.x == 〈c,true〉))
35     (seq (FinProd alpha FinBool) (adv_mark_r …)
36       (seq ? (move_l …)
37         (seq ? (adv_to_mark_l … (is_marked alpha))
38           (seq ? (write ? 〈c,false〉)
39             (seq ? (move_r …)
40               (seq ? (mark …)
41                 (seq ? (move_r …) (adv_to_mark_r … (is_marked alpha)))))))))
42     elseM tc_true.
43
44 definition R_copy_step_subcase ≝ 
45   λalpha,c,RelseM,t1,t2.
46     ∀a,l1,x0,a0,l2,x,l3.
47     t1 = midtape (FinProd … alpha FinBool) (l1@〈a0,false〉::〈x0,true〉::l2) 
48          〈x,true〉 (〈a,false〉::l3) → 
49     (∀c.memb ? c l1 = true → is_marked ? c = false) →          
50     (x = c ∧ t2 = midtape ? (〈x,false〉::l1@〈a0,true〉::〈x,false〉::l2) 〈a,true〉 l3) ∨
51     (x ≠ c ∧ RelseM t1 t2).
52     
53 axiom sem_copy_step_subcase : 
54   ∀alpha,c,elseM,RelseM.
55   Realize ? (copy_step_subcase alpha c elseM) (R_copy_step_subcase alpha c RelseM).
56     
57 (*
58 if current = 0,tt
59    then advance_mark_r;
60         move_l;
61         advance_to_mark_l;
62         write(0,ff)
63         move_r;
64         mark;
65         move_r;
66         advance_to_mark_r;
67 else if current = 1,tt
68    then advance_mark_r;
69         move_l;
70         advance_to_mark_l;
71         write(1,ff)
72         move_r;
73         mark;
74         move_r;
75         advance_to_mark_r;
76 else if current = null 
77    then advance_mark_r;
78         move_l;
79         advance_to_mark_l
80         adv_mark_r;
81         move_r;
82         advance_to_mark_r
83 *)
84
85 definition nocopy_subcase ≝
86   ifTM STape (test_char ? (λx:STape.x == 〈null,true〉))
87     (seq ? (adv_mark_r …)
88       (seq ? (move_l …)
89         (seq ? (adv_to_mark_l … (is_marked ?))
90           (seq ? (adv_mark_r …)
91             (seq ? (move_r …) (adv_to_mark_r … (is_marked ?)))))))
92     (nop ?) tc_true.
93
94 definition R_nocopy_subcase ≝ 
95   λt1,t2.
96     ∀a,l1,x0,a0,l2,x,l3.
97     t1 = midtape STape (l1@〈a0,false〉::〈x0,true〉::l2) 
98          〈x,true〉 (〈a,false〉::l3) → 
99     (∀c.memb ? c l1 = true → is_marked ? c = false) →          
100     (x = null ∧
101      t2 = midtape ? (〈x,false〉::l1@〈a0,true〉::〈x0,false〉::l2) 〈a,true〉 l3) ∨
102     (x ≠ null ∧ t2 = t1).
103     
104 axiom sem_nocopy_subcase : Realize ? nocopy_subcase R_nocopy_subcase.
105 (* #intape
106 cases (sem_if ? (test_char ? (λx:STape.x == 〈null,true〉)) ?????? tc_true
107  (sem_test_char ? (λx:STape.x == 〈null,true〉))
108         (sem_seq … (sem_adv_mark_r …)
109            (sem_seq … (sem_move_l …)
110              (sem_seq … (sem_adv_to_mark_l … (is_marked ?))
111                (sem_seq … (sem_adv_mark_r …)
112                  (sem_seq … (sem_move_r …) (sem_adv_to_mark_r … (is_marked ?))
113                  ))))) (sem_nop ?) intape)
114 #k * #outc * #Hloop #HR @(ex_intro ?? k) @(ex_intro ?? outc)  % [@Hloop] -Hloop
115 cases HR -HR
116 [| * #ta * whd in ⊢ (%→%→?); #Hta #Houtc
117    #ls #x #rs #Hintape %2  >Hintape in Hta; #Hta cases (Hta ? (refl ??)) -Hta #Hx #Hta %
118    [ lapply (\Pf Hx) @not_to_not #Hx' >Hx' %
119    | <Hta @Houtc ] ]
120 @daemon
121 qed. *)
122
123 definition copy_step ≝
124   ifTM ? (test_char STape (λc.is_bit (\fst c)))
125   (single_finalTM ? (copy_step_subcase FSUnialpha (bit false)
126     (copy_step_subcase FSUnialpha (bit true) nocopy_subcase)))
127   (nop ?)
128   tc_true.
129   
130 definition R_copy_step_true ≝ 
131   λt1,t2.
132     ∀ls,c,rs. t1 = midtape STape ls 〈c,true〉 rs → 
133     bit_or_null c = true ∧
134     (∀a,l1,x0,a0,l2,l3.
135      ls = (l1@〈a0,false〉::〈x0,true〉::l2) → 
136      rs = (〈a,false〉::l3) → 
137      no_marks l1 →          
138      ((∃x. c = bit x ∧
139       t2 = midtape STape (〈bit x,false〉::l1@〈a0,true〉::〈bit x,false〉::l2) 〈a,true〉 l3) ∨
140       (c = null ∧
141       t2 = midtape ? (〈null,false〉::l1@〈a0,true〉::〈x0,false〉::l2) 〈a,true〉 l3))).
142      
143 definition R_copy_step_false ≝ 
144   λt1,t2.
145    ∀ls,c,rs.t1 = midtape (FinProd … FSUnialpha FinBool) ls c rs → 
146    bit_or_null (\fst c) = false ∧ t2 = t1.
147
148 axiom sem_copy_step : 
149   accRealize ? copy_step (inr … (inl … (inr … start_nop))) R_copy_step_true R_copy_step_false.
150
151 (*
152 1) il primo carattere è marcato
153 2) l'ultimo carattere è l'unico che può essere null, gli altri sono bit
154 3) il terminatore non è né bit, né null
155 *)
156    
157 definition copy0 ≝ whileTM ? copy_step (inr … (inl … (inr … start_nop))).
158
159 let rec merge_config (l1,l2:list STape) ≝ 
160   match l1 with
161   [ nil ⇒ nil ?
162   | cons p1 l1' ⇒ match l2 with
163     [ nil ⇒ nil ? 
164     | cons p2 l2' ⇒ 
165            let 〈c1,b1〉 ≝ p1 in let 〈c2,b2〉 ≝ p2 in
166            match c2 with
167            [ null ⇒ p1
168            | _ ⇒ p2 ] :: merge_config l1' l2' ] ].
169            
170 lemma merge_config_append :
171  ∀l1,l2,l3,l4.|l1| = |l2| → 
172  merge_config (l1@l3) (l2@l4) = merge_config l1 l2@merge_config l3 l4.
173 #l1 #l2 #l3 #l4 #Hlen @(list_ind2 … Hlen)
174 [normalize //
175 | #t1 #t2 * #c1 #b1 * #c2 #b2 #IH whd in ⊢ (??%%); >IH % ]
176 qed.
177
178 definition R_copy0 ≝ λt1,t2.
179   ∀ls,c,c0,rs,l1,l3,l4.
180   t1 = midtape STape (l3@l4@〈c0,true〉::ls) 〈c,true〉 (l1@rs) → 
181   no_marks l1 → no_marks (l3@l4) → |l1| = |l4| → 
182   ∀l1',bv.〈c,false〉::l1 = l1'@[〈comma,bv〉] → only_bits_or_nulls l1' → 
183   ∀l4',bg.l4@[〈c0,false〉] = 〈grid,bg〉::l4' → only_bits_or_nulls l4' → 
184   (c = comma ∧ t2 = t1) ∨
185   (c ≠ comma ∧ 
186     t2 = midtape ? (reverse ? l1'@l3@〈grid,true〉::
187                   merge_config l4' (reverse ? l1')@ls) 
188      〈comma,true〉 rs).
189      
190 lemma inj_append_singleton_l1 :
191   ∀A.∀l1,l2:list A.∀a1,a2.l1@[a1] = l2@[a2] → l1 = l2.
192 #A #l1 #l2 #a1 #a2 #H lapply (eq_f … (reverse ?) … H)
193 >reverse_append >reverse_append normalize #H1 destruct
194 lapply (eq_f … (reverse ?) … e0) >reverse_reverse >reverse_reverse //
195 qed.
196
197 lemma inj_append_singleton_l2 :
198   ∀A.∀l1,l2:list A.∀a1,a2.l1@[a1] = l2@[a2] → a1 = a2.
199 #A #l1 #l2 #a1 #a2 #H lapply (eq_f … (reverse ?) … H)
200 >reverse_append >reverse_append normalize #H1 destruct %
201 qed.
202
203 axiom length_reverse : ∀A,l.|reverse A l| = |l|.
204
205 lemma wsem_copy0 : WRealize ? copy0 R_copy0.
206 #intape #k #outc #Hloop 
207 lapply (sem_while … sem_copy_step intape k outc Hloop) [%] -Hloop
208 * #ta * #Hstar @(star_ind_l ??????? Hstar)
209 [ #tb whd in ⊢ (%→?); #Hleft
210   #ls #c #c0 #rs #l1 #l3 #l4 #Htb #Hl1nomarks #Hl3l4nomarks #Hlen #l1' #bv
211   #Hl1 #Hl1bits #l4' #bg #Hl4 #Hl4bits
212   cases (Hleft … Htb) -Hleft #Hc #Houtc % %
213   [ generalize in match Hl1bits; -Hl1bits cases l1' in Hl1;
214     [ normalize #Hl1 #c1 destruct (Hl1) %
215     | * #c' #b' #l0 #Heq normalize in Heq; destruct (Heq)
216       #Hl1bits lapply (Hl1bits 〈c',false〉 ?) [ @memb_hd ] 
217       >Hc #Hfalse destruct ]
218   | @Houtc ]
219 | #tb #tc #td whd in ⊢ (%→?→(?→%)→%→?); #Htc #Hstar1 #Hind #Htd
220   lapply (Hind Htd) -Hind #Hind
221   #ls #c #c0 #rs #l1 #l3 #l4 #Htb #Hl1nomarks #Hl3l4nomarks #Hlen #l1' #bv
222   #Hl1 #Hl1bits #l4' #bg #Hl4 #Hl4bits %2
223   cases (Htc … Htb) -Htc #Hcbitnull #Htc
224   % [ % #Hc' >Hc' in Hcbitnull; normalize #Hfalse destruct (Hfalse) ]
225   cut (|l1| = |reverse ? l4|) [@daemon] #Hlen1
226   @(list_cases_2 … Hlen1)
227   [ (* case l1 = [] is discriminated because l1 contains at least comma *)
228     #Hl1nil @False_ind >Hl1nil in Hl1; cases l1' normalize
229     [ #Hl1 destruct normalize in Hcbitnull; destruct (Hcbitnull)
230     | #p0 #l0 normalize #Hfalse destruct (Hfalse) cases l0 in e0;
231       [ normalize #Hfalse1 destruct (Hfalse1)
232       | #p0' #l0' normalize #Hfalse1 destruct (Hfalse1) ] ]
233   | (* case c::l1 = c::a::l1'' *)
234     * #a #ba * #a0 #ba0 #l1'' #l4'' #Hl1cons #Hl4cons
235     lapply (eq_f ?? (reverse ?) ?? Hl4cons) >reverse_reverse >reverse_cons -Hl4cons #Hl4cons
236     cut (ba = false) 
237     [ >Hl1cons in Hl1nomarks; #Hl1nomarks lapply (Hl1nomarks 〈a,ba〉 ?)
238       [ @memb_hd | normalize // ] ] #Hba
239     cut (ba0 = false) 
240     [ >Hl4cons in Hl3l4nomarks; #Hl3l4nomarks lapply (Hl3l4nomarks 〈a0,ba0〉 ?)
241       [ @memb_append_l2 @memb_append_l2 @memb_hd | normalize // ] ] #Hba0
242     >Hba0 in Hl4cons; >Hba in Hl1cons; -Hba0 -Hba #Hl1cons #Hl4cons
243     >Hl4cons in Htc; >Hl1cons #Htc
244     lapply (Htc a (l3@reverse ? l4'') c0 a0 ls (l1''@rs) ? (refl ??) ?)
245     [ #x #Hx @Hl3l4nomarks >Hl4cons <associative_append
246       @memb_append_l1 @Hx
247     | >associative_append >associative_append %
248     | -Htc
249       cut (∃la.l1' = 〈c,false〉::la)
250       [ >Hl1cons in Hl1; cases l1'
251         [normalize #Hfalse destruct (Hfalse)
252         | #p #la normalize #Hla destruct (Hla) @(ex_intro ?? la) % ] ]
253       * #la #Hla
254       cut (∃lb.l4' = lb@[〈c0,false〉])
255       [ >Hl4cons in Hl4;
256         @(list_elim_left … l4')
257         [ #Heq lapply (eq_f … (length ?) … Heq)
258           >length_append >length_append 
259           >commutative_plus normalize >commutative_plus normalize
260           #Hfalse destruct
261         | #a1 #tl #_ #Heq 
262           >(inj_append_singleton_l2 ? (reverse ? l4''@[〈a0,false〉]) (〈grid,bg〉::tl) 〈c0,false〉 a1 Heq)
263           @ex_intro //
264       ] ] * #lb #Hlb
265       cut (|lb| = |reverse ? la|) 
266       [ >Hla in Hl1; >Hlb in Hl4; #Hl4 #Hl1
267         >(?:l1 = la@[〈comma,bv〉]) in Hlen;
268         [|normalize in Hl1; destruct (Hl1) %]
269         >(?:l4 = 〈grid,bg〉::lb)
270         [|@(inj_append_singleton_l1 ?? (〈grid,bg〉::lb) ?? Hl4) ]
271         >length_append >commutative_plus >length_reverse
272         normalize #Hlalb destruct (Hlalb) //
273       ] #Hlen2
274       *
275       (* by hyp on the first iteration step, 
276          we consider whether c = bit x or c = null *)
277       (* c = bit x *)
278       [ * #x * #Hx #Htc 
279         lapply (Hind (〈bit x,false〉::ls) a a0 rs l1'' 
280                 (〈bit x,false〉::l3) (reverse ? l4'') ????) 
281         [ >Hl1cons in Hlen; >Hl4cons >length_append >commutative_plus 
282           normalize #Hlen destruct (Hlen) //
283         | #x0 #Hx0 cases (orb_true_l … Hx0)
284           [ #Hx0eq >(\P Hx0eq) %
285           | -Hx0 #Hx0 @Hl3l4nomarks >Hl4cons
286             <associative_append @memb_append_l1 // ]
287         | #x0 #Hx0 @Hl1nomarks >Hl1cons @memb_cons //
288         | >Htc >associative_append % 
289         | -Hind 
290           <Hl1cons <Hl4cons #Hind lapply (Hind la bv ?? lb bg ??)
291           [ #x0 #Hx0 @Hl4bits >Hlb @memb_append_l1 //
292           | >Hlb in Hl4; normalize in ⊢ (%→?); #Hl4
293             @(inj_append_singleton_l1 ? l4 (〈grid,bg〉::lb) … Hl4)
294           | #x0 #Hx0 @Hl1bits >Hla @memb_cons //
295           | >Hla in Hl1; normalize in ⊢ (%→?); #Hl1
296             destruct (Hl1) // ] -Hind
297           (* by IH, we proceed by cases, whether a = comma 
298              (consequently several lists = []) or not *)          
299           *
300           [ * #Ha #Houtc1
301 (*           cut (l1 = [〈a,false〉])
302            [ cases l1'' in Hl1cons; // #y #ly #Hly
303              >Hly in Hl1; cases l1' in Hl1bits;
304              [ #_ normalize #Hfalse destruct (Hfalse)
305              | #p #lp #Hl1bits normalize #Heq destruct (Heq)
306                @False_ind lapply (Hl1bits 〈a,false〉 ?)
307                [ cases lp in e0;
308                  [ normalize #Hfalse destruct (Hfalse)
309                  | #p0 #lp0 normalize in ⊢ (%→?); #Heq destruct (Heq)
310                    @memb_cons @memb_hd ]
311                | >Ha normalize #Hfalse destruct (Hfalse) ]
312              ]
313            ] #Hl1a
314            cut (l4 = [〈a0,false〉])
315            [ generalize in match Hl4bits; cases l4' in Hl4;
316              [ >Hl4cons #Hfalse #_ 
317                lapply (inj_append_singleton_l1 ?? [] ?? Hfalse)
318                cases (reverse ? l4'') normalize
319                [ #Hfalse1 | #p0 #lp0 #Hfalse1 ] destruct (Hfalse1)
320              | #p #lp 
321            
322              cases l4'' in Hl4cons; // #y #ly #Hly
323              >Hly in Hl4; cases l4' in Hl4bits;
324              [ #_ >reverse_cons #Hfalse
325                lapply (inj_append_singleton_l1 ?? [] ?? Hfalse)
326                -Hfalse cases ly normalize
327                [ #Hfalse | #p #Hp #Hfalse ] destruct (Hfalse)
328                 
329              | #p #lp #Hl1bits normalize #Heq destruct (Heq)
330                @False_ind lapply (Hl1bits 〈a,false〉 ?)
331                [ cases lp in e0;
332                  [ normalize #Hfalse destruct (Hfalse)
333                  | #p0 #lp0 normalize in ⊢ (%→?); #Heq destruct (Heq)
334                    @memb_cons @memb_hd ]
335                | >Ha normalize #Hfalse destruct (Hfalse) ]
336              ]
337            ] #Hl1a
338              
339               >Hla normalize #Hl1 destruct (Hl1) lapply (inj_append_ @False_ind
340              
341            cut (l1'' = [] ∧ l4'' = [])
342            [ % [ >Hla in Hl1; normalize #Hl1 destruct (Hl1)
343            
344             cases l1'' in Hl1bits;
345                 
346                  [ #_ normalize #H *)
347            cut (la = [] ∧ lb = [] ∧ l1'' = [] ∧ l4'' = [])
348            [ @daemon ] * * * #Hla1 #Hlb1 #Hl1nil #Hl4nil
349            >Hl1cons in Hl1; >Hla
350            >Houtc1 >Htc #Hl1
351            >Hl4cons in Hl4; >Hlb #Hl4
352            >Hla1 >Hlb1 >Hl1nil >Hl4nil >Hx
353            cut (a0 = grid) [ @daemon ] #Ha0 <Ha <Ha0
354            normalize in ⊢ (??(??%?%)(??%?%)); >associative_append %
355           | * #Ha #Houtc1 >Houtc1 @eq_f3 //
356             >Hla >reverse_cons >associative_append @eq_f
357             >Hx whd in ⊢ (??%?); @eq_f whd in ⊢ (???%); @eq_f @eq_f
358             >Hlb >append_cons @eq_f2 // >(merge_config_append … Hlen2) %            
359           ]
360        ]
361     | (* c = null *)
362       * #Hc #Htc 
363       lapply (Hind (〈c0,false〉::ls) a a0 rs l1'' (〈null,false〉::l3) (reverse ? l4'') ????)
364       [  >Hl1cons in Hlen; >Hl4cons >length_append >commutative_plus normalize
365          #Hlen destruct (Hlen) @e0
366       | #x0 #Hx0 cases (memb_append STape ? [〈null,false〉] (l3@reverse ? l4'') … Hx0) -Hx0 #Hx0
367         [ >(memb_single … Hx0) %
368         | @Hl3l4nomarks cases (memb_append … Hx0) -Hx0 #Hx0
369           [ @memb_append_l1 //
370           | @memb_append_l2 >Hl4cons @memb_append_l1 // ]
371         ]
372       | >Hl1cons #x' #Hx0 @Hl1nomarks >Hl1cons @memb_cons //
373       | >Htc @eq_f3 // >associative_append % ] -Hind <Hl1cons <Hl4cons #Hind
374         lapply (Hind la bv ?? lb bg ??)
375           [ #x0 #Hx0 @Hl4bits >Hlb @memb_append_l1 //
376           | >Hlb in Hl4; normalize in ⊢ (%→?); #Hl4
377             @(inj_append_singleton_l1 ? l4 (〈grid,bg〉::lb) … Hl4)
378           | #x0 #Hx0 @Hl1bits >Hla @memb_cons //
379           | >Hla in Hl1; normalize in ⊢ (%→?); #Hl1
380             destruct (Hl1) // ] -Hind *
381           (* by IH, we proceed by cases, whether a = comma 
382              (consequently several lists = []) or not *)          
383           [ * #Ha #Houtc1 >Hl1cons in Hl1; >Hla
384            >Houtc1 >Htc #Hl1
385            >Hl4cons in Hl4; >Hlb #Hl4
386            cut (la = [] ∧ lb = [] ∧ l1'' = [] ∧ l4'' = []) 
387            [@daemon] * * * #Hla1 #Hlb1 #Hl1nil #Hl4nil
388            >Hla1 >Hlb1 >Hl1nil >Hl4nil >Hc
389            cut (a0 = grid) [ @daemon ] #Ha0 <Ha <Ha0
390            normalize in ⊢ (??(??%?%)(??%?%)); >associative_append %
391           | * #Ha #Houtc1 >Houtc1 @eq_f3 //
392             >Hla >reverse_cons >associative_append @eq_f
393             >Hc whd in ⊢ (??%?); @eq_f whd in ⊢ (???%); @eq_f @eq_f
394             >Hlb >append_cons @eq_f2 // >(merge_config_append … Hlen2) %
395           ]
396        ]
397 ]]]
398 qed.
399
400 definition merge_char ≝ λc1,c2.
401   match c2 with
402   [ null ⇒ c1
403   | _ ⇒ c2 ].
404   
405 lemma merge_cons : 
406   ∀c1,c2,conf1,conf2.
407   merge_config (〈c1,false〉::conf1) (〈c2,false〉::conf2) = 
408     〈merge_char c1 c2,false〉::merge_config conf1 conf2.
409 #c1 #c2 #conf1 #conf2 normalize @eq_f2 //
410 cases c2 /2/
411 qed.
412
413 lemma merge_config_c_nil : 
414   ∀c.merge_config c [] = [].
415 #c cases c normalize //
416 qed.
417
418 axiom reverse_merge_config :
419   ∀c1,c2.|c1| = |c2| → reverse ? (merge_config c1 c2) = 
420     merge_config (reverse ? c1) (reverse ? c2).        
421
422 definition copy
423 ≝ 
424   seq STape (move_l …) (seq ? (adv_to_mark_l … (is_marked ?))
425    (seq ? (clear_mark …) (seq ? (adv_to_mark_r … (is_marked ?)) (clear_mark …)))).
426
427 (*
428    s0, s1 = caratteri di testa dello stato
429    c0 = carattere corrente del nastro oggetto
430    c1 = carattere in scrittura sul nastro oggetto
431    
432    questa dimostrazione sfrutta il fatto che 
433    merge_config (l0@[c0]) (l1@[c1]) = l1@[merge_char c0 c1] 
434    se l0 e l1 non contengono null
435 *)
436
437 definition R_copy ≝ λt1,t2.
438   ∀ls,s0,s1,c0,c1,rs,l1,l3,l4.
439   t1 = midtape STape (l3@〈grid,false〉::〈c0,false〉::l4@〈s0,true〉::ls) 〈s1,true〉 (l1@〈c1,false〉::〈comma,false〉::rs) → 
440   no_marks l1 → no_marks l3 → no_marks l4 → |l1| = |l4| → 
441   only_bits (l4@[〈s0,true〉]) → only_bits (〈s1,true〉::l1) → 
442   bit_or_null c0 = true → bit_or_null c1 = true → 
443   t2 = midtape STape (〈c1,false〉::reverse ? l1@〈s1,false〉::l3@〈grid,false〉::
444                       〈merge_char c0 c1,false〉::reverse ? l1@〈s1,false〉::ls)
445        〈comma,false〉 rs.
446
447 axiom sem_copy : Realize ? copy R_copy.