Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
rank
int64
0
2.4k
import Mathlib.Algebra.Polynomial.Module.Basic import Mathlib.Algebra.Ring.Idempotents import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Noetherian import Mathlib.RingTheory.ReesAlgebra import Mathlib.RingTheory.Finiteness import Mathlib.Order.Basic import Mathlib.Order.Hom.Lattice #align_import ring_theory.filtration from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe u v variable {R M : Type u} [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R) open Polynomial open scoped Polynomial @[ext] structure Ideal.Filtration (M : Type u) [AddCommGroup M] [Module R M] where N : ℕ → Submodule R M mono : ∀ i, N (i + 1) ≤ N i smul_le : ∀ i, I • N i ≤ N (i + 1) #align ideal.filtration Ideal.Filtration variable (F F' : I.Filtration M) {I} namespace Ideal.Filtration theorem pow_smul_le (i j : ℕ) : I ^ i • F.N j ≤ F.N (i + j) := by induction' i with _ ih · simp · rw [pow_succ', mul_smul, add_assoc, add_comm 1, ← add_assoc] exact (smul_mono_right _ ih).trans (F.smul_le _) #align ideal.filtration.pow_smul_le Ideal.Filtration.pow_smul_le
Mathlib/RingTheory/Filtration.lean
74
76
theorem pow_smul_le_pow_smul (i j k : ℕ) : I ^ (i + k) • F.N j ≤ I ^ k • F.N (i + j) := by
rw [add_comm, pow_add, mul_smul] exact smul_mono_right _ (F.pow_smul_le i j)
1,900
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type u) [CommRing R] [IsDomain R] [DiscreteValuationRing R] theorem not_a_field : maximalIdeal R ≠ ⊥ := not_a_field' #align discrete_valuation_ring.not_a_field DiscreteValuationRing.not_a_field theorem not_isField : ¬IsField R := LocalRing.isField_iff_maximalIdeal_eq.not.mpr (not_a_field R) #align discrete_valuation_ring.not_is_field DiscreteValuationRing.not_isField variable {R} open PrincipalIdealRing
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
75
88
theorem irreducible_of_span_eq_maximalIdeal {R : Type*} [CommRing R] [LocalRing R] [IsDomain R] (ϖ : R) (hϖ : ϖ ≠ 0) (h : maximalIdeal R = Ideal.span {ϖ}) : Irreducible ϖ := by
have h2 : ¬IsUnit ϖ := show ϖ ∈ maximalIdeal R from h.symm ▸ Submodule.mem_span_singleton_self ϖ refine ⟨h2, ?_⟩ intro a b hab by_contra! h obtain ⟨ha : a ∈ maximalIdeal R, hb : b ∈ maximalIdeal R⟩ := h rw [h, mem_span_singleton'] at ha hb rcases ha with ⟨a, rfl⟩ rcases hb with ⟨b, rfl⟩ rw [show a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b)) by ring] at hab apply hϖ apply eq_zero_of_mul_eq_self_right _ hab.symm exact fun hh => h2 (isUnit_of_dvd_one ⟨_, hh.symm⟩)
1,901
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type u) [CommRing R] [IsDomain R] [DiscreteValuationRing R] theorem not_a_field : maximalIdeal R ≠ ⊥ := not_a_field' #align discrete_valuation_ring.not_a_field DiscreteValuationRing.not_a_field theorem not_isField : ¬IsField R := LocalRing.isField_iff_maximalIdeal_eq.not.mpr (not_a_field R) #align discrete_valuation_ring.not_is_field DiscreteValuationRing.not_isField variable {R} open PrincipalIdealRing theorem irreducible_of_span_eq_maximalIdeal {R : Type*} [CommRing R] [LocalRing R] [IsDomain R] (ϖ : R) (hϖ : ϖ ≠ 0) (h : maximalIdeal R = Ideal.span {ϖ}) : Irreducible ϖ := by have h2 : ¬IsUnit ϖ := show ϖ ∈ maximalIdeal R from h.symm ▸ Submodule.mem_span_singleton_self ϖ refine ⟨h2, ?_⟩ intro a b hab by_contra! h obtain ⟨ha : a ∈ maximalIdeal R, hb : b ∈ maximalIdeal R⟩ := h rw [h, mem_span_singleton'] at ha hb rcases ha with ⟨a, rfl⟩ rcases hb with ⟨b, rfl⟩ rw [show a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b)) by ring] at hab apply hϖ apply eq_zero_of_mul_eq_self_right _ hab.symm exact fun hh => h2 (isUnit_of_dvd_one ⟨_, hh.symm⟩) #align discrete_valuation_ring.irreducible_of_span_eq_maximal_ideal DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal theorem irreducible_iff_uniformizer (ϖ : R) : Irreducible ϖ ↔ maximalIdeal R = Ideal.span {ϖ} := ⟨fun hϖ => (eq_maximalIdeal (isMaximal_of_irreducible hϖ)).symm, fun h => irreducible_of_span_eq_maximalIdeal ϖ (fun e => not_a_field R <| by rwa [h, span_singleton_eq_bot]) h⟩ #align discrete_valuation_ring.irreducible_iff_uniformizer DiscreteValuationRing.irreducible_iff_uniformizer theorem _root_.Irreducible.maximalIdeal_eq {ϖ : R} (h : Irreducible ϖ) : maximalIdeal R = Ideal.span {ϖ} := (irreducible_iff_uniformizer _).mp h #align irreducible.maximal_ideal_eq Irreducible.maximalIdeal_eq variable (R)
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
107
109
theorem exists_irreducible : ∃ ϖ : R, Irreducible ϖ := by
simp_rw [irreducible_iff_uniformizer] exact (IsPrincipalIdealRing.principal <| maximalIdeal R).principal
1,901
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type u) [CommRing R] [IsDomain R] [DiscreteValuationRing R] theorem not_a_field : maximalIdeal R ≠ ⊥ := not_a_field' #align discrete_valuation_ring.not_a_field DiscreteValuationRing.not_a_field theorem not_isField : ¬IsField R := LocalRing.isField_iff_maximalIdeal_eq.not.mpr (not_a_field R) #align discrete_valuation_ring.not_is_field DiscreteValuationRing.not_isField variable {R} open PrincipalIdealRing theorem irreducible_of_span_eq_maximalIdeal {R : Type*} [CommRing R] [LocalRing R] [IsDomain R] (ϖ : R) (hϖ : ϖ ≠ 0) (h : maximalIdeal R = Ideal.span {ϖ}) : Irreducible ϖ := by have h2 : ¬IsUnit ϖ := show ϖ ∈ maximalIdeal R from h.symm ▸ Submodule.mem_span_singleton_self ϖ refine ⟨h2, ?_⟩ intro a b hab by_contra! h obtain ⟨ha : a ∈ maximalIdeal R, hb : b ∈ maximalIdeal R⟩ := h rw [h, mem_span_singleton'] at ha hb rcases ha with ⟨a, rfl⟩ rcases hb with ⟨b, rfl⟩ rw [show a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b)) by ring] at hab apply hϖ apply eq_zero_of_mul_eq_self_right _ hab.symm exact fun hh => h2 (isUnit_of_dvd_one ⟨_, hh.symm⟩) #align discrete_valuation_ring.irreducible_of_span_eq_maximal_ideal DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal theorem irreducible_iff_uniformizer (ϖ : R) : Irreducible ϖ ↔ maximalIdeal R = Ideal.span {ϖ} := ⟨fun hϖ => (eq_maximalIdeal (isMaximal_of_irreducible hϖ)).symm, fun h => irreducible_of_span_eq_maximalIdeal ϖ (fun e => not_a_field R <| by rwa [h, span_singleton_eq_bot]) h⟩ #align discrete_valuation_ring.irreducible_iff_uniformizer DiscreteValuationRing.irreducible_iff_uniformizer theorem _root_.Irreducible.maximalIdeal_eq {ϖ : R} (h : Irreducible ϖ) : maximalIdeal R = Ideal.span {ϖ} := (irreducible_iff_uniformizer _).mp h #align irreducible.maximal_ideal_eq Irreducible.maximalIdeal_eq variable (R) theorem exists_irreducible : ∃ ϖ : R, Irreducible ϖ := by simp_rw [irreducible_iff_uniformizer] exact (IsPrincipalIdealRing.principal <| maximalIdeal R).principal #align discrete_valuation_ring.exists_irreducible DiscreteValuationRing.exists_irreducible theorem exists_prime : ∃ ϖ : R, Prime ϖ := (exists_irreducible R).imp fun _ => irreducible_iff_prime.1 #align discrete_valuation_ring.exists_prime DiscreteValuationRing.exists_prime
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
118
145
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] : DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
constructor · intro RDVR rcases id RDVR with ⟨Rlocal⟩ constructor · assumption use LocalRing.maximalIdeal R constructor · exact ⟨Rlocal, inferInstance⟩ · rintro Q ⟨hQ1, hQ2⟩ obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1 have hq : q ≠ 0 := by rintro rfl apply hQ1 simp erw [span_singleton_prime hq] at hQ2 replace hQ2 := hQ2.irreducible rw [irreducible_iff_uniformizer] at hQ2 exact hQ2.symm · rintro ⟨RPID, Punique⟩ haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique refine { not_a_field' := ?_ } rcases Punique with ⟨P, ⟨hP1, hP2⟩, _⟩ have hPM : P ≤ maximalIdeal R := le_maximalIdeal hP2.1 intro h rw [h, le_bot_iff] at hPM exact hP1 hPM
1,901
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type u) [CommRing R] [IsDomain R] [DiscreteValuationRing R] theorem not_a_field : maximalIdeal R ≠ ⊥ := not_a_field' #align discrete_valuation_ring.not_a_field DiscreteValuationRing.not_a_field theorem not_isField : ¬IsField R := LocalRing.isField_iff_maximalIdeal_eq.not.mpr (not_a_field R) #align discrete_valuation_ring.not_is_field DiscreteValuationRing.not_isField variable {R} open PrincipalIdealRing theorem irreducible_of_span_eq_maximalIdeal {R : Type*} [CommRing R] [LocalRing R] [IsDomain R] (ϖ : R) (hϖ : ϖ ≠ 0) (h : maximalIdeal R = Ideal.span {ϖ}) : Irreducible ϖ := by have h2 : ¬IsUnit ϖ := show ϖ ∈ maximalIdeal R from h.symm ▸ Submodule.mem_span_singleton_self ϖ refine ⟨h2, ?_⟩ intro a b hab by_contra! h obtain ⟨ha : a ∈ maximalIdeal R, hb : b ∈ maximalIdeal R⟩ := h rw [h, mem_span_singleton'] at ha hb rcases ha with ⟨a, rfl⟩ rcases hb with ⟨b, rfl⟩ rw [show a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b)) by ring] at hab apply hϖ apply eq_zero_of_mul_eq_self_right _ hab.symm exact fun hh => h2 (isUnit_of_dvd_one ⟨_, hh.symm⟩) #align discrete_valuation_ring.irreducible_of_span_eq_maximal_ideal DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal theorem irreducible_iff_uniformizer (ϖ : R) : Irreducible ϖ ↔ maximalIdeal R = Ideal.span {ϖ} := ⟨fun hϖ => (eq_maximalIdeal (isMaximal_of_irreducible hϖ)).symm, fun h => irreducible_of_span_eq_maximalIdeal ϖ (fun e => not_a_field R <| by rwa [h, span_singleton_eq_bot]) h⟩ #align discrete_valuation_ring.irreducible_iff_uniformizer DiscreteValuationRing.irreducible_iff_uniformizer theorem _root_.Irreducible.maximalIdeal_eq {ϖ : R} (h : Irreducible ϖ) : maximalIdeal R = Ideal.span {ϖ} := (irreducible_iff_uniformizer _).mp h #align irreducible.maximal_ideal_eq Irreducible.maximalIdeal_eq variable (R) theorem exists_irreducible : ∃ ϖ : R, Irreducible ϖ := by simp_rw [irreducible_iff_uniformizer] exact (IsPrincipalIdealRing.principal <| maximalIdeal R).principal #align discrete_valuation_ring.exists_irreducible DiscreteValuationRing.exists_irreducible theorem exists_prime : ∃ ϖ : R, Prime ϖ := (exists_irreducible R).imp fun _ => irreducible_iff_prime.1 #align discrete_valuation_ring.exists_prime DiscreteValuationRing.exists_prime theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] : DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by constructor · intro RDVR rcases id RDVR with ⟨Rlocal⟩ constructor · assumption use LocalRing.maximalIdeal R constructor · exact ⟨Rlocal, inferInstance⟩ · rintro Q ⟨hQ1, hQ2⟩ obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1 have hq : q ≠ 0 := by rintro rfl apply hQ1 simp erw [span_singleton_prime hq] at hQ2 replace hQ2 := hQ2.irreducible rw [irreducible_iff_uniformizer] at hQ2 exact hQ2.symm · rintro ⟨RPID, Punique⟩ haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique refine { not_a_field' := ?_ } rcases Punique with ⟨P, ⟨hP1, hP2⟩, _⟩ have hPM : P ≤ maximalIdeal R := le_maximalIdeal hP2.1 intro h rw [h, le_bot_iff] at hPM exact hP1 hPM #align discrete_valuation_ring.iff_pid_with_one_nonzero_prime DiscreteValuationRing.iff_pid_with_one_nonzero_prime
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
148
151
theorem associated_of_irreducible {a b : R} (ha : Irreducible a) (hb : Irreducible b) : Associated a b := by
rw [irreducible_iff_uniformizer] at ha hb rw [← span_singleton_eq_span_singleton, ← ha, hb]
1,901
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type*) def HasUnitMulPowIrreducibleFactorization [CommRing R] : Prop := ∃ p : R, Irreducible p ∧ ∀ {x : R}, x ≠ 0 → ∃ n : ℕ, Associated (p ^ n) x #align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization namespace HasUnitMulPowIrreducibleFactorization variable {R} [CommRing R] (hR : HasUnitMulPowIrreducibleFactorization R)
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
169
190
theorem unique_irreducible ⦃p q : R⦄ (hp : Irreducible p) (hq : Irreducible q) : Associated p q := by
rcases hR with ⟨ϖ, hϖ, hR⟩ suffices ∀ {p : R} (_ : Irreducible p), Associated p ϖ by apply Associated.trans (this hp) (this hq).symm clear hp hq p q intro p hp obtain ⟨n, hn⟩ := hR hp.ne_zero have : Irreducible (ϖ ^ n) := hn.symm.irreducible hp rcases lt_trichotomy n 1 with (H | rfl | H) · obtain rfl : n = 0 := by clear hn this revert H n decide simp [not_irreducible_one, pow_zero] at this · simpa only [pow_one] using hn.symm · obtain ⟨n, rfl⟩ : ∃ k, n = 1 + k + 1 := Nat.exists_eq_add_of_lt H rw [pow_succ'] at this rcases this.isUnit_or_isUnit rfl with (H0 | H0) · exact (hϖ.not_unit H0).elim · rw [add_comm, pow_succ'] at H0 exact (hϖ.not_unit (isUnit_of_mul_isUnit_left H0)).elim
1,901
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type*) def HasUnitMulPowIrreducibleFactorization [CommRing R] : Prop := ∃ p : R, Irreducible p ∧ ∀ {x : R}, x ≠ 0 → ∃ n : ℕ, Associated (p ^ n) x #align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization namespace HasUnitMulPowIrreducibleFactorization variable {R} [CommRing R] (hR : HasUnitMulPowIrreducibleFactorization R) theorem unique_irreducible ⦃p q : R⦄ (hp : Irreducible p) (hq : Irreducible q) : Associated p q := by rcases hR with ⟨ϖ, hϖ, hR⟩ suffices ∀ {p : R} (_ : Irreducible p), Associated p ϖ by apply Associated.trans (this hp) (this hq).symm clear hp hq p q intro p hp obtain ⟨n, hn⟩ := hR hp.ne_zero have : Irreducible (ϖ ^ n) := hn.symm.irreducible hp rcases lt_trichotomy n 1 with (H | rfl | H) · obtain rfl : n = 0 := by clear hn this revert H n decide simp [not_irreducible_one, pow_zero] at this · simpa only [pow_one] using hn.symm · obtain ⟨n, rfl⟩ : ∃ k, n = 1 + k + 1 := Nat.exists_eq_add_of_lt H rw [pow_succ'] at this rcases this.isUnit_or_isUnit rfl with (H0 | H0) · exact (hϖ.not_unit H0).elim · rw [add_comm, pow_succ'] at H0 exact (hϖ.not_unit (isUnit_of_mul_isUnit_left H0)).elim #align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization.unique_irreducible DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization.unique_irreducible variable [IsDomain R] theorem toUniqueFactorizationMonoid : UniqueFactorizationMonoid R := let p := Classical.choose hR let spec := Classical.choose_spec hR UniqueFactorizationMonoid.of_exists_prime_factors fun x hx => by use Multiset.replicate (Classical.choose (spec.2 hx)) p constructor · intro q hq have hpq := Multiset.eq_of_mem_replicate hq rw [hpq] refine ⟨spec.1.ne_zero, spec.1.not_unit, ?_⟩ intro a b h by_cases ha : a = 0 · rw [ha] simp only [true_or_iff, dvd_zero] obtain ⟨m, u, rfl⟩ := spec.2 ha rw [mul_assoc, mul_left_comm, Units.dvd_mul_left] at h rw [Units.dvd_mul_right] by_cases hm : m = 0 · simp only [hm, one_mul, pow_zero] at h ⊢ right exact h left obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hm rw [pow_succ'] apply dvd_mul_of_dvd_left dvd_rfl _ · rw [Multiset.prod_replicate] exact Classical.choose_spec (spec.2 hx) #align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization.to_unique_factorization_monoid DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization.toUniqueFactorizationMonoid
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
227
245
theorem of_ufd_of_unique_irreducible [UniqueFactorizationMonoid R] (h₁ : ∃ p : R, Irreducible p) (h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q) : HasUnitMulPowIrreducibleFactorization R := by
obtain ⟨p, hp⟩ := h₁ refine ⟨p, hp, ?_⟩ intro x hx cases' WfDvdMonoid.exists_factors x hx with fx hfx refine ⟨Multiset.card fx, ?_⟩ have H := hfx.2 rw [← Associates.mk_eq_mk_iff_associated] at H ⊢ rw [← H, ← Associates.prod_mk, Associates.mk_pow, ← Multiset.prod_replicate] congr 1 symm rw [Multiset.eq_replicate] simp only [true_and_iff, and_imp, Multiset.card_map, eq_self_iff_true, Multiset.mem_map, exists_imp] rintro _ q hq rfl rw [Associates.mk_eq_mk_iff_associated] apply h₂ (hfx.1 _ hq) hp
1,901
import Mathlib.RingTheory.DiscreteValuationRing.Basic import Mathlib.RingTheory.MvPowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.RingTheory.PowerSeries.Order #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Ring variable [Ring R] protected def inv.aux : R → R⟦X⟧ → R⟦X⟧ := MvPowerSeries.inv.aux #align power_series.inv.aux PowerSeries.inv.aux
Mathlib/RingTheory/PowerSeries/Inverse.lean
54
81
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) : coeff R n (inv.aux a φ) = if n = 0 then a else -a * ∑ x ∈ antidiagonal n, if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux] simp only [Finsupp.single_eq_zero] split_ifs; · rfl congr 1 symm apply Finset.sum_nbij' (fun (a, b) ↦ (single () a, single () b)) fun (f, g) ↦ (f (), g ()) · aesop · aesop · aesop · aesop · rintro ⟨i, j⟩ _hij obtain H | H := le_or_lt n j · aesop rw [if_pos H, if_pos] · rfl refine ⟨?_, fun hh ↦ H.not_le ?_⟩ · rintro ⟨⟩ simpa [Finsupp.single_eq_same] using le_of_lt H · simpa [Finsupp.single_eq_same] using hh ()
1,902
import Mathlib.RingTheory.DiscreteValuationRing.Basic import Mathlib.RingTheory.MvPowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.RingTheory.PowerSeries.Order #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Ring variable [Ring R] protected def inv.aux : R → R⟦X⟧ → R⟦X⟧ := MvPowerSeries.inv.aux #align power_series.inv.aux PowerSeries.inv.aux theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) : coeff R n (inv.aux a φ) = if n = 0 then a else -a * ∑ x ∈ antidiagonal n, if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux] simp only [Finsupp.single_eq_zero] split_ifs; · rfl congr 1 symm apply Finset.sum_nbij' (fun (a, b) ↦ (single () a, single () b)) fun (f, g) ↦ (f (), g ()) · aesop · aesop · aesop · aesop · rintro ⟨i, j⟩ _hij obtain H | H := le_or_lt n j · aesop rw [if_pos H, if_pos] · rfl refine ⟨?_, fun hh ↦ H.not_le ?_⟩ · rintro ⟨⟩ simpa [Finsupp.single_eq_same] using le_of_lt H · simpa [Finsupp.single_eq_same] using hh () #align power_series.coeff_inv_aux PowerSeries.coeff_inv_aux def invOfUnit (φ : R⟦X⟧) (u : Rˣ) : R⟦X⟧ := MvPowerSeries.invOfUnit φ u #align power_series.inv_of_unit PowerSeries.invOfUnit theorem coeff_invOfUnit (n : ℕ) (φ : R⟦X⟧) (u : Rˣ) : coeff R n (invOfUnit φ u) = if n = 0 then ↑u⁻¹ else -↑u⁻¹ * ∑ x ∈ antidiagonal n, if x.2 < n then coeff R x.1 φ * coeff R x.2 (invOfUnit φ u) else 0 := coeff_inv_aux n (↑u⁻¹ : R) φ #align power_series.coeff_inv_of_unit PowerSeries.coeff_invOfUnit @[simp]
Mathlib/RingTheory/PowerSeries/Inverse.lean
100
102
theorem constantCoeff_invOfUnit (φ : R⟦X⟧) (u : Rˣ) : constantCoeff R (invOfUnit φ u) = ↑u⁻¹ := by
rw [← coeff_zero_eq_constantCoeff_apply, coeff_invOfUnit, if_pos rfl]
1,902
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def'
Mathlib/NumberTheory/Bernoulli.lean
78
80
theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by
rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range]
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def
Mathlib/NumberTheory/Bernoulli.lean
83
88
theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by
rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self])
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec
Mathlib/NumberTheory/Bernoulli.lean
91
95
theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by
refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub]
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' section Examples @[simp]
Mathlib/NumberTheory/Bernoulli.lean
104
106
theorem bernoulli'_zero : bernoulli' 0 = 1 := by
rw [bernoulli'_def] norm_num
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' section Examples @[simp] theorem bernoulli'_zero : bernoulli' 0 = 1 := by rw [bernoulli'_def] norm_num #align bernoulli'_zero bernoulli'_zero @[simp]
Mathlib/NumberTheory/Bernoulli.lean
110
112
theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by
rw [bernoulli'_def] norm_num
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' section Examples @[simp] theorem bernoulli'_zero : bernoulli' 0 = 1 := by rw [bernoulli'_def] norm_num #align bernoulli'_zero bernoulli'_zero @[simp] theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by rw [bernoulli'_def] norm_num #align bernoulli'_one bernoulli'_one @[simp]
Mathlib/NumberTheory/Bernoulli.lean
116
118
theorem bernoulli'_two : bernoulli' 2 = 1 / 6 := by
rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero]
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' section Examples @[simp] theorem bernoulli'_zero : bernoulli' 0 = 1 := by rw [bernoulli'_def] norm_num #align bernoulli'_zero bernoulli'_zero @[simp] theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by rw [bernoulli'_def] norm_num #align bernoulli'_one bernoulli'_one @[simp] theorem bernoulli'_two : bernoulli' 2 = 1 / 6 := by rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero] #align bernoulli'_two bernoulli'_two @[simp]
Mathlib/NumberTheory/Bernoulli.lean
122
124
theorem bernoulli'_three : bernoulli' 3 = 0 := by
rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero]
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' section Examples @[simp] theorem bernoulli'_zero : bernoulli' 0 = 1 := by rw [bernoulli'_def] norm_num #align bernoulli'_zero bernoulli'_zero @[simp] theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by rw [bernoulli'_def] norm_num #align bernoulli'_one bernoulli'_one @[simp] theorem bernoulli'_two : bernoulli' 2 = 1 / 6 := by rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero] #align bernoulli'_two bernoulli'_two @[simp] theorem bernoulli'_three : bernoulli' 3 = 0 := by rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero] #align bernoulli'_three bernoulli'_three @[simp]
Mathlib/NumberTheory/Bernoulli.lean
128
131
theorem bernoulli'_four : bernoulli' 4 = -1 / 30 := by
have : Nat.choose 4 2 = 6 := by decide -- shrug rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero, this]
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' @[simp]
Mathlib/NumberTheory/Bernoulli.lean
137
150
theorem sum_bernoulli' (n : ℕ) : (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli' k) = n := by
cases' n with n · simp suffices ((n + 1 : ℚ) * ∑ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) = ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right] ring simp_rw [mul_sum, ← mul_assoc] refine sum_congr rfl fun k hk => ?_ congr have : ((n - k : ℕ) : ℚ) + 1 ≠ 0 := by norm_cast field_simp [← cast_sub (mem_range.1 hk).le, mul_comm] rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq]
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' @[simp] theorem sum_bernoulli' (n : ℕ) : (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli' k) = n := by cases' n with n · simp suffices ((n + 1 : ℚ) * ∑ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) = ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right] ring simp_rw [mul_sum, ← mul_assoc] refine sum_congr rfl fun k hk => ?_ congr have : ((n - k : ℕ) : ℚ) + 1 ≠ 0 := by norm_cast field_simp [← cast_sub (mem_range.1 hk).le, mul_comm] rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq] #align sum_bernoulli' sum_bernoulli' def bernoulli'PowerSeries := mk fun n => algebraMap ℚ A (bernoulli' n / n !) #align bernoulli'_power_series bernoulli'PowerSeries
Mathlib/NumberTheory/Bernoulli.lean
158
177
theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A := by
ext n -- constant coefficient is a special case cases' n with n · simp rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ'] suffices (∑ p ∈ antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2! : ℚ)⁻¹) = (n ! : ℚ)⁻¹ by simpa [map_sum, Nat.factorial] using congr_arg (algebraMap ℚ A) this apply eq_inv_of_mul_eq_one_left rw [sum_mul] convert bernoulli'_spec' n using 1 apply sum_congr rfl simp_rw [mem_antidiagonal] rintro ⟨i, j⟩ rfl have := factorial_mul_factorial_dvd_factorial_add i j field_simp [mul_comm _ (bernoulli' i), mul_assoc, add_choose] norm_cast simp [mul_comm (j + 1)]
1,903
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' @[simp] theorem sum_bernoulli' (n : ℕ) : (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli' k) = n := by cases' n with n · simp suffices ((n + 1 : ℚ) * ∑ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) = ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right] ring simp_rw [mul_sum, ← mul_assoc] refine sum_congr rfl fun k hk => ?_ congr have : ((n - k : ℕ) : ℚ) + 1 ≠ 0 := by norm_cast field_simp [← cast_sub (mem_range.1 hk).le, mul_comm] rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq] #align sum_bernoulli' sum_bernoulli' def bernoulli'PowerSeries := mk fun n => algebraMap ℚ A (bernoulli' n / n !) #align bernoulli'_power_series bernoulli'PowerSeries theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A := by ext n -- constant coefficient is a special case cases' n with n · simp rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ'] suffices (∑ p ∈ antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2! : ℚ)⁻¹) = (n ! : ℚ)⁻¹ by simpa [map_sum, Nat.factorial] using congr_arg (algebraMap ℚ A) this apply eq_inv_of_mul_eq_one_left rw [sum_mul] convert bernoulli'_spec' n using 1 apply sum_congr rfl simp_rw [mem_antidiagonal] rintro ⟨i, j⟩ rfl have := factorial_mul_factorial_dvd_factorial_add i j field_simp [mul_comm _ (bernoulli' i), mul_assoc, add_choose] norm_cast simp [mul_comm (j + 1)] #align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_one
Mathlib/NumberTheory/Bernoulli.lean
181
196
theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoulli' n = 0 := by
let B := mk fun n => bernoulli' n / (n ! : ℚ) suffices (B - evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1) by cases' mul_eq_mul_right_iff.mp this with h h <;> simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h · apply eq_zero_of_neg_eq specialize h n split_ifs at h <;> simp_all [B, h_odd.neg_one_pow, factorial_ne_zero] · simpa (config := {decide := true}) [Nat.factorial] using h 1 have h : B * (exp ℚ - 1) = X * exp ℚ := by simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg] suffices evalNegHom (B * (exp ℚ - 1)) * exp ℚ = evalNegHom (X * exp ℚ) * exp ℚ by rw [map_mul, map_mul] at this -- Porting note: Why doesn't simp do this? simpa [mul_assoc, sub_mul, mul_comm (evalNegHom (exp ℚ)), exp_mul_exp_neg_eq_one] congr
1,903
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.NumberTheory.Bernoulli #align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a" noncomputable section open Nat Polynomial open Nat Finset namespace Polynomial def bernoulli (n : ℕ) : ℚ[X] := ∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) #align polynomial.bernoulli Polynomial.bernoulli
Mathlib/NumberTheory/BernoulliPolynomials.lean
57
63
theorem bernoulli_def (n : ℕ) : bernoulli n = ∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by
rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli] apply sum_congr rfl rintro x hx rw [mem_range_succ_iff] at hx rw [choose_symm hx, tsub_tsub_cancel_of_le hx]
1,904
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.NumberTheory.Bernoulli #align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a" noncomputable section open Nat Polynomial open Nat Finset namespace Polynomial def bernoulli (n : ℕ) : ℚ[X] := ∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) #align polynomial.bernoulli Polynomial.bernoulli theorem bernoulli_def (n : ℕ) : bernoulli n = ∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli] apply sum_congr rfl rintro x hx rw [mem_range_succ_iff] at hx rw [choose_symm hx, tsub_tsub_cancel_of_le hx] #align polynomial.bernoulli_def Polynomial.bernoulli_def section Examples @[simp]
Mathlib/NumberTheory/BernoulliPolynomials.lean
72
72
theorem bernoulli_zero : bernoulli 0 = 1 := by
simp [bernoulli]
1,904
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.NumberTheory.Bernoulli #align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a" noncomputable section open Nat Polynomial open Nat Finset namespace Polynomial def bernoulli (n : ℕ) : ℚ[X] := ∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) #align polynomial.bernoulli Polynomial.bernoulli theorem bernoulli_def (n : ℕ) : bernoulli n = ∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli] apply sum_congr rfl rintro x hx rw [mem_range_succ_iff] at hx rw [choose_symm hx, tsub_tsub_cancel_of_le hx] #align polynomial.bernoulli_def Polynomial.bernoulli_def section Examples @[simp] theorem bernoulli_zero : bernoulli 0 = 1 := by simp [bernoulli] #align polynomial.bernoulli_zero Polynomial.bernoulli_zero @[simp]
Mathlib/NumberTheory/BernoulliPolynomials.lean
76
82
theorem bernoulli_eval_zero (n : ℕ) : (bernoulli n).eval 0 = _root_.bernoulli n := by
rw [bernoulli, eval_finset_sum, sum_range_succ] have : ∑ x ∈ range n, _root_.bernoulli x * n.choose x * 0 ^ (n - x) = 0 := by apply sum_eq_zero fun x hx => _ intros x hx simp [tsub_eq_zero_iff_le, mem_range.1 hx] simp [this]
1,904
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.NumberTheory.Bernoulli #align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a" noncomputable section open Nat Polynomial open Nat Finset namespace Polynomial def bernoulli (n : ℕ) : ℚ[X] := ∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) #align polynomial.bernoulli Polynomial.bernoulli theorem bernoulli_def (n : ℕ) : bernoulli n = ∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli] apply sum_congr rfl rintro x hx rw [mem_range_succ_iff] at hx rw [choose_symm hx, tsub_tsub_cancel_of_le hx] #align polynomial.bernoulli_def Polynomial.bernoulli_def section Examples @[simp] theorem bernoulli_zero : bernoulli 0 = 1 := by simp [bernoulli] #align polynomial.bernoulli_zero Polynomial.bernoulli_zero @[simp] theorem bernoulli_eval_zero (n : ℕ) : (bernoulli n).eval 0 = _root_.bernoulli n := by rw [bernoulli, eval_finset_sum, sum_range_succ] have : ∑ x ∈ range n, _root_.bernoulli x * n.choose x * 0 ^ (n - x) = 0 := by apply sum_eq_zero fun x hx => _ intros x hx simp [tsub_eq_zero_iff_le, mem_range.1 hx] simp [this] #align polynomial.bernoulli_eval_zero Polynomial.bernoulli_eval_zero @[simp]
Mathlib/NumberTheory/BernoulliPolynomials.lean
86
92
theorem bernoulli_eval_one (n : ℕ) : (bernoulli n).eval 1 = bernoulli' n := by
simp only [bernoulli, eval_finset_sum] simp only [← succ_eq_add_one, sum_range_succ, mul_one, cast_one, choose_self, (_root_.bernoulli _).mul_comm, sum_bernoulli, one_pow, mul_one, eval_C, eval_monomial, one_mul] by_cases h : n = 1 · norm_num [h] · simp [h, bernoulli_eq_bernoulli'_of_ne_one h]
1,904
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.NumberTheory.Bernoulli #align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a" noncomputable section open Nat Polynomial open Nat Finset namespace Polynomial def bernoulli (n : ℕ) : ℚ[X] := ∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) #align polynomial.bernoulli Polynomial.bernoulli theorem bernoulli_def (n : ℕ) : bernoulli n = ∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli] apply sum_congr rfl rintro x hx rw [mem_range_succ_iff] at hx rw [choose_symm hx, tsub_tsub_cancel_of_le hx] #align polynomial.bernoulli_def Polynomial.bernoulli_def
Mathlib/NumberTheory/BernoulliPolynomials.lean
97
108
theorem derivative_bernoulli_add_one (k : ℕ) : Polynomial.derivative (bernoulli (k + 1)) = (k + 1) * bernoulli k := by
simp_rw [bernoulli, derivative_sum, derivative_monomial, Nat.sub_sub, Nat.add_sub_add_right] -- LHS sum has an extra term, but the coefficient is zero: rw [range_add_one, sum_insert not_mem_range_self, tsub_self, cast_zero, mul_zero, map_zero, zero_add, mul_sum] -- the rest of the sum is termwise equal: refine sum_congr (by rfl) fun m _ => ?_ conv_rhs => rw [← Nat.cast_one, ← Nat.cast_add, ← C_eq_natCast, C_mul_monomial, mul_comm] rw [mul_assoc, mul_assoc, ← Nat.cast_mul, ← Nat.cast_mul] congr 3 rw [(choose_mul_succ_eq k m).symm]
1,904
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1)
Mathlib/RingTheory/PowerSeries/Derivative.lean
41
43
theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by
rw [derivativeFun, coeff_mk]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk]
Mathlib/RingTheory/PowerSeries/Derivative.lean
45
47
theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by
ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk] theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative]
Mathlib/RingTheory/PowerSeries/Derivative.lean
49
53
theorem derivativeFun_add (f g : R⟦X⟧) : derivativeFun (f + g) = derivativeFun f + derivativeFun g := by
ext rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun, coeff_derivativeFun, add_mul]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk] theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative] theorem derivativeFun_add (f g : R⟦X⟧) : derivativeFun (f + g) = derivativeFun f + derivativeFun g := by ext rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun, coeff_derivativeFun, add_mul]
Mathlib/RingTheory/PowerSeries/Derivative.lean
55
58
theorem derivativeFun_C (r : R) : derivativeFun (C R r) = 0 := by
ext n -- Note that `map_zero` didn't get picked up, apparently due to a missing `FunLike.coe` rw [coeff_derivativeFun, coeff_succ_C, zero_mul, (coeff R n).map_zero]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk] theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative] theorem derivativeFun_add (f g : R⟦X⟧) : derivativeFun (f + g) = derivativeFun f + derivativeFun g := by ext rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun, coeff_derivativeFun, add_mul] theorem derivativeFun_C (r : R) : derivativeFun (C R r) = 0 := by ext n -- Note that `map_zero` didn't get picked up, apparently due to a missing `FunLike.coe` rw [coeff_derivativeFun, coeff_succ_C, zero_mul, (coeff R n).map_zero]
Mathlib/RingTheory/PowerSeries/Derivative.lean
60
68
theorem trunc_derivativeFun (f : R⟦X⟧) (n : ℕ) : trunc n f.derivativeFun = derivative (trunc (n + 1) f) := by
ext d rw [coeff_trunc] split_ifs with h · have : d + 1 < n + 1 := succ_lt_succ_iff.2 h rw [coeff_derivativeFun, coeff_derivative, coeff_trunc, if_pos this] · have : ¬d + 1 < n + 1 := by rwa [succ_lt_succ_iff] rw [coeff_derivative, coeff_trunc, if_neg this, zero_mul]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk] theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative] theorem derivativeFun_add (f g : R⟦X⟧) : derivativeFun (f + g) = derivativeFun f + derivativeFun g := by ext rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun, coeff_derivativeFun, add_mul] theorem derivativeFun_C (r : R) : derivativeFun (C R r) = 0 := by ext n -- Note that `map_zero` didn't get picked up, apparently due to a missing `FunLike.coe` rw [coeff_derivativeFun, coeff_succ_C, zero_mul, (coeff R n).map_zero] theorem trunc_derivativeFun (f : R⟦X⟧) (n : ℕ) : trunc n f.derivativeFun = derivative (trunc (n + 1) f) := by ext d rw [coeff_trunc] split_ifs with h · have : d + 1 < n + 1 := succ_lt_succ_iff.2 h rw [coeff_derivativeFun, coeff_derivative, coeff_trunc, if_pos this] · have : ¬d + 1 < n + 1 := by rwa [succ_lt_succ_iff] rw [coeff_derivative, coeff_trunc, if_neg this, zero_mul] --A special case of `derivativeFun_mul`, used in its proof. private theorem derivativeFun_coe_mul_coe (f g : R[X]) : derivativeFun (f * g : R⟦X⟧) = f * derivative g + g * derivative f := by rw [← coe_mul, derivativeFun_coe, derivative_mul, add_comm, mul_comm _ g, ← coe_mul, ← coe_mul, Polynomial.coe_add]
Mathlib/RingTheory/PowerSeries/Derivative.lean
77
85
theorem derivativeFun_mul (f g : R⟦X⟧) : derivativeFun (f * g) = f • g.derivativeFun + g • f.derivativeFun := by
ext n have h₁ : n < n + 1 := lt_succ_self n have h₂ : n < n + 1 + 1 := Nat.lt_add_right _ h₁ rw [coeff_derivativeFun, map_add, coeff_mul_eq_coeff_trunc_mul_trunc _ _ (lt_succ_self _), smul_eq_mul, smul_eq_mul, coeff_mul_eq_coeff_trunc_mul_trunc₂ g f.derivativeFun h₂ h₁, coeff_mul_eq_coeff_trunc_mul_trunc₂ f g.derivativeFun h₂ h₁, trunc_derivativeFun, trunc_derivativeFun, ← map_add, ← derivativeFun_coe_mul_coe, coeff_derivativeFun]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk] theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative] theorem derivativeFun_add (f g : R⟦X⟧) : derivativeFun (f + g) = derivativeFun f + derivativeFun g := by ext rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun, coeff_derivativeFun, add_mul] theorem derivativeFun_C (r : R) : derivativeFun (C R r) = 0 := by ext n -- Note that `map_zero` didn't get picked up, apparently due to a missing `FunLike.coe` rw [coeff_derivativeFun, coeff_succ_C, zero_mul, (coeff R n).map_zero] theorem trunc_derivativeFun (f : R⟦X⟧) (n : ℕ) : trunc n f.derivativeFun = derivative (trunc (n + 1) f) := by ext d rw [coeff_trunc] split_ifs with h · have : d + 1 < n + 1 := succ_lt_succ_iff.2 h rw [coeff_derivativeFun, coeff_derivative, coeff_trunc, if_pos this] · have : ¬d + 1 < n + 1 := by rwa [succ_lt_succ_iff] rw [coeff_derivative, coeff_trunc, if_neg this, zero_mul] --A special case of `derivativeFun_mul`, used in its proof. private theorem derivativeFun_coe_mul_coe (f g : R[X]) : derivativeFun (f * g : R⟦X⟧) = f * derivative g + g * derivative f := by rw [← coe_mul, derivativeFun_coe, derivative_mul, add_comm, mul_comm _ g, ← coe_mul, ← coe_mul, Polynomial.coe_add] theorem derivativeFun_mul (f g : R⟦X⟧) : derivativeFun (f * g) = f • g.derivativeFun + g • f.derivativeFun := by ext n have h₁ : n < n + 1 := lt_succ_self n have h₂ : n < n + 1 + 1 := Nat.lt_add_right _ h₁ rw [coeff_derivativeFun, map_add, coeff_mul_eq_coeff_trunc_mul_trunc _ _ (lt_succ_self _), smul_eq_mul, smul_eq_mul, coeff_mul_eq_coeff_trunc_mul_trunc₂ g f.derivativeFun h₂ h₁, coeff_mul_eq_coeff_trunc_mul_trunc₂ f g.derivativeFun h₂ h₁, trunc_derivativeFun, trunc_derivativeFun, ← map_add, ← derivativeFun_coe_mul_coe, coeff_derivativeFun]
Mathlib/RingTheory/PowerSeries/Derivative.lean
87
88
theorem derivativeFun_one : derivativeFun (1 : R⟦X⟧) = 0 := by
rw [← map_one (C R), derivativeFun_C (1 : R)]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk] theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative] theorem derivativeFun_add (f g : R⟦X⟧) : derivativeFun (f + g) = derivativeFun f + derivativeFun g := by ext rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun, coeff_derivativeFun, add_mul] theorem derivativeFun_C (r : R) : derivativeFun (C R r) = 0 := by ext n -- Note that `map_zero` didn't get picked up, apparently due to a missing `FunLike.coe` rw [coeff_derivativeFun, coeff_succ_C, zero_mul, (coeff R n).map_zero] theorem trunc_derivativeFun (f : R⟦X⟧) (n : ℕ) : trunc n f.derivativeFun = derivative (trunc (n + 1) f) := by ext d rw [coeff_trunc] split_ifs with h · have : d + 1 < n + 1 := succ_lt_succ_iff.2 h rw [coeff_derivativeFun, coeff_derivative, coeff_trunc, if_pos this] · have : ¬d + 1 < n + 1 := by rwa [succ_lt_succ_iff] rw [coeff_derivative, coeff_trunc, if_neg this, zero_mul] --A special case of `derivativeFun_mul`, used in its proof. private theorem derivativeFun_coe_mul_coe (f g : R[X]) : derivativeFun (f * g : R⟦X⟧) = f * derivative g + g * derivative f := by rw [← coe_mul, derivativeFun_coe, derivative_mul, add_comm, mul_comm _ g, ← coe_mul, ← coe_mul, Polynomial.coe_add] theorem derivativeFun_mul (f g : R⟦X⟧) : derivativeFun (f * g) = f • g.derivativeFun + g • f.derivativeFun := by ext n have h₁ : n < n + 1 := lt_succ_self n have h₂ : n < n + 1 + 1 := Nat.lt_add_right _ h₁ rw [coeff_derivativeFun, map_add, coeff_mul_eq_coeff_trunc_mul_trunc _ _ (lt_succ_self _), smul_eq_mul, smul_eq_mul, coeff_mul_eq_coeff_trunc_mul_trunc₂ g f.derivativeFun h₂ h₁, coeff_mul_eq_coeff_trunc_mul_trunc₂ f g.derivativeFun h₂ h₁, trunc_derivativeFun, trunc_derivativeFun, ← map_add, ← derivativeFun_coe_mul_coe, coeff_derivativeFun] theorem derivativeFun_one : derivativeFun (1 : R⟦X⟧) = 0 := by rw [← map_one (C R), derivativeFun_C (1 : R)]
Mathlib/RingTheory/PowerSeries/Derivative.lean
90
92
theorem derivativeFun_smul (r : R) (f : R⟦X⟧) : derivativeFun (r • f) = r • derivativeFun f := by
rw [smul_eq_C_mul, smul_eq_C_mul, derivativeFun_mul, derivativeFun_C, smul_zero, add_zero, smul_eq_mul]
1,905
import Mathlib.RingTheory.PowerSeries.Trunc import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.Derivation.Basic namespace PowerSeries open Polynomial Derivation Nat section CommutativeSemiring variable {R} [CommSemiring R] noncomputable def derivativeFun (f : R⟦X⟧) : R⟦X⟧ := mk fun n ↦ coeff R (n + 1) f * (n + 1) theorem coeff_derivativeFun (f : R⟦X⟧) (n : ℕ) : coeff R n f.derivativeFun = coeff R (n + 1) f * (n + 1) := by rw [derivativeFun, coeff_mk] theorem derivativeFun_coe (f : R[X]) : (f : R⟦X⟧).derivativeFun = derivative f := by ext rw [coeff_derivativeFun, coeff_coe, coeff_coe, coeff_derivative] theorem derivativeFun_add (f g : R⟦X⟧) : derivativeFun (f + g) = derivativeFun f + derivativeFun g := by ext rw [coeff_derivativeFun, map_add, map_add, coeff_derivativeFun, coeff_derivativeFun, add_mul] theorem derivativeFun_C (r : R) : derivativeFun (C R r) = 0 := by ext n -- Note that `map_zero` didn't get picked up, apparently due to a missing `FunLike.coe` rw [coeff_derivativeFun, coeff_succ_C, zero_mul, (coeff R n).map_zero] theorem trunc_derivativeFun (f : R⟦X⟧) (n : ℕ) : trunc n f.derivativeFun = derivative (trunc (n + 1) f) := by ext d rw [coeff_trunc] split_ifs with h · have : d + 1 < n + 1 := succ_lt_succ_iff.2 h rw [coeff_derivativeFun, coeff_derivative, coeff_trunc, if_pos this] · have : ¬d + 1 < n + 1 := by rwa [succ_lt_succ_iff] rw [coeff_derivative, coeff_trunc, if_neg this, zero_mul] --A special case of `derivativeFun_mul`, used in its proof. private theorem derivativeFun_coe_mul_coe (f g : R[X]) : derivativeFun (f * g : R⟦X⟧) = f * derivative g + g * derivative f := by rw [← coe_mul, derivativeFun_coe, derivative_mul, add_comm, mul_comm _ g, ← coe_mul, ← coe_mul, Polynomial.coe_add] theorem derivativeFun_mul (f g : R⟦X⟧) : derivativeFun (f * g) = f • g.derivativeFun + g • f.derivativeFun := by ext n have h₁ : n < n + 1 := lt_succ_self n have h₂ : n < n + 1 + 1 := Nat.lt_add_right _ h₁ rw [coeff_derivativeFun, map_add, coeff_mul_eq_coeff_trunc_mul_trunc _ _ (lt_succ_self _), smul_eq_mul, smul_eq_mul, coeff_mul_eq_coeff_trunc_mul_trunc₂ g f.derivativeFun h₂ h₁, coeff_mul_eq_coeff_trunc_mul_trunc₂ f g.derivativeFun h₂ h₁, trunc_derivativeFun, trunc_derivativeFun, ← map_add, ← derivativeFun_coe_mul_coe, coeff_derivativeFun] theorem derivativeFun_one : derivativeFun (1 : R⟦X⟧) = 0 := by rw [← map_one (C R), derivativeFun_C (1 : R)] theorem derivativeFun_smul (r : R) (f : R⟦X⟧) : derivativeFun (r • f) = r • derivativeFun f := by rw [smul_eq_C_mul, smul_eq_C_mul, derivativeFun_mul, derivativeFun_C, smul_zero, add_zero, smul_eq_mul] variable (R) noncomputable def derivative : Derivation R R⟦X⟧ R⟦X⟧ where toFun := derivativeFun map_add' := derivativeFun_add map_smul' := derivativeFun_smul map_one_eq_zero' := derivativeFun_one leibniz' := derivativeFun_mul scoped notation "d⁄dX" => derivative variable {R} @[simp] theorem derivative_C (r : R) : d⁄dX R (C R r) = 0 := derivativeFun_C r theorem coeff_derivative (f : R⟦X⟧) (n : ℕ) : coeff R n (d⁄dX R f) = coeff R (n + 1) f * (n + 1) := coeff_derivativeFun f n theorem derivative_coe (f : R[X]) : d⁄dX R f = Polynomial.derivative f := derivativeFun_coe f @[simp] theorem derivative_X : d⁄dX R (X : R⟦X⟧) = 1 := by ext rw [coeff_derivative, coeff_one, coeff_X, boole_mul] simp_rw [add_left_eq_self] split_ifs with h · rw [h, cast_zero, zero_add] · rfl theorem trunc_derivative (f : R⟦X⟧) (n : ℕ) : trunc n (d⁄dX R f) = Polynomial.derivative (trunc (n + 1) f) := trunc_derivativeFun ..
Mathlib/RingTheory/PowerSeries/Derivative.lean
127
133
theorem trunc_derivative' (f : R⟦X⟧) (n : ℕ) : trunc (n-1) (d⁄dX R f) = Polynomial.derivative (trunc n f) := by
cases n with | zero => simp | succ n => rw [succ_sub_one, trunc_derivative]
1,905
import Mathlib.NumberTheory.Padics.PadicNumbers import Mathlib.RingTheory.DiscreteValuationRing.Basic #align_import number_theory.padics.padic_integers from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open Padic Metric LocalRing noncomputable section open scoped Classical def PadicInt (p : ℕ) [Fact p.Prime] := { x : ℚ_[p] // ‖x‖ ≤ 1 } #align padic_int PadicInt notation "ℤ_[" p "]" => PadicInt p namespace PadicInt variable {p : ℕ} [Fact p.Prime] instance : Coe ℤ_[p] ℚ_[p] := ⟨Subtype.val⟩ theorem ext {x y : ℤ_[p]} : (x : ℚ_[p]) = y → x = y := Subtype.ext #align padic_int.ext PadicInt.ext variable (p) def subring : Subring ℚ_[p] where carrier := { x : ℚ_[p] | ‖x‖ ≤ 1 } zero_mem' := by set_option tactic.skipAssignedInstances false in norm_num one_mem' := by set_option tactic.skipAssignedInstances false in norm_num add_mem' hx hy := (padicNormE.nonarchimedean _ _).trans <| max_le_iff.2 ⟨hx, hy⟩ mul_mem' hx hy := (padicNormE.mul _ _).trans_le <| mul_le_one hx (norm_nonneg _) hy neg_mem' hx := (norm_neg _).trans_le hx #align padic_int.subring PadicInt.subring @[simp] theorem mem_subring_iff {x : ℚ_[p]} : x ∈ subring p ↔ ‖x‖ ≤ 1 := Iff.rfl #align padic_int.mem_subring_iff PadicInt.mem_subring_iff variable {p} instance : Add ℤ_[p] := (by infer_instance : Add (subring p)) instance : Mul ℤ_[p] := (by infer_instance : Mul (subring p)) instance : Neg ℤ_[p] := (by infer_instance : Neg (subring p)) instance : Sub ℤ_[p] := (by infer_instance : Sub (subring p)) instance : Zero ℤ_[p] := (by infer_instance : Zero (subring p)) instance : Inhabited ℤ_[p] := ⟨0⟩ instance : One ℤ_[p] := ⟨⟨1, by norm_num⟩⟩ @[simp] theorem mk_zero {h} : (⟨0, h⟩ : ℤ_[p]) = (0 : ℤ_[p]) := rfl #align padic_int.mk_zero PadicInt.mk_zero @[simp, norm_cast] theorem coe_add (z1 z2 : ℤ_[p]) : ((z1 + z2 : ℤ_[p]) : ℚ_[p]) = z1 + z2 := rfl #align padic_int.coe_add PadicInt.coe_add @[simp, norm_cast] theorem coe_mul (z1 z2 : ℤ_[p]) : ((z1 * z2 : ℤ_[p]) : ℚ_[p]) = z1 * z2 := rfl #align padic_int.coe_mul PadicInt.coe_mul @[simp, norm_cast] theorem coe_neg (z1 : ℤ_[p]) : ((-z1 : ℤ_[p]) : ℚ_[p]) = -z1 := rfl #align padic_int.coe_neg PadicInt.coe_neg @[simp, norm_cast] theorem coe_sub (z1 z2 : ℤ_[p]) : ((z1 - z2 : ℤ_[p]) : ℚ_[p]) = z1 - z2 := rfl #align padic_int.coe_sub PadicInt.coe_sub @[simp, norm_cast] theorem coe_one : ((1 : ℤ_[p]) : ℚ_[p]) = 1 := rfl #align padic_int.coe_one PadicInt.coe_one @[simp, norm_cast] theorem coe_zero : ((0 : ℤ_[p]) : ℚ_[p]) = 0 := rfl #align padic_int.coe_zero PadicInt.coe_zero
Mathlib/NumberTheory/Padics/PadicIntegers.lean
145
145
theorem coe_eq_zero (z : ℤ_[p]) : (z : ℚ_[p]) = 0 ↔ z = 0 := by
rw [← coe_zero, Subtype.coe_inj]
1,906
import Mathlib.NumberTheory.Padics.PadicNumbers import Mathlib.RingTheory.DiscreteValuationRing.Basic #align_import number_theory.padics.padic_integers from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open Padic Metric LocalRing noncomputable section open scoped Classical def PadicInt (p : ℕ) [Fact p.Prime] := { x : ℚ_[p] // ‖x‖ ≤ 1 } #align padic_int PadicInt notation "ℤ_[" p "]" => PadicInt p namespace PadicInt variable (p : ℕ) [hp : Fact p.Prime]
Mathlib/NumberTheory/Padics/PadicIntegers.lean
343
353
theorem exists_pow_neg_lt {ε : ℝ} (hε : 0 < ε) : ∃ k : ℕ, (p : ℝ) ^ (-(k : ℤ)) < ε := by
obtain ⟨k, hk⟩ := exists_nat_gt ε⁻¹ use k rw [← inv_lt_inv hε (_root_.zpow_pos_of_pos _ _)] · rw [zpow_neg, inv_inv, zpow_natCast] apply lt_of_lt_of_le hk norm_cast apply le_of_lt convert Nat.lt_pow_self _ _ using 1 exact hp.1.one_lt · exact mod_cast hp.1.pos
1,906
import Mathlib.NumberTheory.Padics.PadicNumbers import Mathlib.RingTheory.DiscreteValuationRing.Basic #align_import number_theory.padics.padic_integers from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open Padic Metric LocalRing noncomputable section open scoped Classical def PadicInt (p : ℕ) [Fact p.Prime] := { x : ℚ_[p] // ‖x‖ ≤ 1 } #align padic_int PadicInt notation "ℤ_[" p "]" => PadicInt p namespace PadicInt variable (p : ℕ) [hp : Fact p.Prime] theorem exists_pow_neg_lt {ε : ℝ} (hε : 0 < ε) : ∃ k : ℕ, (p : ℝ) ^ (-(k : ℤ)) < ε := by obtain ⟨k, hk⟩ := exists_nat_gt ε⁻¹ use k rw [← inv_lt_inv hε (_root_.zpow_pos_of_pos _ _)] · rw [zpow_neg, inv_inv, zpow_natCast] apply lt_of_lt_of_le hk norm_cast apply le_of_lt convert Nat.lt_pow_self _ _ using 1 exact hp.1.one_lt · exact mod_cast hp.1.pos #align padic_int.exists_pow_neg_lt PadicInt.exists_pow_neg_lt
Mathlib/NumberTheory/Padics/PadicIntegers.lean
356
360
theorem exists_pow_neg_lt_rat {ε : ℚ} (hε : 0 < ε) : ∃ k : ℕ, (p : ℚ) ^ (-(k : ℤ)) < ε := by
obtain ⟨k, hk⟩ := @exists_pow_neg_lt p _ ε (mod_cast hε) use k rw [show (p : ℝ) = (p : ℚ) by simp] at hk exact mod_cast hk
1,906
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section RingHoms variable (p) (r : ℚ) def modPart : ℤ := r.num * gcdA r.den p % p #align padic_int.mod_part PadicInt.modPart variable {p}
Mathlib/NumberTheory/Padics/RingHoms.lean
72
75
theorem modPart_lt_p : modPart p r < p := by
convert Int.emod_lt _ _ · simp · exact mod_cast hp_prime.1.ne_zero
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section RingHoms variable (p) (r : ℚ) def modPart : ℤ := r.num * gcdA r.den p % p #align padic_int.mod_part PadicInt.modPart variable {p} theorem modPart_lt_p : modPart p r < p := by convert Int.emod_lt _ _ · simp · exact mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_lt_p PadicInt.modPart_lt_p theorem modPart_nonneg : 0 ≤ modPart p r := Int.emod_nonneg _ <| mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_nonneg PadicInt.modPart_nonneg
Mathlib/NumberTheory/Padics/RingHoms.lean
82
101
theorem isUnit_den (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : IsUnit (r.den : ℤ_[p]) := by
rw [isUnit_iff] apply le_antisymm (r.den : ℤ_[p]).2 rw [← not_lt, coe_natCast] intro norm_denom_lt have hr : ‖(r * r.den : ℚ_[p])‖ = ‖(r.num : ℚ_[p])‖ := by congr rw_mod_cast [@Rat.mul_den_eq_num r] rw [padicNormE.mul] at hr have key : ‖(r.num : ℚ_[p])‖ < 1 := by calc _ = _ := hr.symm _ < 1 * 1 := mul_lt_mul' h norm_denom_lt (norm_nonneg _) zero_lt_one _ = 1 := mul_one 1 have : ↑p ∣ r.num ∧ (p : ℤ) ∣ r.den := by simp only [← norm_int_lt_one_iff_dvd, ← padic_norm_e_of_padicInt] exact ⟨key, norm_denom_lt⟩ apply hp_prime.1.not_dvd_one rwa [← r.reduced.gcd_eq_one, Nat.dvd_gcd_iff, ← Int.natCast_dvd, ← Int.natCast_dvd_natCast]
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section RingHoms variable (p) (r : ℚ) def modPart : ℤ := r.num * gcdA r.den p % p #align padic_int.mod_part PadicInt.modPart variable {p} theorem modPart_lt_p : modPart p r < p := by convert Int.emod_lt _ _ · simp · exact mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_lt_p PadicInt.modPart_lt_p theorem modPart_nonneg : 0 ≤ modPart p r := Int.emod_nonneg _ <| mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_nonneg PadicInt.modPart_nonneg theorem isUnit_den (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : IsUnit (r.den : ℤ_[p]) := by rw [isUnit_iff] apply le_antisymm (r.den : ℤ_[p]).2 rw [← not_lt, coe_natCast] intro norm_denom_lt have hr : ‖(r * r.den : ℚ_[p])‖ = ‖(r.num : ℚ_[p])‖ := by congr rw_mod_cast [@Rat.mul_den_eq_num r] rw [padicNormE.mul] at hr have key : ‖(r.num : ℚ_[p])‖ < 1 := by calc _ = _ := hr.symm _ < 1 * 1 := mul_lt_mul' h norm_denom_lt (norm_nonneg _) zero_lt_one _ = 1 := mul_one 1 have : ↑p ∣ r.num ∧ (p : ℤ) ∣ r.den := by simp only [← norm_int_lt_one_iff_dvd, ← padic_norm_e_of_padicInt] exact ⟨key, norm_denom_lt⟩ apply hp_prime.1.not_dvd_one rwa [← r.reduced.gcd_eq_one, Nat.dvd_gcd_iff, ← Int.natCast_dvd, ← Int.natCast_dvd_natCast] #align padic_int.is_unit_denom PadicInt.isUnit_den
Mathlib/NumberTheory/Padics/RingHoms.lean
104
121
theorem norm_sub_modPart_aux (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : ↑p ∣ r.num - r.num * r.den.gcdA p % p * ↑r.den := by
rw [← ZMod.intCast_zmod_eq_zero_iff_dvd] simp only [Int.cast_natCast, ZMod.natCast_mod, Int.cast_mul, Int.cast_sub] have := congr_arg (fun x => x % p : ℤ → ZMod p) (gcd_eq_gcd_ab r.den p) simp only [Int.cast_natCast, CharP.cast_eq_zero, EuclideanDomain.mod_zero, Int.cast_add, Int.cast_mul, zero_mul, add_zero] at this push_cast rw [mul_right_comm, mul_assoc, ← this] suffices rdcp : r.den.Coprime p by rw [rdcp.gcd_eq_one] simp only [mul_one, cast_one, sub_self] apply Coprime.symm apply (coprime_or_dvd_of_prime hp_prime.1 _).resolve_right rw [← Int.natCast_dvd_natCast, ← norm_int_lt_one_iff_dvd, not_lt] apply ge_of_eq rw [← isUnit_iff] exact isUnit_den r h
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section RingHoms variable (p) (r : ℚ) def modPart : ℤ := r.num * gcdA r.den p % p #align padic_int.mod_part PadicInt.modPart variable {p} theorem modPart_lt_p : modPart p r < p := by convert Int.emod_lt _ _ · simp · exact mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_lt_p PadicInt.modPart_lt_p theorem modPart_nonneg : 0 ≤ modPart p r := Int.emod_nonneg _ <| mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_nonneg PadicInt.modPart_nonneg theorem isUnit_den (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : IsUnit (r.den : ℤ_[p]) := by rw [isUnit_iff] apply le_antisymm (r.den : ℤ_[p]).2 rw [← not_lt, coe_natCast] intro norm_denom_lt have hr : ‖(r * r.den : ℚ_[p])‖ = ‖(r.num : ℚ_[p])‖ := by congr rw_mod_cast [@Rat.mul_den_eq_num r] rw [padicNormE.mul] at hr have key : ‖(r.num : ℚ_[p])‖ < 1 := by calc _ = _ := hr.symm _ < 1 * 1 := mul_lt_mul' h norm_denom_lt (norm_nonneg _) zero_lt_one _ = 1 := mul_one 1 have : ↑p ∣ r.num ∧ (p : ℤ) ∣ r.den := by simp only [← norm_int_lt_one_iff_dvd, ← padic_norm_e_of_padicInt] exact ⟨key, norm_denom_lt⟩ apply hp_prime.1.not_dvd_one rwa [← r.reduced.gcd_eq_one, Nat.dvd_gcd_iff, ← Int.natCast_dvd, ← Int.natCast_dvd_natCast] #align padic_int.is_unit_denom PadicInt.isUnit_den theorem norm_sub_modPart_aux (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : ↑p ∣ r.num - r.num * r.den.gcdA p % p * ↑r.den := by rw [← ZMod.intCast_zmod_eq_zero_iff_dvd] simp only [Int.cast_natCast, ZMod.natCast_mod, Int.cast_mul, Int.cast_sub] have := congr_arg (fun x => x % p : ℤ → ZMod p) (gcd_eq_gcd_ab r.den p) simp only [Int.cast_natCast, CharP.cast_eq_zero, EuclideanDomain.mod_zero, Int.cast_add, Int.cast_mul, zero_mul, add_zero] at this push_cast rw [mul_right_comm, mul_assoc, ← this] suffices rdcp : r.den.Coprime p by rw [rdcp.gcd_eq_one] simp only [mul_one, cast_one, sub_self] apply Coprime.symm apply (coprime_or_dvd_of_prime hp_prime.1 _).resolve_right rw [← Int.natCast_dvd_natCast, ← norm_int_lt_one_iff_dvd, not_lt] apply ge_of_eq rw [← isUnit_iff] exact isUnit_den r h #align padic_int.norm_sub_mod_part_aux PadicInt.norm_sub_modPart_aux
Mathlib/NumberTheory/Padics/RingHoms.lean
124
134
theorem norm_sub_modPart (h : ‖(r : ℚ_[p])‖ ≤ 1) : ‖(⟨r, h⟩ - modPart p r : ℤ_[p])‖ < 1 := by
let n := modPart p r rw [norm_lt_one_iff_dvd, ← (isUnit_den r h).dvd_mul_right] suffices ↑p ∣ r.num - n * r.den by convert (Int.castRingHom ℤ_[p]).map_dvd this simp only [sub_mul, Int.cast_natCast, eq_intCast, Int.cast_mul, sub_left_inj, Int.cast_sub] apply Subtype.coe_injective simp only [coe_mul, Subtype.coe_mk, coe_natCast] rw_mod_cast [@Rat.mul_den_eq_num r] rfl exact norm_sub_modPart_aux r h
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section RingHoms variable (p) (r : ℚ) def modPart : ℤ := r.num * gcdA r.den p % p #align padic_int.mod_part PadicInt.modPart variable {p} theorem modPart_lt_p : modPart p r < p := by convert Int.emod_lt _ _ · simp · exact mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_lt_p PadicInt.modPart_lt_p theorem modPart_nonneg : 0 ≤ modPart p r := Int.emod_nonneg _ <| mod_cast hp_prime.1.ne_zero #align padic_int.mod_part_nonneg PadicInt.modPart_nonneg theorem isUnit_den (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : IsUnit (r.den : ℤ_[p]) := by rw [isUnit_iff] apply le_antisymm (r.den : ℤ_[p]).2 rw [← not_lt, coe_natCast] intro norm_denom_lt have hr : ‖(r * r.den : ℚ_[p])‖ = ‖(r.num : ℚ_[p])‖ := by congr rw_mod_cast [@Rat.mul_den_eq_num r] rw [padicNormE.mul] at hr have key : ‖(r.num : ℚ_[p])‖ < 1 := by calc _ = _ := hr.symm _ < 1 * 1 := mul_lt_mul' h norm_denom_lt (norm_nonneg _) zero_lt_one _ = 1 := mul_one 1 have : ↑p ∣ r.num ∧ (p : ℤ) ∣ r.den := by simp only [← norm_int_lt_one_iff_dvd, ← padic_norm_e_of_padicInt] exact ⟨key, norm_denom_lt⟩ apply hp_prime.1.not_dvd_one rwa [← r.reduced.gcd_eq_one, Nat.dvd_gcd_iff, ← Int.natCast_dvd, ← Int.natCast_dvd_natCast] #align padic_int.is_unit_denom PadicInt.isUnit_den theorem norm_sub_modPart_aux (r : ℚ) (h : ‖(r : ℚ_[p])‖ ≤ 1) : ↑p ∣ r.num - r.num * r.den.gcdA p % p * ↑r.den := by rw [← ZMod.intCast_zmod_eq_zero_iff_dvd] simp only [Int.cast_natCast, ZMod.natCast_mod, Int.cast_mul, Int.cast_sub] have := congr_arg (fun x => x % p : ℤ → ZMod p) (gcd_eq_gcd_ab r.den p) simp only [Int.cast_natCast, CharP.cast_eq_zero, EuclideanDomain.mod_zero, Int.cast_add, Int.cast_mul, zero_mul, add_zero] at this push_cast rw [mul_right_comm, mul_assoc, ← this] suffices rdcp : r.den.Coprime p by rw [rdcp.gcd_eq_one] simp only [mul_one, cast_one, sub_self] apply Coprime.symm apply (coprime_or_dvd_of_prime hp_prime.1 _).resolve_right rw [← Int.natCast_dvd_natCast, ← norm_int_lt_one_iff_dvd, not_lt] apply ge_of_eq rw [← isUnit_iff] exact isUnit_den r h #align padic_int.norm_sub_mod_part_aux PadicInt.norm_sub_modPart_aux theorem norm_sub_modPart (h : ‖(r : ℚ_[p])‖ ≤ 1) : ‖(⟨r, h⟩ - modPart p r : ℤ_[p])‖ < 1 := by let n := modPart p r rw [norm_lt_one_iff_dvd, ← (isUnit_den r h).dvd_mul_right] suffices ↑p ∣ r.num - n * r.den by convert (Int.castRingHom ℤ_[p]).map_dvd this simp only [sub_mul, Int.cast_natCast, eq_intCast, Int.cast_mul, sub_left_inj, Int.cast_sub] apply Subtype.coe_injective simp only [coe_mul, Subtype.coe_mk, coe_natCast] rw_mod_cast [@Rat.mul_den_eq_num r] rfl exact norm_sub_modPart_aux r h #align padic_int.norm_sub_mod_part PadicInt.norm_sub_modPart theorem exists_mem_range_of_norm_rat_le_one (h : ‖(r : ℚ_[p])‖ ≤ 1) : ∃ n : ℤ, 0 ≤ n ∧ n < p ∧ ‖(⟨r, h⟩ - n : ℤ_[p])‖ < 1 := ⟨modPart p r, modPart_nonneg _, modPart_lt_p _, norm_sub_modPart _ h⟩ #align padic_int.exists_mem_range_of_norm_rat_le_one PadicInt.exists_mem_range_of_norm_rat_le_one
Mathlib/NumberTheory/Padics/RingHoms.lean
142
150
theorem zmod_congr_of_sub_mem_span_aux (n : ℕ) (x : ℤ_[p]) (a b : ℤ) (ha : x - a ∈ (Ideal.span {(p : ℤ_[p]) ^ n})) (hb : x - b ∈ (Ideal.span {(p : ℤ_[p]) ^ n})) : (a : ZMod (p ^ n)) = b := by
rw [Ideal.mem_span_singleton] at ha hb rw [← sub_eq_zero, ← Int.cast_sub, ZMod.intCast_zmod_eq_zero_iff_dvd, Int.natCast_pow] rw [← dvd_neg, neg_sub] at ha have := dvd_add ha hb rwa [sub_eq_add_neg, sub_eq_add_neg, add_assoc, neg_add_cancel_left, ← sub_eq_add_neg, ← Int.cast_sub, pow_p_dvd_int_iff] at this
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp]
Mathlib/NumberTheory/Padics/RingHoms.lean
498
500
theorem nthHom_zero : nthHom f 0 = 0 := by
simp (config := { unfoldPartialApp := true }) [nthHom] rfl
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp] theorem nthHom_zero : nthHom f 0 = 0 := by simp (config := { unfoldPartialApp := true }) [nthHom] rfl #align padic_int.nth_hom_zero PadicInt.nthHom_zero variable {f}
Mathlib/NumberTheory/Padics/RingHoms.lean
505
511
theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) : (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by
specialize f_compat i j h rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub] dsimp [nthHom] rw [← f_compat, RingHom.comp_apply] simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast]
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp] theorem nthHom_zero : nthHom f 0 = 0 := by simp (config := { unfoldPartialApp := true }) [nthHom] rfl #align padic_int.nth_hom_zero PadicInt.nthHom_zero variable {f} theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) : (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by specialize f_compat i j h rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub] dsimp [nthHom] rw [← f_compat, RingHom.comp_apply] simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast] #align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub
Mathlib/NumberTheory/Padics/RingHoms.lean
514
525
theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by
intro ε hε obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε use k intro j hj refine lt_of_le_of_lt ?_ hk -- Need to do beta reduction first, as `norm_cast` doesn't. -- Added to adapt to leanprover/lean4#2734. beta_reduce norm_cast rw [← padicNorm.dvd_iff_norm_le] exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp] theorem nthHom_zero : nthHom f 0 = 0 := by simp (config := { unfoldPartialApp := true }) [nthHom] rfl #align padic_int.nth_hom_zero PadicInt.nthHom_zero variable {f} theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) : (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by specialize f_compat i j h rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub] dsimp [nthHom] rw [← f_compat, RingHom.comp_apply] simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast] #align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by intro ε hε obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε use k intro j hj refine lt_of_le_of_lt ?_ hk -- Need to do beta reduction first, as `norm_cast` doesn't. -- Added to adapt to leanprover/lean4#2734. beta_reduce norm_cast rw [← padicNorm.dvd_iff_norm_le] exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj #align padic_int.is_cau_seq_nth_hom PadicInt.isCauSeq_nthHom def nthHomSeq (r : R) : PadicSeq p := ⟨fun n => nthHom f r n, isCauSeq_nthHom f_compat r⟩ #align padic_int.nth_hom_seq PadicInt.nthHomSeq -- this lemma ran into issues after changing to `NeZero` and I'm not sure why.
Mathlib/NumberTheory/Padics/RingHoms.lean
537
544
theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 := by
intro ε hε change _ < _ at hε use 1 intro j hj haveI : Fact (1 < p ^ j) := ⟨Nat.one_lt_pow (by omega) hp_prime.1.one_lt⟩ suffices (ZMod.cast (1 : ZMod (p ^ j)) : ℚ) = 1 by simp [nthHomSeq, nthHom, this, hε] rw [ZMod.cast_eq_val, ZMod.val_one, Nat.cast_one]
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp] theorem nthHom_zero : nthHom f 0 = 0 := by simp (config := { unfoldPartialApp := true }) [nthHom] rfl #align padic_int.nth_hom_zero PadicInt.nthHom_zero variable {f} theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) : (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by specialize f_compat i j h rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub] dsimp [nthHom] rw [← f_compat, RingHom.comp_apply] simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast] #align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by intro ε hε obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε use k intro j hj refine lt_of_le_of_lt ?_ hk -- Need to do beta reduction first, as `norm_cast` doesn't. -- Added to adapt to leanprover/lean4#2734. beta_reduce norm_cast rw [← padicNorm.dvd_iff_norm_le] exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj #align padic_int.is_cau_seq_nth_hom PadicInt.isCauSeq_nthHom def nthHomSeq (r : R) : PadicSeq p := ⟨fun n => nthHom f r n, isCauSeq_nthHom f_compat r⟩ #align padic_int.nth_hom_seq PadicInt.nthHomSeq -- this lemma ran into issues after changing to `NeZero` and I'm not sure why. theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 := by intro ε hε change _ < _ at hε use 1 intro j hj haveI : Fact (1 < p ^ j) := ⟨Nat.one_lt_pow (by omega) hp_prime.1.one_lt⟩ suffices (ZMod.cast (1 : ZMod (p ^ j)) : ℚ) = 1 by simp [nthHomSeq, nthHom, this, hε] rw [ZMod.cast_eq_val, ZMod.val_one, Nat.cast_one] #align padic_int.nth_hom_seq_one PadicInt.nthHomSeq_one
Mathlib/NumberTheory/Padics/RingHoms.lean
547
560
theorem nthHomSeq_add (r s : R) : nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s := by
intro ε hε obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε use n intro j hj dsimp [nthHomSeq] apply lt_of_le_of_lt _ hn rw [← Int.cast_add, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ← ZMod.intCast_zmod_eq_zero_iff_dvd] dsimp [nthHom] simp only [ZMod.natCast_val, RingHom.map_add, Int.cast_sub, ZMod.intCast_cast, Int.cast_add] rw [ZMod.cast_add (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj)] simp only [cast_add, ZMod.natCast_val, Int.cast_add, ZMod.intCast_cast, sub_self]
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp] theorem nthHom_zero : nthHom f 0 = 0 := by simp (config := { unfoldPartialApp := true }) [nthHom] rfl #align padic_int.nth_hom_zero PadicInt.nthHom_zero variable {f} theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) : (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by specialize f_compat i j h rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub] dsimp [nthHom] rw [← f_compat, RingHom.comp_apply] simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast] #align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by intro ε hε obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε use k intro j hj refine lt_of_le_of_lt ?_ hk -- Need to do beta reduction first, as `norm_cast` doesn't. -- Added to adapt to leanprover/lean4#2734. beta_reduce norm_cast rw [← padicNorm.dvd_iff_norm_le] exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj #align padic_int.is_cau_seq_nth_hom PadicInt.isCauSeq_nthHom def nthHomSeq (r : R) : PadicSeq p := ⟨fun n => nthHom f r n, isCauSeq_nthHom f_compat r⟩ #align padic_int.nth_hom_seq PadicInt.nthHomSeq -- this lemma ran into issues after changing to `NeZero` and I'm not sure why. theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 := by intro ε hε change _ < _ at hε use 1 intro j hj haveI : Fact (1 < p ^ j) := ⟨Nat.one_lt_pow (by omega) hp_prime.1.one_lt⟩ suffices (ZMod.cast (1 : ZMod (p ^ j)) : ℚ) = 1 by simp [nthHomSeq, nthHom, this, hε] rw [ZMod.cast_eq_val, ZMod.val_one, Nat.cast_one] #align padic_int.nth_hom_seq_one PadicInt.nthHomSeq_one theorem nthHomSeq_add (r s : R) : nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s := by intro ε hε obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε use n intro j hj dsimp [nthHomSeq] apply lt_of_le_of_lt _ hn rw [← Int.cast_add, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ← ZMod.intCast_zmod_eq_zero_iff_dvd] dsimp [nthHom] simp only [ZMod.natCast_val, RingHom.map_add, Int.cast_sub, ZMod.intCast_cast, Int.cast_add] rw [ZMod.cast_add (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj)] simp only [cast_add, ZMod.natCast_val, Int.cast_add, ZMod.intCast_cast, sub_self] #align padic_int.nth_hom_seq_add PadicInt.nthHomSeq_add
Mathlib/NumberTheory/Padics/RingHoms.lean
563
575
theorem nthHomSeq_mul (r s : R) : nthHomSeq f_compat (r * s) ≈ nthHomSeq f_compat r * nthHomSeq f_compat s := by
intro ε hε obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε use n intro j hj dsimp [nthHomSeq] apply lt_of_le_of_lt _ hn rw [← Int.cast_mul, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ← ZMod.intCast_zmod_eq_zero_iff_dvd] dsimp [nthHom] simp only [ZMod.natCast_val, RingHom.map_mul, Int.cast_sub, ZMod.intCast_cast, Int.cast_mul] rw [ZMod.cast_mul (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj), sub_self]
1,907
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp] theorem nthHom_zero : nthHom f 0 = 0 := by simp (config := { unfoldPartialApp := true }) [nthHom] rfl #align padic_int.nth_hom_zero PadicInt.nthHom_zero variable {f} theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) : (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by specialize f_compat i j h rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub] dsimp [nthHom] rw [← f_compat, RingHom.comp_apply] simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast] #align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by intro ε hε obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε use k intro j hj refine lt_of_le_of_lt ?_ hk -- Need to do beta reduction first, as `norm_cast` doesn't. -- Added to adapt to leanprover/lean4#2734. beta_reduce norm_cast rw [← padicNorm.dvd_iff_norm_le] exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj #align padic_int.is_cau_seq_nth_hom PadicInt.isCauSeq_nthHom def nthHomSeq (r : R) : PadicSeq p := ⟨fun n => nthHom f r n, isCauSeq_nthHom f_compat r⟩ #align padic_int.nth_hom_seq PadicInt.nthHomSeq -- this lemma ran into issues after changing to `NeZero` and I'm not sure why. theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 := by intro ε hε change _ < _ at hε use 1 intro j hj haveI : Fact (1 < p ^ j) := ⟨Nat.one_lt_pow (by omega) hp_prime.1.one_lt⟩ suffices (ZMod.cast (1 : ZMod (p ^ j)) : ℚ) = 1 by simp [nthHomSeq, nthHom, this, hε] rw [ZMod.cast_eq_val, ZMod.val_one, Nat.cast_one] #align padic_int.nth_hom_seq_one PadicInt.nthHomSeq_one theorem nthHomSeq_add (r s : R) : nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s := by intro ε hε obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε use n intro j hj dsimp [nthHomSeq] apply lt_of_le_of_lt _ hn rw [← Int.cast_add, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ← ZMod.intCast_zmod_eq_zero_iff_dvd] dsimp [nthHom] simp only [ZMod.natCast_val, RingHom.map_add, Int.cast_sub, ZMod.intCast_cast, Int.cast_add] rw [ZMod.cast_add (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj)] simp only [cast_add, ZMod.natCast_val, Int.cast_add, ZMod.intCast_cast, sub_self] #align padic_int.nth_hom_seq_add PadicInt.nthHomSeq_add theorem nthHomSeq_mul (r s : R) : nthHomSeq f_compat (r * s) ≈ nthHomSeq f_compat r * nthHomSeq f_compat s := by intro ε hε obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε use n intro j hj dsimp [nthHomSeq] apply lt_of_le_of_lt _ hn rw [← Int.cast_mul, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ← ZMod.intCast_zmod_eq_zero_iff_dvd] dsimp [nthHom] simp only [ZMod.natCast_val, RingHom.map_mul, Int.cast_sub, ZMod.intCast_cast, Int.cast_mul] rw [ZMod.cast_mul (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj), sub_self] #align padic_int.nth_hom_seq_mul PadicInt.nthHomSeq_mul def limNthHom (r : R) : ℤ_[p] := ofIntSeq (nthHom f r) (isCauSeq_nthHom f_compat r) #align padic_int.lim_nth_hom PadicInt.limNthHom
Mathlib/NumberTheory/Padics/RingHoms.lean
586
597
theorem limNthHom_spec (r : R) : ∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ n ≥ N, ‖limNthHom f_compat r - nthHom f r n‖ < ε := by
intro ε hε obtain ⟨ε', hε'0, hε'⟩ : ∃ v : ℚ, (0 : ℝ) < v ∧ ↑v < ε := exists_rat_btwn hε norm_cast at hε'0 obtain ⟨N, hN⟩ := padicNormE.defn (nthHomSeq f_compat r) hε'0 use N intro n hn apply _root_.lt_trans _ hε' change (padicNormE _ : ℝ) < _ norm_cast exact hN _ hn
1,907
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module section DualMap open Module universe u v v' variable {R : Type u} [CommSemiring R] {M₁ : Type v} {M₂ : Type v'} variable [AddCommMonoid M₁] [Module R M₁] [AddCommMonoid M₂] [Module R M₂] def LinearMap.dualMap (f : M₁ →ₗ[R] M₂) : Dual R M₂ →ₗ[R] Dual R M₁ := -- Porting note: with reducible def need to specify some parameters to transpose explicitly Module.Dual.transpose (R := R) f #align linear_map.dual_map LinearMap.dualMap lemma LinearMap.dualMap_eq_lcomp (f : M₁ →ₗ[R] M₂) : f.dualMap = f.lcomp R := rfl -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem LinearMap.dualMap_def (f : M₁ →ₗ[R] M₂) : f.dualMap = Module.Dual.transpose (R := R) f := rfl #align linear_map.dual_map_def LinearMap.dualMap_def theorem LinearMap.dualMap_apply' (f : M₁ →ₗ[R] M₂) (g : Dual R M₂) : f.dualMap g = g.comp f := rfl #align linear_map.dual_map_apply' LinearMap.dualMap_apply' @[simp] theorem LinearMap.dualMap_apply (f : M₁ →ₗ[R] M₂) (g : Dual R M₂) (x : M₁) : f.dualMap g x = g (f x) := rfl #align linear_map.dual_map_apply LinearMap.dualMap_apply @[simp]
Mathlib/LinearAlgebra/Dual.lean
215
217
theorem LinearMap.dualMap_id : (LinearMap.id : M₁ →ₗ[R] M₁).dualMap = LinearMap.id := by
ext rfl
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module section DualMap open Module universe u v v' variable {R : Type u} [CommSemiring R] {M₁ : Type v} {M₂ : Type v'} variable [AddCommMonoid M₁] [Module R M₁] [AddCommMonoid M₂] [Module R M₂] def LinearMap.dualMap (f : M₁ →ₗ[R] M₂) : Dual R M₂ →ₗ[R] Dual R M₁ := -- Porting note: with reducible def need to specify some parameters to transpose explicitly Module.Dual.transpose (R := R) f #align linear_map.dual_map LinearMap.dualMap lemma LinearMap.dualMap_eq_lcomp (f : M₁ →ₗ[R] M₂) : f.dualMap = f.lcomp R := rfl -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem LinearMap.dualMap_def (f : M₁ →ₗ[R] M₂) : f.dualMap = Module.Dual.transpose (R := R) f := rfl #align linear_map.dual_map_def LinearMap.dualMap_def theorem LinearMap.dualMap_apply' (f : M₁ →ₗ[R] M₂) (g : Dual R M₂) : f.dualMap g = g.comp f := rfl #align linear_map.dual_map_apply' LinearMap.dualMap_apply' @[simp] theorem LinearMap.dualMap_apply (f : M₁ →ₗ[R] M₂) (g : Dual R M₂) (x : M₁) : f.dualMap g x = g (f x) := rfl #align linear_map.dual_map_apply LinearMap.dualMap_apply @[simp] theorem LinearMap.dualMap_id : (LinearMap.id : M₁ →ₗ[R] M₁).dualMap = LinearMap.id := by ext rfl #align linear_map.dual_map_id LinearMap.dualMap_id theorem LinearMap.dualMap_comp_dualMap {M₃ : Type*} [AddCommGroup M₃] [Module R M₃] (f : M₁ →ₗ[R] M₂) (g : M₂ →ₗ[R] M₃) : f.dualMap.comp g.dualMap = (g.comp f).dualMap := rfl #align linear_map.dual_map_comp_dual_map LinearMap.dualMap_comp_dualMap
Mathlib/LinearAlgebra/Dual.lean
226
231
theorem LinearMap.dualMap_injective_of_surjective {f : M₁ →ₗ[R] M₂} (hf : Function.Surjective f) : Function.Injective f.dualMap := by
intro φ ψ h ext x obtain ⟨y, rfl⟩ := hf x exact congr_arg (fun g : Module.Dual R M₁ => g y) h
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual
Mathlib/LinearAlgebra/Dual.lean
303
305
theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by
erw [constr_basis b, constr_basis b] simp only [eq_comm]
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by erw [constr_basis b, constr_basis b] simp only [eq_comm] #align basis.to_dual_apply Basis.toDual_apply @[simp]
Mathlib/LinearAlgebra/Dual.lean
309
316
theorem toDual_total_left (f : ι →₀ R) (i : ι) : b.toDual (Finsupp.total ι M R b f) (b i) = f i := by
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply] simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq'] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h]
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by erw [constr_basis b, constr_basis b] simp only [eq_comm] #align basis.to_dual_apply Basis.toDual_apply @[simp] theorem toDual_total_left (f : ι →₀ R) (i : ι) : b.toDual (Finsupp.total ι M R b f) (b i) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply] simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq'] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_left Basis.toDual_total_left @[simp]
Mathlib/LinearAlgebra/Dual.lean
320
326
theorem toDual_total_right (f : ι →₀ R) (i : ι) : b.toDual (b i) (Finsupp.total ι M R b f) = f i := by
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum] simp_rw [LinearMap.map_smul, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h]
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by erw [constr_basis b, constr_basis b] simp only [eq_comm] #align basis.to_dual_apply Basis.toDual_apply @[simp] theorem toDual_total_left (f : ι →₀ R) (i : ι) : b.toDual (Finsupp.total ι M R b f) (b i) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply] simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq'] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_left Basis.toDual_total_left @[simp] theorem toDual_total_right (f : ι →₀ R) (i : ι) : b.toDual (b i) (Finsupp.total ι M R b f) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum] simp_rw [LinearMap.map_smul, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_right Basis.toDual_total_right
Mathlib/LinearAlgebra/Dual.lean
329
330
theorem toDual_apply_left (m : M) (i : ι) : b.toDual m (b i) = b.repr m i := by
rw [← b.toDual_total_left, b.total_repr]
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by erw [constr_basis b, constr_basis b] simp only [eq_comm] #align basis.to_dual_apply Basis.toDual_apply @[simp] theorem toDual_total_left (f : ι →₀ R) (i : ι) : b.toDual (Finsupp.total ι M R b f) (b i) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply] simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq'] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_left Basis.toDual_total_left @[simp] theorem toDual_total_right (f : ι →₀ R) (i : ι) : b.toDual (b i) (Finsupp.total ι M R b f) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum] simp_rw [LinearMap.map_smul, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_right Basis.toDual_total_right theorem toDual_apply_left (m : M) (i : ι) : b.toDual m (b i) = b.repr m i := by rw [← b.toDual_total_left, b.total_repr] #align basis.to_dual_apply_left Basis.toDual_apply_left
Mathlib/LinearAlgebra/Dual.lean
333
334
theorem toDual_apply_right (i : ι) (m : M) : b.toDual (b i) m = b.repr m i := by
rw [← b.toDual_total_right, b.total_repr]
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by erw [constr_basis b, constr_basis b] simp only [eq_comm] #align basis.to_dual_apply Basis.toDual_apply @[simp] theorem toDual_total_left (f : ι →₀ R) (i : ι) : b.toDual (Finsupp.total ι M R b f) (b i) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply] simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq'] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_left Basis.toDual_total_left @[simp] theorem toDual_total_right (f : ι →₀ R) (i : ι) : b.toDual (b i) (Finsupp.total ι M R b f) = f i := by rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum] simp_rw [LinearMap.map_smul, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h] #align basis.to_dual_total_right Basis.toDual_total_right theorem toDual_apply_left (m : M) (i : ι) : b.toDual m (b i) = b.repr m i := by rw [← b.toDual_total_left, b.total_repr] #align basis.to_dual_apply_left Basis.toDual_apply_left theorem toDual_apply_right (i : ι) (m : M) : b.toDual (b i) m = b.repr m i := by rw [← b.toDual_total_right, b.total_repr] #align basis.to_dual_apply_right Basis.toDual_apply_right
Mathlib/LinearAlgebra/Dual.lean
337
339
theorem coe_toDual_self (i : ι) : b.toDual (b i) = b.coord i := by
ext apply toDual_apply_right
1,908
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section variable [CommSemiring R] [AddCommMonoid M] [Module R M] [Fintype ι] variable (b : Basis ι R M) @[simp]
Mathlib/LinearAlgebra/Dual.lean
388
392
theorem sum_dual_apply_smul_coord (f : Module.Dual R M) : (∑ x, f (b x) • b.coord x) = f := by
ext m simp_rw [LinearMap.sum_apply, LinearMap.smul_apply, smul_eq_mul, mul_comm (f _), ← smul_eq_mul, ← f.map_smul, ← _root_.map_sum, Basis.coord_apply, Basis.sum_repr]
1,908
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp]
Mathlib/LinearAlgebra/PerfectPairing.lean
71
74
theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by
have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x
1,909
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp] theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x noncomputable def toDualRight : N ≃ₗ[R] Dual R M := toDualLeft p.flip @[simp] theorem toDualRight_apply (a : N) : p.toDualRight a = p.flip a := rfl @[simp]
Mathlib/LinearAlgebra/PerfectPairing.lean
85
89
theorem apply_apply_toDualRight_symm (x : M) (f : Dual R M) : (p x) (p.toDualRight.symm f) = f x := by
have h := LinearEquiv.apply_symm_apply p.toDualRight f rw [toDualRight_apply] at h exact congrFun (congrArg DFunLike.coe h) x
1,909
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp] theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x noncomputable def toDualRight : N ≃ₗ[R] Dual R M := toDualLeft p.flip @[simp] theorem toDualRight_apply (a : N) : p.toDualRight a = p.flip a := rfl @[simp] theorem apply_apply_toDualRight_symm (x : M) (f : Dual R M) : (p x) (p.toDualRight.symm f) = f x := by have h := LinearEquiv.apply_symm_apply p.toDualRight f rw [toDualRight_apply] at h exact congrFun (congrArg DFunLike.coe h) x
Mathlib/LinearAlgebra/PerfectPairing.lean
91
94
theorem toDualLeft_of_toDualRight_symm (x : M) (f : Dual R M) : (p.toDualLeft x) (p.toDualRight.symm f) = f x := by
rw [@toDualLeft_apply] exact apply_apply_toDualRight_symm p x f
1,909
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp] theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x noncomputable def toDualRight : N ≃ₗ[R] Dual R M := toDualLeft p.flip @[simp] theorem toDualRight_apply (a : N) : p.toDualRight a = p.flip a := rfl @[simp] theorem apply_apply_toDualRight_symm (x : M) (f : Dual R M) : (p x) (p.toDualRight.symm f) = f x := by have h := LinearEquiv.apply_symm_apply p.toDualRight f rw [toDualRight_apply] at h exact congrFun (congrArg DFunLike.coe h) x theorem toDualLeft_of_toDualRight_symm (x : M) (f : Dual R M) : (p.toDualLeft x) (p.toDualRight.symm f) = f x := by rw [@toDualLeft_apply] exact apply_apply_toDualRight_symm p x f
Mathlib/LinearAlgebra/PerfectPairing.lean
96
100
theorem toDualRight_symm_toDualLeft (x : M) : p.toDualRight.symm.dualMap (p.toDualLeft x) = Dual.eval R M x := by
ext f simp only [LinearEquiv.dualMap_apply, Dual.eval_apply] exact toDualLeft_of_toDualRight_symm p x f
1,909
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp] theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x noncomputable def toDualRight : N ≃ₗ[R] Dual R M := toDualLeft p.flip @[simp] theorem toDualRight_apply (a : N) : p.toDualRight a = p.flip a := rfl @[simp] theorem apply_apply_toDualRight_symm (x : M) (f : Dual R M) : (p x) (p.toDualRight.symm f) = f x := by have h := LinearEquiv.apply_symm_apply p.toDualRight f rw [toDualRight_apply] at h exact congrFun (congrArg DFunLike.coe h) x theorem toDualLeft_of_toDualRight_symm (x : M) (f : Dual R M) : (p.toDualLeft x) (p.toDualRight.symm f) = f x := by rw [@toDualLeft_apply] exact apply_apply_toDualRight_symm p x f theorem toDualRight_symm_toDualLeft (x : M) : p.toDualRight.symm.dualMap (p.toDualLeft x) = Dual.eval R M x := by ext f simp only [LinearEquiv.dualMap_apply, Dual.eval_apply] exact toDualLeft_of_toDualRight_symm p x f
Mathlib/LinearAlgebra/PerfectPairing.lean
102
105
theorem toDualRight_symm_comp_toDualLeft : p.toDualRight.symm.dualMap ∘ₗ (p.toDualLeft : M →ₗ[R] Dual R N) = Dual.eval R M := by
ext1 x exact p.toDualRight_symm_toDualLeft x
1,909
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp] theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x noncomputable def toDualRight : N ≃ₗ[R] Dual R M := toDualLeft p.flip @[simp] theorem toDualRight_apply (a : N) : p.toDualRight a = p.flip a := rfl @[simp] theorem apply_apply_toDualRight_symm (x : M) (f : Dual R M) : (p x) (p.toDualRight.symm f) = f x := by have h := LinearEquiv.apply_symm_apply p.toDualRight f rw [toDualRight_apply] at h exact congrFun (congrArg DFunLike.coe h) x theorem toDualLeft_of_toDualRight_symm (x : M) (f : Dual R M) : (p.toDualLeft x) (p.toDualRight.symm f) = f x := by rw [@toDualLeft_apply] exact apply_apply_toDualRight_symm p x f theorem toDualRight_symm_toDualLeft (x : M) : p.toDualRight.symm.dualMap (p.toDualLeft x) = Dual.eval R M x := by ext f simp only [LinearEquiv.dualMap_apply, Dual.eval_apply] exact toDualLeft_of_toDualRight_symm p x f theorem toDualRight_symm_comp_toDualLeft : p.toDualRight.symm.dualMap ∘ₗ (p.toDualLeft : M →ₗ[R] Dual R N) = Dual.eval R M := by ext1 x exact p.toDualRight_symm_toDualLeft x theorem bijective_toDualRight_symm_toDualLeft : Bijective (fun x => p.toDualRight.symm.dualMap (p.toDualLeft x)) := Bijective.comp (LinearEquiv.bijective p.toDualRight.symm.dualMap) (LinearEquiv.bijective p.toDualLeft)
Mathlib/LinearAlgebra/PerfectPairing.lean
112
115
theorem reflexive_left : IsReflexive R M where bijective_dual_eval' := by
rw [← p.toDualRight_symm_comp_toDualLeft] exact p.bijective_toDualRight_symm_toDualLeft
1,909
import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec" suppress_compilation -- Porting note: universe metavariables behave oddly universe w u v₁ v₂ v₃ v₄ variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂) (P : Type v₃) (Q : Type v₄) -- Porting note: we need high priority for this to fire first; not the case in ML3 attribute [local ext high] TensorProduct.ext section Contraction open TensorProduct LinearMap Matrix Module open TensorProduct section CommSemiring variable [CommSemiring R] variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] variable [Module R M] [Module R N] [Module R P] [Module R Q] variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M) -- Porting note: doesn't like implicit ring in the tensor product def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R := (uncurry _ _ _ _).toFun LinearMap.id #align contract_left contractLeft -- Porting note: doesn't like implicit ring in the tensor product def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R := (uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id) #align contract_right contractRight -- Porting note: doesn't like implicit ring in the tensor product def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N := let M' := Module.Dual R M (uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ #align dual_tensor_hom dualTensorHom variable {R M N P Q} @[simp] theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m := rfl #align contract_left_apply contractLeft_apply @[simp] theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m := rfl #align contract_right_apply contractRight_apply @[simp] theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) : dualTensorHom R M N (f ⊗ₜ n) m = f m • n := rfl #align dual_tensor_hom_apply dualTensorHom_apply @[simp]
Mathlib/LinearAlgebra/Contraction.lean
85
92
theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) : Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) = dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by
ext f' m' simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply, LinearMap.smul_apply] exact mul_comm _ _
1,910
import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec" suppress_compilation -- Porting note: universe metavariables behave oddly universe w u v₁ v₂ v₃ v₄ variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂) (P : Type v₃) (Q : Type v₄) -- Porting note: we need high priority for this to fire first; not the case in ML3 attribute [local ext high] TensorProduct.ext section Contraction open TensorProduct LinearMap Matrix Module open TensorProduct section CommSemiring variable [CommSemiring R] variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] variable [Module R M] [Module R N] [Module R P] [Module R Q] variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M) -- Porting note: doesn't like implicit ring in the tensor product def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R := (uncurry _ _ _ _).toFun LinearMap.id #align contract_left contractLeft -- Porting note: doesn't like implicit ring in the tensor product def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R := (uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id) #align contract_right contractRight -- Porting note: doesn't like implicit ring in the tensor product def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N := let M' := Module.Dual R M (uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ #align dual_tensor_hom dualTensorHom variable {R M N P Q} @[simp] theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m := rfl #align contract_left_apply contractLeft_apply @[simp] theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m := rfl #align contract_right_apply contractRight_apply @[simp] theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) : dualTensorHom R M N (f ⊗ₜ n) m = f m • n := rfl #align dual_tensor_hom_apply dualTensorHom_apply @[simp] theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) : Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) = dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by ext f' m' simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply, LinearMap.smul_apply] exact mul_comm _ _ #align transpose_dual_tensor_hom transpose_dualTensorHom @[simp]
Mathlib/LinearAlgebra/Contraction.lean
96
101
theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) : ((dualTensorHom R M P) (f ⊗ₜ[R] p)).prodMap (0 : N →ₗ[R] Q) = dualTensorHom R (M × N) (P × Q) ((f ∘ₗ fst R M N) ⊗ₜ inl R P Q p) := by
ext <;> simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply, fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero]
1,910
import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec" suppress_compilation -- Porting note: universe metavariables behave oddly universe w u v₁ v₂ v₃ v₄ variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂) (P : Type v₃) (Q : Type v₄) -- Porting note: we need high priority for this to fire first; not the case in ML3 attribute [local ext high] TensorProduct.ext section Contraction open TensorProduct LinearMap Matrix Module open TensorProduct section CommSemiring variable [CommSemiring R] variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] variable [Module R M] [Module R N] [Module R P] [Module R Q] variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M) -- Porting note: doesn't like implicit ring in the tensor product def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R := (uncurry _ _ _ _).toFun LinearMap.id #align contract_left contractLeft -- Porting note: doesn't like implicit ring in the tensor product def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R := (uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id) #align contract_right contractRight -- Porting note: doesn't like implicit ring in the tensor product def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N := let M' := Module.Dual R M (uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ #align dual_tensor_hom dualTensorHom variable {R M N P Q} @[simp] theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m := rfl #align contract_left_apply contractLeft_apply @[simp] theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m := rfl #align contract_right_apply contractRight_apply @[simp] theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) : dualTensorHom R M N (f ⊗ₜ n) m = f m • n := rfl #align dual_tensor_hom_apply dualTensorHom_apply @[simp] theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) : Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) = dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by ext f' m' simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply, LinearMap.smul_apply] exact mul_comm _ _ #align transpose_dual_tensor_hom transpose_dualTensorHom @[simp] theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) : ((dualTensorHom R M P) (f ⊗ₜ[R] p)).prodMap (0 : N →ₗ[R] Q) = dualTensorHom R (M × N) (P × Q) ((f ∘ₗ fst R M N) ⊗ₜ inl R P Q p) := by ext <;> simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply, fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero] #align dual_tensor_hom_prod_map_zero dualTensorHom_prodMap_zero @[simp]
Mathlib/LinearAlgebra/Contraction.lean
105
110
theorem zero_prodMap_dualTensorHom (g : Module.Dual R N) (q : Q) : (0 : M →ₗ[R] P).prodMap ((dualTensorHom R N Q) (g ⊗ₜ[R] q)) = dualTensorHom R (M × N) (P × Q) ((g ∘ₗ snd R M N) ⊗ₜ inr R P Q q) := by
ext <;> simp only [coe_comp, coe_inr, Function.comp_apply, prodMap_apply, dualTensorHom_apply, snd_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero]
1,910
import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec" suppress_compilation -- Porting note: universe metavariables behave oddly universe w u v₁ v₂ v₃ v₄ variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂) (P : Type v₃) (Q : Type v₄) -- Porting note: we need high priority for this to fire first; not the case in ML3 attribute [local ext high] TensorProduct.ext section Contraction open TensorProduct LinearMap Matrix Module open TensorProduct section CommSemiring variable [CommSemiring R] variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] variable [Module R M] [Module R N] [Module R P] [Module R Q] variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M) -- Porting note: doesn't like implicit ring in the tensor product def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R := (uncurry _ _ _ _).toFun LinearMap.id #align contract_left contractLeft -- Porting note: doesn't like implicit ring in the tensor product def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R := (uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id) #align contract_right contractRight -- Porting note: doesn't like implicit ring in the tensor product def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N := let M' := Module.Dual R M (uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ #align dual_tensor_hom dualTensorHom variable {R M N P Q} @[simp] theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m := rfl #align contract_left_apply contractLeft_apply @[simp] theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m := rfl #align contract_right_apply contractRight_apply @[simp] theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) : dualTensorHom R M N (f ⊗ₜ n) m = f m • n := rfl #align dual_tensor_hom_apply dualTensorHom_apply @[simp] theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) : Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) = dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by ext f' m' simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply, LinearMap.smul_apply] exact mul_comm _ _ #align transpose_dual_tensor_hom transpose_dualTensorHom @[simp] theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) : ((dualTensorHom R M P) (f ⊗ₜ[R] p)).prodMap (0 : N →ₗ[R] Q) = dualTensorHom R (M × N) (P × Q) ((f ∘ₗ fst R M N) ⊗ₜ inl R P Q p) := by ext <;> simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply, fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero] #align dual_tensor_hom_prod_map_zero dualTensorHom_prodMap_zero @[simp] theorem zero_prodMap_dualTensorHom (g : Module.Dual R N) (q : Q) : (0 : M →ₗ[R] P).prodMap ((dualTensorHom R N Q) (g ⊗ₜ[R] q)) = dualTensorHom R (M × N) (P × Q) ((g ∘ₗ snd R M N) ⊗ₜ inr R P Q q) := by ext <;> simp only [coe_comp, coe_inr, Function.comp_apply, prodMap_apply, dualTensorHom_apply, snd_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero] #align zero_prod_map_dual_tensor_hom zero_prodMap_dualTensorHom
Mathlib/LinearAlgebra/Contraction.lean
113
118
theorem map_dualTensorHom (f : Module.Dual R M) (p : P) (g : Module.Dual R N) (q : Q) : TensorProduct.map (dualTensorHom R M P (f ⊗ₜ[R] p)) (dualTensorHom R N Q (g ⊗ₜ[R] q)) = dualTensorHom R (M ⊗[R] N) (P ⊗[R] Q) (dualDistrib R M N (f ⊗ₜ g) ⊗ₜ[R] p ⊗ₜ[R] q) := by
ext m n simp only [compr₂_apply, mk_apply, map_tmul, dualTensorHom_apply, dualDistrib_apply, ← smul_tmul_smul]
1,910
import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec" suppress_compilation -- Porting note: universe metavariables behave oddly universe w u v₁ v₂ v₃ v₄ variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂) (P : Type v₃) (Q : Type v₄) -- Porting note: we need high priority for this to fire first; not the case in ML3 attribute [local ext high] TensorProduct.ext section Contraction open TensorProduct LinearMap Matrix Module open TensorProduct section CommSemiring variable [CommSemiring R] variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] variable [Module R M] [Module R N] [Module R P] [Module R Q] variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M) -- Porting note: doesn't like implicit ring in the tensor product def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R := (uncurry _ _ _ _).toFun LinearMap.id #align contract_left contractLeft -- Porting note: doesn't like implicit ring in the tensor product def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R := (uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id) #align contract_right contractRight -- Porting note: doesn't like implicit ring in the tensor product def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N := let M' := Module.Dual R M (uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ #align dual_tensor_hom dualTensorHom variable {R M N P Q} @[simp] theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m := rfl #align contract_left_apply contractLeft_apply @[simp] theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m := rfl #align contract_right_apply contractRight_apply @[simp] theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) : dualTensorHom R M N (f ⊗ₜ n) m = f m • n := rfl #align dual_tensor_hom_apply dualTensorHom_apply @[simp] theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) : Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) = dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by ext f' m' simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply, LinearMap.smul_apply] exact mul_comm _ _ #align transpose_dual_tensor_hom transpose_dualTensorHom @[simp] theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) : ((dualTensorHom R M P) (f ⊗ₜ[R] p)).prodMap (0 : N →ₗ[R] Q) = dualTensorHom R (M × N) (P × Q) ((f ∘ₗ fst R M N) ⊗ₜ inl R P Q p) := by ext <;> simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply, fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero] #align dual_tensor_hom_prod_map_zero dualTensorHom_prodMap_zero @[simp] theorem zero_prodMap_dualTensorHom (g : Module.Dual R N) (q : Q) : (0 : M →ₗ[R] P).prodMap ((dualTensorHom R N Q) (g ⊗ₜ[R] q)) = dualTensorHom R (M × N) (P × Q) ((g ∘ₗ snd R M N) ⊗ₜ inr R P Q q) := by ext <;> simp only [coe_comp, coe_inr, Function.comp_apply, prodMap_apply, dualTensorHom_apply, snd_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero] #align zero_prod_map_dual_tensor_hom zero_prodMap_dualTensorHom theorem map_dualTensorHom (f : Module.Dual R M) (p : P) (g : Module.Dual R N) (q : Q) : TensorProduct.map (dualTensorHom R M P (f ⊗ₜ[R] p)) (dualTensorHom R N Q (g ⊗ₜ[R] q)) = dualTensorHom R (M ⊗[R] N) (P ⊗[R] Q) (dualDistrib R M N (f ⊗ₜ g) ⊗ₜ[R] p ⊗ₜ[R] q) := by ext m n simp only [compr₂_apply, mk_apply, map_tmul, dualTensorHom_apply, dualDistrib_apply, ← smul_tmul_smul] #align map_dual_tensor_hom map_dualTensorHom @[simp]
Mathlib/LinearAlgebra/Contraction.lean
122
128
theorem comp_dualTensorHom (f : Module.Dual R M) (n : N) (g : Module.Dual R N) (p : P) : dualTensorHom R N P (g ⊗ₜ[R] p) ∘ₗ dualTensorHom R M N (f ⊗ₜ[R] n) = g n • dualTensorHom R M P (f ⊗ₜ p) := by
ext m simp only [coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smul, RingHom.id_apply, LinearMap.smul_apply] rw [smul_comm]
1,910
import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec" suppress_compilation -- Porting note: universe metavariables behave oddly universe w u v₁ v₂ v₃ v₄ variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂) (P : Type v₃) (Q : Type v₄) -- Porting note: we need high priority for this to fire first; not the case in ML3 attribute [local ext high] TensorProduct.ext section Contraction open TensorProduct LinearMap Matrix Module open TensorProduct section CommSemiring variable [CommSemiring R] variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] variable [Module R M] [Module R N] [Module R P] [Module R Q] variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M) -- Porting note: doesn't like implicit ring in the tensor product def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R := (uncurry _ _ _ _).toFun LinearMap.id #align contract_left contractLeft -- Porting note: doesn't like implicit ring in the tensor product def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R := (uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id) #align contract_right contractRight -- Porting note: doesn't like implicit ring in the tensor product def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N := let M' := Module.Dual R M (uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ #align dual_tensor_hom dualTensorHom variable {R M N P Q} @[simp] theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m := rfl #align contract_left_apply contractLeft_apply @[simp] theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m := rfl #align contract_right_apply contractRight_apply @[simp] theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) : dualTensorHom R M N (f ⊗ₜ n) m = f m • n := rfl #align dual_tensor_hom_apply dualTensorHom_apply @[simp] theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) : Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) = dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by ext f' m' simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply, LinearMap.smul_apply] exact mul_comm _ _ #align transpose_dual_tensor_hom transpose_dualTensorHom @[simp] theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) : ((dualTensorHom R M P) (f ⊗ₜ[R] p)).prodMap (0 : N →ₗ[R] Q) = dualTensorHom R (M × N) (P × Q) ((f ∘ₗ fst R M N) ⊗ₜ inl R P Q p) := by ext <;> simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply, fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero] #align dual_tensor_hom_prod_map_zero dualTensorHom_prodMap_zero @[simp] theorem zero_prodMap_dualTensorHom (g : Module.Dual R N) (q : Q) : (0 : M →ₗ[R] P).prodMap ((dualTensorHom R N Q) (g ⊗ₜ[R] q)) = dualTensorHom R (M × N) (P × Q) ((g ∘ₗ snd R M N) ⊗ₜ inr R P Q q) := by ext <;> simp only [coe_comp, coe_inr, Function.comp_apply, prodMap_apply, dualTensorHom_apply, snd_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero] #align zero_prod_map_dual_tensor_hom zero_prodMap_dualTensorHom theorem map_dualTensorHom (f : Module.Dual R M) (p : P) (g : Module.Dual R N) (q : Q) : TensorProduct.map (dualTensorHom R M P (f ⊗ₜ[R] p)) (dualTensorHom R N Q (g ⊗ₜ[R] q)) = dualTensorHom R (M ⊗[R] N) (P ⊗[R] Q) (dualDistrib R M N (f ⊗ₜ g) ⊗ₜ[R] p ⊗ₜ[R] q) := by ext m n simp only [compr₂_apply, mk_apply, map_tmul, dualTensorHom_apply, dualDistrib_apply, ← smul_tmul_smul] #align map_dual_tensor_hom map_dualTensorHom @[simp] theorem comp_dualTensorHom (f : Module.Dual R M) (n : N) (g : Module.Dual R N) (p : P) : dualTensorHom R N P (g ⊗ₜ[R] p) ∘ₗ dualTensorHom R M N (f ⊗ₜ[R] n) = g n • dualTensorHom R M P (f ⊗ₜ p) := by ext m simp only [coe_comp, Function.comp_apply, dualTensorHom_apply, LinearMap.map_smul, RingHom.id_apply, LinearMap.smul_apply] rw [smul_comm] #align comp_dual_tensor_hom comp_dualTensorHom
Mathlib/LinearAlgebra/Contraction.lean
133
140
theorem toMatrix_dualTensorHom {m : Type*} {n : Type*} [Fintype m] [Finite n] [DecidableEq m] [DecidableEq n] (bM : Basis m R M) (bN : Basis n R N) (j : m) (i : n) : toMatrix bM bN (dualTensorHom R M N (bM.coord j ⊗ₜ bN i)) = stdBasisMatrix i j 1 := by
ext i' j' by_cases hij : i = i' ∧ j = j' <;> simp [LinearMap.toMatrix_apply, Finsupp.single_eq_pi_single, hij] rw [and_iff_not_or_not, Classical.not_not] at hij cases' hij with hij hij <;> simp [hij]
1,910
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section MonoidAlgebra variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] variable (ρ : Representation k G V) noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V := (lift k G _) ρ #align representation.as_algebra_hom Representation.asAlgebraHom theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ := rfl #align representation.as_algebra_hom_def Representation.asAlgebraHom_def @[simp]
Mathlib/RepresentationTheory/Basic.lean
106
107
theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by
simp only [asAlgebraHom_def, MonoidAlgebra.lift_single]
1,911
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section MonoidAlgebra variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] variable (ρ : Representation k G V) noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V := (lift k G _) ρ #align representation.as_algebra_hom Representation.asAlgebraHom theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ := rfl #align representation.as_algebra_hom_def Representation.asAlgebraHom_def @[simp] theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by simp only [asAlgebraHom_def, MonoidAlgebra.lift_single] #align representation.as_algebra_hom_single Representation.asAlgebraHom_single
Mathlib/RepresentationTheory/Basic.lean
110
110
theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by
simp
1,911
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section MonoidAlgebra variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] variable (ρ : Representation k G V) noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V := (lift k G _) ρ #align representation.as_algebra_hom Representation.asAlgebraHom theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ := rfl #align representation.as_algebra_hom_def Representation.asAlgebraHom_def @[simp] theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by simp only [asAlgebraHom_def, MonoidAlgebra.lift_single] #align representation.as_algebra_hom_single Representation.asAlgebraHom_single theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by simp #align representation.as_algebra_hom_single_one Representation.asAlgebraHom_single_one
Mathlib/RepresentationTheory/Basic.lean
113
114
theorem asAlgebraHom_of (g : G) : asAlgebraHom ρ (of k G g) = ρ g := by
simp only [MonoidAlgebra.of_apply, asAlgebraHom_single, one_smul]
1,911
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section MonoidAlgebra variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] variable (ρ : Representation k G V) noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V := (lift k G _) ρ #align representation.as_algebra_hom Representation.asAlgebraHom theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ := rfl #align representation.as_algebra_hom_def Representation.asAlgebraHom_def @[simp] theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by simp only [asAlgebraHom_def, MonoidAlgebra.lift_single] #align representation.as_algebra_hom_single Representation.asAlgebraHom_single theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by simp #align representation.as_algebra_hom_single_one Representation.asAlgebraHom_single_one theorem asAlgebraHom_of (g : G) : asAlgebraHom ρ (of k G g) = ρ g := by simp only [MonoidAlgebra.of_apply, asAlgebraHom_single, one_smul] #align representation.as_algebra_hom_of Representation.asAlgebraHom_of @[nolint unusedArguments] def asModule (_ : Representation k G V) := V #align representation.as_module Representation.asModule -- Porting note: no derive handler instance : AddCommMonoid (ρ.asModule) := inferInstanceAs <| AddCommMonoid V instance : Inhabited ρ.asModule where default := 0 noncomputable instance asModuleModule : Module (MonoidAlgebra k G) ρ.asModule := Module.compHom V (asAlgebraHom ρ).toRingHom #align representation.as_module_module Representation.asModuleModule -- Porting note: ρ.asModule doesn't unfold now instance : Module k ρ.asModule := inferInstanceAs <| Module k V def asModuleEquiv : ρ.asModule ≃+ V := AddEquiv.refl _ #align representation.as_module_equiv Representation.asModuleEquiv @[simp] theorem asModuleEquiv_map_smul (r : MonoidAlgebra k G) (x : ρ.asModule) : ρ.asModuleEquiv (r • x) = ρ.asAlgebraHom r (ρ.asModuleEquiv x) := rfl #align representation.as_module_equiv_map_smul Representation.asModuleEquiv_map_smul @[simp]
Mathlib/RepresentationTheory/Basic.lean
159
162
theorem asModuleEquiv_symm_map_smul (r : k) (x : V) : ρ.asModuleEquiv.symm (r • x) = algebraMap k (MonoidAlgebra k G) r • ρ.asModuleEquiv.symm x := by
apply_fun ρ.asModuleEquiv simp
1,911
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section MonoidAlgebra variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] variable (ρ : Representation k G V) noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V := (lift k G _) ρ #align representation.as_algebra_hom Representation.asAlgebraHom theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ := rfl #align representation.as_algebra_hom_def Representation.asAlgebraHom_def @[simp] theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by simp only [asAlgebraHom_def, MonoidAlgebra.lift_single] #align representation.as_algebra_hom_single Representation.asAlgebraHom_single theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by simp #align representation.as_algebra_hom_single_one Representation.asAlgebraHom_single_one theorem asAlgebraHom_of (g : G) : asAlgebraHom ρ (of k G g) = ρ g := by simp only [MonoidAlgebra.of_apply, asAlgebraHom_single, one_smul] #align representation.as_algebra_hom_of Representation.asAlgebraHom_of @[nolint unusedArguments] def asModule (_ : Representation k G V) := V #align representation.as_module Representation.asModule -- Porting note: no derive handler instance : AddCommMonoid (ρ.asModule) := inferInstanceAs <| AddCommMonoid V instance : Inhabited ρ.asModule where default := 0 noncomputable instance asModuleModule : Module (MonoidAlgebra k G) ρ.asModule := Module.compHom V (asAlgebraHom ρ).toRingHom #align representation.as_module_module Representation.asModuleModule -- Porting note: ρ.asModule doesn't unfold now instance : Module k ρ.asModule := inferInstanceAs <| Module k V def asModuleEquiv : ρ.asModule ≃+ V := AddEquiv.refl _ #align representation.as_module_equiv Representation.asModuleEquiv @[simp] theorem asModuleEquiv_map_smul (r : MonoidAlgebra k G) (x : ρ.asModule) : ρ.asModuleEquiv (r • x) = ρ.asAlgebraHom r (ρ.asModuleEquiv x) := rfl #align representation.as_module_equiv_map_smul Representation.asModuleEquiv_map_smul @[simp] theorem asModuleEquiv_symm_map_smul (r : k) (x : V) : ρ.asModuleEquiv.symm (r • x) = algebraMap k (MonoidAlgebra k G) r • ρ.asModuleEquiv.symm x := by apply_fun ρ.asModuleEquiv simp #align representation.as_module_equiv_symm_map_smul Representation.asModuleEquiv_symm_map_smul @[simp]
Mathlib/RepresentationTheory/Basic.lean
166
169
theorem asModuleEquiv_symm_map_rho (g : G) (x : V) : ρ.asModuleEquiv.symm (ρ g x) = MonoidAlgebra.of k G g • ρ.asModuleEquiv.symm x := by
apply_fun ρ.asModuleEquiv simp
1,911
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section MonoidAlgebra variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] variable (ρ : Representation k G V) noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V := (lift k G _) ρ #align representation.as_algebra_hom Representation.asAlgebraHom theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ := rfl #align representation.as_algebra_hom_def Representation.asAlgebraHom_def @[simp] theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by simp only [asAlgebraHom_def, MonoidAlgebra.lift_single] #align representation.as_algebra_hom_single Representation.asAlgebraHom_single theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by simp #align representation.as_algebra_hom_single_one Representation.asAlgebraHom_single_one theorem asAlgebraHom_of (g : G) : asAlgebraHom ρ (of k G g) = ρ g := by simp only [MonoidAlgebra.of_apply, asAlgebraHom_single, one_smul] #align representation.as_algebra_hom_of Representation.asAlgebraHom_of @[nolint unusedArguments] def asModule (_ : Representation k G V) := V #align representation.as_module Representation.asModule -- Porting note: no derive handler instance : AddCommMonoid (ρ.asModule) := inferInstanceAs <| AddCommMonoid V instance : Inhabited ρ.asModule where default := 0 noncomputable instance asModuleModule : Module (MonoidAlgebra k G) ρ.asModule := Module.compHom V (asAlgebraHom ρ).toRingHom #align representation.as_module_module Representation.asModuleModule -- Porting note: ρ.asModule doesn't unfold now instance : Module k ρ.asModule := inferInstanceAs <| Module k V def asModuleEquiv : ρ.asModule ≃+ V := AddEquiv.refl _ #align representation.as_module_equiv Representation.asModuleEquiv @[simp] theorem asModuleEquiv_map_smul (r : MonoidAlgebra k G) (x : ρ.asModule) : ρ.asModuleEquiv (r • x) = ρ.asAlgebraHom r (ρ.asModuleEquiv x) := rfl #align representation.as_module_equiv_map_smul Representation.asModuleEquiv_map_smul @[simp] theorem asModuleEquiv_symm_map_smul (r : k) (x : V) : ρ.asModuleEquiv.symm (r • x) = algebraMap k (MonoidAlgebra k G) r • ρ.asModuleEquiv.symm x := by apply_fun ρ.asModuleEquiv simp #align representation.as_module_equiv_symm_map_smul Representation.asModuleEquiv_symm_map_smul @[simp] theorem asModuleEquiv_symm_map_rho (g : G) (x : V) : ρ.asModuleEquiv.symm (ρ g x) = MonoidAlgebra.of k G g • ρ.asModuleEquiv.symm x := by apply_fun ρ.asModuleEquiv simp #align representation.as_module_equiv_symm_map_rho Representation.asModuleEquiv_symm_map_rho noncomputable def ofModule' (M : Type*) [AddCommMonoid M] [Module k M] [Module (MonoidAlgebra k G) M] [IsScalarTower k (MonoidAlgebra k G) M] : Representation k G M := (MonoidAlgebra.lift k G (M →ₗ[k] M)).symm (Algebra.lsmul k k M) #align representation.of_module' Representation.ofModule' section variable (M : Type*) [AddCommMonoid M] [Module (MonoidAlgebra k G) M] noncomputable def ofModule : Representation k G (RestrictScalars k (MonoidAlgebra k G) M) := (MonoidAlgebra.lift k G (RestrictScalars k (MonoidAlgebra k G) M →ₗ[k] RestrictScalars k (MonoidAlgebra k G) M)).symm (RestrictScalars.lsmul k (MonoidAlgebra k G) M) #align representation.of_module Representation.ofModule @[simp]
Mathlib/RepresentationTheory/Basic.lean
221
234
theorem ofModule_asAlgebraHom_apply_apply (r : MonoidAlgebra k G) (m : RestrictScalars k (MonoidAlgebra k G) M) : ((ofModule M).asAlgebraHom r) m = (RestrictScalars.addEquiv _ _ _).symm (r • RestrictScalars.addEquiv _ _ _ m) := by
apply MonoidAlgebra.induction_on r · intro g simp only [one_smul, MonoidAlgebra.lift_symm_apply, MonoidAlgebra.of_apply, Representation.asAlgebraHom_single, Representation.ofModule, AddEquiv.apply_eq_iff_eq, RestrictScalars.lsmul_apply_apply] · intro f g fw gw simp only [fw, gw, map_add, add_smul, LinearMap.add_apply] · intro r f w simp only [w, AlgHom.map_smul, LinearMap.smul_apply, RestrictScalars.addEquiv_symm_map_smul_smul]
1,911
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section MonoidAlgebra variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] variable (ρ : Representation k G V) noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V := (lift k G _) ρ #align representation.as_algebra_hom Representation.asAlgebraHom theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ := rfl #align representation.as_algebra_hom_def Representation.asAlgebraHom_def @[simp] theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by simp only [asAlgebraHom_def, MonoidAlgebra.lift_single] #align representation.as_algebra_hom_single Representation.asAlgebraHom_single theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by simp #align representation.as_algebra_hom_single_one Representation.asAlgebraHom_single_one theorem asAlgebraHom_of (g : G) : asAlgebraHom ρ (of k G g) = ρ g := by simp only [MonoidAlgebra.of_apply, asAlgebraHom_single, one_smul] #align representation.as_algebra_hom_of Representation.asAlgebraHom_of @[nolint unusedArguments] def asModule (_ : Representation k G V) := V #align representation.as_module Representation.asModule -- Porting note: no derive handler instance : AddCommMonoid (ρ.asModule) := inferInstanceAs <| AddCommMonoid V instance : Inhabited ρ.asModule where default := 0 noncomputable instance asModuleModule : Module (MonoidAlgebra k G) ρ.asModule := Module.compHom V (asAlgebraHom ρ).toRingHom #align representation.as_module_module Representation.asModuleModule -- Porting note: ρ.asModule doesn't unfold now instance : Module k ρ.asModule := inferInstanceAs <| Module k V def asModuleEquiv : ρ.asModule ≃+ V := AddEquiv.refl _ #align representation.as_module_equiv Representation.asModuleEquiv @[simp] theorem asModuleEquiv_map_smul (r : MonoidAlgebra k G) (x : ρ.asModule) : ρ.asModuleEquiv (r • x) = ρ.asAlgebraHom r (ρ.asModuleEquiv x) := rfl #align representation.as_module_equiv_map_smul Representation.asModuleEquiv_map_smul @[simp] theorem asModuleEquiv_symm_map_smul (r : k) (x : V) : ρ.asModuleEquiv.symm (r • x) = algebraMap k (MonoidAlgebra k G) r • ρ.asModuleEquiv.symm x := by apply_fun ρ.asModuleEquiv simp #align representation.as_module_equiv_symm_map_smul Representation.asModuleEquiv_symm_map_smul @[simp] theorem asModuleEquiv_symm_map_rho (g : G) (x : V) : ρ.asModuleEquiv.symm (ρ g x) = MonoidAlgebra.of k G g • ρ.asModuleEquiv.symm x := by apply_fun ρ.asModuleEquiv simp #align representation.as_module_equiv_symm_map_rho Representation.asModuleEquiv_symm_map_rho noncomputable def ofModule' (M : Type*) [AddCommMonoid M] [Module k M] [Module (MonoidAlgebra k G) M] [IsScalarTower k (MonoidAlgebra k G) M] : Representation k G M := (MonoidAlgebra.lift k G (M →ₗ[k] M)).symm (Algebra.lsmul k k M) #align representation.of_module' Representation.ofModule' section variable (M : Type*) [AddCommMonoid M] [Module (MonoidAlgebra k G) M] noncomputable def ofModule : Representation k G (RestrictScalars k (MonoidAlgebra k G) M) := (MonoidAlgebra.lift k G (RestrictScalars k (MonoidAlgebra k G) M →ₗ[k] RestrictScalars k (MonoidAlgebra k G) M)).symm (RestrictScalars.lsmul k (MonoidAlgebra k G) M) #align representation.of_module Representation.ofModule @[simp] theorem ofModule_asAlgebraHom_apply_apply (r : MonoidAlgebra k G) (m : RestrictScalars k (MonoidAlgebra k G) M) : ((ofModule M).asAlgebraHom r) m = (RestrictScalars.addEquiv _ _ _).symm (r • RestrictScalars.addEquiv _ _ _ m) := by apply MonoidAlgebra.induction_on r · intro g simp only [one_smul, MonoidAlgebra.lift_symm_apply, MonoidAlgebra.of_apply, Representation.asAlgebraHom_single, Representation.ofModule, AddEquiv.apply_eq_iff_eq, RestrictScalars.lsmul_apply_apply] · intro f g fw gw simp only [fw, gw, map_add, add_smul, LinearMap.add_apply] · intro r f w simp only [w, AlgHom.map_smul, LinearMap.smul_apply, RestrictScalars.addEquiv_symm_map_smul_smul] #align representation.of_module_as_algebra_hom_apply_apply Representation.ofModule_asAlgebraHom_apply_apply @[simp]
Mathlib/RepresentationTheory/Basic.lean
238
245
theorem ofModule_asModule_act (g : G) (x : RestrictScalars k (MonoidAlgebra k G) ρ.asModule) : ofModule (k := k) (G := G) ρ.asModule g x = -- Porting note: more help with implicit (RestrictScalars.addEquiv _ _ _).symm (ρ.asModuleEquiv.symm (ρ g (ρ.asModuleEquiv (RestrictScalars.addEquiv _ _ _ x)))) := by
apply_fun RestrictScalars.addEquiv _ _ ρ.asModule using (RestrictScalars.addEquiv _ _ ρ.asModule).injective dsimp [ofModule, RestrictScalars.lsmul_apply_apply] simp
1,911
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.LinearAlgebra.Dual import Mathlib.LinearAlgebra.Contraction import Mathlib.RingTheory.TensorProduct.Basic #align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac" open MonoidAlgebra (lift of) open LinearMap section variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V] abbrev Representation := G →* V →ₗ[k] V #align representation Representation end namespace Representation section LinearHom variable {k G V W : Type*} [CommSemiring k] [Group G] variable [AddCommMonoid V] [Module k V] [AddCommMonoid W] [Module k W] variable (ρV : Representation k G V) (ρW : Representation k G W) def linHom : Representation k G (V →ₗ[k] W) where toFun g := { toFun := fun f => ρW g ∘ₗ f ∘ₗ ρV g⁻¹ map_add' := fun f₁ f₂ => by simp_rw [add_comp, comp_add] map_smul' := fun r f => by simp_rw [RingHom.id_apply, smul_comp, comp_smul] } map_one' := LinearMap.ext fun x => by dsimp -- Porting note (#11227):now needed simp_rw [inv_one, map_one, one_eq_id, comp_id, id_comp] map_mul' g h := LinearMap.ext fun x => by dsimp -- Porting note (#11227):now needed simp_rw [mul_inv_rev, map_mul, mul_eq_comp, comp_assoc] #align representation.lin_hom Representation.linHom @[simp] theorem linHom_apply (g : G) (f : V →ₗ[k] W) : (linHom ρV ρW) g f = ρW g ∘ₗ f ∘ₗ ρV g⁻¹ := rfl #align representation.lin_hom_apply Representation.linHom_apply def dual : Representation k G (Module.Dual k V) where toFun g := { toFun := fun f => f ∘ₗ ρV g⁻¹ map_add' := fun f₁ f₂ => by simp only [add_comp] map_smul' := fun r f => by ext simp only [coe_comp, Function.comp_apply, smul_apply, RingHom.id_apply] } map_one' := by ext dsimp -- Porting note (#11227):now needed simp only [coe_comp, Function.comp_apply, map_one, inv_one, coe_mk, one_apply] map_mul' g h := by ext dsimp -- Porting note (#11227):now needed simp only [coe_comp, Function.comp_apply, mul_inv_rev, map_mul, coe_mk, mul_apply] #align representation.dual Representation.dual @[simp] theorem dual_apply (g : G) : (dual ρV) g = Module.Dual.transpose (R := k) (ρV g⁻¹) := rfl #align representation.dual_apply Representation.dual_apply
Mathlib/RepresentationTheory/Basic.lean
501
504
theorem dualTensorHom_comm (g : G) : dualTensorHom k V W ∘ₗ TensorProduct.map (ρV.dual g) (ρW g) = (linHom ρV ρW) g ∘ₗ dualTensorHom k V W := by
ext; simp [Module.Dual.transpose_apply]
1,911
import Mathlib.LinearAlgebra.Contraction #align_import linear_algebra.coevaluation from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31" noncomputable section section coevaluation open TensorProduct FiniteDimensional open TensorProduct universe u v variable (K : Type u) [Field K] variable (V : Type v) [AddCommGroup V] [Module K V] [FiniteDimensional K V] def coevaluation : K →ₗ[K] V ⊗[K] Module.Dual K V := let bV := Basis.ofVectorSpace K V (Basis.singleton Unit K).constr K fun _ => ∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i #align coevaluation coevaluation
Mathlib/LinearAlgebra/Coevaluation.lean
47
54
theorem coevaluation_apply_one : (coevaluation K V) (1 : K) = let bV := Basis.ofVectorSpace K V ∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i := by
simp only [coevaluation, id] rw [(Basis.singleton Unit K).constr_apply_fintype K] simp only [Fintype.univ_punit, Finset.sum_const, one_smul, Basis.singleton_repr, Basis.equivFun_apply, Basis.coe_ofVectorSpace, one_nsmul, Finset.card_singleton]
1,912
import Mathlib.LinearAlgebra.Contraction #align_import linear_algebra.coevaluation from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31" noncomputable section section coevaluation open TensorProduct FiniteDimensional open TensorProduct universe u v variable (K : Type u) [Field K] variable (V : Type v) [AddCommGroup V] [Module K V] [FiniteDimensional K V] def coevaluation : K →ₗ[K] V ⊗[K] Module.Dual K V := let bV := Basis.ofVectorSpace K V (Basis.singleton Unit K).constr K fun _ => ∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i #align coevaluation coevaluation theorem coevaluation_apply_one : (coevaluation K V) (1 : K) = let bV := Basis.ofVectorSpace K V ∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i := by simp only [coevaluation, id] rw [(Basis.singleton Unit K).constr_apply_fintype K] simp only [Fintype.univ_punit, Finset.sum_const, one_smul, Basis.singleton_repr, Basis.equivFun_apply, Basis.coe_ofVectorSpace, one_nsmul, Finset.card_singleton] #align coevaluation_apply_one coevaluation_apply_one open TensorProduct
Mathlib/LinearAlgebra/Coevaluation.lean
61
76
theorem contractLeft_assoc_coevaluation : (contractLeft K V).rTensor _ ∘ₗ (TensorProduct.assoc K _ _ _).symm.toLinearMap ∘ₗ (coevaluation K V).lTensor (Module.Dual K V) = (TensorProduct.lid K _).symm.toLinearMap ∘ₗ (TensorProduct.rid K _).toLinearMap := by
letI := Classical.decEq (Basis.ofVectorSpaceIndex K V) apply TensorProduct.ext apply (Basis.ofVectorSpace K V).dualBasis.ext; intro j; apply LinearMap.ext_ring rw [LinearMap.compr₂_apply, LinearMap.compr₂_apply, TensorProduct.mk_apply] simp only [LinearMap.coe_comp, Function.comp_apply, LinearEquiv.coe_toLinearMap] rw [rid_tmul, one_smul, lid_symm_apply] simp only [LinearEquiv.coe_toLinearMap, LinearMap.lTensor_tmul, coevaluation_apply_one] rw [TensorProduct.tmul_sum, map_sum]; simp only [assoc_symm_tmul] rw [map_sum]; simp only [LinearMap.rTensor_tmul, contractLeft_apply] simp only [Basis.coe_dualBasis, Basis.coord_apply, Basis.repr_self_apply, TensorProduct.ite_tmul] rw [Finset.sum_ite_eq']; simp only [Finset.mem_univ, if_true]
1,912
import Mathlib.LinearAlgebra.Contraction #align_import linear_algebra.coevaluation from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31" noncomputable section section coevaluation open TensorProduct FiniteDimensional open TensorProduct universe u v variable (K : Type u) [Field K] variable (V : Type v) [AddCommGroup V] [Module K V] [FiniteDimensional K V] def coevaluation : K →ₗ[K] V ⊗[K] Module.Dual K V := let bV := Basis.ofVectorSpace K V (Basis.singleton Unit K).constr K fun _ => ∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i #align coevaluation coevaluation theorem coevaluation_apply_one : (coevaluation K V) (1 : K) = let bV := Basis.ofVectorSpace K V ∑ i : Basis.ofVectorSpaceIndex K V, bV i ⊗ₜ[K] bV.coord i := by simp only [coevaluation, id] rw [(Basis.singleton Unit K).constr_apply_fintype K] simp only [Fintype.univ_punit, Finset.sum_const, one_smul, Basis.singleton_repr, Basis.equivFun_apply, Basis.coe_ofVectorSpace, one_nsmul, Finset.card_singleton] #align coevaluation_apply_one coevaluation_apply_one open TensorProduct theorem contractLeft_assoc_coevaluation : (contractLeft K V).rTensor _ ∘ₗ (TensorProduct.assoc K _ _ _).symm.toLinearMap ∘ₗ (coevaluation K V).lTensor (Module.Dual K V) = (TensorProduct.lid K _).symm.toLinearMap ∘ₗ (TensorProduct.rid K _).toLinearMap := by letI := Classical.decEq (Basis.ofVectorSpaceIndex K V) apply TensorProduct.ext apply (Basis.ofVectorSpace K V).dualBasis.ext; intro j; apply LinearMap.ext_ring rw [LinearMap.compr₂_apply, LinearMap.compr₂_apply, TensorProduct.mk_apply] simp only [LinearMap.coe_comp, Function.comp_apply, LinearEquiv.coe_toLinearMap] rw [rid_tmul, one_smul, lid_symm_apply] simp only [LinearEquiv.coe_toLinearMap, LinearMap.lTensor_tmul, coevaluation_apply_one] rw [TensorProduct.tmul_sum, map_sum]; simp only [assoc_symm_tmul] rw [map_sum]; simp only [LinearMap.rTensor_tmul, contractLeft_apply] simp only [Basis.coe_dualBasis, Basis.coord_apply, Basis.repr_self_apply, TensorProduct.ite_tmul] rw [Finset.sum_ite_eq']; simp only [Finset.mem_univ, if_true] #align contract_left_assoc_coevaluation contractLeft_assoc_coevaluation
Mathlib/LinearAlgebra/Coevaluation.lean
81
95
theorem contractLeft_assoc_coevaluation' : (contractLeft K V).lTensor _ ∘ₗ (TensorProduct.assoc K _ _ _).toLinearMap ∘ₗ (coevaluation K V).rTensor V = (TensorProduct.rid K _).symm.toLinearMap ∘ₗ (TensorProduct.lid K _).toLinearMap := by
letI := Classical.decEq (Basis.ofVectorSpaceIndex K V) apply TensorProduct.ext apply LinearMap.ext_ring; apply (Basis.ofVectorSpace K V).ext; intro j rw [LinearMap.compr₂_apply, LinearMap.compr₂_apply, TensorProduct.mk_apply] simp only [LinearMap.coe_comp, Function.comp_apply, LinearEquiv.coe_toLinearMap] rw [lid_tmul, one_smul, rid_symm_apply] simp only [LinearEquiv.coe_toLinearMap, LinearMap.rTensor_tmul, coevaluation_apply_one] rw [TensorProduct.sum_tmul, map_sum]; simp only [assoc_tmul] rw [map_sum]; simp only [LinearMap.lTensor_tmul, contractLeft_apply] simp only [Basis.coord_apply, Basis.repr_self_apply, TensorProduct.tmul_ite] rw [Finset.sum_ite_eq]; simp only [Finset.mem_univ, if_true]
1,912
import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv import Mathlib.LinearAlgebra.Dual #align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Set open scoped Topology Filter variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E} {f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ}
Mathlib/Analysis/Calculus/LagrangeMultipliers.lean
44
53
theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by
intro htop set fφ := fun x => (f x, φ x) have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀) rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop] exact map_snd_nhdsWithin _ exact hextr.not_nhds_le_map A.ge
1,913
import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv import Mathlib.LinearAlgebra.Dual #align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Set open scoped Topology Filter variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E} {f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ} theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by intro htop set fφ := fun x => (f x, φ x) have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀) rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop] exact map_snd_nhdsWithin _ exact hextr.not_nhds_le_map A.ge #align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
Mathlib/Analysis/Calculus/LagrangeMultipliers.lean
60
78
theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ (Λ : Module.Dual ℝ F) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ ∀ x, Λ (f' x) + Λ₀ • φ' x = 0 := by
rcases Submodule.exists_le_ker_of_lt_top _ (lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hφ') with ⟨Λ', h0, hΛ'⟩ set e : ((F →ₗ[ℝ] ℝ) × ℝ) ≃ₗ[ℝ] F × ℝ →ₗ[ℝ] ℝ := ((LinearEquiv.refl ℝ (F →ₗ[ℝ] ℝ)).prod (LinearMap.ringLmapEquivSelf ℝ ℝ ℝ).symm).trans (LinearMap.coprodEquiv ℝ) rcases e.surjective Λ' with ⟨⟨Λ, Λ₀⟩, rfl⟩ refine ⟨Λ, Λ₀, e.map_ne_zero_iff.1 h0, fun x => ?_⟩ convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΛ') x using 1 -- squeezed `simp [mul_comm]` to speed up elaboration simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply, LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply, ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply, LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight, LinearMap.one_apply, mul_comm]
1,913
import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv import Mathlib.LinearAlgebra.Dual #align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Set open scoped Topology Filter variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E} {f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ} theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by intro htop set fφ := fun x => (f x, φ x) have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀) rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop] exact map_snd_nhdsWithin _ exact hextr.not_nhds_le_map A.ge #align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ (Λ : Module.Dual ℝ F) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ ∀ x, Λ (f' x) + Λ₀ • φ' x = 0 := by rcases Submodule.exists_le_ker_of_lt_top _ (lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hφ') with ⟨Λ', h0, hΛ'⟩ set e : ((F →ₗ[ℝ] ℝ) × ℝ) ≃ₗ[ℝ] F × ℝ →ₗ[ℝ] ℝ := ((LinearEquiv.refl ℝ (F →ₗ[ℝ] ℝ)).prod (LinearMap.ringLmapEquivSelf ℝ ℝ ℝ).symm).trans (LinearMap.coprodEquiv ℝ) rcases e.surjective Λ' with ⟨⟨Λ, Λ₀⟩, rfl⟩ refine ⟨Λ, Λ₀, e.map_ne_zero_iff.1 h0, fun x => ?_⟩ convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΛ') x using 1 -- squeezed `simp [mul_comm]` to speed up elaboration simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply, LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply, ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply, LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight, LinearMap.one_apply, mul_comm] #align is_local_extr_on.exists_linear_map_of_has_strict_fderiv_at IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
Mathlib/Analysis/Calculus/LagrangeMultipliers.lean
84
97
theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d {f : E → ℝ} {f' : E →L[ℝ] ℝ} (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • f' + b • φ' = 0 := by
obtain ⟨Λ, Λ₀, hΛ, hfΛ⟩ := hextr.exists_linear_map_of_hasStrictFDerivAt hf' hφ' refine ⟨Λ 1, Λ₀, ?_, ?_⟩ · contrapose! hΛ simp only [Prod.mk_eq_zero] at hΛ ⊢ refine ⟨LinearMap.ext fun x => ?_, hΛ.2⟩ simpa [hΛ.1] using Λ.map_smul x 1 · ext x have H₁ : Λ (f' x) = f' x * Λ 1 := by simpa only [mul_one, Algebra.id.smul_eq_mul] using Λ.map_smul (f' x) 1 have H₂ : f' x * Λ 1 + Λ₀ * φ' x = 0 := by simpa only [Algebra.id.smul_eq_mul, H₁] using hfΛ x simpa [mul_comm] using H₂
1,913
import Mathlib.Analysis.Calculus.FDeriv.Prod import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv import Mathlib.LinearAlgebra.Dual #align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Set open scoped Topology Filter variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {f : E → F} {φ : E → ℝ} {x₀ : E} {f' : E →L[ℝ] F} {φ' : E →L[ℝ] ℝ} theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : LinearMap.range (f'.prod φ') ≠ ⊤ := by intro htop set fφ := fun x => (f x, φ x) have A : map φ (𝓝[f ⁻¹' {f x₀}] x₀) = 𝓝 (φ x₀) := by change map (Prod.snd ∘ fφ) (𝓝[fφ ⁻¹' {p | p.1 = f x₀}] x₀) = 𝓝 (φ x₀) rw [← map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hφ').map_nhds_eq_of_surj htop] exact map_snd_nhdsWithin _ exact hextr.not_nhds_le_map A.ge #align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ (Λ : Module.Dual ℝ F) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ ∀ x, Λ (f' x) + Λ₀ • φ' x = 0 := by rcases Submodule.exists_le_ker_of_lt_top _ (lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hφ') with ⟨Λ', h0, hΛ'⟩ set e : ((F →ₗ[ℝ] ℝ) × ℝ) ≃ₗ[ℝ] F × ℝ →ₗ[ℝ] ℝ := ((LinearEquiv.refl ℝ (F →ₗ[ℝ] ℝ)).prod (LinearMap.ringLmapEquivSelf ℝ ℝ ℝ).symm).trans (LinearMap.coprodEquiv ℝ) rcases e.surjective Λ' with ⟨⟨Λ, Λ₀⟩, rfl⟩ refine ⟨Λ, Λ₀, e.map_ne_zero_iff.1 h0, fun x => ?_⟩ convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΛ') x using 1 -- squeezed `simp [mul_comm]` to speed up elaboration simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply, LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply, ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply, LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight, LinearMap.one_apply, mul_comm] #align is_local_extr_on.exists_linear_map_of_has_strict_fderiv_at IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d {f : E → ℝ} {f' : E →L[ℝ] ℝ} (hextr : IsLocalExtrOn φ {x | f x = f x₀} x₀) (hf' : HasStrictFDerivAt f f' x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • f' + b • φ' = 0 := by obtain ⟨Λ, Λ₀, hΛ, hfΛ⟩ := hextr.exists_linear_map_of_hasStrictFDerivAt hf' hφ' refine ⟨Λ 1, Λ₀, ?_, ?_⟩ · contrapose! hΛ simp only [Prod.mk_eq_zero] at hΛ ⊢ refine ⟨LinearMap.ext fun x => ?_, hΛ.2⟩ simpa [hΛ.1] using Λ.map_smul x 1 · ext x have H₁ : Λ (f' x) = f' x * Λ 1 := by simpa only [mul_one, Algebra.id.smul_eq_mul] using Λ.map_smul (f' x) 1 have H₂ : f' x * Λ 1 + Λ₀ * φ' x = 0 := by simpa only [Algebra.id.smul_eq_mul, H₁] using hfΛ x simpa [mul_comm] using H₂ #align is_local_extr_on.exists_multipliers_of_has_strict_fderiv_at_1d IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d
Mathlib/Analysis/Calculus/LagrangeMultipliers.lean
108
121
theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt {ι : Type*} [Fintype ι] {f : ι → E → ℝ} {f' : ι → E →L[ℝ] ℝ} (hextr : IsLocalExtrOn φ {x | ∀ i, f i x = f i x₀} x₀) (hf' : ∀ i, HasStrictFDerivAt (f i) (f' i) x₀) (hφ' : HasStrictFDerivAt φ φ' x₀) : ∃ (Λ : ι → ℝ) (Λ₀ : ℝ), (Λ, Λ₀) ≠ 0 ∧ (∑ i, Λ i • f' i) + Λ₀ • φ' = 0 := by
letI := Classical.decEq ι replace hextr : IsLocalExtrOn φ {x | (fun i => f i x) = fun i => f i x₀} x₀ := by simpa only [Function.funext_iff] using hextr rcases hextr.exists_linear_map_of_hasStrictFDerivAt (hasStrictFDerivAt_pi.2 fun i => hf' i) hφ' with ⟨Λ, Λ₀, h0, hsum⟩ rcases (LinearEquiv.piRing ℝ ℝ ι ℝ).symm.surjective Λ with ⟨Λ, rfl⟩ refine ⟨Λ, Λ₀, ?_, ?_⟩ · simpa only [Ne, Prod.ext_iff, LinearEquiv.map_eq_zero_iff, Prod.fst_zero] using h0 · ext x; simpa [mul_comm] using hsum x
1,913
import Mathlib.LinearAlgebra.Basis import Mathlib.LinearAlgebra.Dual import Mathlib.Data.Fin.FlagRange open Set Submodule namespace Basis section Semiring variable {R M : Type*} [Semiring R] [AddCommMonoid M] [Module R M] {n : ℕ} def flag (b : Basis (Fin n) R M) (k : Fin (n + 1)) : Submodule R M := .span R <| b '' {i | i.castSucc < k} @[simp]
Mathlib/LinearAlgebra/Basis/Flag.lean
32
32
theorem flag_zero (b : Basis (Fin n) R M) : b.flag 0 = ⊥ := by
simp [flag]
1,914
import Mathlib.LinearAlgebra.Basis import Mathlib.LinearAlgebra.Dual import Mathlib.Data.Fin.FlagRange open Set Submodule namespace Basis section Semiring variable {R M : Type*} [Semiring R] [AddCommMonoid M] [Module R M] {n : ℕ} def flag (b : Basis (Fin n) R M) (k : Fin (n + 1)) : Submodule R M := .span R <| b '' {i | i.castSucc < k} @[simp] theorem flag_zero (b : Basis (Fin n) R M) : b.flag 0 = ⊥ := by simp [flag] @[simp]
Mathlib/LinearAlgebra/Basis/Flag.lean
35
36
theorem flag_last (b : Basis (Fin n) R M) : b.flag (.last n) = ⊤ := by
simp [flag, Fin.castSucc_lt_last]
1,914
import Mathlib.LinearAlgebra.Basis import Mathlib.LinearAlgebra.Dual import Mathlib.Data.Fin.FlagRange open Set Submodule namespace Basis section Semiring variable {R M : Type*} [Semiring R] [AddCommMonoid M] [Module R M] {n : ℕ} def flag (b : Basis (Fin n) R M) (k : Fin (n + 1)) : Submodule R M := .span R <| b '' {i | i.castSucc < k} @[simp] theorem flag_zero (b : Basis (Fin n) R M) : b.flag 0 = ⊥ := by simp [flag] @[simp] theorem flag_last (b : Basis (Fin n) R M) : b.flag (.last n) = ⊤ := by simp [flag, Fin.castSucc_lt_last] theorem flag_le_iff (b : Basis (Fin n) R M) {k p} : b.flag k ≤ p ↔ ∀ i : Fin n, i.castSucc < k → b i ∈ p := span_le.trans forall_mem_image
Mathlib/LinearAlgebra/Basis/Flag.lean
42
45
theorem flag_succ (b : Basis (Fin n) R M) (k : Fin n) : b.flag k.succ = (R ∙ b k) ⊔ b.flag k.castSucc := by
simp only [flag, Fin.castSucc_lt_castSucc_iff] simp [Fin.castSucc_lt_iff_succ_le, le_iff_eq_or_lt, setOf_or, image_insert_eq, span_insert]
1,914
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
68
72
theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by
simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add]
1,915
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
130
134
theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by
-- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx
1,915
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by -- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx #align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
138
141
theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) : b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by
rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul, reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq]
1,915
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by -- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx #align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) : b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul, reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq] #align clifford_algebra.contract_right_mul_ι CliffordAlgebra.contractRight_mul_ι
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
144
146
theorem contractLeft_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : d⌋(algebraMap _ _ r * b) = algebraMap _ _ r * (d⌋b) := by
rw [← Algebra.smul_def, map_smul, Algebra.smul_def]
1,915
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by -- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx #align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) : b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul, reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq] #align clifford_algebra.contract_right_mul_ι CliffordAlgebra.contractRight_mul_ι theorem contractLeft_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : d⌋(algebraMap _ _ r * b) = algebraMap _ _ r * (d⌋b) := by rw [← Algebra.smul_def, map_smul, Algebra.smul_def] #align clifford_algebra.contract_left_algebra_map_mul CliffordAlgebra.contractLeft_algebraMap_mul
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
149
151
theorem contractLeft_mul_algebraMap (a : CliffordAlgebra Q) (r : R) : d⌋(a * algebraMap _ _ r) = d⌋a * algebraMap _ _ r := by
rw [← Algebra.commutes, contractLeft_algebraMap_mul, Algebra.commutes]
1,915
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by -- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx #align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) : b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul, reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq] #align clifford_algebra.contract_right_mul_ι CliffordAlgebra.contractRight_mul_ι theorem contractLeft_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : d⌋(algebraMap _ _ r * b) = algebraMap _ _ r * (d⌋b) := by rw [← Algebra.smul_def, map_smul, Algebra.smul_def] #align clifford_algebra.contract_left_algebra_map_mul CliffordAlgebra.contractLeft_algebraMap_mul theorem contractLeft_mul_algebraMap (a : CliffordAlgebra Q) (r : R) : d⌋(a * algebraMap _ _ r) = d⌋a * algebraMap _ _ r := by rw [← Algebra.commutes, contractLeft_algebraMap_mul, Algebra.commutes] #align clifford_algebra.contract_left_mul_algebra_map CliffordAlgebra.contractLeft_mul_algebraMap
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
154
156
theorem contractRight_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : algebraMap _ _ r * b⌊d = algebraMap _ _ r * (b⌊d) := by
rw [← Algebra.smul_def, LinearMap.map_smul₂, Algebra.smul_def]
1,915
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by -- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx #align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) : b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul, reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq] #align clifford_algebra.contract_right_mul_ι CliffordAlgebra.contractRight_mul_ι theorem contractLeft_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : d⌋(algebraMap _ _ r * b) = algebraMap _ _ r * (d⌋b) := by rw [← Algebra.smul_def, map_smul, Algebra.smul_def] #align clifford_algebra.contract_left_algebra_map_mul CliffordAlgebra.contractLeft_algebraMap_mul theorem contractLeft_mul_algebraMap (a : CliffordAlgebra Q) (r : R) : d⌋(a * algebraMap _ _ r) = d⌋a * algebraMap _ _ r := by rw [← Algebra.commutes, contractLeft_algebraMap_mul, Algebra.commutes] #align clifford_algebra.contract_left_mul_algebra_map CliffordAlgebra.contractLeft_mul_algebraMap theorem contractRight_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : algebraMap _ _ r * b⌊d = algebraMap _ _ r * (b⌊d) := by rw [← Algebra.smul_def, LinearMap.map_smul₂, Algebra.smul_def] #align clifford_algebra.contract_right_algebra_map_mul CliffordAlgebra.contractRight_algebraMap_mul
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
159
161
theorem contractRight_mul_algebraMap (a : CliffordAlgebra Q) (r : R) : a * algebraMap _ _ r⌊d = a⌊d * algebraMap _ _ r := by
rw [← Algebra.commutes, contractRight_algebraMap_mul, Algebra.commutes]
1,915
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.Dual #align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open LinearMap (BilinForm) universe u1 u2 u3 variable {R : Type u1} [CommRing R] variable {M : Type u2} [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace CliffordAlgebra section contractLeft variable (d d' : Module.Dual R M) @[simps!] def contractLeftAux (d : Module.Dual R M) : M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q := haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) - v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _) #align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) : contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by simp only [contractLeftAux_apply_apply] rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self, zero_add] #align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux variable {Q} def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0 map_add' d₁ d₂ := LinearMap.ext fun x => by dsimp only rw [LinearMap.add_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero, zero_add] · rw [map_add, map_add, map_add, add_add_add_comm, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul] map_smul' c d := LinearMap.ext fun x => by dsimp only rw [LinearMap.smul_apply, RingHom.id_apply] induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx · simp_rw [foldr'_algebraMap, smul_zero] · rw [map_add, map_add, smul_add, hx, hy] · rw [foldr'_ι_mul, foldr'_ι_mul, hx] dsimp only [contractLeftAux_apply_apply] rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub] #align clifford_algebra.contract_left CliffordAlgebra.contractLeft def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q := LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse) #align clifford_algebra.contract_right CliffordAlgebra.contractRight theorem contractRight_eq (x : CliffordAlgebra Q) : contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) := rfl #align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq local infixl:70 "⌋" => contractLeft (R := R) (M := M) local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q) -- Porting note: Lean needs to be reminded of this instance otherwise the statement of the -- next result times out instance : SMul R (CliffordAlgebra Q) := inferInstance theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) : d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by -- Porting note: Lean cannot figure out anymore the third argument refine foldr'_ι_mul _ _ ?_ _ _ _ exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx #align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) : b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul, reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq] #align clifford_algebra.contract_right_mul_ι CliffordAlgebra.contractRight_mul_ι theorem contractLeft_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : d⌋(algebraMap _ _ r * b) = algebraMap _ _ r * (d⌋b) := by rw [← Algebra.smul_def, map_smul, Algebra.smul_def] #align clifford_algebra.contract_left_algebra_map_mul CliffordAlgebra.contractLeft_algebraMap_mul theorem contractLeft_mul_algebraMap (a : CliffordAlgebra Q) (r : R) : d⌋(a * algebraMap _ _ r) = d⌋a * algebraMap _ _ r := by rw [← Algebra.commutes, contractLeft_algebraMap_mul, Algebra.commutes] #align clifford_algebra.contract_left_mul_algebra_map CliffordAlgebra.contractLeft_mul_algebraMap theorem contractRight_algebraMap_mul (r : R) (b : CliffordAlgebra Q) : algebraMap _ _ r * b⌊d = algebraMap _ _ r * (b⌊d) := by rw [← Algebra.smul_def, LinearMap.map_smul₂, Algebra.smul_def] #align clifford_algebra.contract_right_algebra_map_mul CliffordAlgebra.contractRight_algebraMap_mul theorem contractRight_mul_algebraMap (a : CliffordAlgebra Q) (r : R) : a * algebraMap _ _ r⌊d = a⌊d * algebraMap _ _ r := by rw [← Algebra.commutes, contractRight_algebraMap_mul, Algebra.commutes] #align clifford_algebra.contract_right_mul_algebra_map CliffordAlgebra.contractRight_mul_algebraMap variable (Q) @[simp]
Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
167
172
theorem contractLeft_ι (x : M) : d⌋ι Q x = algebraMap R _ (d x) := by
-- Porting note: Lean cannot figure out anymore the third argument refine (foldr'_ι _ _ ?_ _ _).trans <| by simp_rw [contractLeftAux_apply_apply, mul_zero, sub_zero, Algebra.algebraMap_eq_smul_one] exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx
1,915
import Mathlib.LinearAlgebra.CliffordAlgebra.Contraction variable {R M : Type*} variable [CommRing R] [AddCommGroup M] [Module R M] {Q : QuadraticForm R M} namespace CliffordAlgebra variable (Q) def invertibleιOfInvertible (m : M) [Invertible (Q m)] : Invertible (ι Q m) where invOf := ι Q (⅟ (Q m) • m) invOf_mul_self := by rw [map_smul, smul_mul_assoc, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] mul_invOf_self := by rw [map_smul, mul_smul_comm, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] #align clifford_algebra.invertible_ι_of_invertible CliffordAlgebra.invertibleιOfInvertible
Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean
31
34
theorem invOf_ι (m : M) [Invertible (Q m)] [Invertible (ι Q m)] : ⅟ (ι Q m) = ι Q (⅟ (Q m) • m) := by
letI := invertibleιOfInvertible Q m convert (rfl : ⅟ (ι Q m) = _)
1,916
import Mathlib.LinearAlgebra.CliffordAlgebra.Contraction variable {R M : Type*} variable [CommRing R] [AddCommGroup M] [Module R M] {Q : QuadraticForm R M} namespace CliffordAlgebra variable (Q) def invertibleιOfInvertible (m : M) [Invertible (Q m)] : Invertible (ι Q m) where invOf := ι Q (⅟ (Q m) • m) invOf_mul_self := by rw [map_smul, smul_mul_assoc, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] mul_invOf_self := by rw [map_smul, mul_smul_comm, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] #align clifford_algebra.invertible_ι_of_invertible CliffordAlgebra.invertibleιOfInvertible theorem invOf_ι (m : M) [Invertible (Q m)] [Invertible (ι Q m)] : ⅟ (ι Q m) = ι Q (⅟ (Q m) • m) := by letI := invertibleιOfInvertible Q m convert (rfl : ⅟ (ι Q m) = _) #align clifford_algebra.inv_of_ι CliffordAlgebra.invOf_ι
Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean
37
40
theorem isUnit_ι_of_isUnit {m : M} (h : IsUnit (Q m)) : IsUnit (ι Q m) := by
cases h.nonempty_invertible letI := invertibleιOfInvertible Q m exact isUnit_of_invertible (ι Q m)
1,916
import Mathlib.LinearAlgebra.CliffordAlgebra.Contraction variable {R M : Type*} variable [CommRing R] [AddCommGroup M] [Module R M] {Q : QuadraticForm R M} namespace CliffordAlgebra variable (Q) def invertibleιOfInvertible (m : M) [Invertible (Q m)] : Invertible (ι Q m) where invOf := ι Q (⅟ (Q m) • m) invOf_mul_self := by rw [map_smul, smul_mul_assoc, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] mul_invOf_self := by rw [map_smul, mul_smul_comm, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] #align clifford_algebra.invertible_ι_of_invertible CliffordAlgebra.invertibleιOfInvertible theorem invOf_ι (m : M) [Invertible (Q m)] [Invertible (ι Q m)] : ⅟ (ι Q m) = ι Q (⅟ (Q m) • m) := by letI := invertibleιOfInvertible Q m convert (rfl : ⅟ (ι Q m) = _) #align clifford_algebra.inv_of_ι CliffordAlgebra.invOf_ι theorem isUnit_ι_of_isUnit {m : M} (h : IsUnit (Q m)) : IsUnit (ι Q m) := by cases h.nonempty_invertible letI := invertibleιOfInvertible Q m exact isUnit_of_invertible (ι Q m) #align clifford_algebra.is_unit_ι_of_is_unit CliffordAlgebra.isUnit_ι_of_isUnit
Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean
44
47
theorem ι_mul_ι_mul_invOf_ι (a b : M) [Invertible (ι Q a)] [Invertible (Q a)] : ι Q a * ι Q b * ⅟ (ι Q a) = ι Q ((⅟ (Q a) * QuadraticForm.polar Q a b) • a - b) := by
rw [invOf_ι, map_smul, mul_smul_comm, ι_mul_ι_mul_ι, ← map_smul, smul_sub, smul_smul, smul_smul, invOf_mul_self, one_smul]
1,916
import Mathlib.LinearAlgebra.CliffordAlgebra.Contraction variable {R M : Type*} variable [CommRing R] [AddCommGroup M] [Module R M] {Q : QuadraticForm R M} namespace CliffordAlgebra variable (Q) def invertibleιOfInvertible (m : M) [Invertible (Q m)] : Invertible (ι Q m) where invOf := ι Q (⅟ (Q m) • m) invOf_mul_self := by rw [map_smul, smul_mul_assoc, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] mul_invOf_self := by rw [map_smul, mul_smul_comm, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one] #align clifford_algebra.invertible_ι_of_invertible CliffordAlgebra.invertibleιOfInvertible theorem invOf_ι (m : M) [Invertible (Q m)] [Invertible (ι Q m)] : ⅟ (ι Q m) = ι Q (⅟ (Q m) • m) := by letI := invertibleιOfInvertible Q m convert (rfl : ⅟ (ι Q m) = _) #align clifford_algebra.inv_of_ι CliffordAlgebra.invOf_ι theorem isUnit_ι_of_isUnit {m : M} (h : IsUnit (Q m)) : IsUnit (ι Q m) := by cases h.nonempty_invertible letI := invertibleιOfInvertible Q m exact isUnit_of_invertible (ι Q m) #align clifford_algebra.is_unit_ι_of_is_unit CliffordAlgebra.isUnit_ι_of_isUnit theorem ι_mul_ι_mul_invOf_ι (a b : M) [Invertible (ι Q a)] [Invertible (Q a)] : ι Q a * ι Q b * ⅟ (ι Q a) = ι Q ((⅟ (Q a) * QuadraticForm.polar Q a b) • a - b) := by rw [invOf_ι, map_smul, mul_smul_comm, ι_mul_ι_mul_ι, ← map_smul, smul_sub, smul_smul, smul_smul, invOf_mul_self, one_smul] #align clifford_algebra.ι_mul_ι_mul_inv_of_ι CliffordAlgebra.ι_mul_ι_mul_invOf_ι
Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean
51
54
theorem invOf_ι_mul_ι_mul_ι (a b : M) [Invertible (ι Q a)] [Invertible (Q a)] : ⅟ (ι Q a) * ι Q b * ι Q a = ι Q ((⅟ (Q a) * QuadraticForm.polar Q a b) • a - b) := by
rw [invOf_ι, map_smul, smul_mul_assoc, smul_mul_assoc, ι_mul_ι_mul_ι, ← map_smul, smul_sub, smul_smul, smul_smul, invOf_mul_self, one_smul]
1,916