Skip to content

Commit 5a4845a

Browse files
committed
Complete Levi's lemma
1 parent 27106de commit 5a4845a

1 file changed

Lines changed: 43 additions & 11 deletions

File tree

TraceTheory/TraceTheory/Trace.lean

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,25 @@ lemma indep_of_indep_of_equiv {w₁ w₂ w₃: List α}
403403
have hbw₂ := h_alph.mpr hb
404404
exact h a ha b hbw₂
405405

406+
omit [DecidableEq α] in
407+
variable (I) in
408+
lemma indep_of_concat {w₁ w₂ w₃: List α} (h : independent I w₁ (w₂ ++ w₃)) :
409+
independent I w₁ w₂ ∧ independent I w₁ w₃ := by
410+
unfold independent at *
411+
constructor
412+
· intro a ha b hb
413+
apply h
414+
apply ha
415+
apply List.mem_append.mpr
416+
left
417+
apply hb
418+
· intro a ha b hb
419+
apply h
420+
apply ha
421+
apply List.mem_append.mpr
422+
right
423+
apply hb
424+
406425
variable (I) in
407426
theorem levi_lemma {u v x y : List α} (h : TraceEquiv I (u ++ v) (x ++ y)) : -- (1.11)
408427
∃ z₁ z₂ z₃ z₄, independent I z₂ z₃
@@ -442,23 +461,36 @@ theorem levi_lemma {u v x y : List α} (h : TraceEquiv I (u ++ v) (x ++ y)) : --
442461
rw [hu, ← List.append_assoc, List.cancel_right_over_concat] at h_cancel
443462
simp only [hev, ↓reduceIte] at h_cancel
444463
rw [List.cancel_right_over_concat] at h_cancel
445-
simp [hu''] at h_cancel
464+
simp [hu'', -List.append_assoc] at h_cancel
446465
have ⟨z₁', z₂', z₃', z₄', ⟨h_indep, ht₁, ht₂, ht₃, ht₄⟩⟩ := ih h_cancel
466+
have h_indep_e : independent I [e] (u'' ++ v) := by
467+
rw [hu, ← List.append_assoc, List.append_assoc] at h
468+
exact indep_of_equiv_rightmost_symbol I h (List.not_mem_append hu'' hev)
447469
replace h_indep : independent I (z₂' ++ [e]) z₃' := by
448470
intro a ha b hb
449471
simp at ha h_indep
450472
rcases ha with haz₂' | hae
451473
· exact h_indep a haz₂' b hb
452-
· rw [hu, List.append_assoc] at h
453-
nth_rw 2 [← List.append_assoc] at h
454-
have heu''v : e ∉ u'' ++ v := by simp [hu'', hev]
455-
have h_indep_u''v := indep_of_equiv_rightmost_symbol I h heu''v
456-
have h_indep_z₃'z₄' := indep_of_indep_of_equiv I h_indep_u''v ht₂
457-
rw [← hae] at h_indep_z₃'z₄'
458-
simp at h_indep_z₃'z₄'
459-
exact h_indep_z₃'z₄' b (Or.intro_left (b ∈ z₄') hb)
474+
· have h_indep_ev := (indep_of_concat I h_indep_e).right
475+
have h_equiv := indep_of_indep_of_equiv I h_indep_ev ht₂
476+
simp [← hae] at h_equiv
477+
apply h_equiv
478+
left
479+
apply hb
460480
use z₁', z₂' ++ [e], z₃', z₄', h_indep
461-
sorry
462-
481+
rw [hu, ← List.append_assoc]
482+
have heu'' : TraceEquiv I (u'' ++ [e]) ([e] ++ u'') :=
483+
equiv_of_indep_symb_commute_list I (indep_of_concat I h_indep_e).left
484+
have hu'e := TraceEquiv.symm ((TraceEquiv.refl u').compat heu'')
485+
rw [← List.append_assoc, ← List.append_assoc] at hu'e
486+
replace ht₁ := hu'e.trans (ht₁.compat (TraceEquiv.refl [e]))
487+
have hez₄' : TraceEquiv I (z₄' ++ [e]) ([e] ++ z₄') := by
488+
have h_indep_ev := (indep_of_concat I h_indep_e).right
489+
have h_indep_ez₃'z₄' := indep_of_indep_of_equiv I h_indep_ev ht₂
490+
exact equiv_of_indep_symb_commute_list I (indep_of_concat I h_indep_ez₃'z₄').right
491+
have hz₄'e := (TraceEquiv.refl z₂').compat hez₄'
492+
rw [← List.append_assoc, ← List.append_assoc] at hz₄'e
493+
replace ht₄ := (ht₄.compat (TraceEquiv.refl [e])).trans hz₄'e
494+
exact ⟨ht₁, ht₂, ht₃, ht₄⟩
463495

464496
end Trace

0 commit comments

Comments
 (0)