Skip to content

Commit

Permalink
shorter lemma using Prod
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahfechtner committed Feb 20, 2025
1 parent 018b842 commit a45871b
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions Mathlib/Data/List/Shortlex.lean
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,7 @@ theorem _root_.List.shortlex_iff_lex {s t : List α} (h : s.length = t.length) :
exact fun h1 => of_lex h h1

theorem _root_.List.shortlex_def {s t : List α} : Shortlex r s t ↔
s.length < t.length ∨ s.length = t.length ∧ List.Lex r s t := by
constructor
· intro hs
unfold Shortlex InvImage at hs
simp only at hs
generalize hp : (s.length, s) = p at hs
generalize hq : (t.length, t) = q at hs
cases hs with
| left b₁ b₂ h =>
left
rw [Prod.mk.injEq] at hp hq
rw [← hp.1, ← hq.1] at h
exact h
| right a h =>
right
rw [Prod.mk.injEq] at hp hq
rw [← hp.2, ← hq.2] at h
exact ⟨hp.1.trans hq.1.symm, h⟩
intro hpq
rcases hpq with h1 | h2
· exact of_length_lt h1
exact of_lex h2.1 h2.2
s.length < t.length ∨ s.length = t.length ∧ List.Lex r s t := Prod.lex_def

theorem cons_iff [IsIrrefl α r] {a : α} {s t : List α} : Shortlex r (a :: s) (a :: t) ↔
Shortlex r s t := by
Expand Down

0 comments on commit a45871b

Please sign in to comment.