1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
16 include "basics/lists/listb.ma".
18 let rec move (S: DeqSet) (x:S) (E: pitem S) on E : pre S ≝
22 | ps y ⇒ 〈 `y, false 〉
23 | pp y ⇒ 〈 `y, x == y 〉
24 | po e1 e2 ⇒ (move ? x e1) ⊕ (move ? x e2)
25 | pc e1 e2 ⇒ (move ? x e1) ⊙ (move ? x e2)
26 | pk e ⇒ (move ? x e)^⊛ ].
28 lemma move_plus: ∀S:DeqSet.∀x:S.∀i1,i2:pitem S.
29 move S x (i1 + i2) = (move ? x i1) ⊕ (move ? x i2).
32 lemma move_cat: ∀S:DeqSet.∀x:S.∀i1,i2:pitem S.
33 move S x (i1 · i2) = (move ? x i1) ⊙ (move ? x i2).
36 lemma move_star: ∀S:DeqSet.∀x:S.∀i:pitem S.
37 move S x i^* = (move ? x i)^⊛.
40 definition pmove ≝ λS:DeqSet.λx:S.λe:pre S. move ? x (\fst e).
42 lemma pmove_def : ∀S:DeqSet.∀x:S.∀i:pitem S.∀b.
43 pmove ? x 〈i,b〉 = move ? x i.
46 lemma eq_to_eq_hd: ∀A.∀l1,l2:list A.∀a,b.
47 a::l1 = b::l2 → a = b.
48 #A #l1 #l2 #a #b #H destruct //
51 lemma same_kernel: ∀S:DeqSet.∀a:S.∀i:pitem S.
52 |\fst (move ? a i)| = |i|.
54 [#i1 #i2 >move_cat #H1 #H2 whd in ⊢ (???%); <H1 <H2 //
55 |#i1 #i2 >move_plus #H1 #H2 whd in ⊢ (???%); <H1 <H2 //
60 ∀S:DeqSet.∀a:S.∀i:pitem S.∀w: word S.
61 \sem{move ? a i} w ↔ \sem{i} (a::w).
66 |normalize #x #w cases (true_or_false (a==x)) #H >H normalize
67 [>(proj1 … (eqb_true …) H) %
68 [* // #bot @False_ind //| #H1 destruct /2/]
69 |% [#bot @False_ind //
70 | #H1 destruct @(absurd ((a==a)=true))
71 [>(proj2 … (eqb_true …) (refl …)) // | /2/]
74 |#i1 #i2 #HI1 #HI2 #w >(sem_cat S i1 i2) >move_cat
75 @iff_trans[|@sem_odot] >same_kernel >sem_cat_w
76 @iff_trans[||@(iff_or_l … (HI2 w))] @iff_or_r %
77 [* #w1 * #w2 * * #eqw #w1in #w2in @(ex_intro … (a::w1))
78 @(ex_intro … w2) % // % normalize // cases (HI1 w1) /2/
79 |* #w1 * #w2 * cases w1
80 [* #_ #H @False_ind /2/
81 |#x #w3 * #eqaw normalize in eqaw; destruct #w3in #w2in
82 @(ex_intro … w3) @(ex_intro … w2) % // % // cases (HI1 w3) /2/
85 |#i1 #i2 #HI1 #HI2 #w >(sem_plus S i1 i2) >move_plus >sem_plus_w
86 @iff_trans[|@sem_oplus]
87 @iff_trans[|@iff_or_l [|@HI2]| @iff_or_r //]
88 |#i1 #HI1 #w >move_star
89 @iff_trans[|@sem_ostar] >same_kernel >sem_star_w %
90 [* #w1 * #w2 * * #eqw #w1in #w2in
91 @(ex_intro … (a::w1)) @(ex_intro … w2) % // % normalize //
93 |* #w1 * #w2 * cases w1
94 [* #_ #H @False_ind /2/
95 |#x #w3 * #eqaw normalize in eqaw; destruct #w3in #w2in
96 @(ex_intro … w3) @(ex_intro … w2) % // % // cases (HI1 w3) /2/
102 notation > "x ↦* E" non associative with precedence 60 for @{moves ? $x $E}.
103 let rec moves (S : DeqSet) w e on w : pre S ≝
106 | cons x w' ⇒ w' ↦* (move S x (\fst e))].
108 lemma moves_empty: ∀S:DeqSet.∀e:pre S.
112 lemma moves_cons: ∀S:DeqSet.∀a:S.∀w.∀e:pre S.
113 moves ? (a::w) e = moves ? w (move S a (\fst e)).
116 lemma not_epsilon_sem: ∀S:DeqSet.∀a:S.∀w: word S. ∀e:pre S.
117 iff ((a::w) ∈ e) ((a::w) ∈ \fst e).
118 #S #a #w * #i #b >fst_eq cases b normalize
119 [% /2/ * // #H destruct |% normalize /2/]
122 lemma same_kernel_moves: ∀S:DeqSet.∀w.∀e:pre S.
123 |\fst (moves ? w e)| = |\fst e|.
127 theorem decidable_sem: ∀S:DeqSet.∀w: word S. ∀e:pre S.
128 (\snd (moves ? w e) = true) ↔ \sem{e} w.
130 [* #i #b >moves_empty cases b % /2/
131 |#a #w1 #Hind #e >moves_cons
132 @iff_trans [||@iff_sym @not_epsilon_sem]
133 @iff_trans [||@move_ok] @Hind
137 lemma not_true_to_false: ∀b.b≠true → b =false.
138 #b * cases b // #H @False_ind /2/
141 theorem equiv_sem: ∀S:DeqSet.∀e1,e2:pre S.
142 iff (\sem{e1} =1 \sem{e2}) (∀w.\snd (moves ? w e1) = \snd (moves ? w e2)).
145 cut (∀b1,b2. iff (b1 = true) (b2 = true) → (b1 = b2))
146 [* * // * #H1 #H2 [@sym_eq @H1 //| @H2 //]]
147 #Hcut @Hcut @iff_trans [|@decidable_sem]
148 @iff_trans [|@same_sem] @iff_sym @decidable_sem
149 |#H #w1 @iff_trans [||@decidable_sem] <H @iff_sym @decidable_sem]
152 lemma moves_left : ∀S,a,w,e.
153 moves S (w@[a]) e = move S a (\fst (moves S w e)).
154 #S #a #w elim w // #x #tl #Hind #e >moves_cons >moves_cons //
157 definition in_moves ≝ λS:DeqSet.λw.λe:pre S. \snd(w ↦* e).
160 coinductive equiv (S:DeqSet) : pre S → pre S → Prop ≝
164 (∀x. equiv S (move ? x (\fst e1)) (move ? x (\fst e2))) →
168 definition beqb ≝ λb1,b2.
174 lemma beqb_ok: ∀b1,b2. iff (beqb b1 b2 = true) (b1 = b2).
175 #b1 #b2 cases b1 cases b2 normalize /2/
178 definition Bin ≝ mk_DeqSet bool beqb beqb_ok.
180 let rec beqitem S (i1,i2: pitem S) on i1 ≝
182 [ pz ⇒ match i2 with [ pz ⇒ true | _ ⇒ false]
183 | pe ⇒ match i2 with [ pe ⇒ true | _ ⇒ false]
184 | ps y1 ⇒ match i2 with [ ps y2 ⇒ y1==y2 | _ ⇒ false]
185 | pp y1 ⇒ match i2 with [ pp y2 ⇒ y1==y2 | _ ⇒ false]
186 | po i11 i12 ⇒ match i2 with
187 [ po i21 i22 ⇒ beqitem S i11 i21 ∧ beqitem S i12 i22
189 | pc i11 i12 ⇒ match i2 with
190 [ pc i21 i22 ⇒ beqitem S i11 i21 ∧ beqitem S i12 i22
192 | pk i11 ⇒ match i2 with [ pk i21 ⇒ beqitem S i11 i21 | _ ⇒ false]
195 axiom beqitem_ok: ∀S,i1,i2. iff (beqitem S i1 i2 = true) (i1 = i2).
197 definition DeqItem ≝ λS.
198 mk_DeqSet (pitem S) (beqitem S) (beqitem_ok S).
200 definition beqpre ≝ λS:DeqSet.λe1,e2:pre S.
201 beqitem S (\fst e1) (\fst e2) ∧ beqb (\snd e1) (\snd e2).
203 definition beqpairs ≝ λS:DeqSet.λp1,p2:(pre S)×(pre S).
204 beqpre S (\fst p1) (\fst p2) ∧ beqpre S (\snd p1) (\snd p2).
206 axiom beqpairs_ok: ∀S,p1,p2. iff (beqpairs S p1 p2 = true) (p1 = p2).
208 definition space ≝ λS.mk_DeqSet ((pre S)×(pre S)) (beqpairs S) (beqpairs_ok S).
210 (* (sons S l p) computes all sons of p relative to characters in l *)
212 definition sons ≝ λS:DeqSet.λl:list S.λp:space S.
213 map ?? (λa.〈move S a (\fst (\fst p)),move S a (\fst (\snd p))〉) l.
215 lemma memb_sons: ∀S,l,p,q. memb (space S) p (sons S l q) = true →
216 ∃a.(move ? a (\fst (\fst q)) = \fst p ∧
217 move ? a (\fst (\snd q)) = \snd p).
218 #S #l elim l [#p #q normalize in ⊢ (%→?); #abs @False_ind /2/]
219 #a #tl #Hind #p #q #H cases (orb_true_l … H) -H
220 [#H @(ex_intro … a) <(proj1 … (eqb_true …)H) /2/
225 let rec bisim S l n (frontier,visited: list (space S)) on n ≝
227 [ O ⇒ 〈false,visited〉 (* assert false *)
230 [ nil ⇒ 〈true,visited〉
232 if beqb (\snd (\fst hd)) (\snd (\snd hd)) then
233 bisim S l m (unique_append ? (filter ? (λx.notb (memb ? x (hd::visited)))
234 (sons S l hd)) tl) (hd::visited)
239 lemma unfold_bisim: ∀S,l,n.∀frontier,visited: list (space S).
240 bisim S l n frontier visited =
242 [ O ⇒ 〈false,visited〉 (* assert false *)
245 [ nil ⇒ 〈true,visited〉
247 if beqb (\snd (\fst hd)) (\snd (\snd hd)) then
248 bisim S l m (unique_append ? (filter ? (λx.notb(memb ? x (hd::visited)))
249 (sons S l hd)) tl) (hd::visited)
253 #S #l #n cases n // qed.
255 lemma bisim_never: ∀S,l.∀frontier,visited: list (space S).
256 bisim S l O frontier visited = 〈false,visited〉.
257 #frontier #visited >unfold_bisim //
260 lemma bisim_end: ∀Sig,l,m.∀visited: list (space Sig).
261 bisim Sig l (S m) [] visited = 〈true,visited〉.
262 #n #visisted >unfold_bisim //
265 lemma bisim_step_true: ∀Sig,l,m.∀p.∀frontier,visited: list (space Sig).
266 beqb (\snd (\fst p)) (\snd (\snd p)) = true →
267 bisim Sig l (S m) (p::frontier) visited =
268 bisim Sig l m (unique_append ? (filter ? (λx.notb(memb (space Sig) x (p::visited)))
269 (sons Sig l p)) frontier) (p::visited).
270 #Sig #l #m #p #frontier #visited #test >unfold_bisim normalize nodelta >test //
273 lemma bisim_step_false: ∀Sig,l,m.∀p.∀frontier,visited: list (space Sig).
274 beqb (\snd (\fst p)) (\snd (\snd p)) = false →
275 bisim Sig l (S m) (p::frontier) visited = 〈false,visited〉.
276 #Sig #l #m #p #frontier #visited #test >unfold_bisim normalize nodelta >test //
279 definition visited_inv ≝ λS.λe1,e2:pre S.λvisited: list (space S).
280 uniqueb ? visited = true ∧
281 ∀p. memb ? p visited = true →
282 (∃w.(moves S w e1 = \fst p) ∧ (moves S w e2 = \snd p)) ∧
283 (beqb (\snd (\fst p)) (\snd (\snd p)) = true).
285 definition frontier_inv ≝ λS.λfrontier,visited: list (space S).
286 uniqueb ? frontier = true ∧
287 ∀p. memb ? p frontier = true →
288 memb ? p visited = false ∧
289 ∃p1.((memb ? p1 visited = true) ∧
290 (∃a. move ? a (\fst (\fst p1)) = \fst p ∧
291 move ? a (\fst (\snd p1)) = \snd p)).
293 (* lemma andb_true: ∀b1,b2:bool.
294 (b1 ∧ b2) = true → (b1 = true) ∧ (b2 = true).
295 #b1 #b2 cases b1 normalize #H [>H /2/ |@False_ind /2/].
298 lemma andb_true_r: ∀b1,b2:bool.
299 (b1 = true) ∧ (b2 = true) → (b1 ∧ b2) = true.
300 #b1 #b2 cases b1 normalize * //
303 lemma notb_eq_true_l: ∀b. notb b = true → b = false.
304 #b cases b normalize //
307 lemma notb_eq_true_r: ∀b. b = false → notb b = true.
308 #b cases b normalize //
311 lemma notb_eq_false_l:∀b. notb b = false → b = true.
312 #b cases b normalize //
315 lemma notb_eq_false_r:∀b. b = true → notb b = false.
316 #b cases b normalize //
319 (* include "arithmetics/exp.ma". *)
321 let rec pos S (i:re S) on i ≝
326 | o i1 i2 ⇒ pos S i1 + pos S i2
327 | c i1 i2 ⇒ pos S i1 + pos S i2
332 let rec pitem_enum S (i:re S) on i ≝
336 | s y ⇒ [ps S y; pp S y]
337 | o i1 i2 ⇒ compose ??? (po S) (pitem_enum S i1) (pitem_enum S i2)
338 | c i1 i2 ⇒ compose ??? (pc S) (pitem_enum S i1) (pitem_enum S i2)
339 | k i ⇒ map ?? (pk S) (pitem_enum S i)
342 (* axiom pitem_enum_complete: ∀S:DeqSet.∀i: pitem S.
343 memb ((pitem S)×(pitem S)) i (pitem_enum ? (forget ? i)) = true. *)
350 |#i1 #i2 #Hind1 #Hind2 @memb_compose //
351 |#i1 #i2 #Hind1 #Hind2 @memb_compose //
355 definition pre_enum ≝ λS.λi:re S.
356 compose ??? (λi,b.〈i,b〉) (pitem_enum S i) [true;false].
358 definition space_enum ≝ λS.λi1,i2:re S.
359 compose ??? (λe1,e2.〈e1,e2〉) (pre_enum S i1) (pre_enum S i1).
361 axiom space_enum_complete : ∀S.∀e1,e2: pre S.
362 memb (space S) 〈e1,e2〉 (space_enum S (|\fst e1|) (|\fst e2|)) = true.
364 lemma bisim_ok1: ∀S.∀e1,e2:pre S.\sem{e1}=1\sem{e2} →
365 ∀l,n.∀frontier,visited:list (space S).
366 |space_enum S (|\fst e1|) (|\fst e2|)| < n + |visited|→
367 visited_inv S e1 e2 visited → frontier_inv S frontier visited →
368 \fst (bisim S l n frontier visited) = true.
369 #Sig #e1 #e2 #same #l #n elim n
370 [#frontier #visited #abs * #unique #H @False_ind @(absurd … abs)
371 @le_to_not_lt @sublist_length // * #e11 #e21 #membp
372 cut ((|\fst e11| = |\fst e1|) ∧ (|\fst e21| = |\fst e2|))
373 [|* #H1 #H2 <H1 <H2 @space_enum_complete]
374 cases (H … membp) * #w * >fst_eq >snd_eq #we1 #we2 #_
376 |#m #HI * [#visited #vinv #finv >bisim_end //]
377 #p #front_tl #visited #Hn * #u_visited #vinv * #u_frontier #finv
378 cases (finv p (memb_hd …)) #Hp * #p2 * #visited_p2
379 * #a * #movea1 #movea2
380 cut (∃w.(moves Sig w e1 = \fst p) ∧ (moves Sig w e2 = \snd p))
381 [cases (vinv … visited_p2) -vinv * #w1 * #mw1 #mw2 #_
382 @(ex_intro … (w1@[a])) /2/]
383 -movea2 -movea1 -a -visited_p2 -p2 #reachp
384 cut (beqb (\snd (\fst p)) (\snd (\snd p)) = true)
385 [cases reachp #w * #move_e1 #move_e2 <move_e1 <move_e2
386 @(proj2 … (beqb_ok … )) @(proj1 … (equiv_sem … )) @same
387 |#ptest >(bisim_step_true … ptest) @HI -HI
389 |% [whd in ⊢ (??%?); >Hp whd in ⊢ (??%?); //]
390 #p1 #H (cases (orb_true_l … H))
391 [#eqp <(proj1 … (eqb_true (space Sig) ? p1) eqp) % //
392 |#visited_p1 @(vinv … visited_p1)
394 |whd % [@unique_append_unique @(andb_true_r … u_frontier)]
395 @unique_append_elim #q #H
397 [@notb_eq_true_l @(filter_true … H)
398 |@(ex_intro … p) % //
399 @(memb_sons … (memb_filter_memb … H))
401 |cases (finv q ?) [|@memb_cons //]
402 #nvq * #p1 * #Hp1 #reach %
403 [cut ((p==q) = false) [|#Hpq whd in ⊢ (??%?); >Hpq @nvq]
404 cases (andb_true … u_frontier) #notp #_
405 @(not_memb_to_not_eq … H) @notb_eq_true_l @notp
406 |cases (proj2 … (finv q ?))
407 [#p1 * #Hp1 #reach @(ex_intro … p1) % // @memb_cons //
417 definition all_true ≝ λS.λl.∀p. memb (space S) p l = true →
418 (beqb (\snd (\fst p)) (\snd (\snd p)) = true).
420 definition sub_sons ≝ λS,l,l1,l2.∀x,a.
421 memb (space S) x l1 = true → memb S a l = true →
422 memb (space S) 〈move ? a (\fst (\fst x)), move ? a (\fst (\snd x))〉 l2 = true.
424 lemma reachable_bisim:
425 ∀S,l,n.∀frontier,visited,visited_res:list (space S).
427 sub_sons S l visited (frontier@visited) →
428 bisim S l n frontier visited = 〈true,visited_res〉 →
429 (sub_sons S l visited_res visited_res ∧
430 sublist ? visited visited_res ∧
431 all_true S visited_res).
433 [#fron #vis #vis_res #_ #_ >bisim_never #H destruct
435 [(* case empty frontier *)
436 -Hind #vis #vis_res #allv #H normalize in ⊢ (%→?);
437 #H1 destruct % // % // #p /2/
438 |#hd cases (true_or_false (beqb (\snd (\fst hd)) (\snd (\snd hd))))
439 [|(* case head of the frontier is non ok (absurd) *)
440 #H #tl #vis #vis_res #allv >(bisim_step_false … H) #_ #H1 destruct]
441 (* frontier = hd:: tl and hd is ok *)
442 #H #tl #visited #visited_res #allv >(bisim_step_true … H)
443 (* new_visited = hd::visited are all ok *)
444 cut (all_true S (hd::visited))
445 [#p #H cases (orb_true_l … H)
446 [#eqp <(proj1 … (eqb_true …) eqp) // |@allv]]
447 (* we now exploit the induction hypothesis *)
448 #allh #subH #bisim cases (Hind … allh … bisim) -Hind
449 [* #H1 #H2 #H3 % // % // #p #H4 @H2 @memb_cons //]
450 (* the only thing left to prove is the sub_sons invariant *)
452 cases (orb_true_l … membx)
454 #eqhdx >(proj1 … (eqb_true …) eqhdx)
455 (* xa is the son of x w.r.t. a; we must distinguish the case xa
456 was already visited form the case xa is new *)
457 letin xa ≝ 〈move S a (\fst (\fst x)), move S a (\fst (\snd x))〉
458 cases (true_or_false … (memb (space S) xa (x::visited)))
459 [(* xa visited - trivial *) #membxa @memb_append_l2 //
460 |(* xa new *) #membxa @memb_append_l1 @sublist_unique_append_l1 @memb_filter_l
462 |(* this can be probably improved *)
463 generalize in match memba; -memba elim l
464 [whd in ⊢ (??%?→?); #abs @False_ind /2/
465 |#b #others #Hind #memba cases (orb_true_l … memba) #H
466 [>(proj1 … (eqb_true …) H) @memb_hd
472 |(* case x in visited *)
473 #H1 letin xa ≝ 〈move S a (\fst (\fst x)), move S a (\fst (\snd x))〉
474 cases (memb_append … (subH x a H1 memba))
475 [#H2 (cases (orb_true_l … H2))
476 [#H3 @memb_append_l2 >(proj1 … (eqb_true …) H3) @memb_hd
477 |#H3 @memb_append_l1 @sublist_unique_append_l2 @H3
479 |#H2 @memb_append_l2 @memb_cons @H2
487 let rec blank_item (S: DeqSet) (i: re S) on i :pitem S ≝
492 | o e1 e2 ⇒ (blank_item S e1) + (blank_item S e2)
493 | c e1 e2 ⇒ (blank_item S e1) · (blank_item S e2)
494 | k e ⇒ (blank_item S e)^* ].
496 definition pit_pre ≝ λS.λi.〈blank_item S (|i|), false〉.
498 let rec occur (S: DeqSet) (i: re S) on i ≝
503 | o e1 e2 ⇒ unique_append ? (occur S e1) (occur S e2)
504 | c e1 e2 ⇒ unique_append ? (occur S e1) (occur S e2)
507 axiom memb_single: ∀S,a,x. memb S a [x] = true → a = x.
509 axiom tech: ∀b. b ≠ true → b = false.
510 axiom tech2: ∀b. b = false → b ≠ true.
512 lemma not_occur_to_pit: ∀S,a.∀i:pitem S. memb S a (occur S (|i|)) = false →
513 move S a i = pit_pre S i.
515 [#x cases (true_or_false (a==x))
516 [#H >(proj1 …(eqb_true …) H) whd in ⊢ ((??%?)→?);
517 >(proj2 …(eqb_true …) (refl …)) whd in ⊢ ((??%?)→?); #abs @False_ind /2/
520 |#i1 #i2 #Hind1 #Hind2 #H >move_cat >Hind1 [2:@tech
521 @(not_to_not … (tech2 … H)) #H1 @sublist_unique_append_l1 //]
522 >Hind2 [2:@tech @(not_to_not … (tech2 … H)) #H1 @sublist_unique_append_l2 //]
524 |#i1 #i2 #Hind1 #Hind2 #H >move_plus >Hind1 [2:@tech
525 @(not_to_not … (tech2 … H)) #H1 @sublist_unique_append_l1 //]
526 >Hind2 [2:@tech @(not_to_not … (tech2 … H)) #H1 @sublist_unique_append_l2 //]
528 |#i #Hind #H >move_star >Hind // @H
532 lemma move_pit: ∀S,a,i. move S a (\fst (pit_pre S i)) = pit_pre S i.
534 [#i1 #i2 #Hind1 #Hind2 >move_cat >Hind1 >Hind2 //
535 |#i1 #i2 #Hind1 #Hind2 >move_plus >Hind1 >Hind2 //
536 |#i #Hind >move_star >Hind //
540 lemma moves_pit: ∀S,w,i. moves S w (pit_pre S i) = pit_pre S i.
541 #S #w #i elim w // #a #tl >moves_cons //
544 lemma to_pit: ∀S,w,e. ¬ sublist S w (occur S (|\fst e|)) →
545 moves S w e = pit_pre S (\fst e).
548 #e * #H @False_ind @H normalize #a #abs @False_ind /2/
549 |#a #tl #Hind #e #H cases (true_or_false (memb S a (occur S (|\fst e|))))
550 [#Htrue >moves_cons whd in ⊢ (???%); <(same_kernel … a)
551 @Hind >same_kernel @(not_to_not … H) #H1 #b #memb cases (orb_true_l … memb)
552 [#H2 <(proj1 … (eqb_true …) H2) // |#H2 @H1 //]
553 |#Hfalse >moves_cons >not_occur_to_pit //
558 definition occ ≝ λS.λe1,e2:pre S.
559 unique_append ? (occur S (|\fst e1|)) (occur S (|\fst e2|)).
561 (* definition occS ≝ λS:DeqSet.λoccur.
562 PSig S (λx.memb S x occur = true). *)
564 lemma occ_enough: ∀S.∀e1,e2:pre S.
565 (∀w.(sublist S w (occ S e1 e2))→
566 (beqb (\snd (moves S w e1)) (\snd (moves ? w e2))) = true) \to
567 ∀w.(beqb (\snd (moves S w e1)) (\snd (moves ? w e2))) = true.
569 cut (sublist S w (occ S e1 e2) ∨ ¬(sublist S w (occ S e1 e2)))
571 [%1 #a normalize in ⊢ (%→?); #abs @False_ind /2/
573 [cases (true_or_false (memb S a (occ S e1 e2))) #memba
574 [%1 whd #x #membx cases (orb_true_l … membx)
575 [#eqax <(proj1 … (eqb_true …) eqax) //
578 |%2 @(not_to_not … (tech2 … memba)) #H1 @H1 @memb_hd
580 |%2 @(not_to_not … subtl) #H1 #x #H2 @H1 @memb_cons //
585 [2: @(not_to_not … H) #H1 #a #memba @sublist_unique_append_l1 @H1 //]
587 [2: @(not_to_not … H) #H1 #a #memba @sublist_unique_append_l2 @H1 //]
592 lemma bisim_char: ∀S.∀e1,e2:pre S.
593 (∀w.(beqb (\snd (moves S w e1)) (\snd (moves ? w e2))) = true) →
595 #S #e1 #e2 #H @(proj2 … (equiv_sem …)) #w @(proj1 …(beqb_ok …)) @H
598 lemma bisim_ok2: ∀S.∀e1,e2:pre S.
599 (beqb (\snd e1) (\snd e2) = true) → ∀n.
600 \fst (bisim S (occ S e1 e2) n (sons S (occ S e1 e2) 〈e1,e2〉) [〈e1,e2〉]) = true →
603 letin rsig ≝ (occ S e1 e2)
604 letin frontier ≝ (sons S rsig 〈e1,e2〉)
605 letin visited_res ≝ (\snd (bisim S rsig n frontier [〈e1,e2〉]))
607 cut (bisim S rsig n frontier [〈e1,e2〉] = 〈true,visited_res〉)
608 [<bisim_true <eq_pair_fst_snd //] #H
609 cut (all_true S [〈e1,e2〉])
610 [#p #Hp cases (orb_true_l … Hp)
611 [#eqp <(proj1 … (eqb_true …) eqp) //
612 | whd in ⊢ ((??%?)→?); #abs @False_ind /2/
614 cut (sub_sons S rsig [〈e1,e2〉] (frontier@[〈e1,e2〉]))
615 [#x #a #H1 cases (orb_true_l … H1)
616 [#eqx <(proj1 … (eqb_true …) eqx) #H2 @memb_append_l1
617 whd in ⊢ (??(???%)?); @(memb_map … H2)
618 |whd in ⊢ ((??%?)→?); #abs @False_ind /2/
621 cases (reachable_bisim … allH init … H) * #H1 #H2 #H3
622 cut (∀w.sublist ? w (occ S e1 e2)→∀p.memb (space S) p visited_res = true →
623 memb (space S) 〈moves ? w (\fst p), moves ? w (\snd p)〉 visited_res = true)
625 #a #w1 #Hind #Hsub * #e11 #e21 #visp >fst_eq >snd_eq >moves_cons >moves_cons
626 @(Hind ? 〈?,?〉) [#x #H4 @Hsub @memb_cons //]
627 @(H1 〈?,?〉) // @Hsub @memb_hd] #all_reach
628 @bisim_char @occ_enough
629 #w #Hsub @(H3 〈?,?〉) @(all_reach w Hsub 〈?,?〉) @H2 //
632 definition tt ≝ ps Bin true.
633 definition ff ≝ ps Bin false.
634 definition eps ≝ pe Bin.
635 definition exp1 ≝ (ff + tt · ff).
636 definition exp2 ≝ ff · (eps + tt).
638 definition exp3 ≝ move Bin true (\fst (•exp1)).
639 definition exp4 ≝ move Bin true (\fst (•exp2)).
640 definition exp5 ≝ move Bin false (\fst (•exp1)).
641 definition exp6 ≝ move Bin false (\fst (•exp2)).