Skip to content

Commit e7ece45

Browse files
authored
refactor: rename congruence lemmas for union on DHashMap/HashMap/HashSet/DTreeMap/TreeMap/TreeSet (#11267)
This PR renames congruence lemmas for union on `DHashMap`/`HashMap`/`HashSet`/`DTreeMap`/`TreeMap`/`TreeSet` to fit the convention of being in the `Equiv` namespace.
1 parent dda6885 commit e7ece45

File tree

17 files changed

+159
-60
lines changed

17 files changed

+159
-60
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,7 +2628,7 @@ theorem contains_of_contains_union_of_contains_eq_false_left [EquivBEq α]
26282628
simp_to_model [union, contains] using List.contains_of_contains_insertList_of_contains_eq_false_left
26292629

26302630
/- Equiv -/
2631-
theorem union_equiv_congr_left {m₃ : Raw₀ α β} [EquivBEq α] [LawfulHashable α]
2631+
theorem Equiv.union_left {m₃ : Raw₀ α β} [EquivBEq α] [LawfulHashable α]
26322632
(h₁ : m₁.val.WF) (h₂ : m₂.val.WF) (h₃ : m₃.val.WF) (equiv : m₁.1.Equiv m₂.1) :
26332633
(m₁.union m₃).1.Equiv (m₂.union m₃).1 := by
26342634
revert equiv
@@ -2637,7 +2637,7 @@ theorem union_equiv_congr_left {m₃ : Raw₀ α β} [EquivBEq α] [LawfulHashab
26372637
apply List.insertList_perm_of_perm_first equiv
26382638
wf_trivial
26392639

2640-
theorem union_equiv_congr_right {m₃ : Raw₀ α β} [EquivBEq α] [LawfulHashable α]
2640+
theorem Equiv.union_right {m₃ : Raw₀ α β} [EquivBEq α] [LawfulHashable α]
26412641
(h₁ : m₁.val.WF) (h₂ : m₂.val.WF) (h₃ : m₃.val.WF) (equiv : m₂.1.Equiv m₃.1) :
26422642
(m₁.union m₂).1.Equiv (m₁.union m₃).1 := by
26432643
revert equiv
@@ -2646,6 +2646,15 @@ theorem union_equiv_congr_right {m₃ : Raw₀ α β} [EquivBEq α] [LawfulHasha
26462646
apply @List.insertList_perm_of_perm_second _ _ _ _ (toListModel m₂.val.buckets) (toListModel m₃.val.buckets) (toListModel m₁.val.buckets) equiv
26472647
all_goals wf_trivial
26482648

2649+
theorem Equiv.union_congr {m₃ m₄ : Raw₀ α β} [EquivBEq α] [LawfulHashable α]
2650+
(h₁ : m₁.val.WF) (h₂ : m₂.val.WF) (h₃ : m₃.val.WF) (h₄ : m₄.val.WF) (equiv₁ : m₁.1.Equiv m₃.1) (equiv₂ : m₂.1.Equiv m₄.1) :
2651+
(m₁.union m₂).1.Equiv (m₃.union m₄).1 := by
2652+
revert equiv₁ equiv₂
2653+
simp_to_model [Equiv, union]
2654+
intro he₁ he₂
2655+
apply insertList_congr he₁ he₂
2656+
all_goals wf_trivial
2657+
26492658
theorem union_insert_right_equiv_insert_union [EquivBEq α] [LawfulHashable α] {p : (a : α) × β a}
26502659
(h₁ : m₁.val.WF) (h₂ : m₂.val.WF) :
26512660
(m₁.union (m₂.insert p.fst p.snd)).1.Equiv ((m₁.union m₂).insert p.fst p.snd).1 := by

src/Std/Data/DHashMap/Lemmas.lean

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,20 +1884,25 @@ theorem mem_of_mem_union_of_not_mem_left [EquivBEq α]
18841884
exact @Raw₀.contains_of_contains_union_of_contains_eq_false_left _ _ _ _ ⟨m₁.1, _⟩ ⟨m₂.1, _⟩ _ _ m₁.2 m₂.2 k h₁ h₂
18851885

18861886
/- Equiv -/
1887-
theorem union_equiv_congr_left {m₃ : DHashMap α β} [EquivBEq α] [LawfulHashable α]
1887+
theorem Equiv.union_left {m₃ : DHashMap α β} [EquivBEq α] [LawfulHashable α]
18881888
(equiv : m₁ ~m m₂) :
18891889
(m₁ ∪ m₃) ~m (m₂ ∪ m₃) :=
1890-
⟨@Raw₀.union_equiv_congr_left α β _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ ⟨m₃.1, m₃.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2 m₃.2 equiv.1
1890+
⟨@Raw₀.Equiv.union_left α β _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ ⟨m₃.1, m₃.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2 m₃.2 equiv.1
18911891

1892-
theorem union_equiv_congr_right {m₃ : DHashMap α β} [EquivBEq α] [LawfulHashable α]
1892+
theorem Equiv.union_right {m₃ : DHashMap α β} [EquivBEq α] [LawfulHashable α]
18931893
(equiv : m₂ ~m m₃) :
18941894
(m₁ ∪ m₂) ~m (m₁ ∪ m₃) :=
1895-
⟨@Raw₀.union_equiv_congr_right α β _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ ⟨m₃.1, m₃.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2 m₃.2 equiv.1
1895+
⟨@Raw₀.Equiv.union_right α β _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ ⟨m₃.1, m₃.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2 m₃.2 equiv.1
18961896

18971897
theorem union_insert_right_equiv_insert_union [EquivBEq α] [LawfulHashable α] {p : (a : α) × β a} :
18981898
(m₁ ∪ (m₂.insert p.fst p.snd)) ~m ((m₁ ∪ m₂).insert p.fst p.snd) :=
18991899
⟨@Raw₀.union_insert_right_equiv_insert_union _ _ _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ _ _ p m₁.2 m₂.2
19001900

1901+
theorem Equiv.union_congr {m₃ m₄ : DHashMap α β} [EquivBEq α] [LawfulHashable α]
1902+
(equiv₁ : m₁ ~m m₃) (equiv₂ : m₂ ~m m₄) :
1903+
(m₁ ∪ m₂) ~m (m₃ ∪ m₄) :=
1904+
⟨@Raw₀.Equiv.union_congr _ _ _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ ⟨m₃.1, m₃.2.size_buckets_pos⟩ ⟨m₄.1, m₄.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2 m₃.2 m₄.2 equiv₁.1 equiv₂.1
1905+
19011906
@[deprecated union_insert_right_equiv_insert_union (since := "2025-11-03")]
19021907
theorem union_insert_right_equiv_union_insert [EquivBEq α] [LawfulHashable α] {p : (a : α) × β a} :
19031908
(m₁ ∪ (m₂.insert p.fst p.snd)) ~m ((m₁ ∪ m₂).insert p.fst p.snd) :=

src/Std/Data/DHashMap/RawLemmas.lean

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,26 +2041,36 @@ theorem mem_of_mem_union_of_not_mem_left [EquivBEq α]
20412041
simp_to_raw using Raw₀.contains_of_contains_union_of_contains_eq_false_left
20422042

20432043
/- Equiv -/
2044-
theorem union_equiv_congr_left {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
2044+
theorem Equiv.union_left {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
20452045
(equiv : m₁ ~m m₂) :
20462046
(m₁ ∪ m₃) ~m (m₂ ∪ m₃) := by
20472047
revert equiv
20482048
simp only [Union.union]
20492049
simp_to_raw
20502050
intro hyp
2051-
apply Raw₀.union_equiv_congr_left
2051+
apply Raw₀.Equiv.union_left
20522052
all_goals wf_trivial
20532053

2054-
theorem union_equiv_congr_right {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
2054+
theorem Equiv.union_right {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
20552055
(equiv : m₂ ~m m₃) :
20562056
(m₁ ∪ m₂) ~m (m₁ ∪ m₃) := by
20572057
revert equiv
20582058
simp only [Union.union]
20592059
simp_to_raw
20602060
intro hyp
2061-
apply Raw₀.union_equiv_congr_right
2061+
apply Raw₀.Equiv.union_right
20622062
all_goals wf_trivial
20632063

2064+
theorem Equiv.union_congr {m₃ m₄ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (h₄ : m₄.WF)
2065+
(equiv₁ : m₁ ~m m₃)
2066+
(equiv₂ : m₂ ~m m₄) :
2067+
(m₁ ∪ m₂) ~m (m₃ ∪ m₄) := by
2068+
simp only [Union.union]
2069+
revert equiv₁ equiv₂
2070+
simp_to_raw
2071+
intro equiv₁ equiv₂
2072+
apply Raw₀.Equiv.union_congr h₁ h₂ h₃ h₄ equiv₁ equiv₂
2073+
20642074
theorem union_insert_right_equiv_insert_union [EquivBEq α] [LawfulHashable α] {p : (a : α) × β a}
20652075
(h₁ : m₁.WF) (h₂ : m₂.WF) :
20662076
(m₁ ∪ (m₂.insert p.fst p.snd)).Equiv ((m₁ ∪ m₂).insert p.fst p.snd) := by

src/Std/Data/DTreeMap/Internal/Lemmas.lean

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,7 +3389,7 @@ theorem union!_insert_right_equiv_insert_union! [TransOrd α] {p : (a : α) ×
33893389
. wf_trivial
33903390
. exact h₂.balanced
33913391

3392-
theorem union_equiv_congr_left {m₃ : Impl α β} [TransOrd α]
3392+
theorem Equiv.union_left {m₃ : Impl α β} [TransOrd α]
33933393
(h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (equiv : m₁.Equiv m₂) :
33943394
(m₁.union m₃ h₁.balanced h₃.balanced).Equiv (m₂.union m₃ h₂.balanced h₃.balanced) := by
33953395
revert equiv
@@ -3402,10 +3402,10 @@ theorem union!_equiv_congr_left {m₃ : Impl α β} [TransOrd α]
34023402
(h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (equiv : m₁.Equiv m₂) :
34033403
(m₁.union! m₃).Equiv (m₂.union! m₃) := by
34043404
rw [← union_eq_union!, ← union_eq_union!]
3405-
apply union_equiv_congr_left
3405+
apply Equiv.union_left
34063406
all_goals wf_trivial
34073407

3408-
theorem union_equiv_congr_right {m₃ : Impl α β} [TransOrd α]
3408+
theorem Equiv.union_right {m₃ : Impl α β} [TransOrd α]
34093409
(h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (equiv : m₂.Equiv m₃) :
34103410
(m₁.union m₂ h₁.balanced h₂.balanced).Equiv (m₁.union m₃ h₁.balanced h₃.balanced) := by
34113411
revert equiv
@@ -3418,7 +3418,23 @@ theorem union!_equiv_congr_right {m₃ : Impl α β} [TransOrd α]
34183418
(h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (equiv : m₂.Equiv m₃) :
34193419
(m₁.union! m₂).Equiv (m₁.union! m₃) := by
34203420
rw [← union_eq_union!, ← union_eq_union!]
3421-
apply union_equiv_congr_right
3421+
apply Equiv.union_right
3422+
all_goals wf_trivial
3423+
3424+
theorem Equiv.union_congr {m₃ m₄: Impl α β} [TransOrd α]
3425+
(h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (h₄ : m₄.WF) (equiv₁ : m₁.Equiv m₃)(equiv₂ : m₂.Equiv m₄) :
3426+
(m₁.union m₂ h₁.balanced h₂.balanced).Equiv (m₃.union m₄ h₃.balanced h₄.balanced) := by
3427+
revert equiv₁ equiv₂
3428+
simp_to_model [Equiv, union]
3429+
intro equiv₁ equiv₂
3430+
apply List.insertList_congr equiv₁ equiv₂
3431+
all_goals wf_trivial
3432+
3433+
theorem union!_equiv_congr {m₃ m₄: Impl α β} [TransOrd α]
3434+
(h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (h₄ : m₄.WF) (equiv₁ : m₁.Equiv m₃) (equiv₂ : m₂.Equiv m₄) :
3435+
(m₁.union! m₂).Equiv (m₃.union! m₄) := by
3436+
rw [← union_eq_union!, ← union_eq_union!]
3437+
apply Equiv.union_congr
34223438
all_goals wf_trivial
34233439

34243440
/- get? -/

src/Std/Data/DTreeMap/Lemmas.lean

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,21 +2260,28 @@ theorem mem_of_mem_union_of_not_mem_left [TransCmp cmp]
22602260

22612261

22622262
/- Equiv -/
2263-
theorem union_equiv_congr_left {t₃ : DTreeMap α β cmp} [TransCmp cmp]
2263+
theorem Equiv.union_left {t₃ : DTreeMap α β cmp} [TransCmp cmp]
22642264
(equiv : t₁.Equiv t₂) :
22652265
(t₁ ∪ t₃).Equiv (t₂ ∪ t₃) := by
22662266
simp only [Union.union]
22672267
constructor
22682268
have ⟨equiv⟩ := equiv
2269-
apply Impl.union_equiv_congr_left t₁.wf t₂.wf t₃.wf equiv
2269+
apply Impl.Equiv.union_left t₁.wf t₂.wf t₃.wf equiv
22702270

2271-
theorem union_equiv_congr_right {t₃ : DTreeMap α β cmp} [TransCmp cmp]
2271+
theorem Equiv.union_right {t₃ : DTreeMap α β cmp} [TransCmp cmp]
22722272
(equiv : t₂.Equiv t₃) :
22732273
(t₁ ∪ t₂).Equiv (t₁ ∪ t₃) := by
22742274
simp only [Union.union]
22752275
constructor
22762276
have ⟨equiv⟩ := equiv
2277-
apply Impl.union_equiv_congr_right t₁.wf t₂.wf t₃.wf equiv
2277+
apply Impl.Equiv.union_right t₁.wf t₂.wf t₃.wf equiv
2278+
2279+
theorem Equiv.union_congr {t₃ t₄ : DTreeMap α β cmp} [TransCmp cmp]
2280+
(equiv₁ : t₁.Equiv t₃) (equiv₂ : t₂.Equiv t₄) :
2281+
(t₁ ∪ t₂).Equiv (t₃ ∪ t₄) := by
2282+
simp only [Union.union]
2283+
constructor
2284+
apply Impl.Equiv.union_congr t₁.wf t₂.wf t₃.wf t₄.wf equiv₁.1 equiv₂.1
22782285

22792286
theorem union_insert_right_equiv_insert_union [TransCmp cmp] {p : (a : α) × β a} :
22802287
(t₁ ∪ (t₂.insert p.fst p.snd)).Equiv ((t₁ ∪ t₂).insert p.fst p.snd) :=

src/Std/Data/DTreeMap/Raw/Lemmas.lean

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,22 +2317,30 @@ theorem mem_of_mem_union_of_not_mem_left [TransCmp cmp]
23172317
exact Impl.contains_of_contains_union!_of_contains_eq_false_left h₁ h₂
23182318

23192319
/- Equiv -/
2320-
theorem union_equiv_congr_left {t₃ : Raw α β cmp} [TransCmp cmp]
2320+
theorem Equiv.union_left {t₃ : Raw α β cmp} [TransCmp cmp]
23212321
(h₁ : t₁.WF) (h₂ : t₂.WF) (h₃ : t₃.WF) (equiv : t₁.Equiv t₂) :
23222322
(t₁ ∪ t₃).Equiv (t₂ ∪ t₃) := by
23232323
simp only [Union.union]
23242324
constructor
23252325
have ⟨equiv⟩ := equiv
23262326
apply Impl.union!_equiv_congr_left h₁ h₂ h₃ equiv
23272327

2328-
theorem union_equiv_congr_right {t₃ : Raw α β cmp} [TransCmp cmp]
2328+
theorem Equiv.union_right {t₃ : Raw α β cmp} [TransCmp cmp]
23292329
(h₁ : t₁.WF) (h₂ : t₂.WF) (h₃ : t₃.WF) (equiv : t₂.Equiv t₃) :
23302330
(t₁ ∪ t₂).Equiv (t₁ ∪ t₃) := by
23312331
simp only [Union.union]
23322332
constructor
23332333
have ⟨equiv⟩ := equiv
23342334
apply Impl.union!_equiv_congr_right h₁ h₂ h₃ equiv
23352335

2336+
theorem Equiv.union_congr {t₃ t₄ : Raw α β cmp} [TransCmp cmp]
2337+
(h₁ : t₁.WF) (h₂ : t₂.WF) (h₃ : t₃.WF) (h₄ : t₄.WF)
2338+
(equiv₁ : t₁.Equiv t₃) (equiv₂ : t₂.Equiv t₄) :
2339+
(t₁ ∪ t₂).Equiv (t₃ ∪ t₄) := by
2340+
simp only [Union.union]
2341+
constructor
2342+
apply Impl.union!_equiv_congr h₁ h₂ h₃ h₄ equiv₁.1 equiv₂.1
2343+
23362344
theorem union_insert_right_equiv_insert_union [TransCmp cmp] {p : (a : α) × β a}
23372345
(h₁ : t₁.WF) (h₂ : t₂.WF) :
23382346
(t₁ ∪ (t₂.insert p.fst p.snd)).Equiv ((t₁ ∪ t₂).insert p.fst p.snd) := by

src/Std/Data/ExtDHashMap/Basic.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,12 @@ def Const.insertManyIfNewUnit [EquivBEq α] [LawfulHashable α] {ρ : Type w}
351351
m := ⟨m.1.insertIfNew a (), fun _ init step => step (m.2 _ init step)⟩
352352
return m.1
353353

354-
theorem union_congr [EquivBEq α] [LawfulHashable α] (a b c d : DHashMap α β) (h₁ : a ~m c) (h₂ : b ~m d) : a ∪ b ~m c ∪ d :=
355-
DHashMap.Equiv.trans (DHashMap.union_equiv_congr_left h₁) (DHashMap.union_equiv_congr_right h₂)
356-
357354
@[inline, inherit_doc DHashMap.union]
358355
def union [EquivBEq α] [LawfulHashable α] (m₁ m₂ : ExtDHashMap α β) : ExtDHashMap α β := lift₂ (fun x y : DHashMap α β => mk (x.union y))
359356
(fun a b c d equiv₁ equiv₂ => by
360357
simp only [DHashMap.union_eq, mk'.injEq]
361358
apply Quotient.sound
362-
apply union_congr
359+
apply DHashMap.Equiv.union_congr
363360
. exact equiv₁
364361
. exact equiv₂) m₁ m₂
365362

src/Std/Data/ExtDTreeMap/Basic.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,15 +907,12 @@ def insertManyIfNewUnit [TransCmp cmp] {ρ} [ForIn Id ρ α] (t : ExtDTreeMap α
907907

908908
end Const
909909

910-
theorem union_congr [TransCmp cmp] (a b c d : DTreeMap α β cmp) (h₁ : a ~m c) (h₂ : b ~m d) : a ∪ b ~m c ∪ d :=
911-
DTreeMap.Equiv.trans (DTreeMap.union_equiv_congr_left h₁) (DTreeMap.union_equiv_congr_right h₂)
912-
913910
@[inline, inherit_doc DTreeMap.union]
914911
def union [TransCmp cmp] (m₁ m₂ : ExtDTreeMap α β cmp) : ExtDTreeMap α β cmp := lift₂ (fun x y : DTreeMap α β cmp => mk (x.union y))
915912
(fun a b c d equiv₁ equiv₂ => by
916913
simp only [DTreeMap.union_eq, mk'.injEq]
917914
apply Quotient.sound
918-
apply union_congr
915+
apply DTreeMap.Equiv.union_congr
919916
. exact equiv₁
920917
. exact equiv₂) m₁ m₂
921918

src/Std/Data/HashMap/Lemmas.lean

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,15 +1389,20 @@ theorem mem_of_mem_union_of_not_mem_left [EquivBEq α]
13891389
@DHashMap.mem_of_mem_union_of_not_mem_left _ _ _ _ m₁.inner m₂.inner _ _ k
13901390

13911391
/- Equiv -/
1392-
theorem union_equiv_congr_left {m₃ : HashMap α β} [EquivBEq α] [LawfulHashable α]
1392+
theorem Equiv.union_left {m₃ : HashMap α β} [EquivBEq α] [LawfulHashable α]
13931393
(equiv : m₁ ~m m₂) :
13941394
(m₁ ∪ m₃) ~m (m₂ ∪ m₃) :=
1395-
⟨DHashMap.union_equiv_congr_left equiv.1
1395+
⟨DHashMap.Equiv.union_left equiv.1
13961396

1397-
theorem union_equiv_congr_right {m₃ : HashMap α β} [EquivBEq α] [LawfulHashable α]
1397+
theorem Equiv.union_right {m₃ : HashMap α β} [EquivBEq α] [LawfulHashable α]
13981398
(equiv : m₂ ~m m₃) :
13991399
(m₁ ∪ m₂) ~m (m₁ ∪ m₃) :=
1400-
⟨DHashMap.union_equiv_congr_right equiv.1
1400+
⟨DHashMap.Equiv.union_right equiv.1
1401+
1402+
theorem Equiv.union_congr {m₃ m₄ : HashMap α β} [EquivBEq α] [LawfulHashable α]
1403+
(equiv₁ : m₁ ~m m₃) (equiv₂ : m₂ ~m m₄) :
1404+
(m₁ ∪ m₂) ~m (m₃ ∪ m₄) :=
1405+
⟨DHashMap.Equiv.union_congr equiv₁.1 equiv₂.1
14011406

14021407
theorem union_insert_right_equiv_insert_union [EquivBEq α] [LawfulHashable α] {p : α × β} :
14031408
(m₁ ∪ (m₂.insert p.fst p.snd)) ~m ((m₁ ∪ m₂).insert p.fst p.snd) :=

src/Std/Data/HashMap/RawLemmas.lean

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,15 +1353,20 @@ theorem mem_of_mem_union_of_not_mem_left [EquivBEq α]
13531353
@DHashMap.Raw.mem_of_mem_union_of_not_mem_left _ _ _ _ m₁.inner m₂.inner _ _ h₁.out h₂.out k
13541354

13551355
/- Equiv -/
1356-
theorem union_equiv_congr_left {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
1356+
theorem Equiv.union_left {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
13571357
(equiv : m₁ ~m m₂) :
13581358
(m₁ ∪ m₃) ~m (m₂ ∪ m₃) :=
1359-
⟨@DHashMap.Raw.union_equiv_congr_left _ _ _ _ m₁.inner m₂.inner m₃.inner _ _ h₁.out h₂.out h₃.out equiv.1
1359+
⟨@DHashMap.Raw.Equiv.union_left _ _ _ _ m₁.inner m₂.inner m₃.inner _ _ h₁.out h₂.out h₃.out equiv.1
13601360

1361-
theorem union_equiv_congr_right {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
1361+
theorem Equiv.union_right {m₃ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF)
13621362
(equiv : m₂ ~m m₃) :
13631363
(m₁ ∪ m₂) ~m (m₁ ∪ m₃) :=
1364-
⟨@DHashMap.Raw.union_equiv_congr_right _ _ _ _ m₁.inner m₂.inner m₃.inner _ _ h₁.out h₂.out h₃.out equiv.1
1364+
⟨@DHashMap.Raw.Equiv.union_right _ _ _ _ m₁.inner m₂.inner m₃.inner _ _ h₁.out h₂.out h₃.out equiv.1
1365+
1366+
theorem Equiv.union_congr {m₃ m₄ : Raw α β} [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF) (h₂ : m₂.WF) (h₃ : m₃.WF) (h₄ : m₄.WF)
1367+
(equiv₁ : m₁ ~m m₃) (equiv₂ : m₂ ~m m₄) :
1368+
(m₁ ∪ m₂) ~m (m₃ ∪ m₄) :=
1369+
⟨@DHashMap.Raw.Equiv.union_congr _ _ _ _ m₁.inner m₂.inner m₃.inner m₄.inner _ _ h₁.out h₂.out h₃.out h₄.out equiv₁.1 equiv₂.1
13651370

13661371
theorem union_insert_right_equiv_insert_union [EquivBEq α] [LawfulHashable α] {p : α × β}
13671372
(h₁ : m₁.WF) (h₂ : m₂.WF) :

0 commit comments

Comments
 (0)