@@ -56,7 +56,6 @@ inductive TraceEquiv : List α → List α → Prop
5656
5757omit [DecidableEq α] in
5858variable (I) in
59- @[simp]
6059lemma equiv_implies_length_eq {w₁ w₂ : List α} (h : TraceEquiv I w₁ w₂):
6160 w₁.length = w₂.length := by
6261 induction h with
@@ -73,7 +72,6 @@ lemma equiv_implies_length_eq {w₁ w₂ : List α} (h : TraceEquiv I w₁ w₂)
7372
7473omit [DecidableEq α] in
7574variable (I) in
76- @[simp]
7775lemma equiv_implies_alph_eq {w₁ w₂ : List α} (a : α) (h : TraceEquiv I w₁ w₂) :
7876 (a ∈ w₁ ↔ a ∈ w₂) := by
7977 induction h with
@@ -92,7 +90,6 @@ lemma equiv_implies_alph_eq {w₁ w₂ : List α} (a : α) (h : TraceEquiv I w
9290
9391omit [DecidableEq α] in
9492variable (I) in
95- @[simp]
9693lemma mirror_rule {w₁ w₂ : List α} (h : TraceEquiv I w₁ w₂) : -- (1.6)
9794 TraceEquiv I w₁.reverse w₂.reverse := by
9895 induction h with
@@ -128,7 +125,7 @@ lemma cancel_right_over_concat {w₁ w₂ : List α} (a : α) :
128125 simp [ha, heq, ih]
129126
130127variable (I) in
131- lemma cancellation_property {w₁ w₂ : List α} (a : α) (h : TraceEquiv I w₁ w₂) : -- (1.7)
128+ lemma cancellation_rule {w₁ w₂ : List α} (a : α) (h : TraceEquiv I w₁ w₂) : -- (1.7)
132129 TraceEquiv I (w₁ ÷ a) (w₂ ÷ a) := by
133130 induction h with
134131 | swap b c hbc =>
@@ -160,7 +157,12 @@ lemma cancellation_property {w₁ w₂ : List α} (a : α) (h : TraceEquiv I w
160157 exact ih₁.compat t₂
161158
162159variable (I) in
163- @[simp]
160+ lemma cancellation_rule_left {w₁ w₂ : List α} (a : α) (h : TraceEquiv I w₁ w₂) :
161+ TraceEquiv I (w₁.cancel_left a) (w₂.cancel_left a) := by
162+ rw [List.cancel_left_eq_rev_cancel_right_rev, List.cancel_left_eq_rev_cancel_right_rev]
163+ exact mirror_rule I (cancellation_rule I a (mirror_rule I h))
164+
165+ variable (I) in
164166lemma projection_rule {w₁ w₂ : List α} (Sigma : Alphabet α) (h : TraceEquiv I w₁ w₂) : -- (1.8)
165167 TraceEquiv I (w₁.proj Sigma) (w₂.proj Sigma) := by
166168 induction h with
@@ -308,7 +310,6 @@ lemma equiv_and_ne_implies_independence {a b : α} (h : TraceEquiv I [a, b] [b,
308310 exact ih₁ hne hx hy
309311
310312variable (I) in
311- @[simp]
312313lemma equiv_of_head_eq_implies_tail_equiv {u v w : List α}
313314 (h : TraceEquiv I (w ++ u) (w ++ v)) :
314315 TraceEquiv I u v := by
@@ -318,48 +319,65 @@ lemma equiv_of_head_eq_implies_tail_equiv {u v w : List α}
318319 exact h
319320 | cons a w' ih =>
320321 simp at h
321- have h' := mirror_rule I (cancellation_property I a (mirror_rule I h))
322- simp at h'
323- exact ih h'
322+ replace h := cancellation_rule_left I a h
323+ simp at h
324+ exact ih h
325+
326+ variable (I) in
327+ lemma equiv_of_tail_eq_implies_head_equiv {u v w : List α}
328+ (h : TraceEquiv I (u ++ w) (v ++ w)) :
329+ TraceEquiv I u v := by
330+ replace h := mirror_rule I h
331+ simp at h
332+ replace h := mirror_rule I (equiv_of_head_eq_implies_tail_equiv I h)
333+ simp at h
334+ exact h
324335
325336variable (I) in
326337lemma tail_lemma {u v : List α} {a b : α}
327- (h_ua_vb : TraceEquiv I (u ++ [a]) (v ++ [b])) (hne : a ≠ b) : -- (1.9)
338+ (h : TraceEquiv I (u ++ [a]) (v ++ [b])) (hne : a ≠ b) : -- (1.9)
328339 I.rel a b ∧ ∃ w, TraceEquiv I u (w ++ [b]) ∧ TraceEquiv I v (w ++ [a]) := by
329- have h_ub'_va' : TraceEquiv I (u ÷ b) (v ÷ a) := by
330- have h_cancel := cancellation_property I b (cancellation_property I a h_ua_vb)
331- simp [hne] at h_cancel
332- exact h_cancel
333- have h_u_va'b : TraceEquiv I u ((v ÷ a) ++ [b]) := by
334- have h_cancel := cancellation_property I a h_ua_vb
335- simp [hne] at h_cancel
336- exact h_cancel
337- have h_v_ub'a : TraceEquiv I v ((u ÷ b) ++ [a]) := by
338- have h_cancel := cancellation_property I b h_ua_vb
339- simp [hne.symm] at h_cancel
340- exact h_cancel.symm
341- have h_u_ub'b : TraceEquiv I u ((u ÷ b) ++ [b]) :=
342- h_u_va'b.trans (h_ub'_va'.compat (TraceEquiv.refl [b])).symm
343- have h_ua_ub'ba : TraceEquiv I (u ++ [a]) ((u ÷ b) ++ [b] ++ [a]) :=
344- h_u_ub'b.compat (TraceEquiv.refl [a])
345- have h_vb_ub'ab : TraceEquiv I (v ++ [b]) ((u ÷ b) ++ [a] ++ [b]) :=
346- h_v_ub'a.compat (TraceEquiv.refl [b])
347- have h_tail : TraceEquiv I ((u ÷ b) ++ [a, b]) ((u ÷ b) ++ [b, a]) := by
348- have h' := h_vb_ub'ab.symm.trans (h_ua_vb.symm.trans h_ua_ub'ba)
349- simp at h'
350- exact h'
351- have h_ab_ba : TraceEquiv I [a, b] [b, a] := equiv_of_head_eq_implies_tail_equiv I h_tail
352- exact ⟨equiv_and_ne_implies_independence I h_ab_ba hne, ⟨u ÷ b, ⟨h_u_ub'b, h_v_ub'a⟩⟩⟩
340+ have h_cancel_a := by simpa [hne] using cancellation_rule I a h
341+ have h_cancel_b := by simpa [hne.symm] using (cancellation_rule I b h).symm
342+ have h_cancel_ab := by simpa [hne] using cancellation_rule I b h_cancel_a
343+ have h_cancel_b_concat_b := h_cancel_a.trans (h_cancel_ab.compat (TraceEquiv.refl [b])).symm
344+ have h_cancel_b_concat_ba := h_cancel_b_concat_b.compat (TraceEquiv.refl [a])
345+ have h_cancel_b_concat_ab := h_cancel_b.compat (TraceEquiv.refl [b])
346+ have h_tail := by simpa using h_cancel_b_concat_ab.symm.trans (h.symm.trans h_cancel_b_concat_ba)
347+ have h_ab_ba := equiv_of_head_eq_implies_tail_equiv I h_tail
348+ exact ⟨equiv_and_ne_implies_independence I h_ab_ba hne,
349+ ⟨u ÷ b,
350+ ⟨h_cancel_b_concat_b, h_cancel_b⟩⟩⟩
353351
354352variable (I) in
355353lemma equiv_of_head_eq_tail_implies_mid_equiv {u v x y : List α}
356354 (h : TraceEquiv I (x ++ u ++ y) (x ++ v ++ y)) : -- (1.10)
357355 TraceEquiv I u v := by
358356 rw [List.append_assoc, List.append_assoc] at h
359- have h₁ := mirror_rule I (equiv_of_head_eq_implies_tail_equiv I h)
360- simp at h₁
361- have h₂ := mirror_rule I (equiv_of_head_eq_implies_tail_equiv I h₁)
362- simp at h₂
363- exact h₂
357+ replace h := equiv_of_head_eq_implies_tail_equiv I h
358+ replace h := equiv_of_tail_eq_implies_head_equiv I h
359+ exact h
360+
361+ variable (I) in
362+ lemma commutation_lemma {u v w : List α} {a : α}
363+ (h : TraceEquiv I (u ++ [a] ++ v) (w ++ [a])) (hav : a ∉ v) : -- (1.3.3)
364+ ∀ b ∈ v, I.rel a b := by
365+ induction v using List.induction_right generalizing w with
366+ | nil =>
367+ simp
368+ | snoc x b ih =>
369+ intro b' hb'
370+ simp at hb' hav
371+ rcases hav with ⟨hax, hab⟩
372+ rw [eq_comm] at hab
373+ rw [← List.append_assoc] at h
374+ have ⟨hr, _⟩ := tail_lemma I h hab
375+ replace h := cancellation_rule I b h
376+ simp only [List.cancel_right_snoc, hab, ↓reduceIte] at h
377+ replace h := ih h hax
378+ rcases hb' with hb'x | hb'b
379+ · exact h b' hb'x
380+ · rw [← hb'b] at hr
381+ exact I.symm b' a hr
364382
365383end Trace
0 commit comments