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.IsPrimePow
import Mathlib.NumberTheory.ArithmeticFunction
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import number_theory.von_mangoldt from "leanprover-community/mathlib"@"c946d6097a6925ad16d7ec55677bbc977f9846de"
namespace ArithmeticFunction
open Finset Nat
open scoped ArithmeticFunction
noncomputable def log : ArithmeticFunction β :=
β¨fun n => Real.log n, by simpβ©
#align nat.arithmetic_function.log ArithmeticFunction.log
@[simp]
theorem log_apply {n : β} : log n = Real.log n :=
rfl
#align nat.arithmetic_function.log_apply ArithmeticFunction.log_apply
noncomputable def vonMangoldt : ArithmeticFunction β :=
β¨fun n => if IsPrimePow n then Real.log (minFac n) else 0, if_neg not_isPrimePow_zeroβ©
#align nat.arithmetic_function.von_mangoldt ArithmeticFunction.vonMangoldt
@[inherit_doc] scoped[ArithmeticFunction] notation "Ξ" => ArithmeticFunction.vonMangoldt
@[inherit_doc] scoped[ArithmeticFunction.vonMangoldt] notation "Ξ" =>
ArithmeticFunction.vonMangoldt
theorem vonMangoldt_apply {n : β} : Ξ n = if IsPrimePow n then Real.log (minFac n) else 0 :=
rfl
#align nat.arithmetic_function.von_mangoldt_apply ArithmeticFunction.vonMangoldt_apply
@[simp]
theorem vonMangoldt_apply_one : Ξ 1 = 0 := by simp [vonMangoldt_apply]
#align nat.arithmetic_function.von_mangoldt_apply_one ArithmeticFunction.vonMangoldt_apply_one
@[simp]
theorem vonMangoldt_nonneg {n : β} : 0 β€ Ξ n := by
rw [vonMangoldt_apply]
split_ifs
Β· exact Real.log_nonneg (one_le_cast.2 (Nat.minFac_pos n))
rfl
#align nat.arithmetic_function.von_mangoldt_nonneg ArithmeticFunction.vonMangoldt_nonneg
theorem vonMangoldt_apply_pow {n k : β} (hk : k β 0) : Ξ (n ^ k) = Ξ n := by
simp only [vonMangoldt_apply, isPrimePow_pow_iff hk, pow_minFac hk]
#align nat.arithmetic_function.von_mangoldt_apply_pow ArithmeticFunction.vonMangoldt_apply_pow
theorem vonMangoldt_apply_prime {p : β} (hp : p.Prime) : Ξ p = Real.log p := by
rw [vonMangoldt_apply, Prime.minFac_eq hp, if_pos hp.prime.isPrimePow]
#align nat.arithmetic_function.von_mangoldt_apply_prime ArithmeticFunction.vonMangoldt_apply_prime
theorem vonMangoldt_ne_zero_iff {n : β} : Ξ n β 0 β IsPrimePow n := by
rcases eq_or_ne n 1 with (rfl | hn); Β· simp [not_isPrimePow_one]
exact (Real.log_pos (one_lt_cast.2 (minFac_prime hn).one_lt)).ne'.ite_ne_right_iff
#align nat.arithmetic_function.von_mangoldt_ne_zero_iff ArithmeticFunction.vonMangoldt_ne_zero_iff
theorem vonMangoldt_pos_iff {n : β} : 0 < Ξ n β IsPrimePow n :=
vonMangoldt_nonneg.lt_iff_ne.trans (ne_comm.trans vonMangoldt_ne_zero_iff)
#align nat.arithmetic_function.von_mangoldt_pos_iff ArithmeticFunction.vonMangoldt_pos_iff
theorem vonMangoldt_eq_zero_iff {n : β} : Ξ n = 0 β Β¬IsPrimePow n :=
vonMangoldt_ne_zero_iff.not_right
#align nat.arithmetic_function.von_mangoldt_eq_zero_iff ArithmeticFunction.vonMangoldt_eq_zero_iff
theorem vonMangoldt_sum {n : β} : β i β n.divisors, Ξ i = Real.log n := by
refine recOnPrimeCoprime ?_ ?_ ?_ n
Β· simp
Β· intro p k hp
rw [sum_divisors_prime_pow hp, cast_pow, Real.log_pow, Finset.sum_range_succ', Nat.pow_zero,
vonMangoldt_apply_one]
simp [vonMangoldt_apply_pow (Nat.succ_ne_zero _), vonMangoldt_apply_prime hp]
intro a b ha' hb' hab ha hb
simp only [vonMangoldt_apply, β sum_filter] at ha hb β’
rw [mul_divisors_filter_prime_pow hab, filter_union,
sum_union (disjoint_divisors_filter_isPrimePow hab), ha, hb, Nat.cast_mul,
Real.log_mul (cast_ne_zero.2 (pos_of_gt ha').ne') (cast_ne_zero.2 (pos_of_gt hb').ne')]
#align nat.arithmetic_function.von_mangoldt_sum ArithmeticFunction.vonMangoldt_sum
@[simp]
theorem vonMangoldt_mul_zeta : Ξ * ΞΆ = log := by
ext n; rw [coe_mul_zeta_apply, vonMangoldt_sum]; rfl
#align nat.arithmetic_function.von_mangoldt_mul_zeta ArithmeticFunction.vonMangoldt_mul_zeta
@[simp]
theorem zeta_mul_vonMangoldt : (ΞΆ : ArithmeticFunction β) * Ξ = log := by rw [mul_comm]; simp
#align nat.arithmetic_function.zeta_mul_von_mangoldt ArithmeticFunction.zeta_mul_vonMangoldt
@[simp]
theorem log_mul_moebius_eq_vonMangoldt : log * ΞΌ = Ξ := by
rw [β vonMangoldt_mul_zeta, mul_assoc, coe_zeta_mul_coe_moebius, mul_one]
#align nat.arithmetic_function.log_mul_moebius_eq_von_mangoldt ArithmeticFunction.log_mul_moebius_eq_vonMangoldt
@[simp]
theorem moebius_mul_log_eq_vonMangoldt : (ΞΌ : ArithmeticFunction β) * log = Ξ := by
rw [mul_comm]; simp
#align nat.arithmetic_function.moebius_mul_log_eq_von_mangoldt ArithmeticFunction.moebius_mul_log_eq_vonMangoldt
| Mathlib/NumberTheory/VonMangoldt.lean | 144 | 160 | theorem sum_moebius_mul_log_eq {n : β} : (β d β n.divisors, (ΞΌ d : β) * log d) = -Ξ n := by |
simp only [β log_mul_moebius_eq_vonMangoldt, mul_comm log, mul_apply, log_apply, intCoe_apply, β
Finset.sum_neg_distrib, neg_mul_eq_mul_neg]
rw [sum_divisorsAntidiagonal fun i j => (ΞΌ i : β) * -Real.log j]
have : (β i β n.divisors, (ΞΌ i : β) * -Real.log (n / i : β)) =
β i β n.divisors, ((ΞΌ i : β) * Real.log i - ΞΌ i * Real.log n) := by
apply sum_congr rfl
simp only [and_imp, Int.cast_eq_zero, mul_eq_mul_left_iff, Ne, neg_inj, mem_divisors]
intro m mn hn
have : (m : β) β 0 := by
rw [cast_ne_zero]
rintro rfl
exact hn (by simpa using mn)
rw [Nat.cast_div mn this, Real.log_div (cast_ne_zero.2 hn) this, neg_sub, mul_sub]
rw [this, sum_sub_distrib, β sum_mul, β Int.cast_sum, β coe_mul_zeta_apply, eq_comm, sub_eq_self,
moebius_mul_coe_zeta]
rcases eq_or_ne n 1 with (hn | hn) <;> simp [hn]
| 16 | 8,886,110.520508 | 2 | 0.636364 | 11 | 552 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
| Mathlib/Combinatorics/Enumerative/Composition.lean | 160 | 161 | theorem sum_blocksFun : β i, c.blocksFun i = n := by |
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
| Mathlib/Combinatorics/Enumerative/Composition.lean | 187 | 189 | theorem length_le : c.length β€ n := by |
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
| 2 | 7.389056 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
| Mathlib/Combinatorics/Enumerative/Composition.lean | 192 | 195 | theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by |
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
| 3 | 20.085537 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
#align composition.length_pos_of_pos Composition.length_pos_of_pos
def sizeUpTo (i : β) : β :=
(c.blocks.take i).sum
#align composition.size_up_to Composition.sizeUpTo
@[simp]
| Mathlib/Combinatorics/Enumerative/Composition.lean | 204 | 204 | theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by | simp [sizeUpTo]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
#align composition.length_pos_of_pos Composition.length_pos_of_pos
def sizeUpTo (i : β) : β :=
(c.blocks.take i).sum
#align composition.size_up_to Composition.sizeUpTo
@[simp]
theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo]
#align composition.size_up_to_zero Composition.sizeUpTo_zero
| Mathlib/Combinatorics/Enumerative/Composition.lean | 207 | 210 | theorem sizeUpTo_ofLength_le (i : β) (h : c.length β€ i) : c.sizeUpTo i = n := by |
dsimp [sizeUpTo]
convert c.blocks_sum
exact take_all_of_le h
| 3 | 20.085537 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
#align composition.length_pos_of_pos Composition.length_pos_of_pos
def sizeUpTo (i : β) : β :=
(c.blocks.take i).sum
#align composition.size_up_to Composition.sizeUpTo
@[simp]
theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo]
#align composition.size_up_to_zero Composition.sizeUpTo_zero
theorem sizeUpTo_ofLength_le (i : β) (h : c.length β€ i) : c.sizeUpTo i = n := by
dsimp [sizeUpTo]
convert c.blocks_sum
exact take_all_of_le h
#align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le
@[simp]
theorem sizeUpTo_length : c.sizeUpTo c.length = n :=
c.sizeUpTo_ofLength_le c.length le_rfl
#align composition.size_up_to_length Composition.sizeUpTo_length
| Mathlib/Combinatorics/Enumerative/Composition.lean | 218 | 220 | theorem sizeUpTo_le (i : β) : c.sizeUpTo i β€ n := by |
conv_rhs => rw [β c.blocks_sum, β sum_take_add_sum_drop _ i]
exact Nat.le_add_right _ _
| 2 | 7.389056 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
#align composition.length_pos_of_pos Composition.length_pos_of_pos
def sizeUpTo (i : β) : β :=
(c.blocks.take i).sum
#align composition.size_up_to Composition.sizeUpTo
@[simp]
theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo]
#align composition.size_up_to_zero Composition.sizeUpTo_zero
theorem sizeUpTo_ofLength_le (i : β) (h : c.length β€ i) : c.sizeUpTo i = n := by
dsimp [sizeUpTo]
convert c.blocks_sum
exact take_all_of_le h
#align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le
@[simp]
theorem sizeUpTo_length : c.sizeUpTo c.length = n :=
c.sizeUpTo_ofLength_le c.length le_rfl
#align composition.size_up_to_length Composition.sizeUpTo_length
theorem sizeUpTo_le (i : β) : c.sizeUpTo i β€ n := by
conv_rhs => rw [β c.blocks_sum, β sum_take_add_sum_drop _ i]
exact Nat.le_add_right _ _
#align composition.size_up_to_le Composition.sizeUpTo_le
| Mathlib/Combinatorics/Enumerative/Composition.lean | 223 | 226 | theorem sizeUpTo_succ {i : β} (h : i < c.length) :
c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get β¨i, hβ© := by |
simp only [sizeUpTo]
rw [sum_take_succ _ _ h]
| 2 | 7.389056 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
#align composition.length_pos_of_pos Composition.length_pos_of_pos
def sizeUpTo (i : β) : β :=
(c.blocks.take i).sum
#align composition.size_up_to Composition.sizeUpTo
@[simp]
theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo]
#align composition.size_up_to_zero Composition.sizeUpTo_zero
theorem sizeUpTo_ofLength_le (i : β) (h : c.length β€ i) : c.sizeUpTo i = n := by
dsimp [sizeUpTo]
convert c.blocks_sum
exact take_all_of_le h
#align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le
@[simp]
theorem sizeUpTo_length : c.sizeUpTo c.length = n :=
c.sizeUpTo_ofLength_le c.length le_rfl
#align composition.size_up_to_length Composition.sizeUpTo_length
theorem sizeUpTo_le (i : β) : c.sizeUpTo i β€ n := by
conv_rhs => rw [β c.blocks_sum, β sum_take_add_sum_drop _ i]
exact Nat.le_add_right _ _
#align composition.size_up_to_le Composition.sizeUpTo_le
theorem sizeUpTo_succ {i : β} (h : i < c.length) :
c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get β¨i, hβ© := by
simp only [sizeUpTo]
rw [sum_take_succ _ _ h]
#align composition.size_up_to_succ Composition.sizeUpTo_succ
theorem sizeUpTo_succ' (i : Fin c.length) :
c.sizeUpTo ((i : β) + 1) = c.sizeUpTo i + c.blocksFun i :=
c.sizeUpTo_succ i.2
#align composition.size_up_to_succ' Composition.sizeUpTo_succ'
| Mathlib/Combinatorics/Enumerative/Composition.lean | 234 | 236 | theorem sizeUpTo_strict_mono {i : β} (h : i < c.length) : c.sizeUpTo i < c.sizeUpTo (i + 1) := by |
rw [c.sizeUpTo_succ h]
simp
| 2 | 7.389056 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
#align composition.length_pos_of_pos Composition.length_pos_of_pos
def sizeUpTo (i : β) : β :=
(c.blocks.take i).sum
#align composition.size_up_to Composition.sizeUpTo
@[simp]
theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo]
#align composition.size_up_to_zero Composition.sizeUpTo_zero
theorem sizeUpTo_ofLength_le (i : β) (h : c.length β€ i) : c.sizeUpTo i = n := by
dsimp [sizeUpTo]
convert c.blocks_sum
exact take_all_of_le h
#align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le
@[simp]
theorem sizeUpTo_length : c.sizeUpTo c.length = n :=
c.sizeUpTo_ofLength_le c.length le_rfl
#align composition.size_up_to_length Composition.sizeUpTo_length
theorem sizeUpTo_le (i : β) : c.sizeUpTo i β€ n := by
conv_rhs => rw [β c.blocks_sum, β sum_take_add_sum_drop _ i]
exact Nat.le_add_right _ _
#align composition.size_up_to_le Composition.sizeUpTo_le
theorem sizeUpTo_succ {i : β} (h : i < c.length) :
c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get β¨i, hβ© := by
simp only [sizeUpTo]
rw [sum_take_succ _ _ h]
#align composition.size_up_to_succ Composition.sizeUpTo_succ
theorem sizeUpTo_succ' (i : Fin c.length) :
c.sizeUpTo ((i : β) + 1) = c.sizeUpTo i + c.blocksFun i :=
c.sizeUpTo_succ i.2
#align composition.size_up_to_succ' Composition.sizeUpTo_succ'
theorem sizeUpTo_strict_mono {i : β} (h : i < c.length) : c.sizeUpTo i < c.sizeUpTo (i + 1) := by
rw [c.sizeUpTo_succ h]
simp
#align composition.size_up_to_strict_mono Composition.sizeUpTo_strict_mono
theorem monotone_sizeUpTo : Monotone c.sizeUpTo :=
monotone_sum_take _
#align composition.monotone_size_up_to Composition.monotone_sizeUpTo
def boundary : Fin (c.length + 1) βͺo Fin (n + 1) :=
(OrderEmbedding.ofStrictMono fun i => β¨c.sizeUpTo i, Nat.lt_succ_of_le (c.sizeUpTo_le i)β©) <|
Fin.strictMono_iff_lt_succ.2 fun β¨_, hiβ© => c.sizeUpTo_strict_mono hi
#align composition.boundary Composition.boundary
@[simp]
| Mathlib/Combinatorics/Enumerative/Composition.lean | 252 | 252 | theorem boundary_zero : c.boundary 0 = 0 := by | simp [boundary, Fin.ext_iff]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace Composition
variable (c : Composition n)
instance (n : β) : ToString (Composition n) :=
β¨fun c => toString c.blocksβ©
abbrev length : β :=
c.blocks.length
#align composition.length Composition.length
theorem blocks_length : c.blocks.length = c.length :=
rfl
#align composition.blocks_length Composition.blocks_length
def blocksFun : Fin c.length β β := c.blocks.get
#align composition.blocks_fun Composition.blocksFun
theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks :=
ofFn_get _
#align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
theorem sum_blocksFun : β i, c.blocksFun i = n := by
conv_rhs => rw [β c.blocks_sum, β ofFn_blocksFun, sum_ofFn]
#align composition.sum_blocks_fun Composition.sum_blocksFun
theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i β c.blocks :=
get_mem _ _ _
#align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks
@[simp]
theorem one_le_blocks {i : β} (h : i β c.blocks) : 1 β€ i :=
c.blocks_pos h
#align composition.one_le_blocks Composition.one_le_blocks
@[simp]
theorem one_le_blocks' {i : β} (h : i < c.length) : 1 β€ c.blocks.get β¨i, hβ© :=
c.one_le_blocks (get_mem (blocks c) i h)
#align composition.one_le_blocks' Composition.one_le_blocks'
@[simp]
theorem blocks_pos' (i : β) (h : i < c.length) : 0 < c.blocks.get β¨i, hβ© :=
c.one_le_blocks' h
#align composition.blocks_pos' Composition.blocks_pos'
theorem one_le_blocksFun (i : Fin c.length) : 1 β€ c.blocksFun i :=
c.one_le_blocks (c.blocksFun_mem_blocks i)
#align composition.one_le_blocks_fun Composition.one_le_blocksFun
theorem length_le : c.length β€ n := by
conv_rhs => rw [β c.blocks_sum]
exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi
#align composition.length_le Composition.length_le
theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by
apply length_pos_of_sum_pos
convert h
exact c.blocks_sum
#align composition.length_pos_of_pos Composition.length_pos_of_pos
def sizeUpTo (i : β) : β :=
(c.blocks.take i).sum
#align composition.size_up_to Composition.sizeUpTo
@[simp]
theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo]
#align composition.size_up_to_zero Composition.sizeUpTo_zero
theorem sizeUpTo_ofLength_le (i : β) (h : c.length β€ i) : c.sizeUpTo i = n := by
dsimp [sizeUpTo]
convert c.blocks_sum
exact take_all_of_le h
#align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le
@[simp]
theorem sizeUpTo_length : c.sizeUpTo c.length = n :=
c.sizeUpTo_ofLength_le c.length le_rfl
#align composition.size_up_to_length Composition.sizeUpTo_length
theorem sizeUpTo_le (i : β) : c.sizeUpTo i β€ n := by
conv_rhs => rw [β c.blocks_sum, β sum_take_add_sum_drop _ i]
exact Nat.le_add_right _ _
#align composition.size_up_to_le Composition.sizeUpTo_le
theorem sizeUpTo_succ {i : β} (h : i < c.length) :
c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get β¨i, hβ© := by
simp only [sizeUpTo]
rw [sum_take_succ _ _ h]
#align composition.size_up_to_succ Composition.sizeUpTo_succ
theorem sizeUpTo_succ' (i : Fin c.length) :
c.sizeUpTo ((i : β) + 1) = c.sizeUpTo i + c.blocksFun i :=
c.sizeUpTo_succ i.2
#align composition.size_up_to_succ' Composition.sizeUpTo_succ'
theorem sizeUpTo_strict_mono {i : β} (h : i < c.length) : c.sizeUpTo i < c.sizeUpTo (i + 1) := by
rw [c.sizeUpTo_succ h]
simp
#align composition.size_up_to_strict_mono Composition.sizeUpTo_strict_mono
theorem monotone_sizeUpTo : Monotone c.sizeUpTo :=
monotone_sum_take _
#align composition.monotone_size_up_to Composition.monotone_sizeUpTo
def boundary : Fin (c.length + 1) βͺo Fin (n + 1) :=
(OrderEmbedding.ofStrictMono fun i => β¨c.sizeUpTo i, Nat.lt_succ_of_le (c.sizeUpTo_le i)β©) <|
Fin.strictMono_iff_lt_succ.2 fun β¨_, hiβ© => c.sizeUpTo_strict_mono hi
#align composition.boundary Composition.boundary
@[simp]
theorem boundary_zero : c.boundary 0 = 0 := by simp [boundary, Fin.ext_iff]
#align composition.boundary_zero Composition.boundary_zero
@[simp]
| Mathlib/Combinatorics/Enumerative/Composition.lean | 256 | 257 | theorem boundary_last : c.boundary (Fin.last c.length) = Fin.last n := by |
simp [boundary, Fin.ext_iff]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace List
variable {Ξ± : Type*}
def splitWrtCompositionAux : List Ξ± β List β β List (List Ξ±)
| _, [] => []
| l, n::ns =>
let (lβ, lβ) := l.splitAt n
lβ::splitWrtCompositionAux lβ ns
#align list.split_wrt_composition_aux List.splitWrtCompositionAux
def splitWrtComposition (l : List Ξ±) (c : Composition n) : List (List Ξ±) :=
splitWrtCompositionAux l c.blocks
#align list.split_wrt_composition List.splitWrtComposition
-- Porting note: can't refer to subeqn in Lean 4 this way, and seems to definitionally simp
--attribute [local simp] splitWrtCompositionAux.equations._eqn_1
@[local simp]
| Mathlib/Combinatorics/Enumerative/Composition.lean | 647 | 649 | theorem splitWrtCompositionAux_cons (l : List Ξ±) (n ns) :
l.splitWrtCompositionAux (n::ns) = take n l::(drop n l).splitWrtCompositionAux ns := by |
simp [splitWrtCompositionAux]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
namespace List
variable {Ξ± : Type*}
def splitWrtCompositionAux : List Ξ± β List β β List (List Ξ±)
| _, [] => []
| l, n::ns =>
let (lβ, lβ) := l.splitAt n
lβ::splitWrtCompositionAux lβ ns
#align list.split_wrt_composition_aux List.splitWrtCompositionAux
def splitWrtComposition (l : List Ξ±) (c : Composition n) : List (List Ξ±) :=
splitWrtCompositionAux l c.blocks
#align list.split_wrt_composition List.splitWrtComposition
-- Porting note: can't refer to subeqn in Lean 4 this way, and seems to definitionally simp
--attribute [local simp] splitWrtCompositionAux.equations._eqn_1
@[local simp]
theorem splitWrtCompositionAux_cons (l : List Ξ±) (n ns) :
l.splitWrtCompositionAux (n::ns) = take n l::(drop n l).splitWrtCompositionAux ns := by
simp [splitWrtCompositionAux]
#align list.split_wrt_composition_aux_cons List.splitWrtCompositionAux_cons
| Mathlib/Combinatorics/Enumerative/Composition.lean | 652 | 656 | theorem length_splitWrtCompositionAux (l : List Ξ±) (ns) :
length (l.splitWrtCompositionAux ns) = ns.length := by |
induction ns generalizing l
Β· simp [splitWrtCompositionAux, *]
Β· simp [*]
| 3 | 20.085537 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
def compositionAsSetEquiv (n : β) : CompositionAsSet n β Finset (Fin (n - 1)) where
toFun c :=
{ i : Fin (n - 1) |
(β¨1 + (i : β), by
apply (add_lt_add_left i.is_lt 1).trans_le
rw [Nat.succ_eq_add_one, add_comm]
exact add_le_add (Nat.sub_le n 1) (le_refl 1)β© :
Fin n.succ) β
c.boundaries }.toFinset
invFun s :=
{ boundaries :=
{ i : Fin n.succ |
i = 0 β¨ i = Fin.last n β¨ β (j : Fin (n - 1)) (_hj : j β s), (i : β) = j + 1 }.toFinset
zero_mem := by simp
getLast_mem := by simp }
left_inv := by
intro c
ext i
simp only [add_comm, Set.toFinset_setOf, Finset.mem_univ,
forall_true_left, Finset.mem_filter, true_and, exists_prop]
constructor
Β· rintro (rfl | rfl | β¨j, hj1, hj2β©)
Β· exact c.zero_mem
Β· exact c.getLast_mem
Β· convert hj1
Β· simp only [or_iff_not_imp_left]
intro i_mem i_ne_zero i_ne_last
simp? [Fin.ext_iff] at i_ne_zero i_ne_last says
simp only [Nat.succ_eq_add_one, Fin.ext_iff, Fin.val_zero, Fin.val_last]
at i_ne_zero i_ne_last
have A : (1 + (i - 1) : β) = (i : β) := by
rw [add_comm]
exact Nat.succ_pred_eq_of_pos (pos_iff_ne_zero.mpr i_ne_zero)
refine β¨β¨i - 1, ?_β©, ?_, ?_β©
Β· have : (i : β) < n + 1 := i.2
simp? [Nat.lt_succ_iff_lt_or_eq, i_ne_last] at this says
simp only [Nat.succ_eq_add_one, Nat.lt_succ_iff_lt_or_eq, i_ne_last, or_false] at this
exact Nat.pred_lt_pred i_ne_zero this
Β· convert i_mem
simp only [ge_iff_le]
rwa [add_comm]
Β· simp only [ge_iff_le]
symm
rwa [add_comm]
right_inv := by
intro s
ext i
have : 1 + (i : β) β n := by
apply ne_of_lt
convert add_lt_add_left i.is_lt 1
rw [add_comm]
apply (Nat.succ_pred_eq_of_pos _).symm
exact (zero_le i.val).trans_lt (i.2.trans_le (Nat.sub_le n 1))
simp only [add_comm, Fin.ext_iff, Fin.val_zero, Fin.val_last, exists_prop, Set.toFinset_setOf,
Finset.mem_univ, forall_true_left, Finset.mem_filter, add_eq_zero_iff, and_false,
add_left_inj, false_or, true_and]
erw [Set.mem_setOf_eq]
simp [this, false_or_iff, add_right_inj, add_eq_zero_iff, one_ne_zero, false_and_iff,
Fin.val_mk]
constructor
Β· intro h
cases' h with n h
Β· rw [add_comm] at this
contradiction
Β· cases' h with w h; cases' h with hβ hβ
rw [β Fin.ext_iff] at hβ
rwa [hβ]
Β· intro h
apply Or.inr
use i, h
#align composition_as_set_equiv compositionAsSetEquiv
instance compositionAsSetFintype (n : β) : Fintype (CompositionAsSet n) :=
Fintype.ofEquiv _ (compositionAsSetEquiv n).symm
#align composition_as_set_fintype compositionAsSetFintype
| Mathlib/Combinatorics/Enumerative/Composition.lean | 843 | 846 | theorem compositionAsSet_card (n : β) : Fintype.card (CompositionAsSet n) = 2 ^ (n - 1) := by |
have : Fintype.card (Finset (Fin (n - 1))) = 2 ^ (n - 1) := by simp
rw [β this]
exact Fintype.card_congr (compositionAsSetEquiv n)
| 3 | 20.085537 | 1 | 0.642857 | 14 | 553 |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Set.Subsingleton
#align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open List
variable {n : β}
@[ext]
structure Composition (n : β) where
blocks : List β
blocks_pos : β {i}, i β blocks β 0 < i
blocks_sum : blocks.sum = n
#align composition Composition
@[ext]
structure CompositionAsSet (n : β) where
boundaries : Finset (Fin n.succ)
zero_mem : (0 : Fin n.succ) β boundaries
getLast_mem : Fin.last n β boundaries
#align composition_as_set CompositionAsSet
instance {n : β} : Inhabited (CompositionAsSet n) :=
β¨β¨Finset.univ, Finset.mem_univ _, Finset.mem_univ _β©β©
def compositionAsSetEquiv (n : β) : CompositionAsSet n β Finset (Fin (n - 1)) where
toFun c :=
{ i : Fin (n - 1) |
(β¨1 + (i : β), by
apply (add_lt_add_left i.is_lt 1).trans_le
rw [Nat.succ_eq_add_one, add_comm]
exact add_le_add (Nat.sub_le n 1) (le_refl 1)β© :
Fin n.succ) β
c.boundaries }.toFinset
invFun s :=
{ boundaries :=
{ i : Fin n.succ |
i = 0 β¨ i = Fin.last n β¨ β (j : Fin (n - 1)) (_hj : j β s), (i : β) = j + 1 }.toFinset
zero_mem := by simp
getLast_mem := by simp }
left_inv := by
intro c
ext i
simp only [add_comm, Set.toFinset_setOf, Finset.mem_univ,
forall_true_left, Finset.mem_filter, true_and, exists_prop]
constructor
Β· rintro (rfl | rfl | β¨j, hj1, hj2β©)
Β· exact c.zero_mem
Β· exact c.getLast_mem
Β· convert hj1
Β· simp only [or_iff_not_imp_left]
intro i_mem i_ne_zero i_ne_last
simp? [Fin.ext_iff] at i_ne_zero i_ne_last says
simp only [Nat.succ_eq_add_one, Fin.ext_iff, Fin.val_zero, Fin.val_last]
at i_ne_zero i_ne_last
have A : (1 + (i - 1) : β) = (i : β) := by
rw [add_comm]
exact Nat.succ_pred_eq_of_pos (pos_iff_ne_zero.mpr i_ne_zero)
refine β¨β¨i - 1, ?_β©, ?_, ?_β©
Β· have : (i : β) < n + 1 := i.2
simp? [Nat.lt_succ_iff_lt_or_eq, i_ne_last] at this says
simp only [Nat.succ_eq_add_one, Nat.lt_succ_iff_lt_or_eq, i_ne_last, or_false] at this
exact Nat.pred_lt_pred i_ne_zero this
Β· convert i_mem
simp only [ge_iff_le]
rwa [add_comm]
Β· simp only [ge_iff_le]
symm
rwa [add_comm]
right_inv := by
intro s
ext i
have : 1 + (i : β) β n := by
apply ne_of_lt
convert add_lt_add_left i.is_lt 1
rw [add_comm]
apply (Nat.succ_pred_eq_of_pos _).symm
exact (zero_le i.val).trans_lt (i.2.trans_le (Nat.sub_le n 1))
simp only [add_comm, Fin.ext_iff, Fin.val_zero, Fin.val_last, exists_prop, Set.toFinset_setOf,
Finset.mem_univ, forall_true_left, Finset.mem_filter, add_eq_zero_iff, and_false,
add_left_inj, false_or, true_and]
erw [Set.mem_setOf_eq]
simp [this, false_or_iff, add_right_inj, add_eq_zero_iff, one_ne_zero, false_and_iff,
Fin.val_mk]
constructor
Β· intro h
cases' h with n h
Β· rw [add_comm] at this
contradiction
Β· cases' h with w h; cases' h with hβ hβ
rw [β Fin.ext_iff] at hβ
rwa [hβ]
Β· intro h
apply Or.inr
use i, h
#align composition_as_set_equiv compositionAsSetEquiv
instance compositionAsSetFintype (n : β) : Fintype (CompositionAsSet n) :=
Fintype.ofEquiv _ (compositionAsSetEquiv n).symm
#align composition_as_set_fintype compositionAsSetFintype
theorem compositionAsSet_card (n : β) : Fintype.card (CompositionAsSet n) = 2 ^ (n - 1) := by
have : Fintype.card (Finset (Fin (n - 1))) = 2 ^ (n - 1) := by simp
rw [β this]
exact Fintype.card_congr (compositionAsSetEquiv n)
#align composition_as_set_card compositionAsSet_card
namespace CompositionAsSet
variable (c : CompositionAsSet n)
theorem boundaries_nonempty : c.boundaries.Nonempty :=
β¨0, c.zero_memβ©
#align composition_as_set.boundaries_nonempty CompositionAsSet.boundaries_nonempty
theorem card_boundaries_pos : 0 < Finset.card c.boundaries :=
Finset.card_pos.mpr c.boundaries_nonempty
#align composition_as_set.card_boundaries_pos CompositionAsSet.card_boundaries_pos
def length : β :=
Finset.card c.boundaries - 1
#align composition_as_set.length CompositionAsSet.length
theorem card_boundaries_eq_succ_length : c.boundaries.card = c.length + 1 :=
(tsub_eq_iff_eq_add_of_le (Nat.succ_le_of_lt c.card_boundaries_pos)).mp rfl
#align composition_as_set.card_boundaries_eq_succ_length CompositionAsSet.card_boundaries_eq_succ_length
| Mathlib/Combinatorics/Enumerative/Composition.lean | 870 | 872 | theorem length_lt_card_boundaries : c.length < c.boundaries.card := by |
rw [c.card_boundaries_eq_succ_length]
exact lt_add_one _
| 2 | 7.389056 | 1 | 0.642857 | 14 | 553 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
| Mathlib/Data/Nat/Count.lean | 38 | 39 | theorem count_zero : count p 0 = 0 := by |
rw [count, List.range_zero, List.countP, List.countP.go]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
| Mathlib/Data/Nat/Count.lean | 54 | 56 | theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by |
rw [count, List.countP_eq_length_filter]
rfl
| 2 | 7.389056 | 1 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
| Mathlib/Data/Nat/Count.lean | 60 | 62 | theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by |
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
| 2 | 7.389056 | 1 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
| Mathlib/Data/Nat/Count.lean | 65 | 66 | theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by |
split_ifs with h <;> simp [count, List.range_succ, h]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
| Mathlib/Data/Nat/Count.lean | 74 | 83 | theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by |
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
| 9 | 8,103.083928 | 2 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
| Mathlib/Data/Nat/Count.lean | 86 | 88 | theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by |
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
| 2 | 7.389056 | 1 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
| Mathlib/Data/Nat/Count.lean | 91 | 91 | theorem count_one : count p 1 = if p 0 then 1 else 0 := by | simp [count_succ]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
| Mathlib/Data/Nat/Count.lean | 94 | 96 | theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by |
rw [count_add', count_one]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
| Mathlib/Data/Nat/Count.lean | 102 | 103 | theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by |
by_cases h : p n <;> simp [count_succ, h]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
| Mathlib/Data/Nat/Count.lean | 106 | 107 | theorem count_succ_eq_succ_count_iff {n : β} : count p (n + 1) = count p n + 1 β p n := by |
by_cases h : p n <;> simp [h, count_succ]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
theorem count_succ_eq_succ_count_iff {n : β} : count p (n + 1) = count p n + 1 β p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_succ_count_iff Nat.count_succ_eq_succ_count_iff
| Mathlib/Data/Nat/Count.lean | 110 | 111 | theorem count_succ_eq_count_iff {n : β} : count p (n + 1) = count p n β Β¬p n := by |
by_cases h : p n <;> simp [h, count_succ]
| 1 | 2.718282 | 0 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
theorem count_succ_eq_succ_count_iff {n : β} : count p (n + 1) = count p n + 1 β p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_succ_count_iff Nat.count_succ_eq_succ_count_iff
theorem count_succ_eq_count_iff {n : β} : count p (n + 1) = count p n β Β¬p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_count_iff Nat.count_succ_eq_count_iff
alias β¨_, count_succ_eq_succ_countβ© := count_succ_eq_succ_count_iff
#align nat.count_succ_eq_succ_count Nat.count_succ_eq_succ_count
alias β¨_, count_succ_eq_countβ© := count_succ_eq_count_iff
#align nat.count_succ_eq_count Nat.count_succ_eq_count
| Mathlib/Data/Nat/Count.lean | 120 | 122 | theorem count_le_cardinal (n : β) : (count p n : Cardinal) β€ Cardinal.mk { k | p k } := by |
rw [count_eq_card_fintype, β Cardinal.mk_fintype]
exact Cardinal.mk_subtype_mono fun x hx β¦ hx.2
| 2 | 7.389056 | 1 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
theorem count_succ_eq_succ_count_iff {n : β} : count p (n + 1) = count p n + 1 β p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_succ_count_iff Nat.count_succ_eq_succ_count_iff
theorem count_succ_eq_count_iff {n : β} : count p (n + 1) = count p n β Β¬p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_count_iff Nat.count_succ_eq_count_iff
alias β¨_, count_succ_eq_succ_countβ© := count_succ_eq_succ_count_iff
#align nat.count_succ_eq_succ_count Nat.count_succ_eq_succ_count
alias β¨_, count_succ_eq_countβ© := count_succ_eq_count_iff
#align nat.count_succ_eq_count Nat.count_succ_eq_count
theorem count_le_cardinal (n : β) : (count p n : Cardinal) β€ Cardinal.mk { k | p k } := by
rw [count_eq_card_fintype, β Cardinal.mk_fintype]
exact Cardinal.mk_subtype_mono fun x hx β¦ hx.2
#align nat.count_le_cardinal Nat.count_le_cardinal
theorem lt_of_count_lt_count {a b : β} (h : count p a < count p b) : a < b :=
(count_monotone p).reflect_lt h
#align nat.lt_of_count_lt_count Nat.lt_of_count_lt_count
theorem count_strict_mono {m n : β} (hm : p m) (hmn : m < n) : count p m < count p n :=
(count_lt_count_succ_iff.2 hm).trans_le <| count_monotone _ (Nat.succ_le_iff.2 hmn)
#align nat.count_strict_mono Nat.count_strict_mono
| Mathlib/Data/Nat/Count.lean | 133 | 137 | theorem count_injective {m n : β} (hm : p m) (hn : p n) (heq : count p m = count p n) : m = n := by |
by_contra! h : m β n
wlog hmn : m < n
Β· exact this hn hm heq.symm h.symm (h.lt_or_lt.resolve_left hmn)
Β· simpa [heq] using count_strict_mono hm hmn
| 4 | 54.59815 | 2 | 0.642857 | 14 | 554 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : β β Prop)
section Count
variable [DecidablePred p]
def count (n : β) : β :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : β) : Fintype { i // i < n β§ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : β) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : β) : count p n = Fintype.card { k : β // k < n β§ p k } := by
rw [count_eq_card_filter_range, β Fintype.card_ofFinset, β CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : β) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n β¦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : β) : count p (a + b) = count p a + count (fun k β¦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx β¨c, _, rflβ©
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
theorem count_succ_eq_succ_count_iff {n : β} : count p (n + 1) = count p n + 1 β p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_succ_count_iff Nat.count_succ_eq_succ_count_iff
theorem count_succ_eq_count_iff {n : β} : count p (n + 1) = count p n β Β¬p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_count_iff Nat.count_succ_eq_count_iff
alias β¨_, count_succ_eq_succ_countβ© := count_succ_eq_succ_count_iff
#align nat.count_succ_eq_succ_count Nat.count_succ_eq_succ_count
alias β¨_, count_succ_eq_countβ© := count_succ_eq_count_iff
#align nat.count_succ_eq_count Nat.count_succ_eq_count
theorem count_le_cardinal (n : β) : (count p n : Cardinal) β€ Cardinal.mk { k | p k } := by
rw [count_eq_card_fintype, β Cardinal.mk_fintype]
exact Cardinal.mk_subtype_mono fun x hx β¦ hx.2
#align nat.count_le_cardinal Nat.count_le_cardinal
theorem lt_of_count_lt_count {a b : β} (h : count p a < count p b) : a < b :=
(count_monotone p).reflect_lt h
#align nat.lt_of_count_lt_count Nat.lt_of_count_lt_count
theorem count_strict_mono {m n : β} (hm : p m) (hmn : m < n) : count p m < count p n :=
(count_lt_count_succ_iff.2 hm).trans_le <| count_monotone _ (Nat.succ_le_iff.2 hmn)
#align nat.count_strict_mono Nat.count_strict_mono
theorem count_injective {m n : β} (hm : p m) (hn : p n) (heq : count p m = count p n) : m = n := by
by_contra! h : m β n
wlog hmn : m < n
Β· exact this hn hm heq.symm h.symm (h.lt_or_lt.resolve_left hmn)
Β· simpa [heq] using count_strict_mono hm hmn
#align nat.count_injective Nat.count_injective
| Mathlib/Data/Nat/Count.lean | 140 | 142 | theorem count_le_card (hp : (setOf p).Finite) (n : β) : count p n β€ hp.toFinset.card := by |
rw [count_eq_card_filter_range]
exact Finset.card_mono fun x hx β¦ hp.mem_toFinset.2 (mem_filter.1 hx).2
| 2 | 7.389056 | 1 | 0.642857 | 14 | 554 |
import Mathlib.Data.Fin.VecNotation
import Mathlib.SetTheory.Cardinal.Basic
#align_import model_theory.basic from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
set_option autoImplicit true
universe u v u' v' w w'
open Cardinal
open Cardinal
namespace FirstOrder
-- intended to be used with explicit universe parameters
@[nolint checkUnivs]
structure Language where
Functions : β β Type u
Relations : β β Type v
#align first_order.language FirstOrder.Language
--@[simp]
def Sequenceβ (aβ aβ aβ : Type u) : β β Type u
| 0 => aβ
| 1 => aβ
| 2 => aβ
| _ => PEmpty
#align first_order.sequenceβ FirstOrder.Sequenceβ
namespace Sequenceβ
variable (aβ aβ aβ : Type u)
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 0) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 1) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 2) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance {n : β} : IsEmpty (Sequenceβ aβ aβ aβ (n + 3)) := inferInstanceAs (IsEmpty PEmpty)
@[simp]
| Mathlib/ModelTheory/Basic.lean | 95 | 100 | theorem lift_mk {i : β} :
Cardinal.lift.{v,u} #(Sequenceβ aβ aβ aβ i)
= #(Sequenceβ (ULift.{v,u} aβ) (ULift.{v,u} aβ) (ULift.{v,u} aβ) i) := by |
rcases i with (_ | _ | _ | i) <;>
simp only [Sequenceβ, mk_uLift, Nat.succ_ne_zero, IsEmpty.forall_iff, Nat.succ.injEq,
add_eq_zero, OfNat.ofNat_ne_zero, and_false, one_ne_zero, mk_eq_zero, lift_zero]
| 3 | 20.085537 | 1 | 0.666667 | 3 | 555 |
import Mathlib.Data.Fin.VecNotation
import Mathlib.SetTheory.Cardinal.Basic
#align_import model_theory.basic from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
set_option autoImplicit true
universe u v u' v' w w'
open Cardinal
open Cardinal
namespace FirstOrder
-- intended to be used with explicit universe parameters
@[nolint checkUnivs]
structure Language where
Functions : β β Type u
Relations : β β Type v
#align first_order.language FirstOrder.Language
--@[simp]
def Sequenceβ (aβ aβ aβ : Type u) : β β Type u
| 0 => aβ
| 1 => aβ
| 2 => aβ
| _ => PEmpty
#align first_order.sequenceβ FirstOrder.Sequenceβ
namespace Sequenceβ
variable (aβ aβ aβ : Type u)
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 0) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 1) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 2) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance {n : β} : IsEmpty (Sequenceβ aβ aβ aβ (n + 3)) := inferInstanceAs (IsEmpty PEmpty)
@[simp]
theorem lift_mk {i : β} :
Cardinal.lift.{v,u} #(Sequenceβ aβ aβ aβ i)
= #(Sequenceβ (ULift.{v,u} aβ) (ULift.{v,u} aβ) (ULift.{v,u} aβ) i) := by
rcases i with (_ | _ | _ | i) <;>
simp only [Sequenceβ, mk_uLift, Nat.succ_ne_zero, IsEmpty.forall_iff, Nat.succ.injEq,
add_eq_zero, OfNat.ofNat_ne_zero, and_false, one_ne_zero, mk_eq_zero, lift_zero]
#align first_order.sequenceβ.lift_mk FirstOrder.Sequenceβ.lift_mk
@[simp]
| Mathlib/ModelTheory/Basic.lean | 104 | 106 | theorem sum_card : Cardinal.sum (fun i => #(Sequenceβ aβ aβ aβ i)) = #aβ + #aβ + #aβ := by |
rw [sum_nat_eq_add_sum_succ, sum_nat_eq_add_sum_succ, sum_nat_eq_add_sum_succ]
simp [add_assoc, Sequenceβ]
| 2 | 7.389056 | 1 | 0.666667 | 3 | 555 |
import Mathlib.Data.Fin.VecNotation
import Mathlib.SetTheory.Cardinal.Basic
#align_import model_theory.basic from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
set_option autoImplicit true
universe u v u' v' w w'
open Cardinal
open Cardinal
namespace FirstOrder
-- intended to be used with explicit universe parameters
@[nolint checkUnivs]
structure Language where
Functions : β β Type u
Relations : β β Type v
#align first_order.language FirstOrder.Language
--@[simp]
def Sequenceβ (aβ aβ aβ : Type u) : β β Type u
| 0 => aβ
| 1 => aβ
| 2 => aβ
| _ => PEmpty
#align first_order.sequenceβ FirstOrder.Sequenceβ
namespace Language
@[simps]
protected def mkβ (c fβ fβ : Type u) (rβ rβ : Type v) : Language :=
β¨Sequenceβ c fβ fβ, Sequenceβ PEmpty rβ rββ©
#align first_order.language.mkβ FirstOrder.Language.mkβ
protected def empty : Language :=
β¨fun _ => Empty, fun _ => Emptyβ©
#align first_order.language.empty FirstOrder.Language.empty
instance : Inhabited Language :=
β¨Language.emptyβ©
protected def sum (L : Language.{u, v}) (L' : Language.{u', v'}) : Language :=
β¨fun n => Sum (L.Functions n) (L'.Functions n), fun n => Sum (L.Relations n) (L'.Relations n)β©
#align first_order.language.sum FirstOrder.Language.sum
variable (L : Language.{u, v})
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
protected def Constants :=
L.Functions 0
#align first_order.language.constants FirstOrder.Language.Constants
@[simp]
theorem constants_mkβ (c fβ fβ : Type u) (rβ rβ : Type v) :
(Language.mkβ c fβ fβ rβ rβ).Constants = c :=
rfl
#align first_order.language.constants_mkβ FirstOrder.Language.constants_mkβ
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
def Symbols :=
Sum (Ξ£l, L.Functions l) (Ξ£l, L.Relations l)
#align first_order.language.symbols FirstOrder.Language.Symbols
def card : Cardinal :=
#L.Symbols
#align first_order.language.card FirstOrder.Language.card
class IsRelational : Prop where
empty_functions : β n, IsEmpty (L.Functions n)
#align first_order.language.is_relational FirstOrder.Language.IsRelational
class IsAlgebraic : Prop where
empty_relations : β n, IsEmpty (L.Relations n)
#align first_order.language.is_algebraic FirstOrder.Language.IsAlgebraic
variable {L} {L' : Language.{u', v'}}
| Mathlib/ModelTheory/Basic.lean | 174 | 178 | theorem card_eq_card_functions_add_card_relations :
L.card =
(Cardinal.sum fun l => Cardinal.lift.{v} #(L.Functions l)) +
Cardinal.sum fun l => Cardinal.lift.{u} #(L.Relations l) := by |
simp [card, Symbols]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 555 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode Ξ±) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
Β· apply min?_reverse
Β· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode Ξ±) : t.reverse.max? = t.min? := by
rw [β min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : Β¬x β (.nil : RBNode Ξ±) := by simp [(Β·βΒ·), EMem]
@[simp] theorem mem_node {y c a x b} :
y β (.node c a x b : RBNode Ξ±) β y = x β¨ y β a β¨ y β b := by simp [(Β·βΒ·), EMem]
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 32 | 33 | theorem All_def {t : RBNode Ξ±} : t.All p β β x β t, p x := by |
induction t <;> simp [or_imp, forall_and, *]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 556 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode Ξ±) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
Β· apply min?_reverse
Β· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode Ξ±) : t.reverse.max? = t.min? := by
rw [β min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : Β¬x β (.nil : RBNode Ξ±) := by simp [(Β·βΒ·), EMem]
@[simp] theorem mem_node {y c a x b} :
y β (.node c a x b : RBNode Ξ±) β y = x β¨ y β a β¨ y β b := by simp [(Β·βΒ·), EMem]
theorem All_def {t : RBNode Ξ±} : t.All p β β x β t, p x := by
induction t <;> simp [or_imp, forall_and, *]
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 35 | 36 | theorem Any_def {t : RBNode Ξ±} : t.Any p β β x β t, p x := by |
induction t <;> simp [or_and_right, exists_or, *]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 556 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode Ξ±) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
Β· apply min?_reverse
Β· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode Ξ±) : t.reverse.max? = t.min? := by
rw [β min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : Β¬x β (.nil : RBNode Ξ±) := by simp [(Β·βΒ·), EMem]
@[simp] theorem mem_node {y c a x b} :
y β (.node c a x b : RBNode Ξ±) β y = x β¨ y β a β¨ y β b := by simp [(Β·βΒ·), EMem]
theorem All_def {t : RBNode Ξ±} : t.All p β β x β t, p x := by
induction t <;> simp [or_imp, forall_and, *]
theorem Any_def {t : RBNode Ξ±} : t.Any p β β x β t, p x := by
induction t <;> simp [or_and_right, exists_or, *]
theorem memP_def : MemP cut t β β x β t, cut x = .eq := Any_def
theorem mem_def : Mem cmp x t β β y β t, cmp x y = .eq := Any_def
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 42 | 43 | theorem mem_congr [@TransCmp Ξ± cmp] {t : RBNode Ξ±} (h : cmp x y = .eq) :
Mem cmp x t β Mem cmp y t := by | simp [Mem, TransCmp.cmp_congr_left' h]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 556 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode Ξ±) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
Β· apply min?_reverse
Β· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode Ξ±) : t.reverse.max? = t.min? := by
rw [β min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : Β¬x β (.nil : RBNode Ξ±) := by simp [(Β·βΒ·), EMem]
@[simp] theorem mem_node {y c a x b} :
y β (.node c a x b : RBNode Ξ±) β y = x β¨ y β a β¨ y β b := by simp [(Β·βΒ·), EMem]
theorem All_def {t : RBNode Ξ±} : t.All p β β x β t, p x := by
induction t <;> simp [or_imp, forall_and, *]
theorem Any_def {t : RBNode Ξ±} : t.Any p β β x β t, p x := by
induction t <;> simp [or_and_right, exists_or, *]
theorem memP_def : MemP cut t β β x β t, cut x = .eq := Any_def
theorem mem_def : Mem cmp x t β β y β t, cmp x y = .eq := Any_def
theorem mem_congr [@TransCmp Ξ± cmp] {t : RBNode Ξ±} (h : cmp x y = .eq) :
Mem cmp x t β Mem cmp y t := by simp [Mem, TransCmp.cmp_congr_left' h]
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 45 | 65 | theorem isOrdered_iff' [@TransCmp Ξ± cmp] {t : RBNode Ξ±} :
isOrdered cmp t L R β
(β a β L, t.All (cmpLT cmp a Β·)) β§
(β a β R, t.All (cmpLT cmp Β· a)) β§
(β a β L, β b β R, cmpLT cmp a b) β§
Ordered cmp t := by |
induction t generalizing L R with
| nil =>
simp [isOrdered]; split <;> simp [cmpLT_iff]
next h => intro _ ha _ hb; cases h _ _ ha hb
| node _ l v r =>
simp [isOrdered, *]
exact β¨
fun β¨β¨Ll, lv, Lv, olβ©, β¨vr, rR, vR, orβ©β© => β¨
fun _ h => β¨Lv _ h, Ll _ h, (Lv _ h).trans_l vrβ©,
fun _ h => β¨vR _ h, (vR _ h).trans_r lv, rR _ hβ©,
fun _ hL _ hR => (Lv _ hL).trans (vR _ hR),
lv, vr, ol, orβ©,
fun β¨hL, hR, _, lv, vr, ol, orβ© => β¨
β¨fun _ h => (hL _ h).2.1, lv, fun _ h => (hL _ h).1, olβ©,
β¨vr, fun _ h => (hR _ h).2.2, fun _ h => (hR _ h).1, orβ©β©β©
| 15 | 3,269,017.372472 | 2 | 0.666667 | 6 | 556 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode Ξ±) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
Β· apply min?_reverse
Β· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode Ξ±) : t.reverse.max? = t.min? := by
rw [β min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : Β¬x β (.nil : RBNode Ξ±) := by simp [(Β·βΒ·), EMem]
@[simp] theorem mem_node {y c a x b} :
y β (.node c a x b : RBNode Ξ±) β y = x β¨ y β a β¨ y β b := by simp [(Β·βΒ·), EMem]
theorem All_def {t : RBNode Ξ±} : t.All p β β x β t, p x := by
induction t <;> simp [or_imp, forall_and, *]
theorem Any_def {t : RBNode Ξ±} : t.Any p β β x β t, p x := by
induction t <;> simp [or_and_right, exists_or, *]
theorem memP_def : MemP cut t β β x β t, cut x = .eq := Any_def
theorem mem_def : Mem cmp x t β β y β t, cmp x y = .eq := Any_def
theorem mem_congr [@TransCmp Ξ± cmp] {t : RBNode Ξ±} (h : cmp x y = .eq) :
Mem cmp x t β Mem cmp y t := by simp [Mem, TransCmp.cmp_congr_left' h]
theorem isOrdered_iff' [@TransCmp Ξ± cmp] {t : RBNode Ξ±} :
isOrdered cmp t L R β
(β a β L, t.All (cmpLT cmp a Β·)) β§
(β a β R, t.All (cmpLT cmp Β· a)) β§
(β a β L, β b β R, cmpLT cmp a b) β§
Ordered cmp t := by
induction t generalizing L R with
| nil =>
simp [isOrdered]; split <;> simp [cmpLT_iff]
next h => intro _ ha _ hb; cases h _ _ ha hb
| node _ l v r =>
simp [isOrdered, *]
exact β¨
fun β¨β¨Ll, lv, Lv, olβ©, β¨vr, rR, vR, orβ©β© => β¨
fun _ h => β¨Lv _ h, Ll _ h, (Lv _ h).trans_l vrβ©,
fun _ h => β¨vR _ h, (vR _ h).trans_r lv, rR _ hβ©,
fun _ hL _ hR => (Lv _ hL).trans (vR _ hR),
lv, vr, ol, orβ©,
fun β¨hL, hR, _, lv, vr, ol, orβ© => β¨
β¨fun _ h => (hL _ h).2.1, lv, fun _ h => (hL _ h).1, olβ©,
β¨vr, fun _ h => (hR _ h).2.2, fun _ h => (hR _ h).1, orβ©β©β©
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 67 | 68 | theorem isOrdered_iff [@TransCmp Ξ± cmp] {t : RBNode Ξ±} :
isOrdered cmp t β Ordered cmp t := by | simp [isOrdered_iff']
| 1 | 2.718282 | 0 | 0.666667 | 6 | 556 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode Ξ±) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
Β· apply min?_reverse
Β· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode Ξ±) : t.reverse.max? = t.min? := by
rw [β min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : Β¬x β (.nil : RBNode Ξ±) := by simp [(Β·βΒ·), EMem]
@[simp] theorem mem_node {y c a x b} :
y β (.node c a x b : RBNode Ξ±) β y = x β¨ y β a β¨ y β b := by simp [(Β·βΒ·), EMem]
theorem All_def {t : RBNode Ξ±} : t.All p β β x β t, p x := by
induction t <;> simp [or_imp, forall_and, *]
theorem Any_def {t : RBNode Ξ±} : t.Any p β β x β t, p x := by
induction t <;> simp [or_and_right, exists_or, *]
theorem memP_def : MemP cut t β β x β t, cut x = .eq := Any_def
theorem mem_def : Mem cmp x t β β y β t, cmp x y = .eq := Any_def
theorem mem_congr [@TransCmp Ξ± cmp] {t : RBNode Ξ±} (h : cmp x y = .eq) :
Mem cmp x t β Mem cmp y t := by simp [Mem, TransCmp.cmp_congr_left' h]
theorem isOrdered_iff' [@TransCmp Ξ± cmp] {t : RBNode Ξ±} :
isOrdered cmp t L R β
(β a β L, t.All (cmpLT cmp a Β·)) β§
(β a β R, t.All (cmpLT cmp Β· a)) β§
(β a β L, β b β R, cmpLT cmp a b) β§
Ordered cmp t := by
induction t generalizing L R with
| nil =>
simp [isOrdered]; split <;> simp [cmpLT_iff]
next h => intro _ ha _ hb; cases h _ _ ha hb
| node _ l v r =>
simp [isOrdered, *]
exact β¨
fun β¨β¨Ll, lv, Lv, olβ©, β¨vr, rR, vR, orβ©β© => β¨
fun _ h => β¨Lv _ h, Ll _ h, (Lv _ h).trans_l vrβ©,
fun _ h => β¨vR _ h, (vR _ h).trans_r lv, rR _ hβ©,
fun _ hL _ hR => (Lv _ hL).trans (vR _ hR),
lv, vr, ol, orβ©,
fun β¨hL, hR, _, lv, vr, ol, orβ© => β¨
β¨fun _ h => (hL _ h).2.1, lv, fun _ h => (hL _ h).1, olβ©,
β¨vr, fun _ h => (hR _ h).2.2, fun _ h => (hR _ h).1, orβ©β©β©
theorem isOrdered_iff [@TransCmp Ξ± cmp] {t : RBNode Ξ±} :
isOrdered cmp t β Ordered cmp t := by simp [isOrdered_iff']
instance (cmp) [@TransCmp Ξ± cmp] (t) : Decidable (Ordered cmp t) := decidable_of_iff _ isOrdered_iff
class IsCut (cmp : Ξ± β Ξ± β Ordering) (cut : Ξ± β Ordering) : Prop where
le_lt_trans [TransCmp cmp] : cmp x y β .gt β cut x = .lt β cut y = .lt
le_gt_trans [TransCmp cmp] : cmp x y β .gt β cut y = .gt β cut x = .gt
theorem IsCut.lt_trans [IsCut cmp cut] [TransCmp cmp]
(H : cmp x y = .lt) : cut x = .lt β cut y = .lt :=
IsCut.le_lt_trans <| TransCmp.gt_asymm <| OrientedCmp.cmp_eq_gt.2 H
theorem IsCut.gt_trans [IsCut cmp cut] [TransCmp cmp]
(H : cmp x y = .lt) : cut y = .gt β cut x = .gt :=
IsCut.le_gt_trans <| TransCmp.gt_asymm <| OrientedCmp.cmp_eq_gt.2 H
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 92 | 100 | theorem IsCut.congr [IsCut cmp cut] [TransCmp cmp] (H : cmp x y = .eq) : cut x = cut y := by |
cases ey : cut y
Β· exact IsCut.le_lt_trans (fun h => nomatch H.symm.trans <| OrientedCmp.cmp_eq_gt.1 h) ey
Β· cases ex : cut x
Β· exact IsCut.le_lt_trans (fun h => nomatch H.symm.trans h) ex |>.symm.trans ey
Β· rfl
Β· refine IsCut.le_gt_trans (cmp := cmp) (fun h => ?_) ex |>.symm.trans ey
cases H.symm.trans <| OrientedCmp.cmp_eq_gt.1 h
Β· exact IsCut.le_gt_trans (fun h => nomatch H.symm.trans h) ey
| 8 | 2,980.957987 | 2 | 0.666667 | 6 | 556 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Group.Nat
import Mathlib.Data.Set.Basic
#align_import data.set.equitable from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {Ξ± Ξ² : Type*}
namespace Set
def EquitableOn [LE Ξ²] [Add Ξ²] [One Ξ²] (s : Set Ξ±) (f : Ξ± β Ξ²) : Prop :=
β β¦aβ aββ¦, aβ β s β aβ β s β f aβ β€ f aβ + 1
#align set.equitable_on Set.EquitableOn
@[simp]
theorem equitableOn_empty [LE Ξ²] [Add Ξ²] [One Ξ²] (f : Ξ± β Ξ²) : EquitableOn β
f := fun a _ ha =>
(Set.not_mem_empty a ha).elim
#align set.equitable_on_empty Set.equitableOn_empty
| Mathlib/Data/Set/Equitable.lean | 42 | 54 | theorem equitableOn_iff_exists_le_le_add_one {s : Set Ξ±} {f : Ξ± β β} :
s.EquitableOn f β β b, β a β s, b β€ f a β§ f a β€ b + 1 := by |
refine β¨?_, fun β¨b, hbβ© x y hx hy => (hb x hx).2.trans (add_le_add_right (hb y hy).1 _)β©
obtain rfl | β¨x, hxβ© := s.eq_empty_or_nonempty
Β· simp
intro hs
by_cases h : β y β s, f x β€ f y
Β· exact β¨f x, fun y hy => β¨h _ hy, hs hy hxβ©β©
push_neg at h
obtain β¨w, hw, hwxβ© := h
refine β¨f w, fun y hy => β¨Nat.le_of_succ_le_succ ?_, hs hy hwβ©β©
rw [(Nat.succ_le_of_lt hwx).antisymm (hs hx hw)]
exact hs hx hy
| 11 | 59,874.141715 | 2 | 0.666667 | 3 | 557 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Group.Nat
import Mathlib.Data.Set.Basic
#align_import data.set.equitable from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {Ξ± Ξ² : Type*}
namespace Set
def EquitableOn [LE Ξ²] [Add Ξ²] [One Ξ²] (s : Set Ξ±) (f : Ξ± β Ξ²) : Prop :=
β β¦aβ aββ¦, aβ β s β aβ β s β f aβ β€ f aβ + 1
#align set.equitable_on Set.EquitableOn
@[simp]
theorem equitableOn_empty [LE Ξ²] [Add Ξ²] [One Ξ²] (f : Ξ± β Ξ²) : EquitableOn β
f := fun a _ ha =>
(Set.not_mem_empty a ha).elim
#align set.equitable_on_empty Set.equitableOn_empty
theorem equitableOn_iff_exists_le_le_add_one {s : Set Ξ±} {f : Ξ± β β} :
s.EquitableOn f β β b, β a β s, b β€ f a β§ f a β€ b + 1 := by
refine β¨?_, fun β¨b, hbβ© x y hx hy => (hb x hx).2.trans (add_le_add_right (hb y hy).1 _)β©
obtain rfl | β¨x, hxβ© := s.eq_empty_or_nonempty
Β· simp
intro hs
by_cases h : β y β s, f x β€ f y
Β· exact β¨f x, fun y hy => β¨h _ hy, hs hy hxβ©β©
push_neg at h
obtain β¨w, hw, hwxβ© := h
refine β¨f w, fun y hy => β¨Nat.le_of_succ_le_succ ?_, hs hy hwβ©β©
rw [(Nat.succ_le_of_lt hwx).antisymm (hs hx hw)]
exact hs hx hy
#align set.equitable_on_iff_exists_le_le_add_one Set.equitableOn_iff_exists_le_le_add_one
| Mathlib/Data/Set/Equitable.lean | 57 | 59 | theorem equitableOn_iff_exists_image_subset_icc {s : Set Ξ±} {f : Ξ± β β} :
s.EquitableOn f β β b, f '' s β Icc b (b + 1) := by |
simpa only [image_subset_iff] using equitableOn_iff_exists_le_le_add_one
| 1 | 2.718282 | 0 | 0.666667 | 3 | 557 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Group.Nat
import Mathlib.Data.Set.Basic
#align_import data.set.equitable from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {Ξ± Ξ² : Type*}
namespace Set
def EquitableOn [LE Ξ²] [Add Ξ²] [One Ξ²] (s : Set Ξ±) (f : Ξ± β Ξ²) : Prop :=
β β¦aβ aββ¦, aβ β s β aβ β s β f aβ β€ f aβ + 1
#align set.equitable_on Set.EquitableOn
@[simp]
theorem equitableOn_empty [LE Ξ²] [Add Ξ²] [One Ξ²] (f : Ξ± β Ξ²) : EquitableOn β
f := fun a _ ha =>
(Set.not_mem_empty a ha).elim
#align set.equitable_on_empty Set.equitableOn_empty
theorem equitableOn_iff_exists_le_le_add_one {s : Set Ξ±} {f : Ξ± β β} :
s.EquitableOn f β β b, β a β s, b β€ f a β§ f a β€ b + 1 := by
refine β¨?_, fun β¨b, hbβ© x y hx hy => (hb x hx).2.trans (add_le_add_right (hb y hy).1 _)β©
obtain rfl | β¨x, hxβ© := s.eq_empty_or_nonempty
Β· simp
intro hs
by_cases h : β y β s, f x β€ f y
Β· exact β¨f x, fun y hy => β¨h _ hy, hs hy hxβ©β©
push_neg at h
obtain β¨w, hw, hwxβ© := h
refine β¨f w, fun y hy => β¨Nat.le_of_succ_le_succ ?_, hs hy hwβ©β©
rw [(Nat.succ_le_of_lt hwx).antisymm (hs hx hw)]
exact hs hx hy
#align set.equitable_on_iff_exists_le_le_add_one Set.equitableOn_iff_exists_le_le_add_one
theorem equitableOn_iff_exists_image_subset_icc {s : Set Ξ±} {f : Ξ± β β} :
s.EquitableOn f β β b, f '' s β Icc b (b + 1) := by
simpa only [image_subset_iff] using equitableOn_iff_exists_le_le_add_one
#align set.equitable_on_iff_exists_image_subset_Icc Set.equitableOn_iff_exists_image_subset_icc
| Mathlib/Data/Set/Equitable.lean | 62 | 64 | theorem equitableOn_iff_exists_eq_eq_add_one {s : Set Ξ±} {f : Ξ± β β} :
s.EquitableOn f β β b, β a β s, f a = b β¨ f a = b + 1 := by |
simp_rw [equitableOn_iff_exists_le_le_add_one, Nat.le_and_le_add_one_iff]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 557 |
import Mathlib.LinearAlgebra.Ray
import Mathlib.LinearAlgebra.Determinant
#align_import linear_algebra.orientation from "leanprover-community/mathlib"@"0c1d80f5a86b36c1db32e021e8d19ae7809d5b79"
noncomputable section
section OrderedCommSemiring
variable (R : Type*) [StrictOrderedCommSemiring R]
variable (M : Type*) [AddCommMonoid M] [Module R M]
variable {N : Type*} [AddCommMonoid N] [Module R N]
variable (ΞΉ ΞΉ' : Type*)
abbrev Orientation := Module.Ray R (M [β^ΞΉ]ββ[R] R)
#align orientation Orientation
class Module.Oriented where
positiveOrientation : Orientation R M ΞΉ
#align module.oriented Module.Oriented
export Module.Oriented (positiveOrientation)
variable {R M}
def Orientation.map (e : M ββ[R] N) : Orientation R M ΞΉ β Orientation R N ΞΉ :=
Module.Ray.map <| AlternatingMap.domLCongr R R ΞΉ R e
#align orientation.map Orientation.map
@[simp]
theorem Orientation.map_apply (e : M ββ[R] N) (v : M [β^ΞΉ]ββ[R] R) (hv : v β 0) :
Orientation.map ΞΉ e (rayOfNeZero _ v hv) =
rayOfNeZero _ (v.compLinearMap e.symm) (mt (v.compLinearEquiv_eq_zero_iff e.symm).mp hv) :=
rfl
#align orientation.map_apply Orientation.map_apply
@[simp]
| Mathlib/LinearAlgebra/Orientation.lean | 74 | 75 | theorem Orientation.map_refl : (Orientation.map ΞΉ <| LinearEquiv.refl R M) = Equiv.refl _ := by |
rw [Orientation.map, AlternatingMap.domLCongr_refl, Module.Ray.map_refl]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 558 |
import Mathlib.LinearAlgebra.Ray
import Mathlib.LinearAlgebra.Determinant
#align_import linear_algebra.orientation from "leanprover-community/mathlib"@"0c1d80f5a86b36c1db32e021e8d19ae7809d5b79"
noncomputable section
section OrderedCommSemiring
variable (R : Type*) [StrictOrderedCommSemiring R]
variable (M : Type*) [AddCommMonoid M] [Module R M]
variable {N : Type*} [AddCommMonoid N] [Module R N]
variable (ΞΉ ΞΉ' : Type*)
abbrev Orientation := Module.Ray R (M [β^ΞΉ]ββ[R] R)
#align orientation Orientation
class Module.Oriented where
positiveOrientation : Orientation R M ΞΉ
#align module.oriented Module.Oriented
export Module.Oriented (positiveOrientation)
variable {R M}
def Orientation.map (e : M ββ[R] N) : Orientation R M ΞΉ β Orientation R N ΞΉ :=
Module.Ray.map <| AlternatingMap.domLCongr R R ΞΉ R e
#align orientation.map Orientation.map
@[simp]
theorem Orientation.map_apply (e : M ββ[R] N) (v : M [β^ΞΉ]ββ[R] R) (hv : v β 0) :
Orientation.map ΞΉ e (rayOfNeZero _ v hv) =
rayOfNeZero _ (v.compLinearMap e.symm) (mt (v.compLinearEquiv_eq_zero_iff e.symm).mp hv) :=
rfl
#align orientation.map_apply Orientation.map_apply
@[simp]
theorem Orientation.map_refl : (Orientation.map ΞΉ <| LinearEquiv.refl R M) = Equiv.refl _ := by
rw [Orientation.map, AlternatingMap.domLCongr_refl, Module.Ray.map_refl]
#align orientation.map_refl Orientation.map_refl
@[simp]
theorem Orientation.map_symm (e : M ββ[R] N) :
(Orientation.map ΞΉ e).symm = Orientation.map ΞΉ e.symm := rfl
#align orientation.map_symm Orientation.map_symm
section Reindex
variable (R M) {ΞΉ ΞΉ'}
def Orientation.reindex (e : ΞΉ β ΞΉ') : Orientation R M ΞΉ β Orientation R M ΞΉ' :=
Module.Ray.map <| AlternatingMap.domDomCongrβ R e
#align orientation.reindex Orientation.reindex
@[simp]
theorem Orientation.reindex_apply (e : ΞΉ β ΞΉ') (v : M [β^ΞΉ]ββ[R] R) (hv : v β 0) :
Orientation.reindex R M e (rayOfNeZero _ v hv) =
rayOfNeZero _ (v.domDomCongr e) (mt (v.domDomCongr_eq_zero_iff e).mp hv) :=
rfl
#align orientation.reindex_apply Orientation.reindex_apply
@[simp]
| Mathlib/LinearAlgebra/Orientation.lean | 100 | 101 | theorem Orientation.reindex_refl : (Orientation.reindex R M <| Equiv.refl ΞΉ) = Equiv.refl _ := by |
rw [Orientation.reindex, AlternatingMap.domDomCongrβ_refl, Module.Ray.map_refl]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 558 |
import Mathlib.LinearAlgebra.Ray
import Mathlib.LinearAlgebra.Determinant
#align_import linear_algebra.orientation from "leanprover-community/mathlib"@"0c1d80f5a86b36c1db32e021e8d19ae7809d5b79"
noncomputable section
section OrderedCommSemiring
variable (R : Type*) [StrictOrderedCommSemiring R]
variable (M : Type*) [AddCommMonoid M] [Module R M]
variable {N : Type*} [AddCommMonoid N] [Module R N]
variable (ΞΉ ΞΉ' : Type*)
abbrev Orientation := Module.Ray R (M [β^ΞΉ]ββ[R] R)
#align orientation Orientation
class Module.Oriented where
positiveOrientation : Orientation R M ΞΉ
#align module.oriented Module.Oriented
export Module.Oriented (positiveOrientation)
variable {R M}
def Orientation.map (e : M ββ[R] N) : Orientation R M ΞΉ β Orientation R N ΞΉ :=
Module.Ray.map <| AlternatingMap.domLCongr R R ΞΉ R e
#align orientation.map Orientation.map
@[simp]
theorem Orientation.map_apply (e : M ββ[R] N) (v : M [β^ΞΉ]ββ[R] R) (hv : v β 0) :
Orientation.map ΞΉ e (rayOfNeZero _ v hv) =
rayOfNeZero _ (v.compLinearMap e.symm) (mt (v.compLinearEquiv_eq_zero_iff e.symm).mp hv) :=
rfl
#align orientation.map_apply Orientation.map_apply
@[simp]
theorem Orientation.map_refl : (Orientation.map ΞΉ <| LinearEquiv.refl R M) = Equiv.refl _ := by
rw [Orientation.map, AlternatingMap.domLCongr_refl, Module.Ray.map_refl]
#align orientation.map_refl Orientation.map_refl
@[simp]
theorem Orientation.map_symm (e : M ββ[R] N) :
(Orientation.map ΞΉ e).symm = Orientation.map ΞΉ e.symm := rfl
#align orientation.map_symm Orientation.map_symm
instance (priority := 100) IsEmpty.oriented [IsEmpty ΞΉ] : Module.Oriented R M ΞΉ where
positiveOrientation :=
rayOfNeZero R (AlternatingMap.constLinearEquivOfIsEmpty 1) <|
AlternatingMap.constLinearEquivOfIsEmpty.injective.ne (by exact one_ne_zero)
#align is_empty.oriented IsEmpty.oriented
@[simp]
theorem Orientation.map_positiveOrientation_of_isEmpty [IsEmpty ΞΉ] (f : M ββ[R] N) :
Orientation.map ΞΉ f positiveOrientation = positiveOrientation := rfl
#align orientation.map_positive_orientation_of_is_empty Orientation.map_positiveOrientation_of_isEmpty
@[simp]
| Mathlib/LinearAlgebra/Orientation.lean | 125 | 133 | theorem Orientation.map_of_isEmpty [IsEmpty ΞΉ] (x : Orientation R M ΞΉ) (f : M ββ[R] M) :
Orientation.map ΞΉ f x = x := by |
induction' x using Module.Ray.ind with g hg
rw [Orientation.map_apply]
congr
ext i
rw [AlternatingMap.compLinearMap_apply]
congr
simp only [LinearEquiv.coe_coe, eq_iff_true_of_subsingleton]
| 7 | 1,096.633158 | 2 | 0.666667 | 3 | 558 |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.FreeModule.Basic
import Mathlib.LinearAlgebra.LinearPMap
import Mathlib.LinearAlgebra.Projection
#align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
open Function Set Submodule
set_option autoImplicit false
variable {ΞΉ : Type*} {ΞΉ' : Type*} {K : Type*} {V : Type*} {V' : Type*}
section DivisionRing
variable [DivisionRing K] [AddCommGroup V] [AddCommGroup V'] [Module K V] [Module K V']
variable {v : ΞΉ β V} {s t : Set V} {x y z : V}
open Submodule
namespace Basis
section ExistsBasis
noncomputable def extend (hs : LinearIndependent K ((β) : s β V)) :
Basis (hs.extend (subset_univ s)) K V :=
Basis.mk
(@LinearIndependent.restrict_of_comp_subtype _ _ _ id _ _ _ _ (hs.linearIndependent_extend _))
(SetLike.coe_subset_coe.mp <| by simpa using hs.subset_span_extend (subset_univ s))
#align basis.extend Basis.extend
theorem extend_apply_self (hs : LinearIndependent K ((β) : s β V)) (x : hs.extend _) :
Basis.extend hs x = x :=
Basis.mk_apply _ _ _
#align basis.extend_apply_self Basis.extend_apply_self
@[simp]
theorem coe_extend (hs : LinearIndependent K ((β) : s β V)) : β(Basis.extend hs) = ((β) : _ β _) :=
funext (extend_apply_self hs)
#align basis.coe_extend Basis.coe_extend
| Mathlib/LinearAlgebra/Basis/VectorSpace.lean | 67 | 69 | theorem range_extend (hs : LinearIndependent K ((β) : s β V)) :
range (Basis.extend hs) = hs.extend (subset_univ _) := by |
rw [coe_extend, Subtype.range_coe_subtype, setOf_mem_eq]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 559 |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.FreeModule.Basic
import Mathlib.LinearAlgebra.LinearPMap
import Mathlib.LinearAlgebra.Projection
#align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
open Function Set Submodule
set_option autoImplicit false
variable {ΞΉ : Type*} {ΞΉ' : Type*} {K : Type*} {V : Type*} {V' : Type*}
section DivisionRing
variable [DivisionRing K] [AddCommGroup V] [AddCommGroup V'] [Module K V] [Module K V']
variable {v : ΞΉ β V} {s t : Set V} {x y z : V}
open Submodule
namespace Basis
section ExistsBasis
noncomputable def extend (hs : LinearIndependent K ((β) : s β V)) :
Basis (hs.extend (subset_univ s)) K V :=
Basis.mk
(@LinearIndependent.restrict_of_comp_subtype _ _ _ id _ _ _ _ (hs.linearIndependent_extend _))
(SetLike.coe_subset_coe.mp <| by simpa using hs.subset_span_extend (subset_univ s))
#align basis.extend Basis.extend
theorem extend_apply_self (hs : LinearIndependent K ((β) : s β V)) (x : hs.extend _) :
Basis.extend hs x = x :=
Basis.mk_apply _ _ _
#align basis.extend_apply_self Basis.extend_apply_self
@[simp]
theorem coe_extend (hs : LinearIndependent K ((β) : s β V)) : β(Basis.extend hs) = ((β) : _ β _) :=
funext (extend_apply_self hs)
#align basis.coe_extend Basis.coe_extend
theorem range_extend (hs : LinearIndependent K ((β) : s β V)) :
range (Basis.extend hs) = hs.extend (subset_univ _) := by
rw [coe_extend, Subtype.range_coe_subtype, setOf_mem_eq]
#align basis.range_extend Basis.range_extend
-- Porting note: adding this to make the statement of `subExtend` more readable
def sumExtendIndex (hs : LinearIndependent K v) : Set V :=
LinearIndependent.extend hs.to_subtype_range (subset_univ _) \ range v
noncomputable def sumExtend (hs : LinearIndependent K v) : Basis (ΞΉ β sumExtendIndex hs) K V :=
let s := Set.range v
let e : ΞΉ β s := Equiv.ofInjective v hs.injective
let b := hs.to_subtype_range.extend (subset_univ (Set.range v))
(Basis.extend hs.to_subtype_range).reindex <|
Equiv.symm <|
calc
Sum ΞΉ (b \ s : Set V) β Sum s (b \ s : Set V) := Equiv.sumCongr e (Equiv.refl _)
_ β b :=
haveI := Classical.decPred (Β· β s)
Equiv.Set.sumDiffSubset (hs.to_subtype_range.subset_extend _)
#align basis.sum_extend Basis.sumExtend
theorem subset_extend {s : Set V} (hs : LinearIndependent K ((β) : s β V)) :
s β hs.extend (Set.subset_univ _) :=
hs.subset_extend _
#align basis.subset_extend Basis.subset_extend
section
variable (K V)
noncomputable def ofVectorSpaceIndex : Set V :=
(linearIndependent_empty K V).extend (subset_univ _)
#align basis.of_vector_space_index Basis.ofVectorSpaceIndex
noncomputable def ofVectorSpace : Basis (ofVectorSpaceIndex K V) K V :=
Basis.extend (linearIndependent_empty K V)
#align basis.of_vector_space Basis.ofVectorSpace
instance (priority := 100) _root_.Module.Free.of_divisionRing : Module.Free K V :=
Module.Free.of_basis (ofVectorSpace K V)
#align module.free.of_division_ring Module.Free.of_divisionRing
| Mathlib/LinearAlgebra/Basis/VectorSpace.lean | 117 | 119 | theorem ofVectorSpace_apply_self (x : ofVectorSpaceIndex K V) : ofVectorSpace K V x = x := by |
unfold ofVectorSpace
exact Basis.mk_apply _ _ _
| 2 | 7.389056 | 1 | 0.666667 | 3 | 559 |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.FreeModule.Basic
import Mathlib.LinearAlgebra.LinearPMap
import Mathlib.LinearAlgebra.Projection
#align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
open Function Set Submodule
set_option autoImplicit false
variable {ΞΉ : Type*} {ΞΉ' : Type*} {K : Type*} {V : Type*} {V' : Type*}
section DivisionRing
variable [DivisionRing K] [AddCommGroup V] [AddCommGroup V'] [Module K V] [Module K V']
variable {v : ΞΉ β V} {s t : Set V} {x y z : V}
open Submodule
namespace Basis
section ExistsBasis
noncomputable def extend (hs : LinearIndependent K ((β) : s β V)) :
Basis (hs.extend (subset_univ s)) K V :=
Basis.mk
(@LinearIndependent.restrict_of_comp_subtype _ _ _ id _ _ _ _ (hs.linearIndependent_extend _))
(SetLike.coe_subset_coe.mp <| by simpa using hs.subset_span_extend (subset_univ s))
#align basis.extend Basis.extend
theorem extend_apply_self (hs : LinearIndependent K ((β) : s β V)) (x : hs.extend _) :
Basis.extend hs x = x :=
Basis.mk_apply _ _ _
#align basis.extend_apply_self Basis.extend_apply_self
@[simp]
theorem coe_extend (hs : LinearIndependent K ((β) : s β V)) : β(Basis.extend hs) = ((β) : _ β _) :=
funext (extend_apply_self hs)
#align basis.coe_extend Basis.coe_extend
theorem range_extend (hs : LinearIndependent K ((β) : s β V)) :
range (Basis.extend hs) = hs.extend (subset_univ _) := by
rw [coe_extend, Subtype.range_coe_subtype, setOf_mem_eq]
#align basis.range_extend Basis.range_extend
-- Porting note: adding this to make the statement of `subExtend` more readable
def sumExtendIndex (hs : LinearIndependent K v) : Set V :=
LinearIndependent.extend hs.to_subtype_range (subset_univ _) \ range v
noncomputable def sumExtend (hs : LinearIndependent K v) : Basis (ΞΉ β sumExtendIndex hs) K V :=
let s := Set.range v
let e : ΞΉ β s := Equiv.ofInjective v hs.injective
let b := hs.to_subtype_range.extend (subset_univ (Set.range v))
(Basis.extend hs.to_subtype_range).reindex <|
Equiv.symm <|
calc
Sum ΞΉ (b \ s : Set V) β Sum s (b \ s : Set V) := Equiv.sumCongr e (Equiv.refl _)
_ β b :=
haveI := Classical.decPred (Β· β s)
Equiv.Set.sumDiffSubset (hs.to_subtype_range.subset_extend _)
#align basis.sum_extend Basis.sumExtend
theorem subset_extend {s : Set V} (hs : LinearIndependent K ((β) : s β V)) :
s β hs.extend (Set.subset_univ _) :=
hs.subset_extend _
#align basis.subset_extend Basis.subset_extend
section
variable (K V)
noncomputable def ofVectorSpaceIndex : Set V :=
(linearIndependent_empty K V).extend (subset_univ _)
#align basis.of_vector_space_index Basis.ofVectorSpaceIndex
noncomputable def ofVectorSpace : Basis (ofVectorSpaceIndex K V) K V :=
Basis.extend (linearIndependent_empty K V)
#align basis.of_vector_space Basis.ofVectorSpace
instance (priority := 100) _root_.Module.Free.of_divisionRing : Module.Free K V :=
Module.Free.of_basis (ofVectorSpace K V)
#align module.free.of_division_ring Module.Free.of_divisionRing
theorem ofVectorSpace_apply_self (x : ofVectorSpaceIndex K V) : ofVectorSpace K V x = x := by
unfold ofVectorSpace
exact Basis.mk_apply _ _ _
#align basis.of_vector_space_apply_self Basis.ofVectorSpace_apply_self
@[simp]
theorem coe_ofVectorSpace : β(ofVectorSpace K V) = ((β) : _ β _ ) :=
funext fun x => ofVectorSpace_apply_self K V x
#align basis.coe_of_vector_space Basis.coe_ofVectorSpace
| Mathlib/LinearAlgebra/Basis/VectorSpace.lean | 127 | 131 | theorem ofVectorSpaceIndex.linearIndependent :
LinearIndependent K ((β) : ofVectorSpaceIndex K V β V) := by |
convert (ofVectorSpace K V).linearIndependent
ext x
rw [ofVectorSpace_apply_self]
| 3 | 20.085537 | 1 | 0.666667 | 3 | 559 |
import Mathlib.Order.CompleteLattice
import Mathlib.Order.Cover
import Mathlib.Order.Iterate
import Mathlib.Order.WellFounded
#align_import order.succ_pred.basic from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
open Function OrderDual Set
variable {Ξ± Ξ² : Type*}
@[ext]
class SuccOrder (Ξ± : Type*) [Preorder Ξ±] where
succ : Ξ± β Ξ±
le_succ : β a, a β€ succ a
max_of_succ_le {a} : succ a β€ a β IsMax a
succ_le_of_lt {a b} : a < b β succ a β€ b
le_of_lt_succ {a b} : a < succ b β a β€ b
#align succ_order SuccOrder
#align succ_order.ext_iff SuccOrder.ext_iff
#align succ_order.ext SuccOrder.ext
@[ext]
class PredOrder (Ξ± : Type*) [Preorder Ξ±] where
pred : Ξ± β Ξ±
pred_le : β a, pred a β€ a
min_of_le_pred {a} : a β€ pred a β IsMin a
le_pred_of_lt {a b} : a < b β a β€ pred b
le_of_pred_lt {a b} : pred a < b β a β€ b
#align pred_order PredOrder
#align pred_order.ext PredOrder.ext
#align pred_order.ext_iff PredOrder.ext_iff
instance [Preorder Ξ±] [SuccOrder Ξ±] :
PredOrder Ξ±α΅α΅ where
pred := toDual β SuccOrder.succ β ofDual
pred_le := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
SuccOrder.le_succ, implies_true]
min_of_le_pred h := by apply SuccOrder.max_of_succ_le h
le_pred_of_lt := by intro a b h; exact SuccOrder.succ_le_of_lt h
le_of_pred_lt := SuccOrder.le_of_lt_succ
instance [Preorder Ξ±] [PredOrder Ξ±] :
SuccOrder Ξ±α΅α΅ where
succ := toDual β PredOrder.pred β ofDual
le_succ := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
PredOrder.pred_le, implies_true]
max_of_succ_le h := by apply PredOrder.min_of_le_pred h
succ_le_of_lt := by intro a b h; exact PredOrder.le_pred_of_lt h
le_of_lt_succ := PredOrder.le_of_pred_lt
namespace Order
section Preorder
variable [Preorder Ξ±] [SuccOrder Ξ±] {a b : Ξ±}
def succ : Ξ± β Ξ± :=
SuccOrder.succ
#align order.succ Order.succ
theorem le_succ : β a : Ξ±, a β€ succ a :=
SuccOrder.le_succ
#align order.le_succ Order.le_succ
theorem max_of_succ_le {a : Ξ±} : succ a β€ a β IsMax a :=
SuccOrder.max_of_succ_le
#align order.max_of_succ_le Order.max_of_succ_le
theorem succ_le_of_lt {a b : Ξ±} : a < b β succ a β€ b :=
SuccOrder.succ_le_of_lt
#align order.succ_le_of_lt Order.succ_le_of_lt
theorem le_of_lt_succ {a b : Ξ±} : a < succ b β a β€ b :=
SuccOrder.le_of_lt_succ
#align order.le_of_lt_succ Order.le_of_lt_succ
@[simp]
theorem succ_le_iff_isMax : succ a β€ a β IsMax a :=
β¨max_of_succ_le, fun h => h <| le_succ _β©
#align order.succ_le_iff_is_max Order.succ_le_iff_isMax
@[simp]
theorem lt_succ_iff_not_isMax : a < succ a β Β¬IsMax a :=
β¨not_isMax_of_lt, fun ha => (le_succ a).lt_of_not_le fun h => ha <| max_of_succ_le hβ©
#align order.lt_succ_iff_not_is_max Order.lt_succ_iff_not_isMax
alias β¨_, lt_succ_of_not_isMaxβ© := lt_succ_iff_not_isMax
#align order.lt_succ_of_not_is_max Order.lt_succ_of_not_isMax
theorem wcovBy_succ (a : Ξ±) : a β©Ώ succ a :=
β¨le_succ a, fun _ hb => (succ_le_of_lt hb).not_ltβ©
#align order.wcovby_succ Order.wcovBy_succ
theorem covBy_succ_of_not_isMax (h : Β¬IsMax a) : a β succ a :=
(wcovBy_succ a).covBy_of_lt <| lt_succ_of_not_isMax h
#align order.covby_succ_of_not_is_max Order.covBy_succ_of_not_isMax
theorem lt_succ_iff_of_not_isMax (ha : Β¬IsMax a) : b < succ a β b β€ a :=
β¨le_of_lt_succ, fun h => h.trans_lt <| lt_succ_of_not_isMax haβ©
#align order.lt_succ_iff_of_not_is_max Order.lt_succ_iff_of_not_isMax
theorem succ_le_iff_of_not_isMax (ha : Β¬IsMax a) : succ a β€ b β a < b :=
β¨(lt_succ_of_not_isMax ha).trans_le, succ_le_of_ltβ©
#align order.succ_le_iff_of_not_is_max Order.succ_le_iff_of_not_isMax
lemma succ_lt_succ_of_not_isMax (h : a < b) (hb : Β¬ IsMax b) : succ a < succ b :=
(lt_succ_iff_of_not_isMax hb).2 <| succ_le_of_lt h
| Mathlib/Order/SuccPred/Basic.lean | 279 | 281 | theorem succ_lt_succ_iff_of_not_isMax (ha : Β¬IsMax a) (hb : Β¬IsMax b) :
succ a < succ b β a < b := by |
rw [lt_succ_iff_of_not_isMax hb, succ_le_iff_of_not_isMax ha]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 560 |
import Mathlib.Order.CompleteLattice
import Mathlib.Order.Cover
import Mathlib.Order.Iterate
import Mathlib.Order.WellFounded
#align_import order.succ_pred.basic from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
open Function OrderDual Set
variable {Ξ± Ξ² : Type*}
@[ext]
class SuccOrder (Ξ± : Type*) [Preorder Ξ±] where
succ : Ξ± β Ξ±
le_succ : β a, a β€ succ a
max_of_succ_le {a} : succ a β€ a β IsMax a
succ_le_of_lt {a b} : a < b β succ a β€ b
le_of_lt_succ {a b} : a < succ b β a β€ b
#align succ_order SuccOrder
#align succ_order.ext_iff SuccOrder.ext_iff
#align succ_order.ext SuccOrder.ext
@[ext]
class PredOrder (Ξ± : Type*) [Preorder Ξ±] where
pred : Ξ± β Ξ±
pred_le : β a, pred a β€ a
min_of_le_pred {a} : a β€ pred a β IsMin a
le_pred_of_lt {a b} : a < b β a β€ pred b
le_of_pred_lt {a b} : pred a < b β a β€ b
#align pred_order PredOrder
#align pred_order.ext PredOrder.ext
#align pred_order.ext_iff PredOrder.ext_iff
instance [Preorder Ξ±] [SuccOrder Ξ±] :
PredOrder Ξ±α΅α΅ where
pred := toDual β SuccOrder.succ β ofDual
pred_le := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
SuccOrder.le_succ, implies_true]
min_of_le_pred h := by apply SuccOrder.max_of_succ_le h
le_pred_of_lt := by intro a b h; exact SuccOrder.succ_le_of_lt h
le_of_pred_lt := SuccOrder.le_of_lt_succ
instance [Preorder Ξ±] [PredOrder Ξ±] :
SuccOrder Ξ±α΅α΅ where
succ := toDual β PredOrder.pred β ofDual
le_succ := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
PredOrder.pred_le, implies_true]
max_of_succ_le h := by apply PredOrder.min_of_le_pred h
succ_le_of_lt := by intro a b h; exact PredOrder.le_pred_of_lt h
le_of_lt_succ := PredOrder.le_of_pred_lt
namespace Order
section Preorder
variable [Preorder Ξ±] [SuccOrder Ξ±] {a b : Ξ±}
def succ : Ξ± β Ξ± :=
SuccOrder.succ
#align order.succ Order.succ
theorem le_succ : β a : Ξ±, a β€ succ a :=
SuccOrder.le_succ
#align order.le_succ Order.le_succ
theorem max_of_succ_le {a : Ξ±} : succ a β€ a β IsMax a :=
SuccOrder.max_of_succ_le
#align order.max_of_succ_le Order.max_of_succ_le
theorem succ_le_of_lt {a b : Ξ±} : a < b β succ a β€ b :=
SuccOrder.succ_le_of_lt
#align order.succ_le_of_lt Order.succ_le_of_lt
theorem le_of_lt_succ {a b : Ξ±} : a < succ b β a β€ b :=
SuccOrder.le_of_lt_succ
#align order.le_of_lt_succ Order.le_of_lt_succ
@[simp]
theorem succ_le_iff_isMax : succ a β€ a β IsMax a :=
β¨max_of_succ_le, fun h => h <| le_succ _β©
#align order.succ_le_iff_is_max Order.succ_le_iff_isMax
@[simp]
theorem lt_succ_iff_not_isMax : a < succ a β Β¬IsMax a :=
β¨not_isMax_of_lt, fun ha => (le_succ a).lt_of_not_le fun h => ha <| max_of_succ_le hβ©
#align order.lt_succ_iff_not_is_max Order.lt_succ_iff_not_isMax
alias β¨_, lt_succ_of_not_isMaxβ© := lt_succ_iff_not_isMax
#align order.lt_succ_of_not_is_max Order.lt_succ_of_not_isMax
theorem wcovBy_succ (a : Ξ±) : a β©Ώ succ a :=
β¨le_succ a, fun _ hb => (succ_le_of_lt hb).not_ltβ©
#align order.wcovby_succ Order.wcovBy_succ
theorem covBy_succ_of_not_isMax (h : Β¬IsMax a) : a β succ a :=
(wcovBy_succ a).covBy_of_lt <| lt_succ_of_not_isMax h
#align order.covby_succ_of_not_is_max Order.covBy_succ_of_not_isMax
theorem lt_succ_iff_of_not_isMax (ha : Β¬IsMax a) : b < succ a β b β€ a :=
β¨le_of_lt_succ, fun h => h.trans_lt <| lt_succ_of_not_isMax haβ©
#align order.lt_succ_iff_of_not_is_max Order.lt_succ_iff_of_not_isMax
theorem succ_le_iff_of_not_isMax (ha : Β¬IsMax a) : succ a β€ b β a < b :=
β¨(lt_succ_of_not_isMax ha).trans_le, succ_le_of_ltβ©
#align order.succ_le_iff_of_not_is_max Order.succ_le_iff_of_not_isMax
lemma succ_lt_succ_of_not_isMax (h : a < b) (hb : Β¬ IsMax b) : succ a < succ b :=
(lt_succ_iff_of_not_isMax hb).2 <| succ_le_of_lt h
theorem succ_lt_succ_iff_of_not_isMax (ha : Β¬IsMax a) (hb : Β¬IsMax b) :
succ a < succ b β a < b := by
rw [lt_succ_iff_of_not_isMax hb, succ_le_iff_of_not_isMax ha]
#align order.succ_lt_succ_iff_of_not_is_max Order.succ_lt_succ_iff_of_not_isMax
| Mathlib/Order/SuccPred/Basic.lean | 284 | 286 | theorem succ_le_succ_iff_of_not_isMax (ha : Β¬IsMax a) (hb : Β¬IsMax b) :
succ a β€ succ b β a β€ b := by |
rw [succ_le_iff_of_not_isMax ha, lt_succ_iff_of_not_isMax hb]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 560 |
import Mathlib.Order.CompleteLattice
import Mathlib.Order.Cover
import Mathlib.Order.Iterate
import Mathlib.Order.WellFounded
#align_import order.succ_pred.basic from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
open Function OrderDual Set
variable {Ξ± Ξ² : Type*}
@[ext]
class SuccOrder (Ξ± : Type*) [Preorder Ξ±] where
succ : Ξ± β Ξ±
le_succ : β a, a β€ succ a
max_of_succ_le {a} : succ a β€ a β IsMax a
succ_le_of_lt {a b} : a < b β succ a β€ b
le_of_lt_succ {a b} : a < succ b β a β€ b
#align succ_order SuccOrder
#align succ_order.ext_iff SuccOrder.ext_iff
#align succ_order.ext SuccOrder.ext
@[ext]
class PredOrder (Ξ± : Type*) [Preorder Ξ±] where
pred : Ξ± β Ξ±
pred_le : β a, pred a β€ a
min_of_le_pred {a} : a β€ pred a β IsMin a
le_pred_of_lt {a b} : a < b β a β€ pred b
le_of_pred_lt {a b} : pred a < b β a β€ b
#align pred_order PredOrder
#align pred_order.ext PredOrder.ext
#align pred_order.ext_iff PredOrder.ext_iff
instance [Preorder Ξ±] [SuccOrder Ξ±] :
PredOrder Ξ±α΅α΅ where
pred := toDual β SuccOrder.succ β ofDual
pred_le := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
SuccOrder.le_succ, implies_true]
min_of_le_pred h := by apply SuccOrder.max_of_succ_le h
le_pred_of_lt := by intro a b h; exact SuccOrder.succ_le_of_lt h
le_of_pred_lt := SuccOrder.le_of_lt_succ
instance [Preorder Ξ±] [PredOrder Ξ±] :
SuccOrder Ξ±α΅α΅ where
succ := toDual β PredOrder.pred β ofDual
le_succ := by
simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual,
PredOrder.pred_le, implies_true]
max_of_succ_le h := by apply PredOrder.min_of_le_pred h
succ_le_of_lt := by intro a b h; exact PredOrder.le_pred_of_lt h
le_of_lt_succ := PredOrder.le_of_pred_lt
namespace Order
section Preorder
variable [Preorder Ξ±] [SuccOrder Ξ±] {a b : Ξ±}
def succ : Ξ± β Ξ± :=
SuccOrder.succ
#align order.succ Order.succ
theorem le_succ : β a : Ξ±, a β€ succ a :=
SuccOrder.le_succ
#align order.le_succ Order.le_succ
theorem max_of_succ_le {a : Ξ±} : succ a β€ a β IsMax a :=
SuccOrder.max_of_succ_le
#align order.max_of_succ_le Order.max_of_succ_le
theorem succ_le_of_lt {a b : Ξ±} : a < b β succ a β€ b :=
SuccOrder.succ_le_of_lt
#align order.succ_le_of_lt Order.succ_le_of_lt
theorem le_of_lt_succ {a b : Ξ±} : a < succ b β a β€ b :=
SuccOrder.le_of_lt_succ
#align order.le_of_lt_succ Order.le_of_lt_succ
@[simp]
theorem succ_le_iff_isMax : succ a β€ a β IsMax a :=
β¨max_of_succ_le, fun h => h <| le_succ _β©
#align order.succ_le_iff_is_max Order.succ_le_iff_isMax
@[simp]
theorem lt_succ_iff_not_isMax : a < succ a β Β¬IsMax a :=
β¨not_isMax_of_lt, fun ha => (le_succ a).lt_of_not_le fun h => ha <| max_of_succ_le hβ©
#align order.lt_succ_iff_not_is_max Order.lt_succ_iff_not_isMax
alias β¨_, lt_succ_of_not_isMaxβ© := lt_succ_iff_not_isMax
#align order.lt_succ_of_not_is_max Order.lt_succ_of_not_isMax
theorem wcovBy_succ (a : Ξ±) : a β©Ώ succ a :=
β¨le_succ a, fun _ hb => (succ_le_of_lt hb).not_ltβ©
#align order.wcovby_succ Order.wcovBy_succ
theorem covBy_succ_of_not_isMax (h : Β¬IsMax a) : a β succ a :=
(wcovBy_succ a).covBy_of_lt <| lt_succ_of_not_isMax h
#align order.covby_succ_of_not_is_max Order.covBy_succ_of_not_isMax
theorem lt_succ_iff_of_not_isMax (ha : Β¬IsMax a) : b < succ a β b β€ a :=
β¨le_of_lt_succ, fun h => h.trans_lt <| lt_succ_of_not_isMax haβ©
#align order.lt_succ_iff_of_not_is_max Order.lt_succ_iff_of_not_isMax
theorem succ_le_iff_of_not_isMax (ha : Β¬IsMax a) : succ a β€ b β a < b :=
β¨(lt_succ_of_not_isMax ha).trans_le, succ_le_of_ltβ©
#align order.succ_le_iff_of_not_is_max Order.succ_le_iff_of_not_isMax
lemma succ_lt_succ_of_not_isMax (h : a < b) (hb : Β¬ IsMax b) : succ a < succ b :=
(lt_succ_iff_of_not_isMax hb).2 <| succ_le_of_lt h
theorem succ_lt_succ_iff_of_not_isMax (ha : Β¬IsMax a) (hb : Β¬IsMax b) :
succ a < succ b β a < b := by
rw [lt_succ_iff_of_not_isMax hb, succ_le_iff_of_not_isMax ha]
#align order.succ_lt_succ_iff_of_not_is_max Order.succ_lt_succ_iff_of_not_isMax
theorem succ_le_succ_iff_of_not_isMax (ha : Β¬IsMax a) (hb : Β¬IsMax b) :
succ a β€ succ b β a β€ b := by
rw [succ_le_iff_of_not_isMax ha, lt_succ_iff_of_not_isMax hb]
#align order.succ_le_succ_iff_of_not_is_max Order.succ_le_succ_iff_of_not_isMax
@[simp, mono]
| Mathlib/Order/SuccPred/Basic.lean | 290 | 295 | theorem succ_le_succ (h : a β€ b) : succ a β€ succ b := by |
by_cases hb : IsMax b
Β· by_cases hba : b β€ a
Β· exact (hb <| hba.trans <| le_succ _).trans (le_succ _)
Β· exact succ_le_of_lt ((h.lt_of_not_le hba).trans_le <| le_succ b)
Β· rwa [succ_le_iff_of_not_isMax fun ha => hb <| ha.mono h, lt_succ_iff_of_not_isMax hb]
| 5 | 148.413159 | 2 | 0.666667 | 3 | 560 |
import Mathlib.Combinatorics.Quiver.Cast
import Mathlib.Combinatorics.Quiver.Symmetric
#align_import combinatorics.quiver.single_obj from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
namespace Quiver
-- Porting note: Removed `deriving Unique`.
@[nolint unusedArguments]
def SingleObj (_ : Type*) : Type :=
Unit
#align quiver.single_obj Quiver.SingleObj
-- Porting note: `deriving` from above has been moved to below.
instance {Ξ± : Type*} : Unique (SingleObj Ξ±) where
default := β¨β©
uniq := fun _ => rfl
namespace SingleObj
variable (Ξ± Ξ² Ξ³ : Type*)
instance : Quiver (SingleObj Ξ±) :=
β¨fun _ _ => Ξ±β©
def star : SingleObj Ξ± :=
Unit.unit
#align quiver.single_obj.star Quiver.SingleObj.star
instance : Inhabited (SingleObj Ξ±) :=
β¨star Ξ±β©
variable {Ξ± Ξ² Ξ³}
lemma ext {x y : SingleObj Ξ±} : x = y := Unit.ext x y
-- See note [reducible non-instances]
abbrev hasReverse (rev : Ξ± β Ξ±) : HasReverse (SingleObj Ξ±) := β¨revβ©
#align quiver.single_obj.has_reverse Quiver.SingleObj.hasReverse
-- See note [reducible non-instances]
abbrev hasInvolutiveReverse (rev : Ξ± β Ξ±) (h : Function.Involutive rev) :
HasInvolutiveReverse (SingleObj Ξ±) where
toHasReverse := hasReverse rev
inv' := h
#align quiver.single_obj.has_involutive_reverse Quiver.SingleObj.hasInvolutiveReverse
@[simps!]
def toHom : Ξ± β (star Ξ± βΆ star Ξ±) :=
Equiv.refl _
#align quiver.single_obj.to_hom Quiver.SingleObj.toHom
#align quiver.single_obj.to_hom_apply Quiver.SingleObj.toHom_apply
#align quiver.single_obj.to_hom_symm_apply Quiver.SingleObj.toHom_symm_apply
@[simps]
def toPrefunctor : (Ξ± β Ξ²) β SingleObj Ξ± β₯€q SingleObj Ξ² where
toFun f := β¨id, fβ©
invFun f a := f.map (toHom a)
left_inv _ := rfl
right_inv _ := rfl
#align quiver.single_obj.to_prefunctor_symm_apply Quiver.SingleObj.toPrefunctor_symm_apply
#align quiver.single_obj.to_prefunctor_apply_map Quiver.SingleObj.toPrefunctor_apply_map
#align quiver.single_obj.to_prefunctor_apply_obj Quiver.SingleObj.toPrefunctor_apply_obj
#align quiver.single_obj.to_prefunctor Quiver.SingleObj.toPrefunctor
theorem toPrefunctor_id : toPrefunctor id = πq (SingleObj Ξ±) :=
rfl
#align quiver.single_obj.to_prefunctor_id Quiver.SingleObj.toPrefunctor_id
@[simp]
theorem toPrefunctor_symm_id : toPrefunctor.symm (πq (SingleObj Ξ±)) = id :=
rfl
#align quiver.single_obj.to_prefunctor_symm_id Quiver.SingleObj.toPrefunctor_symm_id
theorem toPrefunctor_comp (f : Ξ± β Ξ²) (g : Ξ² β Ξ³) :
toPrefunctor (g β f) = toPrefunctor f βq toPrefunctor g :=
rfl
#align quiver.single_obj.to_prefunctor_comp Quiver.SingleObj.toPrefunctor_comp
@[simp]
| Mathlib/Combinatorics/Quiver/SingleObj.lean | 110 | 112 | theorem toPrefunctor_symm_comp (f : SingleObj Ξ± β₯€q SingleObj Ξ²) (g : SingleObj Ξ² β₯€q SingleObj Ξ³) :
toPrefunctor.symm (f βq g) = toPrefunctor.symm g β toPrefunctor.symm f := by |
simp only [Equiv.symm_apply_eq, toPrefunctor_comp, Equiv.apply_symm_apply]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 561 |
import Mathlib.Combinatorics.Quiver.Cast
import Mathlib.Combinatorics.Quiver.Symmetric
#align_import combinatorics.quiver.single_obj from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
namespace Quiver
-- Porting note: Removed `deriving Unique`.
@[nolint unusedArguments]
def SingleObj (_ : Type*) : Type :=
Unit
#align quiver.single_obj Quiver.SingleObj
-- Porting note: `deriving` from above has been moved to below.
instance {Ξ± : Type*} : Unique (SingleObj Ξ±) where
default := β¨β©
uniq := fun _ => rfl
namespace SingleObj
variable (Ξ± Ξ² Ξ³ : Type*)
instance : Quiver (SingleObj Ξ±) :=
β¨fun _ _ => Ξ±β©
def star : SingleObj Ξ± :=
Unit.unit
#align quiver.single_obj.star Quiver.SingleObj.star
instance : Inhabited (SingleObj Ξ±) :=
β¨star Ξ±β©
variable {Ξ± Ξ² Ξ³}
lemma ext {x y : SingleObj Ξ±} : x = y := Unit.ext x y
-- See note [reducible non-instances]
abbrev hasReverse (rev : Ξ± β Ξ±) : HasReverse (SingleObj Ξ±) := β¨revβ©
#align quiver.single_obj.has_reverse Quiver.SingleObj.hasReverse
-- See note [reducible non-instances]
abbrev hasInvolutiveReverse (rev : Ξ± β Ξ±) (h : Function.Involutive rev) :
HasInvolutiveReverse (SingleObj Ξ±) where
toHasReverse := hasReverse rev
inv' := h
#align quiver.single_obj.has_involutive_reverse Quiver.SingleObj.hasInvolutiveReverse
@[simps!]
def toHom : Ξ± β (star Ξ± βΆ star Ξ±) :=
Equiv.refl _
#align quiver.single_obj.to_hom Quiver.SingleObj.toHom
#align quiver.single_obj.to_hom_apply Quiver.SingleObj.toHom_apply
#align quiver.single_obj.to_hom_symm_apply Quiver.SingleObj.toHom_symm_apply
@[simps]
def toPrefunctor : (Ξ± β Ξ²) β SingleObj Ξ± β₯€q SingleObj Ξ² where
toFun f := β¨id, fβ©
invFun f a := f.map (toHom a)
left_inv _ := rfl
right_inv _ := rfl
#align quiver.single_obj.to_prefunctor_symm_apply Quiver.SingleObj.toPrefunctor_symm_apply
#align quiver.single_obj.to_prefunctor_apply_map Quiver.SingleObj.toPrefunctor_apply_map
#align quiver.single_obj.to_prefunctor_apply_obj Quiver.SingleObj.toPrefunctor_apply_obj
#align quiver.single_obj.to_prefunctor Quiver.SingleObj.toPrefunctor
theorem toPrefunctor_id : toPrefunctor id = πq (SingleObj Ξ±) :=
rfl
#align quiver.single_obj.to_prefunctor_id Quiver.SingleObj.toPrefunctor_id
@[simp]
theorem toPrefunctor_symm_id : toPrefunctor.symm (πq (SingleObj Ξ±)) = id :=
rfl
#align quiver.single_obj.to_prefunctor_symm_id Quiver.SingleObj.toPrefunctor_symm_id
theorem toPrefunctor_comp (f : Ξ± β Ξ²) (g : Ξ² β Ξ³) :
toPrefunctor (g β f) = toPrefunctor f βq toPrefunctor g :=
rfl
#align quiver.single_obj.to_prefunctor_comp Quiver.SingleObj.toPrefunctor_comp
@[simp]
theorem toPrefunctor_symm_comp (f : SingleObj Ξ± β₯€q SingleObj Ξ²) (g : SingleObj Ξ² β₯€q SingleObj Ξ³) :
toPrefunctor.symm (f βq g) = toPrefunctor.symm g β toPrefunctor.symm f := by
simp only [Equiv.symm_apply_eq, toPrefunctor_comp, Equiv.apply_symm_apply]
#align quiver.single_obj.to_prefunctor_symm_comp Quiver.SingleObj.toPrefunctor_symm_comp
def pathToList : β {x : SingleObj Ξ±}, Path (star Ξ±) x β List Ξ±
| _, Path.nil => []
| _, Path.cons p a => a :: pathToList p
#align quiver.single_obj.path_to_list Quiver.SingleObj.pathToList
@[simp]
def listToPath : List Ξ± β Path (star Ξ±) (star Ξ±)
| [] => Path.nil
| a :: l => (listToPath l).cons a
#align quiver.single_obj.list_to_path Quiver.SingleObj.listToPath
| Mathlib/Combinatorics/Quiver/SingleObj.lean | 132 | 136 | theorem listToPath_pathToList {x : SingleObj Ξ±} (p : Path (star Ξ±) x) :
listToPath (pathToList p) = p.cast rfl ext := by |
induction' p with y z p a ih
Β· rfl
Β· dsimp at *; rw [ih]
| 3 | 20.085537 | 1 | 0.666667 | 3 | 561 |
import Mathlib.Combinatorics.Quiver.Cast
import Mathlib.Combinatorics.Quiver.Symmetric
#align_import combinatorics.quiver.single_obj from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
namespace Quiver
-- Porting note: Removed `deriving Unique`.
@[nolint unusedArguments]
def SingleObj (_ : Type*) : Type :=
Unit
#align quiver.single_obj Quiver.SingleObj
-- Porting note: `deriving` from above has been moved to below.
instance {Ξ± : Type*} : Unique (SingleObj Ξ±) where
default := β¨β©
uniq := fun _ => rfl
namespace SingleObj
variable (Ξ± Ξ² Ξ³ : Type*)
instance : Quiver (SingleObj Ξ±) :=
β¨fun _ _ => Ξ±β©
def star : SingleObj Ξ± :=
Unit.unit
#align quiver.single_obj.star Quiver.SingleObj.star
instance : Inhabited (SingleObj Ξ±) :=
β¨star Ξ±β©
variable {Ξ± Ξ² Ξ³}
lemma ext {x y : SingleObj Ξ±} : x = y := Unit.ext x y
-- See note [reducible non-instances]
abbrev hasReverse (rev : Ξ± β Ξ±) : HasReverse (SingleObj Ξ±) := β¨revβ©
#align quiver.single_obj.has_reverse Quiver.SingleObj.hasReverse
-- See note [reducible non-instances]
abbrev hasInvolutiveReverse (rev : Ξ± β Ξ±) (h : Function.Involutive rev) :
HasInvolutiveReverse (SingleObj Ξ±) where
toHasReverse := hasReverse rev
inv' := h
#align quiver.single_obj.has_involutive_reverse Quiver.SingleObj.hasInvolutiveReverse
@[simps!]
def toHom : Ξ± β (star Ξ± βΆ star Ξ±) :=
Equiv.refl _
#align quiver.single_obj.to_hom Quiver.SingleObj.toHom
#align quiver.single_obj.to_hom_apply Quiver.SingleObj.toHom_apply
#align quiver.single_obj.to_hom_symm_apply Quiver.SingleObj.toHom_symm_apply
@[simps]
def toPrefunctor : (Ξ± β Ξ²) β SingleObj Ξ± β₯€q SingleObj Ξ² where
toFun f := β¨id, fβ©
invFun f a := f.map (toHom a)
left_inv _ := rfl
right_inv _ := rfl
#align quiver.single_obj.to_prefunctor_symm_apply Quiver.SingleObj.toPrefunctor_symm_apply
#align quiver.single_obj.to_prefunctor_apply_map Quiver.SingleObj.toPrefunctor_apply_map
#align quiver.single_obj.to_prefunctor_apply_obj Quiver.SingleObj.toPrefunctor_apply_obj
#align quiver.single_obj.to_prefunctor Quiver.SingleObj.toPrefunctor
theorem toPrefunctor_id : toPrefunctor id = πq (SingleObj Ξ±) :=
rfl
#align quiver.single_obj.to_prefunctor_id Quiver.SingleObj.toPrefunctor_id
@[simp]
theorem toPrefunctor_symm_id : toPrefunctor.symm (πq (SingleObj Ξ±)) = id :=
rfl
#align quiver.single_obj.to_prefunctor_symm_id Quiver.SingleObj.toPrefunctor_symm_id
theorem toPrefunctor_comp (f : Ξ± β Ξ²) (g : Ξ² β Ξ³) :
toPrefunctor (g β f) = toPrefunctor f βq toPrefunctor g :=
rfl
#align quiver.single_obj.to_prefunctor_comp Quiver.SingleObj.toPrefunctor_comp
@[simp]
theorem toPrefunctor_symm_comp (f : SingleObj Ξ± β₯€q SingleObj Ξ²) (g : SingleObj Ξ² β₯€q SingleObj Ξ³) :
toPrefunctor.symm (f βq g) = toPrefunctor.symm g β toPrefunctor.symm f := by
simp only [Equiv.symm_apply_eq, toPrefunctor_comp, Equiv.apply_symm_apply]
#align quiver.single_obj.to_prefunctor_symm_comp Quiver.SingleObj.toPrefunctor_symm_comp
def pathToList : β {x : SingleObj Ξ±}, Path (star Ξ±) x β List Ξ±
| _, Path.nil => []
| _, Path.cons p a => a :: pathToList p
#align quiver.single_obj.path_to_list Quiver.SingleObj.pathToList
@[simp]
def listToPath : List Ξ± β Path (star Ξ±) (star Ξ±)
| [] => Path.nil
| a :: l => (listToPath l).cons a
#align quiver.single_obj.list_to_path Quiver.SingleObj.listToPath
theorem listToPath_pathToList {x : SingleObj Ξ±} (p : Path (star Ξ±) x) :
listToPath (pathToList p) = p.cast rfl ext := by
induction' p with y z p a ih
Β· rfl
Β· dsimp at *; rw [ih]
#align quiver.single_obj.path_to_list_to_path Quiver.SingleObj.listToPath_pathToList
| Mathlib/Combinatorics/Quiver/SingleObj.lean | 139 | 142 | theorem pathToList_listToPath (l : List Ξ±) : pathToList (listToPath l) = l := by |
induction' l with a l ih
Β· rfl
Β· change a :: pathToList (listToPath l) = a :: l; rw [ih]
| 3 | 20.085537 | 1 | 0.666667 | 3 | 561 |
import Mathlib.SetTheory.Game.Basic
import Mathlib.Tactic.NthRewrite
#align_import set_theory.game.impartial from "leanprover-community/mathlib"@"2e0975f6a25dd3fbfb9e41556a77f075f6269748"
universe u
namespace SetTheory
open scoped PGame
namespace PGame
def ImpartialAux : PGame β Prop
| G => (G β -G) β§ (β i, ImpartialAux (G.moveLeft i)) β§ β j, ImpartialAux (G.moveRight j)
termination_by G => G -- Porting note: Added `termination_by`
#align pgame.impartial_aux SetTheory.PGame.ImpartialAux
| Mathlib/SetTheory/Game/Impartial.lean | 35 | 38 | theorem impartialAux_def {G : PGame} :
G.ImpartialAux β
(G β -G) β§ (β i, ImpartialAux (G.moveLeft i)) β§ β j, ImpartialAux (G.moveRight j) := by |
rw [ImpartialAux]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 562 |
import Mathlib.SetTheory.Game.Basic
import Mathlib.Tactic.NthRewrite
#align_import set_theory.game.impartial from "leanprover-community/mathlib"@"2e0975f6a25dd3fbfb9e41556a77f075f6269748"
universe u
namespace SetTheory
open scoped PGame
namespace PGame
def ImpartialAux : PGame β Prop
| G => (G β -G) β§ (β i, ImpartialAux (G.moveLeft i)) β§ β j, ImpartialAux (G.moveRight j)
termination_by G => G -- Porting note: Added `termination_by`
#align pgame.impartial_aux SetTheory.PGame.ImpartialAux
theorem impartialAux_def {G : PGame} :
G.ImpartialAux β
(G β -G) β§ (β i, ImpartialAux (G.moveLeft i)) β§ β j, ImpartialAux (G.moveRight j) := by
rw [ImpartialAux]
#align pgame.impartial_aux_def SetTheory.PGame.impartialAux_def
class Impartial (G : PGame) : Prop where
out : ImpartialAux G
#align pgame.impartial SetTheory.PGame.Impartial
theorem impartial_iff_aux {G : PGame} : G.Impartial β G.ImpartialAux :=
β¨fun h => h.1, fun h => β¨hβ©β©
#align pgame.impartial_iff_aux SetTheory.PGame.impartial_iff_aux
| Mathlib/SetTheory/Game/Impartial.lean | 50 | 52 | theorem impartial_def {G : PGame} :
G.Impartial β (G β -G) β§ (β i, Impartial (G.moveLeft i)) β§ β j, Impartial (G.moveRight j) := by |
simpa only [impartial_iff_aux] using impartialAux_def
| 1 | 2.718282 | 0 | 0.666667 | 3 | 562 |
import Mathlib.SetTheory.Game.Basic
import Mathlib.Tactic.NthRewrite
#align_import set_theory.game.impartial from "leanprover-community/mathlib"@"2e0975f6a25dd3fbfb9e41556a77f075f6269748"
universe u
namespace SetTheory
open scoped PGame
namespace PGame
def ImpartialAux : PGame β Prop
| G => (G β -G) β§ (β i, ImpartialAux (G.moveLeft i)) β§ β j, ImpartialAux (G.moveRight j)
termination_by G => G -- Porting note: Added `termination_by`
#align pgame.impartial_aux SetTheory.PGame.ImpartialAux
theorem impartialAux_def {G : PGame} :
G.ImpartialAux β
(G β -G) β§ (β i, ImpartialAux (G.moveLeft i)) β§ β j, ImpartialAux (G.moveRight j) := by
rw [ImpartialAux]
#align pgame.impartial_aux_def SetTheory.PGame.impartialAux_def
class Impartial (G : PGame) : Prop where
out : ImpartialAux G
#align pgame.impartial SetTheory.PGame.Impartial
theorem impartial_iff_aux {G : PGame} : G.Impartial β G.ImpartialAux :=
β¨fun h => h.1, fun h => β¨hβ©β©
#align pgame.impartial_iff_aux SetTheory.PGame.impartial_iff_aux
theorem impartial_def {G : PGame} :
G.Impartial β (G β -G) β§ (β i, Impartial (G.moveLeft i)) β§ β j, Impartial (G.moveRight j) := by
simpa only [impartial_iff_aux] using impartialAux_def
#align pgame.impartial_def SetTheory.PGame.impartial_def
namespace Impartial
instance impartial_zero : Impartial 0 := by rw [impartial_def]; dsimp; simp
#align pgame.impartial.impartial_zero SetTheory.PGame.Impartial.impartial_zero
instance impartial_star : Impartial star := by
rw [impartial_def]; simpa using Impartial.impartial_zero
#align pgame.impartial.impartial_star SetTheory.PGame.Impartial.impartial_star
theorem neg_equiv_self (G : PGame) [h : G.Impartial] : G β -G :=
(impartial_def.1 h).1
#align pgame.impartial.neg_equiv_self SetTheory.PGame.Impartial.neg_equiv_self
-- Porting note: Changed `-β¦Gβ§` to `-(β¦Gβ§ : Quotient setoid)`
@[simp]
theorem mk'_neg_equiv_self (G : PGame) [G.Impartial] : -(β¦Gβ§ : Quotient setoid) = β¦Gβ§ :=
Quot.sound (Equiv.symm (neg_equiv_self G))
#align pgame.impartial.mk_neg_equiv_self SetTheory.PGame.Impartial.mk'_neg_equiv_self
instance moveLeft_impartial {G : PGame} [h : G.Impartial] (i : G.LeftMoves) :
(G.moveLeft i).Impartial :=
(impartial_def.1 h).2.1 i
#align pgame.impartial.move_left_impartial SetTheory.PGame.Impartial.moveLeft_impartial
instance moveRight_impartial {G : PGame} [h : G.Impartial] (j : G.RightMoves) :
(G.moveRight j).Impartial :=
(impartial_def.1 h).2.2 j
#align pgame.impartial.move_right_impartial SetTheory.PGame.Impartial.moveRight_impartial
theorem impartial_congr : β {G H : PGame} (_ : G β‘r H) [G.Impartial], H.Impartial
| G, H => fun e => by
intro h
exact impartial_def.2
β¨Equiv.trans e.symm.equiv (Equiv.trans (neg_equiv_self G) (neg_equiv_neg_iff.2 e.equiv)),
fun i => impartial_congr (e.moveLeftSymm i), fun j => impartial_congr (e.moveRightSymm j)β©
termination_by G H => (G, H)
#align pgame.impartial.impartial_congr SetTheory.PGame.Impartial.impartial_congr
instance impartial_add : β (G H : PGame) [G.Impartial] [H.Impartial], (G + H).Impartial
| G, H, _, _ => by
rw [impartial_def]
refine β¨Equiv.trans (add_congr (neg_equiv_self G) (neg_equiv_self _))
(Equiv.symm (negAddRelabelling _ _).equiv), fun k => ?_, fun k => ?_β©
Β· apply leftMoves_add_cases k
all_goals
intro i; simp only [add_moveLeft_inl, add_moveLeft_inr]
apply impartial_add
Β· apply rightMoves_add_cases k
all_goals
intro i; simp only [add_moveRight_inl, add_moveRight_inr]
apply impartial_add
termination_by G H => (G, H)
#align pgame.impartial.impartial_add SetTheory.PGame.Impartial.impartial_add
instance impartial_neg : β (G : PGame) [G.Impartial], (-G).Impartial
| G, _ => by
rw [impartial_def]
refine β¨?_, fun i => ?_, fun i => ?_β©
Β· rw [neg_neg]
exact Equiv.symm (neg_equiv_self G)
Β· rw [moveLeft_neg']
apply impartial_neg
Β· rw [moveRight_neg']
apply impartial_neg
termination_by G => G
#align pgame.impartial.impartial_neg SetTheory.PGame.Impartial.impartial_neg
variable (G : PGame) [Impartial G]
theorem nonpos : Β¬0 < G := fun h => by
have h' := neg_lt_neg_iff.2 h
rw [neg_zero, lt_congr_left (Equiv.symm (neg_equiv_self G))] at h'
exact (h.trans h').false
#align pgame.impartial.nonpos SetTheory.PGame.Impartial.nonpos
theorem nonneg : Β¬G < 0 := fun h => by
have h' := neg_lt_neg_iff.2 h
rw [neg_zero, lt_congr_right (Equiv.symm (neg_equiv_self G))] at h'
exact (h.trans h').false
#align pgame.impartial.nonneg SetTheory.PGame.Impartial.nonneg
| Mathlib/SetTheory/Game/Impartial.lean | 137 | 142 | theorem equiv_or_fuzzy_zero : (G β 0) β¨ G β 0 := by |
rcases lt_or_equiv_or_gt_or_fuzzy G 0 with (h | h | h | h)
Β· exact ((nonneg G) h).elim
Β· exact Or.inl h
Β· exact ((nonpos G) h).elim
Β· exact Or.inr h
| 5 | 148.413159 | 2 | 0.666667 | 3 | 562 |
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Inhabit
#align_import data.prod.basic from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*}
@[simp]
theorem Prod.map_apply (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : Prod.map f g p = (f p.1, g p.2) := rfl
#align prod_map Prod.map_apply
@[deprecated (since := "2024-05-08")] alias Prod_map := Prod.map_apply
namespace Prod
@[simp]
theorem mk.eta : β {p : Ξ± Γ Ξ²}, (p.1, p.2) = p
| (_, _) => rfl
@[simp]
theorem Β«forallΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun h a b β¦ h (a, b), fun h β¨a, bβ© β¦ h a bβ©
#align prod.forall Prod.forall
@[simp]
theorem Β«existsΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun β¨β¨a, bβ©, hβ© β¦ β¨a, b, hβ©, fun β¨a, b, hβ© β¦ β¨β¨a, bβ©, hβ©β©
#align prod.exists Prod.exists
theorem forall' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.forall
#align prod.forall' Prod.forall'
theorem exists' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.exists
#align prod.exists' Prod.exists'
@[simp]
theorem snd_comp_mk (x : Ξ±) : Prod.snd β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = id :=
rfl
#align prod.snd_comp_mk Prod.snd_comp_mk
@[simp]
theorem fst_comp_mk (x : Ξ±) : Prod.fst β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = Function.const Ξ² x :=
rfl
#align prod.fst_comp_mk Prod.fst_comp_mk
@[simp, mfld_simps]
theorem map_mk (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (a : Ξ±) (b : Ξ²) : map f g (a, b) = (f a, g b) :=
rfl
#align prod.map_mk Prod.map_mk
theorem map_fst (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).1 = f p.1 :=
rfl
#align prod.map_fst Prod.map_fst
theorem map_snd (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).2 = g p.2 :=
rfl
#align prod.map_snd Prod.map_snd
theorem map_fst' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.fst β map f g = f β Prod.fst :=
funext <| map_fst f g
#align prod.map_fst' Prod.map_fst'
theorem map_snd' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.snd β map f g = g β Prod.snd :=
funext <| map_snd f g
#align prod.map_snd' Prod.map_snd'
theorem map_comp_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) :
Prod.map g g' β Prod.map f f' = Prod.map (g β f) (g' β f') :=
rfl
#align prod.map_comp_map Prod.map_comp_map
theorem map_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) (x : Ξ± Γ Ξ³) :
Prod.map g g' (Prod.map f f' x) = Prod.map (g β f) (g' β f') x :=
rfl
#align prod.map_map Prod.map_map
-- Porting note: mathlib3 proof uses `by cc` for the mpr direction
-- Porting note: `@[simp]` tag removed because auto-generated `mk.injEq` simplifies LHS
-- @[simp]
theorem mk.inj_iff {aβ aβ : Ξ±} {bβ bβ : Ξ²} : (aβ, bβ) = (aβ, bβ) β aβ = aβ β§ bβ = bβ :=
Iff.of_eq (mk.injEq _ _ _ _)
#align prod.mk.inj_iff Prod.mk.inj_iff
| Mathlib/Data/Prod/Basic.lean | 105 | 107 | theorem mk.inj_left {Ξ± Ξ² : Type*} (a : Ξ±) : Function.Injective (Prod.mk a : Ξ² β Ξ± Γ Ξ²) := by |
intro bβ bβ h
simpa only [true_and, Prod.mk.inj_iff, eq_self_iff_true] using h
| 2 | 7.389056 | 1 | 0.666667 | 3 | 563 |
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Inhabit
#align_import data.prod.basic from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*}
@[simp]
theorem Prod.map_apply (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : Prod.map f g p = (f p.1, g p.2) := rfl
#align prod_map Prod.map_apply
@[deprecated (since := "2024-05-08")] alias Prod_map := Prod.map_apply
namespace Prod
@[simp]
theorem mk.eta : β {p : Ξ± Γ Ξ²}, (p.1, p.2) = p
| (_, _) => rfl
@[simp]
theorem Β«forallΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun h a b β¦ h (a, b), fun h β¨a, bβ© β¦ h a bβ©
#align prod.forall Prod.forall
@[simp]
theorem Β«existsΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun β¨β¨a, bβ©, hβ© β¦ β¨a, b, hβ©, fun β¨a, b, hβ© β¦ β¨β¨a, bβ©, hβ©β©
#align prod.exists Prod.exists
theorem forall' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.forall
#align prod.forall' Prod.forall'
theorem exists' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.exists
#align prod.exists' Prod.exists'
@[simp]
theorem snd_comp_mk (x : Ξ±) : Prod.snd β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = id :=
rfl
#align prod.snd_comp_mk Prod.snd_comp_mk
@[simp]
theorem fst_comp_mk (x : Ξ±) : Prod.fst β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = Function.const Ξ² x :=
rfl
#align prod.fst_comp_mk Prod.fst_comp_mk
@[simp, mfld_simps]
theorem map_mk (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (a : Ξ±) (b : Ξ²) : map f g (a, b) = (f a, g b) :=
rfl
#align prod.map_mk Prod.map_mk
theorem map_fst (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).1 = f p.1 :=
rfl
#align prod.map_fst Prod.map_fst
theorem map_snd (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).2 = g p.2 :=
rfl
#align prod.map_snd Prod.map_snd
theorem map_fst' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.fst β map f g = f β Prod.fst :=
funext <| map_fst f g
#align prod.map_fst' Prod.map_fst'
theorem map_snd' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.snd β map f g = g β Prod.snd :=
funext <| map_snd f g
#align prod.map_snd' Prod.map_snd'
theorem map_comp_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) :
Prod.map g g' β Prod.map f f' = Prod.map (g β f) (g' β f') :=
rfl
#align prod.map_comp_map Prod.map_comp_map
theorem map_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) (x : Ξ± Γ Ξ³) :
Prod.map g g' (Prod.map f f' x) = Prod.map (g β f) (g' β f') x :=
rfl
#align prod.map_map Prod.map_map
-- Porting note: mathlib3 proof uses `by cc` for the mpr direction
-- Porting note: `@[simp]` tag removed because auto-generated `mk.injEq` simplifies LHS
-- @[simp]
theorem mk.inj_iff {aβ aβ : Ξ±} {bβ bβ : Ξ²} : (aβ, bβ) = (aβ, bβ) β aβ = aβ β§ bβ = bβ :=
Iff.of_eq (mk.injEq _ _ _ _)
#align prod.mk.inj_iff Prod.mk.inj_iff
theorem mk.inj_left {Ξ± Ξ² : Type*} (a : Ξ±) : Function.Injective (Prod.mk a : Ξ² β Ξ± Γ Ξ²) := by
intro bβ bβ h
simpa only [true_and, Prod.mk.inj_iff, eq_self_iff_true] using h
#align prod.mk.inj_left Prod.mk.inj_left
| Mathlib/Data/Prod/Basic.lean | 110 | 113 | theorem mk.inj_right {Ξ± Ξ² : Type*} (b : Ξ²) :
Function.Injective (fun a β¦ Prod.mk a b : Ξ± β Ξ± Γ Ξ²) := by |
intro bβ bβ h
simpa only [and_true, eq_self_iff_true, mk.inj_iff] using h
| 2 | 7.389056 | 1 | 0.666667 | 3 | 563 |
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Inhabit
#align_import data.prod.basic from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*}
@[simp]
theorem Prod.map_apply (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : Prod.map f g p = (f p.1, g p.2) := rfl
#align prod_map Prod.map_apply
@[deprecated (since := "2024-05-08")] alias Prod_map := Prod.map_apply
namespace Prod
@[simp]
theorem mk.eta : β {p : Ξ± Γ Ξ²}, (p.1, p.2) = p
| (_, _) => rfl
@[simp]
theorem Β«forallΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun h a b β¦ h (a, b), fun h β¨a, bβ© β¦ h a bβ©
#align prod.forall Prod.forall
@[simp]
theorem Β«existsΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun β¨β¨a, bβ©, hβ© β¦ β¨a, b, hβ©, fun β¨a, b, hβ© β¦ β¨β¨a, bβ©, hβ©β©
#align prod.exists Prod.exists
theorem forall' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.forall
#align prod.forall' Prod.forall'
theorem exists' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.exists
#align prod.exists' Prod.exists'
@[simp]
theorem snd_comp_mk (x : Ξ±) : Prod.snd β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = id :=
rfl
#align prod.snd_comp_mk Prod.snd_comp_mk
@[simp]
theorem fst_comp_mk (x : Ξ±) : Prod.fst β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = Function.const Ξ² x :=
rfl
#align prod.fst_comp_mk Prod.fst_comp_mk
@[simp, mfld_simps]
theorem map_mk (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (a : Ξ±) (b : Ξ²) : map f g (a, b) = (f a, g b) :=
rfl
#align prod.map_mk Prod.map_mk
theorem map_fst (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).1 = f p.1 :=
rfl
#align prod.map_fst Prod.map_fst
theorem map_snd (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).2 = g p.2 :=
rfl
#align prod.map_snd Prod.map_snd
theorem map_fst' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.fst β map f g = f β Prod.fst :=
funext <| map_fst f g
#align prod.map_fst' Prod.map_fst'
theorem map_snd' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.snd β map f g = g β Prod.snd :=
funext <| map_snd f g
#align prod.map_snd' Prod.map_snd'
theorem map_comp_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) :
Prod.map g g' β Prod.map f f' = Prod.map (g β f) (g' β f') :=
rfl
#align prod.map_comp_map Prod.map_comp_map
theorem map_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) (x : Ξ± Γ Ξ³) :
Prod.map g g' (Prod.map f f' x) = Prod.map (g β f) (g' β f') x :=
rfl
#align prod.map_map Prod.map_map
-- Porting note: mathlib3 proof uses `by cc` for the mpr direction
-- Porting note: `@[simp]` tag removed because auto-generated `mk.injEq` simplifies LHS
-- @[simp]
theorem mk.inj_iff {aβ aβ : Ξ±} {bβ bβ : Ξ²} : (aβ, bβ) = (aβ, bβ) β aβ = aβ β§ bβ = bβ :=
Iff.of_eq (mk.injEq _ _ _ _)
#align prod.mk.inj_iff Prod.mk.inj_iff
theorem mk.inj_left {Ξ± Ξ² : Type*} (a : Ξ±) : Function.Injective (Prod.mk a : Ξ² β Ξ± Γ Ξ²) := by
intro bβ bβ h
simpa only [true_and, Prod.mk.inj_iff, eq_self_iff_true] using h
#align prod.mk.inj_left Prod.mk.inj_left
theorem mk.inj_right {Ξ± Ξ² : Type*} (b : Ξ²) :
Function.Injective (fun a β¦ Prod.mk a b : Ξ± β Ξ± Γ Ξ²) := by
intro bβ bβ h
simpa only [and_true, eq_self_iff_true, mk.inj_iff] using h
#align prod.mk.inj_right Prod.mk.inj_right
lemma mk_inj_left {a : Ξ±} {bβ bβ : Ξ²} : (a, bβ) = (a, bβ) β bβ = bβ := (mk.inj_left _).eq_iff
#align prod.mk_inj_left Prod.mk_inj_left
lemma mk_inj_right {aβ aβ : Ξ±} {b : Ξ²} : (aβ, b) = (aβ, b) β aβ = aβ := (mk.inj_right _).eq_iff
#align prod.mk_inj_right Prod.mk_inj_right
| Mathlib/Data/Prod/Basic.lean | 122 | 123 | theorem ext_iff {p q : Ξ± Γ Ξ²} : p = q β p.1 = q.1 β§ p.2 = q.2 := by |
rw [mk.inj_iff]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 563 |
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {Rβ : Type*} [CommRing Rβ] [IsDomain Rβ] [Algebra Rβ K] [IsFractionRing Rβ K]
variable {I J : FractionalIdeal Rββ° K}
noncomputable instance : Inv (FractionalIdeal Rββ° K) := β¨fun I => 1 / Iβ©
theorem inv_eq : Iβ»ΒΉ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal Rββ° K)β»ΒΉ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
Jβ»ΒΉ = β¨(1 : FractionalIdeal Rββ° K) / J, fractional_div_of_nonzero hβ© := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 76 | 78 | theorem coe_inv_of_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
(βJβ»ΒΉ : Submodule Rβ K) = IsLocalization.coeSubmodule K β€ / (J : Submodule Rβ K) := by |
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 564 |
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {Rβ : Type*} [CommRing Rβ] [IsDomain Rβ] [Algebra Rβ K] [IsFractionRing Rβ K]
variable {I J : FractionalIdeal Rββ° K}
noncomputable instance : Inv (FractionalIdeal Rββ° K) := β¨fun I => 1 / Iβ©
theorem inv_eq : Iβ»ΒΉ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal Rββ° K)β»ΒΉ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
Jβ»ΒΉ = β¨(1 : FractionalIdeal Rββ° K) / J, fractional_div_of_nonzero hβ© := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
theorem coe_inv_of_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
(βJβ»ΒΉ : Submodule Rβ K) = IsLocalization.coeSubmodule K β€ / (J : Submodule Rβ K) := by
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
#align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero
variable {K}
theorem mem_inv_iff (hI : I β 0) {x : K} : x β Iβ»ΒΉ β β y β I, x * y β (1 : FractionalIdeal Rββ° K) :=
mem_div_iff_of_nonzero hI
#align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 87 | 92 | theorem inv_anti_mono (hI : I β 0) (hJ : J β 0) (hIJ : I β€ J) : Jβ»ΒΉ β€ Iβ»ΒΉ := by |
-- Porting note: in Lean3, introducing `x` would just give `x β Jβ»ΒΉ β x β Iβ»ΒΉ`, but
-- in Lean4, it goes all the way down to the subtypes
intro x
simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI]
exact fun h y hy => h y (hIJ hy)
| 5 | 148.413159 | 2 | 0.666667 | 6 | 564 |
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {Rβ : Type*} [CommRing Rβ] [IsDomain Rβ] [Algebra Rβ K] [IsFractionRing Rβ K]
variable {I J : FractionalIdeal Rββ° K}
noncomputable instance : Inv (FractionalIdeal Rββ° K) := β¨fun I => 1 / Iβ©
theorem inv_eq : Iβ»ΒΉ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal Rββ° K)β»ΒΉ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
Jβ»ΒΉ = β¨(1 : FractionalIdeal Rββ° K) / J, fractional_div_of_nonzero hβ© := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
theorem coe_inv_of_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
(βJβ»ΒΉ : Submodule Rβ K) = IsLocalization.coeSubmodule K β€ / (J : Submodule Rβ K) := by
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
#align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero
variable {K}
theorem mem_inv_iff (hI : I β 0) {x : K} : x β Iβ»ΒΉ β β y β I, x * y β (1 : FractionalIdeal Rββ° K) :=
mem_div_iff_of_nonzero hI
#align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff
theorem inv_anti_mono (hI : I β 0) (hJ : J β 0) (hIJ : I β€ J) : Jβ»ΒΉ β€ Iβ»ΒΉ := by
-- Porting note: in Lean3, introducing `x` would just give `x β Jβ»ΒΉ β x β Iβ»ΒΉ`, but
-- in Lean4, it goes all the way down to the subtypes
intro x
simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI]
exact fun h y hy => h y (hIJ hy)
#align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono
theorem le_self_mul_inv {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * Iβ»ΒΉ :=
le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv
variable (K)
theorem coe_ideal_le_self_mul_inv (I : Ideal Rβ) :
(I : FractionalIdeal Rββ° K) β€ I * (I : FractionalIdeal Rββ° K)β»ΒΉ :=
le_self_mul_inv coeIdeal_le_one
#align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 108 | 122 | theorem right_inverse_eq (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : J = Iβ»ΒΉ := by |
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1 from
congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
| 14 | 1,202,604.284165 | 2 | 0.666667 | 6 | 564 |
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {Rβ : Type*} [CommRing Rβ] [IsDomain Rβ] [Algebra Rβ K] [IsFractionRing Rβ K]
variable {I J : FractionalIdeal Rββ° K}
noncomputable instance : Inv (FractionalIdeal Rββ° K) := β¨fun I => 1 / Iβ©
theorem inv_eq : Iβ»ΒΉ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal Rββ° K)β»ΒΉ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
Jβ»ΒΉ = β¨(1 : FractionalIdeal Rββ° K) / J, fractional_div_of_nonzero hβ© := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
theorem coe_inv_of_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
(βJβ»ΒΉ : Submodule Rβ K) = IsLocalization.coeSubmodule K β€ / (J : Submodule Rβ K) := by
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
#align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero
variable {K}
theorem mem_inv_iff (hI : I β 0) {x : K} : x β Iβ»ΒΉ β β y β I, x * y β (1 : FractionalIdeal Rββ° K) :=
mem_div_iff_of_nonzero hI
#align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff
theorem inv_anti_mono (hI : I β 0) (hJ : J β 0) (hIJ : I β€ J) : Jβ»ΒΉ β€ Iβ»ΒΉ := by
-- Porting note: in Lean3, introducing `x` would just give `x β Jβ»ΒΉ β x β Iβ»ΒΉ`, but
-- in Lean4, it goes all the way down to the subtypes
intro x
simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI]
exact fun h y hy => h y (hIJ hy)
#align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono
theorem le_self_mul_inv {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * Iβ»ΒΉ :=
le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv
variable (K)
theorem coe_ideal_le_self_mul_inv (I : Ideal Rβ) :
(I : FractionalIdeal Rββ° K) β€ I * (I : FractionalIdeal Rββ° K)β»ΒΉ :=
le_self_mul_inv coeIdeal_le_one
#align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv
theorem right_inverse_eq (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : J = Iβ»ΒΉ := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1 from
congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.right_inverse_eq FractionalIdeal.right_inverse_eq
theorem mul_inv_cancel_iff {I : FractionalIdeal Rββ° K} : I * Iβ»ΒΉ = 1 β β J, I * J = 1 :=
β¨fun h => β¨Iβ»ΒΉ, hβ©, fun β¨J, hJβ© => by rwa [β right_inverse_eq K I J hJ]β©
#align fractional_ideal.mul_inv_cancel_iff FractionalIdeal.mul_inv_cancel_iff
theorem mul_inv_cancel_iff_isUnit {I : FractionalIdeal Rββ° K} : I * Iβ»ΒΉ = 1 β IsUnit I :=
(mul_inv_cancel_iff K).trans isUnit_iff_exists_inv.symm
#align fractional_ideal.mul_inv_cancel_iff_is_unit FractionalIdeal.mul_inv_cancel_iff_isUnit
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 136 | 137 | theorem map_inv (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
Iβ»ΒΉ.map (h : K ββ[Rβ] K') = (I.map h)β»ΒΉ := by | rw [inv_eq, map_div, map_one, inv_eq]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 564 |
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {Rβ : Type*} [CommRing Rβ] [IsDomain Rβ] [Algebra Rβ K] [IsFractionRing Rβ K]
variable {I J : FractionalIdeal Rββ° K}
noncomputable instance : Inv (FractionalIdeal Rββ° K) := β¨fun I => 1 / Iβ©
theorem inv_eq : Iβ»ΒΉ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal Rββ° K)β»ΒΉ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
Jβ»ΒΉ = β¨(1 : FractionalIdeal Rββ° K) / J, fractional_div_of_nonzero hβ© := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
theorem coe_inv_of_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
(βJβ»ΒΉ : Submodule Rβ K) = IsLocalization.coeSubmodule K β€ / (J : Submodule Rβ K) := by
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
#align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero
variable {K}
theorem mem_inv_iff (hI : I β 0) {x : K} : x β Iβ»ΒΉ β β y β I, x * y β (1 : FractionalIdeal Rββ° K) :=
mem_div_iff_of_nonzero hI
#align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff
theorem inv_anti_mono (hI : I β 0) (hJ : J β 0) (hIJ : I β€ J) : Jβ»ΒΉ β€ Iβ»ΒΉ := by
-- Porting note: in Lean3, introducing `x` would just give `x β Jβ»ΒΉ β x β Iβ»ΒΉ`, but
-- in Lean4, it goes all the way down to the subtypes
intro x
simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI]
exact fun h y hy => h y (hIJ hy)
#align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono
theorem le_self_mul_inv {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * Iβ»ΒΉ :=
le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv
variable (K)
theorem coe_ideal_le_self_mul_inv (I : Ideal Rβ) :
(I : FractionalIdeal Rββ° K) β€ I * (I : FractionalIdeal Rββ° K)β»ΒΉ :=
le_self_mul_inv coeIdeal_le_one
#align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv
theorem right_inverse_eq (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : J = Iβ»ΒΉ := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1 from
congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.right_inverse_eq FractionalIdeal.right_inverse_eq
theorem mul_inv_cancel_iff {I : FractionalIdeal Rββ° K} : I * Iβ»ΒΉ = 1 β β J, I * J = 1 :=
β¨fun h => β¨Iβ»ΒΉ, hβ©, fun β¨J, hJβ© => by rwa [β right_inverse_eq K I J hJ]β©
#align fractional_ideal.mul_inv_cancel_iff FractionalIdeal.mul_inv_cancel_iff
theorem mul_inv_cancel_iff_isUnit {I : FractionalIdeal Rββ° K} : I * Iβ»ΒΉ = 1 β IsUnit I :=
(mul_inv_cancel_iff K).trans isUnit_iff_exists_inv.symm
#align fractional_ideal.mul_inv_cancel_iff_is_unit FractionalIdeal.mul_inv_cancel_iff_isUnit
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_inv (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
Iβ»ΒΉ.map (h : K ββ[Rβ] K') = (I.map h)β»ΒΉ := by rw [inv_eq, map_div, map_one, inv_eq]
#align fractional_ideal.map_inv FractionalIdeal.map_inv
open Submodule Submodule.IsPrincipal
@[simp]
theorem spanSingleton_inv (x : K) : (spanSingleton Rββ° x)β»ΒΉ = spanSingleton _ xβ»ΒΉ :=
one_div_spanSingleton x
#align fractional_ideal.span_singleton_inv FractionalIdeal.spanSingleton_inv
-- @[simp] -- Porting note: not in simpNF form
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 148 | 150 | theorem spanSingleton_div_spanSingleton (x y : K) :
spanSingleton Rββ° x / spanSingleton Rββ° y = spanSingleton Rββ° (x / y) := by |
rw [div_spanSingleton, mul_comm, spanSingleton_mul_spanSingleton, div_eq_mul_inv]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 564 |
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {Rβ : Type*} [CommRing Rβ] [IsDomain Rβ] [Algebra Rβ K] [IsFractionRing Rβ K]
variable {I J : FractionalIdeal Rββ° K}
noncomputable instance : Inv (FractionalIdeal Rββ° K) := β¨fun I => 1 / Iβ©
theorem inv_eq : Iβ»ΒΉ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal Rββ° K)β»ΒΉ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
Jβ»ΒΉ = β¨(1 : FractionalIdeal Rββ° K) / J, fractional_div_of_nonzero hβ© := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
theorem coe_inv_of_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
(βJβ»ΒΉ : Submodule Rβ K) = IsLocalization.coeSubmodule K β€ / (J : Submodule Rβ K) := by
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
#align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero
variable {K}
theorem mem_inv_iff (hI : I β 0) {x : K} : x β Iβ»ΒΉ β β y β I, x * y β (1 : FractionalIdeal Rββ° K) :=
mem_div_iff_of_nonzero hI
#align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff
theorem inv_anti_mono (hI : I β 0) (hJ : J β 0) (hIJ : I β€ J) : Jβ»ΒΉ β€ Iβ»ΒΉ := by
-- Porting note: in Lean3, introducing `x` would just give `x β Jβ»ΒΉ β x β Iβ»ΒΉ`, but
-- in Lean4, it goes all the way down to the subtypes
intro x
simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI]
exact fun h y hy => h y (hIJ hy)
#align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono
theorem le_self_mul_inv {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * Iβ»ΒΉ :=
le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv
variable (K)
theorem coe_ideal_le_self_mul_inv (I : Ideal Rβ) :
(I : FractionalIdeal Rββ° K) β€ I * (I : FractionalIdeal Rββ° K)β»ΒΉ :=
le_self_mul_inv coeIdeal_le_one
#align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv
theorem right_inverse_eq (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : J = Iβ»ΒΉ := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1 from
congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.right_inverse_eq FractionalIdeal.right_inverse_eq
theorem mul_inv_cancel_iff {I : FractionalIdeal Rββ° K} : I * Iβ»ΒΉ = 1 β β J, I * J = 1 :=
β¨fun h => β¨Iβ»ΒΉ, hβ©, fun β¨J, hJβ© => by rwa [β right_inverse_eq K I J hJ]β©
#align fractional_ideal.mul_inv_cancel_iff FractionalIdeal.mul_inv_cancel_iff
theorem mul_inv_cancel_iff_isUnit {I : FractionalIdeal Rββ° K} : I * Iβ»ΒΉ = 1 β IsUnit I :=
(mul_inv_cancel_iff K).trans isUnit_iff_exists_inv.symm
#align fractional_ideal.mul_inv_cancel_iff_is_unit FractionalIdeal.mul_inv_cancel_iff_isUnit
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_inv (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
Iβ»ΒΉ.map (h : K ββ[Rβ] K') = (I.map h)β»ΒΉ := by rw [inv_eq, map_div, map_one, inv_eq]
#align fractional_ideal.map_inv FractionalIdeal.map_inv
open Submodule Submodule.IsPrincipal
@[simp]
theorem spanSingleton_inv (x : K) : (spanSingleton Rββ° x)β»ΒΉ = spanSingleton _ xβ»ΒΉ :=
one_div_spanSingleton x
#align fractional_ideal.span_singleton_inv FractionalIdeal.spanSingleton_inv
-- @[simp] -- Porting note: not in simpNF form
theorem spanSingleton_div_spanSingleton (x y : K) :
spanSingleton Rββ° x / spanSingleton Rββ° y = spanSingleton Rββ° (x / y) := by
rw [div_spanSingleton, mul_comm, spanSingleton_mul_spanSingleton, div_eq_mul_inv]
#align fractional_ideal.span_singleton_div_span_singleton FractionalIdeal.spanSingleton_div_spanSingleton
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 153 | 155 | theorem spanSingleton_div_self {x : K} (hx : x β 0) :
spanSingleton Rββ° x / spanSingleton Rββ° x = 1 := by |
rw [spanSingleton_div_spanSingleton, div_self hx, spanSingleton_one]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 564 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section Pi
def pi (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨
i, comap (eval i) (f i)
#align filter.pi Filter.pi
instance pi.isCountablyGenerated [Countable ΞΉ] [β i, IsCountablyGenerated (f i)] :
IsCountablyGenerated (pi f) :=
iInf.isCountablyGenerated _
#align filter.pi.is_countably_generated Filter.pi.isCountablyGenerated
theorem tendsto_eval_pi (f : β i, Filter (Ξ± i)) (i : ΞΉ) : Tendsto (eval i) (pi f) (f i) :=
tendsto_iInf' i tendsto_comap
#align filter.tendsto_eval_pi Filter.tendsto_eval_pi
| Mathlib/Order/Filter/Pi.lean | 51 | 53 | theorem tendsto_pi {Ξ² : Type*} {m : Ξ² β β i, Ξ± i} {l : Filter Ξ²} :
Tendsto m l (pi f) β β i, Tendsto (fun x => m x i) l (f i) := by |
simp only [pi, tendsto_iInf, tendsto_comap_iff]; rfl
| 1 | 2.718282 | 0 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section Pi
def pi (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨
i, comap (eval i) (f i)
#align filter.pi Filter.pi
instance pi.isCountablyGenerated [Countable ΞΉ] [β i, IsCountablyGenerated (f i)] :
IsCountablyGenerated (pi f) :=
iInf.isCountablyGenerated _
#align filter.pi.is_countably_generated Filter.pi.isCountablyGenerated
theorem tendsto_eval_pi (f : β i, Filter (Ξ± i)) (i : ΞΉ) : Tendsto (eval i) (pi f) (f i) :=
tendsto_iInf' i tendsto_comap
#align filter.tendsto_eval_pi Filter.tendsto_eval_pi
theorem tendsto_pi {Ξ² : Type*} {m : Ξ² β β i, Ξ± i} {l : Filter Ξ²} :
Tendsto m l (pi f) β β i, Tendsto (fun x => m x i) l (f i) := by
simp only [pi, tendsto_iInf, tendsto_comap_iff]; rfl
#align filter.tendsto_pi Filter.tendsto_pi
alias β¨Tendsto.apply, _β© := tendsto_pi
theorem le_pi {g : Filter (β i, Ξ± i)} : g β€ pi f β β i, Tendsto (eval i) g (f i) :=
tendsto_pi
#align filter.le_pi Filter.le_pi
@[mono]
theorem pi_mono (h : β i, fβ i β€ fβ i) : pi fβ β€ pi fβ :=
iInf_mono fun i => comap_mono <| h i
#align filter.pi_mono Filter.pi_mono
theorem mem_pi_of_mem (i : ΞΉ) {s : Set (Ξ± i)} (hs : s β f i) : eval i β»ΒΉ' s β pi f :=
mem_iInf_of_mem i <| preimage_mem_comap hs
#align filter.mem_pi_of_mem Filter.mem_pi_of_mem
| Mathlib/Order/Filter/Pi.lean | 74 | 77 | theorem pi_mem_pi {I : Set ΞΉ} (hI : I.Finite) (h : β i β I, s i β f i) : I.pi s β pi f := by |
rw [pi_def, biInter_eq_iInter]
refine mem_iInf_of_iInter hI (fun i => ?_) Subset.rfl
exact preimage_mem_comap (h i i.2)
| 3 | 20.085537 | 1 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section Pi
def pi (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨
i, comap (eval i) (f i)
#align filter.pi Filter.pi
instance pi.isCountablyGenerated [Countable ΞΉ] [β i, IsCountablyGenerated (f i)] :
IsCountablyGenerated (pi f) :=
iInf.isCountablyGenerated _
#align filter.pi.is_countably_generated Filter.pi.isCountablyGenerated
theorem tendsto_eval_pi (f : β i, Filter (Ξ± i)) (i : ΞΉ) : Tendsto (eval i) (pi f) (f i) :=
tendsto_iInf' i tendsto_comap
#align filter.tendsto_eval_pi Filter.tendsto_eval_pi
theorem tendsto_pi {Ξ² : Type*} {m : Ξ² β β i, Ξ± i} {l : Filter Ξ²} :
Tendsto m l (pi f) β β i, Tendsto (fun x => m x i) l (f i) := by
simp only [pi, tendsto_iInf, tendsto_comap_iff]; rfl
#align filter.tendsto_pi Filter.tendsto_pi
alias β¨Tendsto.apply, _β© := tendsto_pi
theorem le_pi {g : Filter (β i, Ξ± i)} : g β€ pi f β β i, Tendsto (eval i) g (f i) :=
tendsto_pi
#align filter.le_pi Filter.le_pi
@[mono]
theorem pi_mono (h : β i, fβ i β€ fβ i) : pi fβ β€ pi fβ :=
iInf_mono fun i => comap_mono <| h i
#align filter.pi_mono Filter.pi_mono
theorem mem_pi_of_mem (i : ΞΉ) {s : Set (Ξ± i)} (hs : s β f i) : eval i β»ΒΉ' s β pi f :=
mem_iInf_of_mem i <| preimage_mem_comap hs
#align filter.mem_pi_of_mem Filter.mem_pi_of_mem
theorem pi_mem_pi {I : Set ΞΉ} (hI : I.Finite) (h : β i β I, s i β f i) : I.pi s β pi f := by
rw [pi_def, biInter_eq_iInter]
refine mem_iInf_of_iInter hI (fun i => ?_) Subset.rfl
exact preimage_mem_comap (h i i.2)
#align filter.pi_mem_pi Filter.pi_mem_pi
| Mathlib/Order/Filter/Pi.lean | 80 | 88 | theorem mem_pi {s : Set (β i, Ξ± i)} :
s β pi f β β I : Set ΞΉ, I.Finite β§ β t : β i, Set (Ξ± i), (β i, t i β f i) β§ I.pi t β s := by |
constructor
Β· simp only [pi, mem_iInf', mem_comap, pi_def]
rintro β¨I, If, V, hVf, -, rfl, -β©
choose t htf htV using hVf
exact β¨I, If, t, htf, iInterβ_mono fun i _ => htV iβ©
Β· rintro β¨I, If, t, htf, htsβ©
exact mem_of_superset (pi_mem_pi If fun i _ => htf i) hts
| 7 | 1,096.633158 | 2 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section Pi
def pi (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨
i, comap (eval i) (f i)
#align filter.pi Filter.pi
instance pi.isCountablyGenerated [Countable ΞΉ] [β i, IsCountablyGenerated (f i)] :
IsCountablyGenerated (pi f) :=
iInf.isCountablyGenerated _
#align filter.pi.is_countably_generated Filter.pi.isCountablyGenerated
theorem tendsto_eval_pi (f : β i, Filter (Ξ± i)) (i : ΞΉ) : Tendsto (eval i) (pi f) (f i) :=
tendsto_iInf' i tendsto_comap
#align filter.tendsto_eval_pi Filter.tendsto_eval_pi
theorem tendsto_pi {Ξ² : Type*} {m : Ξ² β β i, Ξ± i} {l : Filter Ξ²} :
Tendsto m l (pi f) β β i, Tendsto (fun x => m x i) l (f i) := by
simp only [pi, tendsto_iInf, tendsto_comap_iff]; rfl
#align filter.tendsto_pi Filter.tendsto_pi
alias β¨Tendsto.apply, _β© := tendsto_pi
theorem le_pi {g : Filter (β i, Ξ± i)} : g β€ pi f β β i, Tendsto (eval i) g (f i) :=
tendsto_pi
#align filter.le_pi Filter.le_pi
@[mono]
theorem pi_mono (h : β i, fβ i β€ fβ i) : pi fβ β€ pi fβ :=
iInf_mono fun i => comap_mono <| h i
#align filter.pi_mono Filter.pi_mono
theorem mem_pi_of_mem (i : ΞΉ) {s : Set (Ξ± i)} (hs : s β f i) : eval i β»ΒΉ' s β pi f :=
mem_iInf_of_mem i <| preimage_mem_comap hs
#align filter.mem_pi_of_mem Filter.mem_pi_of_mem
theorem pi_mem_pi {I : Set ΞΉ} (hI : I.Finite) (h : β i β I, s i β f i) : I.pi s β pi f := by
rw [pi_def, biInter_eq_iInter]
refine mem_iInf_of_iInter hI (fun i => ?_) Subset.rfl
exact preimage_mem_comap (h i i.2)
#align filter.pi_mem_pi Filter.pi_mem_pi
theorem mem_pi {s : Set (β i, Ξ± i)} :
s β pi f β β I : Set ΞΉ, I.Finite β§ β t : β i, Set (Ξ± i), (β i, t i β f i) β§ I.pi t β s := by
constructor
Β· simp only [pi, mem_iInf', mem_comap, pi_def]
rintro β¨I, If, V, hVf, -, rfl, -β©
choose t htf htV using hVf
exact β¨I, If, t, htf, iInterβ_mono fun i _ => htV iβ©
Β· rintro β¨I, If, t, htf, htsβ©
exact mem_of_superset (pi_mem_pi If fun i _ => htf i) hts
#align filter.mem_pi Filter.mem_pi
theorem mem_pi' {s : Set (β i, Ξ± i)} :
s β pi f β β I : Finset ΞΉ, β t : β i, Set (Ξ± i), (β i, t i β f i) β§ Set.pi (βI) t β s :=
mem_pi.trans exists_finite_iff_finset
#align filter.mem_pi' Filter.mem_pi'
| Mathlib/Order/Filter/Pi.lean | 96 | 104 | theorem mem_of_pi_mem_pi [β i, NeBot (f i)] {I : Set ΞΉ} (h : I.pi s β pi f) {i : ΞΉ} (hi : i β I) :
s i β f i := by |
rcases mem_pi.1 h with β¨I', -, t, htf, htsβ©
refine mem_of_superset (htf i) fun x hx => ?_
have : β i, (t i).Nonempty := fun i => nonempty_of_mem (htf i)
choose g hg using this
have : update g i x β I'.pi t := fun j _ => by
rcases eq_or_ne j i with (rfl | hne) <;> simp [*]
simpa using hts this i hi
| 7 | 1,096.633158 | 2 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section Pi
def pi (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨
i, comap (eval i) (f i)
#align filter.pi Filter.pi
instance pi.isCountablyGenerated [Countable ΞΉ] [β i, IsCountablyGenerated (f i)] :
IsCountablyGenerated (pi f) :=
iInf.isCountablyGenerated _
#align filter.pi.is_countably_generated Filter.pi.isCountablyGenerated
theorem tendsto_eval_pi (f : β i, Filter (Ξ± i)) (i : ΞΉ) : Tendsto (eval i) (pi f) (f i) :=
tendsto_iInf' i tendsto_comap
#align filter.tendsto_eval_pi Filter.tendsto_eval_pi
theorem tendsto_pi {Ξ² : Type*} {m : Ξ² β β i, Ξ± i} {l : Filter Ξ²} :
Tendsto m l (pi f) β β i, Tendsto (fun x => m x i) l (f i) := by
simp only [pi, tendsto_iInf, tendsto_comap_iff]; rfl
#align filter.tendsto_pi Filter.tendsto_pi
alias β¨Tendsto.apply, _β© := tendsto_pi
theorem le_pi {g : Filter (β i, Ξ± i)} : g β€ pi f β β i, Tendsto (eval i) g (f i) :=
tendsto_pi
#align filter.le_pi Filter.le_pi
@[mono]
theorem pi_mono (h : β i, fβ i β€ fβ i) : pi fβ β€ pi fβ :=
iInf_mono fun i => comap_mono <| h i
#align filter.pi_mono Filter.pi_mono
theorem mem_pi_of_mem (i : ΞΉ) {s : Set (Ξ± i)} (hs : s β f i) : eval i β»ΒΉ' s β pi f :=
mem_iInf_of_mem i <| preimage_mem_comap hs
#align filter.mem_pi_of_mem Filter.mem_pi_of_mem
theorem pi_mem_pi {I : Set ΞΉ} (hI : I.Finite) (h : β i β I, s i β f i) : I.pi s β pi f := by
rw [pi_def, biInter_eq_iInter]
refine mem_iInf_of_iInter hI (fun i => ?_) Subset.rfl
exact preimage_mem_comap (h i i.2)
#align filter.pi_mem_pi Filter.pi_mem_pi
theorem mem_pi {s : Set (β i, Ξ± i)} :
s β pi f β β I : Set ΞΉ, I.Finite β§ β t : β i, Set (Ξ± i), (β i, t i β f i) β§ I.pi t β s := by
constructor
Β· simp only [pi, mem_iInf', mem_comap, pi_def]
rintro β¨I, If, V, hVf, -, rfl, -β©
choose t htf htV using hVf
exact β¨I, If, t, htf, iInterβ_mono fun i _ => htV iβ©
Β· rintro β¨I, If, t, htf, htsβ©
exact mem_of_superset (pi_mem_pi If fun i _ => htf i) hts
#align filter.mem_pi Filter.mem_pi
theorem mem_pi' {s : Set (β i, Ξ± i)} :
s β pi f β β I : Finset ΞΉ, β t : β i, Set (Ξ± i), (β i, t i β f i) β§ Set.pi (βI) t β s :=
mem_pi.trans exists_finite_iff_finset
#align filter.mem_pi' Filter.mem_pi'
theorem mem_of_pi_mem_pi [β i, NeBot (f i)] {I : Set ΞΉ} (h : I.pi s β pi f) {i : ΞΉ} (hi : i β I) :
s i β f i := by
rcases mem_pi.1 h with β¨I', -, t, htf, htsβ©
refine mem_of_superset (htf i) fun x hx => ?_
have : β i, (t i).Nonempty := fun i => nonempty_of_mem (htf i)
choose g hg using this
have : update g i x β I'.pi t := fun j _ => by
rcases eq_or_ne j i with (rfl | hne) <;> simp [*]
simpa using hts this i hi
#align filter.mem_of_pi_mem_pi Filter.mem_of_pi_mem_pi
@[simp]
theorem pi_mem_pi_iff [β i, NeBot (f i)] {I : Set ΞΉ} (hI : I.Finite) :
I.pi s β pi f β β i β I, s i β f i :=
β¨fun h _i hi => mem_of_pi_mem_pi h hi, pi_mem_pi hIβ©
#align filter.pi_mem_pi_iff Filter.pi_mem_pi_iff
theorem Eventually.eval_pi {i : ΞΉ} (hf : βαΆ x : Ξ± i in f i, p i x) :
βαΆ x : β i : ΞΉ, Ξ± i in pi f, p i (x i) := (tendsto_eval_pi _ _).eventually hf
#align filter.eventually.eval_pi Filter.Eventually.eval_pi
theorem eventually_pi [Finite ΞΉ] (hf : β i, βαΆ x in f i, p i x) :
βαΆ x : β i, Ξ± i in pi f, β i, p i (x i) := eventually_all.2 fun _i => (hf _).eval_pi
#align filter.eventually_pi Filter.eventually_pi
| Mathlib/Order/Filter/Pi.lean | 121 | 125 | theorem hasBasis_pi {ΞΉ' : ΞΉ β Type} {s : β i, ΞΉ' i β Set (Ξ± i)} {p : β i, ΞΉ' i β Prop}
(h : β i, (f i).HasBasis (p i) (s i)) :
(pi f).HasBasis (fun If : Set ΞΉ Γ β i, ΞΉ' i => If.1.Finite β§ β i β If.1, p i (If.2 i))
fun If : Set ΞΉ Γ β i, ΞΉ' i => If.1.pi fun i => s i <| If.2 i := by |
simpa [Set.pi_def] using hasBasis_iInf' fun i => (h i).comap (eval i : (β j, Ξ± j) β Ξ± i)
| 1 | 2.718282 | 0 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
| Mathlib/Order/Filter/Pi.lean | 229 | 230 | theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by | simp [Filter.coprodα΅’]
| 1 | 2.718282 | 0 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by simp [Filter.coprodα΅’]
#align filter.mem_Coprod_iff Filter.mem_coprodα΅’_iff
| Mathlib/Order/Filter/Pi.lean | 233 | 235 | theorem compl_mem_coprodα΅’ {s : Set (β i, Ξ± i)} :
sαΆ β Filter.coprodα΅’ f β β i, (eval i '' s)αΆ β f i := by |
simp only [Filter.coprodα΅’, mem_iSup, compl_mem_comap]
| 1 | 2.718282 | 0 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by simp [Filter.coprodα΅’]
#align filter.mem_Coprod_iff Filter.mem_coprodα΅’_iff
theorem compl_mem_coprodα΅’ {s : Set (β i, Ξ± i)} :
sαΆ β Filter.coprodα΅’ f β β i, (eval i '' s)αΆ β f i := by
simp only [Filter.coprodα΅’, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodα΅’
| Mathlib/Order/Filter/Pi.lean | 238 | 240 | theorem coprodα΅’_neBot_iff' :
NeBot (Filter.coprodα΅’ f) β (β i, Nonempty (Ξ± i)) β§ β d, NeBot (f d) := by |
simp only [Filter.coprodα΅’, iSup_neBot, β exists_and_left, β comap_eval_neBot_iff']
| 1 | 2.718282 | 0 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by simp [Filter.coprodα΅’]
#align filter.mem_Coprod_iff Filter.mem_coprodα΅’_iff
theorem compl_mem_coprodα΅’ {s : Set (β i, Ξ± i)} :
sαΆ β Filter.coprodα΅’ f β β i, (eval i '' s)αΆ β f i := by
simp only [Filter.coprodα΅’, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodα΅’
theorem coprodα΅’_neBot_iff' :
NeBot (Filter.coprodα΅’ f) β (β i, Nonempty (Ξ± i)) β§ β d, NeBot (f d) := by
simp only [Filter.coprodα΅’, iSup_neBot, β exists_and_left, β comap_eval_neBot_iff']
#align filter.Coprod_ne_bot_iff' Filter.coprodα΅’_neBot_iff'
@[simp]
| Mathlib/Order/Filter/Pi.lean | 244 | 245 | theorem coprodα΅’_neBot_iff [β i, Nonempty (Ξ± i)] : NeBot (Filter.coprodα΅’ f) β β d, NeBot (f d) := by |
simp [coprodα΅’_neBot_iff', *]
| 1 | 2.718282 | 0 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by simp [Filter.coprodα΅’]
#align filter.mem_Coprod_iff Filter.mem_coprodα΅’_iff
theorem compl_mem_coprodα΅’ {s : Set (β i, Ξ± i)} :
sαΆ β Filter.coprodα΅’ f β β i, (eval i '' s)αΆ β f i := by
simp only [Filter.coprodα΅’, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodα΅’
theorem coprodα΅’_neBot_iff' :
NeBot (Filter.coprodα΅’ f) β (β i, Nonempty (Ξ± i)) β§ β d, NeBot (f d) := by
simp only [Filter.coprodα΅’, iSup_neBot, β exists_and_left, β comap_eval_neBot_iff']
#align filter.Coprod_ne_bot_iff' Filter.coprodα΅’_neBot_iff'
@[simp]
theorem coprodα΅’_neBot_iff [β i, Nonempty (Ξ± i)] : NeBot (Filter.coprodα΅’ f) β β d, NeBot (f d) := by
simp [coprodα΅’_neBot_iff', *]
#align filter.Coprod_ne_bot_iff Filter.coprodα΅’_neBot_iff
| Mathlib/Order/Filter/Pi.lean | 248 | 250 | theorem coprodα΅’_eq_bot_iff' : Filter.coprodα΅’ f = β₯ β (β i, IsEmpty (Ξ± i)) β¨ f = β₯ := by |
simpa only [not_neBot, not_and_or, funext_iff, not_forall, not_exists, not_nonempty_iff]
using coprodα΅’_neBot_iff'.not
| 2 | 7.389056 | 1 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by simp [Filter.coprodα΅’]
#align filter.mem_Coprod_iff Filter.mem_coprodα΅’_iff
theorem compl_mem_coprodα΅’ {s : Set (β i, Ξ± i)} :
sαΆ β Filter.coprodα΅’ f β β i, (eval i '' s)αΆ β f i := by
simp only [Filter.coprodα΅’, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodα΅’
theorem coprodα΅’_neBot_iff' :
NeBot (Filter.coprodα΅’ f) β (β i, Nonempty (Ξ± i)) β§ β d, NeBot (f d) := by
simp only [Filter.coprodα΅’, iSup_neBot, β exists_and_left, β comap_eval_neBot_iff']
#align filter.Coprod_ne_bot_iff' Filter.coprodα΅’_neBot_iff'
@[simp]
theorem coprodα΅’_neBot_iff [β i, Nonempty (Ξ± i)] : NeBot (Filter.coprodα΅’ f) β β d, NeBot (f d) := by
simp [coprodα΅’_neBot_iff', *]
#align filter.Coprod_ne_bot_iff Filter.coprodα΅’_neBot_iff
theorem coprodα΅’_eq_bot_iff' : Filter.coprodα΅’ f = β₯ β (β i, IsEmpty (Ξ± i)) β¨ f = β₯ := by
simpa only [not_neBot, not_and_or, funext_iff, not_forall, not_exists, not_nonempty_iff]
using coprodα΅’_neBot_iff'.not
#align filter.Coprod_eq_bot_iff' Filter.coprodα΅’_eq_bot_iff'
@[simp]
| Mathlib/Order/Filter/Pi.lean | 254 | 255 | theorem coprodα΅’_eq_bot_iff [β i, Nonempty (Ξ± i)] : Filter.coprodα΅’ f = β₯ β f = β₯ := by |
simpa [funext_iff] using coprodα΅’_neBot_iff.not
| 1 | 2.718282 | 0 | 0.666667 | 12 | 565 |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} {f fβ fβ : (i : ΞΉ) β Filter (Ξ± i)} {s : (i : ΞΉ) β Set (Ξ± i)}
{p : β i, Ξ± i β Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodα΅’ (f : β i, Filter (Ξ± i)) : Filter (β i, Ξ± i) :=
β¨ i : ΞΉ, comap (eval i) (f i)
#align filter.Coprod Filter.coprodα΅’
theorem mem_coprodα΅’_iff {s : Set (β i, Ξ± i)} :
s β Filter.coprodα΅’ f β β i : ΞΉ, β tβ β f i, eval i β»ΒΉ' tβ β s := by simp [Filter.coprodα΅’]
#align filter.mem_Coprod_iff Filter.mem_coprodα΅’_iff
theorem compl_mem_coprodα΅’ {s : Set (β i, Ξ± i)} :
sαΆ β Filter.coprodα΅’ f β β i, (eval i '' s)αΆ β f i := by
simp only [Filter.coprodα΅’, mem_iSup, compl_mem_comap]
#align filter.compl_mem_Coprod Filter.compl_mem_coprodα΅’
theorem coprodα΅’_neBot_iff' :
NeBot (Filter.coprodα΅’ f) β (β i, Nonempty (Ξ± i)) β§ β d, NeBot (f d) := by
simp only [Filter.coprodα΅’, iSup_neBot, β exists_and_left, β comap_eval_neBot_iff']
#align filter.Coprod_ne_bot_iff' Filter.coprodα΅’_neBot_iff'
@[simp]
theorem coprodα΅’_neBot_iff [β i, Nonempty (Ξ± i)] : NeBot (Filter.coprodα΅’ f) β β d, NeBot (f d) := by
simp [coprodα΅’_neBot_iff', *]
#align filter.Coprod_ne_bot_iff Filter.coprodα΅’_neBot_iff
theorem coprodα΅’_eq_bot_iff' : Filter.coprodα΅’ f = β₯ β (β i, IsEmpty (Ξ± i)) β¨ f = β₯ := by
simpa only [not_neBot, not_and_or, funext_iff, not_forall, not_exists, not_nonempty_iff]
using coprodα΅’_neBot_iff'.not
#align filter.Coprod_eq_bot_iff' Filter.coprodα΅’_eq_bot_iff'
@[simp]
theorem coprodα΅’_eq_bot_iff [β i, Nonempty (Ξ± i)] : Filter.coprodα΅’ f = β₯ β f = β₯ := by
simpa [funext_iff] using coprodα΅’_neBot_iff.not
#align filter.Coprod_eq_bot_iff Filter.coprodα΅’_eq_bot_iff
@[simp] theorem coprodα΅’_bot' : Filter.coprodα΅’ (β₯ : β i, Filter (Ξ± i)) = β₯ :=
coprodα΅’_eq_bot_iff'.2 (Or.inr rfl)
#align filter.Coprod_bot' Filter.coprodα΅’_bot'
@[simp]
theorem coprodα΅’_bot : Filter.coprodα΅’ (fun _ => β₯ : β i, Filter (Ξ± i)) = β₯ :=
coprodα΅’_bot'
#align filter.Coprod_bot Filter.coprodα΅’_bot
theorem NeBot.coprodα΅’ [β i, Nonempty (Ξ± i)] {i : ΞΉ} (h : NeBot (f i)) : NeBot (Filter.coprodα΅’ f) :=
coprodα΅’_neBot_iff.2 β¨i, hβ©
#align filter.ne_bot.Coprod Filter.NeBot.coprodα΅’
@[instance]
theorem coprodα΅’_neBot [β i, Nonempty (Ξ± i)] [Nonempty ΞΉ] (f : β i, Filter (Ξ± i))
[H : β i, NeBot (f i)] : NeBot (Filter.coprodα΅’ f) :=
(H (Classical.arbitrary ΞΉ)).coprodα΅’
#align filter.Coprod_ne_bot Filter.coprodα΅’_neBot
@[mono]
theorem coprodα΅’_mono (hf : β i, fβ i β€ fβ i) : Filter.coprodα΅’ fβ β€ Filter.coprodα΅’ fβ :=
iSup_mono fun i => comap_mono (hf i)
#align filter.Coprod_mono Filter.coprodα΅’_mono
variable {Ξ² : ΞΉ β Type*} {m : β i, Ξ± i β Ξ² i}
| Mathlib/Order/Filter/Pi.lean | 284 | 290 | theorem map_pi_map_coprodα΅’_le :
map (fun k : β i, Ξ± i => fun i => m i (k i)) (Filter.coprodα΅’ f) β€
Filter.coprodα΅’ fun i => map (m i) (f i) := by |
simp only [le_def, mem_map, mem_coprodα΅’_iff]
intro s h i
obtain β¨t, H, hHβ© := h i
exact β¨{ x : Ξ± i | m i x β t }, H, fun x hx => hH hxβ©
| 4 | 54.59815 | 2 | 0.666667 | 12 | 565 |
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.GaloisConnection
import Mathlib.Order.Hom.Basic
#align_import order.hom.order from "leanprover-community/mathlib"@"ba2245edf0c8bb155f1569fd9b9492a9b384cde6"
namespace OrderHom
variable {Ξ± Ξ² : Type*}
section Preorder
variable [Preorder Ξ±]
instance [SemilatticeSup Ξ²] : Sup (Ξ± βo Ξ²) where
sup f g := β¨fun a => f a β g a, f.mono.sup g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_sup [SemilatticeSup Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeSup Ξ²] : SemilatticeSup (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)) with
sup := Sup.sup
le_sup_left := fun _ _ _ => le_sup_left
le_sup_right := fun _ _ _ => le_sup_right
sup_le := fun _ _ _ hβ hβ x => sup_le (hβ x) (hβ x) }
instance [SemilatticeInf Ξ²] : Inf (Ξ± βo Ξ²) where
inf f g := β¨fun a => f a β g a, f.mono.inf g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_inf [SemilatticeInf Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeInf Ξ²] : SemilatticeInf (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)), (dualIso Ξ± Ξ²).symm.toGaloisInsertion.liftSemilatticeInf with
inf := (Β· β Β·) }
instance lattice [Lattice Ξ²] : Lattice (Ξ± βo Ξ²) :=
{ (_ : SemilatticeSup (Ξ± βo Ξ²)), (_ : SemilatticeInf (Ξ± βo Ξ²)) with }
@[simps]
instance [Preorder Ξ²] [OrderBot Ξ²] : Bot (Ξ± βo Ξ²) where
bot := const Ξ± β₯
instance orderBot [Preorder Ξ²] [OrderBot Ξ²] : OrderBot (Ξ± βo Ξ²) where
bot := β₯
bot_le _ _ := bot_le
@[simps]
instance instTopOrderHom [Preorder Ξ²] [OrderTop Ξ²] : Top (Ξ± βo Ξ²) where
top := const Ξ± β€
instance orderTop [Preorder Ξ²] [OrderTop Ξ²] : OrderTop (Ξ± βo Ξ²) where
top := β€
le_top _ _ := le_top
instance [CompleteLattice Ξ²] : InfSet (Ξ± βo Ξ²) where
sInf s := β¨fun x => β¨
f β s, (f : _) x, fun _ _ h => iInfβ_mono fun f _ => f.mono hβ©
@[simp]
theorem sInf_apply [CompleteLattice Ξ²] (s : Set (Ξ± βo Ξ²)) (x : Ξ±) :
sInf s x = β¨
f β s, (f : _) x :=
rfl
#align order_hom.Inf_apply OrderHom.sInf_apply
theorem iInf_apply {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) (x : Ξ±) :
(β¨
i, f i) x = β¨
i, f i x :=
(sInf_apply _ _).trans iInf_range
#align order_hom.infi_apply OrderHom.iInf_apply
@[simp, norm_cast]
| Mathlib/Order/Hom/Order.lean | 97 | 99 | theorem coe_iInf {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) :
((β¨
i, f i : Ξ± βo Ξ²) : Ξ± β Ξ²) = β¨
i, (f i : Ξ± β Ξ²) := by |
funext x; simp [iInf_apply]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 566 |
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.GaloisConnection
import Mathlib.Order.Hom.Basic
#align_import order.hom.order from "leanprover-community/mathlib"@"ba2245edf0c8bb155f1569fd9b9492a9b384cde6"
namespace OrderHom
variable {Ξ± Ξ² : Type*}
section Preorder
variable [Preorder Ξ±]
instance [SemilatticeSup Ξ²] : Sup (Ξ± βo Ξ²) where
sup f g := β¨fun a => f a β g a, f.mono.sup g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_sup [SemilatticeSup Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeSup Ξ²] : SemilatticeSup (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)) with
sup := Sup.sup
le_sup_left := fun _ _ _ => le_sup_left
le_sup_right := fun _ _ _ => le_sup_right
sup_le := fun _ _ _ hβ hβ x => sup_le (hβ x) (hβ x) }
instance [SemilatticeInf Ξ²] : Inf (Ξ± βo Ξ²) where
inf f g := β¨fun a => f a β g a, f.mono.inf g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_inf [SemilatticeInf Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeInf Ξ²] : SemilatticeInf (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)), (dualIso Ξ± Ξ²).symm.toGaloisInsertion.liftSemilatticeInf with
inf := (Β· β Β·) }
instance lattice [Lattice Ξ²] : Lattice (Ξ± βo Ξ²) :=
{ (_ : SemilatticeSup (Ξ± βo Ξ²)), (_ : SemilatticeInf (Ξ± βo Ξ²)) with }
@[simps]
instance [Preorder Ξ²] [OrderBot Ξ²] : Bot (Ξ± βo Ξ²) where
bot := const Ξ± β₯
instance orderBot [Preorder Ξ²] [OrderBot Ξ²] : OrderBot (Ξ± βo Ξ²) where
bot := β₯
bot_le _ _ := bot_le
@[simps]
instance instTopOrderHom [Preorder Ξ²] [OrderTop Ξ²] : Top (Ξ± βo Ξ²) where
top := const Ξ± β€
instance orderTop [Preorder Ξ²] [OrderTop Ξ²] : OrderTop (Ξ± βo Ξ²) where
top := β€
le_top _ _ := le_top
instance [CompleteLattice Ξ²] : InfSet (Ξ± βo Ξ²) where
sInf s := β¨fun x => β¨
f β s, (f : _) x, fun _ _ h => iInfβ_mono fun f _ => f.mono hβ©
@[simp]
theorem sInf_apply [CompleteLattice Ξ²] (s : Set (Ξ± βo Ξ²)) (x : Ξ±) :
sInf s x = β¨
f β s, (f : _) x :=
rfl
#align order_hom.Inf_apply OrderHom.sInf_apply
theorem iInf_apply {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) (x : Ξ±) :
(β¨
i, f i) x = β¨
i, f i x :=
(sInf_apply _ _).trans iInf_range
#align order_hom.infi_apply OrderHom.iInf_apply
@[simp, norm_cast]
theorem coe_iInf {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) :
((β¨
i, f i : Ξ± βo Ξ²) : Ξ± β Ξ²) = β¨
i, (f i : Ξ± β Ξ²) := by
funext x; simp [iInf_apply]
#align order_hom.coe_infi OrderHom.coe_iInf
instance [CompleteLattice Ξ²] : SupSet (Ξ± βo Ξ²) where
sSup s := β¨fun x => β¨ f β s, (f : _) x, fun _ _ h => iSupβ_mono fun f _ => f.mono hβ©
@[simp]
theorem sSup_apply [CompleteLattice Ξ²] (s : Set (Ξ± βo Ξ²)) (x : Ξ±) :
sSup s x = β¨ f β s, (f : _) x :=
rfl
#align order_hom.Sup_apply OrderHom.sSup_apply
theorem iSup_apply {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) (x : Ξ±) :
(β¨ i, f i) x = β¨ i, f i x :=
(sSup_apply _ _).trans iSup_range
#align order_hom.supr_apply OrderHom.iSup_apply
@[simp, norm_cast]
| Mathlib/Order/Hom/Order.lean | 117 | 119 | theorem coe_iSup {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) :
((β¨ i, f i : Ξ± βo Ξ²) : Ξ± β Ξ²) = β¨ i, (f i : Ξ± β Ξ²) := by |
funext x; simp [iSup_apply]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 566 |
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.GaloisConnection
import Mathlib.Order.Hom.Basic
#align_import order.hom.order from "leanprover-community/mathlib"@"ba2245edf0c8bb155f1569fd9b9492a9b384cde6"
namespace OrderHom
variable {Ξ± Ξ² : Type*}
section Preorder
variable [Preorder Ξ±]
instance [SemilatticeSup Ξ²] : Sup (Ξ± βo Ξ²) where
sup f g := β¨fun a => f a β g a, f.mono.sup g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_sup [SemilatticeSup Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeSup Ξ²] : SemilatticeSup (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)) with
sup := Sup.sup
le_sup_left := fun _ _ _ => le_sup_left
le_sup_right := fun _ _ _ => le_sup_right
sup_le := fun _ _ _ hβ hβ x => sup_le (hβ x) (hβ x) }
instance [SemilatticeInf Ξ²] : Inf (Ξ± βo Ξ²) where
inf f g := β¨fun a => f a β g a, f.mono.inf g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_inf [SemilatticeInf Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeInf Ξ²] : SemilatticeInf (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)), (dualIso Ξ± Ξ²).symm.toGaloisInsertion.liftSemilatticeInf with
inf := (Β· β Β·) }
instance lattice [Lattice Ξ²] : Lattice (Ξ± βo Ξ²) :=
{ (_ : SemilatticeSup (Ξ± βo Ξ²)), (_ : SemilatticeInf (Ξ± βo Ξ²)) with }
@[simps]
instance [Preorder Ξ²] [OrderBot Ξ²] : Bot (Ξ± βo Ξ²) where
bot := const Ξ± β₯
instance orderBot [Preorder Ξ²] [OrderBot Ξ²] : OrderBot (Ξ± βo Ξ²) where
bot := β₯
bot_le _ _ := bot_le
@[simps]
instance instTopOrderHom [Preorder Ξ²] [OrderTop Ξ²] : Top (Ξ± βo Ξ²) where
top := const Ξ± β€
instance orderTop [Preorder Ξ²] [OrderTop Ξ²] : OrderTop (Ξ± βo Ξ²) where
top := β€
le_top _ _ := le_top
instance [CompleteLattice Ξ²] : InfSet (Ξ± βo Ξ²) where
sInf s := β¨fun x => β¨
f β s, (f : _) x, fun _ _ h => iInfβ_mono fun f _ => f.mono hβ©
@[simp]
theorem sInf_apply [CompleteLattice Ξ²] (s : Set (Ξ± βo Ξ²)) (x : Ξ±) :
sInf s x = β¨
f β s, (f : _) x :=
rfl
#align order_hom.Inf_apply OrderHom.sInf_apply
theorem iInf_apply {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) (x : Ξ±) :
(β¨
i, f i) x = β¨
i, f i x :=
(sInf_apply _ _).trans iInf_range
#align order_hom.infi_apply OrderHom.iInf_apply
@[simp, norm_cast]
theorem coe_iInf {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) :
((β¨
i, f i : Ξ± βo Ξ²) : Ξ± β Ξ²) = β¨
i, (f i : Ξ± β Ξ²) := by
funext x; simp [iInf_apply]
#align order_hom.coe_infi OrderHom.coe_iInf
instance [CompleteLattice Ξ²] : SupSet (Ξ± βo Ξ²) where
sSup s := β¨fun x => β¨ f β s, (f : _) x, fun _ _ h => iSupβ_mono fun f _ => f.mono hβ©
@[simp]
theorem sSup_apply [CompleteLattice Ξ²] (s : Set (Ξ± βo Ξ²)) (x : Ξ±) :
sSup s x = β¨ f β s, (f : _) x :=
rfl
#align order_hom.Sup_apply OrderHom.sSup_apply
theorem iSup_apply {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) (x : Ξ±) :
(β¨ i, f i) x = β¨ i, f i x :=
(sSup_apply _ _).trans iSup_range
#align order_hom.supr_apply OrderHom.iSup_apply
@[simp, norm_cast]
theorem coe_iSup {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) :
((β¨ i, f i : Ξ± βo Ξ²) : Ξ± β Ξ²) = β¨ i, (f i : Ξ± β Ξ²) := by
funext x; simp [iSup_apply]
#align order_hom.coe_supr OrderHom.coe_iSup
instance [CompleteLattice Ξ²] : CompleteLattice (Ξ± βo Ξ²) :=
{ (_ : Lattice (Ξ± βo Ξ²)), OrderHom.orderTop, OrderHom.orderBot with
-- sSup := SupSet.sSup -- Porting note: removed, unnecessary?
-- Porting note: Added `by apply`, was `fun s f hf x => le_iSup_of_le f (le_iSup _ hf)`
le_sSup := fun s f hf x => le_iSup_of_le f (by apply le_iSup _ hf)
sSup_le := fun s f hf x => iSupβ_le fun g hg => hf g hg x
--inf := sInf -- Porting note: removed, unnecessary?
le_sInf := fun s f hf x => le_iInfβ fun g hg => hf g hg x
sInf_le := fun s f hf x => iInf_le_of_le f (iInf_le _ hf)
}
| Mathlib/Order/Hom/Order.lean | 133 | 154 | theorem iterate_sup_le_sup_iff {Ξ± : Type*} [SemilatticeSup Ξ±] (f : Ξ± βo Ξ±) :
(β nβ nβ aβ aβ, f^[nβ + nβ] (aβ β aβ) β€ f^[nβ] aβ β f^[nβ] aβ) β
β aβ aβ, f (aβ β aβ) β€ f aβ β aβ := by |
constructor <;> intro h
Β· exact h 1 0
Β· intro nβ nβ aβ aβ
have h' : β n aβ aβ, f^[n] (aβ β aβ) β€ f^[n] aβ β aβ := by
intro n
induction' n with n ih <;> intro aβ aβ
Β· rfl
Β· calc
f^[n + 1] (aβ β aβ) = f^[n] (f (aβ β aβ)) := Function.iterate_succ_apply f n _
_ β€ f^[n] (f aβ β aβ) := f.mono.iterate n (h aβ aβ)
_ β€ f^[n] (f aβ) β aβ := ih _ _
_ = f^[n + 1] aβ β aβ := by rw [β Function.iterate_succ_apply]
calc
f^[nβ + nβ] (aβ β aβ) = f^[nβ] (f^[nβ] (aβ β aβ)) :=
Function.iterate_add_apply f nβ nβ _
_ = f^[nβ] (f^[nβ] (aβ β aβ)) := by rw [sup_comm]
_ β€ f^[nβ] (f^[nβ] aβ β aβ) := f.mono.iterate nβ (h' nβ _ _)
_ = f^[nβ] (aβ β f^[nβ] aβ) := by rw [sup_comm]
_ β€ f^[nβ] aβ β f^[nβ] aβ := h' nβ aβ _
| 19 | 178,482,300.963187 | 2 | 0.666667 | 3 | 566 |
import Mathlib.Data.Sigma.Basic
import Mathlib.Algebra.Order.Ring.Nat
#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
variable {Ξ± : Type*}
inductive Lists'.{u} (Ξ± : Type u) : Bool β Type u
| atom : Ξ± β Lists' Ξ± false
| nil : Lists' Ξ± true
| cons' {b} : Lists' Ξ± b β Lists' Ξ± true β Lists' Ξ± true
deriving DecidableEq
#align lists' Lists'
compile_inductive% Lists'
def Lists (Ξ± : Type*) :=
Ξ£b, Lists' Ξ± b
#align lists Lists
namespace Lists'
instance [Inhabited Ξ±] : β b, Inhabited (Lists' Ξ± b)
| true => β¨nilβ©
| false => β¨atom defaultβ©
def cons : Lists Ξ± β Lists' Ξ± true β Lists' Ξ± true
| β¨_, aβ©, l => cons' a l
#align lists'.cons Lists'.cons
@[simp]
def toList : β {b}, Lists' Ξ± b β List (Lists Ξ±)
| _, atom _ => []
| _, nil => []
| _, cons' a l => β¨_, aβ© :: l.toList
#align lists'.to_list Lists'.toList
-- Porting note (#10618): removed @[simp]
-- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
| Mathlib/SetTheory/Lists.lean | 88 | 88 | theorem toList_cons (a : Lists Ξ±) (l) : toList (cons a l) = a :: l.toList := by | simp
| 1 | 2.718282 | 0 | 0.666667 | 3 | 567 |
import Mathlib.Data.Sigma.Basic
import Mathlib.Algebra.Order.Ring.Nat
#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
variable {Ξ± : Type*}
inductive Lists'.{u} (Ξ± : Type u) : Bool β Type u
| atom : Ξ± β Lists' Ξ± false
| nil : Lists' Ξ± true
| cons' {b} : Lists' Ξ± b β Lists' Ξ± true β Lists' Ξ± true
deriving DecidableEq
#align lists' Lists'
compile_inductive% Lists'
def Lists (Ξ± : Type*) :=
Ξ£b, Lists' Ξ± b
#align lists Lists
namespace Lists'
instance [Inhabited Ξ±] : β b, Inhabited (Lists' Ξ± b)
| true => β¨nilβ©
| false => β¨atom defaultβ©
def cons : Lists Ξ± β Lists' Ξ± true β Lists' Ξ± true
| β¨_, aβ©, l => cons' a l
#align lists'.cons Lists'.cons
@[simp]
def toList : β {b}, Lists' Ξ± b β List (Lists Ξ±)
| _, atom _ => []
| _, nil => []
| _, cons' a l => β¨_, aβ© :: l.toList
#align lists'.to_list Lists'.toList
-- Porting note (#10618): removed @[simp]
-- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
theorem toList_cons (a : Lists Ξ±) (l) : toList (cons a l) = a :: l.toList := by simp
#align lists'.to_list_cons Lists'.toList_cons
@[simp]
def ofList : List (Lists Ξ±) β Lists' Ξ± true
| [] => nil
| a :: l => cons a (ofList l)
#align lists'.of_list Lists'.ofList
@[simp]
| Mathlib/SetTheory/Lists.lean | 99 | 99 | theorem to_ofList (l : List (Lists Ξ±)) : toList (ofList l) = l := by | induction l <;> simp [*]
| 1 | 2.718282 | 0 | 0.666667 | 3 | 567 |
import Mathlib.Data.Sigma.Basic
import Mathlib.Algebra.Order.Ring.Nat
#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
variable {Ξ± : Type*}
inductive Lists'.{u} (Ξ± : Type u) : Bool β Type u
| atom : Ξ± β Lists' Ξ± false
| nil : Lists' Ξ± true
| cons' {b} : Lists' Ξ± b β Lists' Ξ± true β Lists' Ξ± true
deriving DecidableEq
#align lists' Lists'
compile_inductive% Lists'
def Lists (Ξ± : Type*) :=
Ξ£b, Lists' Ξ± b
#align lists Lists
namespace Lists'
instance [Inhabited Ξ±] : β b, Inhabited (Lists' Ξ± b)
| true => β¨nilβ©
| false => β¨atom defaultβ©
def cons : Lists Ξ± β Lists' Ξ± true β Lists' Ξ± true
| β¨_, aβ©, l => cons' a l
#align lists'.cons Lists'.cons
@[simp]
def toList : β {b}, Lists' Ξ± b β List (Lists Ξ±)
| _, atom _ => []
| _, nil => []
| _, cons' a l => β¨_, aβ© :: l.toList
#align lists'.to_list Lists'.toList
-- Porting note (#10618): removed @[simp]
-- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
theorem toList_cons (a : Lists Ξ±) (l) : toList (cons a l) = a :: l.toList := by simp
#align lists'.to_list_cons Lists'.toList_cons
@[simp]
def ofList : List (Lists Ξ±) β Lists' Ξ± true
| [] => nil
| a :: l => cons a (ofList l)
#align lists'.of_list Lists'.ofList
@[simp]
theorem to_ofList (l : List (Lists Ξ±)) : toList (ofList l) = l := by induction l <;> simp [*]
#align lists'.to_of_list Lists'.to_ofList
@[simp]
| Mathlib/SetTheory/Lists.lean | 103 | 120 | theorem of_toList : β l : Lists' Ξ± true, ofList (toList l) = l :=
suffices
β (b) (h : true = b) (l : Lists' Ξ± b),
let l' : Lists' Ξ± true := by | rw [h]; exact l
ofList (toList l') = l'
from this _ rfl
fun b h l => by
induction l with
| atom => cases h
-- Porting note: case nil was not covered.
| nil => simp
| cons' b a _ IH =>
intro l'
-- Porting note: Previous code was:
-- change l' with cons' a l
--
-- This can be removed.
simpa [cons, l'] using IH rfl
| 15 | 3,269,017.372472 | 2 | 0.666667 | 3 | 567 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 29 | 30 | theorem aeval_T (x : A) (n : β€) : aeval x (T R n) = (T A n).eval x := by |
rw [aeval_def, evalβ_eq_eval_map, map_T]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 568 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
theorem aeval_T (x : A) (n : β€) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_T]
#align polynomial.chebyshev.aeval_T Polynomial.Chebyshev.aeval_T
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 34 | 35 | theorem aeval_U (x : A) (n : β€) : aeval x (U R n) = (U A n).eval x := by |
rw [aeval_def, evalβ_eq_eval_map, map_U]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 568 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
theorem aeval_T (x : A) (n : β€) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_T]
#align polynomial.chebyshev.aeval_T Polynomial.Chebyshev.aeval_T
@[simp]
theorem aeval_U (x : A) (n : β€) : aeval x (U R n) = (U A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_U]
#align polynomial.chebyshev.aeval_U Polynomial.Chebyshev.aeval_U
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 39 | 41 | theorem algebraMap_eval_T (x : R) (n : β€) :
algebraMap R A ((T R n).eval x) = (T A n).eval (algebraMap R A x) := by |
rw [β aeval_algebraMap_apply_eq_algebraMap_eval, aeval_T]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 568 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
theorem aeval_T (x : A) (n : β€) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_T]
#align polynomial.chebyshev.aeval_T Polynomial.Chebyshev.aeval_T
@[simp]
theorem aeval_U (x : A) (n : β€) : aeval x (U R n) = (U A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_U]
#align polynomial.chebyshev.aeval_U Polynomial.Chebyshev.aeval_U
@[simp]
theorem algebraMap_eval_T (x : R) (n : β€) :
algebraMap R A ((T R n).eval x) = (T A n).eval (algebraMap R A x) := by
rw [β aeval_algebraMap_apply_eq_algebraMap_eval, aeval_T]
#align polynomial.chebyshev.algebra_map_eval_T Polynomial.Chebyshev.algebraMap_eval_T
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 45 | 47 | theorem algebraMap_eval_U (x : R) (n : β€) :
algebraMap R A ((U R n).eval x) = (U A n).eval (algebraMap R A x) := by |
rw [β aeval_algebraMap_apply_eq_algebraMap_eval, aeval_U]
| 1 | 2.718282 | 0 | 0.666667 | 6 | 568 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
theorem aeval_T (x : A) (n : β€) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_T]
#align polynomial.chebyshev.aeval_T Polynomial.Chebyshev.aeval_T
@[simp]
theorem aeval_U (x : A) (n : β€) : aeval x (U R n) = (U A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_U]
#align polynomial.chebyshev.aeval_U Polynomial.Chebyshev.aeval_U
@[simp]
theorem algebraMap_eval_T (x : R) (n : β€) :
algebraMap R A ((T R n).eval x) = (T A n).eval (algebraMap R A x) := by
rw [β aeval_algebraMap_apply_eq_algebraMap_eval, aeval_T]
#align polynomial.chebyshev.algebra_map_eval_T Polynomial.Chebyshev.algebraMap_eval_T
@[simp]
theorem algebraMap_eval_U (x : R) (n : β€) :
algebraMap R A ((U R n).eval x) = (U A n).eval (algebraMap R A x) := by
rw [β aeval_algebraMap_apply_eq_algebraMap_eval, aeval_U]
#align polynomial.chebyshev.algebra_map_eval_U Polynomial.Chebyshev.algebraMap_eval_U
-- Porting note: added type ascriptions to the statement
@[simp, norm_cast]
theorem complex_ofReal_eval_T : β (x : β) n, (((T β n).eval x : β) : β) = (T β n).eval (x : β) :=
@algebraMap_eval_T β β _ _ _
#align polynomial.chebyshev.complex_of_real_eval_T Polynomial.Chebyshev.complex_ofReal_eval_T
-- Porting note: added type ascriptions to the statement
@[simp, norm_cast]
theorem complex_ofReal_eval_U : β (x : β) n, (((U β n).eval x : β) : β) = (U β n).eval (x : β) :=
@algebraMap_eval_U β β _ _ _
#align polynomial.chebyshev.complex_of_real_eval_U Polynomial.Chebyshev.complex_ofReal_eval_U
section Complex
open Complex
variable (ΞΈ : β)
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 73 | 86 | theorem T_complex_cos (n : β€) : (T β n).eval (cos ΞΈ) = cos (n * ΞΈ) := by |
induction n using Polynomial.Chebyshev.induct with
| zero => simp
| one => simp
| add_two n ih1 ih2 =>
simp only [T_add_two, eval_sub, eval_mul, eval_X, eval_ofNat, ih1, ih2, sub_eq_iff_eq_add,
cos_add_cos]
push_cast
ring_nf
| neg_add_one n ih1 ih2 =>
simp only [T_sub_one, eval_sub, eval_mul, eval_X, eval_ofNat, ih1, ih2, sub_eq_iff_eq_add',
cos_add_cos]
push_cast
ring_nf
| 13 | 442,413.392009 | 2 | 0.666667 | 6 | 568 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Complex.Exponential
import Mathlib.Data.Complex.Module
import Mathlib.RingTheory.Polynomial.Chebyshev
#align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
set_option linter.uppercaseLean3 false
namespace Polynomial.Chebyshev
open Polynomial
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
@[simp]
theorem aeval_T (x : A) (n : β€) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_T]
#align polynomial.chebyshev.aeval_T Polynomial.Chebyshev.aeval_T
@[simp]
theorem aeval_U (x : A) (n : β€) : aeval x (U R n) = (U A n).eval x := by
rw [aeval_def, evalβ_eq_eval_map, map_U]
#align polynomial.chebyshev.aeval_U Polynomial.Chebyshev.aeval_U
@[simp]
theorem algebraMap_eval_T (x : R) (n : β€) :
algebraMap R A ((T R n).eval x) = (T A n).eval (algebraMap R A x) := by
rw [β aeval_algebraMap_apply_eq_algebraMap_eval, aeval_T]
#align polynomial.chebyshev.algebra_map_eval_T Polynomial.Chebyshev.algebraMap_eval_T
@[simp]
theorem algebraMap_eval_U (x : R) (n : β€) :
algebraMap R A ((U R n).eval x) = (U A n).eval (algebraMap R A x) := by
rw [β aeval_algebraMap_apply_eq_algebraMap_eval, aeval_U]
#align polynomial.chebyshev.algebra_map_eval_U Polynomial.Chebyshev.algebraMap_eval_U
-- Porting note: added type ascriptions to the statement
@[simp, norm_cast]
theorem complex_ofReal_eval_T : β (x : β) n, (((T β n).eval x : β) : β) = (T β n).eval (x : β) :=
@algebraMap_eval_T β β _ _ _
#align polynomial.chebyshev.complex_of_real_eval_T Polynomial.Chebyshev.complex_ofReal_eval_T
-- Porting note: added type ascriptions to the statement
@[simp, norm_cast]
theorem complex_ofReal_eval_U : β (x : β) n, (((U β n).eval x : β) : β) = (U β n).eval (x : β) :=
@algebraMap_eval_U β β _ _ _
#align polynomial.chebyshev.complex_of_real_eval_U Polynomial.Chebyshev.complex_ofReal_eval_U
section Complex
open Complex
variable (ΞΈ : β)
@[simp]
theorem T_complex_cos (n : β€) : (T β n).eval (cos ΞΈ) = cos (n * ΞΈ) := by
induction n using Polynomial.Chebyshev.induct with
| zero => simp
| one => simp
| add_two n ih1 ih2 =>
simp only [T_add_two, eval_sub, eval_mul, eval_X, eval_ofNat, ih1, ih2, sub_eq_iff_eq_add,
cos_add_cos]
push_cast
ring_nf
| neg_add_one n ih1 ih2 =>
simp only [T_sub_one, eval_sub, eval_mul, eval_X, eval_ofNat, ih1, ih2, sub_eq_iff_eq_add',
cos_add_cos]
push_cast
ring_nf
#align polynomial.chebyshev.T_complex_cos Polynomial.Chebyshev.T_complex_cos
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean | 92 | 105 | theorem U_complex_cos (n : β€) : (U β n).eval (cos ΞΈ) * sin ΞΈ = sin ((n + 1) * ΞΈ) := by |
induction n using Polynomial.Chebyshev.induct with
| zero => simp
| one => simp [one_add_one_eq_two, sin_two_mul]; ring
| add_two n ih1 ih2 =>
simp only [U_add_two, add_sub_cancel_right, eval_sub, eval_mul, eval_X, eval_ofNat, sub_mul,
mul_assoc, ih1, ih2, sub_eq_iff_eq_add, sin_add_sin]
push_cast
ring_nf
| neg_add_one n ih1 ih2 =>
simp only [U_sub_one, add_sub_cancel_right, eval_sub, eval_mul, eval_X, eval_ofNat, sub_mul,
mul_assoc, ih1, ih2, sub_eq_iff_eq_add', sin_add_sin]
push_cast
ring_nf
| 13 | 442,413.392009 | 2 | 0.666667 | 6 | 568 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
| Mathlib/Data/Nat/Size.lean | 38 | 39 | theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by |
induction n <;> simp [bit_ne_zero, shiftLeft', *]
| 1 | 2.718282 | 0 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
| Mathlib/Data/Nat/Size.lean | 51 | 51 | theorem size_zero : size 0 = 0 := by | simp [size]
| 1 | 2.718282 | 0 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
| Mathlib/Data/Nat/Size.lean | 55 | 61 | theorem size_bit {b n} (h : bit b n β 0) : size (bit b n) = succ (size n) := by |
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
| 6 | 403.428793 | 2 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n β 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n β 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
| Mathlib/Data/Nat/Size.lean | 85 | 97 | theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β 0) :
size (shiftLeft' b m n) = size m + n := by |
induction' n with n IH <;> simp [shiftLeft'] at h β’
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h β’
cases b; Β· exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one β¨_, this.symmβ©)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn β¦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
| 11 | 59,874.141715 | 2 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n β 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n β 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h β’
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h β’
cases b; Β· exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one β¨_, this.symmβ©)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn β¦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
| Mathlib/Data/Nat/Size.lean | 103 | 104 | theorem size_shiftLeft {m} (h : m β 0) (n) : size (m <<< n) = size m + n := by |
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), β shiftLeft'_false]
| 1 | 2.718282 | 0 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n β 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n β 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h β’
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h β’
cases b; Β· exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one β¨_, this.symmβ©)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn β¦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
theorem size_shiftLeft {m} (h : m β 0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), β shiftLeft'_false]
#align nat.size_shiftl Nat.size_shiftLeft
| Mathlib/Data/Nat/Size.lean | 107 | 116 | theorem lt_size_self (n : β) : n < 2 ^ size n := by |
rw [β one_shiftLeft]
have : β {n}, n = 0 β n < 1 <<< (size n) := by simp
apply binaryRec _ _ n
Β· apply this rfl
intro b n IH
by_cases h : bit b n = 0
Β· apply this h
rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, β bit0_val]
exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH)
| 9 | 8,103.083928 | 2 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n β 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n β 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h β’
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h β’
cases b; Β· exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one β¨_, this.symmβ©)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn β¦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
theorem size_shiftLeft {m} (h : m β 0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), β shiftLeft'_false]
#align nat.size_shiftl Nat.size_shiftLeft
theorem lt_size_self (n : β) : n < 2 ^ size n := by
rw [β one_shiftLeft]
have : β {n}, n = 0 β n < 1 <<< (size n) := by simp
apply binaryRec _ _ n
Β· apply this rfl
intro b n IH
by_cases h : bit b n = 0
Β· apply this h
rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, β bit0_val]
exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH)
#align nat.lt_size_self Nat.lt_size_self
theorem size_le {m n : β} : size m β€ n β m < 2 ^ n :=
β¨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by
rw [β one_shiftLeft]; revert n
apply binaryRec _ _ m
Β· intro n
simp
Β· intro b m IH n h
by_cases e : bit b m = 0
Β· simp [e]
rw [size_bit e]
cases' n with n
Β· exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h))
Β· apply succ_le_succ (IH _)
apply Nat.lt_of_mul_lt_mul_left (a := 2)
simp only [β bit0_val, shiftLeft_succ] at *
exact lt_of_le_of_lt (bit0_le_bit b rfl.le) hβ©
#align nat.size_le Nat.size_le
| Mathlib/Data/Nat/Size.lean | 137 | 138 | theorem lt_size {m n : β} : m < size n β 2 ^ m β€ n := by |
rw [β not_lt, Decidable.iff_not_comm, not_lt, size_le]
| 1 | 2.718282 | 0 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n β 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n β 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h β’
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h β’
cases b; Β· exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one β¨_, this.symmβ©)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn β¦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
theorem size_shiftLeft {m} (h : m β 0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), β shiftLeft'_false]
#align nat.size_shiftl Nat.size_shiftLeft
theorem lt_size_self (n : β) : n < 2 ^ size n := by
rw [β one_shiftLeft]
have : β {n}, n = 0 β n < 1 <<< (size n) := by simp
apply binaryRec _ _ n
Β· apply this rfl
intro b n IH
by_cases h : bit b n = 0
Β· apply this h
rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, β bit0_val]
exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH)
#align nat.lt_size_self Nat.lt_size_self
theorem size_le {m n : β} : size m β€ n β m < 2 ^ n :=
β¨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by
rw [β one_shiftLeft]; revert n
apply binaryRec _ _ m
Β· intro n
simp
Β· intro b m IH n h
by_cases e : bit b m = 0
Β· simp [e]
rw [size_bit e]
cases' n with n
Β· exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h))
Β· apply succ_le_succ (IH _)
apply Nat.lt_of_mul_lt_mul_left (a := 2)
simp only [β bit0_val, shiftLeft_succ] at *
exact lt_of_le_of_lt (bit0_le_bit b rfl.le) hβ©
#align nat.size_le Nat.size_le
theorem lt_size {m n : β} : m < size n β 2 ^ m β€ n := by
rw [β not_lt, Decidable.iff_not_comm, not_lt, size_le]
#align nat.lt_size Nat.lt_size
| Mathlib/Data/Nat/Size.lean | 141 | 141 | theorem size_pos {n : β} : 0 < size n β 0 < n := by | rw [lt_size]; rfl
| 1 | 2.718282 | 0 | 0.666667 | 9 | 569 |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : β n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : β n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m β 0) (n) : shiftLeft' b m n β 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : β {n}, (n β 0) β shiftLeft' true m n β 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n β 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n β 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n β 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h β’
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h β’
cases b; Β· exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (Β· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one β¨_, this.symmβ©)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn β¦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
theorem size_shiftLeft {m} (h : m β 0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), β shiftLeft'_false]
#align nat.size_shiftl Nat.size_shiftLeft
theorem lt_size_self (n : β) : n < 2 ^ size n := by
rw [β one_shiftLeft]
have : β {n}, n = 0 β n < 1 <<< (size n) := by simp
apply binaryRec _ _ n
Β· apply this rfl
intro b n IH
by_cases h : bit b n = 0
Β· apply this h
rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, β bit0_val]
exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH)
#align nat.lt_size_self Nat.lt_size_self
theorem size_le {m n : β} : size m β€ n β m < 2 ^ n :=
β¨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by
rw [β one_shiftLeft]; revert n
apply binaryRec _ _ m
Β· intro n
simp
Β· intro b m IH n h
by_cases e : bit b m = 0
Β· simp [e]
rw [size_bit e]
cases' n with n
Β· exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h))
Β· apply succ_le_succ (IH _)
apply Nat.lt_of_mul_lt_mul_left (a := 2)
simp only [β bit0_val, shiftLeft_succ] at *
exact lt_of_le_of_lt (bit0_le_bit b rfl.le) hβ©
#align nat.size_le Nat.size_le
theorem lt_size {m n : β} : m < size n β 2 ^ m β€ n := by
rw [β not_lt, Decidable.iff_not_comm, not_lt, size_le]
#align nat.lt_size Nat.lt_size
theorem size_pos {n : β} : 0 < size n β 0 < n := by rw [lt_size]; rfl
#align nat.size_pos Nat.size_pos
| Mathlib/Data/Nat/Size.lean | 144 | 145 | theorem size_eq_zero {n : β} : size n = 0 β n = 0 := by |
simpa [Nat.pos_iff_ne_zero, not_iff_not] using size_pos
| 1 | 2.718282 | 0 | 0.666667 | 9 | 569 |
import Mathlib.Algebra.BigOperators.WithTop
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.ENNReal.Basic
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
variable {a b c d : ββ₯0β} {r p q : ββ₯0}
section Mul
-- Porting note (#11215): TODO: generalize to `WithTop`
@[mono, gcongr]
| Mathlib/Data/ENNReal/Operations.lean | 33 | 41 | theorem mul_lt_mul (ac : a < c) (bd : b < d) : a * b < c * d := by |
rcases lt_iff_exists_nnreal_btwn.1 ac with β¨a', aa', a'cβ©
lift a to ββ₯0 using ne_top_of_lt aa'
rcases lt_iff_exists_nnreal_btwn.1 bd with β¨b', bb', b'dβ©
lift b to ββ₯0 using ne_top_of_lt bb'
norm_cast at *
calc
β(a * b) < β(a' * b') := coe_lt_coe.2 (mul_lt_mulβ aa' bb')
_ β€ c * d := mul_le_mul' a'c.le b'd.le
| 8 | 2,980.957987 | 2 | 0.666667 | 12 | 570 |
import Mathlib.Algebra.BigOperators.WithTop
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.ENNReal.Basic
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
variable {a b c d : ββ₯0β} {r p q : ββ₯0}
section Mul
-- Porting note (#11215): TODO: generalize to `WithTop`
@[mono, gcongr]
theorem mul_lt_mul (ac : a < c) (bd : b < d) : a * b < c * d := by
rcases lt_iff_exists_nnreal_btwn.1 ac with β¨a', aa', a'cβ©
lift a to ββ₯0 using ne_top_of_lt aa'
rcases lt_iff_exists_nnreal_btwn.1 bd with β¨b', bb', b'dβ©
lift b to ββ₯0 using ne_top_of_lt bb'
norm_cast at *
calc
β(a * b) < β(a' * b') := coe_lt_coe.2 (mul_lt_mulβ aa' bb')
_ β€ c * d := mul_le_mul' a'c.le b'd.le
#align ennreal.mul_lt_mul ENNReal.mul_lt_mul
-- TODO: generalize to `CovariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·)`
theorem mul_left_mono : Monotone (a * Β·) := fun _ _ => mul_le_mul' le_rfl
#align ennreal.mul_left_mono ENNReal.mul_left_mono
-- TODO: generalize to `CovariantClass Ξ± Ξ± (swap (Β· * Β·)) (Β· β€ Β·)`
theorem mul_right_mono : Monotone (Β· * a) := fun _ _ h => mul_le_mul' h le_rfl
#align ennreal.mul_right_mono ENNReal.mul_right_mono
-- Porting note (#11215): TODO: generalize to `WithTop`
theorem pow_strictMono : β {n : β}, n β 0 β StrictMono fun x : ββ₯0β => x ^ n
| 0, h => absurd rfl h
| 1, _ => by simpa only [pow_one] using strictMono_id
| n + 2, _ => fun x y h β¦ by
simp_rw [pow_succ _ (n + 1)]; exact mul_lt_mul (pow_strictMono n.succ_ne_zero h) h
#align ennreal.pow_strict_mono ENNReal.pow_strictMono
@[gcongr] protected theorem pow_lt_pow_left (h : a < b) {n : β} (hn : n β 0) :
a ^ n < b ^ n :=
ENNReal.pow_strictMono hn h
theorem max_mul : max a b * c = max (a * c) (b * c) := mul_right_mono.map_max
#align ennreal.max_mul ENNReal.max_mul
theorem mul_max : a * max b c = max (a * b) (a * c) := mul_left_mono.map_max
#align ennreal.mul_max ENNReal.mul_max
-- Porting note (#11215): TODO: generalize to `WithTop`
| Mathlib/Data/ENNReal/Operations.lean | 71 | 77 | theorem mul_left_strictMono (h0 : a β 0) (hinf : a β β) : StrictMono (a * Β·) := by |
lift a to ββ₯0 using hinf
rw [coe_ne_zero] at h0
intro x y h
contrapose! h
simpa only [β mul_assoc, β coe_mul, inv_mul_cancel h0, coe_one, one_mul]
using mul_le_mul_left' h (βaβ»ΒΉ)
| 6 | 403.428793 | 2 | 0.666667 | 12 | 570 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.