Skip to content

Commit

Permalink
refactor: golf proof
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Miller <[email protected]>
  • Loading branch information
chabulhwi and kmill committed Oct 16, 2024
1 parent 6659801 commit 5afa617
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Batteries/Data/List/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -528,17 +528,8 @@ theorem commonPrefix_prefix_left (l₁ l₂ : List α) : commonPrefix l₁ l₂
simp [h]

theorem commonPrefix_prefix_right (l₁ l₂ : List α) : commonPrefix l₁ l₂ <+: l₂ := by
match l₁, l₂ with
| [], _ => simp [commonPrefix]
| _::_, [] => simp [commonPrefix]
| a₁::l₁, a₂::l₂ =>
simp only [commonPrefix]
cases Decidable.em (a₁ = a₂)
· next h =>
simp only [h, ↓reduceIte, cons_prefix_cons, true_and]
apply commonPrefix_prefix_right
· next h =>
simp [h]
rw [commonPrefix_comm]
apply commonPrefix_prefix_left

theorem commonPrefix_append_append (p l₁ l₂ : List α) :
commonPrefix (p ++ l₁) (p ++ l₂) = p ++ commonPrefix l₁ l₂ := by
Expand Down

0 comments on commit 5afa617

Please sign in to comment.