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