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