Skip to content

Commit a269546

Browse files
committed
chore: proof golf
1 parent 02434df commit a269546

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/Std/Data/DHashMap/Internal/Defs.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ def beq [BEq α] [LawfulBEq α] [Hashable α] [∀ k, BEq (β k)] (m₁ m₂ : R
498498
@[inline] def diff [BEq α] [Hashable α] (m₁ m₂ : Raw₀ α β) : Raw₀ α β :=
499499
if m₁.1.size ≤ m₂.1.size then m₁.filter (fun k _ => !m₂.contains k) else (eraseManyEntries m₁ m₂.1).1
500500

501+
501502
section
502503

503504
variable {β : Type v}

src/Std/Data/Internal/List/Associative.lean

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7695,29 +7695,16 @@ theorem beqModel_congr [BEq α] [LawfulBEq α] [∀ k, BEq (β k)] {l₁ l₂ l
76957695
(hl : DistinctKeys l₂) (p₁ : l₁.Perm l₃) (p₂ : l₂.Perm l₄) : beqModel l₁ l₂ = beqModel l₃ l₄ := by
76967696
simp only [beqModel, ne_eq, ite_not, Bool.if_false_right, Perm.length_eq p₁, Perm.length_eq p₂]
76977697
suffices h : (l₁.all fun x => getValueCast? x.fst l₂ == some x.snd) = (l₃.all fun x => getValueCast? x.fst l₄ == some x.snd) by simp [h]
7698-
conv =>
7699-
lhs
7700-
rhs
7701-
ext x
7702-
rw [getValueCast?_of_perm hl p₂]
7703-
apply List.Perm.all_eq p₁
7698+
simp [getValueCast?_of_perm hl p₂, List.Perm.all_eq p₁]
77047699

77057700
theorem Const.beqModel_congr {β : Type v} [BEq α] [EquivBEq α] [BEq β] {l₁ l₂ l₃ l₄ : List ((_ : α) × β)}
77067701
(hl : DistinctKeys l₂) (p₁ : l₁.Perm l₃) (p₂ : l₂.Perm l₄) : beqModel l₁ l₂ = beqModel l₃ l₄ := by
77077702
simp only [beqModel, ne_eq, ite_not, Bool.if_false_right, Perm.length_eq p₁, Perm.length_eq p₂]
77087703
suffices h : (l₁.all fun x => getValue? x.fst l₂ == some x.snd) = (l₃.all fun x => getValue? x.fst l₄ == some x.snd) by simp [h]
7709-
conv =>
7710-
lhs
7711-
rhs
7712-
ext x
7713-
rw [getValue?_of_perm hl p₂]
7714-
apply List.Perm.all_eq p₁
7704+
simp [getValue?_of_perm hl p₂, List.Perm.all_eq p₁]
77157705

77167706
theorem beqModel_eq_constBeqModel {β : Type v} [BEq α] [LawfulBEq α] [BEq β] {l₁ l₂ : List ((_ : α) × β)} : beqModel l₁ l₂ = Const.beqModel l₁ l₂ := by
7717-
rw [beqModel, Const.beqModel]
7718-
congr
7719-
ext x
7720-
rw [getValue?_eq_getValueCast?]
7707+
simp [beqModel, Const.beqModel, getValue?_eq_getValueCast?]
77217708

77227709
theorem Const.perm_of_beqModel {β : Type v} [BEq α] [LawfulBEq α] [BEq β] [LawfulBEq β] {l₁ l₂ : List ((_ : α) × β)} (hl₁ : DistinctKeys l₁) (hl₂ : DistinctKeys l₂) :
77237710
beqModel l₁ l₂ → l₁.Perm l₂ := by

0 commit comments

Comments
 (0)