data.list.lattice
⟷
Mathlib.Data.List.Lattice
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -203,7 +203,7 @@ theorem cons_union (l₁ l₂ : List α) (a : α) : a :: l₁ ∪ l₂ = insert
theorem mem_union_iff : a ∈ l₁ ∪ l₂ ↔ a ∈ l₁ ∨ a ∈ l₂ := by
induction l₁ <;>
simp only [nil_union, not_mem_nil, false_or_iff, cons_union, mem_insert_iff, mem_cons_iff,
- or_assoc', *]
+ or_assoc, *]
#align list.mem_union List.mem_union_iff
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -428,7 +428,7 @@ theorem count_bagInter {a : α} :
· rw [if_neg ab, tsub_zero, add_zero, add_zero]
· rw [cons_bag_inter_of_neg _ hb, count_bag_inter]
by_cases ab : a = b
- · rw [← ab] at hb ; rw [count_eq_zero.2 hb, min_zero, min_zero]
+ · rw [← ab] at hb; rw [count_eq_zero.2 hb, min_zero, min_zero]
· rw [count_cons_of_ne ab]
#align list.count_bag_inter List.count_bagInter
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -4,9 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro,
Scott Morrison
-/
-import Mathbin.Data.List.Count
-import Mathbin.Data.List.Infix
-import Mathbin.Algebra.Order.Monoid.MinMax
+import Data.List.Count
+import Data.List.Infix
+import Algebra.Order.Monoid.MinMax
#align_import data.list.lattice from "leanprover-community/mathlib"@"be24ec5de6701447e5df5ca75400ffee19d65659"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -198,24 +198,24 @@ theorem cons_union (l₁ l₂ : List α) (a : α) : a :: l₁ ∪ l₂ = insert
rfl
#align list.cons_union List.cons_unionₓ
-#print List.mem_union /-
+#print List.mem_union_iff /-
@[simp]
-theorem mem_union : a ∈ l₁ ∪ l₂ ↔ a ∈ l₁ ∨ a ∈ l₂ := by
+theorem mem_union_iff : a ∈ l₁ ∪ l₂ ↔ a ∈ l₁ ∨ a ∈ l₂ := by
induction l₁ <;>
simp only [nil_union, not_mem_nil, false_or_iff, cons_union, mem_insert_iff, mem_cons_iff,
or_assoc', *]
-#align list.mem_union List.mem_union
+#align list.mem_union List.mem_union_iff
-/
#print List.mem_union_left /-
theorem mem_union_left (h : a ∈ l₁) (l₂ : List α) : a ∈ l₁ ∪ l₂ :=
- mem_union.2 (Or.inl h)
+ mem_union_iff.2 (Or.inl h)
#align list.mem_union_left List.mem_union_left
-/
#print List.mem_union_right /-
theorem mem_union_right (l₁ : List α) (h : a ∈ l₂) : a ∈ l₁ ∪ l₂ :=
- mem_union.2 (Or.inr h)
+ mem_union_iff.2 (Or.inr h)
#align list.mem_union_right List.mem_union_right
-/
@@ -309,11 +309,11 @@ theorem mem_inter_of_mem_of_mem : a ∈ l₁ → a ∈ l₂ → a ∈ l₁ ∩ l
#align list.mem_inter_of_mem_of_mem List.mem_inter_of_mem_of_mem
-/
-#print List.mem_inter /-
+#print List.mem_inter_iff /-
@[simp]
-theorem mem_inter : a ∈ l₁ ∩ l₂ ↔ a ∈ l₁ ∧ a ∈ l₂ :=
+theorem mem_inter_iff : a ∈ l₁ ∩ l₂ ↔ a ∈ l₁ ∧ a ∈ l₂ :=
mem_filter
-#align list.mem_inter List.mem_inter
+#align list.mem_inter List.mem_inter_iff
-/
#print List.inter_subset_left /-
@@ -329,7 +329,7 @@ theorem inter_subset_right (l₁ l₂ : List α) : l₁ ∩ l₂ ⊆ l₂ := fun
#print List.subset_inter /-
theorem subset_inter {l l₁ l₂ : List α} (h₁ : l ⊆ l₁) (h₂ : l ⊆ l₂) : l ⊆ l₁ ∩ l₂ := fun a h =>
- mem_inter.2 ⟨h₁ h, h₂ h⟩
+ mem_inter_iff.2 ⟨h₁ h, h₂ h⟩
#align list.subset_inter List.subset_inter
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -3,16 +3,13 @@ Copyright (c) 2014 Parikshit Khanna. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro,
Scott Morrison
-
-! This file was ported from Lean 3 source module data.list.lattice
-! leanprover-community/mathlib commit be24ec5de6701447e5df5ca75400ffee19d65659
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.List.Count
import Mathbin.Data.List.Infix
import Mathbin.Algebra.Order.Monoid.MinMax
+#align_import data.list.lattice from "leanprover-community/mathlib"@"be24ec5de6701447e5df5ca75400ffee19d65659"
+
/-!
# Lattice structure of lists
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -79,9 +79,11 @@ theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoi
d (ss m)
#align list.disjoint_of_subset_left List.disjoint_of_subset_leftₓ
+#print List.disjoint_of_subset_right /-
theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂ := fun x m m₁ =>
d m (ss m₁)
#align list.disjoint_of_subset_right List.disjoint_of_subset_right
+-/
#print List.disjoint_of_disjoint_cons_left /-
theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂ → Disjoint l₁ l₂ :=
@@ -136,10 +138,12 @@ theorem disjoint_cons_left : Disjoint (a :: l₁) l₂ ↔ a ∉ l₂ ∧ Disjoi
(@disjoint_append_left _ l₂ [a] l₁).trans <| by simp only [singleton_disjoint]
#align list.disjoint_cons_left List.disjoint_cons_leftₓ
+#print List.disjoint_cons_right /-
@[simp]
theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ a ∉ l₁ ∧ Disjoint l₁ l₂ :=
disjoint_comm.trans <| by simp only [disjoint_comm, disjoint_cons_left]
#align list.disjoint_cons_right List.disjoint_cons_right
+-/
theorem disjoint_of_disjoint_append_left_left (d : Disjoint (l₁ ++ l₂) l) : Disjoint l₁ l :=
(disjoint_append_left.1 d).1
@@ -366,19 +370,26 @@ end Inter
section BagInter
+#print List.nil_bagInter /-
@[simp]
theorem nil_bagInter (l : List α) : [].bagInterₓ l = [] := by cases l <;> rfl
#align list.nil_bag_inter List.nil_bagInter
+-/
+#print List.bagInter_nil /-
@[simp]
theorem bagInter_nil (l : List α) : l.bagInterₓ [] = [] := by cases l <;> rfl
#align list.bag_inter_nil List.bagInter_nil
+-/
+#print List.cons_bagInter_of_pos /-
@[simp]
theorem cons_bagInter_of_pos (l₁ : List α) (h : a ∈ l₂) :
(a :: l₁).bagInterₓ l₂ = a :: l₁.bagInterₓ (l₂.eraseₓ a) := by cases l₂ <;> exact if_pos h
#align list.cons_bag_inter_of_pos List.cons_bagInter_of_pos
+-/
+#print List.cons_bagInter_of_neg /-
@[simp]
theorem cons_bagInter_of_neg (l₁ : List α) (h : a ∉ l₂) :
(a :: l₁).bagInterₓ l₂ = l₁.bagInterₓ l₂ :=
@@ -386,7 +397,9 @@ theorem cons_bagInter_of_neg (l₁ : List α) (h : a ∉ l₂) :
cases l₂; · simp only [bag_inter_nil]
simp only [erase_of_not_mem h, List.bagInter, if_neg h]
#align list.cons_bag_inter_of_neg List.cons_bagInter_of_neg
+-/
+#print List.mem_bagInter /-
@[simp]
theorem mem_bagInter {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁.bagInterₓ l₂ ↔ a ∈ l₁ ∧ a ∈ l₂
| [], l₂ => by simp only [nil_bag_inter, not_mem_nil, false_and_iff]
@@ -400,6 +413,7 @@ theorem mem_bagInter {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁.bagInter
symm; apply or_iff_right_of_imp
rintro ⟨rfl, h'⟩; exact h.elim h'
#align list.mem_bag_inter List.mem_bagInter
+-/
#print List.count_bagInter /-
@[simp]
@@ -422,6 +436,7 @@ theorem count_bagInter {a : α} :
#align list.count_bag_inter List.count_bagInter
-/
+#print List.bagInter_sublist_left /-
theorem bagInter_sublist_left : ∀ l₁ l₂ : List α, l₁.bagInterₓ l₂ <+ l₁
| [], l₂ => by simp
| b :: l₁, l₂ =>
@@ -430,13 +445,16 @@ theorem bagInter_sublist_left : ∀ l₁ l₂ : List α, l₁.bagInterₓ l₂ <
· exact (bag_inter_sublist_left _ _).cons_cons _
· apply sublist_cons_of_sublist; apply bag_inter_sublist_left
#align list.bag_inter_sublist_left List.bagInter_sublist_left
+-/
+#print List.bagInter_nil_iff_inter_nil /-
theorem bagInter_nil_iff_inter_nil : ∀ l₁ l₂ : List α, l₁.bagInterₓ l₂ = [] ↔ l₁ ∩ l₂ = []
| [], l₂ => by simp
| b :: l₁, l₂ => by
by_cases h : b ∈ l₂ <;> simp [h]
exact bag_inter_nil_iff_inter_nil l₁ l₂
#align list.bag_inter_nil_iff_inter_nil List.bagInter_nil_iff_inter_nil
+-/
end BagInter
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -165,8 +165,8 @@ theorem disjoint_take_drop {m n : ℕ} (hl : l.Nodup) (h : m ≤ n) : Disjoint (
by
induction l generalizing m n
case nil m n => simp
- case
- cons x xs xs_ih m n =>
+ case cons x xs xs_ih m
+ n =>
cases m <;> cases n <;>
simp only [disjoint_cons_left, mem_cons_iff, disjoint_cons_right, drop, true_or_iff,
eq_self_iff_true, not_true, false_and_iff, disjoint_nil_left, take]
@@ -417,7 +417,7 @@ theorem count_bagInter {a : α} :
· rw [if_neg ab, tsub_zero, add_zero, add_zero]
· rw [cons_bag_inter_of_neg _ hb, count_bag_inter]
by_cases ab : a = b
- · rw [← ab] at hb; rw [count_eq_zero.2 hb, min_zero, min_zero]
+ · rw [← ab] at hb ; rw [count_eq_zero.2 hb, min_zero, min_zero]
· rw [count_cons_of_ne ab]
#align list.count_bag_inter List.count_bagInter
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -79,12 +79,6 @@ theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoi
d (ss m)
#align list.disjoint_of_subset_left List.disjoint_of_subset_leftₓ
-/- warning: list.disjoint_of_subset_right -> List.disjoint_of_subset_right is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {l : List.{u1} α} {l₁ : List.{u1} α} {l₂ : List.{u1} α}, (HasSubset.Subset.{u1} (List.{u1} α) (List.hasSubset.{u1} α) l₂ l) -> (List.Disjoint.{u1} α l₁ l) -> (List.Disjoint.{u1} α l₁ l₂)
-but is expected to have type
- forall {α : Type.{u1}} {l : List.{u1} α} {l₁ : List.{u1} α} {l₂ : List.{u1} α}, (HasSubset.Subset.{u1} (List.{u1} α) (List.instHasSubsetList.{u1} α) l l₁) -> (List.Disjoint.{u1} α l₂ l₁) -> (List.Disjoint.{u1} α l₂ l)
-Case conversion may be inaccurate. Consider using '#align list.disjoint_of_subset_right List.disjoint_of_subset_rightₓ'. -/
theorem disjoint_of_subset_right (ss : l₂ ⊆ l) (d : Disjoint l₁ l) : Disjoint l₁ l₂ := fun x m m₁ =>
d m (ss m₁)
#align list.disjoint_of_subset_right List.disjoint_of_subset_right
@@ -142,12 +136,6 @@ theorem disjoint_cons_left : Disjoint (a :: l₁) l₂ ↔ a ∉ l₂ ∧ Disjoi
(@disjoint_append_left _ l₂ [a] l₁).trans <| by simp only [singleton_disjoint]
#align list.disjoint_cons_left List.disjoint_cons_leftₓ
-/- warning: list.disjoint_cons_right -> List.disjoint_cons_right is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : List.{u1} α} {a : α}, Iff (List.Disjoint.{u1} α l₁ (List.cons.{u1} α a l₂)) (And (Not (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l₁)) (List.Disjoint.{u1} α l₁ l₂))
-but is expected to have type
- forall {α : Type.{u1}} {l₁ : List.{u1} α} {l₂ : α} {a : List.{u1} α}, Iff (List.Disjoint.{u1} α l₁ (List.cons.{u1} α l₂ a)) (And (Not (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) l₂ l₁)) (List.Disjoint.{u1} α l₁ a))
-Case conversion may be inaccurate. Consider using '#align list.disjoint_cons_right List.disjoint_cons_rightₓ'. -/
@[simp]
theorem disjoint_cons_right : Disjoint l₁ (a :: l₂) ↔ a ∉ l₁ ∧ Disjoint l₁ l₂ :=
disjoint_comm.trans <| by simp only [disjoint_comm, disjoint_cons_left]
@@ -378,43 +366,19 @@ end Inter
section BagInter
-/- warning: list.nil_bag_inter -> List.nil_bagInter is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (List.nil.{u1} α) l) (List.nil.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) (List.nil.{u1} α) l) (List.nil.{u1} α)
-Case conversion may be inaccurate. Consider using '#align list.nil_bag_inter List.nil_bagInterₓ'. -/
@[simp]
theorem nil_bagInter (l : List α) : [].bagInterₓ l = [] := by cases l <;> rfl
#align list.nil_bag_inter List.nil_bagInter
-/- warning: list.bag_inter_nil -> List.bagInter_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) l (List.nil.{u1} α)) (List.nil.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l (List.nil.{u1} α)) (List.nil.{u1} α)
-Case conversion may be inaccurate. Consider using '#align list.bag_inter_nil List.bagInter_nilₓ'. -/
@[simp]
theorem bagInter_nil (l : List α) : l.bagInterₓ [] = [] := by cases l <;> rfl
#align list.bag_inter_nil List.bagInter_nil
-/- warning: list.cons_bag_inter_of_pos -> List.cons_bagInter_of_pos is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {l₂ : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l₂) -> (Eq.{succ u1} (List.{u1} α) (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (List.cons.{u1} α a l₁) l₂) (List.cons.{u1} α a (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) l₁ (List.eraseₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) l₂ a))))
-but is expected to have type
- forall {α : Type.{u1}} {l₂ : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α), (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l₂) -> (Eq.{succ u1} (List.{u1} α) (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) (List.cons.{u1} α a l₁) l₂) (List.cons.{u1} α a (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₁ (List.erase.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₂ a))))
-Case conversion may be inaccurate. Consider using '#align list.cons_bag_inter_of_pos List.cons_bagInter_of_posₓ'. -/
@[simp]
theorem cons_bagInter_of_pos (l₁ : List α) (h : a ∈ l₂) :
(a :: l₁).bagInterₓ l₂ = a :: l₁.bagInterₓ (l₂.eraseₓ a) := by cases l₂ <;> exact if_pos h
#align list.cons_bag_inter_of_pos List.cons_bagInter_of_pos
-/- warning: list.cons_bag_inter_of_neg -> List.cons_bagInter_of_neg is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {l₂ : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α), (Not (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l₂)) -> (Eq.{succ u1} (List.{u1} α) (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (List.cons.{u1} α a l₁) l₂) (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) l₁ l₂))
-but is expected to have type
- forall {α : Type.{u1}} {l₂ : List.{u1} α} {a : α} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α), (Not (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l₂)) -> (Eq.{succ u1} (List.{u1} α) (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) (List.cons.{u1} α a l₁) l₂) (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₁ l₂))
-Case conversion may be inaccurate. Consider using '#align list.cons_bag_inter_of_neg List.cons_bagInter_of_negₓ'. -/
@[simp]
theorem cons_bagInter_of_neg (l₁ : List α) (h : a ∉ l₂) :
(a :: l₁).bagInterₓ l₂ = l₁.bagInterₓ l₂ :=
@@ -423,12 +387,6 @@ theorem cons_bagInter_of_neg (l₁ : List α) (h : a ∉ l₂) :
simp only [erase_of_not_mem h, List.bagInter, if_neg h]
#align list.cons_bag_inter_of_neg List.cons_bagInter_of_neg
-/- warning: list.mem_bag_inter -> List.mem_bagInter is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {a : α} {l₁ : List.{u1} α} {l₂ : List.{u1} α}, Iff (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) l₁ l₂)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l₁) (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l₂))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] {a : α} {l₁ : List.{u1} α} {l₂ : List.{u1} α}, Iff (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₁ l₂)) (And (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l₁) (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l₂))
-Case conversion may be inaccurate. Consider using '#align list.mem_bag_inter List.mem_bagInterₓ'. -/
@[simp]
theorem mem_bagInter {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁.bagInterₓ l₂ ↔ a ∈ l₁ ∧ a ∈ l₂
| [], l₂ => by simp only [nil_bag_inter, not_mem_nil, false_and_iff]
@@ -464,12 +422,6 @@ theorem count_bagInter {a : α} :
#align list.count_bag_inter List.count_bagInter
-/
-/- warning: list.bag_inter_sublist_left -> List.bagInter_sublist_left is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α) (l₂ : List.{u1} α), List.Sublist.{u1} α (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) l₁ l₂) l₁
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α) (l₂ : List.{u1} α), List.Sublist.{u1} α (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₁ l₂) l₁
-Case conversion may be inaccurate. Consider using '#align list.bag_inter_sublist_left List.bagInter_sublist_leftₓ'. -/
theorem bagInter_sublist_left : ∀ l₁ l₂ : List α, l₁.bagInterₓ l₂ <+ l₁
| [], l₂ => by simp
| b :: l₁, l₂ =>
@@ -479,12 +431,6 @@ theorem bagInter_sublist_left : ∀ l₁ l₂ : List α, l₁.bagInterₓ l₂ <
· apply sublist_cons_of_sublist; apply bag_inter_sublist_left
#align list.bag_inter_sublist_left List.bagInter_sublist_left
-/- warning: list.bag_inter_nil_iff_inter_nil -> List.bagInter_nil_iff_inter_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α) (l₂ : List.{u1} α), Iff (Eq.{succ u1} (List.{u1} α) (List.bagInterₓ.{u1} α (fun (a : α) (b : α) => _inst_1 a b) l₁ l₂) (List.nil.{u1} α)) (Eq.{succ u1} (List.{u1} α) (Inter.inter.{u1} (List.{u1} α) (List.hasInter.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₁ l₂) (List.nil.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (l₁ : List.{u1} α) (l₂ : List.{u1} α), Iff (Eq.{succ u1} (List.{u1} α) (List.bagInter.{u1} α (instBEq.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₁ l₂) (List.nil.{u1} α)) (Eq.{succ u1} (List.{u1} α) (Inter.inter.{u1} (List.{u1} α) (List.instInterList.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) l₁ l₂) (List.nil.{u1} α))
-Case conversion may be inaccurate. Consider using '#align list.bag_inter_nil_iff_inter_nil List.bagInter_nil_iff_inter_nilₓ'. -/
theorem bagInter_nil_iff_inter_nil : ∀ l₁ l₂ : List α, l₁.bagInterₓ l₂ = [] ↔ l₁ ∩ l₂ = []
| [], l₂ => by simp
| b :: l₁, l₂ => by
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -109,18 +109,14 @@ theorem disjoint_nil_left (l : List α) : Disjoint [] l := fun a => (not_mem_nil
#print List.disjoint_nil_right /-
@[simp]
-theorem disjoint_nil_right (l : List α) : Disjoint l [] :=
- by
- rw [disjoint_comm]
+theorem disjoint_nil_right (l : List α) : Disjoint l [] := by rw [disjoint_comm];
exact disjoint_nil_left _
#align list.disjoint_nil_right List.disjoint_nil_right
-/
@[simp]
-theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l :=
- by
- simp only [Disjoint, mem_singleton, forall_eq]
- rfl
+theorem singleton_disjoint : Disjoint [a] l ↔ a ∉ l := by
+ simp only [Disjoint, mem_singleton, forall_eq]; rfl
#align list.singleton_disjoint List.singleton_disjointₓ
#print List.disjoint_singleton /-
@@ -188,8 +184,7 @@ theorem disjoint_take_drop {m n : ℕ} (hl : l.Nodup) (h : m ≤ n) : Disjoint (
eq_self_iff_true, not_true, false_and_iff, disjoint_nil_left, take]
· cases h
cases' hl with _ _ h₀ h₁; constructor
- · intro h
- exact h₀ _ (mem_of_mem_drop h) rfl
+ · intro h; exact h₀ _ (mem_of_mem_drop h) rfl
solve_by_elim (config := { max_depth := 4 }) [le_of_succ_le_succ]
#align list.disjoint_take_drop List.disjoint_take_dropₓ
@@ -350,10 +345,8 @@ theorem subset_inter {l l₁ l₂ : List α} (h₁ : l ⊆ l₁) (h₂ : l ⊆ l
-/
#print List.inter_eq_nil_iff_disjoint /-
-theorem inter_eq_nil_iff_disjoint : l₁ ∩ l₂ = [] ↔ Disjoint l₁ l₂ :=
- by
- simp only [eq_nil_iff_forall_not_mem, mem_inter, not_and]
- rfl
+theorem inter_eq_nil_iff_disjoint : l₁ ∩ l₂ = [] ↔ Disjoint l₁ l₂ := by
+ simp only [eq_nil_iff_forall_not_mem, mem_inter, not_and]; rfl
#align list.inter_eq_nil_iff_disjoint List.inter_eq_nil_iff_disjoint
-/
@@ -446,10 +439,8 @@ theorem mem_bagInter {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁.bagInter
· simp only [ba, h, eq_self_iff_true, true_or_iff, true_and_iff]
· simp only [mem_erase_of_ne ba, ba, false_or_iff]
· rw [cons_bag_inter_of_neg _ h, mem_bag_inter, mem_cons_iff, or_and_right]
- symm
- apply or_iff_right_of_imp
- rintro ⟨rfl, h'⟩
- exact h.elim h'
+ symm; apply or_iff_right_of_imp
+ rintro ⟨rfl, h'⟩; exact h.elim h'
#align list.mem_bag_inter List.mem_bagInter
#print List.count_bagInter /-
@@ -468,8 +459,7 @@ theorem count_bagInter {a : α} :
· rw [if_neg ab, tsub_zero, add_zero, add_zero]
· rw [cons_bag_inter_of_neg _ hb, count_bag_inter]
by_cases ab : a = b
- · rw [← ab] at hb
- rw [count_eq_zero.2 hb, min_zero, min_zero]
+ · rw [← ab] at hb; rw [count_eq_zero.2 hb, min_zero, min_zero]
· rw [count_cons_of_ne ab]
#align list.count_bag_inter List.count_bagInter
-/
@@ -486,8 +476,7 @@ theorem bagInter_sublist_left : ∀ l₁ l₂ : List α, l₁.bagInterₓ l₂ <
by
by_cases b ∈ l₂ <;> simp only [h, cons_bag_inter_of_pos, cons_bag_inter_of_neg, not_false_iff]
· exact (bag_inter_sublist_left _ _).cons_cons _
- · apply sublist_cons_of_sublist
- apply bag_inter_sublist_left
+ · apply sublist_cons_of_sublist; apply bag_inter_sublist_left
#align list.bag_inter_sublist_left List.bagInter_sublist_left
/- warning: list.bag_inter_nil_iff_inter_nil -> List.bagInter_nil_iff_inter_nil is a dubious translation:
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -181,7 +181,7 @@ theorem forall_mem_inter_of_forall_right (l₁ : List α) (h : ∀ x ∈ l₂, p
@[simp]
theorem inter_reverse {xs ys : List α} : xs.inter ys.reverse = xs.inter ys := by
- simp only [List.inter, mem_reverse]
+ simp only [List.inter, elem_eq_mem, mem_reverse]
#align list.inter_reverse List.inter_reverse
end Inter
Make use of Nat
-specific lemmas from Std rather than the general ones provided by mathlib. Also reverse the dependency between Multiset.Nodup
/Multiset.dedup
and Multiset.sum
since only the latter needs algebra. Also rename Algebra.BigOperators.Multiset.Abs
to Algebra.BigOperators.Multiset.Order
and move some lemmas from Algebra.BigOperators.Multiset.Basic
to it.
The ultimate goal here is to carve out Data
, Algebra
and Order
sublibraries.
@@ -242,7 +242,7 @@ theorem count_bagInter {a : α} :
by_cases ab : a = b
· rw [if_pos ab, Nat.sub_add_cancel]
rwa [succ_le_iff, count_pos_iff_mem, ab]
- · rw [if_neg ab, Nat.sub_zero, add_zero, add_zero]
+ · rw [if_neg ab, Nat.sub_zero, Nat.add_zero, Nat.add_zero]
· rw [cons_bagInter_of_neg _ hb, count_bagInter]
by_cases ab : a = b
· rw [← ab] at hb
Use Nat
specialized theorems, and omega
, where necessary to avoid needing to import the abstract ordered algebra hierarchy for basic results about List
.
Import graph between Mathlib.Order.Basic
and Mathlib.Data.List.Basic
:
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -5,7 +5,6 @@ Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, M
Scott Morrison
-/
import Mathlib.Data.List.Basic
-import Mathlib.Algebra.Order.Monoid.MinMax
#align_import data.list.lattice from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
@@ -238,16 +237,16 @@ theorem count_bagInter {a : α} :
| l₁, [] => by simp
| b :: l₁, l₂ => by
by_cases hb : b ∈ l₂
- · rw [cons_bagInter_of_pos _ hb, count_cons, count_cons, count_bagInter, count_erase, ←
- min_add_add_right]
+ · rw [cons_bagInter_of_pos _ hb, count_cons, count_cons, count_bagInter, count_erase,
+ ← Nat.add_min_add_right]
by_cases ab : a = b
- · rw [if_pos ab, @tsub_add_cancel_of_le]
+ · rw [if_pos ab, Nat.sub_add_cancel]
rwa [succ_le_iff, count_pos_iff_mem, ab]
- · rw [if_neg ab, tsub_zero, add_zero, add_zero]
+ · rw [if_neg ab, Nat.sub_zero, add_zero, add_zero]
· rw [cons_bagInter_of_neg _ hb, count_bagInter]
by_cases ab : a = b
· rw [← ab] at hb
- rw [count_eq_zero.2 hb, min_zero, min_zero]
+ rw [count_eq_zero.2 hb, Nat.min_zero, Nat.min_zero]
· rw [count_cons_of_ne ab]
#align list.count_bag_inter List.count_bagInter
@@ -4,8 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro,
Scott Morrison
-/
-import Mathlib.Data.List.Count
-import Mathlib.Data.List.Infix
+import Mathlib.Data.List.Basic
import Mathlib.Algebra.Order.Monoid.MinMax
#align_import data.list.lattice from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
$
with <|
(#9319)
See Zulip thread for the discussion.
@@ -150,7 +150,7 @@ theorem mem_of_mem_inter_right (h : a ∈ l₁ ∩ l₂) : a ∈ l₂ := by simp
#align list.mem_of_mem_inter_right List.mem_of_mem_inter_right
theorem mem_inter_of_mem_of_mem (h₁ : a ∈ l₁) (h₂ : a ∈ l₂) : a ∈ l₁ ∩ l₂ :=
- mem_filter_of_mem h₁ $ by simpa using h₂
+ mem_filter_of_mem h₁ <| by simpa using h₂
#align list.mem_inter_of_mem_of_mem List.mem_inter_of_mem_of_mem
#align list.mem_inter List.mem_inter_iff
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -134,12 +134,12 @@ theorem inter_nil (l : List α) : [] ∩ l = [] :=
@[simp]
theorem inter_cons_of_mem (l₁ : List α) (h : a ∈ l₂) : (a :: l₁) ∩ l₂ = a :: l₁ ∩ l₂ := by
- simp only [Inter.inter, List.inter, filter_cons_of_pos, h]
+ simp [Inter.inter, List.inter, h]
#align list.inter_cons_of_mem List.inter_cons_of_mem
@[simp]
theorem inter_cons_of_not_mem (l₁ : List α) (h : a ∉ l₂) : (a :: l₁) ∩ l₂ = l₁ ∩ l₂ := by
- simp only [Inter.inter, List.inter, filter_cons_of_neg, h]
+ simp [Inter.inter, List.inter, h]
#align list.inter_cons_of_not_mem List.inter_cons_of_not_mem
theorem mem_of_mem_inter_left : a ∈ l₁ ∩ l₂ → a ∈ l₁ :=
This incorporates changes from https://github.com/leanprover-community/mathlib4/pull/6575
I have also renamed Multiset.countp
to Multiset.countP
for consistency.
Co-authored-by: James Gallichio <jamesgallicchio@gmail.com>
Co-authored-by: James <jamesgallicchio@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -239,11 +239,11 @@ theorem count_bagInter {a : α} :
| l₁, [] => by simp
| b :: l₁, l₂ => by
by_cases hb : b ∈ l₂
- · rw [cons_bagInter_of_pos _ hb, count_cons', count_cons', count_bagInter, count_erase, ←
+ · rw [cons_bagInter_of_pos _ hb, count_cons, count_cons, count_bagInter, count_erase, ←
min_add_add_right]
by_cases ab : a = b
· rw [if_pos ab, @tsub_add_cancel_of_le]
- rwa [succ_le_iff, count_pos, ab]
+ rwa [succ_le_iff, count_pos_iff_mem, ab]
· rw [if_neg ab, tsub_zero, add_zero, add_zero]
· rw [cons_bagInter_of_neg _ hb, count_bagInter]
by_cases ab : a = b
Also add a couple of refl and trans attributes
@@ -40,6 +40,7 @@ variable {α : Type*} {l l₁ l₂ : List α} {p : α → Prop} {a : α}
section Disjoint
+@[symm]
theorem Disjoint.symm (d : Disjoint l₁ l₂) : Disjoint l₂ l₁ := fun _ i₂ i₁ => d i₁ i₂
#align list.disjoint.symm List.Disjoint.symm
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -33,7 +33,7 @@ open Nat
namespace List
-variable {α : Type _} {l l₁ l₂ : List α} {p : α → Prop} {a : α}
+variable {α : Type*} {l l₁ l₂ : List α} {p : α → Prop} {a : α}
/-! ### `Disjoint` -/
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -92,12 +92,10 @@ theorem sublist_suffix_of_union : ∀ l₁ l₂ : List α, ∃ t, t <+ l₁ ∧
let ⟨t, s, e⟩ := sublist_suffix_of_union l₁ l₂
if h : a ∈ l₁ ∪ l₂ then
⟨t, sublist_cons_of_sublist _ s, by
- simp only [instUnionList] at h
- simp only [e, instUnionList, cons_union, insert_of_mem h]⟩
+ simp only [e, cons_union, insert_of_mem h]⟩
else
⟨a :: t, s.cons_cons _, by
- simp only [instUnionList] at h
- simp only [cons_append, instUnionList, cons_union, e, insert_of_not_mem h]⟩
+ simp only [cons_append, cons_union, e, insert_of_not_mem h]⟩
#align list.sublist_suffix_of_union List.sublist_suffix_of_union
theorem suffix_union_right (l₁ l₂ : List α) : l₂ <:+ l₁ ∪ l₂ :=
@@ -135,12 +133,12 @@ theorem inter_nil (l : List α) : [] ∩ l = [] :=
@[simp]
theorem inter_cons_of_mem (l₁ : List α) (h : a ∈ l₂) : (a :: l₁) ∩ l₂ = a :: l₁ ∩ l₂ := by
- simp only [instInterList, List.inter, filter_cons_of_pos, h]
+ simp only [Inter.inter, List.inter, filter_cons_of_pos, h]
#align list.inter_cons_of_mem List.inter_cons_of_mem
@[simp]
theorem inter_cons_of_not_mem (l₁ : List α) (h : a ∉ l₂) : (a :: l₁) ∩ l₂ = l₁ ∩ l₂ := by
- simp only [instInterList, List.inter, filter_cons_of_neg, h]
+ simp only [Inter.inter, List.inter, filter_cons_of_neg, h]
#align list.inter_cons_of_not_mem List.inter_cons_of_not_mem
theorem mem_of_mem_inter_left : a ∈ l₁ ∩ l₂ → a ∈ l₁ :=
Notably there is now a l1 ∪ l2
notation for List.union
.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Bulhwi Cha <chabulhwi@semmalgil.com>
@@ -76,20 +76,14 @@ section Union
#align list.nil_union List.nil_union
#align list.cons_union List.cons_unionₓ
-
-@[simp]
-theorem mem_union : a ∈ l₁ ∪ l₂ ↔ a ∈ l₁ ∨ a ∈ l₂ := by
- induction l₁
- · simp only [not_mem_nil, false_or_iff, instUnionList, nil_union]
- · simp only [find?, mem_cons, or_assoc, instUnionList, cons_union, mem_union_iff, mem_insert_iff]
-#align list.mem_union List.mem_union
+#align list.mem_union List.mem_union_iff
theorem mem_union_left (h : a ∈ l₁) (l₂ : List α) : a ∈ l₁ ∪ l₂ :=
- mem_union.2 (Or.inl h)
+ mem_union_iff.2 (Or.inl h)
#align list.mem_union_left List.mem_union_left
theorem mem_union_right (l₁ : List α) (h : a ∈ l₂) : a ∈ l₁ ∪ l₂ :=
- mem_union.2 (Or.inr h)
+ mem_union_iff.2 (Or.inr h)
#align list.mem_union_right List.mem_union_right
theorem sublist_suffix_of_union : ∀ l₁ l₂ : List α, ∃ t, t <+ l₁ ∧ t ++ l₂ = l₁ ∪ l₂
@@ -116,7 +110,7 @@ theorem union_sublist_append (l₁ l₂ : List α) : l₁ ∪ l₂ <+ l₁ ++ l
#align list.union_sublist_append List.union_sublist_append
theorem forall_mem_union : (∀ x ∈ l₁ ∪ l₂, p x) ↔ (∀ x ∈ l₁, p x) ∧ ∀ x ∈ l₂, p x := by
- simp only [mem_union, or_imp, forall_and]
+ simp only [mem_union_iff, or_imp, forall_and]
#align list.forall_mem_union List.forall_mem_union
theorem forall_mem_of_forall_mem_union_left (h : ∀ x ∈ l₁ ∪ l₂, p x) : ∀ x ∈ l₁, p x :=
@@ -160,9 +154,7 @@ theorem mem_inter_of_mem_of_mem (h₁ : a ∈ l₁) (h₂ : a ∈ l₂) : a ∈
mem_filter_of_mem h₁ $ by simpa using h₂
#align list.mem_inter_of_mem_of_mem List.mem_inter_of_mem_of_mem
-@[simp]
-theorem mem_inter : a ∈ l₁ ∩ l₂ ↔ a ∈ l₁ ∧ a ∈ l₂ := by erw [mem_filter]; simp
-#align list.mem_inter List.mem_inter
+#align list.mem_inter List.mem_inter_iff
theorem inter_subset_left (l₁ l₂ : List α) : l₁ ∩ l₂ ⊆ l₁ :=
filter_subset _
@@ -172,11 +164,11 @@ theorem inter_subset_right (l₁ l₂ : List α) : l₁ ∩ l₂ ⊆ l₂ := fun
#align list.inter_subset_right List.inter_subset_right
theorem subset_inter {l l₁ l₂ : List α} (h₁ : l ⊆ l₁) (h₂ : l ⊆ l₂) : l ⊆ l₁ ∩ l₂ := fun _ h =>
- mem_inter.2 ⟨h₁ h, h₂ h⟩
+ mem_inter_iff.2 ⟨h₁ h, h₂ h⟩
#align list.subset_inter List.subset_inter
theorem inter_eq_nil_iff_disjoint : l₁ ∩ l₂ = [] ↔ Disjoint l₁ l₂ := by
- simp only [eq_nil_iff_forall_not_mem, mem_inter, not_and]
+ simp only [eq_nil_iff_forall_not_mem, mem_inter_iff, not_and]
rfl
#align list.inter_eq_nil_iff_disjoint List.inter_eq_nil_iff_disjoint
@@ -3,16 +3,13 @@ Copyright (c) 2014 Parikshit Khanna. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro,
Scott Morrison
-
-! This file was ported from Lean 3 source module data.list.lattice
-! leanprover-community/mathlib commit dd71334db81d0bd444af1ee339a29298bef40734
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.List.Count
import Mathlib.Data.List.Infix
import Mathlib.Algebra.Order.Monoid.MinMax
+#align_import data.list.lattice from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
+
/-!
# Lattice structure of lists
fix-comments.py
on all files.@@ -38,7 +38,7 @@ namespace List
variable {α : Type _} {l l₁ l₂ : List α} {p : α → Prop} {a : α}
-/-! ### `disjoint` -/
+/-! ### `Disjoint` -/
section Disjoint
by
s! (#3825)
This PR puts, with one exception, every single remaining by
that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh
. The exception is when the by
begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.
Essentially this is s/\n *by$/ by/g
, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated by
s".
@@ -266,8 +266,7 @@ theorem count_bagInter {a : α} :
theorem bagInter_sublist_left : ∀ l₁ l₂ : List α, l₁.bagInter l₂ <+ l₁
| [], l₂ => by simp
- | b :: l₁, l₂ =>
- by
+ | b :: l₁, l₂ => by
by_cases h : b ∈ l₂ <;> simp only [h, cons_bagInter_of_pos, cons_bagInter_of_neg, not_false_iff]
· exact (bagInter_sublist_left _ _).cons_cons _
· apply sublist_cons_of_sublist
This PR fixes two things:
align
statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align
). This is often seen in the mathport output after ending calc
blocks.#align
statements. (This was needed for a script I wrote for #3630.)@@ -85,7 +85,6 @@ theorem mem_union : a ∈ l₁ ∪ l₂ ↔ a ∈ l₁ ∨ a ∈ l₂ := by
induction l₁
· simp only [not_mem_nil, false_or_iff, instUnionList, nil_union]
· simp only [find?, mem_cons, or_assoc, instUnionList, cons_union, mem_union_iff, mem_insert_iff]
-
#align list.mem_union List.mem_union
theorem mem_union_left (h : a ∈ l₁) (l₂ : List α) : a ∈ l₁ ∪ l₂ :=
@@ -233,7 +233,7 @@ theorem cons_bagInter_of_neg (l₁ : List α) (h : a ∉ l₂) :
theorem mem_bagInter {a : α} : ∀ {l₁ l₂ : List α}, a ∈ l₁.bagInter l₂ ↔ a ∈ l₁ ∧ a ∈ l₂
| [], l₂ => by simp only [nil_bagInter, not_mem_nil, false_and_iff]
| b :: l₁, l₂ => by
- by_cases b ∈ l₂
+ by_cases h : b ∈ l₂
· rw [cons_bagInter_of_pos _ h, mem_cons, mem_cons, mem_bagInter]
by_cases ba : a = b
· simp only [ba, h, eq_self_iff_true, true_or_iff, true_and_iff]
@@ -269,7 +269,7 @@ theorem bagInter_sublist_left : ∀ l₁ l₂ : List α, l₁.bagInter l₂ <+ l
| [], l₂ => by simp
| b :: l₁, l₂ =>
by
- by_cases b ∈ l₂ <;> simp only [h, cons_bagInter_of_pos, cons_bagInter_of_neg, not_false_iff]
+ by_cases h : b ∈ l₂ <;> simp only [h, cons_bagInter_of_pos, cons_bagInter_of_neg, not_false_iff]
· exact (bagInter_sublist_left _ _).cons_cons _
· apply sublist_cons_of_sublist
apply bagInter_sublist_left
@@ -255,7 +255,7 @@ theorem count_bagInter {a : α} :
· rw [cons_bagInter_of_pos _ hb, count_cons', count_cons', count_bagInter, count_erase, ←
min_add_add_right]
by_cases ab : a = b
- · rw [if_pos ab, tsub_add_cancel_of_le]
+ · rw [if_pos ab, @tsub_add_cancel_of_le]
rwa [succ_le_iff, count_pos, ab]
· rw [if_neg ab, tsub_zero, add_zero, add_zero]
· rw [cons_bagInter_of_neg _ hb, count_bagInter]
by
line breaks (#1523)
During porting, I usually fix the desired format we seem to want for the line breaks around by
with
awk '{do {{if (match($0, "^ by$") && length(p) < 98) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}' Mathlib/File/Im/Working/On.lean
I noticed there are some more files that slipped through.
This pull request is the result of running this command:
grep -lr "^ by\$" Mathlib | xargs -n 1 awk -i inplace '{do {{if (match($0, "^ by$") && length(p) < 98 && not (match(p, "^[ \t]*--"))) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}'
Co-authored-by: Moritz Firsching <firsching@google.com>
@@ -179,8 +179,7 @@ theorem subset_inter {l l₁ l₂ : List α} (h₁ : l ⊆ l₁) (h₂ : l ⊆ l
mem_inter.2 ⟨h₁ h, h₂ h⟩
#align list.subset_inter List.subset_inter
-theorem inter_eq_nil_iff_disjoint : l₁ ∩ l₂ = [] ↔ Disjoint l₁ l₂ :=
- by
+theorem inter_eq_nil_iff_disjoint : l₁ ∩ l₂ = [] ↔ Disjoint l₁ l₂ := by
simp only [eq_nil_iff_forall_not_mem, mem_inter, not_and]
rfl
#align list.inter_eq_nil_iff_disjoint List.inter_eq_nil_iff_disjoint
The unported dependencies are