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