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 | num_lines int64 1 150 | complexity_score float64 2.72 139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000B | diff_level int64 0 2 | file_diff_level float64 0 2 | theorem_same_file int64 1 32 | rank_file int64 0 2.51k |
|---|---|---|---|---|---|---|---|---|---|---|---|
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : β} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {Ξ± : Type*} {Ξ² : Type*}
local notation "π" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : Ξ± β Ξ²) : π Ξ± β π Ξ² := fun x => mk _ (f β x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : Ξ± β Ξ²) (hf : Injective f) : Injective (mapFun f : π Ξ± β π Ξ²) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : Ξ± β Ξ²) (hf : Surjective f) : Surjective (mapFun f : π Ξ± β π Ξ²) := fun x =>
β¨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]β©
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : π R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R β+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_evalβHom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply evalβHom_congr (RingHom.ext_int _ _) _ rfl <;>
ext β¨i, kβ© <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : π R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : π R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
| Mathlib/RingTheory/WittVector/Basic.lean | 114 | 114 | theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by | map_fun_tac
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : β} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {Ξ± : Type*} {Ξ² : Type*}
local notation "π" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : Ξ± β Ξ²) : π Ξ± β π Ξ² := fun x => mk _ (f β x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : Ξ± β Ξ²) (hf : Injective f) : Injective (mapFun f : π Ξ± β π Ξ²) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : Ξ± β Ξ²) (hf : Surjective f) : Surjective (mapFun f : π Ξ± β π Ξ²) := fun x =>
β¨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]β©
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : π R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R β+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_evalβHom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply evalβHom_congr (RingHom.ext_int _ _) _ rfl <;>
ext β¨i, kβ© <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : π R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : π R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac
#align witt_vector.map_fun.mul WittVector.mapFun.mul
| Mathlib/RingTheory/WittVector/Basic.lean | 117 | 117 | theorem neg : mapFun f (-x) = -mapFun f x := by | map_fun_tac
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : β} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {Ξ± : Type*} {Ξ² : Type*}
local notation "π" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : Ξ± β Ξ²) : π Ξ± β π Ξ² := fun x => mk _ (f β x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : Ξ± β Ξ²) (hf : Injective f) : Injective (mapFun f : π Ξ± β π Ξ²) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : Ξ± β Ξ²) (hf : Surjective f) : Surjective (mapFun f : π Ξ± β π Ξ²) := fun x =>
β¨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]β©
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : π R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R β+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_evalβHom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply evalβHom_congr (RingHom.ext_int _ _) _ rfl <;>
ext β¨i, kβ© <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : π R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : π R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac
#align witt_vector.map_fun.mul WittVector.mapFun.mul
theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac
#align witt_vector.map_fun.neg WittVector.mapFun.neg
| Mathlib/RingTheory/WittVector/Basic.lean | 120 | 120 | theorem nsmul (n : β) (x : WittVector p R) : mapFun f (n β’ x) = n β’ mapFun f x := by | map_fun_tac
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : β} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {Ξ± : Type*} {Ξ² : Type*}
local notation "π" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : Ξ± β Ξ²) : π Ξ± β π Ξ² := fun x => mk _ (f β x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : Ξ± β Ξ²) (hf : Injective f) : Injective (mapFun f : π Ξ± β π Ξ²) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : Ξ± β Ξ²) (hf : Surjective f) : Surjective (mapFun f : π Ξ± β π Ξ²) := fun x =>
β¨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]β©
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : π R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R β+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_evalβHom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply evalβHom_congr (RingHom.ext_int _ _) _ rfl <;>
ext β¨i, kβ© <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : π R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : π R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac
#align witt_vector.map_fun.mul WittVector.mapFun.mul
theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac
#align witt_vector.map_fun.neg WittVector.mapFun.neg
theorem nsmul (n : β) (x : WittVector p R) : mapFun f (n β’ x) = n β’ mapFun f x := by map_fun_tac
#align witt_vector.map_fun.nsmul WittVector.mapFun.nsmul
| Mathlib/RingTheory/WittVector/Basic.lean | 123 | 123 | theorem zsmul (z : β€) (x : WittVector p R) : mapFun f (z β’ x) = z β’ mapFun f x := by | map_fun_tac
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : β} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {Ξ± : Type*} {Ξ² : Type*}
local notation "π" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : Ξ± β Ξ²) : π Ξ± β π Ξ² := fun x => mk _ (f β x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace mapFun
-- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
theorem injective (f : Ξ± β Ξ²) (hf : Injective f) : Injective (mapFun f : π Ξ± β π Ξ²) := by
intros _ _ h
ext p
exact hf (congr_arg (fun x => coeff x p) h : _)
#align witt_vector.map_fun.injective WittVector.mapFun.injective
theorem surjective (f : Ξ± β Ξ²) (hf : Surjective f) : Surjective (mapFun f : π Ξ± β π Ξ²) := fun x =>
β¨mk _ fun n => Classical.choose <| hf <| x.coeff n,
by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]β©
#align witt_vector.map_fun.surjective WittVector.mapFun.surjective
-- Porting note: using `(x y : π R)` instead of `(x y : WittVector p R)` produced sorries.
variable (f : R β+* S) (x y : WittVector p R)
-- porting note: a very crude port.
macro "map_fun_tac" : tactic => `(tactic| (
ext n
simp only [mapFun, mk, comp_apply, zero_coeff, map_zero,
-- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4
add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff,
peval, map_aeval, algebraMap_int_eq, coe_evalβHom] <;>
try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one`
apply evalβHom_congr (RingHom.ext_int _ _) _ rfl <;>
ext β¨i, kβ© <;>
fin_cases i <;> rfl))
-- and until `pow`.
-- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
theorem zero : mapFun f (0 : π R) = 0 := by map_fun_tac
#align witt_vector.map_fun.zero WittVector.mapFun.zero
theorem one : mapFun f (1 : π R) = 1 := by map_fun_tac
#align witt_vector.map_fun.one WittVector.mapFun.one
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac
#align witt_vector.map_fun.add WittVector.mapFun.add
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac
#align witt_vector.map_fun.sub WittVector.mapFun.sub
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac
#align witt_vector.map_fun.mul WittVector.mapFun.mul
theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac
#align witt_vector.map_fun.neg WittVector.mapFun.neg
theorem nsmul (n : β) (x : WittVector p R) : mapFun f (n β’ x) = n β’ mapFun f x := by map_fun_tac
#align witt_vector.map_fun.nsmul WittVector.mapFun.nsmul
theorem zsmul (z : β€) (x : WittVector p R) : mapFun f (z β’ x) = z β’ mapFun f x := by map_fun_tac
#align witt_vector.map_fun.zsmul WittVector.mapFun.zsmul
| Mathlib/RingTheory/WittVector/Basic.lean | 126 | 126 | theorem pow (n : β) : mapFun f (x ^ n) = mapFun f x ^ n := by | map_fun_tac
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
import Mathlib.Algebra.MvPolynomial.Counit
import Mathlib.Algebra.MvPolynomial.Invertible
import Mathlib.RingTheory.WittVector.Defs
#align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
noncomputable section
open MvPolynomial Function
variable {p : β} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T]
variable {Ξ± : Type*} {Ξ² : Type*}
local notation "π" => WittVector p
local notation "W_" => wittPolynomial p
-- type as `\bbW`
open scoped Witt
namespace WittVector
def mapFun (f : Ξ± β Ξ²) : π Ξ± β π Ξ² := fun x => mk _ (f β x.coeff)
#align witt_vector.map_fun WittVector.mapFun
namespace WittVector
private def ghostFun : π R β β β R := fun x n => aeval x.coeff (W_ β€ n)
section GhostFun
variable (x y : WittVector p R)
-- The following lemmas are not `@[simp]` because they will be bundled in `ghostMap` later on.
@[local simp]
| Mathlib/RingTheory/WittVector/Basic.lean | 183 | 185 | theorem matrix_vecEmpty_coeff {R} (i j) :
@coeff p R (Matrix.vecEmpty i) j = (Matrix.vecEmpty i : β β R) j := by |
rcases i with β¨_ | _ | _ | _ | i_val, β¨β©β©
| 1 | 2.718282 | 0 | 0.090909 | 11 | 242 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 81 | 81 | theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by | simp [toComplex_def]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 84 | 85 | theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by |
apply Complex.ext <;> simp [toComplex_def]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 89 | 89 | theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by | simp [toComplex_def]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 93 | 93 | theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by | simp [toComplex_def]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 97 | 97 | theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by | simp [toComplex_def]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 101 | 101 | theorem toComplex_im (x y : β€) : ((β¨x, yβ© : β€[i]) : β).im = y := by | simp [toComplex_def]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : β€) : ((β¨x, yβ© : β€[i]) : β).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : β€[i]) : ((x + y : β€[i]) : β) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : β€[i]) : ((x * y : β€[i]) : β) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : β€[i]) : β) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : β€[i]) : β) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : β€[i]) : ((-x : β€[i]) : β) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : β€[i]) : ((x - y : β€[i]) : β) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 135 | 137 | theorem toComplex_star (x : β€[i]) : ((star x : β€[i]) : β) = conj (x : β) := by |
rw [toComplex_defβ, toComplex_defβ]
exact congr_argβ _ rfl (Int.cast_neg _)
| 2 | 7.389056 | 1 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : β€) : ((β¨x, yβ© : β€[i]) : β).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : β€[i]) : ((x + y : β€[i]) : β) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : β€[i]) : ((x * y : β€[i]) : β) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : β€[i]) : β) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : β€[i]) : β) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : β€[i]) : ((-x : β€[i]) : β) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : β€[i]) : ((x - y : β€[i]) : β) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : β€[i]) : ((star x : β€[i]) : β) = conj (x : β) := by
rw [toComplex_defβ, toComplex_defβ]
exact congr_argβ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 141 | 142 | theorem toComplex_inj {x y : β€[i]} : (x : β) = y β x = y := by |
cases x; cases y; simp [toComplex_defβ]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : β€) : ((β¨x, yβ© : β€[i]) : β).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : β€[i]) : ((x + y : β€[i]) : β) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : β€[i]) : ((x * y : β€[i]) : β) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : β€[i]) : β) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : β€[i]) : β) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : β€[i]) : ((-x : β€[i]) : β) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : β€[i]) : ((x - y : β€[i]) : β) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : β€[i]) : ((star x : β€[i]) : β) = conj (x : β) := by
rw [toComplex_defβ, toComplex_defβ]
exact congr_argβ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
theorem toComplex_inj {x y : β€[i]} : (x : β) = y β x = y := by
cases x; cases y; simp [toComplex_defβ]
#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
lemma toComplex_injective : Function.Injective GaussianInt.toComplex :=
fun β¦_ _β¦ β¦ toComplex_inj.mp
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 149 | 150 | theorem toComplex_eq_zero {x : β€[i]} : (x : β) = 0 β x = 0 := by |
rw [β toComplex_zero, toComplex_inj]
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : β€) : ((β¨x, yβ© : β€[i]) : β).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : β€[i]) : ((x + y : β€[i]) : β) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : β€[i]) : ((x * y : β€[i]) : β) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : β€[i]) : β) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : β€[i]) : β) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : β€[i]) : ((-x : β€[i]) : β) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : β€[i]) : ((x - y : β€[i]) : β) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : β€[i]) : ((star x : β€[i]) : β) = conj (x : β) := by
rw [toComplex_defβ, toComplex_defβ]
exact congr_argβ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
theorem toComplex_inj {x y : β€[i]} : (x : β) = y β x = y := by
cases x; cases y; simp [toComplex_defβ]
#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
lemma toComplex_injective : Function.Injective GaussianInt.toComplex :=
fun β¦_ _β¦ β¦ toComplex_inj.mp
@[simp]
theorem toComplex_eq_zero {x : β€[i]} : (x : β) = 0 β x = 0 := by
rw [β toComplex_zero, toComplex_inj]
#align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 154 | 155 | theorem intCast_real_norm (x : β€[i]) : (x.norm : β) = Complex.normSq (x : β) := by |
rw [Zsqrtd.norm, normSq]; simp
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : β€) : ((β¨x, yβ© : β€[i]) : β).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : β€[i]) : ((x + y : β€[i]) : β) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : β€[i]) : ((x * y : β€[i]) : β) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : β€[i]) : β) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : β€[i]) : β) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : β€[i]) : ((-x : β€[i]) : β) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : β€[i]) : ((x - y : β€[i]) : β) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : β€[i]) : ((star x : β€[i]) : β) = conj (x : β) := by
rw [toComplex_defβ, toComplex_defβ]
exact congr_argβ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
theorem toComplex_inj {x y : β€[i]} : (x : β) = y β x = y := by
cases x; cases y; simp [toComplex_defβ]
#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
lemma toComplex_injective : Function.Injective GaussianInt.toComplex :=
fun β¦_ _β¦ β¦ toComplex_inj.mp
@[simp]
theorem toComplex_eq_zero {x : β€[i]} : (x : β) = 0 β x = 0 := by
rw [β toComplex_zero, toComplex_inj]
#align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
@[simp]
theorem intCast_real_norm (x : β€[i]) : (x.norm : β) = Complex.normSq (x : β) := by
rw [Zsqrtd.norm, normSq]; simp
#align gaussian_int.nat_cast_real_norm GaussianInt.intCast_real_norm
@[deprecated (since := "2024-04-17")]
alias int_cast_real_norm := intCast_real_norm
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 162 | 163 | theorem intCast_complex_norm (x : β€[i]) : (x.norm : β) = Complex.normSq (x : β) := by |
cases x; rw [Zsqrtd.norm, normSq]; simp
| 1 | 2.718282 | 0 | 0.090909 | 11 | 243 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
| Mathlib/Analysis/Convex/Join.lean | 36 | 37 | theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by |
simp [convexJoin]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 57 | 57 | theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by | simp [convexJoin]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 61 | 61 | theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by | simp [convexJoin]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 65 | 66 | theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by | simp [convexJoin]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 70 | 71 | theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin π s {y} = β x β s, segment π x y := by | simp [convexJoin]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin π s {y} = β x β s, segment π x y := by simp [convexJoin]
#align convex_join_singleton_right convexJoin_singleton_right
-- Porting note (#10618): simp can prove it
| Mathlib/Analysis/Convex/Join.lean | 75 | 75 | theorem convexJoin_singletons (x : E) : convexJoin π {x} {y} = segment π x y := by | simp
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin π s {y} = β x β s, segment π x y := by simp [convexJoin]
#align convex_join_singleton_right convexJoin_singleton_right
-- Porting note (#10618): simp can prove it
theorem convexJoin_singletons (x : E) : convexJoin π {x} {y} = segment π x y := by simp
#align convex_join_singletons convexJoin_singletons
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 79 | 81 | theorem convexJoin_union_left (sβ sβ t : Set E) :
convexJoin π (sβ βͺ sβ) t = convexJoin π sβ t βͺ convexJoin π sβ t := by |
simp_rw [convexJoin, mem_union, iUnion_or, iUnion_union_distrib]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin π s {y} = β x β s, segment π x y := by simp [convexJoin]
#align convex_join_singleton_right convexJoin_singleton_right
-- Porting note (#10618): simp can prove it
theorem convexJoin_singletons (x : E) : convexJoin π {x} {y} = segment π x y := by simp
#align convex_join_singletons convexJoin_singletons
@[simp]
theorem convexJoin_union_left (sβ sβ t : Set E) :
convexJoin π (sβ βͺ sβ) t = convexJoin π sβ t βͺ convexJoin π sβ t := by
simp_rw [convexJoin, mem_union, iUnion_or, iUnion_union_distrib]
#align convex_join_union_left convexJoin_union_left
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 85 | 87 | theorem convexJoin_union_right (s tβ tβ : Set E) :
convexJoin π s (tβ βͺ tβ) = convexJoin π s tβ βͺ convexJoin π s tβ := by |
simp_rw [convexJoin_comm s, convexJoin_union_left]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin π s {y} = β x β s, segment π x y := by simp [convexJoin]
#align convex_join_singleton_right convexJoin_singleton_right
-- Porting note (#10618): simp can prove it
theorem convexJoin_singletons (x : E) : convexJoin π {x} {y} = segment π x y := by simp
#align convex_join_singletons convexJoin_singletons
@[simp]
theorem convexJoin_union_left (sβ sβ t : Set E) :
convexJoin π (sβ βͺ sβ) t = convexJoin π sβ t βͺ convexJoin π sβ t := by
simp_rw [convexJoin, mem_union, iUnion_or, iUnion_union_distrib]
#align convex_join_union_left convexJoin_union_left
@[simp]
theorem convexJoin_union_right (s tβ tβ : Set E) :
convexJoin π s (tβ βͺ tβ) = convexJoin π s tβ βͺ convexJoin π s tβ := by
simp_rw [convexJoin_comm s, convexJoin_union_left]
#align convex_join_union_right convexJoin_union_right
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 91 | 94 | theorem convexJoin_iUnion_left (s : ΞΉ β Set E) (t : Set E) :
convexJoin π (β i, s i) t = β i, convexJoin π (s i) t := by |
simp_rw [convexJoin, mem_iUnion, iUnion_exists]
exact iUnion_comm _
| 2 | 7.389056 | 1 | 0.1 | 10 | 244 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin π s {y} = β x β s, segment π x y := by simp [convexJoin]
#align convex_join_singleton_right convexJoin_singleton_right
-- Porting note (#10618): simp can prove it
theorem convexJoin_singletons (x : E) : convexJoin π {x} {y} = segment π x y := by simp
#align convex_join_singletons convexJoin_singletons
@[simp]
theorem convexJoin_union_left (sβ sβ t : Set E) :
convexJoin π (sβ βͺ sβ) t = convexJoin π sβ t βͺ convexJoin π sβ t := by
simp_rw [convexJoin, mem_union, iUnion_or, iUnion_union_distrib]
#align convex_join_union_left convexJoin_union_left
@[simp]
theorem convexJoin_union_right (s tβ tβ : Set E) :
convexJoin π s (tβ βͺ tβ) = convexJoin π s tβ βͺ convexJoin π s tβ := by
simp_rw [convexJoin_comm s, convexJoin_union_left]
#align convex_join_union_right convexJoin_union_right
@[simp]
theorem convexJoin_iUnion_left (s : ΞΉ β Set E) (t : Set E) :
convexJoin π (β i, s i) t = β i, convexJoin π (s i) t := by
simp_rw [convexJoin, mem_iUnion, iUnion_exists]
exact iUnion_comm _
#align convex_join_Union_left convexJoin_iUnion_left
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 98 | 100 | theorem convexJoin_iUnion_right (s : Set E) (t : ΞΉ β Set E) :
convexJoin π s (β i, t i) = β i, convexJoin π s (t i) := by |
simp_rw [convexJoin_comm s, convexJoin_iUnion_left]
| 1 | 2.718282 | 0 | 0.1 | 10 | 244 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 117 | 118 | theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by |
rw [β mul_assoc, invOf_mul_self, one_mul]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 120 | 121 | theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by |
rw [β mul_assoc, invOf_mul_self, one_mul]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 125 | 126 | theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by |
rw [β mul_assoc, mul_invOf_self, one_mul]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 128 | 129 | theorem mul_invOf_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : a * (β
a * b) = b := by |
rw [β mul_assoc, mul_invOf_self, one_mul]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 133 | 134 | theorem mul_invOf_mul_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * β
b * b = a := by |
simp [mul_assoc]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * β
b * b = a := by
simp [mul_assoc]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 136 | 137 | theorem mul_invOf_mul_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * β
b * b = a := by |
simp [mul_assoc]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * β
b * b = a := by
simp [mul_assoc]
theorem mul_invOf_mul_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * β
b * b = a := by
simp [mul_assoc]
#align mul_inv_of_mul_self_cancel mul_invOf_mul_self_cancel
@[simp]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 141 | 142 | theorem mul_mul_invOf_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * b * β
b = a := by |
simp [mul_assoc]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * β
b * b = a := by
simp [mul_assoc]
theorem mul_invOf_mul_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * β
b * b = a := by
simp [mul_assoc]
#align mul_inv_of_mul_self_cancel mul_invOf_mul_self_cancel
@[simp]
theorem mul_mul_invOf_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * b * β
b = a := by
simp [mul_assoc]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 144 | 145 | theorem mul_mul_invOf_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * b * β
b = a := by |
simp [mul_assoc]
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * β
b * b = a := by
simp [mul_assoc]
theorem mul_invOf_mul_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * β
b * b = a := by
simp [mul_assoc]
#align mul_inv_of_mul_self_cancel mul_invOf_mul_self_cancel
@[simp]
theorem mul_mul_invOf_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * b * β
b = a := by
simp [mul_assoc]
theorem mul_mul_invOf_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * b * β
b = a := by
simp [mul_assoc]
#align mul_mul_inv_of_self_cancel mul_mul_invOf_self_cancel
theorem invOf_eq_right_inv [Monoid Ξ±] {a b : Ξ±} [Invertible a] (hac : a * b = 1) : β
a = b :=
left_inv_eq_right_inv (invOf_mul_self _) hac
#align inv_of_eq_right_inv invOf_eq_right_inv
theorem invOf_eq_left_inv [Monoid Ξ±] {a b : Ξ±} [Invertible a] (hac : b * a = 1) : β
a = b :=
(left_inv_eq_right_inv hac (mul_invOf_self _)).symm
#align inv_of_eq_left_inv invOf_eq_left_inv
| Mathlib/Algebra/Group/Invertible/Defs.lean | 156 | 159 | theorem invertible_unique {Ξ± : Type u} [Monoid Ξ±] (a b : Ξ±) [Invertible a] [Invertible b]
(h : a = b) : β
a = β
b := by |
apply invOf_eq_right_inv
rw [h, mul_invOf_self]
| 2 | 7.389056 | 1 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {Ξ± : Type u}
class Invertible [Mul Ξ±] [One Ξ±] (a : Ξ±) : Type u where
invOf : Ξ±
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"β
" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : β
a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : β
a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul Ξ±] [One Ξ±] (a : Ξ±) {_ : Invertible a} : a * β
a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul Ξ±] [One Ξ±] (a : Ξ±) [Invertible a] : a * β
a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : β
a * (a * b) = b := by
rw [β mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible a} : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid Ξ±] (a b : Ξ±) [Invertible a] : a * (β
a * b) = b := by
rw [β mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * β
b * b = a := by
simp [mul_assoc]
theorem mul_invOf_mul_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * β
b * b = a := by
simp [mul_assoc]
#align mul_inv_of_mul_self_cancel mul_invOf_mul_self_cancel
@[simp]
theorem mul_mul_invOf_self_cancel' [Monoid Ξ±] (a b : Ξ±) {_ : Invertible b} : a * b * β
b = a := by
simp [mul_assoc]
theorem mul_mul_invOf_self_cancel [Monoid Ξ±] (a b : Ξ±) [Invertible b] : a * b * β
b = a := by
simp [mul_assoc]
#align mul_mul_inv_of_self_cancel mul_mul_invOf_self_cancel
theorem invOf_eq_right_inv [Monoid Ξ±] {a b : Ξ±} [Invertible a] (hac : a * b = 1) : β
a = b :=
left_inv_eq_right_inv (invOf_mul_self _) hac
#align inv_of_eq_right_inv invOf_eq_right_inv
theorem invOf_eq_left_inv [Monoid Ξ±] {a b : Ξ±} [Invertible a] (hac : b * a = 1) : β
a = b :=
(left_inv_eq_right_inv hac (mul_invOf_self _)).symm
#align inv_of_eq_left_inv invOf_eq_left_inv
theorem invertible_unique {Ξ± : Type u} [Monoid Ξ±] (a b : Ξ±) [Invertible a] [Invertible b]
(h : a = b) : β
a = β
b := by
apply invOf_eq_right_inv
rw [h, mul_invOf_self]
#align invertible_unique invertible_unique
instance Invertible.subsingleton [Monoid Ξ±] (a : Ξ±) : Subsingleton (Invertible a) :=
β¨fun β¨b, hba, habβ© β¨c, _, hacβ© => by
congr
exact left_inv_eq_right_inv hba hacβ©
#align invertible.subsingleton Invertible.subsingleton
@[congr]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 170 | 171 | theorem Invertible.congr [Monoid Ξ±] (a b : Ξ±) [Invertible a] [Invertible b] (h : a = b) :
β
a = β
b := by | subst h; congr; apply Subsingleton.allEq
| 1 | 2.718282 | 0 | 0.1 | 10 | 245 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
| Mathlib/Algebra/CubicDiscriminant.lean | 67 | 71 | theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by |
simp only [toPoly, C_neg, C_add, C_mul]
ring1
| 2 | 7.389056 | 1 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
| Mathlib/Algebra/CubicDiscriminant.lean | 75 | 78 | theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by |
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
| Mathlib/Algebra/CubicDiscriminant.lean | 121 | 121 | theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by | rw [β coeff_eq_a, h, coeff_eq_a]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [β coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
| Mathlib/Algebra/CubicDiscriminant.lean | 124 | 124 | theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by | rw [β coeff_eq_b, h, coeff_eq_b]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [β coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [β coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
| Mathlib/Algebra/CubicDiscriminant.lean | 127 | 127 | theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by | rw [β coeff_eq_c, h, coeff_eq_c]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [β coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [β coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by rw [β coeff_eq_c, h, coeff_eq_c]
#align cubic.c_of_eq Cubic.c_of_eq
| Mathlib/Algebra/CubicDiscriminant.lean | 130 | 130 | theorem d_of_eq (h : P.toPoly = Q.toPoly) : P.d = Q.d := by | rw [β coeff_eq_d, h, coeff_eq_d]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [β coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [β coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by rw [β coeff_eq_c, h, coeff_eq_c]
#align cubic.c_of_eq Cubic.c_of_eq
theorem d_of_eq (h : P.toPoly = Q.toPoly) : P.d = Q.d := by rw [β coeff_eq_d, h, coeff_eq_d]
#align cubic.d_of_eq Cubic.d_of_eq
theorem toPoly_injective (P Q : Cubic R) : P.toPoly = Q.toPoly β P = Q :=
β¨fun h β¦ Cubic.ext P Q (a_of_eq h) (b_of_eq h) (c_of_eq h) (d_of_eq h), congr_arg toPolyβ©
#align cubic.to_poly_injective Cubic.toPoly_injective
| Mathlib/Algebra/CubicDiscriminant.lean | 137 | 138 | theorem of_a_eq_zero (ha : P.a = 0) : P.toPoly = C P.b * X ^ 2 + C P.c * X + C P.d := by |
rw [toPoly, ha, C_0, zero_mul, zero_add]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [β coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [β coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by rw [β coeff_eq_c, h, coeff_eq_c]
#align cubic.c_of_eq Cubic.c_of_eq
theorem d_of_eq (h : P.toPoly = Q.toPoly) : P.d = Q.d := by rw [β coeff_eq_d, h, coeff_eq_d]
#align cubic.d_of_eq Cubic.d_of_eq
theorem toPoly_injective (P Q : Cubic R) : P.toPoly = Q.toPoly β P = Q :=
β¨fun h β¦ Cubic.ext P Q (a_of_eq h) (b_of_eq h) (c_of_eq h) (d_of_eq h), congr_arg toPolyβ©
#align cubic.to_poly_injective Cubic.toPoly_injective
theorem of_a_eq_zero (ha : P.a = 0) : P.toPoly = C P.b * X ^ 2 + C P.c * X + C P.d := by
rw [toPoly, ha, C_0, zero_mul, zero_add]
#align cubic.of_a_eq_zero Cubic.of_a_eq_zero
theorem of_a_eq_zero' : toPoly β¨0, b, c, dβ© = C b * X ^ 2 + C c * X + C d :=
of_a_eq_zero rfl
#align cubic.of_a_eq_zero' Cubic.of_a_eq_zero'
| Mathlib/Algebra/CubicDiscriminant.lean | 145 | 146 | theorem of_b_eq_zero (ha : P.a = 0) (hb : P.b = 0) : P.toPoly = C P.c * X + C P.d := by |
rw [of_a_eq_zero ha, hb, C_0, zero_mul, zero_add]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [β coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [β coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by rw [β coeff_eq_c, h, coeff_eq_c]
#align cubic.c_of_eq Cubic.c_of_eq
theorem d_of_eq (h : P.toPoly = Q.toPoly) : P.d = Q.d := by rw [β coeff_eq_d, h, coeff_eq_d]
#align cubic.d_of_eq Cubic.d_of_eq
theorem toPoly_injective (P Q : Cubic R) : P.toPoly = Q.toPoly β P = Q :=
β¨fun h β¦ Cubic.ext P Q (a_of_eq h) (b_of_eq h) (c_of_eq h) (d_of_eq h), congr_arg toPolyβ©
#align cubic.to_poly_injective Cubic.toPoly_injective
theorem of_a_eq_zero (ha : P.a = 0) : P.toPoly = C P.b * X ^ 2 + C P.c * X + C P.d := by
rw [toPoly, ha, C_0, zero_mul, zero_add]
#align cubic.of_a_eq_zero Cubic.of_a_eq_zero
theorem of_a_eq_zero' : toPoly β¨0, b, c, dβ© = C b * X ^ 2 + C c * X + C d :=
of_a_eq_zero rfl
#align cubic.of_a_eq_zero' Cubic.of_a_eq_zero'
theorem of_b_eq_zero (ha : P.a = 0) (hb : P.b = 0) : P.toPoly = C P.c * X + C P.d := by
rw [of_a_eq_zero ha, hb, C_0, zero_mul, zero_add]
#align cubic.of_b_eq_zero Cubic.of_b_eq_zero
theorem of_b_eq_zero' : toPoly β¨0, 0, c, dβ© = C c * X + C d :=
of_b_eq_zero rfl rfl
#align cubic.of_b_eq_zero' Cubic.of_b_eq_zero'
| Mathlib/Algebra/CubicDiscriminant.lean | 153 | 154 | theorem of_c_eq_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) : P.toPoly = C P.d := by |
rw [of_b_eq_zero ha hb, hc, C_0, zero_mul, zero_add]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Map
variable [Semiring S] {Ο : R β+* S}
def map (Ο : R β+* S) (P : Cubic R) : Cubic S :=
β¨Ο P.a, Ο P.b, Ο P.c, Ο P.dβ©
#align cubic.map Cubic.map
| Mathlib/Algebra/CubicDiscriminant.lean | 458 | 459 | theorem map_toPoly : (map Ο P).toPoly = Polynomial.map Ο P.toPoly := by |
simp only [map, toPoly, map_C, map_X, Polynomial.map_add, Polynomial.map_mul, Polynomial.map_pow]
| 1 | 2.718282 | 0 | 0.1 | 10 | 246 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
| Mathlib/Data/Fintype/Basic.lean | 84 | 84 | theorem eq_univ_iff_forall : s = univ β β x, x β s := by | simp [ext_iff]
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
| Mathlib/Data/Fintype/Basic.lean | 92 | 92 | theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by | ext; simp
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
| Mathlib/Data/Fintype/Basic.lean | 96 | 96 | theorem coe_eq_univ : (s : Set Ξ±) = Set.univ β s = univ := by | rw [β coe_univ, coe_inj]
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
theorem coe_eq_univ : (s : Set Ξ±) = Set.univ β s = univ := by rw [β coe_univ, coe_inj]
#align finset.coe_eq_univ Finset.coe_eq_univ
| Mathlib/Data/Fintype/Basic.lean | 99 | 101 | theorem Nonempty.eq_univ [Subsingleton Ξ±] : s.Nonempty β s = univ := by |
rintro β¨x, hxβ©
exact eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
| 2 | 7.389056 | 1 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
theorem coe_eq_univ : (s : Set Ξ±) = Set.univ β s = univ := by rw [β coe_univ, coe_inj]
#align finset.coe_eq_univ Finset.coe_eq_univ
theorem Nonempty.eq_univ [Subsingleton Ξ±] : s.Nonempty β s = univ := by
rintro β¨x, hxβ©
exact eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
#align finset.nonempty.eq_univ Finset.Nonempty.eq_univ
| Mathlib/Data/Fintype/Basic.lean | 104 | 105 | theorem univ_nonempty_iff : (univ : Finset Ξ±).Nonempty β Nonempty Ξ± := by |
rw [β coe_nonempty, coe_univ, Set.nonempty_iff_univ_nonempty]
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
theorem coe_eq_univ : (s : Set Ξ±) = Set.univ β s = univ := by rw [β coe_univ, coe_inj]
#align finset.coe_eq_univ Finset.coe_eq_univ
theorem Nonempty.eq_univ [Subsingleton Ξ±] : s.Nonempty β s = univ := by
rintro β¨x, hxβ©
exact eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
#align finset.nonempty.eq_univ Finset.Nonempty.eq_univ
theorem univ_nonempty_iff : (univ : Finset Ξ±).Nonempty β Nonempty Ξ± := by
rw [β coe_nonempty, coe_univ, Set.nonempty_iff_univ_nonempty]
#align finset.univ_nonempty_iff Finset.univ_nonempty_iff
@[aesop unsafe apply (rule_sets := [finsetNonempty])]
theorem univ_nonempty [Nonempty Ξ±] : (univ : Finset Ξ±).Nonempty :=
univ_nonempty_iff.2 βΉ_βΊ
#align finset.univ_nonempty Finset.univ_nonempty
| Mathlib/Data/Fintype/Basic.lean | 113 | 114 | theorem univ_eq_empty_iff : (univ : Finset Ξ±) = β
β IsEmpty Ξ± := by |
rw [β not_nonempty_iff, β univ_nonempty_iff, not_nonempty_iff_eq_empty]
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
theorem coe_eq_univ : (s : Set Ξ±) = Set.univ β s = univ := by rw [β coe_univ, coe_inj]
#align finset.coe_eq_univ Finset.coe_eq_univ
theorem Nonempty.eq_univ [Subsingleton Ξ±] : s.Nonempty β s = univ := by
rintro β¨x, hxβ©
exact eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
#align finset.nonempty.eq_univ Finset.Nonempty.eq_univ
theorem univ_nonempty_iff : (univ : Finset Ξ±).Nonempty β Nonempty Ξ± := by
rw [β coe_nonempty, coe_univ, Set.nonempty_iff_univ_nonempty]
#align finset.univ_nonempty_iff Finset.univ_nonempty_iff
@[aesop unsafe apply (rule_sets := [finsetNonempty])]
theorem univ_nonempty [Nonempty Ξ±] : (univ : Finset Ξ±).Nonempty :=
univ_nonempty_iff.2 βΉ_βΊ
#align finset.univ_nonempty Finset.univ_nonempty
theorem univ_eq_empty_iff : (univ : Finset Ξ±) = β
β IsEmpty Ξ± := by
rw [β not_nonempty_iff, β univ_nonempty_iff, not_nonempty_iff_eq_empty]
#align finset.univ_eq_empty_iff Finset.univ_eq_empty_iff
@[simp]
theorem univ_eq_empty [IsEmpty Ξ±] : (univ : Finset Ξ±) = β
:=
univ_eq_empty_iff.2 βΉ_βΊ
#align finset.univ_eq_empty Finset.univ_eq_empty
@[simp]
theorem univ_unique [Unique Ξ±] : (univ : Finset Ξ±) = {default} :=
Finset.ext fun x => iff_of_true (mem_univ _) <| mem_singleton.2 <| Subsingleton.elim x default
#align finset.univ_unique Finset.univ_unique
@[simp]
theorem subset_univ (s : Finset Ξ±) : s β univ := fun a _ => mem_univ a
#align finset.subset_univ Finset.subset_univ
instance boundedOrder : BoundedOrder (Finset Ξ±) :=
{ inferInstanceAs (OrderBot (Finset Ξ±)) with
top := univ
le_top := subset_univ }
#align finset.bounded_order Finset.boundedOrder
@[simp]
theorem top_eq_univ : (β€ : Finset Ξ±) = univ :=
rfl
#align finset.top_eq_univ Finset.top_eq_univ
theorem ssubset_univ_iff {s : Finset Ξ±} : s β univ β s β univ :=
@lt_top_iff_ne_top _ _ _ s
#align finset.ssubset_univ_iff Finset.ssubset_univ_iff
@[simp]
theorem univ_subset_iff {s : Finset Ξ±} : univ β s β s = univ :=
@top_le_iff _ _ _ s
| Mathlib/Data/Fintype/Basic.lean | 150 | 151 | theorem codisjoint_left : Codisjoint s t β β β¦aβ¦, a β s β a β t := by |
classical simp [codisjoint_iff, eq_univ_iff_forall, or_iff_not_imp_left]
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
theorem coe_eq_univ : (s : Set Ξ±) = Set.univ β s = univ := by rw [β coe_univ, coe_inj]
#align finset.coe_eq_univ Finset.coe_eq_univ
theorem Nonempty.eq_univ [Subsingleton Ξ±] : s.Nonempty β s = univ := by
rintro β¨x, hxβ©
exact eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
#align finset.nonempty.eq_univ Finset.Nonempty.eq_univ
theorem univ_nonempty_iff : (univ : Finset Ξ±).Nonempty β Nonempty Ξ± := by
rw [β coe_nonempty, coe_univ, Set.nonempty_iff_univ_nonempty]
#align finset.univ_nonempty_iff Finset.univ_nonempty_iff
@[aesop unsafe apply (rule_sets := [finsetNonempty])]
theorem univ_nonempty [Nonempty Ξ±] : (univ : Finset Ξ±).Nonempty :=
univ_nonempty_iff.2 βΉ_βΊ
#align finset.univ_nonempty Finset.univ_nonempty
theorem univ_eq_empty_iff : (univ : Finset Ξ±) = β
β IsEmpty Ξ± := by
rw [β not_nonempty_iff, β univ_nonempty_iff, not_nonempty_iff_eq_empty]
#align finset.univ_eq_empty_iff Finset.univ_eq_empty_iff
@[simp]
theorem univ_eq_empty [IsEmpty Ξ±] : (univ : Finset Ξ±) = β
:=
univ_eq_empty_iff.2 βΉ_βΊ
#align finset.univ_eq_empty Finset.univ_eq_empty
@[simp]
theorem univ_unique [Unique Ξ±] : (univ : Finset Ξ±) = {default} :=
Finset.ext fun x => iff_of_true (mem_univ _) <| mem_singleton.2 <| Subsingleton.elim x default
#align finset.univ_unique Finset.univ_unique
@[simp]
theorem subset_univ (s : Finset Ξ±) : s β univ := fun a _ => mem_univ a
#align finset.subset_univ Finset.subset_univ
instance boundedOrder : BoundedOrder (Finset Ξ±) :=
{ inferInstanceAs (OrderBot (Finset Ξ±)) with
top := univ
le_top := subset_univ }
#align finset.bounded_order Finset.boundedOrder
@[simp]
theorem top_eq_univ : (β€ : Finset Ξ±) = univ :=
rfl
#align finset.top_eq_univ Finset.top_eq_univ
theorem ssubset_univ_iff {s : Finset Ξ±} : s β univ β s β univ :=
@lt_top_iff_ne_top _ _ _ s
#align finset.ssubset_univ_iff Finset.ssubset_univ_iff
@[simp]
theorem univ_subset_iff {s : Finset Ξ±} : univ β s β s = univ :=
@top_le_iff _ _ _ s
theorem codisjoint_left : Codisjoint s t β β β¦aβ¦, a β s β a β t := by
classical simp [codisjoint_iff, eq_univ_iff_forall, or_iff_not_imp_left]
#align finset.codisjoint_left Finset.codisjoint_left
theorem codisjoint_right : Codisjoint s t β β β¦aβ¦, a β t β a β s :=
Codisjoint_comm.trans codisjoint_left
#align finset.codisjoint_right Finset.codisjoint_right
section BooleanAlgebra
variable [DecidableEq Ξ±] {a : Ξ±}
instance booleanAlgebra : BooleanAlgebra (Finset Ξ±) :=
GeneralizedBooleanAlgebra.toBooleanAlgebra
#align finset.boolean_algebra Finset.booleanAlgebra
theorem sdiff_eq_inter_compl (s t : Finset Ξ±) : s \ t = s β© tαΆ :=
sdiff_eq
#align finset.sdiff_eq_inter_compl Finset.sdiff_eq_inter_compl
theorem compl_eq_univ_sdiff (s : Finset Ξ±) : sαΆ = univ \ s :=
rfl
#align finset.compl_eq_univ_sdiff Finset.compl_eq_univ_sdiff
@[simp]
| Mathlib/Data/Fintype/Basic.lean | 175 | 175 | theorem mem_compl : a β sαΆ β a β s := by | simp [compl_eq_univ_sdiff]
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by ext; simp
#align finset.coe_univ Finset.coe_univ
@[simp, norm_cast]
theorem coe_eq_univ : (s : Set Ξ±) = Set.univ β s = univ := by rw [β coe_univ, coe_inj]
#align finset.coe_eq_univ Finset.coe_eq_univ
theorem Nonempty.eq_univ [Subsingleton Ξ±] : s.Nonempty β s = univ := by
rintro β¨x, hxβ©
exact eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
#align finset.nonempty.eq_univ Finset.Nonempty.eq_univ
theorem univ_nonempty_iff : (univ : Finset Ξ±).Nonempty β Nonempty Ξ± := by
rw [β coe_nonempty, coe_univ, Set.nonempty_iff_univ_nonempty]
#align finset.univ_nonempty_iff Finset.univ_nonempty_iff
@[aesop unsafe apply (rule_sets := [finsetNonempty])]
theorem univ_nonempty [Nonempty Ξ±] : (univ : Finset Ξ±).Nonempty :=
univ_nonempty_iff.2 βΉ_βΊ
#align finset.univ_nonempty Finset.univ_nonempty
theorem univ_eq_empty_iff : (univ : Finset Ξ±) = β
β IsEmpty Ξ± := by
rw [β not_nonempty_iff, β univ_nonempty_iff, not_nonempty_iff_eq_empty]
#align finset.univ_eq_empty_iff Finset.univ_eq_empty_iff
@[simp]
theorem univ_eq_empty [IsEmpty Ξ±] : (univ : Finset Ξ±) = β
:=
univ_eq_empty_iff.2 βΉ_βΊ
#align finset.univ_eq_empty Finset.univ_eq_empty
@[simp]
theorem univ_unique [Unique Ξ±] : (univ : Finset Ξ±) = {default} :=
Finset.ext fun x => iff_of_true (mem_univ _) <| mem_singleton.2 <| Subsingleton.elim x default
#align finset.univ_unique Finset.univ_unique
@[simp]
theorem subset_univ (s : Finset Ξ±) : s β univ := fun a _ => mem_univ a
#align finset.subset_univ Finset.subset_univ
instance boundedOrder : BoundedOrder (Finset Ξ±) :=
{ inferInstanceAs (OrderBot (Finset Ξ±)) with
top := univ
le_top := subset_univ }
#align finset.bounded_order Finset.boundedOrder
@[simp]
theorem top_eq_univ : (β€ : Finset Ξ±) = univ :=
rfl
#align finset.top_eq_univ Finset.top_eq_univ
theorem ssubset_univ_iff {s : Finset Ξ±} : s β univ β s β univ :=
@lt_top_iff_ne_top _ _ _ s
#align finset.ssubset_univ_iff Finset.ssubset_univ_iff
@[simp]
theorem univ_subset_iff {s : Finset Ξ±} : univ β s β s = univ :=
@top_le_iff _ _ _ s
theorem codisjoint_left : Codisjoint s t β β β¦aβ¦, a β s β a β t := by
classical simp [codisjoint_iff, eq_univ_iff_forall, or_iff_not_imp_left]
#align finset.codisjoint_left Finset.codisjoint_left
theorem codisjoint_right : Codisjoint s t β β β¦aβ¦, a β t β a β s :=
Codisjoint_comm.trans codisjoint_left
#align finset.codisjoint_right Finset.codisjoint_right
section BooleanAlgebra
variable [DecidableEq Ξ±] {a : Ξ±}
instance booleanAlgebra : BooleanAlgebra (Finset Ξ±) :=
GeneralizedBooleanAlgebra.toBooleanAlgebra
#align finset.boolean_algebra Finset.booleanAlgebra
theorem sdiff_eq_inter_compl (s t : Finset Ξ±) : s \ t = s β© tαΆ :=
sdiff_eq
#align finset.sdiff_eq_inter_compl Finset.sdiff_eq_inter_compl
theorem compl_eq_univ_sdiff (s : Finset Ξ±) : sαΆ = univ \ s :=
rfl
#align finset.compl_eq_univ_sdiff Finset.compl_eq_univ_sdiff
@[simp]
theorem mem_compl : a β sαΆ β a β s := by simp [compl_eq_univ_sdiff]
#align finset.mem_compl Finset.mem_compl
| Mathlib/Data/Fintype/Basic.lean | 178 | 178 | theorem not_mem_compl : a β sαΆ β a β s := by | rw [mem_compl, not_not]
| 1 | 2.718282 | 0 | 0.111111 | 9 | 248 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
| Mathlib/Tactic/Abel.lean | 128 | 130 | theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by |
simp [h.symm, term, add_comm, add_assoc]
| 1 | 2.718282 | 0 | 0.125 | 8 | 249 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
| Mathlib/Tactic/Abel.lean | 132 | 134 | theorem const_add_termg {Ξ±} [AddCommGroup Ξ±] (k n x a a') (h : k + a = a') :
k + @termg Ξ± _ n x a = termg n x a' := by |
simp [h.symm, termg, add_comm, add_assoc]
| 1 | 2.718282 | 0 | 0.125 | 8 | 249 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
theorem const_add_termg {Ξ±} [AddCommGroup Ξ±] (k n x a a') (h : k + a = a') :
k + @termg Ξ± _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
| Mathlib/Tactic/Abel.lean | 136 | 138 | theorem term_add_const {Ξ±} [AddCommMonoid Ξ±] (n x a k a') (h : a + k = a') :
@term Ξ± _ n x a + k = term n x a' := by |
simp [h.symm, term, add_assoc]
| 1 | 2.718282 | 0 | 0.125 | 8 | 249 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
theorem const_add_termg {Ξ±} [AddCommGroup Ξ±] (k n x a a') (h : k + a = a') :
k + @termg Ξ± _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
theorem term_add_const {Ξ±} [AddCommMonoid Ξ±] (n x a k a') (h : a + k = a') :
@term Ξ± _ n x a + k = term n x a' := by
simp [h.symm, term, add_assoc]
| Mathlib/Tactic/Abel.lean | 140 | 142 | theorem term_add_constg {Ξ±} [AddCommGroup Ξ±] (n x a k a') (h : a + k = a') :
@termg Ξ± _ n x a + k = termg n x a' := by |
simp [h.symm, termg, add_assoc]
| 1 | 2.718282 | 0 | 0.125 | 8 | 249 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
theorem const_add_termg {Ξ±} [AddCommGroup Ξ±] (k n x a a') (h : k + a = a') :
k + @termg Ξ± _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
theorem term_add_const {Ξ±} [AddCommMonoid Ξ±] (n x a k a') (h : a + k = a') :
@term Ξ± _ n x a + k = term n x a' := by
simp [h.symm, term, add_assoc]
theorem term_add_constg {Ξ±} [AddCommGroup Ξ±] (n x a k a') (h : a + k = a') :
@termg Ξ± _ n x a + k = termg n x a' := by
simp [h.symm, termg, add_assoc]
| Mathlib/Tactic/Abel.lean | 144 | 146 | theorem term_add_term {Ξ±} [AddCommMonoid Ξ±] (nβ x aβ nβ aβ n' a') (hβ : nβ + nβ = n')
(hβ : aβ + aβ = a') : @term Ξ± _ nβ x aβ + @term Ξ± _ nβ x aβ = term n' x a' := by |
simp [hβ.symm, hβ.symm, term, add_nsmul, add_assoc, add_left_comm]
| 1 | 2.718282 | 0 | 0.125 | 8 | 249 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
theorem const_add_termg {Ξ±} [AddCommGroup Ξ±] (k n x a a') (h : k + a = a') :
k + @termg Ξ± _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
theorem term_add_const {Ξ±} [AddCommMonoid Ξ±] (n x a k a') (h : a + k = a') :
@term Ξ± _ n x a + k = term n x a' := by
simp [h.symm, term, add_assoc]
theorem term_add_constg {Ξ±} [AddCommGroup Ξ±] (n x a k a') (h : a + k = a') :
@termg Ξ± _ n x a + k = termg n x a' := by
simp [h.symm, termg, add_assoc]
theorem term_add_term {Ξ±} [AddCommMonoid Ξ±] (nβ x aβ nβ aβ n' a') (hβ : nβ + nβ = n')
(hβ : aβ + aβ = a') : @term Ξ± _ nβ x aβ + @term Ξ± _ nβ x aβ = term n' x a' := by
simp [hβ.symm, hβ.symm, term, add_nsmul, add_assoc, add_left_comm]
| Mathlib/Tactic/Abel.lean | 148 | 152 | theorem term_add_termg {Ξ±} [AddCommGroup Ξ±] (nβ x aβ nβ aβ n' a')
(hβ : nβ + nβ = n') (hβ : aβ + aβ = a') :
@termg Ξ± _ nβ x aβ + @termg Ξ± _ nβ x aβ = termg n' x a' := by |
simp only [termg, hβ.symm, add_zsmul, hβ.symm]
exact add_add_add_comm (nβ β’ x) aβ (nβ β’ x) aβ
| 2 | 7.389056 | 1 | 0.125 | 8 | 249 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
theorem const_add_termg {Ξ±} [AddCommGroup Ξ±] (k n x a a') (h : k + a = a') :
k + @termg Ξ± _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
theorem term_add_const {Ξ±} [AddCommMonoid Ξ±] (n x a k a') (h : a + k = a') :
@term Ξ± _ n x a + k = term n x a' := by
simp [h.symm, term, add_assoc]
theorem term_add_constg {Ξ±} [AddCommGroup Ξ±] (n x a k a') (h : a + k = a') :
@termg Ξ± _ n x a + k = termg n x a' := by
simp [h.symm, termg, add_assoc]
theorem term_add_term {Ξ±} [AddCommMonoid Ξ±] (nβ x aβ nβ aβ n' a') (hβ : nβ + nβ = n')
(hβ : aβ + aβ = a') : @term Ξ± _ nβ x aβ + @term Ξ± _ nβ x aβ = term n' x a' := by
simp [hβ.symm, hβ.symm, term, add_nsmul, add_assoc, add_left_comm]
theorem term_add_termg {Ξ±} [AddCommGroup Ξ±] (nβ x aβ nβ aβ n' a')
(hβ : nβ + nβ = n') (hβ : aβ + aβ = a') :
@termg Ξ± _ nβ x aβ + @termg Ξ± _ nβ x aβ = termg n' x a' := by
simp only [termg, hβ.symm, add_zsmul, hβ.symm]
exact add_add_add_comm (nβ β’ x) aβ (nβ β’ x) aβ
| Mathlib/Tactic/Abel.lean | 154 | 155 | theorem zero_term {Ξ±} [AddCommMonoid Ξ±] (x a) : @term Ξ± _ 0 x a = a := by |
simp [term, zero_nsmul, one_nsmul]
| 1 | 2.718282 | 0 | 0.125 | 8 | 249 |
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.TryThis
import Mathlib.Util.AtomM
set_option autoImplicit true
namespace Mathlib.Tactic.Abel
open Lean Elab Meta Tactic Qq
initialize registerTraceClass `abel
initialize registerTraceClass `abel.detail
structure Context where
Ξ± : Expr
univ : Level
Ξ±0 : Expr
isGroup : Bool
inst : Expr
def mkContext (e : Expr) : MetaM Context := do
let Ξ± β inferType e
let c β synthInstance (β mkAppM ``AddCommMonoid #[Ξ±])
let cg β synthInstance? (β mkAppM ``AddCommGroup #[Ξ±])
let u β mkFreshLevelMVar
_ β isDefEq (.sort (.succ u)) (β inferType Ξ±)
let Ξ±0 β Expr.ofNat Ξ± 0
match cg with
| some cg => return β¨Ξ±, u, Ξ±0, true, cgβ©
| _ => return β¨Ξ±, u, Ξ±0, false, cβ©
abbrev M := ReaderT Context AtomM
def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr β Expr :=
mkAppN (((@Expr.const n [c.univ]).app c.Ξ±).app inst)
def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do
return c.app n (β synthInstance ((Expr.const inst [c.univ]).app c.Ξ±)) l
def addG : Name β Name
| .str p s => .str p (s ++ "g")
| n => n
def iapp (n : Name) (xs : Array Expr) : M Expr := do
let c β read
return c.app (if c.isGroup then addG n else n) c.inst xs
def term {Ξ±} [AddCommMonoid Ξ±] (n : β) (x a : Ξ±) : Ξ± := n β’ x + a
def termg {Ξ±} [AddCommGroup Ξ±] (n : β€) (x a : Ξ±) : Ξ± := n β’ x + a
def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a]
def intToExpr (n : β€) : M Expr := do
Expr.ofInt (mkConst (if (β read).isGroup then ``Int else ``Nat) []) n
inductive NormalExpr : Type
| zero (e : Expr) : NormalExpr
| nterm (e : Expr) (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : NormalExpr
deriving Inhabited
def NormalExpr.e : NormalExpr β Expr
| .zero e => e
| .nterm e .. => e
instance : Coe NormalExpr Expr where coe := NormalExpr.e
def NormalExpr.term' (n : Expr Γ β€) (x : β Γ Expr) (a : NormalExpr) : M NormalExpr :=
return .nterm (β mkTerm n.1 x.2 a) n x a
def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (β read).Ξ±0
open NormalExpr
theorem const_add_term {Ξ±} [AddCommMonoid Ξ±] (k n x a a') (h : k + a = a') :
k + @term Ξ± _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
theorem const_add_termg {Ξ±} [AddCommGroup Ξ±] (k n x a a') (h : k + a = a') :
k + @termg Ξ± _ n x a = termg n x a' := by
simp [h.symm, termg, add_comm, add_assoc]
theorem term_add_const {Ξ±} [AddCommMonoid Ξ±] (n x a k a') (h : a + k = a') :
@term Ξ± _ n x a + k = term n x a' := by
simp [h.symm, term, add_assoc]
theorem term_add_constg {Ξ±} [AddCommGroup Ξ±] (n x a k a') (h : a + k = a') :
@termg Ξ± _ n x a + k = termg n x a' := by
simp [h.symm, termg, add_assoc]
theorem term_add_term {Ξ±} [AddCommMonoid Ξ±] (nβ x aβ nβ aβ n' a') (hβ : nβ + nβ = n')
(hβ : aβ + aβ = a') : @term Ξ± _ nβ x aβ + @term Ξ± _ nβ x aβ = term n' x a' := by
simp [hβ.symm, hβ.symm, term, add_nsmul, add_assoc, add_left_comm]
theorem term_add_termg {Ξ±} [AddCommGroup Ξ±] (nβ x aβ nβ aβ n' a')
(hβ : nβ + nβ = n') (hβ : aβ + aβ = a') :
@termg Ξ± _ nβ x aβ + @termg Ξ± _ nβ x aβ = termg n' x a' := by
simp only [termg, hβ.symm, add_zsmul, hβ.symm]
exact add_add_add_comm (nβ β’ x) aβ (nβ β’ x) aβ
theorem zero_term {Ξ±} [AddCommMonoid Ξ±] (x a) : @term Ξ± _ 0 x a = a := by
simp [term, zero_nsmul, one_nsmul]
| Mathlib/Tactic/Abel.lean | 157 | 158 | theorem zero_termg {Ξ±} [AddCommGroup Ξ±] (x a) : @termg Ξ± _ 0 x a = a := by |
simp [termg, zero_zsmul]
| 1 | 2.718282 | 0 | 0.125 | 8 | 249 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
section SupSet
variable [Preorder Ξ±] [SupSet Ξ±]
noncomputable def subsetSupSet [Inhabited s] : SupSet s where
sSup t :=
if ht : t.Nonempty β§ BddAbove t β§ sSup ((β) '' t : Set Ξ±) β s
then β¨sSup ((β) '' t : Set Ξ±), ht.2.2β©
else default
#align subset_has_Sup subsetSupSet
attribute [local instance] subsetSupSet
@[simp]
theorem subset_sSup_def [Inhabited s] :
@sSup s _ = fun t =>
if ht : t.Nonempty β§ BddAbove t β§ sSup ((β) '' t : Set Ξ±) β s
then β¨sSup ((β) '' t : Set Ξ±), ht.2.2β©
else default :=
rfl
#align subset_Sup_def subset_sSup_def
| Mathlib/Order/CompleteLatticeIntervals.lean | 57 | 59 | theorem subset_sSup_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddAbove t) (h : sSup ((β) '' t : Set Ξ±) β s) :
sSup ((β) '' t : Set Ξ±) = (@sSup s _ t : Ξ±) := by | simp [dif_pos, h, h', h'']
| 1 | 2.718282 | 0 | 0.125 | 8 | 250 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
section SupSet
variable [Preorder Ξ±] [SupSet Ξ±]
noncomputable def subsetSupSet [Inhabited s] : SupSet s where
sSup t :=
if ht : t.Nonempty β§ BddAbove t β§ sSup ((β) '' t : Set Ξ±) β s
then β¨sSup ((β) '' t : Set Ξ±), ht.2.2β©
else default
#align subset_has_Sup subsetSupSet
attribute [local instance] subsetSupSet
@[simp]
theorem subset_sSup_def [Inhabited s] :
@sSup s _ = fun t =>
if ht : t.Nonempty β§ BddAbove t β§ sSup ((β) '' t : Set Ξ±) β s
then β¨sSup ((β) '' t : Set Ξ±), ht.2.2β©
else default :=
rfl
#align subset_Sup_def subset_sSup_def
theorem subset_sSup_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddAbove t) (h : sSup ((β) '' t : Set Ξ±) β s) :
sSup ((β) '' t : Set Ξ±) = (@sSup s _ t : Ξ±) := by simp [dif_pos, h, h', h'']
#align subset_Sup_of_within subset_sSup_of_within
| Mathlib/Order/CompleteLatticeIntervals.lean | 62 | 64 | theorem subset_sSup_emptyset [Inhabited s] :
sSup (β
: Set s) = default := by |
simp [sSup]
| 1 | 2.718282 | 0 | 0.125 | 8 | 250 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
section SupSet
variable [Preorder Ξ±] [SupSet Ξ±]
noncomputable def subsetSupSet [Inhabited s] : SupSet s where
sSup t :=
if ht : t.Nonempty β§ BddAbove t β§ sSup ((β) '' t : Set Ξ±) β s
then β¨sSup ((β) '' t : Set Ξ±), ht.2.2β©
else default
#align subset_has_Sup subsetSupSet
attribute [local instance] subsetSupSet
@[simp]
theorem subset_sSup_def [Inhabited s] :
@sSup s _ = fun t =>
if ht : t.Nonempty β§ BddAbove t β§ sSup ((β) '' t : Set Ξ±) β s
then β¨sSup ((β) '' t : Set Ξ±), ht.2.2β©
else default :=
rfl
#align subset_Sup_def subset_sSup_def
theorem subset_sSup_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddAbove t) (h : sSup ((β) '' t : Set Ξ±) β s) :
sSup ((β) '' t : Set Ξ±) = (@sSup s _ t : Ξ±) := by simp [dif_pos, h, h', h'']
#align subset_Sup_of_within subset_sSup_of_within
theorem subset_sSup_emptyset [Inhabited s] :
sSup (β
: Set s) = default := by
simp [sSup]
| Mathlib/Order/CompleteLatticeIntervals.lean | 66 | 68 | theorem subset_sSup_of_not_bddAbove [Inhabited s] {t : Set s} (ht : Β¬BddAbove t) :
sSup t = default := by |
simp [sSup, ht]
| 1 | 2.718282 | 0 | 0.125 | 8 | 250 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
section InfSet
variable [Preorder Ξ±] [InfSet Ξ±]
noncomputable def subsetInfSet [Inhabited s] : InfSet s where
sInf t :=
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β©
else default
#align subset_has_Inf subsetInfSet
attribute [local instance] subsetInfSet
@[simp]
theorem subset_sInf_def [Inhabited s] :
@sInf s _ = fun t =>
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β© else
default :=
rfl
#align subset_Inf_def subset_sInf_def
| Mathlib/Order/CompleteLatticeIntervals.lean | 97 | 99 | theorem subset_sInf_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddBelow t) (h : sInf ((β) '' t : Set Ξ±) β s) :
sInf ((β) '' t : Set Ξ±) = (@sInf s _ t : Ξ±) := by | simp [dif_pos, h, h', h'']
| 1 | 2.718282 | 0 | 0.125 | 8 | 250 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
section InfSet
variable [Preorder Ξ±] [InfSet Ξ±]
noncomputable def subsetInfSet [Inhabited s] : InfSet s where
sInf t :=
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β©
else default
#align subset_has_Inf subsetInfSet
attribute [local instance] subsetInfSet
@[simp]
theorem subset_sInf_def [Inhabited s] :
@sInf s _ = fun t =>
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β© else
default :=
rfl
#align subset_Inf_def subset_sInf_def
theorem subset_sInf_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddBelow t) (h : sInf ((β) '' t : Set Ξ±) β s) :
sInf ((β) '' t : Set Ξ±) = (@sInf s _ t : Ξ±) := by simp [dif_pos, h, h', h'']
#align subset_Inf_of_within subset_sInf_of_within
| Mathlib/Order/CompleteLatticeIntervals.lean | 102 | 104 | theorem subset_sInf_emptyset [Inhabited s] :
sInf (β
: Set s) = default := by |
simp [sInf]
| 1 | 2.718282 | 0 | 0.125 | 8 | 250 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
section InfSet
variable [Preorder Ξ±] [InfSet Ξ±]
noncomputable def subsetInfSet [Inhabited s] : InfSet s where
sInf t :=
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β©
else default
#align subset_has_Inf subsetInfSet
attribute [local instance] subsetInfSet
@[simp]
theorem subset_sInf_def [Inhabited s] :
@sInf s _ = fun t =>
if ht : t.Nonempty β§ BddBelow t β§ sInf ((β) '' t : Set Ξ±) β s
then β¨sInf ((β) '' t : Set Ξ±), ht.2.2β© else
default :=
rfl
#align subset_Inf_def subset_sInf_def
theorem subset_sInf_of_within [Inhabited s] {t : Set s}
(h' : t.Nonempty) (h'' : BddBelow t) (h : sInf ((β) '' t : Set Ξ±) β s) :
sInf ((β) '' t : Set Ξ±) = (@sInf s _ t : Ξ±) := by simp [dif_pos, h, h', h'']
#align subset_Inf_of_within subset_sInf_of_within
theorem subset_sInf_emptyset [Inhabited s] :
sInf (β
: Set s) = default := by
simp [sInf]
| Mathlib/Order/CompleteLatticeIntervals.lean | 106 | 108 | theorem subset_sInf_of_not_bddBelow [Inhabited s] {t : Set s} (ht : Β¬BddBelow t) :
sInf t = default := by |
simp [sInf, ht]
| 1 | 2.718282 | 0 | 0.125 | 8 | 250 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
namespace Set.Iic
variable [CompleteLattice Ξ±] {a : Ξ±}
instance instCompleteLattice : CompleteLattice (Iic a) where
sSup S := β¨sSup ((β) '' S), by simpa using fun b hb _ β¦ hbβ©
sInf S := β¨a β sInf ((β) '' S), by simpβ©
le_sSup S b hb := le_sSup <| mem_image_of_mem Subtype.val hb
sSup_le S b hb := sSup_le <| fun c' β¨c, hc, hc'β© β¦ hc' βΈ hb c hc
sInf_le S b hb := inf_le_of_right_le <| sInf_le <| mem_image_of_mem Subtype.val hb
le_sInf S b hb := le_inf_iff.mpr β¨b.property, le_sInf fun d' β¨d, hd, hd'β© β¦ hd' βΈ hb d hdβ©
le_top := by simp
bot_le := by simp
variable (S : Set <| Iic a) (f : ΞΉ β Iic a) (p : ΞΉ β Prop)
@[simp] theorem coe_sSup : (β(sSup S) : Ξ±) = sSup ((β) '' S) := rfl
@[simp] theorem coe_iSup : (β(β¨ i, f i) : Ξ±) = β¨ i, (f i : Ξ±) := by
rw [iSup, coe_sSup]; congr; ext; simp
| Mathlib/Order/CompleteLatticeIntervals.lean | 265 | 265 | theorem coe_biSup : (β(β¨ i, β¨ (_ : p i), f i) : Ξ±) = β¨ i, β¨ (_ : p i), (f i : Ξ±) := by | simp
| 1 | 2.718282 | 0 | 0.125 | 8 | 250 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ΞΉ : Sort*} {Ξ± : Type*} (s : Set Ξ±)
namespace Set.Iic
variable [CompleteLattice Ξ±] {a : Ξ±}
instance instCompleteLattice : CompleteLattice (Iic a) where
sSup S := β¨sSup ((β) '' S), by simpa using fun b hb _ β¦ hbβ©
sInf S := β¨a β sInf ((β) '' S), by simpβ©
le_sSup S b hb := le_sSup <| mem_image_of_mem Subtype.val hb
sSup_le S b hb := sSup_le <| fun c' β¨c, hc, hc'β© β¦ hc' βΈ hb c hc
sInf_le S b hb := inf_le_of_right_le <| sInf_le <| mem_image_of_mem Subtype.val hb
le_sInf S b hb := le_inf_iff.mpr β¨b.property, le_sInf fun d' β¨d, hd, hd'β© β¦ hd' βΈ hb d hdβ©
le_top := by simp
bot_le := by simp
variable (S : Set <| Iic a) (f : ΞΉ β Iic a) (p : ΞΉ β Prop)
@[simp] theorem coe_sSup : (β(sSup S) : Ξ±) = sSup ((β) '' S) := rfl
@[simp] theorem coe_iSup : (β(β¨ i, f i) : Ξ±) = β¨ i, (f i : Ξ±) := by
rw [iSup, coe_sSup]; congr; ext; simp
theorem coe_biSup : (β(β¨ i, β¨ (_ : p i), f i) : Ξ±) = β¨ i, β¨ (_ : p i), (f i : Ξ±) := by simp
@[simp] theorem coe_sInf : (β(sInf S) : Ξ±) = a β sInf ((β) '' S) := rfl
@[simp] theorem coe_iInf : (β(β¨
i, f i) : Ξ±) = a β β¨
i, (f i : Ξ±) := by
rw [iInf, coe_sInf]; congr; ext; simp
| Mathlib/Order/CompleteLatticeIntervals.lean | 272 | 275 | theorem coe_biInf : (β(β¨
i, β¨
(_ : p i), f i) : Ξ±) = a β β¨
i, β¨
(_ : p i), (f i : Ξ±) := by |
cases isEmpty_or_nonempty ΞΉ
Β· simp
Β· simp_rw [coe_iInf, β inf_iInf, β inf_assoc, inf_idem]
| 3 | 20.085537 | 1 | 0.125 | 8 | 250 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 79 | 80 | theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by |
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 84 | 85 | theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by |
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 89 | 90 | theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by |
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 94 | 95 | theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by |
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 104 | 105 | theorem card_Icc : (Icc a b).card = b + 1 - a := by |
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 109 | 110 | theorem card_Ico : (Ico a b).card = b - a := by |
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 114 | 115 | theorem card_Ioc : (Ioc a b).card = b - a := by |
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 119 | 120 | theorem card_Ioo : (Ioo a b).card = b - a - 1 := by |
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 124 | 125 | theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by |
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 130 | 131 | theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by |
rw [β card_Icc, Fintype.card_ofFinset]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [β card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 136 | 137 | theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by |
rw [β card_Ico, Fintype.card_ofFinset]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [β card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [β card_Ico, Fintype.card_ofFinset]
#align fin.card_fintype_Ico Fin.card_fintypeIco
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 142 | 143 | theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by |
rw [β card_Ioc, Fintype.card_ofFinset]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [β card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [β card_Ico, Fintype.card_ofFinset]
#align fin.card_fintype_Ico Fin.card_fintypeIco
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by
rw [β card_Ioc, Fintype.card_ofFinset]
#align fin.card_fintype_Ioc Fin.card_fintypeIoc
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 148 | 149 | theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by |
rw [β card_Ioo, Fintype.card_ofFinset]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [β card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [β card_Ico, Fintype.card_ofFinset]
#align fin.card_fintype_Ico Fin.card_fintypeIco
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by
rw [β card_Ioc, Fintype.card_ofFinset]
#align fin.card_fintype_Ioc Fin.card_fintypeIoc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by
rw [β card_Ioo, Fintype.card_ofFinset]
#align fin.card_fintype_Ioo Fin.card_fintypeIoo
| Mathlib/Order/Interval/Finset/Fin.lean | 152 | 153 | theorem card_fintype_uIcc : Fintype.card (Set.uIcc a b) = (b - a : β€).natAbs + 1 := by |
rw [β card_uIcc, Fintype.card_ofFinset]
| 1 | 2.718282 | 0 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [β card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [β card_Ico, Fintype.card_ofFinset]
#align fin.card_fintype_Ico Fin.card_fintypeIco
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by
rw [β card_Ioc, Fintype.card_ofFinset]
#align fin.card_fintype_Ioc Fin.card_fintypeIoc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by
rw [β card_Ioo, Fintype.card_ofFinset]
#align fin.card_fintype_Ioo Fin.card_fintypeIoo
theorem card_fintype_uIcc : Fintype.card (Set.uIcc a b) = (b - a : β€).natAbs + 1 := by
rw [β card_uIcc, Fintype.card_ofFinset]
#align fin.card_fintype_uIcc Fin.card_fintype_uIcc
| Mathlib/Order/Interval/Finset/Fin.lean | 156 | 158 | theorem Ici_eq_finset_subtype : Ici a = (Icc (a : β) n).fin n := by |
ext
simp
| 2 | 7.389056 | 1 | 0.125 | 16 | 251 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : β)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : β n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : β) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : β) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : β) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : β) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : β) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc βa βb := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico βa βb := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc βa βb := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo βa βb := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc βa βb :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [β Nat.card_Icc, β map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [β Nat.card_Ico, β map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [β Nat.card_Ioc, β map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [β Nat.card_Ioo, β map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 := by
rw [β Nat.card_uIcc, β map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [β card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [β card_Ico, Fintype.card_ofFinset]
#align fin.card_fintype_Ico Fin.card_fintypeIco
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by
rw [β card_Ioc, Fintype.card_ofFinset]
#align fin.card_fintype_Ioc Fin.card_fintypeIoc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by
rw [β card_Ioo, Fintype.card_ofFinset]
#align fin.card_fintype_Ioo Fin.card_fintypeIoo
theorem card_fintype_uIcc : Fintype.card (Set.uIcc a b) = (b - a : β€).natAbs + 1 := by
rw [β card_uIcc, Fintype.card_ofFinset]
#align fin.card_fintype_uIcc Fin.card_fintype_uIcc
theorem Ici_eq_finset_subtype : Ici a = (Icc (a : β) n).fin n := by
ext
simp
#align fin.Ici_eq_finset_subtype Fin.Ici_eq_finset_subtype
| Mathlib/Order/Interval/Finset/Fin.lean | 161 | 163 | theorem Ioi_eq_finset_subtype : Ioi a = (Ioc (a : β) n).fin n := by |
ext
simp
| 2 | 7.389056 | 1 | 0.125 | 16 | 251 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 97 | 97 | theorem mem_box : x β box n d β β i, x i < d := by | simp only [box, Fintype.mem_piFinset, mem_range]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x β box n d β β i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 101 | 101 | theorem card_box : (box n d).card = d ^ n := by | simp [box]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x β box n d β β i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 105 | 105 | theorem box_zero : box (n + 1) 0 = β
:= by | simp [box]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x β box n d β β i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = β
:= by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : β) : Finset (Fin n β β) :=
(box n d).filter fun x => β i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 β 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 118 | 118 | theorem sphere_zero_right (n k : β) : sphere (n + 1) 0 k = β
:= by | simp [sphere]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x β box n d β β i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = β
:= by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : β) : Finset (Fin n β β) :=
(box n d).filter fun x => β i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 β 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
theorem sphere_zero_right (n k : β) : sphere (n + 1) 0 k = β
:= by simp [sphere]
#align behrend.sphere_zero_right Behrend.sphere_zero_right
theorem sphere_subset_box : sphere n d k β box n d :=
filter_subset _ _
#align behrend.sphere_subset_box Behrend.sphere_subset_box
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 125 | 129 | theorem norm_of_mem_sphere {x : Fin n β β} (hx : x β sphere n d k) :
β(WithLp.equiv 2 _).symm ((β) β x : Fin n β β)β = ββk := by |
rw [EuclideanSpace.norm_eq]
dsimp
simp_rw [abs_cast, β cast_pow, β cast_sum, (mem_filter.1 hx).2]
| 3 | 20.085537 | 1 | 0.125 | 8 | 252 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x β box n d β β i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = β
:= by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : β) : Finset (Fin n β β) :=
(box n d).filter fun x => β i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 β 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
theorem sphere_zero_right (n k : β) : sphere (n + 1) 0 k = β
:= by simp [sphere]
#align behrend.sphere_zero_right Behrend.sphere_zero_right
theorem sphere_subset_box : sphere n d k β box n d :=
filter_subset _ _
#align behrend.sphere_subset_box Behrend.sphere_subset_box
theorem norm_of_mem_sphere {x : Fin n β β} (hx : x β sphere n d k) :
β(WithLp.equiv 2 _).symm ((β) β x : Fin n β β)β = ββk := by
rw [EuclideanSpace.norm_eq]
dsimp
simp_rw [abs_cast, β cast_pow, β cast_sum, (mem_filter.1 hx).2]
#align behrend.norm_of_mem_sphere Behrend.norm_of_mem_sphere
theorem sphere_subset_preimage_metric_sphere : (sphere n d k : Set (Fin n β β)) β
(fun x : Fin n β β => (WithLp.equiv 2 _).symm ((β) β x : Fin n β β)) β»ΒΉ'
Metric.sphere (0 : PiLp 2 fun _ : Fin n => β) (ββk) :=
fun x hx => by rw [Set.mem_preimage, mem_sphere_zero_iff_norm, norm_of_mem_sphere hx]
#align behrend.sphere_subset_preimage_metric_sphere Behrend.sphere_subset_preimage_metric_sphere
@[simps]
def map (d : β) : (Fin n β β) β+ β where
toFun a := β i, a i * d ^ (i : β)
map_zero' := by simp_rw [Pi.zero_apply, zero_mul, sum_const_zero]
map_add' a b := by simp_rw [Pi.add_apply, add_mul, sum_add_distrib]
#align behrend.map Behrend.map
-- @[simp] -- Porting note (#10618): simp can prove this
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 147 | 147 | theorem map_zero (d : β) (a : Fin 0 β β) : map d a = 0 := by | simp [map]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x β box n d β β i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = β
:= by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : β) : Finset (Fin n β β) :=
(box n d).filter fun x => β i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 β 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
theorem sphere_zero_right (n k : β) : sphere (n + 1) 0 k = β
:= by simp [sphere]
#align behrend.sphere_zero_right Behrend.sphere_zero_right
theorem sphere_subset_box : sphere n d k β box n d :=
filter_subset _ _
#align behrend.sphere_subset_box Behrend.sphere_subset_box
theorem norm_of_mem_sphere {x : Fin n β β} (hx : x β sphere n d k) :
β(WithLp.equiv 2 _).symm ((β) β x : Fin n β β)β = ββk := by
rw [EuclideanSpace.norm_eq]
dsimp
simp_rw [abs_cast, β cast_pow, β cast_sum, (mem_filter.1 hx).2]
#align behrend.norm_of_mem_sphere Behrend.norm_of_mem_sphere
theorem sphere_subset_preimage_metric_sphere : (sphere n d k : Set (Fin n β β)) β
(fun x : Fin n β β => (WithLp.equiv 2 _).symm ((β) β x : Fin n β β)) β»ΒΉ'
Metric.sphere (0 : PiLp 2 fun _ : Fin n => β) (ββk) :=
fun x hx => by rw [Set.mem_preimage, mem_sphere_zero_iff_norm, norm_of_mem_sphere hx]
#align behrend.sphere_subset_preimage_metric_sphere Behrend.sphere_subset_preimage_metric_sphere
@[simps]
def map (d : β) : (Fin n β β) β+ β where
toFun a := β i, a i * d ^ (i : β)
map_zero' := by simp_rw [Pi.zero_apply, zero_mul, sum_const_zero]
map_add' a b := by simp_rw [Pi.add_apply, add_mul, sum_add_distrib]
#align behrend.map Behrend.map
-- @[simp] -- Porting note (#10618): simp can prove this
theorem map_zero (d : β) (a : Fin 0 β β) : map d a = 0 := by simp [map]
#align behrend.map_zero Behrend.map_zero
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 150 | 152 | theorem map_succ (a : Fin (n + 1) β β) :
map d a = a 0 + (β x : Fin n, a x.succ * d ^ (x : β)) * d := by |
simp [map, Fin.sum_univ_succ, _root_.pow_succ, β mul_assoc, β sum_mul]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {π E : Type*} [LinearOrderedField π] [TopologicalSpace E]
[AddCommMonoid E] [Module π E] {s : Set E} (hsβ : IsClosed s) (hsβ : StrictConvex π s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : π) β’ a + (1 / 2 : π) β’ c = b := by
rwa [β smul_add, one_div, inv_smul_eq_iffβ (show (2 : π) β 0 by norm_num), two_smul]
have :=
hsβ.eq (hsβ.frontier_subset ha) (hsβ.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, β add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace β E]
[StrictConvexSpace β E] (x : E) (r : β) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
Β· rw [sphere_zero]
exact threeAPFree_singleton _
Β· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall β x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {Ξ± Ξ² : Type*} {n d k N : β} {x : Fin n β β}
def box (n d : β) : Finset (Fin n β β) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
theorem mem_box : x β box n d β β i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range]
#align behrend.mem_box Behrend.mem_box
@[simp]
theorem card_box : (box n d).card = d ^ n := by simp [box]
#align behrend.card_box Behrend.card_box
@[simp]
theorem box_zero : box (n + 1) 0 = β
:= by simp [box]
#align behrend.box_zero Behrend.box_zero
def sphere (n d k : β) : Finset (Fin n β β) :=
(box n d).filter fun x => β i, x i ^ 2 = k
#align behrend.sphere Behrend.sphere
theorem sphere_zero_subset : sphere n d 0 β 0 := fun x => by simp [sphere, Function.funext_iff]
#align behrend.sphere_zero_subset Behrend.sphere_zero_subset
@[simp]
theorem sphere_zero_right (n k : β) : sphere (n + 1) 0 k = β
:= by simp [sphere]
#align behrend.sphere_zero_right Behrend.sphere_zero_right
theorem sphere_subset_box : sphere n d k β box n d :=
filter_subset _ _
#align behrend.sphere_subset_box Behrend.sphere_subset_box
theorem norm_of_mem_sphere {x : Fin n β β} (hx : x β sphere n d k) :
β(WithLp.equiv 2 _).symm ((β) β x : Fin n β β)β = ββk := by
rw [EuclideanSpace.norm_eq]
dsimp
simp_rw [abs_cast, β cast_pow, β cast_sum, (mem_filter.1 hx).2]
#align behrend.norm_of_mem_sphere Behrend.norm_of_mem_sphere
theorem sphere_subset_preimage_metric_sphere : (sphere n d k : Set (Fin n β β)) β
(fun x : Fin n β β => (WithLp.equiv 2 _).symm ((β) β x : Fin n β β)) β»ΒΉ'
Metric.sphere (0 : PiLp 2 fun _ : Fin n => β) (ββk) :=
fun x hx => by rw [Set.mem_preimage, mem_sphere_zero_iff_norm, norm_of_mem_sphere hx]
#align behrend.sphere_subset_preimage_metric_sphere Behrend.sphere_subset_preimage_metric_sphere
@[simps]
def map (d : β) : (Fin n β β) β+ β where
toFun a := β i, a i * d ^ (i : β)
map_zero' := by simp_rw [Pi.zero_apply, zero_mul, sum_const_zero]
map_add' a b := by simp_rw [Pi.add_apply, add_mul, sum_add_distrib]
#align behrend.map Behrend.map
-- @[simp] -- Porting note (#10618): simp can prove this
theorem map_zero (d : β) (a : Fin 0 β β) : map d a = 0 := by simp [map]
#align behrend.map_zero Behrend.map_zero
theorem map_succ (a : Fin (n + 1) β β) :
map d a = a 0 + (β x : Fin n, a x.succ * d ^ (x : β)) * d := by
simp [map, Fin.sum_univ_succ, _root_.pow_succ, β mul_assoc, β sum_mul]
#align behrend.map_succ Behrend.map_succ
theorem map_succ' (a : Fin (n + 1) β β) : map d a = a 0 + map d (a β Fin.succ) * d :=
map_succ _
#align behrend.map_succ' Behrend.map_succ'
theorem map_monotone (d : β) : Monotone (map d : (Fin n β β) β β) := fun x y h => by
dsimp; exact sum_le_sum fun i _ => Nat.mul_le_mul_right _ <| h i
#align behrend.map_monotone Behrend.map_monotone
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 163 | 164 | theorem map_mod (a : Fin n.succ β β) : map d a % d = a 0 % d := by |
rw [map_succ, Nat.add_mul_mod_self_right]
| 1 | 2.718282 | 0 | 0.125 | 8 | 252 |
import Mathlib.Order.Interval.Multiset
#align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
-- TODO
-- assert_not_exists Ring
open Finset Nat
variable (a b c : β)
namespace Nat
instance instLocallyFiniteOrder : LocallyFiniteOrder β where
finsetIcc a b := β¨List.range' a (b + 1 - a), List.nodup_range' _ _β©
finsetIco a b := β¨List.range' a (b - a), List.nodup_range' _ _β©
finsetIoc a b := β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β©
finsetIoo a b := β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β©
finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
theorem Icc_eq_range' : Icc a b = β¨List.range' a (b + 1 - a), List.nodup_range' _ _β© :=
rfl
#align nat.Icc_eq_range' Nat.Icc_eq_range'
theorem Ico_eq_range' : Ico a b = β¨List.range' a (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ico_eq_range' Nat.Ico_eq_range'
theorem Ioc_eq_range' : Ioc a b = β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ioc_eq_range' Nat.Ioc_eq_range'
theorem Ioo_eq_range' : Ioo a b = β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β© :=
rfl
#align nat.Ioo_eq_range' Nat.Ioo_eq_range'
theorem uIcc_eq_range' :
uIcc a b = β¨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _β© := rfl
#align nat.uIcc_eq_range' Nat.uIcc_eq_range'
| Mathlib/Order/Interval/Finset/Nat.lean | 61 | 63 | theorem Iio_eq_range : Iio = range := by |
ext b x
rw [mem_Iio, mem_range]
| 2 | 7.389056 | 1 | 0.125 | 8 | 253 |
import Mathlib.Order.Interval.Multiset
#align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
-- TODO
-- assert_not_exists Ring
open Finset Nat
variable (a b c : β)
namespace Nat
instance instLocallyFiniteOrder : LocallyFiniteOrder β where
finsetIcc a b := β¨List.range' a (b + 1 - a), List.nodup_range' _ _β©
finsetIco a b := β¨List.range' a (b - a), List.nodup_range' _ _β©
finsetIoc a b := β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β©
finsetIoo a b := β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β©
finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
theorem Icc_eq_range' : Icc a b = β¨List.range' a (b + 1 - a), List.nodup_range' _ _β© :=
rfl
#align nat.Icc_eq_range' Nat.Icc_eq_range'
theorem Ico_eq_range' : Ico a b = β¨List.range' a (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ico_eq_range' Nat.Ico_eq_range'
theorem Ioc_eq_range' : Ioc a b = β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ioc_eq_range' Nat.Ioc_eq_range'
theorem Ioo_eq_range' : Ioo a b = β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β© :=
rfl
#align nat.Ioo_eq_range' Nat.Ioo_eq_range'
theorem uIcc_eq_range' :
uIcc a b = β¨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _β© := rfl
#align nat.uIcc_eq_range' Nat.uIcc_eq_range'
theorem Iio_eq_range : Iio = range := by
ext b x
rw [mem_Iio, mem_range]
#align nat.Iio_eq_range Nat.Iio_eq_range
@[simp]
| Mathlib/Order/Interval/Finset/Nat.lean | 67 | 67 | theorem Ico_zero_eq_range : Ico 0 = range := by | rw [β Nat.bot_eq_zero, β Iio_eq_Ico, Iio_eq_range]
| 1 | 2.718282 | 0 | 0.125 | 8 | 253 |
import Mathlib.Order.Interval.Multiset
#align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
-- TODO
-- assert_not_exists Ring
open Finset Nat
variable (a b c : β)
namespace Nat
instance instLocallyFiniteOrder : LocallyFiniteOrder β where
finsetIcc a b := β¨List.range' a (b + 1 - a), List.nodup_range' _ _β©
finsetIco a b := β¨List.range' a (b - a), List.nodup_range' _ _β©
finsetIoc a b := β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β©
finsetIoo a b := β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β©
finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
theorem Icc_eq_range' : Icc a b = β¨List.range' a (b + 1 - a), List.nodup_range' _ _β© :=
rfl
#align nat.Icc_eq_range' Nat.Icc_eq_range'
theorem Ico_eq_range' : Ico a b = β¨List.range' a (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ico_eq_range' Nat.Ico_eq_range'
theorem Ioc_eq_range' : Ioc a b = β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ioc_eq_range' Nat.Ioc_eq_range'
theorem Ioo_eq_range' : Ioo a b = β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β© :=
rfl
#align nat.Ioo_eq_range' Nat.Ioo_eq_range'
theorem uIcc_eq_range' :
uIcc a b = β¨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _β© := rfl
#align nat.uIcc_eq_range' Nat.uIcc_eq_range'
theorem Iio_eq_range : Iio = range := by
ext b x
rw [mem_Iio, mem_range]
#align nat.Iio_eq_range Nat.Iio_eq_range
@[simp]
theorem Ico_zero_eq_range : Ico 0 = range := by rw [β Nat.bot_eq_zero, β Iio_eq_Ico, Iio_eq_range]
#align nat.Ico_zero_eq_range Nat.Ico_zero_eq_range
lemma range_eq_Icc_zero_sub_one (n : β) (hn : n β 0): range n = Icc 0 (n - 1) := by
ext b
simp_all only [mem_Icc, zero_le, true_and, mem_range]
exact lt_iff_le_pred (zero_lt_of_ne_zero hn)
theorem _root_.Finset.range_eq_Ico : range = Ico 0 :=
Ico_zero_eq_range.symm
#align finset.range_eq_Ico Finset.range_eq_Ico
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a :=
List.length_range' _ _ _
#align nat.card_Icc Nat.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a :=
List.length_range' _ _ _
#align nat.card_Ico Nat.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a :=
List.length_range' _ _ _
#align nat.card_Ioc Nat.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 :=
List.length_range' _ _ _
#align nat.card_Ioo Nat.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 :=
(card_Icc _ _).trans $ by rw [β Int.natCast_inj, sup_eq_max, inf_eq_min, Int.ofNat_sub] <;> omega
#align nat.card_uIcc Nat.card_uIcc
@[simp]
lemma card_Iic : (Iic b).card = b + 1 := by rw [Iic_eq_Icc, card_Icc, Nat.bot_eq_zero, Nat.sub_zero]
#align nat.card_Iic Nat.card_Iic
@[simp]
| Mathlib/Order/Interval/Finset/Nat.lean | 109 | 109 | theorem card_Iio : (Iio b).card = b := by | rw [Iio_eq_Ico, card_Ico, Nat.bot_eq_zero, Nat.sub_zero]
| 1 | 2.718282 | 0 | 0.125 | 8 | 253 |
import Mathlib.Order.Interval.Multiset
#align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
-- TODO
-- assert_not_exists Ring
open Finset Nat
variable (a b c : β)
namespace Nat
instance instLocallyFiniteOrder : LocallyFiniteOrder β where
finsetIcc a b := β¨List.range' a (b + 1 - a), List.nodup_range' _ _β©
finsetIco a b := β¨List.range' a (b - a), List.nodup_range' _ _β©
finsetIoc a b := β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β©
finsetIoo a b := β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β©
finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
theorem Icc_eq_range' : Icc a b = β¨List.range' a (b + 1 - a), List.nodup_range' _ _β© :=
rfl
#align nat.Icc_eq_range' Nat.Icc_eq_range'
theorem Ico_eq_range' : Ico a b = β¨List.range' a (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ico_eq_range' Nat.Ico_eq_range'
theorem Ioc_eq_range' : Ioc a b = β¨List.range' (a + 1) (b - a), List.nodup_range' _ _β© :=
rfl
#align nat.Ioc_eq_range' Nat.Ioc_eq_range'
theorem Ioo_eq_range' : Ioo a b = β¨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _β© :=
rfl
#align nat.Ioo_eq_range' Nat.Ioo_eq_range'
theorem uIcc_eq_range' :
uIcc a b = β¨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _β© := rfl
#align nat.uIcc_eq_range' Nat.uIcc_eq_range'
theorem Iio_eq_range : Iio = range := by
ext b x
rw [mem_Iio, mem_range]
#align nat.Iio_eq_range Nat.Iio_eq_range
@[simp]
theorem Ico_zero_eq_range : Ico 0 = range := by rw [β Nat.bot_eq_zero, β Iio_eq_Ico, Iio_eq_range]
#align nat.Ico_zero_eq_range Nat.Ico_zero_eq_range
lemma range_eq_Icc_zero_sub_one (n : β) (hn : n β 0): range n = Icc 0 (n - 1) := by
ext b
simp_all only [mem_Icc, zero_le, true_and, mem_range]
exact lt_iff_le_pred (zero_lt_of_ne_zero hn)
theorem _root_.Finset.range_eq_Ico : range = Ico 0 :=
Ico_zero_eq_range.symm
#align finset.range_eq_Ico Finset.range_eq_Ico
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a :=
List.length_range' _ _ _
#align nat.card_Icc Nat.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a :=
List.length_range' _ _ _
#align nat.card_Ico Nat.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a :=
List.length_range' _ _ _
#align nat.card_Ioc Nat.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 :=
List.length_range' _ _ _
#align nat.card_Ioo Nat.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : β€).natAbs + 1 :=
(card_Icc _ _).trans $ by rw [β Int.natCast_inj, sup_eq_max, inf_eq_min, Int.ofNat_sub] <;> omega
#align nat.card_uIcc Nat.card_uIcc
@[simp]
lemma card_Iic : (Iic b).card = b + 1 := by rw [Iic_eq_Icc, card_Icc, Nat.bot_eq_zero, Nat.sub_zero]
#align nat.card_Iic Nat.card_Iic
@[simp]
theorem card_Iio : (Iio b).card = b := by rw [Iio_eq_Ico, card_Ico, Nat.bot_eq_zero, Nat.sub_zero]
#align nat.card_Iio Nat.card_Iio
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Nat.lean | 114 | 115 | theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by |
rw [Fintype.card_ofFinset, card_Icc]
| 1 | 2.718282 | 0 | 0.125 | 8 | 253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.