Skip to content

Commit f7a8138

Browse files
committed
chore: fix premises of size_union_of_not_mem
1 parent 6cf3b00 commit f7a8138

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

src/Std/Data/DHashMap/Lemmas.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,9 +1965,10 @@ theorem getKey!_union_of_not_mem_right [Inhabited α]
19651965

19661966
/- size -/
19671967
theorem size_union_of_not_mem [EquivBEq α] [LawfulHashable α] :
1968-
(∀ (a : α), m₁.contains a → m₂.contains a = false) →
1969-
(m₁ ∪ m₂).size = m₁.size + m₂.size :=
1970-
@Raw₀.size_union_of_not_mem _ _ _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2
1968+
(∀ (a : α), a ∈ m₁ → ¬a ∈ m₂) →
1969+
(m₁ ∪ m₂).size = m₁.size + m₂.size := by
1970+
simp only [← contains_eq_false_iff_not_mem]
1971+
exact @Raw₀.size_union_of_not_mem _ _ _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2
19711972

19721973
theorem size_left_le_size_union [EquivBEq α] [LawfulHashable α] : m₁.size ≤ (m₁ ∪ m₂).size :=
19731974
@Raw₀.size_left_le_size_union α β _ _ ⟨m₁.1, m₁.2.size_buckets_pos⟩ ⟨m₂.1, m₂.2.size_buckets_pos⟩ _ _ m₁.2 m₂.2

src/Std/Data/DHashMap/RawLemmas.lean

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,8 +2149,15 @@ theorem getKey!_union_of_not_mem_right [Inhabited α]
21492149

21502150
/- size -/
21512151
theorem size_union_of_not_mem [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF)
2152-
(h₂ : m₂.WF) : (∀ (a : α), m₁.contains a → m₂.contains a = false) →
2152+
(h₂ : m₂.WF) : (∀ (a : α), a ∈ m₁ → ¬a ∈ m₂) →
21532153
(m₁ ∪ m₂).size = m₁.size + m₂.size := by
2154+
intro hyp
2155+
conv at hyp =>
2156+
ext
2157+
lhs
2158+
rw [mem_iff_contains]
2159+
simp only [← contains_eq_false_iff_not_mem] at hyp
2160+
revert hyp
21542161
simp only [Union.union]
21552162
simp_to_raw using Raw₀.size_union_of_not_mem
21562163

src/Std/Data/HashMap/Lemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ theorem getKey!_union_of_not_mem_right [Inhabited α]
14821482

14831483
/- size -/
14841484
theorem size_union_of_not_mem [EquivBEq α] [LawfulHashable α] :
1485-
(∀ (a : α), m₁.contains a → m₂.contains a = false) →
1485+
(∀ (a : α), a ∈ m₁ → ¬a ∈ m₂) →
14861486
(m₁ ∪ m₂).size = m₁.size + m₂.size :=
14871487
@DHashMap.size_union_of_not_mem _ _ _ _ m₁.inner m₂.inner _ _
14881488

src/Std/Data/HashMap/RawLemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ theorem getKey!_union_of_not_mem_right [Inhabited α]
14601460

14611461
/- size -/
14621462
theorem size_union_of_not_mem [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF)
1463-
(h₂ : m₂.WF) : (∀ (a : α), m₁.contains a → m₂.contains a = false) →
1463+
(h₂ : m₂.WF) : (∀ (a : α), a ∈ m₁ → ¬a ∈ m₂) →
14641464
(m₁ ∪ m₂).size = m₁.size + m₂.size :=
14651465
@DHashMap.Raw.size_union_of_not_mem _ _ _ _ m₁.inner m₂.inner _ _ h₁.out h₂.out
14661466

src/Std/Data/HashSet/Lemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ theorem get!_union_of_not_mem_right [Inhabited α]
858858

859859
/- size -/
860860
theorem size_union_of_not_mem [EquivBEq α] [LawfulHashable α] :
861-
(∀ (a : α), m₁.contains a → m₂.contains a = false) →
861+
(∀ (a : α), a ∈ m₁ → ¬a ∈ m₂) →
862862
(m₁ ∪ m₂).size = m₁.size + m₂.size :=
863863
@HashMap.size_union_of_not_mem _ _ _ _ m₁.inner m₂.inner _ _
864864

src/Std/Data/HashSet/RawLemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ theorem get!_union_of_not_mem_right [Inhabited α]
894894

895895
/- size -/
896896
theorem size_union_of_not_mem [EquivBEq α] [LawfulHashable α] (h₁ : m₁.WF)
897-
(h₂ : m₂.WF) : (∀ (a : α), m₁.contains a → m₂.contains a = false) →
897+
(h₂ : m₂.WF) : (∀ (a : α), a ∈ m₁ → ¬a ∈ m₂) →
898898
(m₁ ∪ m₂).size = m₁.size + m₂.size :=
899899
@HashMap.Raw.size_union_of_not_mem _ _ _ _ m₁.inner m₂.inner _ _ h₁.out h₂.out
900900

0 commit comments

Comments
 (0)