Dataset Viewer
Auto-converted to Parquet Duplicate
Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
rank
int64
0
2.4k
import Batteries.Data.Array.Lemmas import Batteries.Tactic.Lint.Misc namespace Batteries structure UFNode where parent : Nat rank : Nat namespace UnionFind def panicWith (v : Ξ±) (msg : String) : Ξ± := @panic Ξ± ⟨v⟩ msg @[simp] theorem panicWith_eq (v : Ξ±) (msg) : panicWith v msg = v := rfl def parentD (arr : Array UFNode) (i : Nat) : Nat := if h : i < arr.size then (arr.get ⟨i, h⟩).parent else i def rankD (arr : Array UFNode) (i : Nat) : Nat := if h : i < arr.size then (arr.get ⟨i, h⟩).rank else 0 theorem parentD_eq {arr : Array UFNode} {i} : parentD arr i.1 = (arr.get i).parent := dif_pos _ theorem parentD_eq' {arr : Array UFNode} {i} (h) : parentD arr i = (arr.get ⟨i, h⟩).parent := dif_pos _ theorem rankD_eq {arr : Array UFNode} {i} : rankD arr i.1 = (arr.get i).rank := dif_pos _ theorem rankD_eq' {arr : Array UFNode} {i} (h) : rankD arr i = (arr.get ⟨i, h⟩).rank := dif_pos _ theorem parentD_of_not_lt : Β¬i < arr.size β†’ parentD arr i = i := (dif_neg Β·) theorem lt_of_parentD : parentD arr i β‰  i β†’ i < arr.size := Decidable.not_imp_comm.1 parentD_of_not_lt
.lake/packages/batteries/Batteries/Data/UnionFind/Basic.lean
47
50
theorem parentD_set {arr : Array UFNode} {x v i} : parentD (arr.set x v) i = if x.1 = i then v.parent else parentD arr i := by
rw [parentD]; simp [Array.get_eq_getElem, parentD] split <;> [split <;> simp [Array.get_set, *]; split <;> [(subst i; cases β€ΉΒ¬_β€Ί x.2); rfl]]
0
import Batteries.Data.Array.Lemmas import Batteries.Tactic.Lint.Misc namespace Batteries structure UFNode where parent : Nat rank : Nat namespace UnionFind def panicWith (v : Ξ±) (msg : String) : Ξ± := @panic Ξ± ⟨v⟩ msg @[simp] theorem panicWith_eq (v : Ξ±) (msg) : panicWith v msg = v := rfl def parentD (arr : Array UFNode) (i : Nat) : Nat := if h : i < arr.size then (arr.get ⟨i, h⟩).parent else i def rankD (arr : Array UFNode) (i : Nat) : Nat := if h : i < arr.size then (arr.get ⟨i, h⟩).rank else 0 theorem parentD_eq {arr : Array UFNode} {i} : parentD arr i.1 = (arr.get i).parent := dif_pos _ theorem parentD_eq' {arr : Array UFNode} {i} (h) : parentD arr i = (arr.get ⟨i, h⟩).parent := dif_pos _ theorem rankD_eq {arr : Array UFNode} {i} : rankD arr i.1 = (arr.get i).rank := dif_pos _ theorem rankD_eq' {arr : Array UFNode} {i} (h) : rankD arr i = (arr.get ⟨i, h⟩).rank := dif_pos _ theorem parentD_of_not_lt : Β¬i < arr.size β†’ parentD arr i = i := (dif_neg Β·) theorem lt_of_parentD : parentD arr i β‰  i β†’ i < arr.size := Decidable.not_imp_comm.1 parentD_of_not_lt theorem parentD_set {arr : Array UFNode} {x v i} : parentD (arr.set x v) i = if x.1 = i then v.parent else parentD arr i := by rw [parentD]; simp [Array.get_eq_getElem, parentD] split <;> [split <;> simp [Array.get_set, *]; split <;> [(subst i; cases β€ΉΒ¬_β€Ί x.2); rfl]]
.lake/packages/batteries/Batteries/Data/UnionFind/Basic.lean
52
55
theorem rankD_set {arr : Array UFNode} {x v i} : rankD (arr.set x v) i = if x.1 = i then v.rank else rankD arr i := by
rw [rankD]; simp [Array.get_eq_getElem, rankD] split <;> [split <;> simp [Array.get_set, *]; split <;> [(subst i; cases β€ΉΒ¬_β€Ί x.2); rfl]]
0
import Mathlib.Algebra.MvPolynomial.Monad #align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6" namespace MvPolynomial variable {Οƒ Ο„ R S : Type*} [CommSemiring R] [CommSemiring S] noncomputable def expand (p : β„•) : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Οƒ R := { (evalβ‚‚Hom C fun i ↦ X i ^ p : MvPolynomial Οƒ R β†’+* MvPolynomial Οƒ R) with commutes' := fun _ ↦ evalβ‚‚Hom_C _ _ _ } #align mv_polynomial.expand MvPolynomial.expand -- @[simp] -- Porting note (#10618): simp can prove this theorem expand_C (p : β„•) (r : R) : expand p (C r : MvPolynomial Οƒ R) = C r := evalβ‚‚Hom_C _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_C MvPolynomial.expand_C @[simp] theorem expand_X (p : β„•) (i : Οƒ) : expand p (X i : MvPolynomial Οƒ R) = X i ^ p := evalβ‚‚Hom_X' _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_X MvPolynomial.expand_X @[simp] theorem expand_monomial (p : β„•) (d : Οƒ β†’β‚€ β„•) (r : R) : expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i := bind₁_monomial _ _ _ #align mv_polynomial.expand_monomial MvPolynomial.expand_monomial
Mathlib/Algebra/MvPolynomial/Expand.lean
53
55
theorem expand_one_apply (f : MvPolynomial Οƒ R) : expand 1 f = f := by
simp only [expand, pow_one, evalβ‚‚Hom_eq_bindβ‚‚, bindβ‚‚_C_left, RingHom.toMonoidHom_eq_coe, RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply]
1
import Mathlib.Algebra.MvPolynomial.Monad #align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6" namespace MvPolynomial variable {Οƒ Ο„ R S : Type*} [CommSemiring R] [CommSemiring S] noncomputable def expand (p : β„•) : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Οƒ R := { (evalβ‚‚Hom C fun i ↦ X i ^ p : MvPolynomial Οƒ R β†’+* MvPolynomial Οƒ R) with commutes' := fun _ ↦ evalβ‚‚Hom_C _ _ _ } #align mv_polynomial.expand MvPolynomial.expand -- @[simp] -- Porting note (#10618): simp can prove this theorem expand_C (p : β„•) (r : R) : expand p (C r : MvPolynomial Οƒ R) = C r := evalβ‚‚Hom_C _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_C MvPolynomial.expand_C @[simp] theorem expand_X (p : β„•) (i : Οƒ) : expand p (X i : MvPolynomial Οƒ R) = X i ^ p := evalβ‚‚Hom_X' _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_X MvPolynomial.expand_X @[simp] theorem expand_monomial (p : β„•) (d : Οƒ β†’β‚€ β„•) (r : R) : expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i := bind₁_monomial _ _ _ #align mv_polynomial.expand_monomial MvPolynomial.expand_monomial theorem expand_one_apply (f : MvPolynomial Οƒ R) : expand 1 f = f := by simp only [expand, pow_one, evalβ‚‚Hom_eq_bindβ‚‚, bindβ‚‚_C_left, RingHom.toMonoidHom_eq_coe, RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply] #align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply @[simp]
Mathlib/Algebra/MvPolynomial/Expand.lean
59
61
theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial Οƒ R) := by
ext1 f rw [expand_one_apply, AlgHom.id_apply]
1
import Mathlib.Algebra.MvPolynomial.Monad #align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6" namespace MvPolynomial variable {Οƒ Ο„ R S : Type*} [CommSemiring R] [CommSemiring S] noncomputable def expand (p : β„•) : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Οƒ R := { (evalβ‚‚Hom C fun i ↦ X i ^ p : MvPolynomial Οƒ R β†’+* MvPolynomial Οƒ R) with commutes' := fun _ ↦ evalβ‚‚Hom_C _ _ _ } #align mv_polynomial.expand MvPolynomial.expand -- @[simp] -- Porting note (#10618): simp can prove this theorem expand_C (p : β„•) (r : R) : expand p (C r : MvPolynomial Οƒ R) = C r := evalβ‚‚Hom_C _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_C MvPolynomial.expand_C @[simp] theorem expand_X (p : β„•) (i : Οƒ) : expand p (X i : MvPolynomial Οƒ R) = X i ^ p := evalβ‚‚Hom_X' _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_X MvPolynomial.expand_X @[simp] theorem expand_monomial (p : β„•) (d : Οƒ β†’β‚€ β„•) (r : R) : expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i := bind₁_monomial _ _ _ #align mv_polynomial.expand_monomial MvPolynomial.expand_monomial theorem expand_one_apply (f : MvPolynomial Οƒ R) : expand 1 f = f := by simp only [expand, pow_one, evalβ‚‚Hom_eq_bindβ‚‚, bindβ‚‚_C_left, RingHom.toMonoidHom_eq_coe, RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply] #align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply @[simp] theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial Οƒ R) := by ext1 f rw [expand_one_apply, AlgHom.id_apply] #align mv_polynomial.expand_one MvPolynomial.expand_one
Mathlib/Algebra/MvPolynomial/Expand.lean
64
68
theorem expand_comp_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) : (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by
apply algHom_ext intro i simp only [AlgHom.comp_apply, bind₁_X_right]
1
import Mathlib.Algebra.MvPolynomial.Monad #align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6" namespace MvPolynomial variable {Οƒ Ο„ R S : Type*} [CommSemiring R] [CommSemiring S] noncomputable def expand (p : β„•) : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Οƒ R := { (evalβ‚‚Hom C fun i ↦ X i ^ p : MvPolynomial Οƒ R β†’+* MvPolynomial Οƒ R) with commutes' := fun _ ↦ evalβ‚‚Hom_C _ _ _ } #align mv_polynomial.expand MvPolynomial.expand -- @[simp] -- Porting note (#10618): simp can prove this theorem expand_C (p : β„•) (r : R) : expand p (C r : MvPolynomial Οƒ R) = C r := evalβ‚‚Hom_C _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_C MvPolynomial.expand_C @[simp] theorem expand_X (p : β„•) (i : Οƒ) : expand p (X i : MvPolynomial Οƒ R) = X i ^ p := evalβ‚‚Hom_X' _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_X MvPolynomial.expand_X @[simp] theorem expand_monomial (p : β„•) (d : Οƒ β†’β‚€ β„•) (r : R) : expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i := bind₁_monomial _ _ _ #align mv_polynomial.expand_monomial MvPolynomial.expand_monomial theorem expand_one_apply (f : MvPolynomial Οƒ R) : expand 1 f = f := by simp only [expand, pow_one, evalβ‚‚Hom_eq_bindβ‚‚, bindβ‚‚_C_left, RingHom.toMonoidHom_eq_coe, RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply] #align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply @[simp] theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial Οƒ R) := by ext1 f rw [expand_one_apply, AlgHom.id_apply] #align mv_polynomial.expand_one MvPolynomial.expand_one theorem expand_comp_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) : (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by apply algHom_ext intro i simp only [AlgHom.comp_apply, bind₁_X_right] #align mv_polynomial.expand_comp_bind₁ MvPolynomial.expand_comp_bind₁
Mathlib/Algebra/MvPolynomial/Expand.lean
71
73
theorem expand_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) (Ο† : MvPolynomial Οƒ R) : expand p (bind₁ f Ο†) = bind₁ (fun i ↦ expand p (f i)) Ο† := by
rw [← AlgHom.comp_apply, expand_comp_bind₁]
1
import Mathlib.Algebra.MvPolynomial.Monad #align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6" namespace MvPolynomial variable {Οƒ Ο„ R S : Type*} [CommSemiring R] [CommSemiring S] noncomputable def expand (p : β„•) : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Οƒ R := { (evalβ‚‚Hom C fun i ↦ X i ^ p : MvPolynomial Οƒ R β†’+* MvPolynomial Οƒ R) with commutes' := fun _ ↦ evalβ‚‚Hom_C _ _ _ } #align mv_polynomial.expand MvPolynomial.expand -- @[simp] -- Porting note (#10618): simp can prove this theorem expand_C (p : β„•) (r : R) : expand p (C r : MvPolynomial Οƒ R) = C r := evalβ‚‚Hom_C _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_C MvPolynomial.expand_C @[simp] theorem expand_X (p : β„•) (i : Οƒ) : expand p (X i : MvPolynomial Οƒ R) = X i ^ p := evalβ‚‚Hom_X' _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_X MvPolynomial.expand_X @[simp] theorem expand_monomial (p : β„•) (d : Οƒ β†’β‚€ β„•) (r : R) : expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i := bind₁_monomial _ _ _ #align mv_polynomial.expand_monomial MvPolynomial.expand_monomial theorem expand_one_apply (f : MvPolynomial Οƒ R) : expand 1 f = f := by simp only [expand, pow_one, evalβ‚‚Hom_eq_bindβ‚‚, bindβ‚‚_C_left, RingHom.toMonoidHom_eq_coe, RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply] #align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply @[simp] theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial Οƒ R) := by ext1 f rw [expand_one_apply, AlgHom.id_apply] #align mv_polynomial.expand_one MvPolynomial.expand_one theorem expand_comp_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) : (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by apply algHom_ext intro i simp only [AlgHom.comp_apply, bind₁_X_right] #align mv_polynomial.expand_comp_bind₁ MvPolynomial.expand_comp_bind₁ theorem expand_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) (Ο† : MvPolynomial Οƒ R) : expand p (bind₁ f Ο†) = bind₁ (fun i ↦ expand p (f i)) Ο† := by rw [← AlgHom.comp_apply, expand_comp_bind₁] #align mv_polynomial.expand_bind₁ MvPolynomial.expand_bind₁ @[simp]
Mathlib/Algebra/MvPolynomial/Expand.lean
77
78
theorem map_expand (f : R β†’+* S) (p : β„•) (Ο† : MvPolynomial Οƒ R) : map f (expand p Ο†) = expand p (map f Ο†) := by
simp [expand, map_bind₁]
1
import Mathlib.Algebra.MvPolynomial.Monad #align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6" namespace MvPolynomial variable {Οƒ Ο„ R S : Type*} [CommSemiring R] [CommSemiring S] noncomputable def expand (p : β„•) : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Οƒ R := { (evalβ‚‚Hom C fun i ↦ X i ^ p : MvPolynomial Οƒ R β†’+* MvPolynomial Οƒ R) with commutes' := fun _ ↦ evalβ‚‚Hom_C _ _ _ } #align mv_polynomial.expand MvPolynomial.expand -- @[simp] -- Porting note (#10618): simp can prove this theorem expand_C (p : β„•) (r : R) : expand p (C r : MvPolynomial Οƒ R) = C r := evalβ‚‚Hom_C _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_C MvPolynomial.expand_C @[simp] theorem expand_X (p : β„•) (i : Οƒ) : expand p (X i : MvPolynomial Οƒ R) = X i ^ p := evalβ‚‚Hom_X' _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_X MvPolynomial.expand_X @[simp] theorem expand_monomial (p : β„•) (d : Οƒ β†’β‚€ β„•) (r : R) : expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i := bind₁_monomial _ _ _ #align mv_polynomial.expand_monomial MvPolynomial.expand_monomial theorem expand_one_apply (f : MvPolynomial Οƒ R) : expand 1 f = f := by simp only [expand, pow_one, evalβ‚‚Hom_eq_bindβ‚‚, bindβ‚‚_C_left, RingHom.toMonoidHom_eq_coe, RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply] #align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply @[simp] theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial Οƒ R) := by ext1 f rw [expand_one_apply, AlgHom.id_apply] #align mv_polynomial.expand_one MvPolynomial.expand_one theorem expand_comp_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) : (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by apply algHom_ext intro i simp only [AlgHom.comp_apply, bind₁_X_right] #align mv_polynomial.expand_comp_bind₁ MvPolynomial.expand_comp_bind₁ theorem expand_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) (Ο† : MvPolynomial Οƒ R) : expand p (bind₁ f Ο†) = bind₁ (fun i ↦ expand p (f i)) Ο† := by rw [← AlgHom.comp_apply, expand_comp_bind₁] #align mv_polynomial.expand_bind₁ MvPolynomial.expand_bind₁ @[simp] theorem map_expand (f : R β†’+* S) (p : β„•) (Ο† : MvPolynomial Οƒ R) : map f (expand p Ο†) = expand p (map f Ο†) := by simp [expand, map_bind₁] #align mv_polynomial.map_expand MvPolynomial.map_expand @[simp]
Mathlib/Algebra/MvPolynomial/Expand.lean
82
84
theorem rename_expand (f : Οƒ β†’ Ο„) (p : β„•) (Ο† : MvPolynomial Οƒ R) : rename f (expand p Ο†) = expand p (rename f Ο†) := by
simp [expand, bind₁_rename, rename_bind₁, Function.comp]
1
import Mathlib.Algebra.MvPolynomial.Monad #align_import data.mv_polynomial.expand from "leanprover-community/mathlib"@"5da451b4c96b4c2e122c0325a7fce17d62ee46c6" namespace MvPolynomial variable {Οƒ Ο„ R S : Type*} [CommSemiring R] [CommSemiring S] noncomputable def expand (p : β„•) : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Οƒ R := { (evalβ‚‚Hom C fun i ↦ X i ^ p : MvPolynomial Οƒ R β†’+* MvPolynomial Οƒ R) with commutes' := fun _ ↦ evalβ‚‚Hom_C _ _ _ } #align mv_polynomial.expand MvPolynomial.expand -- @[simp] -- Porting note (#10618): simp can prove this theorem expand_C (p : β„•) (r : R) : expand p (C r : MvPolynomial Οƒ R) = C r := evalβ‚‚Hom_C _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_C MvPolynomial.expand_C @[simp] theorem expand_X (p : β„•) (i : Οƒ) : expand p (X i : MvPolynomial Οƒ R) = X i ^ p := evalβ‚‚Hom_X' _ _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.expand_X MvPolynomial.expand_X @[simp] theorem expand_monomial (p : β„•) (d : Οƒ β†’β‚€ β„•) (r : R) : expand p (monomial d r) = C r * ∏ i ∈ d.support, (X i ^ p) ^ d i := bind₁_monomial _ _ _ #align mv_polynomial.expand_monomial MvPolynomial.expand_monomial theorem expand_one_apply (f : MvPolynomial Οƒ R) : expand 1 f = f := by simp only [expand, pow_one, evalβ‚‚Hom_eq_bindβ‚‚, bindβ‚‚_C_left, RingHom.toMonoidHom_eq_coe, RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply, RingHom.id_apply] #align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply @[simp] theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial Οƒ R) := by ext1 f rw [expand_one_apply, AlgHom.id_apply] #align mv_polynomial.expand_one MvPolynomial.expand_one theorem expand_comp_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) : (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by apply algHom_ext intro i simp only [AlgHom.comp_apply, bind₁_X_right] #align mv_polynomial.expand_comp_bind₁ MvPolynomial.expand_comp_bind₁ theorem expand_bind₁ (p : β„•) (f : Οƒ β†’ MvPolynomial Ο„ R) (Ο† : MvPolynomial Οƒ R) : expand p (bind₁ f Ο†) = bind₁ (fun i ↦ expand p (f i)) Ο† := by rw [← AlgHom.comp_apply, expand_comp_bind₁] #align mv_polynomial.expand_bind₁ MvPolynomial.expand_bind₁ @[simp] theorem map_expand (f : R β†’+* S) (p : β„•) (Ο† : MvPolynomial Οƒ R) : map f (expand p Ο†) = expand p (map f Ο†) := by simp [expand, map_bind₁] #align mv_polynomial.map_expand MvPolynomial.map_expand @[simp] theorem rename_expand (f : Οƒ β†’ Ο„) (p : β„•) (Ο† : MvPolynomial Οƒ R) : rename f (expand p Ο†) = expand p (rename f Ο†) := by simp [expand, bind₁_rename, rename_bind₁, Function.comp] #align mv_polynomial.rename_expand MvPolynomial.rename_expand @[simp]
Mathlib/Algebra/MvPolynomial/Expand.lean
88
92
theorem rename_comp_expand (f : Οƒ β†’ Ο„) (p : β„•) : (rename f).comp (expand p) = (expand p).comp (rename f : MvPolynomial Οƒ R →ₐ[R] MvPolynomial Ο„ R) := by
ext1 Ο† simp only [rename_expand, AlgHom.comp_apply]
1
import Mathlib.LinearAlgebra.CliffordAlgebra.Basic import Mathlib.LinearAlgebra.Alternating.Basic #align_import linear_algebra.exterior_algebra.basic from "leanprover-community/mathlib"@"b8d2eaa69d69ce8f03179a5cda774fc0cde984e4" universe u1 u2 u3 u4 u5 variable (R : Type u1) [CommRing R] variable (M : Type u2) [AddCommGroup M] [Module R M] abbrev ExteriorAlgebra := CliffordAlgebra (0 : QuadraticForm R M) #align exterior_algebra ExteriorAlgebra namespace ExteriorAlgebra variable {M} abbrev ΞΉ : M β†’β‚—[R] ExteriorAlgebra R M := CliffordAlgebra.ΞΉ _ #align exterior_algebra.ΞΉ ExteriorAlgebra.ΞΉ variable {R} -- @[simp] -- Porting note (#10618): simp can prove this theorem ΞΉ_sq_zero (m : M) : ΞΉ R m * ΞΉ R m = 0 := (CliffordAlgebra.ΞΉ_sq_scalar _ m).trans <| map_zero _ #align exterior_algebra.ΞΉ_sq_zero ExteriorAlgebra.ΞΉ_sq_zero variable {A : Type*} [Semiring A] [Algebra R A] -- @[simp] -- Porting note (#10618): simp can prove this
Mathlib/LinearAlgebra/ExteriorAlgebra/Basic.lean
97
98
theorem comp_ΞΉ_sq_zero (g : ExteriorAlgebra R M →ₐ[R] A) (m : M) : g (ΞΉ R m) * g (ΞΉ R m) = 0 := by
rw [← AlgHom.map_mul, ΞΉ_sq_zero, AlgHom.map_zero]
2
import Mathlib.Algebra.Module.Equiv #align_import linear_algebra.general_linear_group from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9" variable (R M : Type*) namespace LinearMap variable [Semiring R] [AddCommMonoid M] [Module R M] abbrev GeneralLinearGroup := (M β†’β‚—[R] M)Λ£ #align linear_map.general_linear_group LinearMap.GeneralLinearGroup namespace GeneralLinearGroup variable {R M} def toLinearEquiv (f : GeneralLinearGroup R M) : M ≃ₗ[R] M := { f.val with invFun := f.inv.toFun left_inv := fun m ↦ show (f.inv * f.val) m = m by erw [f.inv_val]; simp right_inv := fun m ↦ show (f.val * f.inv) m = m by erw [f.val_inv]; simp } #align linear_map.general_linear_group.to_linear_equiv LinearMap.GeneralLinearGroup.toLinearEquiv def ofLinearEquiv (f : M ≃ₗ[R] M) : GeneralLinearGroup R M where val := f inv := (f.symm : M β†’β‚—[R] M) val_inv := LinearMap.ext fun _ ↦ f.apply_symm_apply _ inv_val := LinearMap.ext fun _ ↦ f.symm_apply_apply _ #align linear_map.general_linear_group.of_linear_equiv LinearMap.GeneralLinearGroup.ofLinearEquiv variable (R M) def generalLinearEquiv : GeneralLinearGroup R M ≃* M ≃ₗ[R] M where toFun := toLinearEquiv invFun := ofLinearEquiv left_inv f := by ext; rfl right_inv f := by ext; rfl map_mul' x y := by ext; rfl #align linear_map.general_linear_group.general_linear_equiv LinearMap.GeneralLinearGroup.generalLinearEquiv @[simp]
Mathlib/LinearAlgebra/GeneralLinearGroup.lean
68
69
theorem generalLinearEquiv_to_linearMap (f : GeneralLinearGroup R M) : (generalLinearEquiv R M f : M β†’β‚—[R] M) = f := by
ext; rfl
3
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Thickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ : ℝ} {s : Set Ξ±} {x : Ξ±} open EMetric def thickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E < ENNReal.ofReal Ξ΄ } #align metric.thickening Metric.thickening theorem mem_thickening_iff_infEdist_lt : x ∈ thickening Ξ΄ s ↔ infEdist x s < ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_thickening_iff_inf_edist_lt Metric.mem_thickening_iff_infEdist_lt lemma eventually_not_mem_thickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.thickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [thickening, mem_setOf_eq, not_lt] exact (ENNReal.ofReal_le_ofReal hΞ΄.le).trans Ξ΅_lt.le theorem thickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : thickening Ξ΄ E = (infEdist Β· E) ⁻¹' Iio (ENNReal.ofReal Ξ΄) := rfl #align metric.thickening_eq_preimage_inf_edist Metric.thickening_eq_preimage_infEdist theorem isOpen_thickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsOpen (thickening Ξ΄ E) := Continuous.isOpen_preimage continuous_infEdist _ isOpen_Iio #align metric.is_open_thickening Metric.isOpen_thickening @[simp]
Mathlib/Topology/MetricSpace/Thickening.lean
81
82
theorem thickening_empty (Ξ΄ : ℝ) : thickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by
simp only [thickening, setOf_false, infEdist_empty, not_top_lt]
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Thickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ : ℝ} {s : Set Ξ±} {x : Ξ±} open EMetric def thickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E < ENNReal.ofReal Ξ΄ } #align metric.thickening Metric.thickening theorem mem_thickening_iff_infEdist_lt : x ∈ thickening Ξ΄ s ↔ infEdist x s < ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_thickening_iff_inf_edist_lt Metric.mem_thickening_iff_infEdist_lt lemma eventually_not_mem_thickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.thickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [thickening, mem_setOf_eq, not_lt] exact (ENNReal.ofReal_le_ofReal hΞ΄.le).trans Ξ΅_lt.le theorem thickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : thickening Ξ΄ E = (infEdist Β· E) ⁻¹' Iio (ENNReal.ofReal Ξ΄) := rfl #align metric.thickening_eq_preimage_inf_edist Metric.thickening_eq_preimage_infEdist theorem isOpen_thickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsOpen (thickening Ξ΄ E) := Continuous.isOpen_preimage continuous_infEdist _ isOpen_Iio #align metric.is_open_thickening Metric.isOpen_thickening @[simp] theorem thickening_empty (Ξ΄ : ℝ) : thickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by simp only [thickening, setOf_false, infEdist_empty, not_top_lt] #align metric.thickening_empty Metric.thickening_empty theorem thickening_of_nonpos (hΞ΄ : Ξ΄ ≀ 0) (s : Set Ξ±) : thickening Ξ΄ s = βˆ… := eq_empty_of_forall_not_mem fun _ => ((ENNReal.ofReal_of_nonpos hΞ΄).trans_le bot_le).not_lt #align metric.thickening_of_nonpos Metric.thickening_of_nonpos theorem thickening_mono {δ₁ Ξ΄β‚‚ : ℝ} (hle : δ₁ ≀ Ξ΄β‚‚) (E : Set Ξ±) : thickening δ₁ E βŠ† thickening Ξ΄β‚‚ E := preimage_mono (Iio_subset_Iio (ENNReal.ofReal_le_ofReal hle)) #align metric.thickening_mono Metric.thickening_mono theorem thickening_subset_of_subset (Ξ΄ : ℝ) {E₁ Eβ‚‚ : Set Ξ±} (h : E₁ βŠ† Eβ‚‚) : thickening Ξ΄ E₁ βŠ† thickening Ξ΄ Eβ‚‚ := fun _ hx => lt_of_le_of_lt (infEdist_anti h) hx #align metric.thickening_subset_of_subset Metric.thickening_subset_of_subset theorem mem_thickening_iff_exists_edist_lt {Ξ΄ : ℝ} (E : Set Ξ±) (x : Ξ±) : x ∈ thickening Ξ΄ E ↔ βˆƒ z ∈ E, edist x z < ENNReal.ofReal Ξ΄ := infEdist_lt_iff #align metric.mem_thickening_iff_exists_edist_lt Metric.mem_thickening_iff_exists_edist_lt theorem frontier_thickening_subset (E : Set Ξ±) {Ξ΄ : ℝ} : frontier (thickening Ξ΄ E) βŠ† { x : Ξ± | infEdist x E = ENNReal.ofReal Ξ΄ } := frontier_lt_subset_eq continuous_infEdist continuous_const #align metric.frontier_thickening_subset Metric.frontier_thickening_subset
Mathlib/Topology/MetricSpace/Thickening.lean
114
122
theorem frontier_thickening_disjoint (A : Set Ξ±) : Pairwise (Disjoint on fun r : ℝ => frontier (thickening r A)) := by
refine (pairwise_disjoint_on _).2 fun r₁ rβ‚‚ hr => ?_ rcases le_total r₁ 0 with h₁ | h₁ Β· simp [thickening_of_nonpos h₁] refine ((disjoint_singleton.2 fun h => hr.ne ?_).preimage _).mono (frontier_thickening_subset _) (frontier_thickening_subset _) apply_fun ENNReal.toReal at h rwa [ENNReal.toReal_ofReal h₁, ENNReal.toReal_ofReal (h₁.trans hr.le)] at h
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Thickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ : ℝ} {s : Set Ξ±} {x : Ξ±} open EMetric def thickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E < ENNReal.ofReal Ξ΄ } #align metric.thickening Metric.thickening theorem mem_thickening_iff_infEdist_lt : x ∈ thickening Ξ΄ s ↔ infEdist x s < ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_thickening_iff_inf_edist_lt Metric.mem_thickening_iff_infEdist_lt lemma eventually_not_mem_thickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.thickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [thickening, mem_setOf_eq, not_lt] exact (ENNReal.ofReal_le_ofReal hΞ΄.le).trans Ξ΅_lt.le theorem thickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : thickening Ξ΄ E = (infEdist Β· E) ⁻¹' Iio (ENNReal.ofReal Ξ΄) := rfl #align metric.thickening_eq_preimage_inf_edist Metric.thickening_eq_preimage_infEdist theorem isOpen_thickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsOpen (thickening Ξ΄ E) := Continuous.isOpen_preimage continuous_infEdist _ isOpen_Iio #align metric.is_open_thickening Metric.isOpen_thickening @[simp] theorem thickening_empty (Ξ΄ : ℝ) : thickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by simp only [thickening, setOf_false, infEdist_empty, not_top_lt] #align metric.thickening_empty Metric.thickening_empty theorem thickening_of_nonpos (hΞ΄ : Ξ΄ ≀ 0) (s : Set Ξ±) : thickening Ξ΄ s = βˆ… := eq_empty_of_forall_not_mem fun _ => ((ENNReal.ofReal_of_nonpos hΞ΄).trans_le bot_le).not_lt #align metric.thickening_of_nonpos Metric.thickening_of_nonpos theorem thickening_mono {δ₁ Ξ΄β‚‚ : ℝ} (hle : δ₁ ≀ Ξ΄β‚‚) (E : Set Ξ±) : thickening δ₁ E βŠ† thickening Ξ΄β‚‚ E := preimage_mono (Iio_subset_Iio (ENNReal.ofReal_le_ofReal hle)) #align metric.thickening_mono Metric.thickening_mono theorem thickening_subset_of_subset (Ξ΄ : ℝ) {E₁ Eβ‚‚ : Set Ξ±} (h : E₁ βŠ† Eβ‚‚) : thickening Ξ΄ E₁ βŠ† thickening Ξ΄ Eβ‚‚ := fun _ hx => lt_of_le_of_lt (infEdist_anti h) hx #align metric.thickening_subset_of_subset Metric.thickening_subset_of_subset theorem mem_thickening_iff_exists_edist_lt {Ξ΄ : ℝ} (E : Set Ξ±) (x : Ξ±) : x ∈ thickening Ξ΄ E ↔ βˆƒ z ∈ E, edist x z < ENNReal.ofReal Ξ΄ := infEdist_lt_iff #align metric.mem_thickening_iff_exists_edist_lt Metric.mem_thickening_iff_exists_edist_lt theorem frontier_thickening_subset (E : Set Ξ±) {Ξ΄ : ℝ} : frontier (thickening Ξ΄ E) βŠ† { x : Ξ± | infEdist x E = ENNReal.ofReal Ξ΄ } := frontier_lt_subset_eq continuous_infEdist continuous_const #align metric.frontier_thickening_subset Metric.frontier_thickening_subset theorem frontier_thickening_disjoint (A : Set Ξ±) : Pairwise (Disjoint on fun r : ℝ => frontier (thickening r A)) := by refine (pairwise_disjoint_on _).2 fun r₁ rβ‚‚ hr => ?_ rcases le_total r₁ 0 with h₁ | h₁ Β· simp [thickening_of_nonpos h₁] refine ((disjoint_singleton.2 fun h => hr.ne ?_).preimage _).mono (frontier_thickening_subset _) (frontier_thickening_subset _) apply_fun ENNReal.toReal at h rwa [ENNReal.toReal_ofReal h₁, ENNReal.toReal_ofReal (h₁.trans hr.le)] at h #align metric.frontier_thickening_disjoint Metric.frontier_thickening_disjoint lemma subset_compl_thickening_compl_thickening_self (Ξ΄ : ℝ) (E : Set Ξ±) : E βŠ† (thickening Ξ΄ (thickening Ξ΄ E)ᢜ)ᢜ := by intro x x_in_E simp only [thickening, mem_compl_iff, mem_setOf_eq, not_lt] apply EMetric.le_infEdist.mpr fun y hy ↦ ?_ simp only [mem_compl_iff, mem_setOf_eq, not_lt] at hy simpa only [edist_comm] using le_trans hy <| EMetric.infEdist_le_edist_of_mem x_in_E lemma thickening_compl_thickening_self_subset_compl (Ξ΄ : ℝ) (E : Set Ξ±) : thickening Ξ΄ (thickening Ξ΄ E)ᢜ βŠ† Eᢜ := by apply compl_subset_compl.mp simpa only [compl_compl] using subset_compl_thickening_compl_thickening_self Ξ΄ E variable {X : Type u} [PseudoMetricSpace X] -- Porting note (#10756): new lemma theorem mem_thickening_iff_infDist_lt {E : Set X} {x : X} (h : E.Nonempty) : x ∈ thickening Ξ΄ E ↔ infDist x E < Ξ΄ := lt_ofReal_iff_toReal_lt (infEdist_ne_top h)
Mathlib/Topology/MetricSpace/Thickening.lean
151
154
theorem mem_thickening_iff {E : Set X} {x : X} : x ∈ thickening Ξ΄ E ↔ βˆƒ z ∈ E, dist x z < Ξ΄ := by
have key_iff : βˆ€ z : X, edist x z < ENNReal.ofReal Ξ΄ ↔ dist x z < Ξ΄ := fun z ↦ by rw [dist_edist, lt_ofReal_iff_toReal_lt (edist_ne_top _ _)] simp_rw [mem_thickening_iff_exists_edist_lt, key_iff]
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Cthickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ Ξ΅ : ℝ} {s t : Set Ξ±} {x : Ξ±} open EMetric def cthickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E ≀ ENNReal.ofReal Ξ΄ } #align metric.cthickening Metric.cthickening @[simp] theorem mem_cthickening_iff : x ∈ cthickening Ξ΄ s ↔ infEdist x s ≀ ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_cthickening_iff Metric.mem_cthickening_iff lemma eventually_not_mem_cthickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.cthickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [cthickening, mem_setOf_eq, not_le] exact ((ofReal_lt_ofReal_iff Ξ΅_pos).mpr hΞ΄).trans Ξ΅_lt theorem mem_cthickening_of_edist_le (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : edist x y ≀ ENNReal.ofReal Ξ΄) : x ∈ cthickening Ξ΄ E := (infEdist_le_edist_of_mem h).trans h' #align metric.mem_cthickening_of_edist_le Metric.mem_cthickening_of_edist_le
Mathlib/Topology/MetricSpace/Thickening.lean
219
223
theorem mem_cthickening_of_dist_le {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : dist x y ≀ Ξ΄) : x ∈ cthickening Ξ΄ E := by
apply mem_cthickening_of_edist_le x y Ξ΄ E h rw [edist_dist] exact ENNReal.ofReal_le_ofReal h'
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Cthickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ Ξ΅ : ℝ} {s t : Set Ξ±} {x : Ξ±} open EMetric def cthickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E ≀ ENNReal.ofReal Ξ΄ } #align metric.cthickening Metric.cthickening @[simp] theorem mem_cthickening_iff : x ∈ cthickening Ξ΄ s ↔ infEdist x s ≀ ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_cthickening_iff Metric.mem_cthickening_iff lemma eventually_not_mem_cthickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.cthickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [cthickening, mem_setOf_eq, not_le] exact ((ofReal_lt_ofReal_iff Ξ΅_pos).mpr hΞ΄).trans Ξ΅_lt theorem mem_cthickening_of_edist_le (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : edist x y ≀ ENNReal.ofReal Ξ΄) : x ∈ cthickening Ξ΄ E := (infEdist_le_edist_of_mem h).trans h' #align metric.mem_cthickening_of_edist_le Metric.mem_cthickening_of_edist_le theorem mem_cthickening_of_dist_le {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : dist x y ≀ Ξ΄) : x ∈ cthickening Ξ΄ E := by apply mem_cthickening_of_edist_le x y Ξ΄ E h rw [edist_dist] exact ENNReal.ofReal_le_ofReal h' #align metric.mem_cthickening_of_dist_le Metric.mem_cthickening_of_dist_le theorem cthickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening Ξ΄ E = (fun x => infEdist x E) ⁻¹' Iic (ENNReal.ofReal Ξ΄) := rfl #align metric.cthickening_eq_preimage_inf_edist Metric.cthickening_eq_preimage_infEdist theorem isClosed_cthickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsClosed (cthickening Ξ΄ E) := IsClosed.preimage continuous_infEdist isClosed_Iic #align metric.is_closed_cthickening Metric.isClosed_cthickening @[simp]
Mathlib/Topology/MetricSpace/Thickening.lean
238
239
theorem cthickening_empty (Ξ΄ : ℝ) : cthickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by
simp only [cthickening, ENNReal.ofReal_ne_top, setOf_false, infEdist_empty, top_le_iff]
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Cthickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ Ξ΅ : ℝ} {s t : Set Ξ±} {x : Ξ±} open EMetric def cthickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E ≀ ENNReal.ofReal Ξ΄ } #align metric.cthickening Metric.cthickening @[simp] theorem mem_cthickening_iff : x ∈ cthickening Ξ΄ s ↔ infEdist x s ≀ ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_cthickening_iff Metric.mem_cthickening_iff lemma eventually_not_mem_cthickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.cthickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [cthickening, mem_setOf_eq, not_le] exact ((ofReal_lt_ofReal_iff Ξ΅_pos).mpr hΞ΄).trans Ξ΅_lt theorem mem_cthickening_of_edist_le (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : edist x y ≀ ENNReal.ofReal Ξ΄) : x ∈ cthickening Ξ΄ E := (infEdist_le_edist_of_mem h).trans h' #align metric.mem_cthickening_of_edist_le Metric.mem_cthickening_of_edist_le theorem mem_cthickening_of_dist_le {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : dist x y ≀ Ξ΄) : x ∈ cthickening Ξ΄ E := by apply mem_cthickening_of_edist_le x y Ξ΄ E h rw [edist_dist] exact ENNReal.ofReal_le_ofReal h' #align metric.mem_cthickening_of_dist_le Metric.mem_cthickening_of_dist_le theorem cthickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening Ξ΄ E = (fun x => infEdist x E) ⁻¹' Iic (ENNReal.ofReal Ξ΄) := rfl #align metric.cthickening_eq_preimage_inf_edist Metric.cthickening_eq_preimage_infEdist theorem isClosed_cthickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsClosed (cthickening Ξ΄ E) := IsClosed.preimage continuous_infEdist isClosed_Iic #align metric.is_closed_cthickening Metric.isClosed_cthickening @[simp] theorem cthickening_empty (Ξ΄ : ℝ) : cthickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by simp only [cthickening, ENNReal.ofReal_ne_top, setOf_false, infEdist_empty, top_le_iff] #align metric.cthickening_empty Metric.cthickening_empty
Mathlib/Topology/MetricSpace/Thickening.lean
242
244
theorem cthickening_of_nonpos {Ξ΄ : ℝ} (hΞ΄ : Ξ΄ ≀ 0) (E : Set Ξ±) : cthickening Ξ΄ E = closure E := by
ext x simp [mem_closure_iff_infEdist_zero, cthickening, ENNReal.ofReal_eq_zero.2 hΞ΄]
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Cthickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ Ξ΅ : ℝ} {s t : Set Ξ±} {x : Ξ±} open EMetric def cthickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E ≀ ENNReal.ofReal Ξ΄ } #align metric.cthickening Metric.cthickening @[simp] theorem mem_cthickening_iff : x ∈ cthickening Ξ΄ s ↔ infEdist x s ≀ ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_cthickening_iff Metric.mem_cthickening_iff lemma eventually_not_mem_cthickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.cthickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [cthickening, mem_setOf_eq, not_le] exact ((ofReal_lt_ofReal_iff Ξ΅_pos).mpr hΞ΄).trans Ξ΅_lt theorem mem_cthickening_of_edist_le (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : edist x y ≀ ENNReal.ofReal Ξ΄) : x ∈ cthickening Ξ΄ E := (infEdist_le_edist_of_mem h).trans h' #align metric.mem_cthickening_of_edist_le Metric.mem_cthickening_of_edist_le theorem mem_cthickening_of_dist_le {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : dist x y ≀ Ξ΄) : x ∈ cthickening Ξ΄ E := by apply mem_cthickening_of_edist_le x y Ξ΄ E h rw [edist_dist] exact ENNReal.ofReal_le_ofReal h' #align metric.mem_cthickening_of_dist_le Metric.mem_cthickening_of_dist_le theorem cthickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening Ξ΄ E = (fun x => infEdist x E) ⁻¹' Iic (ENNReal.ofReal Ξ΄) := rfl #align metric.cthickening_eq_preimage_inf_edist Metric.cthickening_eq_preimage_infEdist theorem isClosed_cthickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsClosed (cthickening Ξ΄ E) := IsClosed.preimage continuous_infEdist isClosed_Iic #align metric.is_closed_cthickening Metric.isClosed_cthickening @[simp] theorem cthickening_empty (Ξ΄ : ℝ) : cthickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by simp only [cthickening, ENNReal.ofReal_ne_top, setOf_false, infEdist_empty, top_le_iff] #align metric.cthickening_empty Metric.cthickening_empty theorem cthickening_of_nonpos {Ξ΄ : ℝ} (hΞ΄ : Ξ΄ ≀ 0) (E : Set Ξ±) : cthickening Ξ΄ E = closure E := by ext x simp [mem_closure_iff_infEdist_zero, cthickening, ENNReal.ofReal_eq_zero.2 hΞ΄] #align metric.cthickening_of_nonpos Metric.cthickening_of_nonpos @[simp] theorem cthickening_zero (E : Set Ξ±) : cthickening 0 E = closure E := cthickening_of_nonpos le_rfl E #align metric.cthickening_zero Metric.cthickening_zero
Mathlib/Topology/MetricSpace/Thickening.lean
253
254
theorem cthickening_max_zero (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening (max 0 Ξ΄) E = cthickening Ξ΄ E := by
cases le_total Ξ΄ 0 <;> simp [cthickening_of_nonpos, *]
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Cthickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ Ξ΅ : ℝ} {s t : Set Ξ±} {x : Ξ±} open EMetric def cthickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E ≀ ENNReal.ofReal Ξ΄ } #align metric.cthickening Metric.cthickening @[simp] theorem mem_cthickening_iff : x ∈ cthickening Ξ΄ s ↔ infEdist x s ≀ ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_cthickening_iff Metric.mem_cthickening_iff lemma eventually_not_mem_cthickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.cthickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [cthickening, mem_setOf_eq, not_le] exact ((ofReal_lt_ofReal_iff Ξ΅_pos).mpr hΞ΄).trans Ξ΅_lt theorem mem_cthickening_of_edist_le (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : edist x y ≀ ENNReal.ofReal Ξ΄) : x ∈ cthickening Ξ΄ E := (infEdist_le_edist_of_mem h).trans h' #align metric.mem_cthickening_of_edist_le Metric.mem_cthickening_of_edist_le theorem mem_cthickening_of_dist_le {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : dist x y ≀ Ξ΄) : x ∈ cthickening Ξ΄ E := by apply mem_cthickening_of_edist_le x y Ξ΄ E h rw [edist_dist] exact ENNReal.ofReal_le_ofReal h' #align metric.mem_cthickening_of_dist_le Metric.mem_cthickening_of_dist_le theorem cthickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening Ξ΄ E = (fun x => infEdist x E) ⁻¹' Iic (ENNReal.ofReal Ξ΄) := rfl #align metric.cthickening_eq_preimage_inf_edist Metric.cthickening_eq_preimage_infEdist theorem isClosed_cthickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsClosed (cthickening Ξ΄ E) := IsClosed.preimage continuous_infEdist isClosed_Iic #align metric.is_closed_cthickening Metric.isClosed_cthickening @[simp] theorem cthickening_empty (Ξ΄ : ℝ) : cthickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by simp only [cthickening, ENNReal.ofReal_ne_top, setOf_false, infEdist_empty, top_le_iff] #align metric.cthickening_empty Metric.cthickening_empty theorem cthickening_of_nonpos {Ξ΄ : ℝ} (hΞ΄ : Ξ΄ ≀ 0) (E : Set Ξ±) : cthickening Ξ΄ E = closure E := by ext x simp [mem_closure_iff_infEdist_zero, cthickening, ENNReal.ofReal_eq_zero.2 hΞ΄] #align metric.cthickening_of_nonpos Metric.cthickening_of_nonpos @[simp] theorem cthickening_zero (E : Set Ξ±) : cthickening 0 E = closure E := cthickening_of_nonpos le_rfl E #align metric.cthickening_zero Metric.cthickening_zero theorem cthickening_max_zero (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening (max 0 Ξ΄) E = cthickening Ξ΄ E := by cases le_total Ξ΄ 0 <;> simp [cthickening_of_nonpos, *] #align metric.cthickening_max_zero Metric.cthickening_max_zero theorem cthickening_mono {δ₁ Ξ΄β‚‚ : ℝ} (hle : δ₁ ≀ Ξ΄β‚‚) (E : Set Ξ±) : cthickening δ₁ E βŠ† cthickening Ξ΄β‚‚ E := preimage_mono (Iic_subset_Iic.mpr (ENNReal.ofReal_le_ofReal hle)) #align metric.cthickening_mono Metric.cthickening_mono @[simp]
Mathlib/Topology/MetricSpace/Thickening.lean
265
268
theorem cthickening_singleton {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x : Ξ±) {Ξ΄ : ℝ} (hΞ΄ : 0 ≀ Ξ΄) : cthickening Ξ΄ ({x} : Set Ξ±) = closedBall x Ξ΄ := by
ext y simp [cthickening, edist_dist, ENNReal.ofReal_le_ofReal_iff hΞ΄]
4
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" noncomputable section open NNReal ENNReal Topology Set Filter Bornology universe u v w variable {ΞΉ : Sort*} {Ξ± : Type u} {Ξ² : Type v} namespace Metric section Cthickening variable [PseudoEMetricSpace Ξ±] {Ξ΄ Ξ΅ : ℝ} {s t : Set Ξ±} {x : Ξ±} open EMetric def cthickening (Ξ΄ : ℝ) (E : Set Ξ±) : Set Ξ± := { x : Ξ± | infEdist x E ≀ ENNReal.ofReal Ξ΄ } #align metric.cthickening Metric.cthickening @[simp] theorem mem_cthickening_iff : x ∈ cthickening Ξ΄ s ↔ infEdist x s ≀ ENNReal.ofReal Ξ΄ := Iff.rfl #align metric.mem_cthickening_iff Metric.mem_cthickening_iff lemma eventually_not_mem_cthickening_of_infEdist_pos {E : Set Ξ±} {x : Ξ±} (h : x βˆ‰ closure E) : βˆ€αΆ  Ξ΄ in 𝓝 (0 : ℝ), x βˆ‰ Metric.cthickening Ξ΄ E := by obtain ⟨Ρ, ⟨Ρ_pos, Ξ΅_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h filter_upwards [eventually_lt_nhds Ξ΅_pos] with Ξ΄ hΞ΄ simp only [cthickening, mem_setOf_eq, not_le] exact ((ofReal_lt_ofReal_iff Ξ΅_pos).mpr hΞ΄).trans Ξ΅_lt theorem mem_cthickening_of_edist_le (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : edist x y ≀ ENNReal.ofReal Ξ΄) : x ∈ cthickening Ξ΄ E := (infEdist_le_edist_of_mem h).trans h' #align metric.mem_cthickening_of_edist_le Metric.mem_cthickening_of_edist_le theorem mem_cthickening_of_dist_le {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x y : Ξ±) (Ξ΄ : ℝ) (E : Set Ξ±) (h : y ∈ E) (h' : dist x y ≀ Ξ΄) : x ∈ cthickening Ξ΄ E := by apply mem_cthickening_of_edist_le x y Ξ΄ E h rw [edist_dist] exact ENNReal.ofReal_le_ofReal h' #align metric.mem_cthickening_of_dist_le Metric.mem_cthickening_of_dist_le theorem cthickening_eq_preimage_infEdist (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening Ξ΄ E = (fun x => infEdist x E) ⁻¹' Iic (ENNReal.ofReal Ξ΄) := rfl #align metric.cthickening_eq_preimage_inf_edist Metric.cthickening_eq_preimage_infEdist theorem isClosed_cthickening {Ξ΄ : ℝ} {E : Set Ξ±} : IsClosed (cthickening Ξ΄ E) := IsClosed.preimage continuous_infEdist isClosed_Iic #align metric.is_closed_cthickening Metric.isClosed_cthickening @[simp] theorem cthickening_empty (Ξ΄ : ℝ) : cthickening Ξ΄ (βˆ… : Set Ξ±) = βˆ… := by simp only [cthickening, ENNReal.ofReal_ne_top, setOf_false, infEdist_empty, top_le_iff] #align metric.cthickening_empty Metric.cthickening_empty theorem cthickening_of_nonpos {Ξ΄ : ℝ} (hΞ΄ : Ξ΄ ≀ 0) (E : Set Ξ±) : cthickening Ξ΄ E = closure E := by ext x simp [mem_closure_iff_infEdist_zero, cthickening, ENNReal.ofReal_eq_zero.2 hΞ΄] #align metric.cthickening_of_nonpos Metric.cthickening_of_nonpos @[simp] theorem cthickening_zero (E : Set Ξ±) : cthickening 0 E = closure E := cthickening_of_nonpos le_rfl E #align metric.cthickening_zero Metric.cthickening_zero theorem cthickening_max_zero (Ξ΄ : ℝ) (E : Set Ξ±) : cthickening (max 0 Ξ΄) E = cthickening Ξ΄ E := by cases le_total Ξ΄ 0 <;> simp [cthickening_of_nonpos, *] #align metric.cthickening_max_zero Metric.cthickening_max_zero theorem cthickening_mono {δ₁ Ξ΄β‚‚ : ℝ} (hle : δ₁ ≀ Ξ΄β‚‚) (E : Set Ξ±) : cthickening δ₁ E βŠ† cthickening Ξ΄β‚‚ E := preimage_mono (Iic_subset_Iic.mpr (ENNReal.ofReal_le_ofReal hle)) #align metric.cthickening_mono Metric.cthickening_mono @[simp] theorem cthickening_singleton {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x : Ξ±) {Ξ΄ : ℝ} (hΞ΄ : 0 ≀ Ξ΄) : cthickening Ξ΄ ({x} : Set Ξ±) = closedBall x Ξ΄ := by ext y simp [cthickening, edist_dist, ENNReal.ofReal_le_ofReal_iff hΞ΄] #align metric.cthickening_singleton Metric.cthickening_singleton
Mathlib/Topology/MetricSpace/Thickening.lean
271
275
theorem closedBall_subset_cthickening_singleton {Ξ± : Type*} [PseudoMetricSpace Ξ±] (x : Ξ±) (Ξ΄ : ℝ) : closedBall x Ξ΄ βŠ† cthickening Ξ΄ ({x} : Set Ξ±) := by
rcases lt_or_le Ξ΄ 0 with (hΞ΄ | hΞ΄) Β· simp only [closedBall_eq_empty.mpr hΞ΄, empty_subset] Β· simp only [cthickening_singleton x hΞ΄, Subset.rfl]
4
import Batteries.Data.RBMap.Basic import Mathlib.Init.Data.Nat.Notation import Mathlib.Mathport.Rename import Mathlib.Tactic.TypeStar import Mathlib.Util.CompileInductive #align_import data.tree from "leanprover-community/mathlib"@"ed989ff568099019c6533a4d94b27d852a5710d8" inductive Tree.{u} (Ξ± : Type u) : Type u | nil : Tree Ξ± | node : Ξ± β†’ Tree Ξ± β†’ Tree Ξ± β†’ Tree Ξ± deriving DecidableEq, Repr -- Porting note: Removed `has_reflect`, added `Repr`. #align tree Tree namespace Tree universe u variable {Ξ± : Type u} -- Porting note: replaced with `deriving Repr` which builds a better instance anyway #noalign tree.repr instance : Inhabited (Tree Ξ±) := ⟨nil⟩ open Batteries (RBNode) def ofRBNode : RBNode Ξ± β†’ Tree Ξ± | RBNode.nil => nil | RBNode.node _color l key r => node key (ofRBNode l) (ofRBNode r) #align tree.of_rbnode Tree.ofRBNode def map {Ξ²} (f : Ξ± β†’ Ξ²) : Tree Ξ± β†’ Tree Ξ² | nil => nil | node a l r => node (f a) (map f l) (map f r) #align tree.map Tree.map @[simp] def numNodes : Tree Ξ± β†’ β„• | nil => 0 | node _ a b => a.numNodes + b.numNodes + 1 #align tree.num_nodes Tree.numNodes @[simp] def numLeaves : Tree Ξ± β†’ β„• | nil => 1 | node _ a b => a.numLeaves + b.numLeaves #align tree.num_leaves Tree.numLeaves @[simp] def height : Tree Ξ± β†’ β„• | nil => 0 | node _ a b => max a.height b.height + 1 #align tree.height Tree.height
Mathlib/Data/Tree/Basic.lean
90
91
theorem numLeaves_eq_numNodes_succ (x : Tree Ξ±) : x.numLeaves = x.numNodes + 1 := by
induction x <;> simp [*, Nat.add_comm, Nat.add_assoc, Nat.add_left_comm]
5
import Batteries.Data.RBMap.Basic import Mathlib.Init.Data.Nat.Notation import Mathlib.Mathport.Rename import Mathlib.Tactic.TypeStar import Mathlib.Util.CompileInductive #align_import data.tree from "leanprover-community/mathlib"@"ed989ff568099019c6533a4d94b27d852a5710d8" inductive Tree.{u} (Ξ± : Type u) : Type u | nil : Tree Ξ± | node : Ξ± β†’ Tree Ξ± β†’ Tree Ξ± β†’ Tree Ξ± deriving DecidableEq, Repr -- Porting note: Removed `has_reflect`, added `Repr`. #align tree Tree namespace Tree universe u variable {Ξ± : Type u} -- Porting note: replaced with `deriving Repr` which builds a better instance anyway #noalign tree.repr instance : Inhabited (Tree Ξ±) := ⟨nil⟩ open Batteries (RBNode) def ofRBNode : RBNode Ξ± β†’ Tree Ξ± | RBNode.nil => nil | RBNode.node _color l key r => node key (ofRBNode l) (ofRBNode r) #align tree.of_rbnode Tree.ofRBNode def map {Ξ²} (f : Ξ± β†’ Ξ²) : Tree Ξ± β†’ Tree Ξ² | nil => nil | node a l r => node (f a) (map f l) (map f r) #align tree.map Tree.map @[simp] def numNodes : Tree Ξ± β†’ β„• | nil => 0 | node _ a b => a.numNodes + b.numNodes + 1 #align tree.num_nodes Tree.numNodes @[simp] def numLeaves : Tree Ξ± β†’ β„• | nil => 1 | node _ a b => a.numLeaves + b.numLeaves #align tree.num_leaves Tree.numLeaves @[simp] def height : Tree Ξ± β†’ β„• | nil => 0 | node _ a b => max a.height b.height + 1 #align tree.height Tree.height theorem numLeaves_eq_numNodes_succ (x : Tree Ξ±) : x.numLeaves = x.numNodes + 1 := by induction x <;> simp [*, Nat.add_comm, Nat.add_assoc, Nat.add_left_comm] #align tree.num_leaves_eq_num_nodes_succ Tree.numLeaves_eq_numNodes_succ
Mathlib/Data/Tree/Basic.lean
94
96
theorem numLeaves_pos (x : Tree Ξ±) : 0 < x.numLeaves := by
rw [numLeaves_eq_numNodes_succ] exact x.numNodes.zero_lt_succ
5
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Tactic.Positivity.Core import Mathlib.Algebra.Ring.NegOnePow #align_import analysis.special_functions.trigonometric.basic from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section open scoped Classical open Topology Filter Set namespace Complex @[continuity, fun_prop]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean
54
56
theorem continuous_sin : Continuous sin := by
change Continuous fun z => (exp (-z * I) - exp (z * I)) * I / 2 continuity
6
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Tactic.Positivity.Core import Mathlib.Algebra.Ring.NegOnePow #align_import analysis.special_functions.trigonometric.basic from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section open scoped Classical open Topology Filter Set namespace Complex @[continuity, fun_prop] theorem continuous_sin : Continuous sin := by change Continuous fun z => (exp (-z * I) - exp (z * I)) * I / 2 continuity #align complex.continuous_sin Complex.continuous_sin @[fun_prop] theorem continuousOn_sin {s : Set β„‚} : ContinuousOn sin s := continuous_sin.continuousOn #align complex.continuous_on_sin Complex.continuousOn_sin @[continuity, fun_prop]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean
65
67
theorem continuous_cos : Continuous cos := by
change Continuous fun z => (exp (z * I) + exp (-z * I)) / 2 continuity
6
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Tactic.Positivity.Core import Mathlib.Algebra.Ring.NegOnePow #align_import analysis.special_functions.trigonometric.basic from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section open scoped Classical open Topology Filter Set namespace Complex @[continuity, fun_prop] theorem continuous_sin : Continuous sin := by change Continuous fun z => (exp (-z * I) - exp (z * I)) * I / 2 continuity #align complex.continuous_sin Complex.continuous_sin @[fun_prop] theorem continuousOn_sin {s : Set β„‚} : ContinuousOn sin s := continuous_sin.continuousOn #align complex.continuous_on_sin Complex.continuousOn_sin @[continuity, fun_prop] theorem continuous_cos : Continuous cos := by change Continuous fun z => (exp (z * I) + exp (-z * I)) / 2 continuity #align complex.continuous_cos Complex.continuous_cos @[fun_prop] theorem continuousOn_cos {s : Set β„‚} : ContinuousOn cos s := continuous_cos.continuousOn #align complex.continuous_on_cos Complex.continuousOn_cos @[continuity, fun_prop]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean
76
78
theorem continuous_sinh : Continuous sinh := by
change Continuous fun z => (exp z - exp (-z)) / 2 continuity
6
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Tactic.Positivity.Core import Mathlib.Algebra.Ring.NegOnePow #align_import analysis.special_functions.trigonometric.basic from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section open scoped Classical open Topology Filter Set namespace Complex @[continuity, fun_prop] theorem continuous_sin : Continuous sin := by change Continuous fun z => (exp (-z * I) - exp (z * I)) * I / 2 continuity #align complex.continuous_sin Complex.continuous_sin @[fun_prop] theorem continuousOn_sin {s : Set β„‚} : ContinuousOn sin s := continuous_sin.continuousOn #align complex.continuous_on_sin Complex.continuousOn_sin @[continuity, fun_prop] theorem continuous_cos : Continuous cos := by change Continuous fun z => (exp (z * I) + exp (-z * I)) / 2 continuity #align complex.continuous_cos Complex.continuous_cos @[fun_prop] theorem continuousOn_cos {s : Set β„‚} : ContinuousOn cos s := continuous_cos.continuousOn #align complex.continuous_on_cos Complex.continuousOn_cos @[continuity, fun_prop] theorem continuous_sinh : Continuous sinh := by change Continuous fun z => (exp z - exp (-z)) / 2 continuity #align complex.continuous_sinh Complex.continuous_sinh @[continuity, fun_prop]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean
82
84
theorem continuous_cosh : Continuous cosh := by
change Continuous fun z => (exp z + exp (-z)) / 2 continuity
6
import Mathlib.Algebra.Group.Nat set_option autoImplicit true open Lean hiding Literal HashMap open Batteries namespace Sat inductive Literal | pos : Nat β†’ Literal | neg : Nat β†’ Literal def Literal.ofInt (i : Int) : Literal := if i < 0 then Literal.neg (-i-1).toNat else Literal.pos (i-1).toNat def Literal.negate : Literal β†’ Literal | pos i => neg i | neg i => pos i instance : ToExpr Literal where toTypeExpr := mkConst ``Literal toExpr | Literal.pos i => mkApp (mkConst ``Literal.pos) (mkRawNatLit i) | Literal.neg i => mkApp (mkConst ``Literal.neg) (mkRawNatLit i) def Clause := List Literal def Clause.nil : Clause := [] def Clause.cons : Literal β†’ Clause β†’ Clause := List.cons abbrev Fmla := List Clause def Fmla.one (c : Clause) : Fmla := [c] def Fmla.and (a b : Fmla) : Fmla := a ++ b structure Fmla.subsumes (f f' : Fmla) : Prop where prop : βˆ€ x, x ∈ f' β†’ x ∈ f theorem Fmla.subsumes_self (f : Fmla) : f.subsumes f := ⟨fun _ h ↦ h⟩ theorem Fmla.subsumes_left (f f₁ fβ‚‚ : Fmla) (H : f.subsumes (f₁.and fβ‚‚)) : f.subsumes f₁ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inl h⟩ theorem Fmla.subsumes_right (f f₁ fβ‚‚ : Fmla) (H : f.subsumes (f₁.and fβ‚‚)) : f.subsumes fβ‚‚ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inr h⟩ def Valuation := Nat β†’ Prop def Valuation.neg (v : Valuation) : Literal β†’ Prop | Literal.pos i => Β¬ v i | Literal.neg i => v i def Valuation.satisfies (v : Valuation) : Clause β†’ Prop | [] => False | l::c => v.neg l β†’ v.satisfies c structure Valuation.satisfies_fmla (v : Valuation) (f : Fmla) : Prop where prop : βˆ€ c, c ∈ f β†’ v.satisfies c def Fmla.proof (f : Fmla) (c : Clause) : Prop := βˆ€ v : Valuation, v.satisfies_fmla f β†’ v.satisfies c theorem Fmla.proof_of_subsumes (H : Fmla.subsumes f (Fmla.one c)) : f.proof c := fun _ h ↦ h.1 _ <| H.1 _ <| List.Mem.head .. theorem Valuation.by_cases {v : Valuation} {l} (h₁ : v.neg l.negate β†’ False) (hβ‚‚ : v.neg l β†’ False) : False := match l with | Literal.pos _ => hβ‚‚ h₁ | Literal.neg _ => h₁ hβ‚‚ def Valuation.implies (v : Valuation) (p : Prop) : List Prop β†’ Nat β†’ Prop | [], _ => p | a::as, n => (v n ↔ a) β†’ v.implies p as (n+1) def Valuation.mk : List Prop β†’ Valuation | [], _ => False | a::_, 0 => a | _::as, n+1 => mk as n
Mathlib/Tactic/Sat/FromLRAT.lean
156
166
theorem Valuation.mk_implies {as ps} (as₁) : as = List.reverseAux as₁ ps β†’ (Valuation.mk as).implies p ps as₁.length β†’ p := by
induction ps generalizing as₁ with | nil => exact fun _ ↦ id | cons a as ih => refine fun e H ↦ @ih (a::as₁) e (H ?_) subst e; clear ih H suffices βˆ€ n n', n' = List.length as₁ + n β†’ βˆ€ bs, mk (as₁.reverseAux bs) n' ↔ mk bs n from this 0 _ rfl (a::as) induction as₁ with simp | cons b as₁ ih => exact fun n bs ↦ ih (n+1) _ (Nat.succ_add ..) _
7
import Mathlib.Algebra.Group.Nat set_option autoImplicit true open Lean hiding Literal HashMap open Batteries namespace Sat inductive Literal | pos : Nat β†’ Literal | neg : Nat β†’ Literal def Literal.ofInt (i : Int) : Literal := if i < 0 then Literal.neg (-i-1).toNat else Literal.pos (i-1).toNat def Literal.negate : Literal β†’ Literal | pos i => neg i | neg i => pos i instance : ToExpr Literal where toTypeExpr := mkConst ``Literal toExpr | Literal.pos i => mkApp (mkConst ``Literal.pos) (mkRawNatLit i) | Literal.neg i => mkApp (mkConst ``Literal.neg) (mkRawNatLit i) def Clause := List Literal def Clause.nil : Clause := [] def Clause.cons : Literal β†’ Clause β†’ Clause := List.cons abbrev Fmla := List Clause def Fmla.one (c : Clause) : Fmla := [c] def Fmla.and (a b : Fmla) : Fmla := a ++ b structure Fmla.subsumes (f f' : Fmla) : Prop where prop : βˆ€ x, x ∈ f' β†’ x ∈ f theorem Fmla.subsumes_self (f : Fmla) : f.subsumes f := ⟨fun _ h ↦ h⟩ theorem Fmla.subsumes_left (f f₁ fβ‚‚ : Fmla) (H : f.subsumes (f₁.and fβ‚‚)) : f.subsumes f₁ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inl h⟩ theorem Fmla.subsumes_right (f f₁ fβ‚‚ : Fmla) (H : f.subsumes (f₁.and fβ‚‚)) : f.subsumes fβ‚‚ := ⟨fun _ h ↦ H.1 _ <| List.mem_append.2 <| Or.inr h⟩ def Valuation := Nat β†’ Prop def Valuation.neg (v : Valuation) : Literal β†’ Prop | Literal.pos i => Β¬ v i | Literal.neg i => v i def Valuation.satisfies (v : Valuation) : Clause β†’ Prop | [] => False | l::c => v.neg l β†’ v.satisfies c structure Valuation.satisfies_fmla (v : Valuation) (f : Fmla) : Prop where prop : βˆ€ c, c ∈ f β†’ v.satisfies c def Fmla.proof (f : Fmla) (c : Clause) : Prop := βˆ€ v : Valuation, v.satisfies_fmla f β†’ v.satisfies c theorem Fmla.proof_of_subsumes (H : Fmla.subsumes f (Fmla.one c)) : f.proof c := fun _ h ↦ h.1 _ <| H.1 _ <| List.Mem.head .. theorem Valuation.by_cases {v : Valuation} {l} (h₁ : v.neg l.negate β†’ False) (hβ‚‚ : v.neg l β†’ False) : False := match l with | Literal.pos _ => hβ‚‚ h₁ | Literal.neg _ => h₁ hβ‚‚ def Valuation.implies (v : Valuation) (p : Prop) : List Prop β†’ Nat β†’ Prop | [], _ => p | a::as, n => (v n ↔ a) β†’ v.implies p as (n+1) def Valuation.mk : List Prop β†’ Valuation | [], _ => False | a::_, 0 => a | _::as, n+1 => mk as n theorem Valuation.mk_implies {as ps} (as₁) : as = List.reverseAux as₁ ps β†’ (Valuation.mk as).implies p ps as₁.length β†’ p := by induction ps generalizing as₁ with | nil => exact fun _ ↦ id | cons a as ih => refine fun e H ↦ @ih (a::as₁) e (H ?_) subst e; clear ih H suffices βˆ€ n n', n' = List.length as₁ + n β†’ βˆ€ bs, mk (as₁.reverseAux bs) n' ↔ mk bs n from this 0 _ rfl (a::as) induction as₁ with simp | cons b as₁ ih => exact fun n bs ↦ ih (n+1) _ (Nat.succ_add ..) _ structure Fmla.reify (v : Valuation) (f : Fmla) (p : Prop) : Prop where prop : Β¬ v.satisfies_fmla f β†’ p theorem Fmla.refute {ps} (f : Fmla) (hf : f.proof []) (hv : βˆ€ v, Valuation.implies v (Fmla.reify v f p) ps 0) : p := (Valuation.mk_implies [] rfl (hv _)).1 (hf _)
Mathlib/Tactic/Sat/FromLRAT.lean
180
185
theorem Fmla.reify_or (h₁ : Fmla.reify v f₁ a) (hβ‚‚ : Fmla.reify v fβ‚‚ b) : Fmla.reify v (f₁.and fβ‚‚) (a ∨ b) := by
refine ⟨fun H ↦ by_contra fun hn ↦ H ⟨fun c h ↦ by_contra fun hn' ↦ ?_⟩⟩ rcases List.mem_append.1 h with h | h Β· exact hn <| Or.inl <| h₁.1 fun Hc ↦ hn' <| Hc.1 _ h Β· exact hn <| Or.inr <| hβ‚‚.1 fun Hc ↦ hn' <| Hc.1 _ h
7
import Mathlib.Analysis.NormedSpace.Multilinear.Curry #align_import analysis.calculus.formal_multilinear_series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open Set Fin Topology -- Porting note: added explicit universes to fix compile universe u u' v w x variable {π•œ : Type u} {π•œ' : Type u'} {E : Type v} {F : Type w} {G : Type x} section variable [Ring π•œ] [AddCommGroup E] [Module π•œ E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousConstSMul π•œ E] [AddCommGroup F] [Module π•œ F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul π•œ F] [AddCommGroup G] [Module π•œ G] [TopologicalSpace G] [TopologicalAddGroup G] [ContinuousConstSMul π•œ G] @[nolint unusedArguments] def FormalMultilinearSeries (π•œ : Type*) (E : Type*) (F : Type*) [Ring π•œ] [AddCommGroup E] [Module π•œ E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousConstSMul π•œ E] [AddCommGroup F] [Module π•œ F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul π•œ F] := βˆ€ n : β„•, E[Γ—n]β†’L[π•œ] F #align formal_multilinear_series FormalMultilinearSeries -- Porting note: was `deriving` instance : AddCommGroup (FormalMultilinearSeries π•œ E F) := inferInstanceAs <| AddCommGroup <| βˆ€ n : β„•, E[Γ—n]β†’L[π•œ] F instance : Inhabited (FormalMultilinearSeries π•œ E F) := ⟨0⟩ namespace FormalMultilinearSeries @[simp] -- Porting note (#10756): new theorem; was not needed in Lean 3 theorem zero_apply (n : β„•) : (0 : FormalMultilinearSeries π•œ E F) n = 0 := rfl @[simp] -- Porting note (#10756): new theorem; was not needed in Lean 3 theorem neg_apply (f : FormalMultilinearSeries π•œ E F) (n : β„•) : (-f) n = - f n := rfl @[ext] -- Porting note (#10756): new theorem protected theorem ext {p q : FormalMultilinearSeries π•œ E F} (h : βˆ€ n, p n = q n) : p = q := funext h protected theorem ext_iff {p q : FormalMultilinearSeries π•œ E F} : p = q ↔ βˆ€ n, p n = q n := Function.funext_iff #align formal_multilinear_series.ext_iff FormalMultilinearSeries.ext_iff protected theorem ne_iff {p q : FormalMultilinearSeries π•œ E F} : p β‰  q ↔ βˆƒ n, p n β‰  q n := Function.ne_iff #align formal_multilinear_series.ne_iff FormalMultilinearSeries.ne_iff def prod (p : FormalMultilinearSeries π•œ E F) (q : FormalMultilinearSeries π•œ E G) : FormalMultilinearSeries π•œ E (F Γ— G) | n => (p n).prod (q n) def removeZero (p : FormalMultilinearSeries π•œ E F) : FormalMultilinearSeries π•œ E F | 0 => 0 | n + 1 => p (n + 1) #align formal_multilinear_series.remove_zero FormalMultilinearSeries.removeZero @[simp] theorem removeZero_coeff_zero (p : FormalMultilinearSeries π•œ E F) : p.removeZero 0 = 0 := rfl #align formal_multilinear_series.remove_zero_coeff_zero FormalMultilinearSeries.removeZero_coeff_zero @[simp] theorem removeZero_coeff_succ (p : FormalMultilinearSeries π•œ E F) (n : β„•) : p.removeZero (n + 1) = p (n + 1) := rfl #align formal_multilinear_series.remove_zero_coeff_succ FormalMultilinearSeries.removeZero_coeff_succ
Mathlib/Analysis/Calculus/FormalMultilinearSeries.lean
111
114
theorem removeZero_of_pos (p : FormalMultilinearSeries π•œ E F) {n : β„•} (h : 0 < n) : p.removeZero n = p n := by
rw [← Nat.succ_pred_eq_of_pos h] rfl
8
import Mathlib.Analysis.NormedSpace.Multilinear.Curry #align_import analysis.calculus.formal_multilinear_series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open Set Fin Topology -- Porting note: added explicit universes to fix compile universe u u' v w x variable {π•œ : Type u} {π•œ' : Type u'} {E : Type v} {F : Type w} {G : Type x} section variable [Ring π•œ] [AddCommGroup E] [Module π•œ E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousConstSMul π•œ E] [AddCommGroup F] [Module π•œ F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul π•œ F] [AddCommGroup G] [Module π•œ G] [TopologicalSpace G] [TopologicalAddGroup G] [ContinuousConstSMul π•œ G] @[nolint unusedArguments] def FormalMultilinearSeries (π•œ : Type*) (E : Type*) (F : Type*) [Ring π•œ] [AddCommGroup E] [Module π•œ E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousConstSMul π•œ E] [AddCommGroup F] [Module π•œ F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul π•œ F] := βˆ€ n : β„•, E[Γ—n]β†’L[π•œ] F #align formal_multilinear_series FormalMultilinearSeries -- Porting note: was `deriving` instance : AddCommGroup (FormalMultilinearSeries π•œ E F) := inferInstanceAs <| AddCommGroup <| βˆ€ n : β„•, E[Γ—n]β†’L[π•œ] F instance : Inhabited (FormalMultilinearSeries π•œ E F) := ⟨0⟩ namespace FormalMultilinearSeries @[simp] -- Porting note (#10756): new theorem; was not needed in Lean 3 theorem zero_apply (n : β„•) : (0 : FormalMultilinearSeries π•œ E F) n = 0 := rfl @[simp] -- Porting note (#10756): new theorem; was not needed in Lean 3 theorem neg_apply (f : FormalMultilinearSeries π•œ E F) (n : β„•) : (-f) n = - f n := rfl @[ext] -- Porting note (#10756): new theorem protected theorem ext {p q : FormalMultilinearSeries π•œ E F} (h : βˆ€ n, p n = q n) : p = q := funext h protected theorem ext_iff {p q : FormalMultilinearSeries π•œ E F} : p = q ↔ βˆ€ n, p n = q n := Function.funext_iff #align formal_multilinear_series.ext_iff FormalMultilinearSeries.ext_iff protected theorem ne_iff {p q : FormalMultilinearSeries π•œ E F} : p β‰  q ↔ βˆƒ n, p n β‰  q n := Function.ne_iff #align formal_multilinear_series.ne_iff FormalMultilinearSeries.ne_iff def prod (p : FormalMultilinearSeries π•œ E F) (q : FormalMultilinearSeries π•œ E G) : FormalMultilinearSeries π•œ E (F Γ— G) | n => (p n).prod (q n) def removeZero (p : FormalMultilinearSeries π•œ E F) : FormalMultilinearSeries π•œ E F | 0 => 0 | n + 1 => p (n + 1) #align formal_multilinear_series.remove_zero FormalMultilinearSeries.removeZero @[simp] theorem removeZero_coeff_zero (p : FormalMultilinearSeries π•œ E F) : p.removeZero 0 = 0 := rfl #align formal_multilinear_series.remove_zero_coeff_zero FormalMultilinearSeries.removeZero_coeff_zero @[simp] theorem removeZero_coeff_succ (p : FormalMultilinearSeries π•œ E F) (n : β„•) : p.removeZero (n + 1) = p (n + 1) := rfl #align formal_multilinear_series.remove_zero_coeff_succ FormalMultilinearSeries.removeZero_coeff_succ theorem removeZero_of_pos (p : FormalMultilinearSeries π•œ E F) {n : β„•} (h : 0 < n) : p.removeZero n = p n := by rw [← Nat.succ_pred_eq_of_pos h] rfl #align formal_multilinear_series.remove_zero_of_pos FormalMultilinearSeries.removeZero_of_pos
Mathlib/Analysis/Calculus/FormalMultilinearSeries.lean
119
124
theorem congr (p : FormalMultilinearSeries π•œ E F) {m n : β„•} {v : Fin m β†’ E} {w : Fin n β†’ E} (h1 : m = n) (h2 : βˆ€ (i : β„•) (him : i < m) (hin : i < n), v ⟨i, him⟩ = w ⟨i, hin⟩) : p m v = p n w := by
subst n congr with ⟨i, hi⟩ exact h2 i hi hi
8
import Aesop.Nanos import Aesop.Util.UnionFind import Aesop.Util.UnorderedArraySet import Batteries.Data.String import Batteries.Lean.Expr import Batteries.Lean.Meta.DiscrTree import Batteries.Lean.PersistentHashSet import Lean.Meta.Tactic.TryThis open Lean open Lean.Meta Lean.Elab.Tactic namespace Aesop.Array
.lake/packages/aesop/Aesop/Util/Basic.lean
21
24
theorem size_modify (a : Array Ξ±) (i : Nat) (f : Ξ± β†’ Ξ±) : (a.modify i f).size = a.size := by
simp only [Array.modify, Id.run, Array.modifyM] split <;> simp
9
import Mathlib.CategoryTheory.Limits.Shapes.Terminal #align_import category_theory.limits.shapes.zero_objects from "leanprover-community/mathlib"@"74333bd53d25b6809203a2bfae80eea5fc1fc076" noncomputable section universe v u v' u' open CategoryTheory open CategoryTheory.Category variable {C : Type u} [Category.{v} C] variable {D : Type u'} [Category.{v'} D] namespace CategoryTheory namespace Limits structure IsZero (X : C) : Prop where unique_to : βˆ€ Y, Nonempty (Unique (X ⟢ Y)) unique_from : βˆ€ Y, Nonempty (Unique (Y ⟢ X)) #align category_theory.limits.is_zero CategoryTheory.Limits.IsZero namespace IsZero variable {X Y : C} -- Porting note: `to` is a reserved word, it was replaced by `to_` protected def to_ (h : IsZero X) (Y : C) : X ⟢ Y := @default _ <| (h.unique_to Y).some.toInhabited #align category_theory.limits.is_zero.to CategoryTheory.Limits.IsZero.to_ theorem eq_to (h : IsZero X) (f : X ⟢ Y) : f = h.to_ Y := @Unique.eq_default _ (id _) _ #align category_theory.limits.is_zero.eq_to CategoryTheory.Limits.IsZero.eq_to theorem to_eq (h : IsZero X) (f : X ⟢ Y) : h.to_ Y = f := (h.eq_to f).symm #align category_theory.limits.is_zero.to_eq CategoryTheory.Limits.IsZero.to_eq -- Porting note: `from` is a reserved word, it was replaced by `from_` protected def from_ (h : IsZero X) (Y : C) : Y ⟢ X := @default _ <| (h.unique_from Y).some.toInhabited #align category_theory.limits.is_zero.from CategoryTheory.Limits.IsZero.from_ theorem eq_from (h : IsZero X) (f : Y ⟢ X) : f = h.from_ Y := @Unique.eq_default _ (id _) _ #align category_theory.limits.is_zero.eq_from CategoryTheory.Limits.IsZero.eq_from theorem from_eq (h : IsZero X) (f : Y ⟢ X) : h.from_ Y = f := (h.eq_from f).symm #align category_theory.limits.is_zero.from_eq CategoryTheory.Limits.IsZero.from_eq theorem eq_of_src (hX : IsZero X) (f g : X ⟢ Y) : f = g := (hX.eq_to f).trans (hX.eq_to g).symm #align category_theory.limits.is_zero.eq_of_src CategoryTheory.Limits.IsZero.eq_of_src theorem eq_of_tgt (hX : IsZero X) (f g : Y ⟢ X) : f = g := (hX.eq_from f).trans (hX.eq_from g).symm #align category_theory.limits.is_zero.eq_of_tgt CategoryTheory.Limits.IsZero.eq_of_tgt def iso (hX : IsZero X) (hY : IsZero Y) : X β‰… Y where hom := hX.to_ Y inv := hX.from_ Y hom_inv_id := hX.eq_of_src _ _ inv_hom_id := hY.eq_of_src _ _ #align category_theory.limits.is_zero.iso CategoryTheory.Limits.IsZero.iso protected def isInitial (hX : IsZero X) : IsInitial X := @IsInitial.ofUnique _ _ X fun Y => (hX.unique_to Y).some #align category_theory.limits.is_zero.is_initial CategoryTheory.Limits.IsZero.isInitial protected def isTerminal (hX : IsZero X) : IsTerminal X := @IsTerminal.ofUnique _ _ X fun Y => (hX.unique_from Y).some #align category_theory.limits.is_zero.is_terminal CategoryTheory.Limits.IsZero.isTerminal def isoIsInitial (hX : IsZero X) (hY : IsInitial Y) : X β‰… Y := IsInitial.uniqueUpToIso hX.isInitial hY #align category_theory.limits.is_zero.iso_is_initial CategoryTheory.Limits.IsZero.isoIsInitial def isoIsTerminal (hX : IsZero X) (hY : IsTerminal Y) : X β‰… Y := IsTerminal.uniqueUpToIso hX.isTerminal hY #align category_theory.limits.is_zero.iso_is_terminal CategoryTheory.Limits.IsZero.isoIsTerminal
Mathlib/CategoryTheory/Limits/Shapes/ZeroObjects.lean
117
123
theorem of_iso (hY : IsZero Y) (e : X β‰… Y) : IsZero X := by
refine ⟨fun Z => ⟨⟨⟨e.hom ≫ hY.to_ Z⟩, fun f => ?_⟩⟩, fun Z => ⟨⟨⟨hY.from_ Z ≫ e.inv⟩, fun f => ?_⟩⟩⟩ Β· rw [← cancel_epi e.inv] apply hY.eq_of_src Β· rw [← cancel_mono e.hom] apply hY.eq_of_tgt
10
import Mathlib.CategoryTheory.EffectiveEpi.Basic import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks import Mathlib.Tactic.ApplyFun namespace CategoryTheory open Limits variable {C : Type*} [Category C] noncomputable def effectiveEpiStructIsColimitDescOfEffectiveEpiFamily {B : C} {Ξ± : Type*} (X : Ξ± β†’ C) (c : Cofan X) (hc : IsColimit c) (Ο€ : (a : Ξ±) β†’ (X a ⟢ B)) [EffectiveEpiFamily X Ο€] : EffectiveEpiStruct (hc.desc (Cofan.mk B Ο€)) where desc e h := EffectiveEpiFamily.desc X Ο€ (fun a ↦ c.ΞΉ.app ⟨a⟩ ≫ e) (fun a₁ aβ‚‚ g₁ gβ‚‚ hg ↦ by simp only [← Category.assoc] exact h (g₁ ≫ c.ΞΉ.app ⟨aβ‚βŸ©) (gβ‚‚ ≫ c.ΞΉ.app ⟨aβ‚‚βŸ©) (by simpa)) fac e h := hc.hom_ext (fun ⟨j⟩ ↦ (by simp)) uniq e _ m hm := EffectiveEpiFamily.uniq X Ο€ (fun a ↦ c.ΞΉ.app ⟨a⟩ ≫ e) (fun _ _ _ _ hg ↦ (by simp [← hm, reassoc_of% hg])) m (fun _ ↦ (by simp [← hm])) noncomputable def effectiveEpiStructDescOfEffectiveEpiFamily {B : C} {Ξ± : Type*} (X : Ξ± β†’ C) (Ο€ : (a : Ξ±) β†’ (X a ⟢ B)) [HasCoproduct X] [EffectiveEpiFamily X Ο€] : EffectiveEpiStruct (Sigma.desc Ο€) := by simpa [coproductIsCoproduct] using effectiveEpiStructIsColimitDescOfEffectiveEpiFamily X _ (coproductIsCoproduct _) Ο€ instance {B : C} {Ξ± : Type*} (X : Ξ± β†’ C) (Ο€ : (a : Ξ±) β†’ (X a ⟢ B)) [HasCoproduct X] [EffectiveEpiFamily X Ο€] : EffectiveEpi (Sigma.desc Ο€) := ⟨⟨effectiveEpiStructDescOfEffectiveEpiFamily X Ο€βŸ©βŸ© example {B : C} {Ξ± : Type*} (X : Ξ± β†’ C) (Ο€ : (a : Ξ±) β†’ (X a ⟢ B)) [EffectiveEpiFamily X Ο€] [HasCoproduct X] : Epi (Sigma.desc Ο€) := inferInstance
Mathlib/CategoryTheory/EffectiveEpi/Coproduct.lean
61
93
theorem effectiveEpiFamilyStructOfEffectiveEpiDesc_aux {B : C} {Ξ± : Type*} {X : Ξ± β†’ C} {Ο€ : (a : Ξ±) β†’ X a ⟢ B} [HasCoproduct X] [βˆ€ {Z : C} (g : Z ⟢ ∐ X) (a : Ξ±), HasPullback g (Sigma.ΞΉ X a)] [βˆ€ {Z : C} (g : Z ⟢ ∐ X), HasCoproduct fun a ↦ pullback g (Sigma.ΞΉ X a)] [βˆ€ {Z : C} (g : Z ⟢ ∐ X), Epi (Sigma.desc fun a ↦ pullback.fst (f := g) (g := (Sigma.ΞΉ X a)))] {W : C} {e : (a : Ξ±) β†’ X a ⟢ W} (h : βˆ€ {Z : C} (a₁ aβ‚‚ : Ξ±) (g₁ : Z ⟢ X a₁) (gβ‚‚ : Z ⟢ X aβ‚‚), g₁ ≫ Ο€ a₁ = gβ‚‚ ≫ Ο€ aβ‚‚ β†’ g₁ ≫ e a₁ = gβ‚‚ ≫ e aβ‚‚) {Z : C} {g₁ gβ‚‚ : Z ⟢ ∐ fun b ↦ X b} (hg : g₁ ≫ Sigma.desc Ο€ = gβ‚‚ ≫ Sigma.desc Ο€) : g₁ ≫ Sigma.desc e = gβ‚‚ ≫ Sigma.desc e := by
apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := g₁) (g := (Sigma.ΞΉ X a))) ≫ Β·) using (fun a b ↦ (cancel_epi _).mp) ext a simp only [colimit.ΞΉ_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ΞΉ_app] rw [← Category.assoc, pullback.condition] simp only [Category.assoc, colimit.ΞΉ_desc, Cofan.mk_pt, Cofan.mk_ΞΉ_app] apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ gβ‚‚) (g := (Sigma.ΞΉ X a))) ≫ Β·) using (fun a b ↦ (cancel_epi _).mp) ext b simp only [colimit.ΞΉ_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ΞΉ_app] simp only [← Category.assoc] rw [(Category.assoc _ _ gβ‚‚), pullback.condition] simp only [Category.assoc, colimit.ΞΉ_desc, Cofan.mk_pt, Cofan.mk_ΞΉ_app] rw [← Category.assoc] apply h apply_fun (pullback.fst (f := g₁) (g := (Sigma.ΞΉ X a)) ≫ Β·) at hg rw [← Category.assoc, pullback.condition] at hg simp only [Category.assoc, colimit.ΞΉ_desc, Cofan.mk_pt, Cofan.mk_ΞΉ_app] at hg apply_fun ((Sigma.ΞΉ (fun a ↦ pullback _ _) b) ≫ (Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ gβ‚‚) (g := (Sigma.ΞΉ X a))) ≫ Β·) at hg simp only [colimit.ΞΉ_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ΞΉ_app] at hg simp only [← Category.assoc] at hg rw [(Category.assoc _ _ gβ‚‚), pullback.condition] at hg simpa using hg
11
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp]
Mathlib/Order/Heyting/Boundary.lean
63
63
theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by
rw [boundary, hnot_top, inf_bot_eq]
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp]
Mathlib/Order/Heyting/Boundary.lean
71
72
theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by
simp_rw [boundary, hnot_hnot_hnot, inf_comm]
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp] theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by simp_rw [boundary, hnot_hnot_hnot, inf_comm] #align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot @[simp]
Mathlib/Order/Heyting/Boundary.lean
76
76
theorem hnot_boundary (a : Ξ±) : οΏ’βˆ‚ a = ⊀ := by
rw [boundary, hnot_inf_distrib, sup_hnot_self]
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp] theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by simp_rw [boundary, hnot_hnot_hnot, inf_comm] #align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot @[simp] theorem hnot_boundary (a : Ξ±) : οΏ’βˆ‚ a = ⊀ := by rw [boundary, hnot_inf_distrib, sup_hnot_self] #align coheyting.hnot_boundary Coheyting.hnot_boundary
Mathlib/Order/Heyting/Boundary.lean
80
82
theorem boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ“ b βŠ” a βŠ“ βˆ‚ b := by
unfold boundary rw [hnot_inf_distrib, inf_sup_left, inf_right_comm, ← inf_assoc]
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp] theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by simp_rw [boundary, hnot_hnot_hnot, inf_comm] #align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot @[simp] theorem hnot_boundary (a : Ξ±) : οΏ’βˆ‚ a = ⊀ := by rw [boundary, hnot_inf_distrib, sup_hnot_self] #align coheyting.hnot_boundary Coheyting.hnot_boundary theorem boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ“ b βŠ” a βŠ“ βˆ‚ b := by unfold boundary rw [hnot_inf_distrib, inf_sup_left, inf_right_comm, ← inf_assoc] #align coheyting.boundary_inf Coheyting.boundary_inf theorem boundary_inf_le : βˆ‚ (a βŠ“ b) ≀ βˆ‚ a βŠ” βˆ‚ b := (boundary_inf _ _).trans_le <| sup_le_sup inf_le_left inf_le_right #align coheyting.boundary_inf_le Coheyting.boundary_inf_le
Mathlib/Order/Heyting/Boundary.lean
89
93
theorem boundary_sup_le : βˆ‚ (a βŠ” b) ≀ βˆ‚ a βŠ” βˆ‚ b := by
rw [boundary, inf_sup_right] exact sup_le_sup (inf_le_inf_left _ <| hnot_anti le_sup_left) (inf_le_inf_left _ <| hnot_anti le_sup_right)
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp] theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by simp_rw [boundary, hnot_hnot_hnot, inf_comm] #align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot @[simp] theorem hnot_boundary (a : Ξ±) : οΏ’βˆ‚ a = ⊀ := by rw [boundary, hnot_inf_distrib, sup_hnot_self] #align coheyting.hnot_boundary Coheyting.hnot_boundary theorem boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ“ b βŠ” a βŠ“ βˆ‚ b := by unfold boundary rw [hnot_inf_distrib, inf_sup_left, inf_right_comm, ← inf_assoc] #align coheyting.boundary_inf Coheyting.boundary_inf theorem boundary_inf_le : βˆ‚ (a βŠ“ b) ≀ βˆ‚ a βŠ” βˆ‚ b := (boundary_inf _ _).trans_le <| sup_le_sup inf_le_left inf_le_right #align coheyting.boundary_inf_le Coheyting.boundary_inf_le theorem boundary_sup_le : βˆ‚ (a βŠ” b) ≀ βˆ‚ a βŠ” βˆ‚ b := by rw [boundary, inf_sup_right] exact sup_le_sup (inf_le_inf_left _ <| hnot_anti le_sup_left) (inf_le_inf_left _ <| hnot_anti le_sup_right) #align coheyting.boundary_sup_le Coheyting.boundary_sup_le example (a b : Prop) : (a ∧ b ∨ Β¬(a ∧ b)) ∧ ((a ∨ b) ∨ Β¬(a ∨ b)) β†’ a ∨ Β¬a := by rintro ⟨⟨ha, _⟩ | hnab, (ha | hb) | hnab⟩ <;> try exact Or.inl ha Β· exact Or.inr fun ha => hnab ⟨ha, hb⟩ Β· exact Or.inr fun ha => hnab <| Or.inl ha
Mathlib/Order/Heyting/Boundary.lean
105
117
theorem boundary_le_boundary_sup_sup_boundary_inf_left : βˆ‚ a ≀ βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) := by
-- Porting note: the following simp generates the same term as mathlib3 if you remove -- sup_inf_right from both. With sup_inf_right included, mathlib4 and mathlib3 generate -- different terms simp only [boundary, sup_inf_left, sup_inf_right, sup_right_idem, le_inf_iff, sup_assoc, sup_comm _ a] refine ⟨⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩, ?_, ?_⟩ <;> try { exact le_sup_of_le_left inf_le_left } <;> refine inf_le_of_right_le ?_ · rw [hnot_le_iff_codisjoint_right, codisjoint_left_comm] exact codisjoint_hnot_left · refine le_sup_of_le_right ?_ rw [hnot_le_iff_codisjoint_right] exact codisjoint_hnot_right.mono_right (hnot_anti inf_le_left)
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp] theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by simp_rw [boundary, hnot_hnot_hnot, inf_comm] #align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot @[simp] theorem hnot_boundary (a : Ξ±) : οΏ’βˆ‚ a = ⊀ := by rw [boundary, hnot_inf_distrib, sup_hnot_self] #align coheyting.hnot_boundary Coheyting.hnot_boundary theorem boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ“ b βŠ” a βŠ“ βˆ‚ b := by unfold boundary rw [hnot_inf_distrib, inf_sup_left, inf_right_comm, ← inf_assoc] #align coheyting.boundary_inf Coheyting.boundary_inf theorem boundary_inf_le : βˆ‚ (a βŠ“ b) ≀ βˆ‚ a βŠ” βˆ‚ b := (boundary_inf _ _).trans_le <| sup_le_sup inf_le_left inf_le_right #align coheyting.boundary_inf_le Coheyting.boundary_inf_le theorem boundary_sup_le : βˆ‚ (a βŠ” b) ≀ βˆ‚ a βŠ” βˆ‚ b := by rw [boundary, inf_sup_right] exact sup_le_sup (inf_le_inf_left _ <| hnot_anti le_sup_left) (inf_le_inf_left _ <| hnot_anti le_sup_right) #align coheyting.boundary_sup_le Coheyting.boundary_sup_le example (a b : Prop) : (a ∧ b ∨ Β¬(a ∧ b)) ∧ ((a ∨ b) ∨ Β¬(a ∨ b)) β†’ a ∨ Β¬a := by rintro ⟨⟨ha, _⟩ | hnab, (ha | hb) | hnab⟩ <;> try exact Or.inl ha Β· exact Or.inr fun ha => hnab ⟨ha, hb⟩ Β· exact Or.inr fun ha => hnab <| Or.inl ha theorem boundary_le_boundary_sup_sup_boundary_inf_left : βˆ‚ a ≀ βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) := by -- Porting note: the following simp generates the same term as mathlib3 if you remove -- sup_inf_right from both. With sup_inf_right included, mathlib4 and mathlib3 generate -- different terms simp only [boundary, sup_inf_left, sup_inf_right, sup_right_idem, le_inf_iff, sup_assoc, sup_comm _ a] refine ⟨⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩, ?_, ?_⟩ <;> try { exact le_sup_of_le_left inf_le_left } <;> refine inf_le_of_right_le ?_ Β· rw [hnot_le_iff_codisjoint_right, codisjoint_left_comm] exact codisjoint_hnot_left Β· refine le_sup_of_le_right ?_ rw [hnot_le_iff_codisjoint_right] exact codisjoint_hnot_right.mono_right (hnot_anti inf_le_left) #align coheyting.boundary_le_boundary_sup_sup_boundary_inf_left Coheyting.boundary_le_boundary_sup_sup_boundary_inf_left
Mathlib/Order/Heyting/Boundary.lean
120
122
theorem boundary_le_boundary_sup_sup_boundary_inf_right : βˆ‚ b ≀ βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) := by
rw [sup_comm a, inf_comm] exact boundary_le_boundary_sup_sup_boundary_inf_left
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp] theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by simp_rw [boundary, hnot_hnot_hnot, inf_comm] #align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot @[simp] theorem hnot_boundary (a : Ξ±) : οΏ’βˆ‚ a = ⊀ := by rw [boundary, hnot_inf_distrib, sup_hnot_self] #align coheyting.hnot_boundary Coheyting.hnot_boundary theorem boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ“ b βŠ” a βŠ“ βˆ‚ b := by unfold boundary rw [hnot_inf_distrib, inf_sup_left, inf_right_comm, ← inf_assoc] #align coheyting.boundary_inf Coheyting.boundary_inf theorem boundary_inf_le : βˆ‚ (a βŠ“ b) ≀ βˆ‚ a βŠ” βˆ‚ b := (boundary_inf _ _).trans_le <| sup_le_sup inf_le_left inf_le_right #align coheyting.boundary_inf_le Coheyting.boundary_inf_le theorem boundary_sup_le : βˆ‚ (a βŠ” b) ≀ βˆ‚ a βŠ” βˆ‚ b := by rw [boundary, inf_sup_right] exact sup_le_sup (inf_le_inf_left _ <| hnot_anti le_sup_left) (inf_le_inf_left _ <| hnot_anti le_sup_right) #align coheyting.boundary_sup_le Coheyting.boundary_sup_le example (a b : Prop) : (a ∧ b ∨ Β¬(a ∧ b)) ∧ ((a ∨ b) ∨ Β¬(a ∨ b)) β†’ a ∨ Β¬a := by rintro ⟨⟨ha, _⟩ | hnab, (ha | hb) | hnab⟩ <;> try exact Or.inl ha Β· exact Or.inr fun ha => hnab ⟨ha, hb⟩ Β· exact Or.inr fun ha => hnab <| Or.inl ha theorem boundary_le_boundary_sup_sup_boundary_inf_left : βˆ‚ a ≀ βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) := by -- Porting note: the following simp generates the same term as mathlib3 if you remove -- sup_inf_right from both. With sup_inf_right included, mathlib4 and mathlib3 generate -- different terms simp only [boundary, sup_inf_left, sup_inf_right, sup_right_idem, le_inf_iff, sup_assoc, sup_comm _ a] refine ⟨⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩, ?_, ?_⟩ <;> try { exact le_sup_of_le_left inf_le_left } <;> refine inf_le_of_right_le ?_ Β· rw [hnot_le_iff_codisjoint_right, codisjoint_left_comm] exact codisjoint_hnot_left Β· refine le_sup_of_le_right ?_ rw [hnot_le_iff_codisjoint_right] exact codisjoint_hnot_right.mono_right (hnot_anti inf_le_left) #align coheyting.boundary_le_boundary_sup_sup_boundary_inf_left Coheyting.boundary_le_boundary_sup_sup_boundary_inf_left theorem boundary_le_boundary_sup_sup_boundary_inf_right : βˆ‚ b ≀ βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) := by rw [sup_comm a, inf_comm] exact boundary_le_boundary_sup_sup_boundary_inf_left #align coheyting.boundary_le_boundary_sup_sup_boundary_inf_right Coheyting.boundary_le_boundary_sup_sup_boundary_inf_right theorem boundary_sup_sup_boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ” βˆ‚ b := le_antisymm (sup_le boundary_sup_le boundary_inf_le) <| sup_le boundary_le_boundary_sup_sup_boundary_inf_left boundary_le_boundary_sup_sup_boundary_inf_right #align coheyting.boundary_sup_sup_boundary_inf Coheyting.boundary_sup_sup_boundary_inf @[simp]
Mathlib/Order/Heyting/Boundary.lean
132
132
theorem boundary_idem (a : Ξ±) : βˆ‚ βˆ‚ a = βˆ‚ a := by
rw [boundary, hnot_boundary, inf_top_eq]
12
import Mathlib.Order.BooleanAlgebra import Mathlib.Tactic.Common #align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" variable {Ξ± : Type*} namespace Coheyting variable [CoheytingAlgebra Ξ±] {a b : Ξ±} def boundary (a : Ξ±) : Ξ± := a βŠ“ οΏ’a #align coheyting.boundary Coheyting.boundary scoped[Heyting] prefix:120 "βˆ‚ " => Coheyting.boundary -- Porting note: Should the notation be automatically included in the current scope? open Heyting -- Porting note: Should hnot be named hNot? theorem inf_hnot_self (a : Ξ±) : a βŠ“ οΏ’a = βˆ‚ a := rfl #align coheyting.inf_hnot_self Coheyting.inf_hnot_self theorem boundary_le : βˆ‚ a ≀ a := inf_le_left #align coheyting.boundary_le Coheyting.boundary_le theorem boundary_le_hnot : βˆ‚ a ≀ οΏ’a := inf_le_right #align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot @[simp] theorem boundary_bot : βˆ‚ (βŠ₯ : Ξ±) = βŠ₯ := bot_inf_eq _ #align coheyting.boundary_bot Coheyting.boundary_bot @[simp] theorem boundary_top : βˆ‚ (⊀ : Ξ±) = βŠ₯ := by rw [boundary, hnot_top, inf_bot_eq] #align coheyting.boundary_top Coheyting.boundary_top theorem boundary_hnot_le (a : Ξ±) : βˆ‚ (οΏ’a) ≀ βˆ‚ a := (inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le #align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le @[simp] theorem boundary_hnot_hnot (a : Ξ±) : βˆ‚ (οΏ’οΏ’a) = βˆ‚ (οΏ’a) := by simp_rw [boundary, hnot_hnot_hnot, inf_comm] #align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot @[simp] theorem hnot_boundary (a : Ξ±) : οΏ’βˆ‚ a = ⊀ := by rw [boundary, hnot_inf_distrib, sup_hnot_self] #align coheyting.hnot_boundary Coheyting.hnot_boundary theorem boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ“ b βŠ” a βŠ“ βˆ‚ b := by unfold boundary rw [hnot_inf_distrib, inf_sup_left, inf_right_comm, ← inf_assoc] #align coheyting.boundary_inf Coheyting.boundary_inf theorem boundary_inf_le : βˆ‚ (a βŠ“ b) ≀ βˆ‚ a βŠ” βˆ‚ b := (boundary_inf _ _).trans_le <| sup_le_sup inf_le_left inf_le_right #align coheyting.boundary_inf_le Coheyting.boundary_inf_le theorem boundary_sup_le : βˆ‚ (a βŠ” b) ≀ βˆ‚ a βŠ” βˆ‚ b := by rw [boundary, inf_sup_right] exact sup_le_sup (inf_le_inf_left _ <| hnot_anti le_sup_left) (inf_le_inf_left _ <| hnot_anti le_sup_right) #align coheyting.boundary_sup_le Coheyting.boundary_sup_le example (a b : Prop) : (a ∧ b ∨ Β¬(a ∧ b)) ∧ ((a ∨ b) ∨ Β¬(a ∨ b)) β†’ a ∨ Β¬a := by rintro ⟨⟨ha, _⟩ | hnab, (ha | hb) | hnab⟩ <;> try exact Or.inl ha Β· exact Or.inr fun ha => hnab ⟨ha, hb⟩ Β· exact Or.inr fun ha => hnab <| Or.inl ha theorem boundary_le_boundary_sup_sup_boundary_inf_left : βˆ‚ a ≀ βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) := by -- Porting note: the following simp generates the same term as mathlib3 if you remove -- sup_inf_right from both. With sup_inf_right included, mathlib4 and mathlib3 generate -- different terms simp only [boundary, sup_inf_left, sup_inf_right, sup_right_idem, le_inf_iff, sup_assoc, sup_comm _ a] refine ⟨⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩, ?_, ?_⟩ <;> try { exact le_sup_of_le_left inf_le_left } <;> refine inf_le_of_right_le ?_ Β· rw [hnot_le_iff_codisjoint_right, codisjoint_left_comm] exact codisjoint_hnot_left Β· refine le_sup_of_le_right ?_ rw [hnot_le_iff_codisjoint_right] exact codisjoint_hnot_right.mono_right (hnot_anti inf_le_left) #align coheyting.boundary_le_boundary_sup_sup_boundary_inf_left Coheyting.boundary_le_boundary_sup_sup_boundary_inf_left theorem boundary_le_boundary_sup_sup_boundary_inf_right : βˆ‚ b ≀ βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) := by rw [sup_comm a, inf_comm] exact boundary_le_boundary_sup_sup_boundary_inf_left #align coheyting.boundary_le_boundary_sup_sup_boundary_inf_right Coheyting.boundary_le_boundary_sup_sup_boundary_inf_right theorem boundary_sup_sup_boundary_inf (a b : Ξ±) : βˆ‚ (a βŠ” b) βŠ” βˆ‚ (a βŠ“ b) = βˆ‚ a βŠ” βˆ‚ b := le_antisymm (sup_le boundary_sup_le boundary_inf_le) <| sup_le boundary_le_boundary_sup_sup_boundary_inf_left boundary_le_boundary_sup_sup_boundary_inf_right #align coheyting.boundary_sup_sup_boundary_inf Coheyting.boundary_sup_sup_boundary_inf @[simp] theorem boundary_idem (a : Ξ±) : βˆ‚ βˆ‚ a = βˆ‚ a := by rw [boundary, hnot_boundary, inf_top_eq] #align coheyting.boundary_idem Coheyting.boundary_idem
Mathlib/Order/Heyting/Boundary.lean
135
137
theorem hnot_hnot_sup_boundary (a : Ξ±) : οΏ’οΏ’a βŠ” βˆ‚ a = a := by
rw [boundary, sup_inf_left, hnot_sup_self, inf_top_eq, sup_eq_right] exact hnot_hnot_le
12
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*} variable [TopologicalSpace Ξ±] @[simp] theorem nhds_bind_nhdsWithin {a : Ξ±} {s : Set Ξ±} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_argβ‚‚ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝 a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  x in 𝓝[s] a, p x) ↔ βˆ€αΆ  x in 𝓝 a, x ∈ s β†’ p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆƒαΆ  x in 𝓝[s] z, p x) ↔ βˆƒαΆ  x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff
Mathlib/Topology/ContinuousOn.lean
57
59
theorem mem_closure_ne_iff_frequently_within {z : Ξ±} {s : Set Ξ±} : z ∈ closure (s \ {z}) ↔ βˆƒαΆ  x in 𝓝[β‰ ] z, x ∈ s := by
simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff]
13
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*} variable [TopologicalSpace Ξ±] @[simp] theorem nhds_bind_nhdsWithin {a : Ξ±} {s : Set Ξ±} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_argβ‚‚ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝 a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  x in 𝓝[s] a, p x) ↔ βˆ€αΆ  x in 𝓝 a, x ∈ s β†’ p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆƒαΆ  x in 𝓝[s] z, p x) ↔ βˆƒαΆ  x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff theorem mem_closure_ne_iff_frequently_within {z : Ξ±} {s : Set Ξ±} : z ∈ closure (s \ {z}) ↔ βˆƒαΆ  x in 𝓝[β‰ ] z, x ∈ s := by simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff] #align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within @[simp]
Mathlib/Topology/ContinuousOn.lean
63
67
theorem eventually_nhdsWithin_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝[s] a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := by
refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩ simp only [eventually_nhdsWithin_iff] at h ⊒ exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs
13
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*} variable [TopologicalSpace Ξ±] @[simp] theorem nhds_bind_nhdsWithin {a : Ξ±} {s : Set Ξ±} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_argβ‚‚ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝 a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  x in 𝓝[s] a, p x) ↔ βˆ€αΆ  x in 𝓝 a, x ∈ s β†’ p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆƒαΆ  x in 𝓝[s] z, p x) ↔ βˆƒαΆ  x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff theorem mem_closure_ne_iff_frequently_within {z : Ξ±} {s : Set Ξ±} : z ∈ closure (s \ {z}) ↔ βˆƒαΆ  x in 𝓝[β‰ ] z, x ∈ s := by simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff] #align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within @[simp] theorem eventually_nhdsWithin_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝[s] a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := by refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩ simp only [eventually_nhdsWithin_iff] at h ⊒ exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs #align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin theorem nhdsWithin_eq (a : Ξ±) (s : Set Ξ±) : 𝓝[s] a = β¨… t ∈ { t : Set Ξ± | a ∈ t ∧ IsOpen t }, π“Ÿ (t ∩ s) := ((nhds_basis_opens a).inf_principal s).eq_biInf #align nhds_within_eq nhdsWithin_eq
Mathlib/Topology/ContinuousOn.lean
75
76
theorem nhdsWithin_univ (a : Ξ±) : 𝓝[Set.univ] a = 𝓝 a := by
rw [nhdsWithin, principal_univ, inf_top_eq]
13
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*} variable [TopologicalSpace Ξ±] @[simp] theorem nhds_bind_nhdsWithin {a : Ξ±} {s : Set Ξ±} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_argβ‚‚ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝 a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  x in 𝓝[s] a, p x) ↔ βˆ€αΆ  x in 𝓝 a, x ∈ s β†’ p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆƒαΆ  x in 𝓝[s] z, p x) ↔ βˆƒαΆ  x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff theorem mem_closure_ne_iff_frequently_within {z : Ξ±} {s : Set Ξ±} : z ∈ closure (s \ {z}) ↔ βˆƒαΆ  x in 𝓝[β‰ ] z, x ∈ s := by simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff] #align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within @[simp] theorem eventually_nhdsWithin_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝[s] a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := by refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩ simp only [eventually_nhdsWithin_iff] at h ⊒ exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs #align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin theorem nhdsWithin_eq (a : Ξ±) (s : Set Ξ±) : 𝓝[s] a = β¨… t ∈ { t : Set Ξ± | a ∈ t ∧ IsOpen t }, π“Ÿ (t ∩ s) := ((nhds_basis_opens a).inf_principal s).eq_biInf #align nhds_within_eq nhdsWithin_eq theorem nhdsWithin_univ (a : Ξ±) : 𝓝[Set.univ] a = 𝓝 a := by rw [nhdsWithin, principal_univ, inf_top_eq] #align nhds_within_univ nhdsWithin_univ theorem nhdsWithin_hasBasis {p : Ξ² β†’ Prop} {s : Ξ² β†’ Set Ξ±} {a : Ξ±} (h : (𝓝 a).HasBasis p s) (t : Set Ξ±) : (𝓝[t] a).HasBasis p fun i => s i ∩ t := h.inf_principal t #align nhds_within_has_basis nhdsWithin_hasBasis theorem nhdsWithin_basis_open (a : Ξ±) (t : Set Ξ±) : (𝓝[t] a).HasBasis (fun u => a ∈ u ∧ IsOpen u) fun u => u ∩ t := nhdsWithin_hasBasis (nhds_basis_opens a) t #align nhds_within_basis_open nhdsWithin_basis_open
Mathlib/Topology/ContinuousOn.lean
89
91
theorem mem_nhdsWithin {t : Set Ξ±} {a : Ξ±} {s : Set Ξ±} : t ∈ 𝓝[s] a ↔ βˆƒ u, IsOpen u ∧ a ∈ u ∧ u ∩ s βŠ† t := by
simpa only [and_assoc, and_left_comm] using (nhdsWithin_basis_open a s).mem_iff
13
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*} variable [TopologicalSpace Ξ±] @[simp] theorem nhds_bind_nhdsWithin {a : Ξ±} {s : Set Ξ±} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_argβ‚‚ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝 a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  x in 𝓝[s] a, p x) ↔ βˆ€αΆ  x in 𝓝 a, x ∈ s β†’ p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆƒαΆ  x in 𝓝[s] z, p x) ↔ βˆƒαΆ  x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff theorem mem_closure_ne_iff_frequently_within {z : Ξ±} {s : Set Ξ±} : z ∈ closure (s \ {z}) ↔ βˆƒαΆ  x in 𝓝[β‰ ] z, x ∈ s := by simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff] #align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within @[simp] theorem eventually_nhdsWithin_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝[s] a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := by refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩ simp only [eventually_nhdsWithin_iff] at h ⊒ exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs #align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin theorem nhdsWithin_eq (a : Ξ±) (s : Set Ξ±) : 𝓝[s] a = β¨… t ∈ { t : Set Ξ± | a ∈ t ∧ IsOpen t }, π“Ÿ (t ∩ s) := ((nhds_basis_opens a).inf_principal s).eq_biInf #align nhds_within_eq nhdsWithin_eq theorem nhdsWithin_univ (a : Ξ±) : 𝓝[Set.univ] a = 𝓝 a := by rw [nhdsWithin, principal_univ, inf_top_eq] #align nhds_within_univ nhdsWithin_univ theorem nhdsWithin_hasBasis {p : Ξ² β†’ Prop} {s : Ξ² β†’ Set Ξ±} {a : Ξ±} (h : (𝓝 a).HasBasis p s) (t : Set Ξ±) : (𝓝[t] a).HasBasis p fun i => s i ∩ t := h.inf_principal t #align nhds_within_has_basis nhdsWithin_hasBasis theorem nhdsWithin_basis_open (a : Ξ±) (t : Set Ξ±) : (𝓝[t] a).HasBasis (fun u => a ∈ u ∧ IsOpen u) fun u => u ∩ t := nhdsWithin_hasBasis (nhds_basis_opens a) t #align nhds_within_basis_open nhdsWithin_basis_open theorem mem_nhdsWithin {t : Set Ξ±} {a : Ξ±} {s : Set Ξ±} : t ∈ 𝓝[s] a ↔ βˆƒ u, IsOpen u ∧ a ∈ u ∧ u ∩ s βŠ† t := by simpa only [and_assoc, and_left_comm] using (nhdsWithin_basis_open a s).mem_iff #align mem_nhds_within mem_nhdsWithin theorem mem_nhdsWithin_iff_exists_mem_nhds_inter {t : Set Ξ±} {a : Ξ±} {s : Set Ξ±} : t ∈ 𝓝[s] a ↔ βˆƒ u ∈ 𝓝 a, u ∩ s βŠ† t := (nhdsWithin_hasBasis (𝓝 a).basis_sets s).mem_iff #align mem_nhds_within_iff_exists_mem_nhds_inter mem_nhdsWithin_iff_exists_mem_nhds_inter theorem diff_mem_nhdsWithin_compl {x : Ξ±} {s : Set Ξ±} (hs : s ∈ 𝓝 x) (t : Set Ξ±) : s \ t ∈ 𝓝[tᢜ] x := diff_mem_inf_principal_compl hs t #align diff_mem_nhds_within_compl diff_mem_nhdsWithin_compl
Mathlib/Topology/ContinuousOn.lean
104
107
theorem diff_mem_nhdsWithin_diff {x : Ξ±} {s t : Set Ξ±} (hs : s ∈ 𝓝[t] x) (t' : Set Ξ±) : s \ t' ∈ 𝓝[t \ t'] x := by
rw [nhdsWithin, diff_eq, diff_eq, ← inf_principal, ← inf_assoc] exact inter_mem_inf hs (mem_principal_self _)
13
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*} variable [TopologicalSpace Ξ±] @[simp] theorem nhds_bind_nhdsWithin {a : Ξ±} {s : Set Ξ±} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_argβ‚‚ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝 a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  x in 𝓝[s] a, p x) ↔ βˆ€αΆ  x in 𝓝 a, x ∈ s β†’ p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆƒαΆ  x in 𝓝[s] z, p x) ↔ βˆƒαΆ  x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff theorem mem_closure_ne_iff_frequently_within {z : Ξ±} {s : Set Ξ±} : z ∈ closure (s \ {z}) ↔ βˆƒαΆ  x in 𝓝[β‰ ] z, x ∈ s := by simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff] #align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within @[simp] theorem eventually_nhdsWithin_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β†’ Prop} : (βˆ€αΆ  y in 𝓝[s] a, βˆ€αΆ  x in 𝓝[s] y, p x) ↔ βˆ€αΆ  x in 𝓝[s] a, p x := by refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩ simp only [eventually_nhdsWithin_iff] at h ⊒ exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs #align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin theorem nhdsWithin_eq (a : Ξ±) (s : Set Ξ±) : 𝓝[s] a = β¨… t ∈ { t : Set Ξ± | a ∈ t ∧ IsOpen t }, π“Ÿ (t ∩ s) := ((nhds_basis_opens a).inf_principal s).eq_biInf #align nhds_within_eq nhdsWithin_eq theorem nhdsWithin_univ (a : Ξ±) : 𝓝[Set.univ] a = 𝓝 a := by rw [nhdsWithin, principal_univ, inf_top_eq] #align nhds_within_univ nhdsWithin_univ theorem nhdsWithin_hasBasis {p : Ξ² β†’ Prop} {s : Ξ² β†’ Set Ξ±} {a : Ξ±} (h : (𝓝 a).HasBasis p s) (t : Set Ξ±) : (𝓝[t] a).HasBasis p fun i => s i ∩ t := h.inf_principal t #align nhds_within_has_basis nhdsWithin_hasBasis theorem nhdsWithin_basis_open (a : Ξ±) (t : Set Ξ±) : (𝓝[t] a).HasBasis (fun u => a ∈ u ∧ IsOpen u) fun u => u ∩ t := nhdsWithin_hasBasis (nhds_basis_opens a) t #align nhds_within_basis_open nhdsWithin_basis_open theorem mem_nhdsWithin {t : Set Ξ±} {a : Ξ±} {s : Set Ξ±} : t ∈ 𝓝[s] a ↔ βˆƒ u, IsOpen u ∧ a ∈ u ∧ u ∩ s βŠ† t := by simpa only [and_assoc, and_left_comm] using (nhdsWithin_basis_open a s).mem_iff #align mem_nhds_within mem_nhdsWithin theorem mem_nhdsWithin_iff_exists_mem_nhds_inter {t : Set Ξ±} {a : Ξ±} {s : Set Ξ±} : t ∈ 𝓝[s] a ↔ βˆƒ u ∈ 𝓝 a, u ∩ s βŠ† t := (nhdsWithin_hasBasis (𝓝 a).basis_sets s).mem_iff #align mem_nhds_within_iff_exists_mem_nhds_inter mem_nhdsWithin_iff_exists_mem_nhds_inter theorem diff_mem_nhdsWithin_compl {x : Ξ±} {s : Set Ξ±} (hs : s ∈ 𝓝 x) (t : Set Ξ±) : s \ t ∈ 𝓝[tᢜ] x := diff_mem_inf_principal_compl hs t #align diff_mem_nhds_within_compl diff_mem_nhdsWithin_compl theorem diff_mem_nhdsWithin_diff {x : Ξ±} {s t : Set Ξ±} (hs : s ∈ 𝓝[t] x) (t' : Set Ξ±) : s \ t' ∈ 𝓝[t \ t'] x := by rw [nhdsWithin, diff_eq, diff_eq, ← inf_principal, ← inf_assoc] exact inter_mem_inf hs (mem_principal_self _) #align diff_mem_nhds_within_diff diff_mem_nhdsWithin_diff
Mathlib/Topology/ContinuousOn.lean
110
113
theorem nhds_of_nhdsWithin_of_nhds {s t : Set Ξ±} {a : Ξ±} (h1 : s ∈ 𝓝 a) (h2 : t ∈ 𝓝[s] a) : t ∈ 𝓝 a := by
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.mp h2 with ⟨_, Hw, hw⟩ exact (𝓝 a).sets_of_superset ((𝓝 a).inter_sets Hw h1) hw
13
import Mathlib.Topology.Algebra.UniformConvergence #align_import topology.algebra.equicontinuity from "leanprover-community/mathlib"@"01ad394a11bf06b950232720cf7e8fc6b22f0d6a" open Function open UniformConvergence @[to_additive]
Mathlib/Topology/Algebra/Equicontinuity.lean
20
31
theorem equicontinuous_of_equicontinuousAt_one {ΞΉ G M hom : Type*} [TopologicalSpace G] [UniformSpace M] [Group G] [Group M] [TopologicalGroup G] [UniformGroup M] [FunLike hom G M] [MonoidHomClass hom G M] (F : ΞΉ β†’ hom) (hf : EquicontinuousAt ((↑) ∘ F) (1 : G)) : Equicontinuous ((↑) ∘ F) := by
rw [equicontinuous_iff_continuous] rw [equicontinuousAt_iff_continuousAt] at hf let Ο† : G β†’* (ΞΉ β†’α΅€ M) := { toFun := swap ((↑) ∘ F) map_one' := by dsimp [UniformFun]; ext; exact map_one _ map_mul' := fun a b => by dsimp [UniformFun]; ext; exact map_mul _ _ _ } exact continuous_of_continuousAt_one Ο† hf
14
import Mathlib.Topology.Algebra.UniformConvergence #align_import topology.algebra.equicontinuity from "leanprover-community/mathlib"@"01ad394a11bf06b950232720cf7e8fc6b22f0d6a" open Function open UniformConvergence @[to_additive] theorem equicontinuous_of_equicontinuousAt_one {ΞΉ G M hom : Type*} [TopologicalSpace G] [UniformSpace M] [Group G] [Group M] [TopologicalGroup G] [UniformGroup M] [FunLike hom G M] [MonoidHomClass hom G M] (F : ΞΉ β†’ hom) (hf : EquicontinuousAt ((↑) ∘ F) (1 : G)) : Equicontinuous ((↑) ∘ F) := by rw [equicontinuous_iff_continuous] rw [equicontinuousAt_iff_continuousAt] at hf let Ο† : G β†’* (ΞΉ β†’α΅€ M) := { toFun := swap ((↑) ∘ F) map_one' := by dsimp [UniformFun]; ext; exact map_one _ map_mul' := fun a b => by dsimp [UniformFun]; ext; exact map_mul _ _ _ } exact continuous_of_continuousAt_one Ο† hf #align equicontinuous_of_equicontinuous_at_one equicontinuous_of_equicontinuousAt_one #align equicontinuous_of_equicontinuous_at_zero equicontinuous_of_equicontinuousAt_zero @[to_additive]
Mathlib/Topology/Algebra/Equicontinuity.lean
36
47
theorem uniformEquicontinuous_of_equicontinuousAt_one {ΞΉ G M hom : Type*} [UniformSpace G] [UniformSpace M] [Group G] [Group M] [UniformGroup G] [UniformGroup M] [FunLike hom G M] [MonoidHomClass hom G M] (F : ΞΉ β†’ hom) (hf : EquicontinuousAt ((↑) ∘ F) (1 : G)) : UniformEquicontinuous ((↑) ∘ F) := by
rw [uniformEquicontinuous_iff_uniformContinuous] rw [equicontinuousAt_iff_continuousAt] at hf let Ο† : G β†’* (ΞΉ β†’α΅€ M) := { toFun := swap ((↑) ∘ F) map_one' := by dsimp [UniformFun]; ext; exact map_one _ map_mul' := fun a b => by dsimp [UniformFun]; ext; exact map_mul _ _ _ } exact uniformContinuous_of_continuousAt_one Ο† hf
14
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
Mathlib/Data/Nat/Size.lean
38
39
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp]
Mathlib/Data/Nat/Size.lean
51
51
theorem size_zero : size 0 = 0 := by
simp [size]
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp]
Mathlib/Data/Nat/Size.lean
55
61
theorem size_bit {b n} (h : bit b n β‰  0) : size (bit b n) = succ (size n) := by
rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit]
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n β‰  0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n β‰  0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp]
Mathlib/Data/Nat/Size.lean
85
97
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β‰  0) : size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h ⊒ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊒ cases b; Β· exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n β‰  0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n β‰  0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β‰  0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊒ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊒ cases b; Β· exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF]
Mathlib/Data/Nat/Size.lean
103
104
theorem size_shiftLeft {m} (h : m β‰  0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false]
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n β‰  0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n β‰  0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β‰  0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊒ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊒ cases b; Β· exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF] theorem size_shiftLeft {m} (h : m β‰  0) (n) : size (m <<< n) = size m + n := by simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false] #align nat.size_shiftl Nat.size_shiftLeft
Mathlib/Data/Nat/Size.lean
107
116
theorem lt_size_self (n : β„•) : n < 2 ^ size n := by
rw [← one_shiftLeft] have : βˆ€ {n}, n = 0 β†’ n < 1 <<< (size n) := by simp apply binaryRec _ _ n Β· apply this rfl intro b n IH by_cases h : bit b n = 0 Β· apply this h rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val] exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH)
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n β‰  0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n β‰  0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β‰  0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊒ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊒ cases b; Β· exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF] theorem size_shiftLeft {m} (h : m β‰  0) (n) : size (m <<< n) = size m + n := by simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false] #align nat.size_shiftl Nat.size_shiftLeft theorem lt_size_self (n : β„•) : n < 2 ^ size n := by rw [← one_shiftLeft] have : βˆ€ {n}, n = 0 β†’ n < 1 <<< (size n) := by simp apply binaryRec _ _ n Β· apply this rfl intro b n IH by_cases h : bit b n = 0 Β· apply this h rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val] exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH) #align nat.lt_size_self Nat.lt_size_self theorem size_le {m n : β„•} : size m ≀ n ↔ m < 2 ^ n := ⟨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by rw [← one_shiftLeft]; revert n apply binaryRec _ _ m Β· intro n simp Β· intro b m IH n h by_cases e : bit b m = 0 Β· simp [e] rw [size_bit e] cases' n with n Β· exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h)) Β· apply succ_le_succ (IH _) apply Nat.lt_of_mul_lt_mul_left (a := 2) simp only [← bit0_val, shiftLeft_succ] at * exact lt_of_le_of_lt (bit0_le_bit b rfl.le) h⟩ #align nat.size_le Nat.size_le
Mathlib/Data/Nat/Size.lean
137
138
theorem lt_size {m n : β„•} : m < size n ↔ 2 ^ m ≀ n := by
rw [← not_lt, Decidable.iff_not_comm, not_lt, size_le]
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n β‰  0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n β‰  0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β‰  0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊒ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊒ cases b; Β· exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF] theorem size_shiftLeft {m} (h : m β‰  0) (n) : size (m <<< n) = size m + n := by simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false] #align nat.size_shiftl Nat.size_shiftLeft theorem lt_size_self (n : β„•) : n < 2 ^ size n := by rw [← one_shiftLeft] have : βˆ€ {n}, n = 0 β†’ n < 1 <<< (size n) := by simp apply binaryRec _ _ n Β· apply this rfl intro b n IH by_cases h : bit b n = 0 Β· apply this h rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val] exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH) #align nat.lt_size_self Nat.lt_size_self theorem size_le {m n : β„•} : size m ≀ n ↔ m < 2 ^ n := ⟨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by rw [← one_shiftLeft]; revert n apply binaryRec _ _ m Β· intro n simp Β· intro b m IH n h by_cases e : bit b m = 0 Β· simp [e] rw [size_bit e] cases' n with n Β· exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h)) Β· apply succ_le_succ (IH _) apply Nat.lt_of_mul_lt_mul_left (a := 2) simp only [← bit0_val, shiftLeft_succ] at * exact lt_of_le_of_lt (bit0_le_bit b rfl.le) h⟩ #align nat.size_le Nat.size_le theorem lt_size {m n : β„•} : m < size n ↔ 2 ^ m ≀ n := by rw [← not_lt, Decidable.iff_not_comm, not_lt, size_le] #align nat.lt_size Nat.lt_size
Mathlib/Data/Nat/Size.lean
141
141
theorem size_pos {n : β„•} : 0 < size n ↔ 0 < n := by
rw [lt_size]; rfl
15
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : βˆ€ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : βˆ€ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m β‰  0) (n) : shiftLeft' b m n β‰  0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : βˆ€ {n}, (n β‰  0) β†’ shiftLeft' true m n β‰  0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n β‰  0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n β‰  0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β‰  0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊒ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊒ cases b; Β· exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF] theorem size_shiftLeft {m} (h : m β‰  0) (n) : size (m <<< n) = size m + n := by simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false] #align nat.size_shiftl Nat.size_shiftLeft theorem lt_size_self (n : β„•) : n < 2 ^ size n := by rw [← one_shiftLeft] have : βˆ€ {n}, n = 0 β†’ n < 1 <<< (size n) := by simp apply binaryRec _ _ n Β· apply this rfl intro b n IH by_cases h : bit b n = 0 Β· apply this h rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val] exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH) #align nat.lt_size_self Nat.lt_size_self theorem size_le {m n : β„•} : size m ≀ n ↔ m < 2 ^ n := ⟨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by rw [← one_shiftLeft]; revert n apply binaryRec _ _ m Β· intro n simp Β· intro b m IH n h by_cases e : bit b m = 0 Β· simp [e] rw [size_bit e] cases' n with n Β· exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h)) Β· apply succ_le_succ (IH _) apply Nat.lt_of_mul_lt_mul_left (a := 2) simp only [← bit0_val, shiftLeft_succ] at * exact lt_of_le_of_lt (bit0_le_bit b rfl.le) h⟩ #align nat.size_le Nat.size_le theorem lt_size {m n : β„•} : m < size n ↔ 2 ^ m ≀ n := by rw [← not_lt, Decidable.iff_not_comm, not_lt, size_le] #align nat.lt_size Nat.lt_size theorem size_pos {n : β„•} : 0 < size n ↔ 0 < n := by rw [lt_size]; rfl #align nat.size_pos Nat.size_pos
Mathlib/Data/Nat/Size.lean
144
145
theorem size_eq_zero {n : β„•} : size n = 0 ↔ n = 0 := by
simpa [Nat.pos_iff_ne_zero, not_iff_not] using size_pos
15
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def
Mathlib/Data/Nat/Dist.lean
27
27
theorem dist_comm (n m : β„•) : dist n m = dist m n := by
simp [dist, add_comm]
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp]
Mathlib/Data/Nat/Dist.lean
31
31
theorem dist_self (n : β„•) : dist n n = 0 := by
simp [dist, tsub_self]
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero
Mathlib/Data/Nat/Dist.lean
42
42
theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by
rw [h, dist_self]
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero
Mathlib/Data/Nat/Dist.lean
45
46
theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by
rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add]
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le
Mathlib/Data/Nat/Dist.lean
49
50
theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by
rw [dist_comm]; apply dist_eq_sub_of_le h
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left
Mathlib/Data/Nat/Dist.lean
57
57
theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by
rw [add_comm]; apply dist_tri_left
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right
Mathlib/Data/Nat/Dist.lean
60
60
theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by
rw [dist_comm]; apply dist_tri_left
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left'
Mathlib/Data/Nat/Dist.lean
63
63
theorem dist_tri_right' (n m : β„•) : n ≀ m + dist n m := by
rw [dist_comm]; apply dist_tri_right
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left' theorem dist_tri_right' (n m : β„•) : n ≀ m + dist n m := by rw [dist_comm]; apply dist_tri_right #align nat.dist_tri_right' Nat.dist_tri_right' theorem dist_zero_right (n : β„•) : dist n 0 = n := Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n) #align nat.dist_zero_right Nat.dist_zero_right theorem dist_zero_left (n : β„•) : dist 0 n = n := Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n) #align nat.dist_zero_left Nat.dist_zero_left
Mathlib/Data/Nat/Dist.lean
74
78
theorem dist_add_add_right (n k m : β„•) : dist (n + k) (m + k) = dist n m := calc dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl _ = n - m + (m + k - (n + k)) := by
rw [@add_tsub_add_eq_tsub_right] _ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right]
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left' theorem dist_tri_right' (n m : β„•) : n ≀ m + dist n m := by rw [dist_comm]; apply dist_tri_right #align nat.dist_tri_right' Nat.dist_tri_right' theorem dist_zero_right (n : β„•) : dist n 0 = n := Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n) #align nat.dist_zero_right Nat.dist_zero_right theorem dist_zero_left (n : β„•) : dist 0 n = n := Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n) #align nat.dist_zero_left Nat.dist_zero_left theorem dist_add_add_right (n k m : β„•) : dist (n + k) (m + k) = dist n m := calc dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl _ = n - m + (m + k - (n + k)) := by rw [@add_tsub_add_eq_tsub_right] _ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right] #align nat.dist_add_add_right Nat.dist_add_add_right
Mathlib/Data/Nat/Dist.lean
81
82
theorem dist_add_add_left (k n m : β„•) : dist (k + n) (k + m) = dist n m := by
rw [add_comm k n, add_comm k m]; apply dist_add_add_right
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left' theorem dist_tri_right' (n m : β„•) : n ≀ m + dist n m := by rw [dist_comm]; apply dist_tri_right #align nat.dist_tri_right' Nat.dist_tri_right' theorem dist_zero_right (n : β„•) : dist n 0 = n := Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n) #align nat.dist_zero_right Nat.dist_zero_right theorem dist_zero_left (n : β„•) : dist 0 n = n := Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n) #align nat.dist_zero_left Nat.dist_zero_left theorem dist_add_add_right (n k m : β„•) : dist (n + k) (m + k) = dist n m := calc dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl _ = n - m + (m + k - (n + k)) := by rw [@add_tsub_add_eq_tsub_right] _ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right] #align nat.dist_add_add_right Nat.dist_add_add_right theorem dist_add_add_left (k n m : β„•) : dist (k + n) (k + m) = dist n m := by rw [add_comm k n, add_comm k m]; apply dist_add_add_right #align nat.dist_add_add_left Nat.dist_add_add_left
Mathlib/Data/Nat/Dist.lean
85
89
theorem dist_eq_intro {n m k l : β„•} (h : n + m = k + l) : dist n k = dist l m := calc dist n k = dist (n + m) (k + m) := by
rw [dist_add_add_right] _ = dist (k + l) (k + m) := by rw [h] _ = dist l m := by rw [dist_add_add_left]
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left' theorem dist_tri_right' (n m : β„•) : n ≀ m + dist n m := by rw [dist_comm]; apply dist_tri_right #align nat.dist_tri_right' Nat.dist_tri_right' theorem dist_zero_right (n : β„•) : dist n 0 = n := Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n) #align nat.dist_zero_right Nat.dist_zero_right theorem dist_zero_left (n : β„•) : dist 0 n = n := Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n) #align nat.dist_zero_left Nat.dist_zero_left theorem dist_add_add_right (n k m : β„•) : dist (n + k) (m + k) = dist n m := calc dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl _ = n - m + (m + k - (n + k)) := by rw [@add_tsub_add_eq_tsub_right] _ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right] #align nat.dist_add_add_right Nat.dist_add_add_right theorem dist_add_add_left (k n m : β„•) : dist (k + n) (k + m) = dist n m := by rw [add_comm k n, add_comm k m]; apply dist_add_add_right #align nat.dist_add_add_left Nat.dist_add_add_left theorem dist_eq_intro {n m k l : β„•} (h : n + m = k + l) : dist n k = dist l m := calc dist n k = dist (n + m) (k + m) := by rw [dist_add_add_right] _ = dist (k + l) (k + m) := by rw [h] _ = dist l m := by rw [dist_add_add_left] #align nat.dist_eq_intro Nat.dist_eq_intro
Mathlib/Data/Nat/Dist.lean
92
96
theorem dist.triangle_inequality (n m k : β„•) : dist n k ≀ dist n m + dist m k := by
have : dist n m + dist m k = n - m + (m - k) + (k - m + (m - n)) := by simp [dist, add_comm, add_left_comm, add_assoc] rw [this, dist] exact add_le_add tsub_le_tsub_add_tsub tsub_le_tsub_add_tsub
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left' theorem dist_tri_right' (n m : β„•) : n ≀ m + dist n m := by rw [dist_comm]; apply dist_tri_right #align nat.dist_tri_right' Nat.dist_tri_right' theorem dist_zero_right (n : β„•) : dist n 0 = n := Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n) #align nat.dist_zero_right Nat.dist_zero_right theorem dist_zero_left (n : β„•) : dist 0 n = n := Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n) #align nat.dist_zero_left Nat.dist_zero_left theorem dist_add_add_right (n k m : β„•) : dist (n + k) (m + k) = dist n m := calc dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl _ = n - m + (m + k - (n + k)) := by rw [@add_tsub_add_eq_tsub_right] _ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right] #align nat.dist_add_add_right Nat.dist_add_add_right theorem dist_add_add_left (k n m : β„•) : dist (k + n) (k + m) = dist n m := by rw [add_comm k n, add_comm k m]; apply dist_add_add_right #align nat.dist_add_add_left Nat.dist_add_add_left theorem dist_eq_intro {n m k l : β„•} (h : n + m = k + l) : dist n k = dist l m := calc dist n k = dist (n + m) (k + m) := by rw [dist_add_add_right] _ = dist (k + l) (k + m) := by rw [h] _ = dist l m := by rw [dist_add_add_left] #align nat.dist_eq_intro Nat.dist_eq_intro theorem dist.triangle_inequality (n m k : β„•) : dist n k ≀ dist n m + dist m k := by have : dist n m + dist m k = n - m + (m - k) + (k - m + (m - n)) := by simp [dist, add_comm, add_left_comm, add_assoc] rw [this, dist] exact add_le_add tsub_le_tsub_add_tsub tsub_le_tsub_add_tsub #align nat.dist.triangle_inequality Nat.dist.triangle_inequality
Mathlib/Data/Nat/Dist.lean
99
100
theorem dist_mul_right (n k m : β„•) : dist (n * k) (m * k) = dist n m * k := by
rw [dist, dist, right_distrib, tsub_mul n, tsub_mul m]
16
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : β„•) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : β„•) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : β„•) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : β„•} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≀ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≀ n := tsub_eq_zero_iff_le.mp this le_antisymm β€Ήn ≀ mβ€Ί β€Ήm ≀ nβ€Ί #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : β„•} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : β„•} (h : n ≀ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : β„•} (h : m ≀ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : β„•) : m ≀ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : β„•) : m ≀ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : β„•) : n ≀ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left' theorem dist_tri_right' (n m : β„•) : n ≀ m + dist n m := by rw [dist_comm]; apply dist_tri_right #align nat.dist_tri_right' Nat.dist_tri_right' theorem dist_zero_right (n : β„•) : dist n 0 = n := Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n) #align nat.dist_zero_right Nat.dist_zero_right theorem dist_zero_left (n : β„•) : dist 0 n = n := Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n) #align nat.dist_zero_left Nat.dist_zero_left theorem dist_add_add_right (n k m : β„•) : dist (n + k) (m + k) = dist n m := calc dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl _ = n - m + (m + k - (n + k)) := by rw [@add_tsub_add_eq_tsub_right] _ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right] #align nat.dist_add_add_right Nat.dist_add_add_right theorem dist_add_add_left (k n m : β„•) : dist (k + n) (k + m) = dist n m := by rw [add_comm k n, add_comm k m]; apply dist_add_add_right #align nat.dist_add_add_left Nat.dist_add_add_left theorem dist_eq_intro {n m k l : β„•} (h : n + m = k + l) : dist n k = dist l m := calc dist n k = dist (n + m) (k + m) := by rw [dist_add_add_right] _ = dist (k + l) (k + m) := by rw [h] _ = dist l m := by rw [dist_add_add_left] #align nat.dist_eq_intro Nat.dist_eq_intro theorem dist.triangle_inequality (n m k : β„•) : dist n k ≀ dist n m + dist m k := by have : dist n m + dist m k = n - m + (m - k) + (k - m + (m - n)) := by simp [dist, add_comm, add_left_comm, add_assoc] rw [this, dist] exact add_le_add tsub_le_tsub_add_tsub tsub_le_tsub_add_tsub #align nat.dist.triangle_inequality Nat.dist.triangle_inequality theorem dist_mul_right (n k m : β„•) : dist (n * k) (m * k) = dist n m * k := by rw [dist, dist, right_distrib, tsub_mul n, tsub_mul m] #align nat.dist_mul_right Nat.dist_mul_right
Mathlib/Data/Nat/Dist.lean
103
104
theorem dist_mul_left (k n m : β„•) : dist (k * n) (k * m) = k * dist n m := by
rw [mul_comm k n, mul_comm k m, dist_mul_right, mul_comm]
16
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
6