Context
stringlengths
57
85k
file_name
stringlengths
21
79
start
int64
14
2.42k
end
int64
18
2.43k
theorem
stringlengths
25
2.71k
proof
stringlengths
5
10.6k
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 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 #align padic_int.zmod_congr_of_sub_mem_span_aux PadicInt.zmod_congr_of_sub_mem_span_aux
Mathlib/NumberTheory/Padics/RingHoms.lean
153
156
theorem zmod_congr_of_sub_mem_span (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
simpa using zmod_congr_of_sub_mem_span_aux n x a b ha hb
import Batteries.Data.UnionFind.Basic namespace Batteries.UnionFind @[simp] theorem arr_empty : empty.arr = #[] := rfl @[simp] theorem parent_empty : empty.parent a = a := rfl @[simp] theorem rank_empty : empty.rank a = 0 := rfl @[simp] theorem rootD_empty : empty.rootD a = a := rfl @[simp] theorem arr_push {m : UnionFind} : m.push.arr = m.arr.push ⟨m.arr.size, 0⟩ := rfl @[simp] theorem parentD_push {arr : Array UFNode} : parentD (arr.push ⟨arr.size, 0⟩) a = parentD arr a := by simp [parentD]; split <;> split <;> try simp [Array.get_push, *] · next h1 h2 => simp [Nat.lt_succ] at h1 h2 exact Nat.le_antisymm h2 h1 · next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2) @[simp] theorem parent_push {m : UnionFind} : m.push.parent a = m.parent a := by simp [parent] @[simp] theorem rankD_push {arr : Array UFNode} : rankD (arr.push ⟨arr.size, 0⟩) a = rankD arr a := by simp [rankD]; split <;> split <;> try simp [Array.get_push, *] next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2) @[simp] theorem rank_push {m : UnionFind} : m.push.rank a = m.rank a := by simp [rank] @[simp] theorem rankMax_push {m : UnionFind} : m.push.rankMax = m.rankMax := by simp [rankMax] @[simp] theorem root_push {self : UnionFind} : self.push.rootD x = self.rootD x := rootD_ext fun _ => parent_push @[simp] theorem arr_link : (link self x y yroot).arr = linkAux self.arr x y := rfl
.lake/packages/batteries/Batteries/Data/UnionFind/Lemmas.lean
41
51
theorem parentD_linkAux {self} {x y : Fin self.size} : parentD (linkAux self x y) i = if x.1 = y then parentD self i else if (self.get y).rank < (self.get x).rank then if y = i then x else parentD self i else if x = i then y else parentD self i := by
dsimp only [linkAux]; split <;> [rfl; split] <;> [rw [parentD_set]; split] <;> rw [parentD_set] split <;> [(subst i; rwa [if_neg, parentD_eq]); rw [parentD_set]]
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec" open Real noncomputable section namespace Real -- Porting note: can't derive `NormedAddCommGroup, Inhabited` def Angle : Type := AddCircle (2 * π) #align real.angle Real.Angle namespace Angle -- Porting note (#10754): added due to missing instances due to no deriving instance : NormedAddCommGroup Angle := inferInstanceAs (NormedAddCommGroup (AddCircle (2 * π))) -- Porting note (#10754): added due to missing instances due to no deriving instance : Inhabited Angle := inferInstanceAs (Inhabited (AddCircle (2 * π))) -- Porting note (#10754): added due to missing instances due to no deriving -- also, without this, a plain `QuotientAddGroup.mk` -- causes coerced terms to be of type `ℝ ⧸ AddSubgroup.zmultiples (2 * π)` @[coe] protected def coe (r : ℝ) : Angle := QuotientAddGroup.mk r instance : Coe ℝ Angle := ⟨Angle.coe⟩ instance : CircularOrder Real.Angle := QuotientAddGroup.circularOrder (hp' := ⟨by norm_num [pi_pos]⟩) @[continuity] theorem continuous_coe : Continuous ((↑) : ℝ → Angle) := continuous_quotient_mk' #align real.angle.continuous_coe Real.Angle.continuous_coe def coeHom : ℝ →+ Angle := QuotientAddGroup.mk' _ #align real.angle.coe_hom Real.Angle.coeHom @[simp] theorem coe_coeHom : (coeHom : ℝ → Angle) = ((↑) : ℝ → Angle) := rfl #align real.angle.coe_coe_hom Real.Angle.coe_coeHom @[elab_as_elim] protected theorem induction_on {p : Angle → Prop} (θ : Angle) (h : ∀ x : ℝ, p x) : p θ := Quotient.inductionOn' θ h #align real.angle.induction_on Real.Angle.induction_on @[simp] theorem coe_zero : ↑(0 : ℝ) = (0 : Angle) := rfl #align real.angle.coe_zero Real.Angle.coe_zero @[simp] theorem coe_add (x y : ℝ) : ↑(x + y : ℝ) = (↑x + ↑y : Angle) := rfl #align real.angle.coe_add Real.Angle.coe_add @[simp] theorem coe_neg (x : ℝ) : ↑(-x : ℝ) = -(↑x : Angle) := rfl #align real.angle.coe_neg Real.Angle.coe_neg @[simp] theorem coe_sub (x y : ℝ) : ↑(x - y : ℝ) = (↑x - ↑y : Angle) := rfl #align real.angle.coe_sub Real.Angle.coe_sub theorem coe_nsmul (n : ℕ) (x : ℝ) : ↑(n • x : ℝ) = n • (↑x : Angle) := rfl #align real.angle.coe_nsmul Real.Angle.coe_nsmul theorem coe_zsmul (z : ℤ) (x : ℝ) : ↑(z • x : ℝ) = z • (↑x : Angle) := rfl #align real.angle.coe_zsmul Real.Angle.coe_zsmul @[simp, norm_cast] theorem natCast_mul_eq_nsmul (x : ℝ) (n : ℕ) : ↑((n : ℝ) * x) = n • (↑x : Angle) := by simpa only [nsmul_eq_mul] using coeHom.map_nsmul x n #align real.angle.coe_nat_mul_eq_nsmul Real.Angle.natCast_mul_eq_nsmul @[simp, norm_cast] theorem intCast_mul_eq_zsmul (x : ℝ) (n : ℤ) : ↑((n : ℝ) * x : ℝ) = n • (↑x : Angle) := by simpa only [zsmul_eq_mul] using coeHom.map_zsmul x n #align real.angle.coe_int_mul_eq_zsmul Real.Angle.intCast_mul_eq_zsmul @[deprecated (since := "2024-05-25")] alias coe_nat_mul_eq_nsmul := natCast_mul_eq_nsmul @[deprecated (since := "2024-05-25")] alias coe_int_mul_eq_zsmul := intCast_mul_eq_zsmul theorem angle_eq_iff_two_pi_dvd_sub {ψ θ : ℝ} : (θ : Angle) = ψ ↔ ∃ k : ℤ, θ - ψ = 2 * π * k := by simp only [QuotientAddGroup.eq, AddSubgroup.zmultiples_eq_closure, AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm] -- Porting note: added `rw`, `simp [Angle.coe, QuotientAddGroup.eq]` doesn't fire otherwise rw [Angle.coe, Angle.coe, QuotientAddGroup.eq] simp only [AddSubgroup.zmultiples_eq_closure, AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm] #align real.angle.angle_eq_iff_two_pi_dvd_sub Real.Angle.angle_eq_iff_two_pi_dvd_sub @[simp] theorem coe_two_pi : ↑(2 * π : ℝ) = (0 : Angle) := angle_eq_iff_two_pi_dvd_sub.2 ⟨1, by rw [sub_zero, Int.cast_one, mul_one]⟩ #align real.angle.coe_two_pi Real.Angle.coe_two_pi @[simp] theorem neg_coe_pi : -(π : Angle) = π := by rw [← coe_neg, angle_eq_iff_two_pi_dvd_sub] use -1 simp [two_mul, sub_eq_add_neg] #align real.angle.neg_coe_pi Real.Angle.neg_coe_pi @[simp] theorem two_nsmul_coe_div_two (θ : ℝ) : (2 : ℕ) • (↑(θ / 2) : Angle) = θ := by rw [← coe_nsmul, two_nsmul, add_halves] #align real.angle.two_nsmul_coe_div_two Real.Angle.two_nsmul_coe_div_two @[simp] theorem two_zsmul_coe_div_two (θ : ℝ) : (2 : ℤ) • (↑(θ / 2) : Angle) = θ := by rw [← coe_zsmul, two_zsmul, add_halves] #align real.angle.two_zsmul_coe_div_two Real.Angle.two_zsmul_coe_div_two -- Porting note (#10618): @[simp] can prove it theorem two_nsmul_neg_pi_div_two : (2 : ℕ) • (↑(-π / 2) : Angle) = π := by rw [two_nsmul_coe_div_two, coe_neg, neg_coe_pi] #align real.angle.two_nsmul_neg_pi_div_two Real.Angle.two_nsmul_neg_pi_div_two -- Porting note (#10618): @[simp] can prove it theorem two_zsmul_neg_pi_div_two : (2 : ℤ) • (↑(-π / 2) : Angle) = π := by rw [two_zsmul, ← two_nsmul, two_nsmul_neg_pi_div_two] #align real.angle.two_zsmul_neg_pi_div_two Real.Angle.two_zsmul_neg_pi_div_two theorem sub_coe_pi_eq_add_coe_pi (θ : Angle) : θ - π = θ + π := by rw [sub_eq_add_neg, neg_coe_pi] #align real.angle.sub_coe_pi_eq_add_coe_pi Real.Angle.sub_coe_pi_eq_add_coe_pi @[simp] theorem two_nsmul_coe_pi : (2 : ℕ) • (π : Angle) = 0 := by simp [← natCast_mul_eq_nsmul] #align real.angle.two_nsmul_coe_pi Real.Angle.two_nsmul_coe_pi @[simp] theorem two_zsmul_coe_pi : (2 : ℤ) • (π : Angle) = 0 := by simp [← intCast_mul_eq_zsmul] #align real.angle.two_zsmul_coe_pi Real.Angle.two_zsmul_coe_pi @[simp] theorem coe_pi_add_coe_pi : (π : Real.Angle) + π = 0 := by rw [← two_nsmul, two_nsmul_coe_pi] #align real.angle.coe_pi_add_coe_pi Real.Angle.coe_pi_add_coe_pi theorem zsmul_eq_iff {ψ θ : Angle} {z : ℤ} (hz : z ≠ 0) : z • ψ = z • θ ↔ ∃ k : Fin z.natAbs, ψ = θ + (k : ℕ) • (2 * π / z : ℝ) := QuotientAddGroup.zmultiples_zsmul_eq_zsmul_iff hz #align real.angle.zsmul_eq_iff Real.Angle.zsmul_eq_iff theorem nsmul_eq_iff {ψ θ : Angle} {n : ℕ} (hz : n ≠ 0) : n • ψ = n • θ ↔ ∃ k : Fin n, ψ = θ + (k : ℕ) • (2 * π / n : ℝ) := QuotientAddGroup.zmultiples_nsmul_eq_nsmul_iff hz #align real.angle.nsmul_eq_iff Real.Angle.nsmul_eq_iff theorem two_zsmul_eq_iff {ψ θ : Angle} : (2 : ℤ) • ψ = (2 : ℤ) • θ ↔ ψ = θ ∨ ψ = θ + ↑π := by -- Porting note: no `Int.natAbs_bit0` anymore have : Int.natAbs 2 = 2 := rfl rw [zsmul_eq_iff two_ne_zero, this, Fin.exists_fin_two, Fin.val_zero, Fin.val_one, zero_smul, add_zero, one_smul, Int.cast_two, mul_div_cancel_left₀ (_ : ℝ) two_ne_zero] #align real.angle.two_zsmul_eq_iff Real.Angle.two_zsmul_eq_iff theorem two_nsmul_eq_iff {ψ θ : Angle} : (2 : ℕ) • ψ = (2 : ℕ) • θ ↔ ψ = θ ∨ ψ = θ + ↑π := by simp_rw [← natCast_zsmul, Nat.cast_ofNat, two_zsmul_eq_iff] #align real.angle.two_nsmul_eq_iff Real.Angle.two_nsmul_eq_iff theorem two_nsmul_eq_zero_iff {θ : Angle} : (2 : ℕ) • θ = 0 ↔ θ = 0 ∨ θ = π := by convert two_nsmul_eq_iff <;> simp #align real.angle.two_nsmul_eq_zero_iff Real.Angle.two_nsmul_eq_zero_iff theorem two_nsmul_ne_zero_iff {θ : Angle} : (2 : ℕ) • θ ≠ 0 ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← two_nsmul_eq_zero_iff] #align real.angle.two_nsmul_ne_zero_iff Real.Angle.two_nsmul_ne_zero_iff theorem two_zsmul_eq_zero_iff {θ : Angle} : (2 : ℤ) • θ = 0 ↔ θ = 0 ∨ θ = π := by simp_rw [two_zsmul, ← two_nsmul, two_nsmul_eq_zero_iff] #align real.angle.two_zsmul_eq_zero_iff Real.Angle.two_zsmul_eq_zero_iff theorem two_zsmul_ne_zero_iff {θ : Angle} : (2 : ℤ) • θ ≠ 0 ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← two_zsmul_eq_zero_iff] #align real.angle.two_zsmul_ne_zero_iff Real.Angle.two_zsmul_ne_zero_iff theorem eq_neg_self_iff {θ : Angle} : θ = -θ ↔ θ = 0 ∨ θ = π := by rw [← add_eq_zero_iff_eq_neg, ← two_nsmul, two_nsmul_eq_zero_iff] #align real.angle.eq_neg_self_iff Real.Angle.eq_neg_self_iff theorem ne_neg_self_iff {θ : Angle} : θ ≠ -θ ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← eq_neg_self_iff.not] #align real.angle.ne_neg_self_iff Real.Angle.ne_neg_self_iff theorem neg_eq_self_iff {θ : Angle} : -θ = θ ↔ θ = 0 ∨ θ = π := by rw [eq_comm, eq_neg_self_iff] #align real.angle.neg_eq_self_iff Real.Angle.neg_eq_self_iff theorem neg_ne_self_iff {θ : Angle} : -θ ≠ θ ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← neg_eq_self_iff.not] #align real.angle.neg_ne_self_iff Real.Angle.neg_ne_self_iff theorem two_nsmul_eq_pi_iff {θ : Angle} : (2 : ℕ) • θ = π ↔ θ = (π / 2 : ℝ) ∨ θ = (-π / 2 : ℝ) := by have h : (π : Angle) = ((2 : ℕ) • (π / 2 : ℝ) :) := by rw [two_nsmul, add_halves] nth_rw 1 [h] rw [coe_nsmul, two_nsmul_eq_iff] -- Porting note: `congr` didn't simplify the goal of iff of `Or`s convert Iff.rfl rw [add_comm, ← coe_add, ← sub_eq_zero, ← coe_sub, neg_div, ← neg_sub, sub_neg_eq_add, add_assoc, add_halves, ← two_mul, coe_neg, coe_two_pi, neg_zero] #align real.angle.two_nsmul_eq_pi_iff Real.Angle.two_nsmul_eq_pi_iff theorem two_zsmul_eq_pi_iff {θ : Angle} : (2 : ℤ) • θ = π ↔ θ = (π / 2 : ℝ) ∨ θ = (-π / 2 : ℝ) := by rw [two_zsmul, ← two_nsmul, two_nsmul_eq_pi_iff] #align real.angle.two_zsmul_eq_pi_iff Real.Angle.two_zsmul_eq_pi_iff theorem cos_eq_iff_coe_eq_or_eq_neg {θ ψ : ℝ} : cos θ = cos ψ ↔ (θ : Angle) = ψ ∨ (θ : Angle) = -ψ := by constructor · intro Hcos rw [← sub_eq_zero, cos_sub_cos, mul_eq_zero, mul_eq_zero, neg_eq_zero, eq_false (two_ne_zero' ℝ), false_or_iff, sin_eq_zero_iff, sin_eq_zero_iff] at Hcos rcases Hcos with (⟨n, hn⟩ | ⟨n, hn⟩) · right rw [eq_div_iff_mul_eq (two_ne_zero' ℝ), ← sub_eq_iff_eq_add] at hn rw [← hn, coe_sub, eq_neg_iff_add_eq_zero, sub_add_cancel, mul_assoc, intCast_mul_eq_zsmul, mul_comm, coe_two_pi, zsmul_zero] · left rw [eq_div_iff_mul_eq (two_ne_zero' ℝ), eq_sub_iff_add_eq] at hn rw [← hn, coe_add, mul_assoc, intCast_mul_eq_zsmul, mul_comm, coe_two_pi, zsmul_zero, zero_add] · rw [angle_eq_iff_two_pi_dvd_sub, ← coe_neg, angle_eq_iff_two_pi_dvd_sub] rintro (⟨k, H⟩ | ⟨k, H⟩) · rw [← sub_eq_zero, cos_sub_cos, H, mul_assoc 2 π k, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), mul_comm π _, sin_int_mul_pi, mul_zero] rw [← sub_eq_zero, cos_sub_cos, ← sub_neg_eq_add, H, mul_assoc 2 π k, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), mul_comm π _, sin_int_mul_pi, mul_zero, zero_mul] #align real.angle.cos_eq_iff_coe_eq_or_eq_neg Real.Angle.cos_eq_iff_coe_eq_or_eq_neg theorem sin_eq_iff_coe_eq_or_add_eq_pi {θ ψ : ℝ} : sin θ = sin ψ ↔ (θ : Angle) = ψ ∨ (θ : Angle) + ψ = π := by constructor · intro Hsin rw [← cos_pi_div_two_sub, ← cos_pi_div_two_sub] at Hsin cases' cos_eq_iff_coe_eq_or_eq_neg.mp Hsin with h h · left rw [coe_sub, coe_sub] at h exact sub_right_inj.1 h right rw [coe_sub, coe_sub, eq_neg_iff_add_eq_zero, add_sub, sub_add_eq_add_sub, ← coe_add, add_halves, sub_sub, sub_eq_zero] at h exact h.symm · rw [angle_eq_iff_two_pi_dvd_sub, ← eq_sub_iff_add_eq, ← coe_sub, angle_eq_iff_two_pi_dvd_sub] rintro (⟨k, H⟩ | ⟨k, H⟩) · rw [← sub_eq_zero, sin_sub_sin, H, mul_assoc 2 π k, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), mul_comm π _, sin_int_mul_pi, mul_zero, zero_mul] have H' : θ + ψ = 2 * k * π + π := by rwa [← sub_add, sub_add_eq_add_sub, sub_eq_iff_eq_add, mul_assoc, mul_comm π _, ← mul_assoc] at H rw [← sub_eq_zero, sin_sub_sin, H', add_div, mul_assoc 2 _ π, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), cos_add_pi_div_two, sin_int_mul_pi, neg_zero, mul_zero] #align real.angle.sin_eq_iff_coe_eq_or_add_eq_pi Real.Angle.sin_eq_iff_coe_eq_or_add_eq_pi theorem cos_sin_inj {θ ψ : ℝ} (Hcos : cos θ = cos ψ) (Hsin : sin θ = sin ψ) : (θ : Angle) = ψ := by cases' cos_eq_iff_coe_eq_or_eq_neg.mp Hcos with hc hc; · exact hc cases' sin_eq_iff_coe_eq_or_add_eq_pi.mp Hsin with hs hs; · exact hs rw [eq_neg_iff_add_eq_zero, hs] at hc obtain ⟨n, hn⟩ : ∃ n, n • _ = _ := QuotientAddGroup.leftRel_apply.mp (Quotient.exact' hc) rw [← neg_one_mul, add_zero, ← sub_eq_zero, zsmul_eq_mul, ← mul_assoc, ← sub_mul, mul_eq_zero, eq_false (ne_of_gt pi_pos), or_false_iff, sub_neg_eq_add, ← Int.cast_zero, ← Int.cast_one, ← Int.cast_ofNat, ← Int.cast_mul, ← Int.cast_add, Int.cast_inj] at hn have : (n * 2 + 1) % (2 : ℤ) = 0 % (2 : ℤ) := congr_arg (· % (2 : ℤ)) hn rw [add_comm, Int.add_mul_emod_self] at this exact absurd this one_ne_zero #align real.angle.cos_sin_inj Real.Angle.cos_sin_inj def sin (θ : Angle) : ℝ := sin_periodic.lift θ #align real.angle.sin Real.Angle.sin @[simp] theorem sin_coe (x : ℝ) : sin (x : Angle) = Real.sin x := rfl #align real.angle.sin_coe Real.Angle.sin_coe @[continuity] theorem continuous_sin : Continuous sin := Real.continuous_sin.quotient_liftOn' _ #align real.angle.continuous_sin Real.Angle.continuous_sin def cos (θ : Angle) : ℝ := cos_periodic.lift θ #align real.angle.cos Real.Angle.cos @[simp] theorem cos_coe (x : ℝ) : cos (x : Angle) = Real.cos x := rfl #align real.angle.cos_coe Real.Angle.cos_coe @[continuity] theorem continuous_cos : Continuous cos := Real.continuous_cos.quotient_liftOn' _ #align real.angle.continuous_cos Real.Angle.continuous_cos theorem cos_eq_real_cos_iff_eq_or_eq_neg {θ : Angle} {ψ : ℝ} : cos θ = Real.cos ψ ↔ θ = ψ ∨ θ = -ψ := by induction θ using Real.Angle.induction_on exact cos_eq_iff_coe_eq_or_eq_neg #align real.angle.cos_eq_real_cos_iff_eq_or_eq_neg Real.Angle.cos_eq_real_cos_iff_eq_or_eq_neg theorem cos_eq_iff_eq_or_eq_neg {θ ψ : Angle} : cos θ = cos ψ ↔ θ = ψ ∨ θ = -ψ := by induction ψ using Real.Angle.induction_on exact cos_eq_real_cos_iff_eq_or_eq_neg #align real.angle.cos_eq_iff_eq_or_eq_neg Real.Angle.cos_eq_iff_eq_or_eq_neg theorem sin_eq_real_sin_iff_eq_or_add_eq_pi {θ : Angle} {ψ : ℝ} : sin θ = Real.sin ψ ↔ θ = ψ ∨ θ + ψ = π := by induction θ using Real.Angle.induction_on exact sin_eq_iff_coe_eq_or_add_eq_pi #align real.angle.sin_eq_real_sin_iff_eq_or_add_eq_pi Real.Angle.sin_eq_real_sin_iff_eq_or_add_eq_pi theorem sin_eq_iff_eq_or_add_eq_pi {θ ψ : Angle} : sin θ = sin ψ ↔ θ = ψ ∨ θ + ψ = π := by induction ψ using Real.Angle.induction_on exact sin_eq_real_sin_iff_eq_or_add_eq_pi #align real.angle.sin_eq_iff_eq_or_add_eq_pi Real.Angle.sin_eq_iff_eq_or_add_eq_pi @[simp] theorem sin_zero : sin (0 : Angle) = 0 := by rw [← coe_zero, sin_coe, Real.sin_zero] #align real.angle.sin_zero Real.Angle.sin_zero -- Porting note (#10618): @[simp] can prove it theorem sin_coe_pi : sin (π : Angle) = 0 := by rw [sin_coe, Real.sin_pi] #align real.angle.sin_coe_pi Real.Angle.sin_coe_pi theorem sin_eq_zero_iff {θ : Angle} : sin θ = 0 ↔ θ = 0 ∨ θ = π := by nth_rw 1 [← sin_zero] rw [sin_eq_iff_eq_or_add_eq_pi] simp #align real.angle.sin_eq_zero_iff Real.Angle.sin_eq_zero_iff theorem sin_ne_zero_iff {θ : Angle} : sin θ ≠ 0 ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← sin_eq_zero_iff] #align real.angle.sin_ne_zero_iff Real.Angle.sin_ne_zero_iff @[simp] theorem sin_neg (θ : Angle) : sin (-θ) = -sin θ := by induction θ using Real.Angle.induction_on exact Real.sin_neg _ #align real.angle.sin_neg Real.Angle.sin_neg theorem sin_antiperiodic : Function.Antiperiodic sin (π : Angle) := by intro θ induction θ using Real.Angle.induction_on exact Real.sin_antiperiodic _ #align real.angle.sin_antiperiodic Real.Angle.sin_antiperiodic @[simp] theorem sin_add_pi (θ : Angle) : sin (θ + π) = -sin θ := sin_antiperiodic θ #align real.angle.sin_add_pi Real.Angle.sin_add_pi @[simp] theorem sin_sub_pi (θ : Angle) : sin (θ - π) = -sin θ := sin_antiperiodic.sub_eq θ #align real.angle.sin_sub_pi Real.Angle.sin_sub_pi @[simp] theorem cos_zero : cos (0 : Angle) = 1 := by rw [← coe_zero, cos_coe, Real.cos_zero] #align real.angle.cos_zero Real.Angle.cos_zero -- Porting note (#10618): @[simp] can prove it theorem cos_coe_pi : cos (π : Angle) = -1 := by rw [cos_coe, Real.cos_pi] #align real.angle.cos_coe_pi Real.Angle.cos_coe_pi @[simp] theorem cos_neg (θ : Angle) : cos (-θ) = cos θ := by induction θ using Real.Angle.induction_on exact Real.cos_neg _ #align real.angle.cos_neg Real.Angle.cos_neg theorem cos_antiperiodic : Function.Antiperiodic cos (π : Angle) := by intro θ induction θ using Real.Angle.induction_on exact Real.cos_antiperiodic _ #align real.angle.cos_antiperiodic Real.Angle.cos_antiperiodic @[simp] theorem cos_add_pi (θ : Angle) : cos (θ + π) = -cos θ := cos_antiperiodic θ #align real.angle.cos_add_pi Real.Angle.cos_add_pi @[simp] theorem cos_sub_pi (θ : Angle) : cos (θ - π) = -cos θ := cos_antiperiodic.sub_eq θ #align real.angle.cos_sub_pi Real.Angle.cos_sub_pi theorem cos_eq_zero_iff {θ : Angle} : cos θ = 0 ↔ θ = (π / 2 : ℝ) ∨ θ = (-π / 2 : ℝ) := by rw [← cos_pi_div_two, ← cos_coe, cos_eq_iff_eq_or_eq_neg, ← coe_neg, ← neg_div] #align real.angle.cos_eq_zero_iff Real.Angle.cos_eq_zero_iff theorem sin_add (θ₁ θ₂ : Real.Angle) : sin (θ₁ + θ₂) = sin θ₁ * cos θ₂ + cos θ₁ * sin θ₂ := by induction θ₁ using Real.Angle.induction_on induction θ₂ using Real.Angle.induction_on exact Real.sin_add _ _ #align real.angle.sin_add Real.Angle.sin_add theorem cos_add (θ₁ θ₂ : Real.Angle) : cos (θ₁ + θ₂) = cos θ₁ * cos θ₂ - sin θ₁ * sin θ₂ := by induction θ₂ using Real.Angle.induction_on induction θ₁ using Real.Angle.induction_on exact Real.cos_add _ _ #align real.angle.cos_add Real.Angle.cos_add @[simp] theorem cos_sq_add_sin_sq (θ : Real.Angle) : cos θ ^ 2 + sin θ ^ 2 = 1 := by induction θ using Real.Angle.induction_on exact Real.cos_sq_add_sin_sq _ #align real.angle.cos_sq_add_sin_sq Real.Angle.cos_sq_add_sin_sq theorem sin_add_pi_div_two (θ : Angle) : sin (θ + ↑(π / 2)) = cos θ := by induction θ using Real.Angle.induction_on exact Real.sin_add_pi_div_two _ #align real.angle.sin_add_pi_div_two Real.Angle.sin_add_pi_div_two theorem sin_sub_pi_div_two (θ : Angle) : sin (θ - ↑(π / 2)) = -cos θ := by induction θ using Real.Angle.induction_on exact Real.sin_sub_pi_div_two _ #align real.angle.sin_sub_pi_div_two Real.Angle.sin_sub_pi_div_two theorem sin_pi_div_two_sub (θ : Angle) : sin (↑(π / 2) - θ) = cos θ := by induction θ using Real.Angle.induction_on exact Real.sin_pi_div_two_sub _ #align real.angle.sin_pi_div_two_sub Real.Angle.sin_pi_div_two_sub theorem cos_add_pi_div_two (θ : Angle) : cos (θ + ↑(π / 2)) = -sin θ := by induction θ using Real.Angle.induction_on exact Real.cos_add_pi_div_two _ #align real.angle.cos_add_pi_div_two Real.Angle.cos_add_pi_div_two theorem cos_sub_pi_div_two (θ : Angle) : cos (θ - ↑(π / 2)) = sin θ := by induction θ using Real.Angle.induction_on exact Real.cos_sub_pi_div_two _ #align real.angle.cos_sub_pi_div_two Real.Angle.cos_sub_pi_div_two theorem cos_pi_div_two_sub (θ : Angle) : cos (↑(π / 2) - θ) = sin θ := by induction θ using Real.Angle.induction_on exact Real.cos_pi_div_two_sub _ #align real.angle.cos_pi_div_two_sub Real.Angle.cos_pi_div_two_sub theorem abs_sin_eq_of_two_nsmul_eq {θ ψ : Angle} (h : (2 : ℕ) • θ = (2 : ℕ) • ψ) : |sin θ| = |sin ψ| := by rw [two_nsmul_eq_iff] at h rcases h with (rfl | rfl) · rfl · rw [sin_add_pi, abs_neg] #align real.angle.abs_sin_eq_of_two_nsmul_eq Real.Angle.abs_sin_eq_of_two_nsmul_eq theorem abs_sin_eq_of_two_zsmul_eq {θ ψ : Angle} (h : (2 : ℤ) • θ = (2 : ℤ) • ψ) : |sin θ| = |sin ψ| := by simp_rw [two_zsmul, ← two_nsmul] at h exact abs_sin_eq_of_two_nsmul_eq h #align real.angle.abs_sin_eq_of_two_zsmul_eq Real.Angle.abs_sin_eq_of_two_zsmul_eq theorem abs_cos_eq_of_two_nsmul_eq {θ ψ : Angle} (h : (2 : ℕ) • θ = (2 : ℕ) • ψ) : |cos θ| = |cos ψ| := by rw [two_nsmul_eq_iff] at h rcases h with (rfl | rfl) · rfl · rw [cos_add_pi, abs_neg] #align real.angle.abs_cos_eq_of_two_nsmul_eq Real.Angle.abs_cos_eq_of_two_nsmul_eq theorem abs_cos_eq_of_two_zsmul_eq {θ ψ : Angle} (h : (2 : ℤ) • θ = (2 : ℤ) • ψ) : |cos θ| = |cos ψ| := by simp_rw [two_zsmul, ← two_nsmul] at h exact abs_cos_eq_of_two_nsmul_eq h #align real.angle.abs_cos_eq_of_two_zsmul_eq Real.Angle.abs_cos_eq_of_two_zsmul_eq @[simp] theorem coe_toIcoMod (θ ψ : ℝ) : ↑(toIcoMod two_pi_pos ψ θ) = (θ : Angle) := by rw [angle_eq_iff_two_pi_dvd_sub] refine ⟨-toIcoDiv two_pi_pos ψ θ, ?_⟩ rw [toIcoMod_sub_self, zsmul_eq_mul, mul_comm] #align real.angle.coe_to_Ico_mod Real.Angle.coe_toIcoMod @[simp] theorem coe_toIocMod (θ ψ : ℝ) : ↑(toIocMod two_pi_pos ψ θ) = (θ : Angle) := by rw [angle_eq_iff_two_pi_dvd_sub] refine ⟨-toIocDiv two_pi_pos ψ θ, ?_⟩ rw [toIocMod_sub_self, zsmul_eq_mul, mul_comm] #align real.angle.coe_to_Ioc_mod Real.Angle.coe_toIocMod def toReal (θ : Angle) : ℝ := (toIocMod_periodic two_pi_pos (-π)).lift θ #align real.angle.to_real Real.Angle.toReal theorem toReal_coe (θ : ℝ) : (θ : Angle).toReal = toIocMod two_pi_pos (-π) θ := rfl #align real.angle.to_real_coe Real.Angle.toReal_coe theorem toReal_coe_eq_self_iff {θ : ℝ} : (θ : Angle).toReal = θ ↔ -π < θ ∧ θ ≤ π := by rw [toReal_coe, toIocMod_eq_self two_pi_pos] ring_nf rfl #align real.angle.to_real_coe_eq_self_iff Real.Angle.toReal_coe_eq_self_iff theorem toReal_coe_eq_self_iff_mem_Ioc {θ : ℝ} : (θ : Angle).toReal = θ ↔ θ ∈ Set.Ioc (-π) π := by rw [toReal_coe_eq_self_iff, ← Set.mem_Ioc] #align real.angle.to_real_coe_eq_self_iff_mem_Ioc Real.Angle.toReal_coe_eq_self_iff_mem_Ioc theorem toReal_injective : Function.Injective toReal := by intro θ ψ h induction θ using Real.Angle.induction_on induction ψ using Real.Angle.induction_on simpa [toReal_coe, toIocMod_eq_toIocMod, zsmul_eq_mul, mul_comm _ (2 * π), ← angle_eq_iff_two_pi_dvd_sub, eq_comm] using h #align real.angle.to_real_injective Real.Angle.toReal_injective @[simp] theorem toReal_inj {θ ψ : Angle} : θ.toReal = ψ.toReal ↔ θ = ψ := toReal_injective.eq_iff #align real.angle.to_real_inj Real.Angle.toReal_inj @[simp] theorem coe_toReal (θ : Angle) : (θ.toReal : Angle) = θ := by induction θ using Real.Angle.induction_on exact coe_toIocMod _ _ #align real.angle.coe_to_real Real.Angle.coe_toReal theorem neg_pi_lt_toReal (θ : Angle) : -π < θ.toReal := by induction θ using Real.Angle.induction_on exact left_lt_toIocMod _ _ _ #align real.angle.neg_pi_lt_to_real Real.Angle.neg_pi_lt_toReal theorem toReal_le_pi (θ : Angle) : θ.toReal ≤ π := by induction θ using Real.Angle.induction_on convert toIocMod_le_right two_pi_pos _ _ ring #align real.angle.to_real_le_pi Real.Angle.toReal_le_pi theorem abs_toReal_le_pi (θ : Angle) : |θ.toReal| ≤ π := abs_le.2 ⟨(neg_pi_lt_toReal _).le, toReal_le_pi _⟩ #align real.angle.abs_to_real_le_pi Real.Angle.abs_toReal_le_pi theorem toReal_mem_Ioc (θ : Angle) : θ.toReal ∈ Set.Ioc (-π) π := ⟨neg_pi_lt_toReal _, toReal_le_pi _⟩ #align real.angle.to_real_mem_Ioc Real.Angle.toReal_mem_Ioc @[simp] theorem toIocMod_toReal (θ : Angle) : toIocMod two_pi_pos (-π) θ.toReal = θ.toReal := by induction θ using Real.Angle.induction_on rw [toReal_coe] exact toIocMod_toIocMod _ _ _ _ #align real.angle.to_Ioc_mod_to_real Real.Angle.toIocMod_toReal @[simp] theorem toReal_zero : (0 : Angle).toReal = 0 := by rw [← coe_zero, toReal_coe_eq_self_iff] exact ⟨Left.neg_neg_iff.2 Real.pi_pos, Real.pi_pos.le⟩ #align real.angle.to_real_zero Real.Angle.toReal_zero @[simp] theorem toReal_eq_zero_iff {θ : Angle} : θ.toReal = 0 ↔ θ = 0 := by nth_rw 1 [← toReal_zero] exact toReal_inj #align real.angle.to_real_eq_zero_iff Real.Angle.toReal_eq_zero_iff @[simp] theorem toReal_pi : (π : Angle).toReal = π := by rw [toReal_coe_eq_self_iff] exact ⟨Left.neg_lt_self Real.pi_pos, le_refl _⟩ #align real.angle.to_real_pi Real.Angle.toReal_pi @[simp] theorem toReal_eq_pi_iff {θ : Angle} : θ.toReal = π ↔ θ = π := by rw [← toReal_inj, toReal_pi] #align real.angle.to_real_eq_pi_iff Real.Angle.toReal_eq_pi_iff theorem pi_ne_zero : (π : Angle) ≠ 0 := by rw [← toReal_injective.ne_iff, toReal_pi, toReal_zero] exact Real.pi_ne_zero #align real.angle.pi_ne_zero Real.Angle.pi_ne_zero @[simp] theorem toReal_pi_div_two : ((π / 2 : ℝ) : Angle).toReal = π / 2 := toReal_coe_eq_self_iff.2 <| by constructor <;> linarith [pi_pos] #align real.angle.to_real_pi_div_two Real.Angle.toReal_pi_div_two @[simp] theorem toReal_eq_pi_div_two_iff {θ : Angle} : θ.toReal = π / 2 ↔ θ = (π / 2 : ℝ) := by rw [← toReal_inj, toReal_pi_div_two] #align real.angle.to_real_eq_pi_div_two_iff Real.Angle.toReal_eq_pi_div_two_iff @[simp] theorem toReal_neg_pi_div_two : ((-π / 2 : ℝ) : Angle).toReal = -π / 2 := toReal_coe_eq_self_iff.2 <| by constructor <;> linarith [pi_pos] #align real.angle.to_real_neg_pi_div_two Real.Angle.toReal_neg_pi_div_two @[simp] theorem toReal_eq_neg_pi_div_two_iff {θ : Angle} : θ.toReal = -π / 2 ↔ θ = (-π / 2 : ℝ) := by rw [← toReal_inj, toReal_neg_pi_div_two] #align real.angle.to_real_eq_neg_pi_div_two_iff Real.Angle.toReal_eq_neg_pi_div_two_iff theorem pi_div_two_ne_zero : ((π / 2 : ℝ) : Angle) ≠ 0 := by rw [← toReal_injective.ne_iff, toReal_pi_div_two, toReal_zero] exact div_ne_zero Real.pi_ne_zero two_ne_zero #align real.angle.pi_div_two_ne_zero Real.Angle.pi_div_two_ne_zero theorem neg_pi_div_two_ne_zero : ((-π / 2 : ℝ) : Angle) ≠ 0 := by rw [← toReal_injective.ne_iff, toReal_neg_pi_div_two, toReal_zero] exact div_ne_zero (neg_ne_zero.2 Real.pi_ne_zero) two_ne_zero #align real.angle.neg_pi_div_two_ne_zero Real.Angle.neg_pi_div_two_ne_zero theorem abs_toReal_coe_eq_self_iff {θ : ℝ} : |(θ : Angle).toReal| = θ ↔ 0 ≤ θ ∧ θ ≤ π := ⟨fun h => h ▸ ⟨abs_nonneg _, abs_toReal_le_pi _⟩, fun h => (toReal_coe_eq_self_iff.2 ⟨(Left.neg_neg_iff.2 Real.pi_pos).trans_le h.1, h.2⟩).symm ▸ abs_eq_self.2 h.1⟩ #align real.angle.abs_to_real_coe_eq_self_iff Real.Angle.abs_toReal_coe_eq_self_iff theorem abs_toReal_neg_coe_eq_self_iff {θ : ℝ} : |(-θ : Angle).toReal| = θ ↔ 0 ≤ θ ∧ θ ≤ π := by refine ⟨fun h => h ▸ ⟨abs_nonneg _, abs_toReal_le_pi _⟩, fun h => ?_⟩ by_cases hnegpi : θ = π; · simp [hnegpi, Real.pi_pos.le] rw [← coe_neg, toReal_coe_eq_self_iff.2 ⟨neg_lt_neg (lt_of_le_of_ne h.2 hnegpi), (neg_nonpos.2 h.1).trans Real.pi_pos.le⟩, abs_neg, abs_eq_self.2 h.1] #align real.angle.abs_to_real_neg_coe_eq_self_iff Real.Angle.abs_toReal_neg_coe_eq_self_iff theorem abs_toReal_eq_pi_div_two_iff {θ : Angle} : |θ.toReal| = π / 2 ↔ θ = (π / 2 : ℝ) ∨ θ = (-π / 2 : ℝ) := by rw [abs_eq (div_nonneg Real.pi_pos.le two_pos.le), ← neg_div, toReal_eq_pi_div_two_iff, toReal_eq_neg_pi_div_two_iff] #align real.angle.abs_to_real_eq_pi_div_two_iff Real.Angle.abs_toReal_eq_pi_div_two_iff theorem nsmul_toReal_eq_mul {n : ℕ} (h : n ≠ 0) {θ : Angle} : (n • θ).toReal = n * θ.toReal ↔ θ.toReal ∈ Set.Ioc (-π / n) (π / n) := by nth_rw 1 [← coe_toReal θ] have h' : 0 < (n : ℝ) := mod_cast Nat.pos_of_ne_zero h rw [← coe_nsmul, nsmul_eq_mul, toReal_coe_eq_self_iff, Set.mem_Ioc, div_lt_iff' h', le_div_iff' h'] #align real.angle.nsmul_to_real_eq_mul Real.Angle.nsmul_toReal_eq_mul theorem two_nsmul_toReal_eq_two_mul {θ : Angle} : ((2 : ℕ) • θ).toReal = 2 * θ.toReal ↔ θ.toReal ∈ Set.Ioc (-π / 2) (π / 2) := mod_cast nsmul_toReal_eq_mul two_ne_zero #align real.angle.two_nsmul_to_real_eq_two_mul Real.Angle.two_nsmul_toReal_eq_two_mul theorem two_zsmul_toReal_eq_two_mul {θ : Angle} : ((2 : ℤ) • θ).toReal = 2 * θ.toReal ↔ θ.toReal ∈ Set.Ioc (-π / 2) (π / 2) := by rw [two_zsmul, ← two_nsmul, two_nsmul_toReal_eq_two_mul] #align real.angle.two_zsmul_to_real_eq_two_mul Real.Angle.two_zsmul_toReal_eq_two_mul theorem toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff {θ : ℝ} {k : ℤ} : (θ : Angle).toReal = θ - 2 * k * π ↔ θ ∈ Set.Ioc ((2 * k - 1 : ℝ) * π) ((2 * k + 1) * π) := by rw [← sub_zero (θ : Angle), ← zsmul_zero k, ← coe_two_pi, ← coe_zsmul, ← coe_sub, zsmul_eq_mul, ← mul_assoc, mul_comm (k : ℝ), toReal_coe_eq_self_iff, Set.mem_Ioc] exact ⟨fun h => ⟨by linarith, by linarith⟩, fun h => ⟨by linarith, by linarith⟩⟩ #align real.angle.to_real_coe_eq_self_sub_two_mul_int_mul_pi_iff Real.Angle.toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff theorem toReal_coe_eq_self_sub_two_pi_iff {θ : ℝ} : (θ : Angle).toReal = θ - 2 * π ↔ θ ∈ Set.Ioc π (3 * π) := by convert @toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff θ 1 <;> norm_num #align real.angle.to_real_coe_eq_self_sub_two_pi_iff Real.Angle.toReal_coe_eq_self_sub_two_pi_iff theorem toReal_coe_eq_self_add_two_pi_iff {θ : ℝ} : (θ : Angle).toReal = θ + 2 * π ↔ θ ∈ Set.Ioc (-3 * π) (-π) := by convert @toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff θ (-1) using 2 <;> set_option tactic.skipAssignedInstances false in norm_num #align real.angle.to_real_coe_eq_self_add_two_pi_iff Real.Angle.toReal_coe_eq_self_add_two_pi_iff theorem two_nsmul_toReal_eq_two_mul_sub_two_pi {θ : Angle} : ((2 : ℕ) • θ).toReal = 2 * θ.toReal - 2 * π ↔ π / 2 < θ.toReal := by nth_rw 1 [← coe_toReal θ] rw [← coe_nsmul, two_nsmul, ← two_mul, toReal_coe_eq_self_sub_two_pi_iff, Set.mem_Ioc] exact ⟨fun h => by linarith, fun h => ⟨(div_lt_iff' (zero_lt_two' ℝ)).1 h, by linarith [pi_pos, toReal_le_pi θ]⟩⟩ #align real.angle.two_nsmul_to_real_eq_two_mul_sub_two_pi Real.Angle.two_nsmul_toReal_eq_two_mul_sub_two_pi theorem two_zsmul_toReal_eq_two_mul_sub_two_pi {θ : Angle} : ((2 : ℤ) • θ).toReal = 2 * θ.toReal - 2 * π ↔ π / 2 < θ.toReal := by rw [two_zsmul, ← two_nsmul, two_nsmul_toReal_eq_two_mul_sub_two_pi] #align real.angle.two_zsmul_to_real_eq_two_mul_sub_two_pi Real.Angle.two_zsmul_toReal_eq_two_mul_sub_two_pi theorem two_nsmul_toReal_eq_two_mul_add_two_pi {θ : Angle} : ((2 : ℕ) • θ).toReal = 2 * θ.toReal + 2 * π ↔ θ.toReal ≤ -π / 2 := by nth_rw 1 [← coe_toReal θ] rw [← coe_nsmul, two_nsmul, ← two_mul, toReal_coe_eq_self_add_two_pi_iff, Set.mem_Ioc] refine ⟨fun h => by linarith, fun h => ⟨by linarith [pi_pos, neg_pi_lt_toReal θ], (le_div_iff' (zero_lt_two' ℝ)).1 h⟩⟩ #align real.angle.two_nsmul_to_real_eq_two_mul_add_two_pi Real.Angle.two_nsmul_toReal_eq_two_mul_add_two_pi theorem two_zsmul_toReal_eq_two_mul_add_two_pi {θ : Angle} : ((2 : ℤ) • θ).toReal = 2 * θ.toReal + 2 * π ↔ θ.toReal ≤ -π / 2 := by rw [two_zsmul, ← two_nsmul, two_nsmul_toReal_eq_two_mul_add_two_pi] #align real.angle.two_zsmul_to_real_eq_two_mul_add_two_pi Real.Angle.two_zsmul_toReal_eq_two_mul_add_two_pi @[simp] theorem sin_toReal (θ : Angle) : Real.sin θ.toReal = sin θ := by conv_rhs => rw [← coe_toReal θ, sin_coe] #align real.angle.sin_to_real Real.Angle.sin_toReal @[simp] theorem cos_toReal (θ : Angle) : Real.cos θ.toReal = cos θ := by conv_rhs => rw [← coe_toReal θ, cos_coe] #align real.angle.cos_to_real Real.Angle.cos_toReal theorem cos_nonneg_iff_abs_toReal_le_pi_div_two {θ : Angle} : 0 ≤ cos θ ↔ |θ.toReal| ≤ π / 2 := by nth_rw 1 [← coe_toReal θ] rw [abs_le, cos_coe] refine ⟨fun h => ?_, cos_nonneg_of_mem_Icc⟩ by_contra hn rw [not_and_or, not_le, not_le] at hn refine (not_lt.2 h) ?_ rcases hn with (hn | hn) · rw [← Real.cos_neg] refine cos_neg_of_pi_div_two_lt_of_lt (by linarith) ?_ linarith [neg_pi_lt_toReal θ] · refine cos_neg_of_pi_div_two_lt_of_lt hn ?_ linarith [toReal_le_pi θ] #align real.angle.cos_nonneg_iff_abs_to_real_le_pi_div_two Real.Angle.cos_nonneg_iff_abs_toReal_le_pi_div_two theorem cos_pos_iff_abs_toReal_lt_pi_div_two {θ : Angle} : 0 < cos θ ↔ |θ.toReal| < π / 2 := by rw [lt_iff_le_and_ne, lt_iff_le_and_ne, cos_nonneg_iff_abs_toReal_le_pi_div_two, ← and_congr_right] rintro - rw [Ne, Ne, not_iff_not, @eq_comm ℝ 0, abs_toReal_eq_pi_div_two_iff, cos_eq_zero_iff] #align real.angle.cos_pos_iff_abs_to_real_lt_pi_div_two Real.Angle.cos_pos_iff_abs_toReal_lt_pi_div_two theorem cos_neg_iff_pi_div_two_lt_abs_toReal {θ : Angle} : cos θ < 0 ↔ π / 2 < |θ.toReal| := by rw [← not_le, ← not_le, not_iff_not, cos_nonneg_iff_abs_toReal_le_pi_div_two] #align real.angle.cos_neg_iff_pi_div_two_lt_abs_to_real Real.Angle.cos_neg_iff_pi_div_two_lt_abs_toReal theorem abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi {θ ψ : Angle} (h : (2 : ℕ) • θ + (2 : ℕ) • ψ = π) : |cos θ| = |sin ψ| := by rw [← eq_sub_iff_add_eq, ← two_nsmul_coe_div_two, ← nsmul_sub, two_nsmul_eq_iff] at h rcases h with (rfl | rfl) <;> simp [cos_pi_div_two_sub] #align real.angle.abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi Real.Angle.abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi theorem abs_cos_eq_abs_sin_of_two_zsmul_add_two_zsmul_eq_pi {θ ψ : Angle} (h : (2 : ℤ) • θ + (2 : ℤ) • ψ = π) : |cos θ| = |sin ψ| := by simp_rw [two_zsmul, ← two_nsmul] at h exact abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi h #align real.angle.abs_cos_eq_abs_sin_of_two_zsmul_add_two_zsmul_eq_pi Real.Angle.abs_cos_eq_abs_sin_of_two_zsmul_add_two_zsmul_eq_pi def tan (θ : Angle) : ℝ := sin θ / cos θ #align real.angle.tan Real.Angle.tan theorem tan_eq_sin_div_cos (θ : Angle) : tan θ = sin θ / cos θ := rfl #align real.angle.tan_eq_sin_div_cos Real.Angle.tan_eq_sin_div_cos @[simp] theorem tan_coe (x : ℝ) : tan (x : Angle) = Real.tan x := by rw [tan, sin_coe, cos_coe, Real.tan_eq_sin_div_cos] #align real.angle.tan_coe Real.Angle.tan_coe @[simp] theorem tan_zero : tan (0 : Angle) = 0 := by rw [← coe_zero, tan_coe, Real.tan_zero] #align real.angle.tan_zero Real.Angle.tan_zero -- Porting note (#10618): @[simp] can now prove it theorem tan_coe_pi : tan (π : Angle) = 0 := by rw [tan_coe, Real.tan_pi] #align real.angle.tan_coe_pi Real.Angle.tan_coe_pi theorem tan_periodic : Function.Periodic tan (π : Angle) := by intro θ induction θ using Real.Angle.induction_on rw [← coe_add, tan_coe, tan_coe] exact Real.tan_periodic _ #align real.angle.tan_periodic Real.Angle.tan_periodic @[simp] theorem tan_add_pi (θ : Angle) : tan (θ + π) = tan θ := tan_periodic θ #align real.angle.tan_add_pi Real.Angle.tan_add_pi @[simp] theorem tan_sub_pi (θ : Angle) : tan (θ - π) = tan θ := tan_periodic.sub_eq θ #align real.angle.tan_sub_pi Real.Angle.tan_sub_pi @[simp] theorem tan_toReal (θ : Angle) : Real.tan θ.toReal = tan θ := by conv_rhs => rw [← coe_toReal θ, tan_coe] #align real.angle.tan_to_real Real.Angle.tan_toReal theorem tan_eq_of_two_nsmul_eq {θ ψ : Angle} (h : (2 : ℕ) • θ = (2 : ℕ) • ψ) : tan θ = tan ψ := by rw [two_nsmul_eq_iff] at h rcases h with (rfl | rfl) · rfl · exact tan_add_pi _ #align real.angle.tan_eq_of_two_nsmul_eq Real.Angle.tan_eq_of_two_nsmul_eq theorem tan_eq_of_two_zsmul_eq {θ ψ : Angle} (h : (2 : ℤ) • θ = (2 : ℤ) • ψ) : tan θ = tan ψ := by simp_rw [two_zsmul, ← two_nsmul] at h exact tan_eq_of_two_nsmul_eq h #align real.angle.tan_eq_of_two_zsmul_eq Real.Angle.tan_eq_of_two_zsmul_eq theorem tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi {θ ψ : Angle} (h : (2 : ℕ) • θ + (2 : ℕ) • ψ = π) : tan ψ = (tan θ)⁻¹ := by induction θ using Real.Angle.induction_on induction ψ using Real.Angle.induction_on rw [← smul_add, ← coe_add, ← coe_nsmul, two_nsmul, ← two_mul, angle_eq_iff_two_pi_dvd_sub] at h rcases h with ⟨k, h⟩ rw [sub_eq_iff_eq_add, ← mul_inv_cancel_left₀ two_ne_zero π, mul_assoc, ← mul_add, mul_right_inj' (two_ne_zero' ℝ), ← eq_sub_iff_add_eq', mul_inv_cancel_left₀ two_ne_zero π, inv_mul_eq_div, mul_comm] at h rw [tan_coe, tan_coe, ← tan_pi_div_two_sub, h, add_sub_assoc, add_comm] exact Real.tan_periodic.int_mul _ _ #align real.angle.tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi Real.Angle.tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi theorem tan_eq_inv_of_two_zsmul_add_two_zsmul_eq_pi {θ ψ : Angle} (h : (2 : ℤ) • θ + (2 : ℤ) • ψ = π) : tan ψ = (tan θ)⁻¹ := by simp_rw [two_zsmul, ← two_nsmul] at h exact tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi h #align real.angle.tan_eq_inv_of_two_zsmul_add_two_zsmul_eq_pi Real.Angle.tan_eq_inv_of_two_zsmul_add_two_zsmul_eq_pi def sign (θ : Angle) : SignType := SignType.sign (sin θ) #align real.angle.sign Real.Angle.sign @[simp] theorem sign_zero : (0 : Angle).sign = 0 := by rw [sign, sin_zero, _root_.sign_zero] #align real.angle.sign_zero Real.Angle.sign_zero @[simp] theorem sign_coe_pi : (π : Angle).sign = 0 := by rw [sign, sin_coe_pi, _root_.sign_zero] #align real.angle.sign_coe_pi Real.Angle.sign_coe_pi @[simp] theorem sign_neg (θ : Angle) : (-θ).sign = -θ.sign := by simp_rw [sign, sin_neg, Left.sign_neg] #align real.angle.sign_neg Real.Angle.sign_neg theorem sign_antiperiodic : Function.Antiperiodic sign (π : Angle) := fun θ => by rw [sign, sign, sin_add_pi, Left.sign_neg] #align real.angle.sign_antiperiodic Real.Angle.sign_antiperiodic @[simp] theorem sign_add_pi (θ : Angle) : (θ + π).sign = -θ.sign := sign_antiperiodic θ #align real.angle.sign_add_pi Real.Angle.sign_add_pi @[simp] theorem sign_pi_add (θ : Angle) : ((π : Angle) + θ).sign = -θ.sign := by rw [add_comm, sign_add_pi] #align real.angle.sign_pi_add Real.Angle.sign_pi_add @[simp] theorem sign_sub_pi (θ : Angle) : (θ - π).sign = -θ.sign := sign_antiperiodic.sub_eq θ #align real.angle.sign_sub_pi Real.Angle.sign_sub_pi @[simp]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
890
891
theorem sign_pi_sub (θ : Angle) : ((π : Angle) - θ).sign = θ.sign := by
simp [sign_antiperiodic.sub_eq']
import Mathlib.RingTheory.IntegralClosure import Mathlib.RingTheory.FractionalIdeal.Basic #align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7" open IsLocalization Pointwise nonZeroDivisors namespace FractionalIdeal open Set Submodule variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P] variable [Algebra R P] [loc : IsLocalization S P] section variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P'] variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P''] theorem _root_.IsFractional.map (g : P →ₐ[R] P') {I : Submodule R P} : IsFractional S I → IsFractional S (Submodule.map g.toLinearMap I) | ⟨a, a_nonzero, hI⟩ => ⟨a, a_nonzero, fun b hb => by obtain ⟨b', b'_mem, hb'⟩ := Submodule.mem_map.mp hb rw [AlgHom.toLinearMap_apply] at hb' obtain ⟨x, hx⟩ := hI b' b'_mem use x rw [← g.commutes, hx, g.map_smul, hb']⟩ #align is_fractional.map IsFractional.map def map (g : P →ₐ[R] P') : FractionalIdeal S P → FractionalIdeal S P' := fun I => ⟨Submodule.map g.toLinearMap I, I.isFractional.map g⟩ #align fractional_ideal.map FractionalIdeal.map @[simp, norm_cast] theorem coe_map (g : P →ₐ[R] P') (I : FractionalIdeal S P) : ↑(map g I) = Submodule.map g.toLinearMap I := rfl #align fractional_ideal.coe_map FractionalIdeal.coe_map @[simp] theorem mem_map {I : FractionalIdeal S P} {g : P →ₐ[R] P'} {y : P'} : y ∈ I.map g ↔ ∃ x, x ∈ I ∧ g x = y := Submodule.mem_map #align fractional_ideal.mem_map FractionalIdeal.mem_map variable (I J : FractionalIdeal S P) (g : P →ₐ[R] P') @[simp] theorem map_id : I.map (AlgHom.id _ _) = I := coeToSubmodule_injective (Submodule.map_id (I : Submodule R P)) #align fractional_ideal.map_id FractionalIdeal.map_id @[simp] theorem map_comp (g' : P' →ₐ[R] P'') : I.map (g'.comp g) = (I.map g).map g' := coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I) #align fractional_ideal.map_comp FractionalIdeal.map_comp @[simp, norm_cast] theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by ext x simp only [mem_coeIdeal] constructor · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ exact ⟨y, hy, (g.commutes y).symm⟩ · rintro ⟨y, hy, rfl⟩ exact ⟨_, ⟨y, hy, rfl⟩, g.commutes y⟩ #align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal @[simp] theorem map_one : (1 : FractionalIdeal S P).map g = 1 := map_coeIdeal g ⊤ #align fractional_ideal.map_one FractionalIdeal.map_one @[simp] theorem map_zero : (0 : FractionalIdeal S P).map g = 0 := map_coeIdeal g 0 #align fractional_ideal.map_zero FractionalIdeal.map_zero @[simp] theorem map_add : (I + J).map g = I.map g + J.map g := coeToSubmodule_injective (Submodule.map_sup _ _ _) #align fractional_ideal.map_add FractionalIdeal.map_add @[simp] theorem map_mul : (I * J).map g = I.map g * J.map g := by simp only [mul_def] exact coeToSubmodule_injective (Submodule.map_mul _ _ _) #align fractional_ideal.map_mul FractionalIdeal.map_mul @[simp] theorem map_map_symm (g : P ≃ₐ[R] P') : (I.map (g : P →ₐ[R] P')).map (g.symm : P' →ₐ[R] P) = I := by rw [← map_comp, g.symm_comp, map_id] #align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm @[simp] theorem map_symm_map (I : FractionalIdeal S P') (g : P ≃ₐ[R] P') : (I.map (g.symm : P' →ₐ[R] P)).map (g : P →ₐ[R] P') = I := by rw [← map_comp, g.comp_symm, map_id] #align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map theorem map_mem_map {f : P →ₐ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} : f x ∈ map f I ↔ x ∈ I := mem_map.trans ⟨fun ⟨_, hx', x'_eq⟩ => h x'_eq ▸ hx', fun h => ⟨x, h, rfl⟩⟩ #align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map theorem map_injective (f : P →ₐ[R] P') (h : Function.Injective f) : Function.Injective (map f : FractionalIdeal S P → FractionalIdeal S P') := fun _ _ hIJ => ext fun _ => (map_mem_map h).symm.trans (hIJ.symm ▸ map_mem_map h) #align fractional_ideal.map_injective FractionalIdeal.map_injective def mapEquiv (g : P ≃ₐ[R] P') : FractionalIdeal S P ≃+* FractionalIdeal S P' where toFun := map g invFun := map g.symm map_add' I J := map_add I J _ map_mul' I J := map_mul I J _ left_inv I := by rw [← map_comp, AlgEquiv.symm_comp, map_id] right_inv I := by rw [← map_comp, AlgEquiv.comp_symm, map_id] #align fractional_ideal.map_equiv FractionalIdeal.mapEquiv @[simp] theorem coeFun_mapEquiv (g : P ≃ₐ[R] P') : (mapEquiv g : FractionalIdeal S P → FractionalIdeal S P') = map g := rfl #align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv @[simp] theorem mapEquiv_apply (g : P ≃ₐ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (↑g) I := rfl #align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply @[simp] theorem mapEquiv_symm (g : P ≃ₐ[R] P') : ((mapEquiv g).symm : FractionalIdeal S P' ≃+* _) = mapEquiv g.symm := rfl #align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm @[simp] theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) := RingEquiv.ext fun x => by simp #align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl theorem isFractional_span_iff {s : Set P} : IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) := ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => span_induction hb h (by rw [smul_zero] exact isInteger_zero) (fun x y hx hy => by rw [smul_add] exact isInteger_add hx hy) fun s x hx => by rw [smul_comm] exact isInteger_smul hx⟩⟩ #align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by rcases hI with ⟨I, rfl⟩ rcases exist_integer_multiples_of_finset S I with ⟨⟨s, hs1⟩, hs⟩ rw [isFractional_span_iff] exact ⟨s, hs1, hs⟩ #align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x ∈ I * J) : ∃ T T' : Finset P, (T : Set P) ⊆ I ∧ (T' : Set P) ⊆ J ∧ x ∈ span R (T * T' : Set P) := Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx) #align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul variable (S) theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) : FG ((I : FractionalIdeal S P) : Submodule R P) ↔ I.FG := coeSubmodule_fg _ inj _ #align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg variable {S} theorem fg_unit (I : (FractionalIdeal S P)ˣ) : FG (I : Submodule R P) := Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I #align fractional_ideal.fg_unit FractionalIdeal.fg_unit theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) := fg_unit h.unit #align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R) (h : IsUnit (I : FractionalIdeal S P)) : I.FG := by rw [← coeIdeal_fg S inj I] exact FractionalIdeal.fg_of_isUnit I h #align ideal.fg_of_is_unit Ideal.fg_of_isUnit variable (S P P') noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P ≃+* FractionalIdeal S P' := mapEquiv { ringEquivOfRingEquiv P P' (RingEquiv.refl R) (show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with commutes' := fun r => ringEquivOfRingEquiv_eq _ _ } #align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv @[simp] theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} : x ∈ canonicalEquiv S P P' I ↔ ∃ y ∈ I, IsLocalization.map P' (RingHom.id R) (fun y (hy : y ∈ S) => show RingHom.id R y ∈ S from hy) (y : P) = x := by rw [canonicalEquiv, mapEquiv_apply, mem_map] exact ⟨fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩, fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩⟩ #align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply @[simp] theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P := RingEquiv.ext fun I => SetLike.ext_iff.mpr fun x => by rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply, mem_map] exact ⟨fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩, fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩⟩ #align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by rw [← canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply] #align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip @[simp] theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P''] [IsLocalization S P''] (I : FractionalIdeal S P) : canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by ext simp only [IsLocalization.map_map, RingHomInvPair.comp_eq₂, mem_canonicalEquiv_apply, exists_prop, exists_exists_and_eq_and] #align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P''] [IsLocalization S P''] : (canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' := RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'') #align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv @[simp] theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by ext simp [IsLocalization.map_eq] #align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal @[simp] theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by rw [← canonicalEquiv_trans_canonicalEquiv S P P] convert (canonicalEquiv S P P).symm_trans_self exact (canonicalEquiv_symm S P P).symm #align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self end section PrincipalIdeal variable {R₁ : Type*} [CommRing R₁] {K : Type*} [Field K] variable [Algebra R₁ K] [IsFractionRing R₁ K] open scoped Classical variable (R₁) -- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a -- `FractionalIdeal.coeToSubmodule` coercion def spanFinset {ι : Type*} (s : Finset ι) (f : ι → K) : FractionalIdeal R₁⁰ K := ⟨Submodule.span R₁ (f '' s), by obtain ⟨a', ha'⟩ := IsLocalization.exist_integer_multiples R₁⁰ s f refine ⟨a', a'.2, fun x hx => Submodule.span_induction hx ?_ ?_ ?_ ?_⟩ · rintro _ ⟨i, hi, rfl⟩ exact ha' i hi · rw [smul_zero] exact IsLocalization.isInteger_zero · intro x y hx hy rw [smul_add] exact IsLocalization.isInteger_add hx hy · intro c x hx rw [smul_comm] exact IsLocalization.isInteger_smul hx⟩ #align fractional_ideal.span_finset FractionalIdeal.spanFinset @[simp] lemma spanFinset_coe {ι : Type*} (s : Finset ι) (f : ι → K) : (spanFinset R₁ s f : Submodule R₁ K) = Submodule.span R₁ (f '' s) := rfl variable {R₁} @[simp] theorem spanFinset_eq_zero {ι : Type*} {s : Finset ι} {f : ι → K} : spanFinset R₁ s f = 0 ↔ ∀ j ∈ s, f j = 0 := by simp only [← coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot, Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] #align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero theorem spanFinset_ne_zero {ι : Type*} {s : Finset ι} {f : ι → K} : spanFinset R₁ s f ≠ 0 ↔ ∃ j ∈ s, f j ≠ 0 := by simp #align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero open Submodule.IsPrincipal theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) := let ⟨a, ha⟩ := exists_integer_multiple S x isFractional_span_iff.mpr ⟨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm ▸ ha⟩ #align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton variable (S) irreducible_def spanSingleton (x : P) : FractionalIdeal S P := ⟨span R {x}, isFractional_span_singleton x⟩ #align fractional_ideal.span_singleton FractionalIdeal.spanSingleton -- local attribute [semireducible] span_singleton @[simp] theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by rw [spanSingleton] rfl #align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton @[simp] theorem mem_spanSingleton {x y : P} : x ∈ spanSingleton S y ↔ ∃ z : R, z • y = x := by rw [spanSingleton] exact Submodule.mem_span_singleton #align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton theorem mem_spanSingleton_self (x : P) : x ∈ spanSingleton S x := (mem_spanSingleton S).mpr ⟨1, one_smul _ _⟩ #align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self variable (P) in theorem den_mul_self_eq_num' (I : FractionalIdeal S P) : spanSingleton S (algebraMap R P I.den) * I = I.num := by apply coeToSubmodule_injective dsimp only rw [coe_mul, ← smul_eq_mul, coe_spanSingleton, smul_eq_mul, Submodule.span_singleton_mul] convert I.den_mul_self_eq_num using 1 ext erw [Set.mem_smul_set, Set.mem_smul_set] simp [Algebra.smul_def] variable {S} @[simp] theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} : spanSingleton S x ≤ I ↔ x ∈ I := by rw [← coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe] #align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} : spanSingleton S x = spanSingleton S y ↔ ∃ z : Rˣ, z • x = y := by rw [← Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton] exact Subtype.mk_eq_mk #align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] : I = spanSingleton S (generator (I : Submodule R P)) := by -- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator ↑I).symm` -- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`. rw [spanSingleton, ← coeToSubmodule_inj, coe_mk, span_singleton_generator] #align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal theorem isPrincipal_iff (I : FractionalIdeal S P) : IsPrincipal (I : Submodule R P) ↔ ∃ x, I = spanSingleton S x := ⟨fun h => ⟨@generator _ _ _ _ _ (↑I) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I h⟩, fun ⟨x, hx⟩ => { principal' := ⟨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)⟩ }⟩ #align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff @[simp]
Mathlib/RingTheory/FractionalIdeal/Operations.lean
684
686
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext simp [Submodule.mem_span_singleton, eq_comm]
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Star.Pi #align_import algebra.star.self_adjoint from "leanprover-community/mathlib"@"a6ece35404f60597c651689c1b46ead86de5ac1b" open Function variable {R A : Type*} def IsSelfAdjoint [Star R] (x : R) : Prop := star x = x #align is_self_adjoint IsSelfAdjoint @[mk_iff] class IsStarNormal [Mul R] [Star R] (x : R) : Prop where star_comm_self : Commute (star x) x #align is_star_normal IsStarNormal export IsStarNormal (star_comm_self) theorem star_comm_self' [Mul R] [Star R] (x : R) [IsStarNormal x] : star x * x = x * star x := IsStarNormal.star_comm_self #align star_comm_self' star_comm_self' namespace IsSelfAdjoint -- named to match `Commute.allₓ` theorem all [Star R] [TrivialStar R] (r : R) : IsSelfAdjoint r := star_trivial _ #align is_self_adjoint.all IsSelfAdjoint.all theorem star_eq [Star R] {x : R} (hx : IsSelfAdjoint x) : star x = x := hx #align is_self_adjoint.star_eq IsSelfAdjoint.star_eq theorem _root_.isSelfAdjoint_iff [Star R] {x : R} : IsSelfAdjoint x ↔ star x = x := Iff.rfl #align is_self_adjoint_iff isSelfAdjoint_iff @[simp] theorem star_iff [InvolutiveStar R] {x : R} : IsSelfAdjoint (star x) ↔ IsSelfAdjoint x := by simpa only [IsSelfAdjoint, star_star] using eq_comm #align is_self_adjoint.star_iff IsSelfAdjoint.star_iff @[simp] theorem star_mul_self [Mul R] [StarMul R] (x : R) : IsSelfAdjoint (star x * x) := by simp only [IsSelfAdjoint, star_mul, star_star] #align is_self_adjoint.star_mul_self IsSelfAdjoint.star_mul_self @[simp] theorem mul_star_self [Mul R] [StarMul R] (x : R) : IsSelfAdjoint (x * star x) := by simpa only [star_star] using star_mul_self (star x) #align is_self_adjoint.mul_star_self IsSelfAdjoint.mul_star_self lemma commute_iff {R : Type*} [Mul R] [StarMul R] {x y : R} (hx : IsSelfAdjoint x) (hy : IsSelfAdjoint y) : Commute x y ↔ IsSelfAdjoint (x * y) := by refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · rw [isSelfAdjoint_iff, star_mul, hx.star_eq, hy.star_eq, h.eq] · simpa only [star_mul, hx.star_eq, hy.star_eq] using h.symm theorem starHom_apply {F R S : Type*} [Star R] [Star S] [FunLike F R S] [StarHomClass F R S] {x : R} (hx : IsSelfAdjoint x) (f : F) : IsSelfAdjoint (f x) := show star (f x) = f x from map_star f x ▸ congr_arg f hx #align is_self_adjoint.star_hom_apply IsSelfAdjoint.starHom_apply theorem _root_.isSelfAdjoint_starHom_apply {F R S : Type*} [Star R] [Star S] [FunLike F R S] [StarHomClass F R S] [TrivialStar R] (f : F) (x : R) : IsSelfAdjoint (f x) := (IsSelfAdjoint.all x).starHom_apply f section SMul variable [Star R] [AddMonoid A] [StarAddMonoid A] [SMul R A] [StarModule R A]
Mathlib/Algebra/Star/SelfAdjoint.lean
290
291
theorem smul {r : R} (hr : IsSelfAdjoint r) {x : A} (hx : IsSelfAdjoint x) : IsSelfAdjoint (r • x) := by
simp only [isSelfAdjoint_iff, star_smul, hr.star_eq, hx.star_eq]
import Mathlib.Order.Lattice import Mathlib.Data.List.Sort import Mathlib.Logic.Equiv.Fin import Mathlib.Logic.Equiv.Functor import Mathlib.Data.Fintype.Card import Mathlib.Order.RelSeries #align_import order.jordan_holder from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u open Set RelSeries class JordanHolderLattice (X : Type u) [Lattice X] where IsMaximal : X → X → Prop lt_of_isMaximal : ∀ {x y}, IsMaximal x y → x < y sup_eq_of_isMaximal : ∀ {x y z}, IsMaximal x z → IsMaximal y z → x ≠ y → x ⊔ y = z isMaximal_inf_left_of_isMaximal_sup : ∀ {x y}, IsMaximal x (x ⊔ y) → IsMaximal y (x ⊔ y) → IsMaximal (x ⊓ y) x Iso : X × X → X × X → Prop iso_symm : ∀ {x y}, Iso x y → Iso y x iso_trans : ∀ {x y z}, Iso x y → Iso y z → Iso x z second_iso : ∀ {x y}, IsMaximal x (x ⊔ y) → Iso (x, x ⊔ y) (x ⊓ y, y) #align jordan_holder_lattice JordanHolderLattice open JordanHolderLattice attribute [symm] iso_symm attribute [trans] iso_trans abbrev CompositionSeries (X : Type u) [Lattice X] [JordanHolderLattice X] : Type u := RelSeries (IsMaximal (X := X)) #align composition_series CompositionSeries namespace CompositionSeries variable {X : Type u} [Lattice X] [JordanHolderLattice X] #noalign composition_series.has_coe_to_fun #align composition_series.has_inhabited RelSeries.instInhabited #align composition_series.step RelSeries.membership theorem lt_succ (s : CompositionSeries X) (i : Fin s.length) : s (Fin.castSucc i) < s (Fin.succ i) := lt_of_isMaximal (s.step _) #align composition_series.lt_succ CompositionSeries.lt_succ protected theorem strictMono (s : CompositionSeries X) : StrictMono s := Fin.strictMono_iff_lt_succ.2 s.lt_succ #align composition_series.strict_mono CompositionSeries.strictMono protected theorem injective (s : CompositionSeries X) : Function.Injective s := s.strictMono.injective #align composition_series.injective CompositionSeries.injective @[simp] protected theorem inj (s : CompositionSeries X) {i j : Fin s.length.succ} : s i = s j ↔ i = j := s.injective.eq_iff #align composition_series.inj CompositionSeries.inj #align composition_series.has_mem RelSeries.membership #align composition_series.mem_def RelSeries.mem_def
Mathlib/Order/JordanHolder.lean
173
177
theorem total {s : CompositionSeries X} {x y : X} (hx : x ∈ s) (hy : y ∈ s) : x ≤ y ∨ y ≤ x := by
rcases Set.mem_range.1 hx with ⟨i, rfl⟩ rcases Set.mem_range.1 hy with ⟨j, rfl⟩ rw [s.strictMono.le_iff_le, s.strictMono.le_iff_le] exact le_total i j
import Mathlib.SetTheory.Ordinal.Arithmetic import Mathlib.SetTheory.Ordinal.Exponential #align_import set_theory.ordinal.fixed_point from "leanprover-community/mathlib"@"0dd4319a17376eda5763cd0a7e0d35bbaaa50e83" noncomputable section universe u v open Function Order namespace Ordinal section variable {ι : Type u} {f : ι → Ordinal.{max u v} → Ordinal.{max u v}} def nfpFamily (f : ι → Ordinal → Ordinal) (a : Ordinal) : Ordinal := sup (List.foldr f a) #align ordinal.nfp_family Ordinal.nfpFamily theorem nfpFamily_eq_sup (f : ι → Ordinal.{max u v} → Ordinal.{max u v}) (a : Ordinal.{max u v}) : nfpFamily.{u, v} f a = sup.{u, v} (List.foldr f a) := rfl #align ordinal.nfp_family_eq_sup Ordinal.nfpFamily_eq_sup theorem foldr_le_nfpFamily (f : ι → Ordinal → Ordinal) (a l) : List.foldr f a l ≤ nfpFamily.{u, v} f a := le_sup.{u, v} _ _ #align ordinal.foldr_le_nfp_family Ordinal.foldr_le_nfpFamily theorem le_nfpFamily (f : ι → Ordinal → Ordinal) (a) : a ≤ nfpFamily f a := le_sup _ [] #align ordinal.le_nfp_family Ordinal.le_nfpFamily theorem lt_nfpFamily {a b} : a < nfpFamily.{u, v} f b ↔ ∃ l, a < List.foldr f b l := lt_sup.{u, v} #align ordinal.lt_nfp_family Ordinal.lt_nfpFamily theorem nfpFamily_le_iff {a b} : nfpFamily.{u, v} f a ≤ b ↔ ∀ l, List.foldr f a l ≤ b := sup_le_iff #align ordinal.nfp_family_le_iff Ordinal.nfpFamily_le_iff theorem nfpFamily_le {a b} : (∀ l, List.foldr f a l ≤ b) → nfpFamily.{u, v} f a ≤ b := sup_le.{u, v} #align ordinal.nfp_family_le Ordinal.nfpFamily_le theorem nfpFamily_monotone (hf : ∀ i, Monotone (f i)) : Monotone (nfpFamily.{u, v} f) := fun _ _ h => sup_le.{u, v} fun l => (List.foldr_monotone hf l h).trans (le_sup.{u, v} _ l) #align ordinal.nfp_family_monotone Ordinal.nfpFamily_monotone theorem apply_lt_nfpFamily (H : ∀ i, IsNormal (f i)) {a b} (hb : b < nfpFamily.{u, v} f a) (i) : f i b < nfpFamily.{u, v} f a := let ⟨l, hl⟩ := lt_nfpFamily.1 hb lt_sup.2 ⟨i::l, (H i).strictMono hl⟩ #align ordinal.apply_lt_nfp_family Ordinal.apply_lt_nfpFamily theorem apply_lt_nfpFamily_iff [Nonempty ι] (H : ∀ i, IsNormal (f i)) {a b} : (∀ i, f i b < nfpFamily.{u, v} f a) ↔ b < nfpFamily.{u, v} f a := ⟨fun h => lt_nfpFamily.2 <| let ⟨l, hl⟩ := lt_sup.1 <| h <| Classical.arbitrary ι ⟨l, ((H _).self_le b).trans_lt hl⟩, apply_lt_nfpFamily H⟩ #align ordinal.apply_lt_nfp_family_iff Ordinal.apply_lt_nfpFamily_iff theorem nfpFamily_le_apply [Nonempty ι] (H : ∀ i, IsNormal (f i)) {a b} : (∃ i, nfpFamily.{u, v} f a ≤ f i b) ↔ nfpFamily.{u, v} f a ≤ b := by rw [← not_iff_not] push_neg exact apply_lt_nfpFamily_iff H #align ordinal.nfp_family_le_apply Ordinal.nfpFamily_le_apply theorem nfpFamily_le_fp (H : ∀ i, Monotone (f i)) {a b} (ab : a ≤ b) (h : ∀ i, f i b ≤ b) : nfpFamily.{u, v} f a ≤ b := sup_le fun l => by by_cases hι : IsEmpty ι · rwa [Unique.eq_default l] · induction' l with i l IH generalizing a · exact ab exact (H i (IH ab)).trans (h i) #align ordinal.nfp_family_le_fp Ordinal.nfpFamily_le_fp theorem nfpFamily_fp {i} (H : IsNormal (f i)) (a) : f i (nfpFamily.{u, v} f a) = nfpFamily.{u, v} f a := by unfold nfpFamily rw [@IsNormal.sup.{u, v, v} _ H _ _ ⟨[]⟩] apply le_antisymm <;> refine Ordinal.sup_le fun l => ?_ · exact le_sup _ (i::l) · exact (H.self_le _).trans (le_sup _ _) #align ordinal.nfp_family_fp Ordinal.nfpFamily_fp theorem apply_le_nfpFamily [hι : Nonempty ι] {f : ι → Ordinal → Ordinal} (H : ∀ i, IsNormal (f i)) {a b} : (∀ i, f i b ≤ nfpFamily.{u, v} f a) ↔ b ≤ nfpFamily.{u, v} f a := by refine ⟨fun h => ?_, fun h i => ?_⟩ · cases' hι with i exact ((H i).self_le b).trans (h i) rw [← nfpFamily_fp (H i)] exact (H i).monotone h #align ordinal.apply_le_nfp_family Ordinal.apply_le_nfpFamily theorem nfpFamily_eq_self {f : ι → Ordinal → Ordinal} {a} (h : ∀ i, f i a = a) : nfpFamily f a = a := le_antisymm (sup_le fun l => by rw [List.foldr_fixed' h l]) <| le_nfpFamily f a #align ordinal.nfp_family_eq_self Ordinal.nfpFamily_eq_self -- Todo: This is actually a special case of the fact the intersection of club sets is a club set. theorem fp_family_unbounded (H : ∀ i, IsNormal (f i)) : (⋂ i, Function.fixedPoints (f i)).Unbounded (· < ·) := fun a => ⟨nfpFamily.{u, v} f a, fun s ⟨i, hi⟩ => by rw [← hi, mem_fixedPoints_iff] exact nfpFamily_fp.{u, v} (H i) a, (le_nfpFamily f a).not_lt⟩ #align ordinal.fp_family_unbounded Ordinal.fp_family_unbounded def derivFamily (f : ι → Ordinal → Ordinal) (o : Ordinal) : Ordinal := limitRecOn o (nfpFamily.{u, v} f 0) (fun _ IH => nfpFamily.{u, v} f (succ IH)) fun a _ => bsup.{max u v, u} a #align ordinal.deriv_family Ordinal.derivFamily @[simp] theorem derivFamily_zero (f : ι → Ordinal → Ordinal) : derivFamily.{u, v} f 0 = nfpFamily.{u, v} f 0 := limitRecOn_zero _ _ _ #align ordinal.deriv_family_zero Ordinal.derivFamily_zero @[simp] theorem derivFamily_succ (f : ι → Ordinal → Ordinal) (o) : derivFamily.{u, v} f (succ o) = nfpFamily.{u, v} f (succ (derivFamily.{u, v} f o)) := limitRecOn_succ _ _ _ _ #align ordinal.deriv_family_succ Ordinal.derivFamily_succ theorem derivFamily_limit (f : ι → Ordinal → Ordinal) {o} : IsLimit o → derivFamily.{u, v} f o = bsup.{max u v, u} o fun a _ => derivFamily.{u, v} f a := limitRecOn_limit _ _ _ _ #align ordinal.deriv_family_limit Ordinal.derivFamily_limit theorem derivFamily_isNormal (f : ι → Ordinal → Ordinal) : IsNormal (derivFamily f) := ⟨fun o => by rw [derivFamily_succ, ← succ_le_iff]; apply le_nfpFamily, fun o l a => by rw [derivFamily_limit _ l, bsup_le_iff]⟩ #align ordinal.deriv_family_is_normal Ordinal.derivFamily_isNormal theorem derivFamily_fp {i} (H : IsNormal (f i)) (o : Ordinal.{max u v}) : f i (derivFamily.{u, v} f o) = derivFamily.{u, v} f o := by induction' o using limitRecOn with o _ o l IH · rw [derivFamily_zero] exact nfpFamily_fp H 0 · rw [derivFamily_succ] exact nfpFamily_fp H _ · rw [derivFamily_limit _ l, IsNormal.bsup.{max u v, u, max u v} H (fun a _ => derivFamily f a) l.1] refine eq_of_forall_ge_iff fun c => ?_ simp (config := { contextual := true }) only [bsup_le_iff, IH] #align ordinal.deriv_family_fp Ordinal.derivFamily_fp theorem le_iff_derivFamily (H : ∀ i, IsNormal (f i)) {a} : (∀ i, f i a ≤ a) ↔ ∃ o, derivFamily.{u, v} f o = a := ⟨fun ha => by suffices ∀ (o) (_ : a ≤ derivFamily.{u, v} f o), ∃ o, derivFamily.{u, v} f o = a from this a ((derivFamily_isNormal _).self_le _) intro o induction' o using limitRecOn with o IH o l IH · intro h₁ refine ⟨0, le_antisymm ?_ h₁⟩ rw [derivFamily_zero] exact nfpFamily_le_fp (fun i => (H i).monotone) (Ordinal.zero_le _) ha · intro h₁ rcases le_or_lt a (derivFamily.{u, v} f o) with h | h · exact IH h refine ⟨succ o, le_antisymm ?_ h₁⟩ rw [derivFamily_succ] exact nfpFamily_le_fp (fun i => (H i).monotone) (succ_le_of_lt h) ha · intro h₁ cases' eq_or_lt_of_le h₁ with h h · exact ⟨_, h.symm⟩ rw [derivFamily_limit _ l, ← not_le, bsup_le_iff, not_forall₂] at h exact let ⟨o', h, hl⟩ := h IH o' h (le_of_not_le hl), fun ⟨o, e⟩ i => e ▸ (derivFamily_fp (H i) _).le⟩ #align ordinal.le_iff_deriv_family Ordinal.le_iff_derivFamily theorem fp_iff_derivFamily (H : ∀ i, IsNormal (f i)) {a} : (∀ i, f i a = a) ↔ ∃ o, derivFamily.{u, v} f o = a := Iff.trans ⟨fun h i => le_of_eq (h i), fun h i => (H i).le_iff_eq.1 (h i)⟩ (le_iff_derivFamily H) #align ordinal.fp_iff_deriv_family Ordinal.fp_iff_derivFamily theorem derivFamily_eq_enumOrd (H : ∀ i, IsNormal (f i)) : derivFamily.{u, v} f = enumOrd (⋂ i, Function.fixedPoints (f i)) := by rw [← eq_enumOrd _ (fp_family_unbounded.{u, v} H)] use (derivFamily_isNormal f).strictMono rw [Set.range_eq_iff] refine ⟨?_, fun a ha => ?_⟩ · rintro a S ⟨i, hi⟩ rw [← hi] exact derivFamily_fp (H i) a rw [Set.mem_iInter] at ha rwa [← fp_iff_derivFamily H] #align ordinal.deriv_family_eq_enum_ord Ordinal.derivFamily_eq_enumOrd end section variable {o : Ordinal.{u}} {f : ∀ b < o, Ordinal.{max u v} → Ordinal.{max u v}} def nfpBFamily (o : Ordinal) (f : ∀ b < o, Ordinal → Ordinal) : Ordinal → Ordinal := nfpFamily (familyOfBFamily o f) #align ordinal.nfp_bfamily Ordinal.nfpBFamily theorem nfpBFamily_eq_nfpFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) : nfpBFamily.{u, v} o f = nfpFamily.{u, v} (familyOfBFamily o f) := rfl #align ordinal.nfp_bfamily_eq_nfp_family Ordinal.nfpBFamily_eq_nfpFamily theorem foldr_le_nfpBFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) (a l) : List.foldr (familyOfBFamily o f) a l ≤ nfpBFamily.{u, v} o f a := le_sup.{u, v} _ _ #align ordinal.foldr_le_nfp_bfamily Ordinal.foldr_le_nfpBFamily theorem le_nfpBFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) (a) : a ≤ nfpBFamily.{u, v} o f a := le_sup.{u, v} _ [] #align ordinal.le_nfp_bfamily Ordinal.le_nfpBFamily theorem lt_nfpBFamily {a b} : a < nfpBFamily.{u, v} o f b ↔ ∃ l, a < List.foldr (familyOfBFamily o f) b l := lt_sup.{u, v} #align ordinal.lt_nfp_bfamily Ordinal.lt_nfpBFamily theorem nfpBFamily_le_iff {o : Ordinal} {f : ∀ b < o, Ordinal → Ordinal} {a b} : nfpBFamily.{u, v} o f a ≤ b ↔ ∀ l, List.foldr (familyOfBFamily o f) a l ≤ b := sup_le_iff.{u, v} #align ordinal.nfp_bfamily_le_iff Ordinal.nfpBFamily_le_iff theorem nfpBFamily_le {o : Ordinal} {f : ∀ b < o, Ordinal → Ordinal} {a b} : (∀ l, List.foldr (familyOfBFamily o f) a l ≤ b) → nfpBFamily.{u, v} o f a ≤ b := sup_le.{u, v} #align ordinal.nfp_bfamily_le Ordinal.nfpBFamily_le theorem nfpBFamily_monotone (hf : ∀ i hi, Monotone (f i hi)) : Monotone (nfpBFamily.{u, v} o f) := nfpFamily_monotone fun _ => hf _ _ #align ordinal.nfp_bfamily_monotone Ordinal.nfpBFamily_monotone theorem apply_lt_nfpBFamily (H : ∀ i hi, IsNormal (f i hi)) {a b} (hb : b < nfpBFamily.{u, v} o f a) (i hi) : f i hi b < nfpBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply apply_lt_nfpFamily (fun _ => H _ _) hb #align ordinal.apply_lt_nfp_bfamily Ordinal.apply_lt_nfpBFamily theorem apply_lt_nfpBFamily_iff (ho : o ≠ 0) (H : ∀ i hi, IsNormal (f i hi)) {a b} : (∀ i hi, f i hi b < nfpBFamily.{u, v} o f a) ↔ b < nfpBFamily.{u, v} o f a := ⟨fun h => by haveI := out_nonempty_iff_ne_zero.2 ho refine (apply_lt_nfpFamily_iff.{u, v} ?_).1 fun _ => h _ _ exact fun _ => H _ _, apply_lt_nfpBFamily H⟩ #align ordinal.apply_lt_nfp_bfamily_iff Ordinal.apply_lt_nfpBFamily_iff theorem nfpBFamily_le_apply (ho : o ≠ 0) (H : ∀ i hi, IsNormal (f i hi)) {a b} : (∃ i hi, nfpBFamily.{u, v} o f a ≤ f i hi b) ↔ nfpBFamily.{u, v} o f a ≤ b := by rw [← not_iff_not] push_neg exact apply_lt_nfpBFamily_iff.{u, v} ho H #align ordinal.nfp_bfamily_le_apply Ordinal.nfpBFamily_le_apply theorem nfpBFamily_le_fp (H : ∀ i hi, Monotone (f i hi)) {a b} (ab : a ≤ b) (h : ∀ i hi, f i hi b ≤ b) : nfpBFamily.{u, v} o f a ≤ b := nfpFamily_le_fp (fun _ => H _ _) ab fun _ => h _ _ #align ordinal.nfp_bfamily_le_fp Ordinal.nfpBFamily_le_fp theorem nfpBFamily_fp {i hi} (H : IsNormal (f i hi)) (a) : f i hi (nfpBFamily.{u, v} o f a) = nfpBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply nfpFamily_fp rw [familyOfBFamily_enum] exact H #align ordinal.nfp_bfamily_fp Ordinal.nfpBFamily_fp theorem apply_le_nfpBFamily (ho : o ≠ 0) (H : ∀ i hi, IsNormal (f i hi)) {a b} : (∀ i hi, f i hi b ≤ nfpBFamily.{u, v} o f a) ↔ b ≤ nfpBFamily.{u, v} o f a := by refine ⟨fun h => ?_, fun h i hi => ?_⟩ · have ho' : 0 < o := Ordinal.pos_iff_ne_zero.2 ho exact ((H 0 ho').self_le b).trans (h 0 ho') · rw [← nfpBFamily_fp (H i hi)] exact (H i hi).monotone h #align ordinal.apply_le_nfp_bfamily Ordinal.apply_le_nfpBFamily theorem nfpBFamily_eq_self {a} (h : ∀ i hi, f i hi a = a) : nfpBFamily.{u, v} o f a = a := nfpFamily_eq_self fun _ => h _ _ #align ordinal.nfp_bfamily_eq_self Ordinal.nfpBFamily_eq_self theorem fp_bfamily_unbounded (H : ∀ i hi, IsNormal (f i hi)) : (⋂ (i) (hi), Function.fixedPoints (f i hi)).Unbounded (· < ·) := fun a => ⟨nfpBFamily.{u, v} _ f a, by rw [Set.mem_iInter₂] exact fun i hi => nfpBFamily_fp (H i hi) _, (le_nfpBFamily f a).not_lt⟩ #align ordinal.fp_bfamily_unbounded Ordinal.fp_bfamily_unbounded def derivBFamily (o : Ordinal) (f : ∀ b < o, Ordinal → Ordinal) : Ordinal → Ordinal := derivFamily (familyOfBFamily o f) #align ordinal.deriv_bfamily Ordinal.derivBFamily theorem derivBFamily_eq_derivFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) : derivBFamily.{u, v} o f = derivFamily.{u, v} (familyOfBFamily o f) := rfl #align ordinal.deriv_bfamily_eq_deriv_family Ordinal.derivBFamily_eq_derivFamily theorem derivBFamily_isNormal {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) : IsNormal (derivBFamily o f) := derivFamily_isNormal _ #align ordinal.deriv_bfamily_is_normal Ordinal.derivBFamily_isNormal theorem derivBFamily_fp {i hi} (H : IsNormal (f i hi)) (a : Ordinal) : f i hi (derivBFamily.{u, v} o f a) = derivBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply derivFamily_fp rw [familyOfBFamily_enum] exact H #align ordinal.deriv_bfamily_fp Ordinal.derivBFamily_fp theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} : (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by unfold derivBFamily rw [← le_iff_derivFamily] · refine ⟨fun h i => h _ _, fun h i hi => ?_⟩ rw [← familyOfBFamily_enum o f] apply h · exact fun _ => H _ _ #align ordinal.le_iff_deriv_bfamily Ordinal.le_iff_derivBFamily theorem fp_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} : (∀ i hi, f i hi a = a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by rw [← le_iff_derivBFamily H] refine ⟨fun h i hi => le_of_eq (h i hi), fun h i hi => ?_⟩ rw [← (H i hi).le_iff_eq] exact h i hi #align ordinal.fp_iff_deriv_bfamily Ordinal.fp_iff_derivBFamily theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) : derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)] use (derivBFamily_isNormal f).strictMono rw [Set.range_eq_iff] refine ⟨fun a => Set.mem_iInter₂.2 fun i hi => derivBFamily_fp (H i hi) a, fun a ha => ?_⟩ rw [Set.mem_iInter₂] at ha rwa [← fp_iff_derivBFamily H] #align ordinal.deriv_bfamily_eq_enum_ord Ordinal.derivBFamily_eq_enumOrd end section variable {f : Ordinal.{u} → Ordinal.{u}} def nfp (f : Ordinal → Ordinal) : Ordinal → Ordinal := nfpFamily fun _ : Unit => f #align ordinal.nfp Ordinal.nfp theorem nfp_eq_nfpFamily (f : Ordinal → Ordinal) : nfp f = nfpFamily fun _ : Unit => f := rfl #align ordinal.nfp_eq_nfp_family Ordinal.nfp_eq_nfpFamily @[simp] theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) : (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by refine funext fun a => le_antisymm ?_ (sup_le fun l => ?_) · rw [sup_le_iff] intro n rw [← List.length_replicate n Unit.unit, ← List.foldr_const f a] apply le_sup · rw [List.foldr_const f a l] exact le_sup _ _ #align ordinal.sup_iterate_eq_nfp Ordinal.sup_iterate_eq_nfp theorem iterate_le_nfp (f a n) : f^[n] a ≤ nfp f a := by rw [← sup_iterate_eq_nfp] exact le_sup _ n #align ordinal.iterate_le_nfp Ordinal.iterate_le_nfp theorem le_nfp (f a) : a ≤ nfp f a := iterate_le_nfp f a 0 #align ordinal.le_nfp Ordinal.le_nfp theorem lt_nfp {a b} : a < nfp f b ↔ ∃ n, a < f^[n] b := by rw [← sup_iterate_eq_nfp] exact lt_sup #align ordinal.lt_nfp Ordinal.lt_nfp theorem nfp_le_iff {a b} : nfp f a ≤ b ↔ ∀ n, f^[n] a ≤ b := by rw [← sup_iterate_eq_nfp] exact sup_le_iff #align ordinal.nfp_le_iff Ordinal.nfp_le_iff theorem nfp_le {a b} : (∀ n, f^[n] a ≤ b) → nfp f a ≤ b := nfp_le_iff.2 #align ordinal.nfp_le Ordinal.nfp_le @[simp] theorem nfp_id : nfp id = id := funext fun a => by simp_rw [← sup_iterate_eq_nfp, iterate_id] exact sup_const a #align ordinal.nfp_id Ordinal.nfp_id theorem nfp_monotone (hf : Monotone f) : Monotone (nfp f) := nfpFamily_monotone fun _ => hf #align ordinal.nfp_monotone Ordinal.nfp_monotone theorem IsNormal.apply_lt_nfp {f} (H : IsNormal f) {a b} : f b < nfp f a ↔ b < nfp f a := by unfold nfp rw [← @apply_lt_nfpFamily_iff Unit (fun _ => f) _ (fun _ => H) a b] exact ⟨fun h _ => h, fun h => h Unit.unit⟩ #align ordinal.is_normal.apply_lt_nfp Ordinal.IsNormal.apply_lt_nfp theorem IsNormal.nfp_le_apply {f} (H : IsNormal f) {a b} : nfp f a ≤ f b ↔ nfp f a ≤ b := le_iff_le_iff_lt_iff_lt.2 H.apply_lt_nfp #align ordinal.is_normal.nfp_le_apply Ordinal.IsNormal.nfp_le_apply theorem nfp_le_fp {f} (H : Monotone f) {a b} (ab : a ≤ b) (h : f b ≤ b) : nfp f a ≤ b := nfpFamily_le_fp (fun _ => H) ab fun _ => h #align ordinal.nfp_le_fp Ordinal.nfp_le_fp theorem IsNormal.nfp_fp {f} (H : IsNormal f) : ∀ a, f (nfp f a) = nfp f a := @nfpFamily_fp Unit (fun _ => f) Unit.unit H #align ordinal.is_normal.nfp_fp Ordinal.IsNormal.nfp_fp theorem IsNormal.apply_le_nfp {f} (H : IsNormal f) {a b} : f b ≤ nfp f a ↔ b ≤ nfp f a := ⟨le_trans (H.self_le _), fun h => by simpa only [H.nfp_fp] using H.le_iff.2 h⟩ #align ordinal.is_normal.apply_le_nfp Ordinal.IsNormal.apply_le_nfp theorem nfp_eq_self {f : Ordinal → Ordinal} {a} (h : f a = a) : nfp f a = a := nfpFamily_eq_self fun _ => h #align ordinal.nfp_eq_self Ordinal.nfp_eq_self theorem fp_unbounded (H : IsNormal f) : (Function.fixedPoints f).Unbounded (· < ·) := by convert fp_family_unbounded fun _ : Unit => H exact (Set.iInter_const _).symm #align ordinal.fp_unbounded Ordinal.fp_unbounded def deriv (f : Ordinal → Ordinal) : Ordinal → Ordinal := derivFamily fun _ : Unit => f #align ordinal.deriv Ordinal.deriv theorem deriv_eq_derivFamily (f : Ordinal → Ordinal) : deriv f = derivFamily fun _ : Unit => f := rfl #align ordinal.deriv_eq_deriv_family Ordinal.deriv_eq_derivFamily @[simp] theorem deriv_zero (f) : deriv f 0 = nfp f 0 := derivFamily_zero _ #align ordinal.deriv_zero Ordinal.deriv_zero @[simp] theorem deriv_succ (f o) : deriv f (succ o) = nfp f (succ (deriv f o)) := derivFamily_succ _ _ #align ordinal.deriv_succ Ordinal.deriv_succ theorem deriv_limit (f) {o} : IsLimit o → deriv f o = bsup.{u, 0} o fun a _ => deriv f a := derivFamily_limit _ #align ordinal.deriv_limit Ordinal.deriv_limit theorem deriv_isNormal (f) : IsNormal (deriv f) := derivFamily_isNormal _ #align ordinal.deriv_is_normal Ordinal.deriv_isNormal theorem deriv_id_of_nfp_id {f : Ordinal → Ordinal} (h : nfp f = id) : deriv f = id := ((deriv_isNormal _).eq_iff_zero_and_succ IsNormal.refl).2 (by simp [h]) #align ordinal.deriv_id_of_nfp_id Ordinal.deriv_id_of_nfp_id theorem IsNormal.deriv_fp {f} (H : IsNormal f) : ∀ o, f (deriv f o) = deriv f o := @derivFamily_fp Unit (fun _ => f) Unit.unit H #align ordinal.is_normal.deriv_fp Ordinal.IsNormal.deriv_fp theorem IsNormal.le_iff_deriv {f} (H : IsNormal f) {a} : f a ≤ a ↔ ∃ o, deriv f o = a := by unfold deriv rw [← le_iff_derivFamily fun _ : Unit => H] exact ⟨fun h _ => h, fun h => h Unit.unit⟩ #align ordinal.is_normal.le_iff_deriv Ordinal.IsNormal.le_iff_deriv theorem IsNormal.fp_iff_deriv {f} (H : IsNormal f) {a} : f a = a ↔ ∃ o, deriv f o = a := by rw [← H.le_iff_eq, H.le_iff_deriv] #align ordinal.is_normal.fp_iff_deriv Ordinal.IsNormal.fp_iff_deriv theorem deriv_eq_enumOrd (H : IsNormal f) : deriv f = enumOrd (Function.fixedPoints f) := by convert derivFamily_eq_enumOrd fun _ : Unit => H exact (Set.iInter_const _).symm #align ordinal.deriv_eq_enum_ord Ordinal.deriv_eq_enumOrd theorem deriv_eq_id_of_nfp_eq_id {f : Ordinal → Ordinal} (h : nfp f = id) : deriv f = id := (IsNormal.eq_iff_zero_and_succ (deriv_isNormal _) IsNormal.refl).2 <| by simp [h] #align ordinal.deriv_eq_id_of_nfp_eq_id Ordinal.deriv_eq_id_of_nfp_eq_id end @[simp] theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat] congr; funext n induction' n with n hn · rw [Nat.cast_zero, mul_zero, iterate_zero_apply] · rw [iterate_succ_apply', Nat.add_comm, Nat.cast_add, Nat.cast_one, mul_one_add, hn] #align ordinal.nfp_add_zero Ordinal.nfp_add_zero theorem nfp_add_eq_mul_omega {a b} (hba : b ≤ a * omega) : nfp (a + ·) b = a * omega := by apply le_antisymm (nfp_le_fp (add_isNormal a).monotone hba _) · rw [← nfp_add_zero] exact nfp_monotone (add_isNormal a).monotone (Ordinal.zero_le b) · dsimp; rw [← mul_one_add, one_add_omega] #align ordinal.nfp_add_eq_mul_omega Ordinal.nfp_add_eq_mul_omega theorem add_eq_right_iff_mul_omega_le {a b : Ordinal} : a + b = b ↔ a * omega ≤ b := by refine ⟨fun h => ?_, fun h => ?_⟩ · rw [← nfp_add_zero a, ← deriv_zero] cases' (add_isNormal a).fp_iff_deriv.1 h with c hc rw [← hc] exact (deriv_isNormal _).monotone (Ordinal.zero_le _) · have := Ordinal.add_sub_cancel_of_le h nth_rw 1 [← this] rwa [← add_assoc, ← mul_one_add, one_add_omega] #align ordinal.add_eq_right_iff_mul_omega_le Ordinal.add_eq_right_iff_mul_omega_le theorem add_le_right_iff_mul_omega_le {a b : Ordinal} : a + b ≤ b ↔ a * omega ≤ b := by rw [← add_eq_right_iff_mul_omega_le] exact (add_isNormal a).le_iff_eq #align ordinal.add_le_right_iff_mul_omega_le Ordinal.add_le_right_iff_mul_omega_le theorem deriv_add_eq_mul_omega_add (a b : Ordinal.{u}) : deriv (a + ·) b = a * omega + b := by revert b rw [← funext_iff, IsNormal.eq_iff_zero_and_succ (deriv_isNormal _) (add_isNormal _)] refine ⟨?_, fun a h => ?_⟩ · rw [deriv_zero, add_zero] exact nfp_add_zero a · rw [deriv_succ, h, add_succ] exact nfp_eq_self (add_eq_right_iff_mul_omega_le.2 ((le_add_right _ _).trans (le_succ _))) #align ordinal.deriv_add_eq_mul_omega_add Ordinal.deriv_add_eq_mul_omega_add -- Porting note: commented out, doesn't seem necessary -- local infixr:0 "^" => @Pow.pow Ordinal Ordinal Ordinal.hasPow @[simp] theorem nfp_mul_one {a : Ordinal} (ha : 0 < a) : nfp (a * ·) 1 = (a^omega) := by rw [← sup_iterate_eq_nfp, ← sup_opow_nat] · dsimp congr funext n induction' n with n hn · rw [Nat.cast_zero, opow_zero, iterate_zero_apply] rw [iterate_succ_apply', Nat.add_comm, Nat.cast_add, Nat.cast_one, opow_add, opow_one, hn] · exact ha #align ordinal.nfp_mul_one Ordinal.nfp_mul_one @[simp] theorem nfp_mul_zero (a : Ordinal) : nfp (a * ·) 0 = 0 := by rw [← Ordinal.le_zero, nfp_le_iff] intro n induction' n with n hn; · rfl dsimp only; rwa [iterate_succ_apply, mul_zero] #align ordinal.nfp_mul_zero Ordinal.nfp_mul_zero @[simp] theorem nfp_zero_mul : nfp (HMul.hMul 0) = id := by rw [← sup_iterate_eq_nfp] refine funext fun a => (sup_le fun n => ?_).antisymm (le_sup (fun n => (0 * ·)^[n] a) 0) induction' n with n _ · rfl rw [Function.iterate_succ'] change 0 * _ ≤ a rw [zero_mul] exact Ordinal.zero_le a #align ordinal.nfp_zero_mul Ordinal.nfp_zero_mul @[simp] theorem deriv_mul_zero : deriv (HMul.hMul 0) = id := deriv_eq_id_of_nfp_eq_id nfp_zero_mul #align ordinal.deriv_mul_zero Ordinal.deriv_mul_zero
Mathlib/SetTheory/Ordinal/FixedPoint.lean
648
658
theorem nfp_mul_eq_opow_omega {a b : Ordinal} (hb : 0 < b) (hba : b ≤ (a^omega)) : nfp (a * ·) b = (a^omega.{u}) := by
rcases eq_zero_or_pos a with ha | ha · rw [ha, zero_opow omega_ne_zero] at hba ⊢ rw [Ordinal.le_zero.1 hba, nfp_zero_mul] rfl apply le_antisymm · apply nfp_le_fp (mul_isNormal ha).monotone hba rw [← opow_one_add, one_add_omega] rw [← nfp_mul_one ha] exact nfp_monotone (mul_isNormal ha).monotone (one_le_iff_pos.2 hb)
import Mathlib.Algebra.Module.Submodule.Ker #align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" variable {R : Type*} {R₂ : Type*} variable {M : Type*} {M₂ : Type*} namespace LinearMap section AddCommMonoid variable [Semiring R] [Semiring R₂] variable [AddCommMonoid M] [AddCommMonoid M₂] variable [Module R M] [Module R₂ M₂] open Submodule variable {τ₁₂ : R →+* R₂} section variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂] def eqLocus (f g : F) : Submodule R M := { (f : M →+ M₂).eqLocusM g with carrier := { x | f x = g x } smul_mem' := fun {r} {x} (hx : _ = _) => show _ = _ by -- Note: #8386 changed `map_smulₛₗ` into `map_smulₛₗ _` simpa only [map_smulₛₗ _] using congr_arg (τ₁₂ r • ·) hx } #align linear_map.eq_locus LinearMap.eqLocus @[simp] theorem mem_eqLocus {x : M} {f g : F} : x ∈ eqLocus f g ↔ f x = g x := Iff.rfl #align linear_map.mem_eq_locus LinearMap.mem_eqLocus theorem eqLocus_toAddSubmonoid (f g : F) : (eqLocus f g).toAddSubmonoid = (f : M →+ M₂).eqLocusM g := rfl #align linear_map.eq_locus_to_add_submonoid LinearMap.eqLocus_toAddSubmonoid @[simp]
Mathlib/Algebra/Module/Submodule/EqLocus.lean
64
65
theorem eqLocus_eq_top {f g : F} : eqLocus f g = ⊤ ↔ f = g := by
simp [SetLike.ext_iff, DFunLike.ext_iff]
import Mathlib.MeasureTheory.Measure.Content import Mathlib.MeasureTheory.Group.Prod import Mathlib.Topology.Algebra.Group.Compact #align_import measure_theory.measure.haar.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Set Inv Function TopologicalSpace MeasurableSpace open scoped NNReal Classical ENNReal Pointwise Topology namespace MeasureTheory namespace Measure section Group variable {G : Type*} [Group G] namespace haar -- Porting note: Even in `noncomputable section`, a definition with `to_additive` require -- `noncomputable` to generate an additive definition. -- Please refer to leanprover/lean4#2077. @[to_additive addIndex "additive version of `MeasureTheory.Measure.haar.index`"] noncomputable def index (K V : Set G) : ℕ := sInf <| Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } #align measure_theory.measure.haar.index MeasureTheory.Measure.haar.index #align measure_theory.measure.haar.add_index MeasureTheory.Measure.haar.addIndex @[to_additive addIndex_empty] theorem index_empty {V : Set G} : index ∅ V = 0 := by simp only [index, Nat.sInf_eq_zero]; left; use ∅ simp only [Finset.card_empty, empty_subset, mem_setOf_eq, eq_self_iff_true, and_self_iff] #align measure_theory.measure.haar.index_empty MeasureTheory.Measure.haar.index_empty #align measure_theory.measure.haar.add_index_empty MeasureTheory.Measure.haar.addIndex_empty variable [TopologicalSpace G] @[to_additive "additive version of `MeasureTheory.Measure.haar.prehaar`"] noncomputable def prehaar (K₀ U : Set G) (K : Compacts G) : ℝ := (index (K : Set G) U : ℝ) / index K₀ U #align measure_theory.measure.haar.prehaar MeasureTheory.Measure.haar.prehaar #align measure_theory.measure.haar.add_prehaar MeasureTheory.Measure.haar.addPrehaar @[to_additive] theorem prehaar_empty (K₀ : PositiveCompacts G) {U : Set G} : prehaar (K₀ : Set G) U ⊥ = 0 := by rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div] #align measure_theory.measure.haar.prehaar_empty MeasureTheory.Measure.haar.prehaar_empty #align measure_theory.measure.haar.add_prehaar_empty MeasureTheory.Measure.haar.addPrehaar_empty @[to_additive] theorem prehaar_nonneg (K₀ : PositiveCompacts G) {U : Set G} (K : Compacts G) : 0 ≤ prehaar (K₀ : Set G) U K := by apply div_nonneg <;> norm_cast <;> apply zero_le #align measure_theory.measure.haar.prehaar_nonneg MeasureTheory.Measure.haar.prehaar_nonneg #align measure_theory.measure.haar.add_prehaar_nonneg MeasureTheory.Measure.haar.addPrehaar_nonneg @[to_additive "additive version of `MeasureTheory.Measure.haar.haarProduct`"] def haarProduct (K₀ : Set G) : Set (Compacts G → ℝ) := pi univ fun K => Icc 0 <| index (K : Set G) K₀ #align measure_theory.measure.haar.haar_product MeasureTheory.Measure.haar.haarProduct #align measure_theory.measure.haar.add_haar_product MeasureTheory.Measure.haar.addHaarProduct @[to_additive (attr := simp)] theorem mem_prehaar_empty {K₀ : Set G} {f : Compacts G → ℝ} : f ∈ haarProduct K₀ ↔ ∀ K : Compacts G, f K ∈ Icc (0 : ℝ) (index (K : Set G) K₀) := by simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_setOf_eq] #align measure_theory.measure.haar.mem_prehaar_empty MeasureTheory.Measure.haar.mem_prehaar_empty #align measure_theory.measure.haar.mem_add_prehaar_empty MeasureTheory.Measure.haar.mem_addPrehaar_empty @[to_additive "additive version of `MeasureTheory.Measure.haar.clPrehaar`"] def clPrehaar (K₀ : Set G) (V : OpenNhdsOf (1 : G)) : Set (Compacts G → ℝ) := closure <| prehaar K₀ '' { U : Set G | U ⊆ V.1 ∧ IsOpen U ∧ (1 : G) ∈ U } #align measure_theory.measure.haar.cl_prehaar MeasureTheory.Measure.haar.clPrehaar #align measure_theory.measure.haar.cl_add_prehaar MeasureTheory.Measure.haar.clAddPrehaar variable [TopologicalGroup G] @[to_additive addIndex_defined "If `K` is compact and `V` has nonempty interior, then the index `(K : V)` is well-defined, there is a finite set `t` satisfying the desired properties."] theorem index_defined {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : ∃ n : ℕ, n ∈ Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } := by rcases compact_covered_by_mul_left_translates hK hV with ⟨t, ht⟩; exact ⟨t.card, t, ht, rfl⟩ #align measure_theory.measure.haar.index_defined MeasureTheory.Measure.haar.index_defined #align measure_theory.measure.haar.add_index_defined MeasureTheory.Measure.haar.addIndex_defined @[to_additive addIndex_elim] theorem index_elim {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : ∃ t : Finset G, (K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V) ∧ Finset.card t = index K V := by have := Nat.sInf_mem (index_defined hK hV); rwa [mem_image] at this #align measure_theory.measure.haar.index_elim MeasureTheory.Measure.haar.index_elim #align measure_theory.measure.haar.add_index_elim MeasureTheory.Measure.haar.addIndex_elim @[to_additive le_addIndex_mul] theorem le_index_mul (K₀ : PositiveCompacts G) (K : Compacts G) {V : Set G} (hV : (interior V).Nonempty) : index (K : Set G) V ≤ index (K : Set G) K₀ * index (K₀ : Set G) V := by obtain ⟨s, h1s, h2s⟩ := index_elim K.isCompact K₀.interior_nonempty obtain ⟨t, h1t, h2t⟩ := index_elim K₀.isCompact hV rw [← h2s, ← h2t, mul_comm] refine le_trans ?_ Finset.card_mul_le apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq]; refine Subset.trans h1s ?_ apply iUnion₂_subset; intro g₁ hg₁; rw [preimage_subset_iff]; intro g₂ hg₂ have := h1t hg₂ rcases this with ⟨_, ⟨g₃, rfl⟩, A, ⟨hg₃, rfl⟩, h2V⟩; rw [mem_preimage, ← mul_assoc] at h2V exact mem_biUnion (Finset.mul_mem_mul hg₃ hg₁) h2V #align measure_theory.measure.haar.le_index_mul MeasureTheory.Measure.haar.le_index_mul #align measure_theory.measure.haar.le_add_index_mul MeasureTheory.Measure.haar.le_addIndex_mul @[to_additive addIndex_pos] theorem index_pos (K : PositiveCompacts G) {V : Set G} (hV : (interior V).Nonempty) : 0 < index (K : Set G) V := by unfold index; rw [Nat.sInf_def, Nat.find_pos, mem_image] · rintro ⟨t, h1t, h2t⟩; rw [Finset.card_eq_zero] at h2t; subst h2t obtain ⟨g, hg⟩ := K.interior_nonempty show g ∈ (∅ : Set G) convert h1t (interior_subset hg); symm simp only [Finset.not_mem_empty, iUnion_of_empty, iUnion_empty] · exact index_defined K.isCompact hV #align measure_theory.measure.haar.index_pos MeasureTheory.Measure.haar.index_pos #align measure_theory.measure.haar.add_index_pos MeasureTheory.Measure.haar.addIndex_pos @[to_additive addIndex_mono] theorem index_mono {K K' V : Set G} (hK' : IsCompact K') (h : K ⊆ K') (hV : (interior V).Nonempty) : index K V ≤ index K' V := by rcases index_elim hK' hV with ⟨s, h1s, h2s⟩ apply Nat.sInf_le; rw [mem_image]; exact ⟨s, Subset.trans h h1s, h2s⟩ #align measure_theory.measure.haar.index_mono MeasureTheory.Measure.haar.index_mono #align measure_theory.measure.haar.add_index_mono MeasureTheory.Measure.haar.addIndex_mono @[to_additive addIndex_union_le] theorem index_union_le (K₁ K₂ : Compacts G) {V : Set G} (hV : (interior V).Nonempty) : index (K₁.1 ∪ K₂.1) V ≤ index K₁.1 V + index K₂.1 V := by rcases index_elim K₁.2 hV with ⟨s, h1s, h2s⟩ rcases index_elim K₂.2 hV with ⟨t, h1t, h2t⟩ rw [← h2s, ← h2t] refine le_trans ?_ (Finset.card_union_le _ _) apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq] apply union_subset <;> refine Subset.trans (by assumption) ?_ <;> apply biUnion_subset_biUnion_left <;> intro g hg <;> simp only [mem_def] at hg <;> simp only [mem_def, Multiset.mem_union, Finset.union_val, hg, or_true_iff, true_or_iff] #align measure_theory.measure.haar.index_union_le MeasureTheory.Measure.haar.index_union_le #align measure_theory.measure.haar.add_index_union_le MeasureTheory.Measure.haar.addIndex_union_le @[to_additive addIndex_union_eq] theorem index_union_eq (K₁ K₂ : Compacts G) {V : Set G} (hV : (interior V).Nonempty) (h : Disjoint (K₁.1 * V⁻¹) (K₂.1 * V⁻¹)) : index (K₁.1 ∪ K₂.1) V = index K₁.1 V + index K₂.1 V := by apply le_antisymm (index_union_le K₁ K₂ hV) rcases index_elim (K₁.2.union K₂.2) hV with ⟨s, h1s, h2s⟩; rw [← h2s] have : ∀ K : Set G, (K ⊆ ⋃ g ∈ s, (fun h => g * h) ⁻¹' V) → index K V ≤ (s.filter fun g => ((fun h : G => g * h) ⁻¹' V ∩ K).Nonempty).card := by intro K hK; apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq] intro g hg; rcases hK hg with ⟨_, ⟨g₀, rfl⟩, _, ⟨h1g₀, rfl⟩, h2g₀⟩ simp only [mem_preimage] at h2g₀ simp only [mem_iUnion]; use g₀; constructor; swap · simp only [Finset.mem_filter, h1g₀, true_and_iff]; use g simp only [hg, h2g₀, mem_inter_iff, mem_preimage, and_self_iff] exact h2g₀ refine le_trans (add_le_add (this K₁.1 <| Subset.trans subset_union_left h1s) (this K₂.1 <| Subset.trans subset_union_right h1s)) ?_ rw [← Finset.card_union_of_disjoint, Finset.filter_union_right] · exact s.card_filter_le _ apply Finset.disjoint_filter.mpr rintro g₁ _ ⟨g₂, h1g₂, h2g₂⟩ ⟨g₃, h1g₃, h2g₃⟩ simp only [mem_preimage] at h1g₃ h1g₂ refine h.le_bot (?_ : g₁⁻¹ ∈ _) constructor <;> simp only [Set.mem_inv, Set.mem_mul, exists_exists_and_eq_and, exists_and_left] · refine ⟨_, h2g₂, (g₁ * g₂)⁻¹, ?_, ?_⟩ · simp only [inv_inv, h1g₂] · simp only [mul_inv_rev, mul_inv_cancel_left] · refine ⟨_, h2g₃, (g₁ * g₃)⁻¹, ?_, ?_⟩ · simp only [inv_inv, h1g₃] · simp only [mul_inv_rev, mul_inv_cancel_left] #align measure_theory.measure.haar.index_union_eq MeasureTheory.Measure.haar.index_union_eq #align measure_theory.measure.haar.add_index_union_eq MeasureTheory.Measure.haar.addIndex_union_eq @[to_additive add_left_addIndex_le] theorem mul_left_index_le {K : Set G} (hK : IsCompact K) {V : Set G} (hV : (interior V).Nonempty) (g : G) : index ((fun h => g * h) '' K) V ≤ index K V := by rcases index_elim hK hV with ⟨s, h1s, h2s⟩; rw [← h2s] apply Nat.sInf_le; rw [mem_image] refine ⟨s.map (Equiv.mulRight g⁻¹).toEmbedding, ?_, Finset.card_map _⟩ simp only [mem_setOf_eq]; refine Subset.trans (image_subset _ h1s) ?_ rintro _ ⟨g₁, ⟨_, ⟨g₂, rfl⟩, ⟨_, ⟨hg₂, rfl⟩, hg₁⟩⟩, rfl⟩ simp only [mem_preimage] at hg₁; simp only [exists_prop, mem_iUnion, Finset.mem_map, Equiv.coe_mulRight, exists_exists_and_eq_and, mem_preimage, Equiv.toEmbedding_apply] refine ⟨_, hg₂, ?_⟩; simp only [mul_assoc, hg₁, inv_mul_cancel_left] #align measure_theory.measure.haar.mul_left_index_le MeasureTheory.Measure.haar.mul_left_index_le #align measure_theory.measure.haar.add_left_add_index_le MeasureTheory.Measure.haar.add_left_addIndex_le @[to_additive is_left_invariant_addIndex]
Mathlib/MeasureTheory/Measure/Haar/Basic.lean
288
292
theorem is_left_invariant_index {K : Set G} (hK : IsCompact K) (g : G) {V : Set G} (hV : (interior V).Nonempty) : index ((fun h => g * h) '' K) V = index K V := by
refine le_antisymm (mul_left_index_le hK hV g) ?_ convert mul_left_index_le (hK.image <| continuous_mul_left g) hV g⁻¹ rw [image_image]; symm; convert image_id' _ with h; apply inv_mul_cancel_left
import Mathlib.Analysis.Quaternion import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series #align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm #align quaternion.exp_coe Quaternion.exp_coe
Mathlib/Analysis/NormedSpace/QuaternionExponential.lean
39
55
theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf
import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Pointwise #align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Metric variable {𝕜 : Type*} [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E] theorem RCLike.norm_coe_norm {z : E} : ‖(‖z‖ : 𝕜)‖ = ‖z‖ := by simp #align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm variable [NormedSpace 𝕜 E] @[simp]
Mathlib/Analysis/NormedSpace/RCLike.lean
43
45
theorem norm_smul_inv_norm {x : E} (hx : x ≠ 0) : ‖(‖x‖⁻¹ : 𝕜) • x‖ = 1 := by
have : ‖x‖ ≠ 0 := by simp [hx] field_simp [norm_smul]
import Mathlib.MeasureTheory.Measure.Dirac set_option autoImplicit true open Set open scoped ENNReal Classical variable [MeasurableSpace α] [MeasurableSpace β] {s : Set α} noncomputable section namespace MeasureTheory.Measure def count : Measure α := sum dirac #align measure_theory.measure.count MeasureTheory.Measure.count theorem le_count_apply : ∑' _ : s, (1 : ℝ≥0∞) ≤ count s := calc (∑' _ : s, 1 : ℝ≥0∞) = ∑' i, indicator s 1 i := tsum_subtype s 1 _ ≤ ∑' i, dirac i s := ENNReal.tsum_le_tsum fun _ => le_dirac_apply _ ≤ count s := le_sum_apply _ _ #align measure_theory.measure.le_count_apply MeasureTheory.Measure.le_count_apply theorem count_apply (hs : MeasurableSet s) : count s = ∑' i : s, 1 := by simp only [count, sum_apply, hs, dirac_apply', ← tsum_subtype s (1 : α → ℝ≥0∞), Pi.one_apply] #align measure_theory.measure.count_apply MeasureTheory.Measure.count_apply -- @[simp] -- Porting note (#10618): simp can prove this theorem count_empty : count (∅ : Set α) = 0 := by rw [count_apply MeasurableSet.empty, tsum_empty] #align measure_theory.measure.count_empty MeasureTheory.Measure.count_empty @[simp] theorem count_apply_finset' {s : Finset α} (s_mble : MeasurableSet (s : Set α)) : count (↑s : Set α) = s.card := calc count (↑s : Set α) = ∑' i : (↑s : Set α), 1 := count_apply s_mble _ = ∑ i ∈ s, 1 := s.tsum_subtype 1 _ = s.card := by simp #align measure_theory.measure.count_apply_finset' MeasureTheory.Measure.count_apply_finset' @[simp] theorem count_apply_finset [MeasurableSingletonClass α] (s : Finset α) : count (↑s : Set α) = s.card := count_apply_finset' s.measurableSet #align measure_theory.measure.count_apply_finset MeasureTheory.Measure.count_apply_finset theorem count_apply_finite' {s : Set α} (s_fin : s.Finite) (s_mble : MeasurableSet s) : count s = s_fin.toFinset.card := by simp [← @count_apply_finset' _ _ s_fin.toFinset (by simpa only [Finite.coe_toFinset] using s_mble)] #align measure_theory.measure.count_apply_finite' MeasureTheory.Measure.count_apply_finite' theorem count_apply_finite [MeasurableSingletonClass α] (s : Set α) (hs : s.Finite) : count s = hs.toFinset.card := by rw [← count_apply_finset, Finite.coe_toFinset] #align measure_theory.measure.count_apply_finite MeasureTheory.Measure.count_apply_finite theorem count_apply_infinite (hs : s.Infinite) : count s = ∞ := by refine top_unique (le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n => ?_) rcases hs.exists_subset_card_eq n with ⟨t, ht, rfl⟩ calc (t.card : ℝ≥0∞) = ∑ i ∈ t, 1 := by simp _ = ∑' i : (t : Set α), 1 := (t.tsum_subtype 1).symm _ ≤ count (t : Set α) := le_count_apply _ ≤ count s := measure_mono ht #align measure_theory.measure.count_apply_infinite MeasureTheory.Measure.count_apply_infinite @[simp] theorem count_apply_eq_top' (s_mble : MeasurableSet s) : count s = ∞ ↔ s.Infinite := by by_cases hs : s.Finite · simp [Set.Infinite, hs, count_apply_finite' hs s_mble] · change s.Infinite at hs simp [hs, count_apply_infinite] #align measure_theory.measure.count_apply_eq_top' MeasureTheory.Measure.count_apply_eq_top' @[simp] theorem count_apply_eq_top [MeasurableSingletonClass α] : count s = ∞ ↔ s.Infinite := by by_cases hs : s.Finite · exact count_apply_eq_top' hs.measurableSet · change s.Infinite at hs simp [hs, count_apply_infinite] #align measure_theory.measure.count_apply_eq_top MeasureTheory.Measure.count_apply_eq_top @[simp] theorem count_apply_lt_top' (s_mble : MeasurableSet s) : count s < ∞ ↔ s.Finite := calc count s < ∞ ↔ count s ≠ ∞ := lt_top_iff_ne_top _ ↔ ¬s.Infinite := not_congr (count_apply_eq_top' s_mble) _ ↔ s.Finite := Classical.not_not #align measure_theory.measure.count_apply_lt_top' MeasureTheory.Measure.count_apply_lt_top' @[simp] theorem count_apply_lt_top [MeasurableSingletonClass α] : count s < ∞ ↔ s.Finite := calc count s < ∞ ↔ count s ≠ ∞ := lt_top_iff_ne_top _ ↔ ¬s.Infinite := not_congr count_apply_eq_top _ ↔ s.Finite := Classical.not_not #align measure_theory.measure.count_apply_lt_top MeasureTheory.Measure.count_apply_lt_top theorem empty_of_count_eq_zero' (s_mble : MeasurableSet s) (hsc : count s = 0) : s = ∅ := by have hs : s.Finite := by rw [← count_apply_lt_top' s_mble, hsc] exact WithTop.zero_lt_top simpa [count_apply_finite' hs s_mble] using hsc #align measure_theory.measure.empty_of_count_eq_zero' MeasureTheory.Measure.empty_of_count_eq_zero' theorem empty_of_count_eq_zero [MeasurableSingletonClass α] (hsc : count s = 0) : s = ∅ := by have hs : s.Finite := by rw [← count_apply_lt_top, hsc] exact WithTop.zero_lt_top simpa [count_apply_finite _ hs] using hsc #align measure_theory.measure.empty_of_count_eq_zero MeasureTheory.Measure.empty_of_count_eq_zero @[simp] theorem count_eq_zero_iff' (s_mble : MeasurableSet s) : count s = 0 ↔ s = ∅ := ⟨empty_of_count_eq_zero' s_mble, fun h => h.symm ▸ count_empty⟩ #align measure_theory.measure.count_eq_zero_iff' MeasureTheory.Measure.count_eq_zero_iff' @[simp] theorem count_eq_zero_iff [MeasurableSingletonClass α] : count s = 0 ↔ s = ∅ := ⟨empty_of_count_eq_zero, fun h => h.symm ▸ count_empty⟩ #align measure_theory.measure.count_eq_zero_iff MeasureTheory.Measure.count_eq_zero_iff theorem count_ne_zero' (hs' : s.Nonempty) (s_mble : MeasurableSet s) : count s ≠ 0 := by rw [Ne, count_eq_zero_iff' s_mble] exact hs'.ne_empty #align measure_theory.measure.count_ne_zero' MeasureTheory.Measure.count_ne_zero' theorem count_ne_zero [MeasurableSingletonClass α] (hs' : s.Nonempty) : count s ≠ 0 := by rw [Ne, count_eq_zero_iff] exact hs'.ne_empty #align measure_theory.measure.count_ne_zero MeasureTheory.Measure.count_ne_zero @[simp] theorem count_singleton' {a : α} (ha : MeasurableSet ({a} : Set α)) : count ({a} : Set α) = 1 := by rw [count_apply_finite' (Set.finite_singleton a) ha, Set.Finite.toFinset] simp [@toFinset_card _ _ (Set.finite_singleton a).fintype, @Fintype.card_unique _ _ (Set.finite_singleton a).fintype] #align measure_theory.measure.count_singleton' MeasureTheory.Measure.count_singleton' -- @[simp] -- Porting note (#10618): simp can prove this theorem count_singleton [MeasurableSingletonClass α] (a : α) : count ({a} : Set α) = 1 := count_singleton' (measurableSet_singleton a) #align measure_theory.measure.count_singleton MeasureTheory.Measure.count_singleton theorem count_injective_image' {f : β → α} (hf : Function.Injective f) {s : Set β} (s_mble : MeasurableSet s) (fs_mble : MeasurableSet (f '' s)) : count (f '' s) = count s := by by_cases hs : s.Finite · lift s to Finset β using hs rw [← Finset.coe_image, count_apply_finset' _, count_apply_finset' s_mble, s.card_image_of_injective hf] simpa only [Finset.coe_image] using fs_mble · rw [count_apply_infinite hs] rw [← finite_image_iff hf.injOn] at hs rw [count_apply_infinite hs] #align measure_theory.measure.count_injective_image' MeasureTheory.Measure.count_injective_image'
Mathlib/MeasureTheory/Measure/Count.lean
173
179
theorem count_injective_image [MeasurableSingletonClass α] [MeasurableSingletonClass β] {f : β → α} (hf : Function.Injective f) (s : Set β) : count (f '' s) = count s := by
by_cases hs : s.Finite · exact count_injective_image' hf hs.measurableSet (Finite.image f hs).measurableSet rw [count_apply_infinite hs] rw [← finite_image_iff hf.injOn] at hs rw [count_apply_infinite hs]
import Mathlib.Geometry.RingedSpace.PresheafedSpace import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.Topology.Sheaves.Limits import Mathlib.CategoryTheory.ConcreteCategory.Elementwise #align_import algebraic_geometry.presheafed_space.has_colimits from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" noncomputable section universe v' u' v u open CategoryTheory Opposite CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits TopCat TopCat.Presheaf TopologicalSpace variable {J : Type u'} [Category.{v'} J] {C : Type u} [Category.{v} C] namespace AlgebraicGeometry namespace PresheafedSpace attribute [local simp] eqToHom_map -- Porting note: we used to have: -- local attribute [tidy] tactic.auto_cases_opens -- We would replace this by: -- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens -- although it doesn't appear to help in this file, in any case. @[simp]
Mathlib/Geometry/RingedSpace/PresheafedSpace/HasColimits.lean
59
65
theorem map_id_c_app (F : J ⥤ PresheafedSpace.{_, _, v} C) (j) (U) : (F.map (𝟙 j)).c.app (op U) = (Pushforward.id (F.obj j).presheaf).inv.app (op U) ≫ (pushforwardEq (by simp) (F.obj j).presheaf).hom.app (op U) := by
cases U simp [PresheafedSpace.congr_app (F.map_id j)]
import Mathlib.Algebra.Group.Prod import Mathlib.Data.Set.Lattice #align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" assert_not_exists MonoidWithZero open Prod Decidable Function namespace Nat -- Porting note: no pp_nodot --@[pp_nodot] def pair (a b : ℕ) : ℕ := if a < b then b * b + a else a * a + a + b #align nat.mkpair Nat.pair -- Porting note: no pp_nodot --@[pp_nodot] def unpair (n : ℕ) : ℕ × ℕ := let s := sqrt n if n - s * s < s then (n - s * s, s) else (s, n - s * s - s) #align nat.unpair Nat.unpair @[simp] theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by dsimp only [unpair]; let s := sqrt n have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _) split_ifs with h · simp [pair, h, sm] · have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2 (Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add) simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm] #align nat.mkpair_unpair Nat.pair_unpair theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by simpa [H] using pair_unpair n #align nat.mkpair_unpair' Nat.pair_unpair' @[simp] theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by dsimp only [pair]; split_ifs with h · show unpair (b * b + a) = (a, b) have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _)) simp [unpair, be, Nat.add_sub_cancel_left, h] · show unpair (a * a + a + b) = (a, b) have ae : sqrt (a * a + (a + b)) = a := by rw [sqrt_add_eq] exact Nat.add_le_add_left (le_of_not_gt h) _ simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left] #align nat.unpair_mkpair Nat.unpair_pair @[simps (config := .asFn)] def pairEquiv : ℕ × ℕ ≃ ℕ := ⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩ #align nat.mkpair_equiv Nat.pairEquiv #align nat.mkpair_equiv_apply Nat.pairEquiv_apply #align nat.mkpair_equiv_symm_apply Nat.pairEquiv_symm_apply theorem surjective_unpair : Surjective unpair := pairEquiv.symm.surjective #align nat.surjective_unpair Nat.surjective_unpair @[simp] theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d := pairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d)) #align nat.mkpair_eq_mkpair Nat.pair_eq_pair theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by let s := sqrt n simp only [unpair, ge_iff_le, Nat.sub_le_iff_le_add] by_cases h : n - s * s < s <;> simp [h] · exact lt_of_lt_of_le h (sqrt_le_self _) · simp at h have s0 : 0 < s := sqrt_pos.2 n1 exact lt_of_le_of_lt h (Nat.sub_lt n1 (Nat.mul_pos s0 s0)) #align nat.unpair_lt Nat.unpair_lt @[simp] theorem unpair_zero : unpair 0 = 0 := by rw [unpair] simp #align nat.unpair_zero Nat.unpair_zero theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n | 0 => by simp | n + 1 => le_of_lt (unpair_lt (Nat.succ_pos _)) #align nat.unpair_left_le Nat.unpair_left_le theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (pair a b) #align nat.left_le_mkpair Nat.left_le_pair
Mathlib/Data/Nat/Pairing.lean
117
119
theorem right_le_pair (a b : ℕ) : b ≤ pair a b := by
by_cases h : a < b <;> simp [pair, h] exact le_trans (le_mul_self _) (Nat.le_add_right _ _)
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Ring.Pi import Mathlib.GroupTheory.GroupAction.Pi #align_import algebra.big_operators.pi from "leanprover-community/mathlib"@"fa2309577c7009ea243cffdf990cd6c84f0ad497" @[to_additive (attr := simp)] theorem Finset.prod_apply {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (a : α) (s : Finset γ) (g : γ → ∀ a, β a) : (∏ c ∈ s, g c) a = ∏ c ∈ s, g c a := map_prod (Pi.evalMonoidHom β a) _ _ #align finset.prod_apply Finset.prod_apply #align finset.sum_apply Finset.sum_apply @[to_additive "An 'unapplied' analogue of `Finset.sum_apply`."] theorem Finset.prod_fn {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (s : Finset γ) (g : γ → ∀ a, β a) : ∏ c ∈ s, g c = fun a ↦ ∏ c ∈ s, g c a := funext fun _ ↦ Finset.prod_apply _ _ _ #align finset.prod_fn Finset.prod_fn #align finset.sum_fn Finset.sum_fn @[to_additive] theorem Fintype.prod_apply {α : Type*} {β : α → Type*} {γ : Type*} [Fintype γ] [∀ a, CommMonoid (β a)] (a : α) (g : γ → ∀ a, β a) : (∏ c, g c) a = ∏ c, g c a := Finset.prod_apply a Finset.univ g #align fintype.prod_apply Fintype.prod_apply #align fintype.sum_apply Fintype.sum_apply @[to_additive prod_mk_sum] theorem prod_mk_prod {α β γ : Type*} [CommMonoid α] [CommMonoid β] (s : Finset γ) (f : γ → α) (g : γ → β) : (∏ x ∈ s, f x, ∏ x ∈ s, g x) = ∏ x ∈ s, (f x, g x) := haveI := Classical.decEq γ Finset.induction_on s rfl (by simp (config := { contextual := true }) [Prod.ext_iff]) #align prod_mk_prod prod_mk_prod #align prod_mk_sum prod_mk_sum theorem pi_eq_sum_univ {ι : Type*} [Fintype ι] [DecidableEq ι] {R : Type*} [Semiring R] (x : ι → R) : x = ∑ i, (x i) • fun j => if i = j then (1 : R) else 0 := by ext simp #align pi_eq_sum_univ pi_eq_sum_univ section MulSingle variable {I : Type*} [DecidableEq I] {Z : I → Type*} variable [∀ i, CommMonoid (Z i)] @[to_additive]
Mathlib/Algebra/BigOperators/Pi.lean
81
84
theorem Finset.univ_prod_mulSingle [Fintype I] (f : ∀ i, Z i) : (∏ i, Pi.mulSingle i (f i)) = f := by
ext a simp
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology namespace Real variable {ι : Type*} [Fintype ι] theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by haveI : IsAddLeftInvariant StieltjesFunction.id.measure := ⟨fun a => Eq.symm <| Real.measure_ext_Ioo_rat fun p q => by simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo, sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim, StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩ have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1 rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;> simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero, StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one] conv_rhs => rw [addHaarMeasure_unique StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A] simp only [volume, Basis.addHaar, one_smul] #align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by simp [volume_eq_stieltjes_id] #align real.volume_val Real.volume_val @[simp] theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ico Real.volume_Ico @[simp] theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Icc Real.volume_Icc @[simp] theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioo Real.volume_Ioo @[simp] theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioc Real.volume_Ioc -- @[simp] -- Porting note (#10618): simp can prove this theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp [volume_val] #align real.volume_singleton Real.volume_singleton -- @[simp] -- Porting note (#10618): simp can prove this, after mathlib4#4628 theorem volume_univ : volume (univ : Set ℝ) = ∞ := ENNReal.eq_top_of_forall_nnreal_le fun r => calc (r : ℝ≥0∞) = volume (Icc (0 : ℝ) r) := by simp _ ≤ volume univ := measure_mono (subset_univ _) #align real.volume_univ Real.volume_univ @[simp] theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel_left, two_mul] #align real.volume_ball Real.volume_ball @[simp]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
113
114
theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel_left, two_mul]
import Mathlib.MeasureTheory.Group.Measure import Mathlib.MeasureTheory.Integral.IntegrableOn import Mathlib.MeasureTheory.Function.LocallyIntegrable open Asymptotics MeasureTheory Set Filter variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α} theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l] (hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) : IntegrableAtFilter f l μ := by obtain ⟨C, hC⟩ := hf.bound obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ := (hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩ refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_ exact (hfg x hx).trans (le_abs_self _) theorem _root_.Asymptotics.IsBigO.integrable (hfm : AEStronglyMeasurable f μ) (hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by rewrite [← integrableAtFilter_top] at * exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg variable [TopologicalSpace α] [SecondCountableTopology α] namespace MeasureTheory theorem LocallyIntegrable.integrable_of_isBigO_cocompact [IsMeasurablyGenerated (cocompact α)] (hf : LocallyIntegrable f μ) (ho : f =O[cocompact α] g) (hg : IntegrableAtFilter g (cocompact α) μ) : Integrable f μ := by refine integrable_iff_integrableAtFilter_cocompact.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter section LinearOrder variable [LinearOrder α] [CompactIccSpace α] {g' : α → F} theorem LocallyIntegrable.integrable_of_isBigO_atBot_atTop [IsMeasurablyGenerated (atBot (α := α))] [IsMeasurablyGenerated (atTop (α := α))] (hf : LocallyIntegrable f μ) (ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ) (ho' : f =O[atTop] g') (hg' : IntegrableAtFilter g' atTop μ) : Integrable f μ := by refine integrable_iff_integrableAtFilter_atBot_atTop.mpr ⟨⟨ho.integrableAtFilter ?_ hg, ho'.integrableAtFilter ?_ hg'⟩, hf⟩ all_goals exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter theorem LocallyIntegrableOn.integrableOn_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))] (hf : LocallyIntegrableOn f (Iic a) μ) (ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ) : IntegrableOn f (Iic a) μ := by refine integrableOn_Iic_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact ⟨Iic a, Iic_mem_atBot a, hf.aestronglyMeasurable⟩ theorem LocallyIntegrableOn.integrableOn_of_isBigO_atTop [IsMeasurablyGenerated (atTop (α := α))] (hf : LocallyIntegrableOn f (Ici a) μ) (ho : f =O[atTop] g) (hg : IntegrableAtFilter g atTop μ) : IntegrableOn f (Ici a) μ := by refine integrableOn_Ici_iff_integrableAtFilter_atTop.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact ⟨Ici a, Ici_mem_atTop a, hf.aestronglyMeasurable⟩ theorem LocallyIntegrable.integrable_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))] [OrderTop α] (hf : LocallyIntegrable f μ) (ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ) : Integrable f μ := by refine integrable_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
Mathlib/MeasureTheory/Integral/Asymptotics.lean
105
109
theorem LocallyIntegrable.integrable_of_isBigO_atTop [IsMeasurablyGenerated (atTop (α := α))] [OrderBot α] (hf : LocallyIntegrable f μ) (ho : f =O[atTop] g) (hg : IntegrableAtFilter g atTop μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atTop.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
import Mathlib.SetTheory.Ordinal.Arithmetic import Mathlib.SetTheory.Ordinal.Exponential #align_import set_theory.ordinal.fixed_point from "leanprover-community/mathlib"@"0dd4319a17376eda5763cd0a7e0d35bbaaa50e83" noncomputable section universe u v open Function Order namespace Ordinal section variable {ι : Type u} {f : ι → Ordinal.{max u v} → Ordinal.{max u v}} def nfpFamily (f : ι → Ordinal → Ordinal) (a : Ordinal) : Ordinal := sup (List.foldr f a) #align ordinal.nfp_family Ordinal.nfpFamily theorem nfpFamily_eq_sup (f : ι → Ordinal.{max u v} → Ordinal.{max u v}) (a : Ordinal.{max u v}) : nfpFamily.{u, v} f a = sup.{u, v} (List.foldr f a) := rfl #align ordinal.nfp_family_eq_sup Ordinal.nfpFamily_eq_sup theorem foldr_le_nfpFamily (f : ι → Ordinal → Ordinal) (a l) : List.foldr f a l ≤ nfpFamily.{u, v} f a := le_sup.{u, v} _ _ #align ordinal.foldr_le_nfp_family Ordinal.foldr_le_nfpFamily theorem le_nfpFamily (f : ι → Ordinal → Ordinal) (a) : a ≤ nfpFamily f a := le_sup _ [] #align ordinal.le_nfp_family Ordinal.le_nfpFamily theorem lt_nfpFamily {a b} : a < nfpFamily.{u, v} f b ↔ ∃ l, a < List.foldr f b l := lt_sup.{u, v} #align ordinal.lt_nfp_family Ordinal.lt_nfpFamily theorem nfpFamily_le_iff {a b} : nfpFamily.{u, v} f a ≤ b ↔ ∀ l, List.foldr f a l ≤ b := sup_le_iff #align ordinal.nfp_family_le_iff Ordinal.nfpFamily_le_iff theorem nfpFamily_le {a b} : (∀ l, List.foldr f a l ≤ b) → nfpFamily.{u, v} f a ≤ b := sup_le.{u, v} #align ordinal.nfp_family_le Ordinal.nfpFamily_le theorem nfpFamily_monotone (hf : ∀ i, Monotone (f i)) : Monotone (nfpFamily.{u, v} f) := fun _ _ h => sup_le.{u, v} fun l => (List.foldr_monotone hf l h).trans (le_sup.{u, v} _ l) #align ordinal.nfp_family_monotone Ordinal.nfpFamily_monotone theorem apply_lt_nfpFamily (H : ∀ i, IsNormal (f i)) {a b} (hb : b < nfpFamily.{u, v} f a) (i) : f i b < nfpFamily.{u, v} f a := let ⟨l, hl⟩ := lt_nfpFamily.1 hb lt_sup.2 ⟨i::l, (H i).strictMono hl⟩ #align ordinal.apply_lt_nfp_family Ordinal.apply_lt_nfpFamily theorem apply_lt_nfpFamily_iff [Nonempty ι] (H : ∀ i, IsNormal (f i)) {a b} : (∀ i, f i b < nfpFamily.{u, v} f a) ↔ b < nfpFamily.{u, v} f a := ⟨fun h => lt_nfpFamily.2 <| let ⟨l, hl⟩ := lt_sup.1 <| h <| Classical.arbitrary ι ⟨l, ((H _).self_le b).trans_lt hl⟩, apply_lt_nfpFamily H⟩ #align ordinal.apply_lt_nfp_family_iff Ordinal.apply_lt_nfpFamily_iff theorem nfpFamily_le_apply [Nonempty ι] (H : ∀ i, IsNormal (f i)) {a b} : (∃ i, nfpFamily.{u, v} f a ≤ f i b) ↔ nfpFamily.{u, v} f a ≤ b := by rw [← not_iff_not] push_neg exact apply_lt_nfpFamily_iff H #align ordinal.nfp_family_le_apply Ordinal.nfpFamily_le_apply theorem nfpFamily_le_fp (H : ∀ i, Monotone (f i)) {a b} (ab : a ≤ b) (h : ∀ i, f i b ≤ b) : nfpFamily.{u, v} f a ≤ b := sup_le fun l => by by_cases hι : IsEmpty ι · rwa [Unique.eq_default l] · induction' l with i l IH generalizing a · exact ab exact (H i (IH ab)).trans (h i) #align ordinal.nfp_family_le_fp Ordinal.nfpFamily_le_fp theorem nfpFamily_fp {i} (H : IsNormal (f i)) (a) : f i (nfpFamily.{u, v} f a) = nfpFamily.{u, v} f a := by unfold nfpFamily rw [@IsNormal.sup.{u, v, v} _ H _ _ ⟨[]⟩] apply le_antisymm <;> refine Ordinal.sup_le fun l => ?_ · exact le_sup _ (i::l) · exact (H.self_le _).trans (le_sup _ _) #align ordinal.nfp_family_fp Ordinal.nfpFamily_fp theorem apply_le_nfpFamily [hι : Nonempty ι] {f : ι → Ordinal → Ordinal} (H : ∀ i, IsNormal (f i)) {a b} : (∀ i, f i b ≤ nfpFamily.{u, v} f a) ↔ b ≤ nfpFamily.{u, v} f a := by refine ⟨fun h => ?_, fun h i => ?_⟩ · cases' hι with i exact ((H i).self_le b).trans (h i) rw [← nfpFamily_fp (H i)] exact (H i).monotone h #align ordinal.apply_le_nfp_family Ordinal.apply_le_nfpFamily theorem nfpFamily_eq_self {f : ι → Ordinal → Ordinal} {a} (h : ∀ i, f i a = a) : nfpFamily f a = a := le_antisymm (sup_le fun l => by rw [List.foldr_fixed' h l]) <| le_nfpFamily f a #align ordinal.nfp_family_eq_self Ordinal.nfpFamily_eq_self -- Todo: This is actually a special case of the fact the intersection of club sets is a club set. theorem fp_family_unbounded (H : ∀ i, IsNormal (f i)) : (⋂ i, Function.fixedPoints (f i)).Unbounded (· < ·) := fun a => ⟨nfpFamily.{u, v} f a, fun s ⟨i, hi⟩ => by rw [← hi, mem_fixedPoints_iff] exact nfpFamily_fp.{u, v} (H i) a, (le_nfpFamily f a).not_lt⟩ #align ordinal.fp_family_unbounded Ordinal.fp_family_unbounded def derivFamily (f : ι → Ordinal → Ordinal) (o : Ordinal) : Ordinal := limitRecOn o (nfpFamily.{u, v} f 0) (fun _ IH => nfpFamily.{u, v} f (succ IH)) fun a _ => bsup.{max u v, u} a #align ordinal.deriv_family Ordinal.derivFamily @[simp] theorem derivFamily_zero (f : ι → Ordinal → Ordinal) : derivFamily.{u, v} f 0 = nfpFamily.{u, v} f 0 := limitRecOn_zero _ _ _ #align ordinal.deriv_family_zero Ordinal.derivFamily_zero @[simp] theorem derivFamily_succ (f : ι → Ordinal → Ordinal) (o) : derivFamily.{u, v} f (succ o) = nfpFamily.{u, v} f (succ (derivFamily.{u, v} f o)) := limitRecOn_succ _ _ _ _ #align ordinal.deriv_family_succ Ordinal.derivFamily_succ theorem derivFamily_limit (f : ι → Ordinal → Ordinal) {o} : IsLimit o → derivFamily.{u, v} f o = bsup.{max u v, u} o fun a _ => derivFamily.{u, v} f a := limitRecOn_limit _ _ _ _ #align ordinal.deriv_family_limit Ordinal.derivFamily_limit theorem derivFamily_isNormal (f : ι → Ordinal → Ordinal) : IsNormal (derivFamily f) := ⟨fun o => by rw [derivFamily_succ, ← succ_le_iff]; apply le_nfpFamily, fun o l a => by rw [derivFamily_limit _ l, bsup_le_iff]⟩ #align ordinal.deriv_family_is_normal Ordinal.derivFamily_isNormal theorem derivFamily_fp {i} (H : IsNormal (f i)) (o : Ordinal.{max u v}) : f i (derivFamily.{u, v} f o) = derivFamily.{u, v} f o := by induction' o using limitRecOn with o _ o l IH · rw [derivFamily_zero] exact nfpFamily_fp H 0 · rw [derivFamily_succ] exact nfpFamily_fp H _ · rw [derivFamily_limit _ l, IsNormal.bsup.{max u v, u, max u v} H (fun a _ => derivFamily f a) l.1] refine eq_of_forall_ge_iff fun c => ?_ simp (config := { contextual := true }) only [bsup_le_iff, IH] #align ordinal.deriv_family_fp Ordinal.derivFamily_fp theorem le_iff_derivFamily (H : ∀ i, IsNormal (f i)) {a} : (∀ i, f i a ≤ a) ↔ ∃ o, derivFamily.{u, v} f o = a := ⟨fun ha => by suffices ∀ (o) (_ : a ≤ derivFamily.{u, v} f o), ∃ o, derivFamily.{u, v} f o = a from this a ((derivFamily_isNormal _).self_le _) intro o induction' o using limitRecOn with o IH o l IH · intro h₁ refine ⟨0, le_antisymm ?_ h₁⟩ rw [derivFamily_zero] exact nfpFamily_le_fp (fun i => (H i).monotone) (Ordinal.zero_le _) ha · intro h₁ rcases le_or_lt a (derivFamily.{u, v} f o) with h | h · exact IH h refine ⟨succ o, le_antisymm ?_ h₁⟩ rw [derivFamily_succ] exact nfpFamily_le_fp (fun i => (H i).monotone) (succ_le_of_lt h) ha · intro h₁ cases' eq_or_lt_of_le h₁ with h h · exact ⟨_, h.symm⟩ rw [derivFamily_limit _ l, ← not_le, bsup_le_iff, not_forall₂] at h exact let ⟨o', h, hl⟩ := h IH o' h (le_of_not_le hl), fun ⟨o, e⟩ i => e ▸ (derivFamily_fp (H i) _).le⟩ #align ordinal.le_iff_deriv_family Ordinal.le_iff_derivFamily theorem fp_iff_derivFamily (H : ∀ i, IsNormal (f i)) {a} : (∀ i, f i a = a) ↔ ∃ o, derivFamily.{u, v} f o = a := Iff.trans ⟨fun h i => le_of_eq (h i), fun h i => (H i).le_iff_eq.1 (h i)⟩ (le_iff_derivFamily H) #align ordinal.fp_iff_deriv_family Ordinal.fp_iff_derivFamily theorem derivFamily_eq_enumOrd (H : ∀ i, IsNormal (f i)) : derivFamily.{u, v} f = enumOrd (⋂ i, Function.fixedPoints (f i)) := by rw [← eq_enumOrd _ (fp_family_unbounded.{u, v} H)] use (derivFamily_isNormal f).strictMono rw [Set.range_eq_iff] refine ⟨?_, fun a ha => ?_⟩ · rintro a S ⟨i, hi⟩ rw [← hi] exact derivFamily_fp (H i) a rw [Set.mem_iInter] at ha rwa [← fp_iff_derivFamily H] #align ordinal.deriv_family_eq_enum_ord Ordinal.derivFamily_eq_enumOrd end section variable {o : Ordinal.{u}} {f : ∀ b < o, Ordinal.{max u v} → Ordinal.{max u v}} def nfpBFamily (o : Ordinal) (f : ∀ b < o, Ordinal → Ordinal) : Ordinal → Ordinal := nfpFamily (familyOfBFamily o f) #align ordinal.nfp_bfamily Ordinal.nfpBFamily theorem nfpBFamily_eq_nfpFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) : nfpBFamily.{u, v} o f = nfpFamily.{u, v} (familyOfBFamily o f) := rfl #align ordinal.nfp_bfamily_eq_nfp_family Ordinal.nfpBFamily_eq_nfpFamily theorem foldr_le_nfpBFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) (a l) : List.foldr (familyOfBFamily o f) a l ≤ nfpBFamily.{u, v} o f a := le_sup.{u, v} _ _ #align ordinal.foldr_le_nfp_bfamily Ordinal.foldr_le_nfpBFamily theorem le_nfpBFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) (a) : a ≤ nfpBFamily.{u, v} o f a := le_sup.{u, v} _ [] #align ordinal.le_nfp_bfamily Ordinal.le_nfpBFamily theorem lt_nfpBFamily {a b} : a < nfpBFamily.{u, v} o f b ↔ ∃ l, a < List.foldr (familyOfBFamily o f) b l := lt_sup.{u, v} #align ordinal.lt_nfp_bfamily Ordinal.lt_nfpBFamily theorem nfpBFamily_le_iff {o : Ordinal} {f : ∀ b < o, Ordinal → Ordinal} {a b} : nfpBFamily.{u, v} o f a ≤ b ↔ ∀ l, List.foldr (familyOfBFamily o f) a l ≤ b := sup_le_iff.{u, v} #align ordinal.nfp_bfamily_le_iff Ordinal.nfpBFamily_le_iff theorem nfpBFamily_le {o : Ordinal} {f : ∀ b < o, Ordinal → Ordinal} {a b} : (∀ l, List.foldr (familyOfBFamily o f) a l ≤ b) → nfpBFamily.{u, v} o f a ≤ b := sup_le.{u, v} #align ordinal.nfp_bfamily_le Ordinal.nfpBFamily_le theorem nfpBFamily_monotone (hf : ∀ i hi, Monotone (f i hi)) : Monotone (nfpBFamily.{u, v} o f) := nfpFamily_monotone fun _ => hf _ _ #align ordinal.nfp_bfamily_monotone Ordinal.nfpBFamily_monotone theorem apply_lt_nfpBFamily (H : ∀ i hi, IsNormal (f i hi)) {a b} (hb : b < nfpBFamily.{u, v} o f a) (i hi) : f i hi b < nfpBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply apply_lt_nfpFamily (fun _ => H _ _) hb #align ordinal.apply_lt_nfp_bfamily Ordinal.apply_lt_nfpBFamily theorem apply_lt_nfpBFamily_iff (ho : o ≠ 0) (H : ∀ i hi, IsNormal (f i hi)) {a b} : (∀ i hi, f i hi b < nfpBFamily.{u, v} o f a) ↔ b < nfpBFamily.{u, v} o f a := ⟨fun h => by haveI := out_nonempty_iff_ne_zero.2 ho refine (apply_lt_nfpFamily_iff.{u, v} ?_).1 fun _ => h _ _ exact fun _ => H _ _, apply_lt_nfpBFamily H⟩ #align ordinal.apply_lt_nfp_bfamily_iff Ordinal.apply_lt_nfpBFamily_iff theorem nfpBFamily_le_apply (ho : o ≠ 0) (H : ∀ i hi, IsNormal (f i hi)) {a b} : (∃ i hi, nfpBFamily.{u, v} o f a ≤ f i hi b) ↔ nfpBFamily.{u, v} o f a ≤ b := by rw [← not_iff_not] push_neg exact apply_lt_nfpBFamily_iff.{u, v} ho H #align ordinal.nfp_bfamily_le_apply Ordinal.nfpBFamily_le_apply theorem nfpBFamily_le_fp (H : ∀ i hi, Monotone (f i hi)) {a b} (ab : a ≤ b) (h : ∀ i hi, f i hi b ≤ b) : nfpBFamily.{u, v} o f a ≤ b := nfpFamily_le_fp (fun _ => H _ _) ab fun _ => h _ _ #align ordinal.nfp_bfamily_le_fp Ordinal.nfpBFamily_le_fp theorem nfpBFamily_fp {i hi} (H : IsNormal (f i hi)) (a) : f i hi (nfpBFamily.{u, v} o f a) = nfpBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply nfpFamily_fp rw [familyOfBFamily_enum] exact H #align ordinal.nfp_bfamily_fp Ordinal.nfpBFamily_fp theorem apply_le_nfpBFamily (ho : o ≠ 0) (H : ∀ i hi, IsNormal (f i hi)) {a b} : (∀ i hi, f i hi b ≤ nfpBFamily.{u, v} o f a) ↔ b ≤ nfpBFamily.{u, v} o f a := by refine ⟨fun h => ?_, fun h i hi => ?_⟩ · have ho' : 0 < o := Ordinal.pos_iff_ne_zero.2 ho exact ((H 0 ho').self_le b).trans (h 0 ho') · rw [← nfpBFamily_fp (H i hi)] exact (H i hi).monotone h #align ordinal.apply_le_nfp_bfamily Ordinal.apply_le_nfpBFamily theorem nfpBFamily_eq_self {a} (h : ∀ i hi, f i hi a = a) : nfpBFamily.{u, v} o f a = a := nfpFamily_eq_self fun _ => h _ _ #align ordinal.nfp_bfamily_eq_self Ordinal.nfpBFamily_eq_self theorem fp_bfamily_unbounded (H : ∀ i hi, IsNormal (f i hi)) : (⋂ (i) (hi), Function.fixedPoints (f i hi)).Unbounded (· < ·) := fun a => ⟨nfpBFamily.{u, v} _ f a, by rw [Set.mem_iInter₂] exact fun i hi => nfpBFamily_fp (H i hi) _, (le_nfpBFamily f a).not_lt⟩ #align ordinal.fp_bfamily_unbounded Ordinal.fp_bfamily_unbounded def derivBFamily (o : Ordinal) (f : ∀ b < o, Ordinal → Ordinal) : Ordinal → Ordinal := derivFamily (familyOfBFamily o f) #align ordinal.deriv_bfamily Ordinal.derivBFamily theorem derivBFamily_eq_derivFamily {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) : derivBFamily.{u, v} o f = derivFamily.{u, v} (familyOfBFamily o f) := rfl #align ordinal.deriv_bfamily_eq_deriv_family Ordinal.derivBFamily_eq_derivFamily theorem derivBFamily_isNormal {o : Ordinal} (f : ∀ b < o, Ordinal → Ordinal) : IsNormal (derivBFamily o f) := derivFamily_isNormal _ #align ordinal.deriv_bfamily_is_normal Ordinal.derivBFamily_isNormal theorem derivBFamily_fp {i hi} (H : IsNormal (f i hi)) (a : Ordinal) : f i hi (derivBFamily.{u, v} o f a) = derivBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply derivFamily_fp rw [familyOfBFamily_enum] exact H #align ordinal.deriv_bfamily_fp Ordinal.derivBFamily_fp theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} : (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by unfold derivBFamily rw [← le_iff_derivFamily] · refine ⟨fun h i => h _ _, fun h i hi => ?_⟩ rw [← familyOfBFamily_enum o f] apply h · exact fun _ => H _ _ #align ordinal.le_iff_deriv_bfamily Ordinal.le_iff_derivBFamily theorem fp_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} : (∀ i hi, f i hi a = a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by rw [← le_iff_derivBFamily H] refine ⟨fun h i hi => le_of_eq (h i hi), fun h i hi => ?_⟩ rw [← (H i hi).le_iff_eq] exact h i hi #align ordinal.fp_iff_deriv_bfamily Ordinal.fp_iff_derivBFamily theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) : derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)] use (derivBFamily_isNormal f).strictMono rw [Set.range_eq_iff] refine ⟨fun a => Set.mem_iInter₂.2 fun i hi => derivBFamily_fp (H i hi) a, fun a ha => ?_⟩ rw [Set.mem_iInter₂] at ha rwa [← fp_iff_derivBFamily H] #align ordinal.deriv_bfamily_eq_enum_ord Ordinal.derivBFamily_eq_enumOrd end section variable {f : Ordinal.{u} → Ordinal.{u}} def nfp (f : Ordinal → Ordinal) : Ordinal → Ordinal := nfpFamily fun _ : Unit => f #align ordinal.nfp Ordinal.nfp theorem nfp_eq_nfpFamily (f : Ordinal → Ordinal) : nfp f = nfpFamily fun _ : Unit => f := rfl #align ordinal.nfp_eq_nfp_family Ordinal.nfp_eq_nfpFamily @[simp] theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) : (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by refine funext fun a => le_antisymm ?_ (sup_le fun l => ?_) · rw [sup_le_iff] intro n rw [← List.length_replicate n Unit.unit, ← List.foldr_const f a] apply le_sup · rw [List.foldr_const f a l] exact le_sup _ _ #align ordinal.sup_iterate_eq_nfp Ordinal.sup_iterate_eq_nfp theorem iterate_le_nfp (f a n) : f^[n] a ≤ nfp f a := by rw [← sup_iterate_eq_nfp] exact le_sup _ n #align ordinal.iterate_le_nfp Ordinal.iterate_le_nfp theorem le_nfp (f a) : a ≤ nfp f a := iterate_le_nfp f a 0 #align ordinal.le_nfp Ordinal.le_nfp theorem lt_nfp {a b} : a < nfp f b ↔ ∃ n, a < f^[n] b := by rw [← sup_iterate_eq_nfp] exact lt_sup #align ordinal.lt_nfp Ordinal.lt_nfp theorem nfp_le_iff {a b} : nfp f a ≤ b ↔ ∀ n, f^[n] a ≤ b := by rw [← sup_iterate_eq_nfp] exact sup_le_iff #align ordinal.nfp_le_iff Ordinal.nfp_le_iff theorem nfp_le {a b} : (∀ n, f^[n] a ≤ b) → nfp f a ≤ b := nfp_le_iff.2 #align ordinal.nfp_le Ordinal.nfp_le @[simp] theorem nfp_id : nfp id = id := funext fun a => by simp_rw [← sup_iterate_eq_nfp, iterate_id] exact sup_const a #align ordinal.nfp_id Ordinal.nfp_id theorem nfp_monotone (hf : Monotone f) : Monotone (nfp f) := nfpFamily_monotone fun _ => hf #align ordinal.nfp_monotone Ordinal.nfp_monotone theorem IsNormal.apply_lt_nfp {f} (H : IsNormal f) {a b} : f b < nfp f a ↔ b < nfp f a := by unfold nfp rw [← @apply_lt_nfpFamily_iff Unit (fun _ => f) _ (fun _ => H) a b] exact ⟨fun h _ => h, fun h => h Unit.unit⟩ #align ordinal.is_normal.apply_lt_nfp Ordinal.IsNormal.apply_lt_nfp theorem IsNormal.nfp_le_apply {f} (H : IsNormal f) {a b} : nfp f a ≤ f b ↔ nfp f a ≤ b := le_iff_le_iff_lt_iff_lt.2 H.apply_lt_nfp #align ordinal.is_normal.nfp_le_apply Ordinal.IsNormal.nfp_le_apply theorem nfp_le_fp {f} (H : Monotone f) {a b} (ab : a ≤ b) (h : f b ≤ b) : nfp f a ≤ b := nfpFamily_le_fp (fun _ => H) ab fun _ => h #align ordinal.nfp_le_fp Ordinal.nfp_le_fp theorem IsNormal.nfp_fp {f} (H : IsNormal f) : ∀ a, f (nfp f a) = nfp f a := @nfpFamily_fp Unit (fun _ => f) Unit.unit H #align ordinal.is_normal.nfp_fp Ordinal.IsNormal.nfp_fp theorem IsNormal.apply_le_nfp {f} (H : IsNormal f) {a b} : f b ≤ nfp f a ↔ b ≤ nfp f a := ⟨le_trans (H.self_le _), fun h => by simpa only [H.nfp_fp] using H.le_iff.2 h⟩ #align ordinal.is_normal.apply_le_nfp Ordinal.IsNormal.apply_le_nfp theorem nfp_eq_self {f : Ordinal → Ordinal} {a} (h : f a = a) : nfp f a = a := nfpFamily_eq_self fun _ => h #align ordinal.nfp_eq_self Ordinal.nfp_eq_self theorem fp_unbounded (H : IsNormal f) : (Function.fixedPoints f).Unbounded (· < ·) := by convert fp_family_unbounded fun _ : Unit => H exact (Set.iInter_const _).symm #align ordinal.fp_unbounded Ordinal.fp_unbounded def deriv (f : Ordinal → Ordinal) : Ordinal → Ordinal := derivFamily fun _ : Unit => f #align ordinal.deriv Ordinal.deriv theorem deriv_eq_derivFamily (f : Ordinal → Ordinal) : deriv f = derivFamily fun _ : Unit => f := rfl #align ordinal.deriv_eq_deriv_family Ordinal.deriv_eq_derivFamily @[simp] theorem deriv_zero (f) : deriv f 0 = nfp f 0 := derivFamily_zero _ #align ordinal.deriv_zero Ordinal.deriv_zero @[simp] theorem deriv_succ (f o) : deriv f (succ o) = nfp f (succ (deriv f o)) := derivFamily_succ _ _ #align ordinal.deriv_succ Ordinal.deriv_succ theorem deriv_limit (f) {o} : IsLimit o → deriv f o = bsup.{u, 0} o fun a _ => deriv f a := derivFamily_limit _ #align ordinal.deriv_limit Ordinal.deriv_limit theorem deriv_isNormal (f) : IsNormal (deriv f) := derivFamily_isNormal _ #align ordinal.deriv_is_normal Ordinal.deriv_isNormal theorem deriv_id_of_nfp_id {f : Ordinal → Ordinal} (h : nfp f = id) : deriv f = id := ((deriv_isNormal _).eq_iff_zero_and_succ IsNormal.refl).2 (by simp [h]) #align ordinal.deriv_id_of_nfp_id Ordinal.deriv_id_of_nfp_id theorem IsNormal.deriv_fp {f} (H : IsNormal f) : ∀ o, f (deriv f o) = deriv f o := @derivFamily_fp Unit (fun _ => f) Unit.unit H #align ordinal.is_normal.deriv_fp Ordinal.IsNormal.deriv_fp theorem IsNormal.le_iff_deriv {f} (H : IsNormal f) {a} : f a ≤ a ↔ ∃ o, deriv f o = a := by unfold deriv rw [← le_iff_derivFamily fun _ : Unit => H] exact ⟨fun h _ => h, fun h => h Unit.unit⟩ #align ordinal.is_normal.le_iff_deriv Ordinal.IsNormal.le_iff_deriv theorem IsNormal.fp_iff_deriv {f} (H : IsNormal f) {a} : f a = a ↔ ∃ o, deriv f o = a := by rw [← H.le_iff_eq, H.le_iff_deriv] #align ordinal.is_normal.fp_iff_deriv Ordinal.IsNormal.fp_iff_deriv theorem deriv_eq_enumOrd (H : IsNormal f) : deriv f = enumOrd (Function.fixedPoints f) := by convert derivFamily_eq_enumOrd fun _ : Unit => H exact (Set.iInter_const _).symm #align ordinal.deriv_eq_enum_ord Ordinal.deriv_eq_enumOrd theorem deriv_eq_id_of_nfp_eq_id {f : Ordinal → Ordinal} (h : nfp f = id) : deriv f = id := (IsNormal.eq_iff_zero_and_succ (deriv_isNormal _) IsNormal.refl).2 <| by simp [h] #align ordinal.deriv_eq_id_of_nfp_eq_id Ordinal.deriv_eq_id_of_nfp_eq_id end @[simp] theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat] congr; funext n induction' n with n hn · rw [Nat.cast_zero, mul_zero, iterate_zero_apply] · rw [iterate_succ_apply', Nat.add_comm, Nat.cast_add, Nat.cast_one, mul_one_add, hn] #align ordinal.nfp_add_zero Ordinal.nfp_add_zero
Mathlib/SetTheory/Ordinal/FixedPoint.lean
573
577
theorem nfp_add_eq_mul_omega {a b} (hba : b ≤ a * omega) : nfp (a + ·) b = a * omega := by
apply le_antisymm (nfp_le_fp (add_isNormal a).monotone hba _) · rw [← nfp_add_zero] exact nfp_monotone (add_isNormal a).monotone (Ordinal.zero_le b) · dsimp; rw [← mul_one_add, one_add_omega]
import Mathlib.Order.ConditionallyCompleteLattice.Basic import Mathlib.Data.Int.LeastGreatest #align_import data.int.conditionally_complete_order from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae" open Int noncomputable section open scoped Classical instance instConditionallyCompleteLinearOrder : ConditionallyCompleteLinearOrder ℤ where __ := instLinearOrder __ := LinearOrder.toLattice sSup s := if h : s.Nonempty ∧ BddAbove s then greatestOfBdd (Classical.choose h.2) (Classical.choose_spec h.2) h.1 else 0 sInf s := if h : s.Nonempty ∧ BddBelow s then leastOfBdd (Classical.choose h.2) (Classical.choose_spec h.2) h.1 else 0 le_csSup s n hs hns := by have : s.Nonempty ∧ BddAbove s := ⟨⟨n, hns⟩, hs⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact (greatestOfBdd _ _ _).2.2 n hns csSup_le s n hs hns := by have : s.Nonempty ∧ BddAbove s := ⟨hs, ⟨n, hns⟩⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact hns (greatestOfBdd _ (Classical.choose_spec this.2) _).2.1 csInf_le s n hs hns := by have : s.Nonempty ∧ BddBelow s := ⟨⟨n, hns⟩, hs⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact (leastOfBdd _ _ _).2.2 n hns le_csInf s n hs hns := by have : s.Nonempty ∧ BddBelow s := ⟨hs, ⟨n, hns⟩⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact hns (leastOfBdd _ (Classical.choose_spec this.2) _).2.1 csSup_of_not_bddAbove := fun s hs ↦ by simp [hs] csInf_of_not_bddBelow := fun s hs ↦ by simp [hs] namespace Int -- Porting note: mathlib3 proof uses `convert dif_pos _ using 1` theorem csSup_eq_greatest_of_bdd {s : Set ℤ} [DecidablePred (· ∈ s)] (b : ℤ) (Hb : ∀ z ∈ s, z ≤ b) (Hinh : ∃ z : ℤ, z ∈ s) : sSup s = greatestOfBdd b Hb Hinh := by have : s.Nonempty ∧ BddAbove s := ⟨Hinh, b, Hb⟩ simp only [sSup, this, and_self, dite_true] convert (coe_greatestOfBdd_eq Hb (Classical.choose_spec (⟨b, Hb⟩ : BddAbove s)) Hinh).symm #align int.cSup_eq_greatest_of_bdd Int.csSup_eq_greatest_of_bdd @[simp] theorem csSup_empty : sSup (∅ : Set ℤ) = 0 := dif_neg (by simp) #align int.cSup_empty Int.csSup_empty theorem csSup_of_not_bdd_above {s : Set ℤ} (h : ¬BddAbove s) : sSup s = 0 := dif_neg (by simp [h]) #align int.cSup_of_not_bdd_above Int.csSup_of_not_bdd_above -- Porting note: mathlib3 proof uses `convert dif_pos _ using 1`
Mathlib/Data/Int/ConditionallyCompleteOrder.lean
78
82
theorem csInf_eq_least_of_bdd {s : Set ℤ} [DecidablePred (· ∈ s)] (b : ℤ) (Hb : ∀ z ∈ s, b ≤ z) (Hinh : ∃ z : ℤ, z ∈ s) : sInf s = leastOfBdd b Hb Hinh := by
have : s.Nonempty ∧ BddBelow s := ⟨Hinh, b, Hb⟩ simp only [sInf, this, and_self, dite_true] convert (coe_leastOfBdd_eq Hb (Classical.choose_spec (⟨b, Hb⟩ : BddBelow s)) Hinh).symm
import Mathlib.Analysis.Convex.Slope import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic.LinearCombination #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" open Real Set NNReal theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ rintro x y z - - hxy hyz trans exp y · have h1 : 0 < y - x := by linarith have h2 : x - y < 0 := by linarith rw [div_lt_iff h1] calc exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf _ = exp y * (1 - exp (x - y)) := by ring _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne] _ = exp y * (y - x) := by ring · have h1 : 0 < z - y := by linarith rw [lt_div_iff h1] calc exp y * (z - y) < exp y * (exp (z - y) - 1) := by gcongr _ * ?_ linarith [add_one_lt_exp h1.ne'] _ = exp (z - y) * exp y - exp y := by ring _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl #align strict_convex_on_exp strictConvexOn_exp theorem convexOn_exp : ConvexOn ℝ univ exp := strictConvexOn_exp.convexOn #align convex_on_exp convexOn_exp theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ)) intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz have hy : 0 < y := hx.trans hxy trans y⁻¹ · have h : 0 < z - y := by linarith rw [div_lt_iff h] have hyz' : 0 < z / y := by positivity have hyz'' : z / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne'] _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz'' _ = y⁻¹ * (z - y) := by field_simp · have h : 0 < y - x := by linarith rw [lt_div_iff h] have hxy' : 0 < x / y := by positivity have hxy'' : x / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc y⁻¹ * (y - x) = 1 - x / y := by field_simp _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy''] _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne'] _ = log y - log x := by ring #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) : 1 + p * s < (1 + s) ^ p := by have hp' : 0 < p := zero_lt_one.trans hp rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs rcases le_or_lt (1 + p * s) 0 with hs2 | hs2 · exact hs2.trans_lt (rpow_pos_of_pos hs1 _) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp) · rw [← div_lt_iff hp', ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp) #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean
127
133
theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) : 1 + p * s ≤ (1 + s) ^ p := by
rcases eq_or_lt_of_le hp with (rfl | hp) · simp by_cases hs' : s = 0 · simp [hs'] exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" -- Workaround for lean4#2038 attribute [-instance] instBEqNat open Nat Finset List Finsupp namespace Nat variable {a b m n p : ℕ} def factorization (n : ℕ) : ℕ →₀ ℕ where support := n.primeFactors toFun p := if p.Prime then padicValNat p n else 0 mem_support_toFun := by simp [not_or]; aesop #align nat.factorization Nat.factorization @[simp] lemma support_factorization (n : ℕ) : (factorization n).support = n.primeFactors := rfl theorem factorization_def (n : ℕ) {p : ℕ} (pp : p.Prime) : n.factorization p = padicValNat p n := by simpa [factorization] using absurd pp #align nat.factorization_def Nat.factorization_def @[simp] theorem factors_count_eq {n p : ℕ} : n.factors.count p = n.factorization p := by rcases n.eq_zero_or_pos with (rfl | hn0) · simp [factorization, count] if pp : p.Prime then ?_ else rw [count_eq_zero_of_not_mem (mt prime_of_mem_factors pp)] simp [factorization, pp] simp only [factorization_def _ pp] apply _root_.le_antisymm · rw [le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] exact List.le_count_iff_replicate_sublist.mp le_rfl |>.subperm · rw [← lt_add_one_iff, lt_iff_not_ge, ge_iff_le, le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] intro h have := h.count_le p simp at this #align nat.factors_count_eq Nat.factors_count_eq theorem factorization_eq_factors_multiset (n : ℕ) : n.factorization = Multiset.toFinsupp (n.factors : Multiset ℕ) := by ext p simp #align nat.factorization_eq_factors_multiset Nat.factorization_eq_factors_multiset theorem multiplicity_eq_factorization {n p : ℕ} (pp : p.Prime) (hn : n ≠ 0) : multiplicity p n = n.factorization p := by simp [factorization, pp, padicValNat_def' pp.ne_one hn.bot_lt] #align nat.multiplicity_eq_factorization Nat.multiplicity_eq_factorization @[simp] theorem factorization_prod_pow_eq_self {n : ℕ} (hn : n ≠ 0) : n.factorization.prod (· ^ ·) = n := by rw [factorization_eq_factors_multiset n] simp only [← prod_toMultiset, factorization, Multiset.prod_coe, Multiset.toFinsupp_toMultiset] exact prod_factors hn #align nat.factorization_prod_pow_eq_self Nat.factorization_prod_pow_eq_self theorem eq_of_factorization_eq {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) (h : ∀ p : ℕ, a.factorization p = b.factorization p) : a = b := eq_of_perm_factors ha hb (by simpa only [List.perm_iff_count, factors_count_eq] using h) #align nat.eq_of_factorization_eq Nat.eq_of_factorization_eq theorem factorization_inj : Set.InjOn factorization { x : ℕ | x ≠ 0 } := fun a ha b hb h => eq_of_factorization_eq ha hb fun p => by simp [h] #align nat.factorization_inj Nat.factorization_inj @[simp] theorem factorization_zero : factorization 0 = 0 := by ext; simp [factorization] #align nat.factorization_zero Nat.factorization_zero @[simp] theorem factorization_one : factorization 1 = 0 := by ext; simp [factorization] #align nat.factorization_one Nat.factorization_one #noalign nat.support_factorization #align nat.factor_iff_mem_factorization Nat.mem_primeFactors_iff_mem_factors #align nat.prime_of_mem_factorization Nat.prime_of_mem_primeFactors #align nat.pos_of_mem_factorization Nat.pos_of_mem_primeFactors #align nat.le_of_mem_factorization Nat.le_of_mem_primeFactors theorem factorization_eq_zero_iff (n p : ℕ) : n.factorization p = 0 ↔ ¬p.Prime ∨ ¬p ∣ n ∨ n = 0 := by simp_rw [← not_mem_support_iff, support_factorization, mem_primeFactors, not_and_or, not_ne_iff] #align nat.factorization_eq_zero_iff Nat.factorization_eq_zero_iff @[simp] theorem factorization_eq_zero_of_non_prime (n : ℕ) {p : ℕ} (hp : ¬p.Prime) : n.factorization p = 0 := by simp [factorization_eq_zero_iff, hp] #align nat.factorization_eq_zero_of_non_prime Nat.factorization_eq_zero_of_non_prime theorem factorization_eq_zero_of_not_dvd {n p : ℕ} (h : ¬p ∣ n) : n.factorization p = 0 := by simp [factorization_eq_zero_iff, h] #align nat.factorization_eq_zero_of_not_dvd Nat.factorization_eq_zero_of_not_dvd theorem factorization_eq_zero_of_lt {n p : ℕ} (h : n < p) : n.factorization p = 0 := Finsupp.not_mem_support_iff.mp (mt le_of_mem_primeFactors (not_le_of_lt h)) #align nat.factorization_eq_zero_of_lt Nat.factorization_eq_zero_of_lt @[simp] theorem factorization_zero_right (n : ℕ) : n.factorization 0 = 0 := factorization_eq_zero_of_non_prime _ not_prime_zero #align nat.factorization_zero_right Nat.factorization_zero_right @[simp] theorem factorization_one_right (n : ℕ) : n.factorization 1 = 0 := factorization_eq_zero_of_non_prime _ not_prime_one #align nat.factorization_one_right Nat.factorization_one_right theorem dvd_of_factorization_pos {n p : ℕ} (hn : n.factorization p ≠ 0) : p ∣ n := dvd_of_mem_factors <| mem_primeFactors_iff_mem_factors.1 <| mem_support_iff.2 hn #align nat.dvd_of_factorization_pos Nat.dvd_of_factorization_pos theorem Prime.factorization_pos_of_dvd {n p : ℕ} (hp : p.Prime) (hn : n ≠ 0) (h : p ∣ n) : 0 < n.factorization p := by rwa [← factors_count_eq, count_pos_iff_mem, mem_factors_iff_dvd hn hp] #align nat.prime.factorization_pos_of_dvd Nat.Prime.factorization_pos_of_dvd theorem factorization_eq_zero_of_remainder {p r : ℕ} (i : ℕ) (hr : ¬p ∣ r) : (p * i + r).factorization p = 0 := by apply factorization_eq_zero_of_not_dvd rwa [← Nat.dvd_add_iff_right (Dvd.intro i rfl)] #align nat.factorization_eq_zero_of_remainder Nat.factorization_eq_zero_of_remainder theorem factorization_eq_zero_iff_remainder {p r : ℕ} (i : ℕ) (pp : p.Prime) (hr0 : r ≠ 0) : ¬p ∣ r ↔ (p * i + r).factorization p = 0 := by refine ⟨factorization_eq_zero_of_remainder i, fun h => ?_⟩ rw [factorization_eq_zero_iff] at h contrapose! h refine ⟨pp, ?_, ?_⟩ · rwa [← Nat.dvd_add_iff_right (dvd_mul_right p i)] · contrapose! hr0 exact (add_eq_zero_iff.mp hr0).2 #align nat.factorization_eq_zero_iff_remainder Nat.factorization_eq_zero_iff_remainder theorem factorization_eq_zero_iff' (n : ℕ) : n.factorization = 0 ↔ n = 0 ∨ n = 1 := by rw [factorization_eq_factors_multiset n] simp [factorization, AddEquiv.map_eq_zero_iff, Multiset.coe_eq_zero] #align nat.factorization_eq_zero_iff' Nat.factorization_eq_zero_iff' @[simp] theorem factorization_mul {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) : (a * b).factorization = a.factorization + b.factorization := by ext p simp only [add_apply, ← factors_count_eq, perm_iff_count.mp (perm_factors_mul ha hb) p, count_append] #align nat.factorization_mul Nat.factorization_mul #align nat.factorization_mul_support Nat.primeFactors_mul lemma prod_factorization_eq_prod_primeFactors {β : Type*} [CommMonoid β] (f : ℕ → ℕ → β) : n.factorization.prod f = ∏ p ∈ n.primeFactors, f p (n.factorization p) := rfl #align nat.prod_factorization_eq_prod_factors Nat.prod_factorization_eq_prod_primeFactors lemma prod_primeFactors_prod_factorization {β : Type*} [CommMonoid β] (f : ℕ → β) : ∏ p ∈ n.primeFactors, f p = n.factorization.prod (fun p _ ↦ f p) := rfl theorem factorization_prod {α : Type*} {S : Finset α} {g : α → ℕ} (hS : ∀ x ∈ S, g x ≠ 0) : (S.prod g).factorization = S.sum fun x => (g x).factorization := by classical ext p refine Finset.induction_on' S ?_ ?_ · simp · intro x T hxS hTS hxT IH have hT : T.prod g ≠ 0 := prod_ne_zero_iff.mpr fun x hx => hS x (hTS hx) simp [prod_insert hxT, sum_insert hxT, ← IH, factorization_mul (hS x hxS) hT] #align nat.factorization_prod Nat.factorization_prod @[simp] theorem factorization_pow (n k : ℕ) : factorization (n ^ k) = k • n.factorization := by induction' k with k ih; · simp rcases eq_or_ne n 0 with (rfl | hn) · simp rw [Nat.pow_succ, mul_comm, factorization_mul hn (pow_ne_zero _ hn), ih, add_smul, one_smul, add_comm] #align nat.factorization_pow Nat.factorization_pow @[simp] protected theorem Prime.factorization {p : ℕ} (hp : Prime p) : p.factorization = single p 1 := by ext q rw [← factors_count_eq, factors_prime hp, single_apply, count_singleton', if_congr eq_comm] <;> rfl #align nat.prime.factorization Nat.Prime.factorization @[simp] theorem Prime.factorization_self {p : ℕ} (hp : Prime p) : p.factorization p = 1 := by simp [hp] #align nat.prime.factorization_self Nat.Prime.factorization_self theorem Prime.factorization_pow {p k : ℕ} (hp : Prime p) : (p ^ k).factorization = single p k := by simp [hp] #align nat.prime.factorization_pow Nat.Prime.factorization_pow theorem eq_pow_of_factorization_eq_single {n p k : ℕ} (hn : n ≠ 0) (h : n.factorization = Finsupp.single p k) : n = p ^ k := by -- Porting note: explicitly added `Finsupp.prod_single_index` rw [← Nat.factorization_prod_pow_eq_self hn, h, Finsupp.prod_single_index] simp #align nat.eq_pow_of_factorization_eq_single Nat.eq_pow_of_factorization_eq_single theorem Prime.eq_of_factorization_pos {p q : ℕ} (hp : Prime p) (h : p.factorization q ≠ 0) : p = q := by simpa [hp.factorization, single_apply] using h #align nat.prime.eq_of_factorization_pos Nat.Prime.eq_of_factorization_pos theorem prod_pow_factorization_eq_self {f : ℕ →₀ ℕ} (hf : ∀ p : ℕ, p ∈ f.support → Prime p) : (f.prod (· ^ ·)).factorization = f := by have h : ∀ x : ℕ, x ∈ f.support → x ^ f x ≠ 0 := fun p hp => pow_ne_zero _ (Prime.ne_zero (hf p hp)) simp only [Finsupp.prod, factorization_prod h] conv => rhs rw [(sum_single f).symm] exact sum_congr rfl fun p hp => Prime.factorization_pow (hf p hp) #align nat.prod_pow_factorization_eq_self Nat.prod_pow_factorization_eq_self theorem eq_factorization_iff {n : ℕ} {f : ℕ →₀ ℕ} (hn : n ≠ 0) (hf : ∀ p ∈ f.support, Prime p) : f = n.factorization ↔ f.prod (· ^ ·) = n := ⟨fun h => by rw [h, factorization_prod_pow_eq_self hn], fun h => by rw [← h, prod_pow_factorization_eq_self hf]⟩ #align nat.eq_factorization_iff Nat.eq_factorization_iff def factorizationEquiv : ℕ+ ≃ { f : ℕ →₀ ℕ | ∀ p ∈ f.support, Prime p } where toFun := fun ⟨n, _⟩ => ⟨n.factorization, fun _ => prime_of_mem_primeFactors⟩ invFun := fun ⟨f, hf⟩ => ⟨f.prod _, prod_pow_pos_of_zero_not_mem_support fun H => not_prime_zero (hf 0 H)⟩ left_inv := fun ⟨_, hx⟩ => Subtype.ext <| factorization_prod_pow_eq_self hx.ne.symm right_inv := fun ⟨_, hf⟩ => Subtype.ext <| prod_pow_factorization_eq_self hf #align nat.factorization_equiv Nat.factorizationEquiv theorem factorizationEquiv_apply (n : ℕ+) : (factorizationEquiv n).1 = n.1.factorization := by cases n rfl #align nat.factorization_equiv_apply Nat.factorizationEquiv_apply theorem factorizationEquiv_inv_apply {f : ℕ →₀ ℕ} (hf : ∀ p ∈ f.support, Prime p) : (factorizationEquiv.symm ⟨f, hf⟩).1 = f.prod (· ^ ·) := rfl #align nat.factorization_equiv_inv_apply Nat.factorizationEquiv_inv_apply -- Porting note: Lean 4 thinks we need `HPow` without this set_option quotPrecheck false in notation "ord_proj[" p "] " n:arg => p ^ Nat.factorization n p notation "ord_compl[" p "] " n:arg => n / ord_proj[p] n @[simp] theorem ord_proj_of_not_prime (n p : ℕ) (hp : ¬p.Prime) : ord_proj[p] n = 1 := by simp [factorization_eq_zero_of_non_prime n hp] #align nat.ord_proj_of_not_prime Nat.ord_proj_of_not_prime @[simp] theorem ord_compl_of_not_prime (n p : ℕ) (hp : ¬p.Prime) : ord_compl[p] n = n := by simp [factorization_eq_zero_of_non_prime n hp] #align nat.ord_compl_of_not_prime Nat.ord_compl_of_not_prime theorem ord_proj_dvd (n p : ℕ) : ord_proj[p] n ∣ n := by if hp : p.Prime then ?_ else simp [hp] rw [← factors_count_eq] apply dvd_of_factors_subperm (pow_ne_zero _ hp.ne_zero) rw [hp.factors_pow, List.subperm_ext_iff] intro q hq simp [List.eq_of_mem_replicate hq] #align nat.ord_proj_dvd Nat.ord_proj_dvd theorem ord_compl_dvd (n p : ℕ) : ord_compl[p] n ∣ n := div_dvd_of_dvd (ord_proj_dvd n p) #align nat.ord_compl_dvd Nat.ord_compl_dvd theorem ord_proj_pos (n p : ℕ) : 0 < ord_proj[p] n := by if pp : p.Prime then simp [pow_pos pp.pos] else simp [pp] #align nat.ord_proj_pos Nat.ord_proj_pos theorem ord_proj_le {n : ℕ} (p : ℕ) (hn : n ≠ 0) : ord_proj[p] n ≤ n := le_of_dvd hn.bot_lt (Nat.ord_proj_dvd n p) #align nat.ord_proj_le Nat.ord_proj_le theorem ord_compl_pos {n : ℕ} (p : ℕ) (hn : n ≠ 0) : 0 < ord_compl[p] n := by if pp : p.Prime then exact Nat.div_pos (ord_proj_le p hn) (ord_proj_pos n p) else simpa [Nat.factorization_eq_zero_of_non_prime n pp] using hn.bot_lt #align nat.ord_compl_pos Nat.ord_compl_pos theorem ord_compl_le (n p : ℕ) : ord_compl[p] n ≤ n := Nat.div_le_self _ _ #align nat.ord_compl_le Nat.ord_compl_le theorem ord_proj_mul_ord_compl_eq_self (n p : ℕ) : ord_proj[p] n * ord_compl[p] n = n := Nat.mul_div_cancel' (ord_proj_dvd n p) #align nat.ord_proj_mul_ord_compl_eq_self Nat.ord_proj_mul_ord_compl_eq_self theorem ord_proj_mul {a b : ℕ} (p : ℕ) (ha : a ≠ 0) (hb : b ≠ 0) : ord_proj[p] (a * b) = ord_proj[p] a * ord_proj[p] b := by simp [factorization_mul ha hb, pow_add] #align nat.ord_proj_mul Nat.ord_proj_mul theorem ord_compl_mul (a b p : ℕ) : ord_compl[p] (a * b) = ord_compl[p] a * ord_compl[p] b := by if ha : a = 0 then simp [ha] else if hb : b = 0 then simp [hb] else simp only [ord_proj_mul p ha hb] rw [div_mul_div_comm (ord_proj_dvd a p) (ord_proj_dvd b p)] #align nat.ord_compl_mul Nat.ord_compl_mul #align nat.dvd_of_mem_factorization Nat.dvd_of_mem_primeFactors theorem factorization_lt {n : ℕ} (p : ℕ) (hn : n ≠ 0) : n.factorization p < n := by by_cases pp : p.Prime · exact (pow_lt_pow_iff_right pp.one_lt).1 <| (ord_proj_le p hn).trans_lt <| lt_pow_self pp.one_lt _ · simpa only [factorization_eq_zero_of_non_prime n pp] using hn.bot_lt #align nat.factorization_lt Nat.factorization_lt theorem factorization_le_of_le_pow {n p b : ℕ} (hb : n ≤ p ^ b) : n.factorization p ≤ b := by if hn : n = 0 then simp [hn] else if pp : p.Prime then exact (pow_le_pow_iff_right pp.one_lt).1 ((ord_proj_le p hn).trans hb) else simp [factorization_eq_zero_of_non_prime n pp] #align nat.factorization_le_of_le_pow Nat.factorization_le_of_le_pow theorem factorization_le_iff_dvd {d n : ℕ} (hd : d ≠ 0) (hn : n ≠ 0) : d.factorization ≤ n.factorization ↔ d ∣ n := by constructor · intro hdn set K := n.factorization - d.factorization with hK use K.prod (· ^ ·) rw [← factorization_prod_pow_eq_self hn, ← factorization_prod_pow_eq_self hd, ← Finsupp.prod_add_index' pow_zero pow_add, hK, add_tsub_cancel_of_le hdn] · rintro ⟨c, rfl⟩ rw [factorization_mul hd (right_ne_zero_of_mul hn)] simp #align nat.factorization_le_iff_dvd Nat.factorization_le_iff_dvd theorem factorization_prime_le_iff_dvd {d n : ℕ} (hd : d ≠ 0) (hn : n ≠ 0) : (∀ p : ℕ, p.Prime → d.factorization p ≤ n.factorization p) ↔ d ∣ n := by rw [← factorization_le_iff_dvd hd hn] refine ⟨fun h p => (em p.Prime).elim (h p) fun hp => ?_, fun h p _ => h p⟩ simp_rw [factorization_eq_zero_of_non_prime _ hp] rfl #align nat.factorization_prime_le_iff_dvd Nat.factorization_prime_le_iff_dvd theorem pow_succ_factorization_not_dvd {n p : ℕ} (hn : n ≠ 0) (hp : p.Prime) : ¬p ^ (n.factorization p + 1) ∣ n := by intro h rw [← factorization_le_iff_dvd (pow_pos hp.pos _).ne' hn] at h simpa [hp.factorization] using h p #align nat.pow_succ_factorization_not_dvd Nat.pow_succ_factorization_not_dvd theorem factorization_le_factorization_mul_left {a b : ℕ} (hb : b ≠ 0) : a.factorization ≤ (a * b).factorization := by rcases eq_or_ne a 0 with (rfl | ha) · simp rw [factorization_le_iff_dvd ha <| mul_ne_zero ha hb] exact Dvd.intro b rfl #align nat.factorization_le_factorization_mul_left Nat.factorization_le_factorization_mul_left theorem factorization_le_factorization_mul_right {a b : ℕ} (ha : a ≠ 0) : b.factorization ≤ (a * b).factorization := by rw [mul_comm] apply factorization_le_factorization_mul_left ha #align nat.factorization_le_factorization_mul_right Nat.factorization_le_factorization_mul_right theorem Prime.pow_dvd_iff_le_factorization {p k n : ℕ} (pp : Prime p) (hn : n ≠ 0) : p ^ k ∣ n ↔ k ≤ n.factorization p := by rw [← factorization_le_iff_dvd (pow_pos pp.pos k).ne' hn, pp.factorization_pow, single_le_iff] #align nat.prime.pow_dvd_iff_le_factorization Nat.Prime.pow_dvd_iff_le_factorization theorem Prime.pow_dvd_iff_dvd_ord_proj {p k n : ℕ} (pp : Prime p) (hn : n ≠ 0) : p ^ k ∣ n ↔ p ^ k ∣ ord_proj[p] n := by rw [pow_dvd_pow_iff_le_right pp.one_lt, pp.pow_dvd_iff_le_factorization hn] #align nat.prime.pow_dvd_iff_dvd_ord_proj Nat.Prime.pow_dvd_iff_dvd_ord_proj theorem Prime.dvd_iff_one_le_factorization {p n : ℕ} (pp : Prime p) (hn : n ≠ 0) : p ∣ n ↔ 1 ≤ n.factorization p := Iff.trans (by simp) (pp.pow_dvd_iff_le_factorization hn) #align nat.prime.dvd_iff_one_le_factorization Nat.Prime.dvd_iff_one_le_factorization theorem exists_factorization_lt_of_lt {a b : ℕ} (ha : a ≠ 0) (hab : a < b) : ∃ p : ℕ, a.factorization p < b.factorization p := by have hb : b ≠ 0 := (ha.bot_lt.trans hab).ne' contrapose! hab rw [← Finsupp.le_def, factorization_le_iff_dvd hb ha] at hab exact le_of_dvd ha.bot_lt hab #align nat.exists_factorization_lt_of_lt Nat.exists_factorization_lt_of_lt @[simp] theorem factorization_div {d n : ℕ} (h : d ∣ n) : (n / d).factorization = n.factorization - d.factorization := by rcases eq_or_ne d 0 with (rfl | hd); · simp [zero_dvd_iff.mp h] rcases eq_or_ne n 0 with (rfl | hn); · simp apply add_left_injective d.factorization simp only rw [tsub_add_cancel_of_le <| (Nat.factorization_le_iff_dvd hd hn).mpr h, ← Nat.factorization_mul (Nat.div_pos (Nat.le_of_dvd hn.bot_lt h) hd.bot_lt).ne' hd, Nat.div_mul_cancel h] #align nat.factorization_div Nat.factorization_div theorem dvd_ord_proj_of_dvd {n p : ℕ} (hn : n ≠ 0) (pp : p.Prime) (h : p ∣ n) : p ∣ ord_proj[p] n := dvd_pow_self p (Prime.factorization_pos_of_dvd pp hn h).ne' #align nat.dvd_ord_proj_of_dvd Nat.dvd_ord_proj_of_dvd theorem not_dvd_ord_compl {n p : ℕ} (hp : Prime p) (hn : n ≠ 0) : ¬p ∣ ord_compl[p] n := by rw [Nat.Prime.dvd_iff_one_le_factorization hp (ord_compl_pos p hn).ne'] rw [Nat.factorization_div (Nat.ord_proj_dvd n p)] simp [hp.factorization] #align nat.not_dvd_ord_compl Nat.not_dvd_ord_compl theorem coprime_ord_compl {n p : ℕ} (hp : Prime p) (hn : n ≠ 0) : Coprime p (ord_compl[p] n) := (or_iff_left (not_dvd_ord_compl hp hn)).mp <| coprime_or_dvd_of_prime hp _ #align nat.coprime_ord_compl Nat.coprime_ord_compl theorem factorization_ord_compl (n p : ℕ) : (ord_compl[p] n).factorization = n.factorization.erase p := by if hn : n = 0 then simp [hn] else if pp : p.Prime then ?_ else -- Porting note: needed to solve side goal explicitly rw [Finsupp.erase_of_not_mem_support] <;> simp [pp] ext q rcases eq_or_ne q p with (rfl | hqp) · simp only [Finsupp.erase_same, factorization_eq_zero_iff, not_dvd_ord_compl pp hn] simp · rw [Finsupp.erase_ne hqp, factorization_div (ord_proj_dvd n p)] simp [pp.factorization, hqp.symm] #align nat.factorization_ord_compl Nat.factorization_ord_compl -- `ord_compl[p] n` is the largest divisor of `n` not divisible by `p`. theorem dvd_ord_compl_of_dvd_not_dvd {p d n : ℕ} (hdn : d ∣ n) (hpd : ¬p ∣ d) : d ∣ ord_compl[p] n := by if hn0 : n = 0 then simp [hn0] else if hd0 : d = 0 then simp [hd0] at hpd else rw [← factorization_le_iff_dvd hd0 (ord_compl_pos p hn0).ne', factorization_ord_compl] intro q if hqp : q = p then simp [factorization_eq_zero_iff, hqp, hpd] else simp [hqp, (factorization_le_iff_dvd hd0 hn0).2 hdn q] #align nat.dvd_ord_compl_of_dvd_not_dvd Nat.dvd_ord_compl_of_dvd_not_dvd theorem exists_eq_pow_mul_and_not_dvd {n : ℕ} (hn : n ≠ 0) (p : ℕ) (hp : p ≠ 1) : ∃ e n' : ℕ, ¬p ∣ n' ∧ n = p ^ e * n' := let ⟨a', h₁, h₂⟩ := multiplicity.exists_eq_pow_mul_and_not_dvd (multiplicity.finite_nat_iff.mpr ⟨hp, Nat.pos_of_ne_zero hn⟩) ⟨_, a', h₂, h₁⟩ #align nat.exists_eq_pow_mul_and_not_dvd Nat.exists_eq_pow_mul_and_not_dvd
Mathlib/Data/Nat/Factorization/Basic.lean
537
547
theorem dvd_iff_div_factorization_eq_tsub {d n : ℕ} (hd : d ≠ 0) (hdn : d ≤ n) : d ∣ n ↔ (n / d).factorization = n.factorization - d.factorization := by
refine ⟨factorization_div, ?_⟩ rcases eq_or_lt_of_le hdn with (rfl | hd_lt_n); · simp have h1 : n / d ≠ 0 := fun H => Nat.lt_asymm hd_lt_n ((Nat.div_eq_zero_iff hd.bot_lt).mp H) intro h rw [dvd_iff_le_div_mul n d] by_contra h2 cases' exists_factorization_lt_of_lt (mul_ne_zero h1 hd) (not_le.mp h2) with p hp rwa [factorization_mul h1 hd, add_apply, ← lt_tsub_iff_right, h, tsub_apply, lt_self_iff_false] at hp
import Mathlib.Analysis.Convex.Side import Mathlib.Geometry.Euclidean.Angle.Oriented.Rotation import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine #align_import geometry.euclidean.angle.oriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open FiniteDimensional Complex open scoped Affine EuclideanGeometry Real RealInnerProductSpace ComplexConjugate namespace EuclideanGeometry variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)] abbrev o := @Module.Oriented.positiveOrientation def oangle (p₁ p₂ p₃ : P) : Real.Angle := o.oangle (p₁ -ᵥ p₂) (p₃ -ᵥ p₂) #align euclidean_geometry.oangle EuclideanGeometry.oangle @[inherit_doc] scoped notation "∡" => EuclideanGeometry.oangle theorem continuousAt_oangle {x : P × P × P} (hx12 : x.1 ≠ x.2.1) (hx32 : x.2.2 ≠ x.2.1) : ContinuousAt (fun y : P × P × P => ∡ y.1 y.2.1 y.2.2) x := by let f : P × P × P → V × V := fun y => (y.1 -ᵥ y.2.1, y.2.2 -ᵥ y.2.1) have hf1 : (f x).1 ≠ 0 := by simp [hx12] have hf2 : (f x).2 ≠ 0 := by simp [hx32] exact (o.continuousAt_oangle hf1 hf2).comp ((continuous_fst.vsub continuous_snd.fst).prod_mk (continuous_snd.snd.vsub continuous_snd.fst)).continuousAt #align euclidean_geometry.continuous_at_oangle EuclideanGeometry.continuousAt_oangle @[simp] theorem oangle_self_left (p₁ p₂ : P) : ∡ p₁ p₁ p₂ = 0 := by simp [oangle] #align euclidean_geometry.oangle_self_left EuclideanGeometry.oangle_self_left @[simp] theorem oangle_self_right (p₁ p₂ : P) : ∡ p₁ p₂ p₂ = 0 := by simp [oangle] #align euclidean_geometry.oangle_self_right EuclideanGeometry.oangle_self_right @[simp] theorem oangle_self_left_right (p₁ p₂ : P) : ∡ p₁ p₂ p₁ = 0 := o.oangle_self _ #align euclidean_geometry.oangle_self_left_right EuclideanGeometry.oangle_self_left_right theorem left_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₁ ≠ p₂ := by rw [← @vsub_ne_zero V]; exact o.left_ne_zero_of_oangle_ne_zero h #align euclidean_geometry.left_ne_of_oangle_ne_zero EuclideanGeometry.left_ne_of_oangle_ne_zero theorem right_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₃ ≠ p₂ := by rw [← @vsub_ne_zero V]; exact o.right_ne_zero_of_oangle_ne_zero h #align euclidean_geometry.right_ne_of_oangle_ne_zero EuclideanGeometry.right_ne_of_oangle_ne_zero theorem left_ne_right_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₁ ≠ p₃ := by rw [← (vsub_left_injective p₂).ne_iff]; exact o.ne_of_oangle_ne_zero h #align euclidean_geometry.left_ne_right_of_oangle_ne_zero EuclideanGeometry.left_ne_right_of_oangle_ne_zero theorem left_ne_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_pi EuclideanGeometry.left_ne_of_oangle_eq_pi theorem right_ne_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_pi EuclideanGeometry.right_ne_of_oangle_eq_pi theorem left_ne_right_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_pi EuclideanGeometry.left_ne_right_of_oangle_eq_pi theorem left_ne_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_pi_div_two EuclideanGeometry.left_ne_of_oangle_eq_pi_div_two theorem right_ne_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_pi_div_two EuclideanGeometry.right_ne_of_oangle_eq_pi_div_two theorem left_ne_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_pi_div_two EuclideanGeometry.left_ne_right_of_oangle_eq_pi_div_two theorem left_ne_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_neg_pi_div_two EuclideanGeometry.left_ne_of_oangle_eq_neg_pi_div_two theorem right_ne_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_neg_pi_div_two EuclideanGeometry.right_ne_of_oangle_eq_neg_pi_div_two theorem left_ne_right_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_neg_pi_div_two EuclideanGeometry.left_ne_right_of_oangle_eq_neg_pi_div_two theorem left_ne_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.left_ne_of_oangle_sign_ne_zero EuclideanGeometry.left_ne_of_oangle_sign_ne_zero theorem right_ne_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.right_ne_of_oangle_sign_ne_zero EuclideanGeometry.right_ne_of_oangle_sign_ne_zero theorem left_ne_right_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.left_ne_right_of_oangle_sign_ne_zero EuclideanGeometry.left_ne_right_of_oangle_sign_ne_zero theorem left_ne_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₁ ≠ p₂ := left_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_of_oangle_sign_eq_one EuclideanGeometry.left_ne_of_oangle_sign_eq_one theorem right_ne_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₃ ≠ p₂ := right_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.right_ne_of_oangle_sign_eq_one EuclideanGeometry.right_ne_of_oangle_sign_eq_one theorem left_ne_right_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₁ ≠ p₃ := left_ne_right_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_sign_eq_one EuclideanGeometry.left_ne_right_of_oangle_sign_eq_one theorem left_ne_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₁ ≠ p₂ := left_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_of_oangle_sign_eq_neg_one EuclideanGeometry.left_ne_of_oangle_sign_eq_neg_one theorem right_ne_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₃ ≠ p₂ := right_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.right_ne_of_oangle_sign_eq_neg_one EuclideanGeometry.right_ne_of_oangle_sign_eq_neg_one theorem left_ne_right_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₁ ≠ p₃ := left_ne_right_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_sign_eq_neg_one EuclideanGeometry.left_ne_right_of_oangle_sign_eq_neg_one theorem oangle_rev (p₁ p₂ p₃ : P) : ∡ p₃ p₂ p₁ = -∡ p₁ p₂ p₃ := o.oangle_rev _ _ #align euclidean_geometry.oangle_rev EuclideanGeometry.oangle_rev @[simp] theorem oangle_add_oangle_rev (p₁ p₂ p₃ : P) : ∡ p₁ p₂ p₃ + ∡ p₃ p₂ p₁ = 0 := o.oangle_add_oangle_rev _ _ #align euclidean_geometry.oangle_add_oangle_rev EuclideanGeometry.oangle_add_oangle_rev theorem oangle_eq_zero_iff_oangle_rev_eq_zero {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ↔ ∡ p₃ p₂ p₁ = 0 := o.oangle_eq_zero_iff_oangle_rev_eq_zero #align euclidean_geometry.oangle_eq_zero_iff_oangle_rev_eq_zero EuclideanGeometry.oangle_eq_zero_iff_oangle_rev_eq_zero theorem oangle_eq_pi_iff_oangle_rev_eq_pi {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = π ↔ ∡ p₃ p₂ p₁ = π := o.oangle_eq_pi_iff_oangle_rev_eq_pi #align euclidean_geometry.oangle_eq_pi_iff_oangle_rev_eq_pi EuclideanGeometry.oangle_eq_pi_iff_oangle_rev_eq_pi theorem oangle_ne_zero_and_ne_pi_iff_affineIndependent {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ ≠ 0 ∧ ∡ p₁ p₂ p₃ ≠ π ↔ AffineIndependent ℝ ![p₁, p₂, p₃] := by rw [oangle, o.oangle_ne_zero_and_ne_pi_iff_linearIndependent, affineIndependent_iff_linearIndependent_vsub ℝ _ (1 : Fin 3), ← linearIndependent_equiv (finSuccAboveEquiv (1 : Fin 3)).toEquiv] convert Iff.rfl ext i fin_cases i <;> rfl #align euclidean_geometry.oangle_ne_zero_and_ne_pi_iff_affine_independent EuclideanGeometry.oangle_ne_zero_and_ne_pi_iff_affineIndependent theorem oangle_eq_zero_or_eq_pi_iff_collinear {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ∨ ∡ p₁ p₂ p₃ = π ↔ Collinear ℝ ({p₁, p₂, p₃} : Set P) := by rw [← not_iff_not, not_or, oangle_ne_zero_and_ne_pi_iff_affineIndependent, affineIndependent_iff_not_collinear_set] #align euclidean_geometry.oangle_eq_zero_or_eq_pi_iff_collinear EuclideanGeometry.oangle_eq_zero_or_eq_pi_iff_collinear theorem oangle_sign_eq_zero_iff_collinear {p₁ p₂ p₃ : P} : (∡ p₁ p₂ p₃).sign = 0 ↔ Collinear ℝ ({p₁, p₂, p₃} : Set P) := by rw [Real.Angle.sign_eq_zero_iff, oangle_eq_zero_or_eq_pi_iff_collinear] theorem affineIndependent_iff_of_two_zsmul_oangle_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆) : AffineIndependent ℝ ![p₁, p₂, p₃] ↔ AffineIndependent ℝ ![p₄, p₅, p₆] := by simp_rw [← oangle_ne_zero_and_ne_pi_iff_affineIndependent, ← Real.Angle.two_zsmul_ne_zero_iff, h] #align euclidean_geometry.affine_independent_iff_of_two_zsmul_oangle_eq EuclideanGeometry.affineIndependent_iff_of_two_zsmul_oangle_eq theorem collinear_iff_of_two_zsmul_oangle_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆) : Collinear ℝ ({p₁, p₂, p₃} : Set P) ↔ Collinear ℝ ({p₄, p₅, p₆} : Set P) := by simp_rw [← oangle_eq_zero_or_eq_pi_iff_collinear, ← Real.Angle.two_zsmul_eq_zero_iff, h] #align euclidean_geometry.collinear_iff_of_two_zsmul_oangle_eq EuclideanGeometry.collinear_iff_of_two_zsmul_oangle_eq theorem two_zsmul_oangle_of_vectorSpan_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h₁₂₄₅ : vectorSpan ℝ ({p₁, p₂} : Set P) = vectorSpan ℝ ({p₄, p₅} : Set P)) (h₃₂₆₅ : vectorSpan ℝ ({p₃, p₂} : Set P) = vectorSpan ℝ ({p₆, p₅} : Set P)) : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆ := by simp_rw [vectorSpan_pair] at h₁₂₄₅ h₃₂₆₅ exact o.two_zsmul_oangle_of_span_eq_of_span_eq h₁₂₄₅ h₃₂₆₅ #align euclidean_geometry.two_zsmul_oangle_of_vector_span_eq EuclideanGeometry.two_zsmul_oangle_of_vectorSpan_eq theorem two_zsmul_oangle_of_parallel {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h₁₂₄₅ : line[ℝ, p₁, p₂] ∥ line[ℝ, p₄, p₅]) (h₃₂₆₅ : line[ℝ, p₃, p₂] ∥ line[ℝ, p₆, p₅]) : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆ := by rw [AffineSubspace.affineSpan_pair_parallel_iff_vectorSpan_eq] at h₁₂₄₅ h₃₂₆₅ exact two_zsmul_oangle_of_vectorSpan_eq h₁₂₄₅ h₃₂₆₅ #align euclidean_geometry.two_zsmul_oangle_of_parallel EuclideanGeometry.two_zsmul_oangle_of_parallel @[simp] theorem oangle_add {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₂ + ∡ p₂ p p₃ = ∡ p₁ p p₃ := o.oangle_add (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_add EuclideanGeometry.oangle_add @[simp] theorem oangle_add_swap {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₂ p p₃ + ∡ p₁ p p₂ = ∡ p₁ p p₃ := o.oangle_add_swap (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_add_swap EuclideanGeometry.oangle_add_swap @[simp] theorem oangle_sub_left {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₃ - ∡ p₁ p p₂ = ∡ p₂ p p₃ := o.oangle_sub_left (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_sub_left EuclideanGeometry.oangle_sub_left @[simp] theorem oangle_sub_right {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₃ - ∡ p₂ p p₃ = ∡ p₁ p p₂ := o.oangle_sub_right (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_sub_right EuclideanGeometry.oangle_sub_right @[simp] theorem oangle_add_cyc3 {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₂ + ∡ p₂ p p₃ + ∡ p₃ p p₁ = 0 := o.oangle_add_cyc3 (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_add_cyc3 EuclideanGeometry.oangle_add_cyc3 theorem oangle_eq_oangle_of_dist_eq {p₁ p₂ p₃ : P} (h : dist p₁ p₂ = dist p₁ p₃) : ∡ p₁ p₂ p₃ = ∡ p₂ p₃ p₁ := by simp_rw [dist_eq_norm_vsub V] at h rw [oangle, oangle, ← vsub_sub_vsub_cancel_left p₃ p₂ p₁, ← vsub_sub_vsub_cancel_left p₂ p₃ p₁, o.oangle_sub_eq_oangle_sub_rev_of_norm_eq h] #align euclidean_geometry.oangle_eq_oangle_of_dist_eq EuclideanGeometry.oangle_eq_oangle_of_dist_eq theorem oangle_eq_pi_sub_two_zsmul_oangle_of_dist_eq {p₁ p₂ p₃ : P} (hn : p₂ ≠ p₃) (h : dist p₁ p₂ = dist p₁ p₃) : ∡ p₃ p₁ p₂ = π - (2 : ℤ) • ∡ p₁ p₂ p₃ := by simp_rw [dist_eq_norm_vsub V] at h rw [oangle, oangle] convert o.oangle_eq_pi_sub_two_zsmul_oangle_sub_of_norm_eq _ h using 1 · rw [← neg_vsub_eq_vsub_rev p₁ p₃, ← neg_vsub_eq_vsub_rev p₁ p₂, o.oangle_neg_neg] · rw [← o.oangle_sub_eq_oangle_sub_rev_of_norm_eq h]; simp · simpa using hn #align euclidean_geometry.oangle_eq_pi_sub_two_zsmul_oangle_of_dist_eq EuclideanGeometry.oangle_eq_pi_sub_two_zsmul_oangle_of_dist_eq theorem abs_oangle_right_toReal_lt_pi_div_two_of_dist_eq {p₁ p₂ p₃ : P} (h : dist p₁ p₂ = dist p₁ p₃) : |(∡ p₁ p₂ p₃).toReal| < π / 2 := by simp_rw [dist_eq_norm_vsub V] at h rw [oangle, ← vsub_sub_vsub_cancel_left p₃ p₂ p₁] exact o.abs_oangle_sub_right_toReal_lt_pi_div_two h #align euclidean_geometry.abs_oangle_right_to_real_lt_pi_div_two_of_dist_eq EuclideanGeometry.abs_oangle_right_toReal_lt_pi_div_two_of_dist_eq theorem abs_oangle_left_toReal_lt_pi_div_two_of_dist_eq {p₁ p₂ p₃ : P} (h : dist p₁ p₂ = dist p₁ p₃) : |(∡ p₂ p₃ p₁).toReal| < π / 2 := oangle_eq_oangle_of_dist_eq h ▸ abs_oangle_right_toReal_lt_pi_div_two_of_dist_eq h #align euclidean_geometry.abs_oangle_left_to_real_lt_pi_div_two_of_dist_eq EuclideanGeometry.abs_oangle_left_toReal_lt_pi_div_two_of_dist_eq theorem cos_oangle_eq_cos_angle {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : Real.Angle.cos (∡ p₁ p p₂) = Real.cos (∠ p₁ p p₂) := o.cos_oangle_eq_cos_angle (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.cos_oangle_eq_cos_angle EuclideanGeometry.cos_oangle_eq_cos_angle theorem oangle_eq_angle_or_eq_neg_angle {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : ∡ p₁ p p₂ = ∠ p₁ p p₂ ∨ ∡ p₁ p p₂ = -∠ p₁ p p₂ := o.oangle_eq_angle_or_eq_neg_angle (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.oangle_eq_angle_or_eq_neg_angle EuclideanGeometry.oangle_eq_angle_or_eq_neg_angle theorem angle_eq_abs_oangle_toReal {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : ∠ p₁ p p₂ = |(∡ p₁ p p₂).toReal| := o.angle_eq_abs_oangle_toReal (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.angle_eq_abs_oangle_to_real EuclideanGeometry.angle_eq_abs_oangle_toReal theorem eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero {p p₁ p₂ : P} (h : (∡ p₁ p p₂).sign = 0) : p₁ = p ∨ p₂ = p ∨ ∠ p₁ p p₂ = 0 ∨ ∠ p₁ p p₂ = π := by convert o.eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero h <;> simp #align euclidean_geometry.eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero EuclideanGeometry.eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero theorem oangle_eq_of_angle_eq_of_sign_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h : ∠ p₁ p₂ p₃ = ∠ p₄ p₅ p₆) (hs : (∡ p₁ p₂ p₃).sign = (∡ p₄ p₅ p₆).sign) : ∡ p₁ p₂ p₃ = ∡ p₄ p₅ p₆ := o.oangle_eq_of_angle_eq_of_sign_eq h hs #align euclidean_geometry.oangle_eq_of_angle_eq_of_sign_eq EuclideanGeometry.oangle_eq_of_angle_eq_of_sign_eq theorem angle_eq_iff_oangle_eq_of_sign_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (hp₁ : p₁ ≠ p₂) (hp₃ : p₃ ≠ p₂) (hp₄ : p₄ ≠ p₅) (hp₆ : p₆ ≠ p₅) (hs : (∡ p₁ p₂ p₃).sign = (∡ p₄ p₅ p₆).sign) : ∠ p₁ p₂ p₃ = ∠ p₄ p₅ p₆ ↔ ∡ p₁ p₂ p₃ = ∡ p₄ p₅ p₆ := o.angle_eq_iff_oangle_eq_of_sign_eq (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₃) (vsub_ne_zero.2 hp₄) (vsub_ne_zero.2 hp₆) hs #align euclidean_geometry.angle_eq_iff_oangle_eq_of_sign_eq EuclideanGeometry.angle_eq_iff_oangle_eq_of_sign_eq theorem oangle_eq_angle_of_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : ∡ p₁ p₂ p₃ = ∠ p₁ p₂ p₃ := o.oangle_eq_angle_of_sign_eq_one h #align euclidean_geometry.oangle_eq_angle_of_sign_eq_one EuclideanGeometry.oangle_eq_angle_of_sign_eq_one theorem oangle_eq_neg_angle_of_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : ∡ p₁ p₂ p₃ = -∠ p₁ p₂ p₃ := o.oangle_eq_neg_angle_of_sign_eq_neg_one h #align euclidean_geometry.oangle_eq_neg_angle_of_sign_eq_neg_one EuclideanGeometry.oangle_eq_neg_angle_of_sign_eq_neg_one theorem oangle_eq_zero_iff_angle_eq_zero {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : ∡ p₁ p p₂ = 0 ↔ ∠ p₁ p p₂ = 0 := o.oangle_eq_zero_iff_angle_eq_zero (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.oangle_eq_zero_iff_angle_eq_zero EuclideanGeometry.oangle_eq_zero_iff_angle_eq_zero theorem oangle_eq_pi_iff_angle_eq_pi {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = π ↔ ∠ p₁ p₂ p₃ = π := o.oangle_eq_pi_iff_angle_eq_pi #align euclidean_geometry.oangle_eq_pi_iff_angle_eq_pi EuclideanGeometry.oangle_eq_pi_iff_angle_eq_pi theorem angle_eq_pi_div_two_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∠ p₁ p₂ p₃ = π / 2 := by rw [angle, ← InnerProductGeometry.inner_eq_zero_iff_angle_eq_pi_div_two] exact o.inner_eq_zero_of_oangle_eq_pi_div_two h #align euclidean_geometry.angle_eq_pi_div_two_of_oangle_eq_pi_div_two EuclideanGeometry.angle_eq_pi_div_two_of_oangle_eq_pi_div_two theorem angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∠ p₃ p₂ p₁ = π / 2 := by rw [angle_comm] exact angle_eq_pi_div_two_of_oangle_eq_pi_div_two h #align euclidean_geometry.angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two EuclideanGeometry.angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two theorem angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(-π / 2)) : ∠ p₁ p₂ p₃ = π / 2 := by rw [angle, ← InnerProductGeometry.inner_eq_zero_iff_angle_eq_pi_div_two] exact o.inner_eq_zero_of_oangle_eq_neg_pi_div_two h #align euclidean_geometry.angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two EuclideanGeometry.angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two theorem angle_rev_eq_pi_div_two_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(-π / 2)) : ∠ p₃ p₂ p₁ = π / 2 := by rw [angle_comm] exact angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two h #align euclidean_geometry.angle_rev_eq_pi_div_two_of_oangle_eq_neg_pi_div_two EuclideanGeometry.angle_rev_eq_pi_div_two_of_oangle_eq_neg_pi_div_two theorem oangle_swap₁₂_sign (p₁ p₂ p₃ : P) : -(∡ p₁ p₂ p₃).sign = (∡ p₂ p₁ p₃).sign := by rw [eq_comm, oangle, oangle, ← o.oangle_neg_neg, neg_vsub_eq_vsub_rev, neg_vsub_eq_vsub_rev, ← vsub_sub_vsub_cancel_left p₁ p₃ p₂, ← neg_vsub_eq_vsub_rev p₃ p₂, sub_eq_add_neg, neg_vsub_eq_vsub_rev p₂ p₁, add_comm, ← @neg_one_smul ℝ] nth_rw 2 [← one_smul ℝ (p₁ -ᵥ p₂)] rw [o.oangle_sign_smul_add_smul_right] simp #align euclidean_geometry.oangle_swap₁₂_sign EuclideanGeometry.oangle_swap₁₂_sign theorem oangle_swap₁₃_sign (p₁ p₂ p₃ : P) : -(∡ p₁ p₂ p₃).sign = (∡ p₃ p₂ p₁).sign := by rw [oangle_rev, Real.Angle.sign_neg, neg_neg] #align euclidean_geometry.oangle_swap₁₃_sign EuclideanGeometry.oangle_swap₁₃_sign theorem oangle_swap₂₃_sign (p₁ p₂ p₃ : P) : -(∡ p₁ p₂ p₃).sign = (∡ p₁ p₃ p₂).sign := by rw [oangle_swap₁₃_sign, ← oangle_swap₁₂_sign, oangle_swap₁₃_sign] #align euclidean_geometry.oangle_swap₂₃_sign EuclideanGeometry.oangle_swap₂₃_sign theorem oangle_rotate_sign (p₁ p₂ p₃ : P) : (∡ p₂ p₃ p₁).sign = (∡ p₁ p₂ p₃).sign := by rw [← oangle_swap₁₂_sign, oangle_swap₁₃_sign] #align euclidean_geometry.oangle_rotate_sign EuclideanGeometry.oangle_rotate_sign theorem oangle_eq_pi_iff_sbtw {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = π ↔ Sbtw ℝ p₁ p₂ p₃ := by rw [oangle_eq_pi_iff_angle_eq_pi, angle_eq_pi_iff_sbtw] #align euclidean_geometry.oangle_eq_pi_iff_sbtw EuclideanGeometry.oangle_eq_pi_iff_sbtw theorem _root_.Sbtw.oangle₁₂₃_eq_pi {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₁ p₂ p₃ = π := oangle_eq_pi_iff_sbtw.2 h #align sbtw.oangle₁₂₃_eq_pi Sbtw.oangle₁₂₃_eq_pi theorem _root_.Sbtw.oangle₃₂₁_eq_pi {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₃ p₂ p₁ = π := by rw [oangle_eq_pi_iff_oangle_rev_eq_pi, ← h.oangle₁₂₃_eq_pi] #align sbtw.oangle₃₂₁_eq_pi Sbtw.oangle₃₂₁_eq_pi theorem _root_.Wbtw.oangle₂₁₃_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₁ p₃ = 0 := by by_cases hp₂p₁ : p₂ = p₁; · simp [hp₂p₁] by_cases hp₃p₁ : p₃ = p₁; · simp [hp₃p₁] rw [oangle_eq_zero_iff_angle_eq_zero hp₂p₁ hp₃p₁] exact h.angle₂₁₃_eq_zero_of_ne hp₂p₁ #align wbtw.oangle₂₁₃_eq_zero Wbtw.oangle₂₁₃_eq_zero theorem _root_.Sbtw.oangle₂₁₃_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₁ p₃ = 0 := h.wbtw.oangle₂₁₃_eq_zero #align sbtw.oangle₂₁₃_eq_zero Sbtw.oangle₂₁₃_eq_zero theorem _root_.Wbtw.oangle₃₁₂_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₃ p₁ p₂ = 0 := by rw [oangle_eq_zero_iff_oangle_rev_eq_zero, h.oangle₂₁₃_eq_zero] #align wbtw.oangle₃₁₂_eq_zero Wbtw.oangle₃₁₂_eq_zero theorem _root_.Sbtw.oangle₃₁₂_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₃ p₁ p₂ = 0 := h.wbtw.oangle₃₁₂_eq_zero #align sbtw.oangle₃₁₂_eq_zero Sbtw.oangle₃₁₂_eq_zero theorem _root_.Wbtw.oangle₂₃₁_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₃ p₁ = 0 := h.symm.oangle₂₁₃_eq_zero #align wbtw.oangle₂₃₁_eq_zero Wbtw.oangle₂₃₁_eq_zero theorem _root_.Sbtw.oangle₂₃₁_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₃ p₁ = 0 := h.wbtw.oangle₂₃₁_eq_zero #align sbtw.oangle₂₃₁_eq_zero Sbtw.oangle₂₃₁_eq_zero theorem _root_.Wbtw.oangle₁₃₂_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₁ p₃ p₂ = 0 := h.symm.oangle₃₁₂_eq_zero #align wbtw.oangle₁₃₂_eq_zero Wbtw.oangle₁₃₂_eq_zero theorem _root_.Sbtw.oangle₁₃₂_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₁ p₃ p₂ = 0 := h.wbtw.oangle₁₃₂_eq_zero #align sbtw.oangle₁₃₂_eq_zero Sbtw.oangle₁₃₂_eq_zero theorem oangle_eq_zero_iff_wbtw {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ↔ Wbtw ℝ p₂ p₁ p₃ ∨ Wbtw ℝ p₂ p₃ p₁ := by by_cases hp₁p₂ : p₁ = p₂; · simp [hp₁p₂] by_cases hp₃p₂ : p₃ = p₂; · simp [hp₃p₂] rw [oangle_eq_zero_iff_angle_eq_zero hp₁p₂ hp₃p₂, angle_eq_zero_iff_ne_and_wbtw] simp [hp₁p₂, hp₃p₂] #align euclidean_geometry.oangle_eq_zero_iff_wbtw EuclideanGeometry.oangle_eq_zero_iff_wbtw theorem _root_.Wbtw.oangle_eq_left {p₁ p₁' p₂ p₃ : P} (h : Wbtw ℝ p₂ p₁ p₁') (hp₁p₂ : p₁ ≠ p₂) : ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ := by by_cases hp₃p₂ : p₃ = p₂; · simp [hp₃p₂] by_cases hp₁'p₂ : p₁' = p₂; · rw [hp₁'p₂, wbtw_self_iff] at h; exact False.elim (hp₁p₂ h) rw [← oangle_add hp₁'p₂ hp₁p₂ hp₃p₂, h.oangle₃₁₂_eq_zero, zero_add] #align wbtw.oangle_eq_left Wbtw.oangle_eq_left theorem _root_.Sbtw.oangle_eq_left {p₁ p₁' p₂ p₃ : P} (h : Sbtw ℝ p₂ p₁ p₁') : ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ := h.wbtw.oangle_eq_left h.ne_left #align sbtw.oangle_eq_left Sbtw.oangle_eq_left theorem _root_.Wbtw.oangle_eq_right {p₁ p₂ p₃ p₃' : P} (h : Wbtw ℝ p₂ p₃ p₃') (hp₃p₂ : p₃ ≠ p₂) : ∡ p₁ p₂ p₃ = ∡ p₁ p₂ p₃' := by rw [oangle_rev, h.oangle_eq_left hp₃p₂, ← oangle_rev] #align wbtw.oangle_eq_right Wbtw.oangle_eq_right theorem _root_.Sbtw.oangle_eq_right {p₁ p₂ p₃ p₃' : P} (h : Sbtw ℝ p₂ p₃ p₃') : ∡ p₁ p₂ p₃ = ∡ p₁ p₂ p₃' := h.wbtw.oangle_eq_right h.ne_left #align sbtw.oangle_eq_right Sbtw.oangle_eq_right @[simp] theorem oangle_midpoint_left (p₁ p₂ p₃ : P) : ∡ (midpoint ℝ p₁ p₂) p₂ p₃ = ∡ p₁ p₂ p₃ := by by_cases h : p₁ = p₂; · simp [h] exact (sbtw_midpoint_of_ne ℝ h).symm.oangle_eq_left #align euclidean_geometry.oangle_midpoint_left EuclideanGeometry.oangle_midpoint_left @[simp] theorem oangle_midpoint_rev_left (p₁ p₂ p₃ : P) : ∡ (midpoint ℝ p₂ p₁) p₂ p₃ = ∡ p₁ p₂ p₃ := by rw [midpoint_comm, oangle_midpoint_left] #align euclidean_geometry.oangle_midpoint_rev_left EuclideanGeometry.oangle_midpoint_rev_left @[simp] theorem oangle_midpoint_right (p₁ p₂ p₃ : P) : ∡ p₁ p₂ (midpoint ℝ p₃ p₂) = ∡ p₁ p₂ p₃ := by by_cases h : p₃ = p₂; · simp [h] exact (sbtw_midpoint_of_ne ℝ h).symm.oangle_eq_right #align euclidean_geometry.oangle_midpoint_right EuclideanGeometry.oangle_midpoint_right @[simp] theorem oangle_midpoint_rev_right (p₁ p₂ p₃ : P) : ∡ p₁ p₂ (midpoint ℝ p₂ p₃) = ∡ p₁ p₂ p₃ := by rw [midpoint_comm, oangle_midpoint_right] #align euclidean_geometry.oangle_midpoint_rev_right EuclideanGeometry.oangle_midpoint_rev_right theorem _root_.Sbtw.oangle_eq_add_pi_left {p₁ p₁' p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₁') (hp₃p₂ : p₃ ≠ p₂) : ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ + π := by rw [← h.oangle₁₂₃_eq_pi, oangle_add_swap h.left_ne h.right_ne hp₃p₂] #align sbtw.oangle_eq_add_pi_left Sbtw.oangle_eq_add_pi_left theorem _root_.Sbtw.oangle_eq_add_pi_right {p₁ p₂ p₃ p₃' : P} (h : Sbtw ℝ p₃ p₂ p₃') (hp₁p₂ : p₁ ≠ p₂) : ∡ p₁ p₂ p₃ = ∡ p₁ p₂ p₃' + π := by rw [← h.oangle₃₂₁_eq_pi, oangle_add hp₁p₂ h.right_ne h.left_ne] #align sbtw.oangle_eq_add_pi_right Sbtw.oangle_eq_add_pi_right theorem _root_.Sbtw.oangle_eq_left_right {p₁ p₁' p₂ p₃ p₃' : P} (h₁ : Sbtw ℝ p₁ p₂ p₁') (h₃ : Sbtw ℝ p₃ p₂ p₃') : ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃' := by rw [h₁.oangle_eq_add_pi_left h₃.left_ne, h₃.oangle_eq_add_pi_right h₁.right_ne, add_assoc, Real.Angle.coe_pi_add_coe_pi, add_zero] #align sbtw.oangle_eq_left_right Sbtw.oangle_eq_left_right theorem _root_.Collinear.two_zsmul_oangle_eq_left {p₁ p₁' p₂ p₃ : P} (h : Collinear ℝ ({p₁, p₂, p₁'} : Set P)) (hp₁p₂ : p₁ ≠ p₂) (hp₁'p₂ : p₁' ≠ p₂) : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₁' p₂ p₃ := by by_cases hp₃p₂ : p₃ = p₂; · simp [hp₃p₂] rcases h.wbtw_or_wbtw_or_wbtw with (hw | hw | hw) · have hw' : Sbtw ℝ p₁ p₂ p₁' := ⟨hw, hp₁p₂.symm, hp₁'p₂.symm⟩ rw [hw'.oangle_eq_add_pi_left hp₃p₂, smul_add, Real.Angle.two_zsmul_coe_pi, add_zero] · rw [hw.oangle_eq_left hp₁'p₂] · rw [hw.symm.oangle_eq_left hp₁p₂] #align collinear.two_zsmul_oangle_eq_left Collinear.two_zsmul_oangle_eq_left theorem _root_.Collinear.two_zsmul_oangle_eq_right {p₁ p₂ p₃ p₃' : P} (h : Collinear ℝ ({p₃, p₂, p₃'} : Set P)) (hp₃p₂ : p₃ ≠ p₂) (hp₃'p₂ : p₃' ≠ p₂) : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₁ p₂ p₃' := by rw [oangle_rev, smul_neg, h.two_zsmul_oangle_eq_left hp₃p₂ hp₃'p₂, ← smul_neg, ← oangle_rev] #align collinear.two_zsmul_oangle_eq_right Collinear.two_zsmul_oangle_eq_right theorem dist_eq_iff_eq_smul_rotation_pi_div_two_vadd_midpoint {p₁ p₂ p : P} (h : p₁ ≠ p₂) : dist p₁ p = dist p₂ p ↔ ∃ r : ℝ, r • o.rotation (π / 2 : ℝ) (p₂ -ᵥ p₁) +ᵥ midpoint ℝ p₁ p₂ = p := by refine ⟨fun hd => ?_, fun hr => ?_⟩ · have hi : ⟪p₂ -ᵥ p₁, p -ᵥ midpoint ℝ p₁ p₂⟫ = 0 := by rw [@dist_eq_norm_vsub' V, @dist_eq_norm_vsub' V, ← mul_self_inj (norm_nonneg _) (norm_nonneg _), ← real_inner_self_eq_norm_mul_norm, ← real_inner_self_eq_norm_mul_norm] at hd simp_rw [vsub_midpoint, ← vsub_sub_vsub_cancel_left p₂ p₁ p, inner_sub_left, inner_add_right, inner_smul_right, hd, real_inner_comm (p -ᵥ p₁)] abel rw [@Orientation.inner_eq_zero_iff_eq_zero_or_eq_smul_rotation_pi_div_two V _ _ _ o, or_iff_right (vsub_ne_zero.2 h.symm)] at hi rcases hi with ⟨r, hr⟩ rw [eq_comm, ← eq_vadd_iff_vsub_eq] at hr exact ⟨r, hr.symm⟩ · rcases hr with ⟨r, rfl⟩ simp_rw [@dist_eq_norm_vsub V, vsub_vadd_eq_vsub_sub, left_vsub_midpoint, right_vsub_midpoint, invOf_eq_inv, ← neg_vsub_eq_vsub_rev p₂ p₁, ← mul_self_inj (norm_nonneg _) (norm_nonneg _), ← real_inner_self_eq_norm_mul_norm, inner_sub_sub_self] simp [-neg_vsub_eq_vsub_rev] #align euclidean_geometry.dist_eq_iff_eq_smul_rotation_pi_div_two_vadd_midpoint EuclideanGeometry.dist_eq_iff_eq_smul_rotation_pi_div_two_vadd_midpoint open AffineSubspace theorem _root_.Collinear.oangle_sign_of_sameRay_vsub {p₁ p₂ p₃ p₄ : P} (p₅ : P) (hp₁p₂ : p₁ ≠ p₂) (hp₃p₄ : p₃ ≠ p₄) (hc : Collinear ℝ ({p₁, p₂, p₃, p₄} : Set P)) (hr : SameRay ℝ (p₂ -ᵥ p₁) (p₄ -ᵥ p₃)) : (∡ p₁ p₅ p₂).sign = (∡ p₃ p₅ p₄).sign := by by_cases hc₅₁₂ : Collinear ℝ ({p₅, p₁, p₂} : Set P) · have hc₅₁₂₃₄ : Collinear ℝ ({p₅, p₁, p₂, p₃, p₄} : Set P) := (hc.collinear_insert_iff_of_ne (Set.mem_insert _ _) (Set.mem_insert_of_mem _ (Set.mem_insert _ _)) hp₁p₂).2 hc₅₁₂ have hc₅₃₄ : Collinear ℝ ({p₅, p₃, p₄} : Set P) := (hc.collinear_insert_iff_of_ne (Set.mem_insert_of_mem _ (Set.mem_insert_of_mem _ (Set.mem_insert _ _))) (Set.mem_insert_of_mem _ (Set.mem_insert_of_mem _ (Set.mem_insert_of_mem _ (Set.mem_singleton _)))) hp₃p₄).1 hc₅₁₂₃₄ rw [Set.insert_comm] at hc₅₁₂ hc₅₃₄ have hs₁₅₂ := oangle_eq_zero_or_eq_pi_iff_collinear.2 hc₅₁₂ have hs₃₅₄ := oangle_eq_zero_or_eq_pi_iff_collinear.2 hc₅₃₄ rw [← Real.Angle.sign_eq_zero_iff] at hs₁₅₂ hs₃₅₄ rw [hs₁₅₂, hs₃₅₄] · let s : Set (P × P × P) := (fun x : line[ℝ, p₁, p₂] × V => (x.1, p₅, x.2 +ᵥ (x.1 : P))) '' Set.univ ×ˢ {v | SameRay ℝ (p₂ -ᵥ p₁) v ∧ v ≠ 0} have hco : IsConnected s := haveI : ConnectedSpace line[ℝ, p₁, p₂] := AddTorsor.connectedSpace _ _ (isConnected_univ.prod (isConnected_setOf_sameRay_and_ne_zero (vsub_ne_zero.2 hp₁p₂.symm))).image _ (continuous_fst.subtype_val.prod_mk (continuous_const.prod_mk (continuous_snd.vadd continuous_fst.subtype_val))).continuousOn have hf : ContinuousOn (fun p : P × P × P => ∡ p.1 p.2.1 p.2.2) s := by refine ContinuousAt.continuousOn fun p hp => continuousAt_oangle ?_ ?_ all_goals simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_univ, true_and_iff, Prod.ext_iff] at hp obtain ⟨q₁, q₅, q₂⟩ := p dsimp only at hp ⊢ obtain ⟨⟨⟨q, hq⟩, v⟩, hv, rfl, rfl, rfl⟩ := hp dsimp only [Subtype.coe_mk, Set.mem_setOf] at hv ⊢ obtain ⟨hvr, -⟩ := hv rintro rfl refine hc₅₁₂ ((collinear_insert_iff_of_mem_affineSpan ?_).2 (collinear_pair _ _ _)) · exact hq · refine vadd_mem_of_mem_direction ?_ hq rw [← exists_nonneg_left_iff_sameRay (vsub_ne_zero.2 hp₁p₂.symm)] at hvr obtain ⟨r, -, rfl⟩ := hvr rw [direction_affineSpan] exact smul_vsub_rev_mem_vectorSpan_pair _ _ _ have hsp : ∀ p : P × P × P, p ∈ s → ∡ p.1 p.2.1 p.2.2 ≠ 0 ∧ ∡ p.1 p.2.1 p.2.2 ≠ π := by intro p hp simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_setOf, Set.mem_univ, true_and_iff, Prod.ext_iff] at hp obtain ⟨q₁, q₅, q₂⟩ := p dsimp only at hp ⊢ obtain ⟨⟨⟨q, hq⟩, v⟩, hv, rfl, rfl, rfl⟩ := hp dsimp only [Subtype.coe_mk, Set.mem_setOf] at hv ⊢ obtain ⟨hvr, hv0⟩ := hv rw [← exists_nonneg_left_iff_sameRay (vsub_ne_zero.2 hp₁p₂.symm)] at hvr obtain ⟨r, -, rfl⟩ := hvr change q ∈ line[ℝ, p₁, p₂] at hq rw [oangle_ne_zero_and_ne_pi_iff_affineIndependent] refine affineIndependent_of_ne_of_mem_of_not_mem_of_mem ?_ hq (fun h => hc₅₁₂ ((collinear_insert_iff_of_mem_affineSpan h).2 (collinear_pair _ _ _))) ?_ · rwa [← @vsub_ne_zero V, vsub_vadd_eq_vsub_sub, vsub_self, zero_sub, neg_ne_zero] · refine vadd_mem_of_mem_direction ?_ hq rw [direction_affineSpan] exact smul_vsub_rev_mem_vectorSpan_pair _ _ _ have hp₁p₂s : (p₁, p₅, p₂) ∈ s := by simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_setOf, Set.mem_univ, true_and_iff, Prod.ext_iff] refine ⟨⟨⟨p₁, left_mem_affineSpan_pair ℝ _ _⟩, p₂ -ᵥ p₁⟩, ⟨SameRay.rfl, vsub_ne_zero.2 hp₁p₂.symm⟩, ?_⟩ simp have hp₃p₄s : (p₃, p₅, p₄) ∈ s := by simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_setOf, Set.mem_univ, true_and_iff, Prod.ext_iff] refine ⟨⟨⟨p₃, hc.mem_affineSpan_of_mem_of_ne (Set.mem_insert _ _) (Set.mem_insert_of_mem _ (Set.mem_insert _ _)) (Set.mem_insert_of_mem _ (Set.mem_insert_of_mem _ (Set.mem_insert _ _))) hp₁p₂⟩, p₄ -ᵥ p₃⟩, ⟨hr, vsub_ne_zero.2 hp₃p₄.symm⟩, ?_⟩ simp convert Real.Angle.sign_eq_of_continuousOn hco hf hsp hp₃p₄s hp₁p₂s #align collinear.oangle_sign_of_same_ray_vsub Collinear.oangle_sign_of_sameRay_vsub theorem _root_.Sbtw.oangle_sign_eq {p₁ p₂ p₃ : P} (p₄ : P) (h : Sbtw ℝ p₁ p₂ p₃) : (∡ p₁ p₄ p₂).sign = (∡ p₂ p₄ p₃).sign := haveI hc : Collinear ℝ ({p₁, p₂, p₂, p₃} : Set P) := by simpa using h.wbtw.collinear hc.oangle_sign_of_sameRay_vsub _ h.left_ne h.ne_right h.wbtw.sameRay_vsub #align sbtw.oangle_sign_eq Sbtw.oangle_sign_eq theorem _root_.Wbtw.oangle_sign_eq_of_ne_left {p₁ p₂ p₃ : P} (p₄ : P) (h : Wbtw ℝ p₁ p₂ p₃) (hne : p₁ ≠ p₂) : (∡ p₁ p₄ p₂).sign = (∡ p₁ p₄ p₃).sign := haveI hc : Collinear ℝ ({p₁, p₂, p₁, p₃} : Set P) := by simpa [Set.insert_comm p₂] using h.collinear hc.oangle_sign_of_sameRay_vsub _ hne (h.left_ne_right_of_ne_left hne.symm) h.sameRay_vsub_left #align wbtw.oangle_sign_eq_of_ne_left Wbtw.oangle_sign_eq_of_ne_left theorem _root_.Sbtw.oangle_sign_eq_left {p₁ p₂ p₃ : P} (p₄ : P) (h : Sbtw ℝ p₁ p₂ p₃) : (∡ p₁ p₄ p₂).sign = (∡ p₁ p₄ p₃).sign := h.wbtw.oangle_sign_eq_of_ne_left _ h.left_ne #align sbtw.oangle_sign_eq_left Sbtw.oangle_sign_eq_left theorem _root_.Wbtw.oangle_sign_eq_of_ne_right {p₁ p₂ p₃ : P} (p₄ : P) (h : Wbtw ℝ p₁ p₂ p₃) (hne : p₂ ≠ p₃) : (∡ p₂ p₄ p₃).sign = (∡ p₁ p₄ p₃).sign := by simp_rw [oangle_rev p₃, Real.Angle.sign_neg, h.symm.oangle_sign_eq_of_ne_left _ hne.symm] #align wbtw.oangle_sign_eq_of_ne_right Wbtw.oangle_sign_eq_of_ne_right theorem _root_.Sbtw.oangle_sign_eq_right {p₁ p₂ p₃ : P} (p₄ : P) (h : Sbtw ℝ p₁ p₂ p₃) : (∡ p₂ p₄ p₃).sign = (∡ p₁ p₄ p₃).sign := h.wbtw.oangle_sign_eq_of_ne_right _ h.ne_right #align sbtw.oangle_sign_eq_right Sbtw.oangle_sign_eq_right
Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean
808
834
theorem _root_.AffineSubspace.SSameSide.oangle_sign_eq {s : AffineSubspace ℝ P} {p₁ p₂ p₃ p₄ : P} (hp₁ : p₁ ∈ s) (hp₂ : p₂ ∈ s) (hp₃p₄ : s.SSameSide p₃ p₄) : (∡ p₁ p₄ p₂).sign = (∡ p₁ p₃ p₂).sign := by
by_cases h : p₁ = p₂; · simp [h] let sp : Set (P × P × P) := (fun p : P => (p₁, p, p₂)) '' {p | s.SSameSide p₃ p} have hc : IsConnected sp := (isConnected_setOf_sSameSide hp₃p₄.2.1 hp₃p₄.nonempty).image _ (continuous_const.prod_mk (Continuous.Prod.mk_left _)).continuousOn have hf : ContinuousOn (fun p : P × P × P => ∡ p.1 p.2.1 p.2.2) sp := by refine ContinuousAt.continuousOn fun p hp => continuousAt_oangle ?_ ?_ all_goals simp_rw [sp, Set.mem_image, Set.mem_setOf] at hp obtain ⟨p', hp', rfl⟩ := hp dsimp only rintro rfl · exact hp'.2.2 hp₁ · exact hp'.2.2 hp₂ have hsp : ∀ p : P × P × P, p ∈ sp → ∡ p.1 p.2.1 p.2.2 ≠ 0 ∧ ∡ p.1 p.2.1 p.2.2 ≠ π := by intro p hp simp_rw [sp, Set.mem_image, Set.mem_setOf] at hp obtain ⟨p', hp', rfl⟩ := hp dsimp only rw [oangle_ne_zero_and_ne_pi_iff_affineIndependent] exact affineIndependent_of_ne_of_mem_of_not_mem_of_mem h hp₁ hp'.2.2 hp₂ have hp₃ : (p₁, p₃, p₂) ∈ sp := Set.mem_image_of_mem _ (sSameSide_self_iff.2 ⟨hp₃p₄.nonempty, hp₃p₄.2.1⟩) have hp₄ : (p₁, p₄, p₂) ∈ sp := Set.mem_image_of_mem _ hp₃p₄ convert Real.Angle.sign_eq_of_continuousOn hc hf hsp hp₃ hp₄
import Mathlib.CategoryTheory.Comma.Over import Mathlib.CategoryTheory.DiscreteCategory import Mathlib.CategoryTheory.EpiMono import Mathlib.CategoryTheory.Limits.Shapes.Terminal #align_import category_theory.limits.shapes.binary_products from "leanprover-community/mathlib"@"fec1d95fc61c750c1ddbb5b1f7f48b8e811a80d7" noncomputable section universe v u u₂ open CategoryTheory namespace CategoryTheory.Limits inductive WalkingPair : Type | left | right deriving DecidableEq, Inhabited #align category_theory.limits.walking_pair CategoryTheory.Limits.WalkingPair open WalkingPair def WalkingPair.swap : WalkingPair ≃ WalkingPair where toFun j := WalkingPair.recOn j right left invFun j := WalkingPair.recOn j right left left_inv j := by cases j; repeat rfl right_inv j := by cases j; repeat rfl #align category_theory.limits.walking_pair.swap CategoryTheory.Limits.WalkingPair.swap @[simp] theorem WalkingPair.swap_apply_left : WalkingPair.swap left = right := rfl #align category_theory.limits.walking_pair.swap_apply_left CategoryTheory.Limits.WalkingPair.swap_apply_left @[simp] theorem WalkingPair.swap_apply_right : WalkingPair.swap right = left := rfl #align category_theory.limits.walking_pair.swap_apply_right CategoryTheory.Limits.WalkingPair.swap_apply_right @[simp] theorem WalkingPair.swap_symm_apply_tt : WalkingPair.swap.symm left = right := rfl #align category_theory.limits.walking_pair.swap_symm_apply_tt CategoryTheory.Limits.WalkingPair.swap_symm_apply_tt @[simp] theorem WalkingPair.swap_symm_apply_ff : WalkingPair.swap.symm right = left := rfl #align category_theory.limits.walking_pair.swap_symm_apply_ff CategoryTheory.Limits.WalkingPair.swap_symm_apply_ff def WalkingPair.equivBool : WalkingPair ≃ Bool where toFun j := WalkingPair.recOn j true false -- to match equiv.sum_equiv_sigma_bool invFun b := Bool.recOn b right left left_inv j := by cases j; repeat rfl right_inv b := by cases b; repeat rfl #align category_theory.limits.walking_pair.equiv_bool CategoryTheory.Limits.WalkingPair.equivBool @[simp] theorem WalkingPair.equivBool_apply_left : WalkingPair.equivBool left = true := rfl #align category_theory.limits.walking_pair.equiv_bool_apply_left CategoryTheory.Limits.WalkingPair.equivBool_apply_left @[simp] theorem WalkingPair.equivBool_apply_right : WalkingPair.equivBool right = false := rfl #align category_theory.limits.walking_pair.equiv_bool_apply_right CategoryTheory.Limits.WalkingPair.equivBool_apply_right @[simp] theorem WalkingPair.equivBool_symm_apply_true : WalkingPair.equivBool.symm true = left := rfl #align category_theory.limits.walking_pair.equiv_bool_symm_apply_tt CategoryTheory.Limits.WalkingPair.equivBool_symm_apply_true @[simp] theorem WalkingPair.equivBool_symm_apply_false : WalkingPair.equivBool.symm false = right := rfl #align category_theory.limits.walking_pair.equiv_bool_symm_apply_ff CategoryTheory.Limits.WalkingPair.equivBool_symm_apply_false variable {C : Type u} def pairFunction (X Y : C) : WalkingPair → C := fun j => WalkingPair.casesOn j X Y #align category_theory.limits.pair_function CategoryTheory.Limits.pairFunction @[simp] theorem pairFunction_left (X Y : C) : pairFunction X Y left = X := rfl #align category_theory.limits.pair_function_left CategoryTheory.Limits.pairFunction_left @[simp] theorem pairFunction_right (X Y : C) : pairFunction X Y right = Y := rfl #align category_theory.limits.pair_function_right CategoryTheory.Limits.pairFunction_right variable [Category.{v} C] def pair (X Y : C) : Discrete WalkingPair ⥤ C := Discrete.functor fun j => WalkingPair.casesOn j X Y #align category_theory.limits.pair CategoryTheory.Limits.pair @[simp] theorem pair_obj_left (X Y : C) : (pair X Y).obj ⟨left⟩ = X := rfl #align category_theory.limits.pair_obj_left CategoryTheory.Limits.pair_obj_left @[simp] theorem pair_obj_right (X Y : C) : (pair X Y).obj ⟨right⟩ = Y := rfl #align category_theory.limits.pair_obj_right CategoryTheory.Limits.pair_obj_right section variable {F G : Discrete WalkingPair ⥤ C} (f : F.obj ⟨left⟩ ⟶ G.obj ⟨left⟩) (g : F.obj ⟨right⟩ ⟶ G.obj ⟨right⟩) attribute [local aesop safe tactic (rule_sets := [CategoryTheory])] CategoryTheory.Discrete.discreteCases def mapPair : F ⟶ G where app j := Discrete.recOn j fun j => WalkingPair.casesOn j f g naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨u⟩⟩ => by aesop_cat #align category_theory.limits.map_pair CategoryTheory.Limits.mapPair @[simp] theorem mapPair_left : (mapPair f g).app ⟨left⟩ = f := rfl #align category_theory.limits.map_pair_left CategoryTheory.Limits.mapPair_left @[simp] theorem mapPair_right : (mapPair f g).app ⟨right⟩ = g := rfl #align category_theory.limits.map_pair_right CategoryTheory.Limits.mapPair_right @[simps!] def mapPairIso (f : F.obj ⟨left⟩ ≅ G.obj ⟨left⟩) (g : F.obj ⟨right⟩ ≅ G.obj ⟨right⟩) : F ≅ G := NatIso.ofComponents (fun j => Discrete.recOn j fun j => WalkingPair.casesOn j f g) (fun ⟨⟨u⟩⟩ => by aesop_cat) #align category_theory.limits.map_pair_iso CategoryTheory.Limits.mapPairIso end @[simps!] def diagramIsoPair (F : Discrete WalkingPair ⥤ C) : F ≅ pair (F.obj ⟨WalkingPair.left⟩) (F.obj ⟨WalkingPair.right⟩) := mapPairIso (Iso.refl _) (Iso.refl _) #align category_theory.limits.diagram_iso_pair CategoryTheory.Limits.diagramIsoPair section variable {D : Type u} [Category.{v} D] def pairComp (X Y : C) (F : C ⥤ D) : pair X Y ⋙ F ≅ pair (F.obj X) (F.obj Y) := diagramIsoPair _ #align category_theory.limits.pair_comp CategoryTheory.Limits.pairComp end abbrev BinaryFan (X Y : C) := Cone (pair X Y) #align category_theory.limits.binary_fan CategoryTheory.Limits.BinaryFan abbrev BinaryFan.fst {X Y : C} (s : BinaryFan X Y) := s.π.app ⟨WalkingPair.left⟩ #align category_theory.limits.binary_fan.fst CategoryTheory.Limits.BinaryFan.fst abbrev BinaryFan.snd {X Y : C} (s : BinaryFan X Y) := s.π.app ⟨WalkingPair.right⟩ #align category_theory.limits.binary_fan.snd CategoryTheory.Limits.BinaryFan.snd @[simp] theorem BinaryFan.π_app_left {X Y : C} (s : BinaryFan X Y) : s.π.app ⟨WalkingPair.left⟩ = s.fst := rfl #align category_theory.limits.binary_fan.π_app_left CategoryTheory.Limits.BinaryFan.π_app_left @[simp] theorem BinaryFan.π_app_right {X Y : C} (s : BinaryFan X Y) : s.π.app ⟨WalkingPair.right⟩ = s.snd := rfl #align category_theory.limits.binary_fan.π_app_right CategoryTheory.Limits.BinaryFan.π_app_right def BinaryFan.IsLimit.mk {X Y : C} (s : BinaryFan X Y) (lift : ∀ {T : C} (_ : T ⟶ X) (_ : T ⟶ Y), T ⟶ s.pt) (hl₁ : ∀ {T : C} (f : T ⟶ X) (g : T ⟶ Y), lift f g ≫ s.fst = f) (hl₂ : ∀ {T : C} (f : T ⟶ X) (g : T ⟶ Y), lift f g ≫ s.snd = g) (uniq : ∀ {T : C} (f : T ⟶ X) (g : T ⟶ Y) (m : T ⟶ s.pt) (_ : m ≫ s.fst = f) (_ : m ≫ s.snd = g), m = lift f g) : IsLimit s := Limits.IsLimit.mk (fun t => lift (BinaryFan.fst t) (BinaryFan.snd t)) (by rintro t (rfl | rfl) · exact hl₁ _ _ · exact hl₂ _ _) fun t m h => uniq _ _ _ (h ⟨WalkingPair.left⟩) (h ⟨WalkingPair.right⟩) #align category_theory.limits.binary_fan.is_limit.mk CategoryTheory.Limits.BinaryFan.IsLimit.mk theorem BinaryFan.IsLimit.hom_ext {W X Y : C} {s : BinaryFan X Y} (h : IsLimit s) {f g : W ⟶ s.pt} (h₁ : f ≫ s.fst = g ≫ s.fst) (h₂ : f ≫ s.snd = g ≫ s.snd) : f = g := h.hom_ext fun j => Discrete.recOn j fun j => WalkingPair.casesOn j h₁ h₂ #align category_theory.limits.binary_fan.is_limit.hom_ext CategoryTheory.Limits.BinaryFan.IsLimit.hom_ext abbrev BinaryCofan (X Y : C) := Cocone (pair X Y) #align category_theory.limits.binary_cofan CategoryTheory.Limits.BinaryCofan abbrev BinaryCofan.inl {X Y : C} (s : BinaryCofan X Y) := s.ι.app ⟨WalkingPair.left⟩ #align category_theory.limits.binary_cofan.inl CategoryTheory.Limits.BinaryCofan.inl abbrev BinaryCofan.inr {X Y : C} (s : BinaryCofan X Y) := s.ι.app ⟨WalkingPair.right⟩ #align category_theory.limits.binary_cofan.inr CategoryTheory.Limits.BinaryCofan.inr @[simp] theorem BinaryCofan.ι_app_left {X Y : C} (s : BinaryCofan X Y) : s.ι.app ⟨WalkingPair.left⟩ = s.inl := rfl #align category_theory.limits.binary_cofan.ι_app_left CategoryTheory.Limits.BinaryCofan.ι_app_left @[simp] theorem BinaryCofan.ι_app_right {X Y : C} (s : BinaryCofan X Y) : s.ι.app ⟨WalkingPair.right⟩ = s.inr := rfl #align category_theory.limits.binary_cofan.ι_app_right CategoryTheory.Limits.BinaryCofan.ι_app_right def BinaryCofan.IsColimit.mk {X Y : C} (s : BinaryCofan X Y) (desc : ∀ {T : C} (_ : X ⟶ T) (_ : Y ⟶ T), s.pt ⟶ T) (hd₁ : ∀ {T : C} (f : X ⟶ T) (g : Y ⟶ T), s.inl ≫ desc f g = f) (hd₂ : ∀ {T : C} (f : X ⟶ T) (g : Y ⟶ T), s.inr ≫ desc f g = g) (uniq : ∀ {T : C} (f : X ⟶ T) (g : Y ⟶ T) (m : s.pt ⟶ T) (_ : s.inl ≫ m = f) (_ : s.inr ≫ m = g), m = desc f g) : IsColimit s := Limits.IsColimit.mk (fun t => desc (BinaryCofan.inl t) (BinaryCofan.inr t)) (by rintro t (rfl | rfl) · exact hd₁ _ _ · exact hd₂ _ _) fun t m h => uniq _ _ _ (h ⟨WalkingPair.left⟩) (h ⟨WalkingPair.right⟩) #align category_theory.limits.binary_cofan.is_colimit.mk CategoryTheory.Limits.BinaryCofan.IsColimit.mk theorem BinaryCofan.IsColimit.hom_ext {W X Y : C} {s : BinaryCofan X Y} (h : IsColimit s) {f g : s.pt ⟶ W} (h₁ : s.inl ≫ f = s.inl ≫ g) (h₂ : s.inr ≫ f = s.inr ≫ g) : f = g := h.hom_ext fun j => Discrete.recOn j fun j => WalkingPair.casesOn j h₁ h₂ #align category_theory.limits.binary_cofan.is_colimit.hom_ext CategoryTheory.Limits.BinaryCofan.IsColimit.hom_ext variable {X Y : C} section attribute [local aesop safe tactic (rule_sets := [CategoryTheory])] CategoryTheory.Discrete.discreteCases -- Porting note: would it be okay to use this more generally? attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Eq @[simps pt] def BinaryFan.mk {P : C} (π₁ : P ⟶ X) (π₂ : P ⟶ Y) : BinaryFan X Y where pt := P π := { app := fun ⟨j⟩ => by cases j <;> simpa } #align category_theory.limits.binary_fan.mk CategoryTheory.Limits.BinaryFan.mk @[simps pt] def BinaryCofan.mk {P : C} (ι₁ : X ⟶ P) (ι₂ : Y ⟶ P) : BinaryCofan X Y where pt := P ι := { app := fun ⟨j⟩ => by cases j <;> simpa } #align category_theory.limits.binary_cofan.mk CategoryTheory.Limits.BinaryCofan.mk end @[simp] theorem BinaryFan.mk_fst {P : C} (π₁ : P ⟶ X) (π₂ : P ⟶ Y) : (BinaryFan.mk π₁ π₂).fst = π₁ := rfl #align category_theory.limits.binary_fan.mk_fst CategoryTheory.Limits.BinaryFan.mk_fst @[simp] theorem BinaryFan.mk_snd {P : C} (π₁ : P ⟶ X) (π₂ : P ⟶ Y) : (BinaryFan.mk π₁ π₂).snd = π₂ := rfl #align category_theory.limits.binary_fan.mk_snd CategoryTheory.Limits.BinaryFan.mk_snd @[simp] theorem BinaryCofan.mk_inl {P : C} (ι₁ : X ⟶ P) (ι₂ : Y ⟶ P) : (BinaryCofan.mk ι₁ ι₂).inl = ι₁ := rfl #align category_theory.limits.binary_cofan.mk_inl CategoryTheory.Limits.BinaryCofan.mk_inl @[simp] theorem BinaryCofan.mk_inr {P : C} (ι₁ : X ⟶ P) (ι₂ : Y ⟶ P) : (BinaryCofan.mk ι₁ ι₂).inr = ι₂ := rfl #align category_theory.limits.binary_cofan.mk_inr CategoryTheory.Limits.BinaryCofan.mk_inr def isoBinaryFanMk {X Y : C} (c : BinaryFan X Y) : c ≅ BinaryFan.mk c.fst c.snd := Cones.ext (Iso.refl _) fun j => by cases' j with l; cases l; repeat simp #align category_theory.limits.iso_binary_fan_mk CategoryTheory.Limits.isoBinaryFanMk def isoBinaryCofanMk {X Y : C} (c : BinaryCofan X Y) : c ≅ BinaryCofan.mk c.inl c.inr := Cocones.ext (Iso.refl _) fun j => by cases' j with l; cases l; repeat simp #align category_theory.limits.iso_binary_cofan_mk CategoryTheory.Limits.isoBinaryCofanMk def BinaryFan.isLimitMk {W : C} {fst : W ⟶ X} {snd : W ⟶ Y} (lift : ∀ s : BinaryFan X Y, s.pt ⟶ W) (fac_left : ∀ s : BinaryFan X Y, lift s ≫ fst = s.fst) (fac_right : ∀ s : BinaryFan X Y, lift s ≫ snd = s.snd) (uniq : ∀ (s : BinaryFan X Y) (m : s.pt ⟶ W) (_ : m ≫ fst = s.fst) (_ : m ≫ snd = s.snd), m = lift s) : IsLimit (BinaryFan.mk fst snd) := { lift := lift fac := fun s j => by rcases j with ⟨⟨⟩⟩ exacts [fac_left s, fac_right s] uniq := fun s m w => uniq s m (w ⟨WalkingPair.left⟩) (w ⟨WalkingPair.right⟩) } #align category_theory.limits.binary_fan.is_limit_mk CategoryTheory.Limits.BinaryFan.isLimitMk def BinaryCofan.isColimitMk {W : C} {inl : X ⟶ W} {inr : Y ⟶ W} (desc : ∀ s : BinaryCofan X Y, W ⟶ s.pt) (fac_left : ∀ s : BinaryCofan X Y, inl ≫ desc s = s.inl) (fac_right : ∀ s : BinaryCofan X Y, inr ≫ desc s = s.inr) (uniq : ∀ (s : BinaryCofan X Y) (m : W ⟶ s.pt) (_ : inl ≫ m = s.inl) (_ : inr ≫ m = s.inr), m = desc s) : IsColimit (BinaryCofan.mk inl inr) := { desc := desc fac := fun s j => by rcases j with ⟨⟨⟩⟩ exacts [fac_left s, fac_right s] uniq := fun s m w => uniq s m (w ⟨WalkingPair.left⟩) (w ⟨WalkingPair.right⟩) } #align category_theory.limits.binary_cofan.is_colimit_mk CategoryTheory.Limits.BinaryCofan.isColimitMk @[simps] def BinaryFan.IsLimit.lift' {W X Y : C} {s : BinaryFan X Y} (h : IsLimit s) (f : W ⟶ X) (g : W ⟶ Y) : { l : W ⟶ s.pt // l ≫ s.fst = f ∧ l ≫ s.snd = g } := ⟨h.lift <| BinaryFan.mk f g, h.fac _ _, h.fac _ _⟩ #align category_theory.limits.binary_fan.is_limit.lift' CategoryTheory.Limits.BinaryFan.IsLimit.lift' @[simps] def BinaryCofan.IsColimit.desc' {W X Y : C} {s : BinaryCofan X Y} (h : IsColimit s) (f : X ⟶ W) (g : Y ⟶ W) : { l : s.pt ⟶ W // s.inl ≫ l = f ∧ s.inr ≫ l = g } := ⟨h.desc <| BinaryCofan.mk f g, h.fac _ _, h.fac _ _⟩ #align category_theory.limits.binary_cofan.is_colimit.desc' CategoryTheory.Limits.BinaryCofan.IsColimit.desc' def BinaryFan.isLimitFlip {X Y : C} {c : BinaryFan X Y} (hc : IsLimit c) : IsLimit (BinaryFan.mk c.snd c.fst) := BinaryFan.isLimitMk (fun s => hc.lift (BinaryFan.mk s.snd s.fst)) (fun _ => hc.fac _ _) (fun _ => hc.fac _ _) fun s _ e₁ e₂ => BinaryFan.IsLimit.hom_ext hc (e₂.trans (hc.fac (BinaryFan.mk s.snd s.fst) ⟨WalkingPair.left⟩).symm) (e₁.trans (hc.fac (BinaryFan.mk s.snd s.fst) ⟨WalkingPair.right⟩).symm) #align category_theory.limits.binary_fan.is_limit_flip CategoryTheory.Limits.BinaryFan.isLimitFlip theorem BinaryFan.isLimit_iff_isIso_fst {X Y : C} (h : IsTerminal Y) (c : BinaryFan X Y) : Nonempty (IsLimit c) ↔ IsIso c.fst := by constructor · rintro ⟨H⟩ obtain ⟨l, hl, -⟩ := BinaryFan.IsLimit.lift' H (𝟙 X) (h.from X) exact ⟨⟨l, BinaryFan.IsLimit.hom_ext H (by simpa [hl, -Category.comp_id] using Category.comp_id _) (h.hom_ext _ _), hl⟩⟩ · intro exact ⟨BinaryFan.IsLimit.mk _ (fun f _ => f ≫ inv c.fst) (fun _ _ => by simp) (fun _ _ => h.hom_ext _ _) fun _ _ _ e _ => by simp [← e]⟩ #align category_theory.limits.binary_fan.is_limit_iff_is_iso_fst CategoryTheory.Limits.BinaryFan.isLimit_iff_isIso_fst theorem BinaryFan.isLimit_iff_isIso_snd {X Y : C} (h : IsTerminal X) (c : BinaryFan X Y) : Nonempty (IsLimit c) ↔ IsIso c.snd := by refine Iff.trans ?_ (BinaryFan.isLimit_iff_isIso_fst h (BinaryFan.mk c.snd c.fst)) exact ⟨fun h => ⟨BinaryFan.isLimitFlip h.some⟩, fun h => ⟨(BinaryFan.isLimitFlip h.some).ofIsoLimit (isoBinaryFanMk c).symm⟩⟩ #align category_theory.limits.binary_fan.is_limit_iff_is_iso_snd CategoryTheory.Limits.BinaryFan.isLimit_iff_isIso_snd noncomputable def BinaryFan.isLimitCompLeftIso {X Y X' : C} (c : BinaryFan X Y) (f : X ⟶ X') [IsIso f] (h : IsLimit c) : IsLimit (BinaryFan.mk (c.fst ≫ f) c.snd) := by fapply BinaryFan.isLimitMk · exact fun s => h.lift (BinaryFan.mk (s.fst ≫ inv f) s.snd) · intro s -- Porting note: simp timed out here simp only [Category.comp_id,BinaryFan.π_app_left,IsIso.inv_hom_id, BinaryFan.mk_fst,IsLimit.fac_assoc,eq_self_iff_true,Category.assoc] · intro s -- Porting note: simp timed out here simp only [BinaryFan.π_app_right,BinaryFan.mk_snd,eq_self_iff_true,IsLimit.fac] · intro s m e₁ e₂ -- Porting note: simpa timed out here also apply BinaryFan.IsLimit.hom_ext h · simpa only [BinaryFan.π_app_left,BinaryFan.mk_fst,Category.assoc,IsLimit.fac,IsIso.eq_comp_inv] · simpa only [BinaryFan.π_app_right,BinaryFan.mk_snd,IsLimit.fac] #align category_theory.limits.binary_fan.is_limit_comp_left_iso CategoryTheory.Limits.BinaryFan.isLimitCompLeftIso noncomputable def BinaryFan.isLimitCompRightIso {X Y Y' : C} (c : BinaryFan X Y) (f : Y ⟶ Y') [IsIso f] (h : IsLimit c) : IsLimit (BinaryFan.mk c.fst (c.snd ≫ f)) := BinaryFan.isLimitFlip <| BinaryFan.isLimitCompLeftIso _ f (BinaryFan.isLimitFlip h) #align category_theory.limits.binary_fan.is_limit_comp_right_iso CategoryTheory.Limits.BinaryFan.isLimitCompRightIso def BinaryCofan.isColimitFlip {X Y : C} {c : BinaryCofan X Y} (hc : IsColimit c) : IsColimit (BinaryCofan.mk c.inr c.inl) := BinaryCofan.isColimitMk (fun s => hc.desc (BinaryCofan.mk s.inr s.inl)) (fun _ => hc.fac _ _) (fun _ => hc.fac _ _) fun s _ e₁ e₂ => BinaryCofan.IsColimit.hom_ext hc (e₂.trans (hc.fac (BinaryCofan.mk s.inr s.inl) ⟨WalkingPair.left⟩).symm) (e₁.trans (hc.fac (BinaryCofan.mk s.inr s.inl) ⟨WalkingPair.right⟩).symm) #align category_theory.limits.binary_cofan.is_colimit_flip CategoryTheory.Limits.BinaryCofan.isColimitFlip theorem BinaryCofan.isColimit_iff_isIso_inl {X Y : C} (h : IsInitial Y) (c : BinaryCofan X Y) : Nonempty (IsColimit c) ↔ IsIso c.inl := by constructor · rintro ⟨H⟩ obtain ⟨l, hl, -⟩ := BinaryCofan.IsColimit.desc' H (𝟙 X) (h.to X) refine ⟨⟨l, hl, BinaryCofan.IsColimit.hom_ext H (?_) (h.hom_ext _ _)⟩⟩ rw [Category.comp_id] have e : (inl c ≫ l) ≫ inl c = 𝟙 X ≫ inl c := congrArg (·≫inl c) hl rwa [Category.assoc,Category.id_comp] at e · intro exact ⟨BinaryCofan.IsColimit.mk _ (fun f _ => inv c.inl ≫ f) (fun _ _ => IsIso.hom_inv_id_assoc _ _) (fun _ _ => h.hom_ext _ _) fun _ _ _ e _ => (IsIso.eq_inv_comp _).mpr e⟩ #align category_theory.limits.binary_cofan.is_colimit_iff_is_iso_inl CategoryTheory.Limits.BinaryCofan.isColimit_iff_isIso_inl theorem BinaryCofan.isColimit_iff_isIso_inr {X Y : C} (h : IsInitial X) (c : BinaryCofan X Y) : Nonempty (IsColimit c) ↔ IsIso c.inr := by refine Iff.trans ?_ (BinaryCofan.isColimit_iff_isIso_inl h (BinaryCofan.mk c.inr c.inl)) exact ⟨fun h => ⟨BinaryCofan.isColimitFlip h.some⟩, fun h => ⟨(BinaryCofan.isColimitFlip h.some).ofIsoColimit (isoBinaryCofanMk c).symm⟩⟩ #align category_theory.limits.binary_cofan.is_colimit_iff_is_iso_inr CategoryTheory.Limits.BinaryCofan.isColimit_iff_isIso_inr noncomputable def BinaryCofan.isColimitCompLeftIso {X Y X' : C} (c : BinaryCofan X Y) (f : X' ⟶ X) [IsIso f] (h : IsColimit c) : IsColimit (BinaryCofan.mk (f ≫ c.inl) c.inr) := by fapply BinaryCofan.isColimitMk · exact fun s => h.desc (BinaryCofan.mk (inv f ≫ s.inl) s.inr) · intro s -- Porting note: simp timed out here too simp only [IsColimit.fac,BinaryCofan.ι_app_left,eq_self_iff_true, Category.assoc,BinaryCofan.mk_inl,IsIso.hom_inv_id_assoc] · intro s -- Porting note: simp timed out here too simp only [IsColimit.fac,BinaryCofan.ι_app_right,eq_self_iff_true,BinaryCofan.mk_inr] · intro s m e₁ e₂ apply BinaryCofan.IsColimit.hom_ext h · rw [← cancel_epi f] -- Porting note: simp timed out here too simpa only [IsColimit.fac,BinaryCofan.ι_app_left,eq_self_iff_true, Category.assoc,BinaryCofan.mk_inl,IsIso.hom_inv_id_assoc] using e₁ -- Porting note: simp timed out here too · simpa only [IsColimit.fac,BinaryCofan.ι_app_right,eq_self_iff_true,BinaryCofan.mk_inr] #align category_theory.limits.binary_cofan.is_colimit_comp_left_iso CategoryTheory.Limits.BinaryCofan.isColimitCompLeftIso noncomputable def BinaryCofan.isColimitCompRightIso {X Y Y' : C} (c : BinaryCofan X Y) (f : Y' ⟶ Y) [IsIso f] (h : IsColimit c) : IsColimit (BinaryCofan.mk c.inl (f ≫ c.inr)) := BinaryCofan.isColimitFlip <| BinaryCofan.isColimitCompLeftIso _ f (BinaryCofan.isColimitFlip h) #align category_theory.limits.binary_cofan.is_colimit_comp_right_iso CategoryTheory.Limits.BinaryCofan.isColimitCompRightIso abbrev HasBinaryProduct (X Y : C) := HasLimit (pair X Y) #align category_theory.limits.has_binary_product CategoryTheory.Limits.HasBinaryProduct abbrev HasBinaryCoproduct (X Y : C) := HasColimit (pair X Y) #align category_theory.limits.has_binary_coproduct CategoryTheory.Limits.HasBinaryCoproduct abbrev prod (X Y : C) [HasBinaryProduct X Y] := limit (pair X Y) #align category_theory.limits.prod CategoryTheory.Limits.prod abbrev coprod (X Y : C) [HasBinaryCoproduct X Y] := colimit (pair X Y) #align category_theory.limits.coprod CategoryTheory.Limits.coprod notation:20 X " ⨯ " Y:20 => prod X Y notation:20 X " ⨿ " Y:20 => coprod X Y abbrev prod.fst {X Y : C} [HasBinaryProduct X Y] : X ⨯ Y ⟶ X := limit.π (pair X Y) ⟨WalkingPair.left⟩ #align category_theory.limits.prod.fst CategoryTheory.Limits.prod.fst abbrev prod.snd {X Y : C} [HasBinaryProduct X Y] : X ⨯ Y ⟶ Y := limit.π (pair X Y) ⟨WalkingPair.right⟩ #align category_theory.limits.prod.snd CategoryTheory.Limits.prod.snd abbrev coprod.inl {X Y : C} [HasBinaryCoproduct X Y] : X ⟶ X ⨿ Y := colimit.ι (pair X Y) ⟨WalkingPair.left⟩ #align category_theory.limits.coprod.inl CategoryTheory.Limits.coprod.inl abbrev coprod.inr {X Y : C} [HasBinaryCoproduct X Y] : Y ⟶ X ⨿ Y := colimit.ι (pair X Y) ⟨WalkingPair.right⟩ #align category_theory.limits.coprod.inr CategoryTheory.Limits.coprod.inr def prodIsProd (X Y : C) [HasBinaryProduct X Y] : IsLimit (BinaryFan.mk (prod.fst : X ⨯ Y ⟶ X) prod.snd) := (limit.isLimit _).ofIsoLimit (Cones.ext (Iso.refl _) (fun ⟨u⟩ => by cases u · dsimp; simp only [Category.id_comp]; rfl · dsimp; simp only [Category.id_comp]; rfl )) #align category_theory.limits.prod_is_prod CategoryTheory.Limits.prodIsProd def coprodIsCoprod (X Y : C) [HasBinaryCoproduct X Y] : IsColimit (BinaryCofan.mk (coprod.inl : X ⟶ X ⨿ Y) coprod.inr) := (colimit.isColimit _).ofIsoColimit (Cocones.ext (Iso.refl _) (fun ⟨u⟩ => by cases u · dsimp; simp only [Category.comp_id] · dsimp; simp only [Category.comp_id] )) #align category_theory.limits.coprod_is_coprod CategoryTheory.Limits.coprodIsCoprod @[ext 1100] theorem prod.hom_ext {W X Y : C} [HasBinaryProduct X Y] {f g : W ⟶ X ⨯ Y} (h₁ : f ≫ prod.fst = g ≫ prod.fst) (h₂ : f ≫ prod.snd = g ≫ prod.snd) : f = g := BinaryFan.IsLimit.hom_ext (limit.isLimit _) h₁ h₂ #align category_theory.limits.prod.hom_ext CategoryTheory.Limits.prod.hom_ext @[ext 1100] theorem coprod.hom_ext {W X Y : C} [HasBinaryCoproduct X Y] {f g : X ⨿ Y ⟶ W} (h₁ : coprod.inl ≫ f = coprod.inl ≫ g) (h₂ : coprod.inr ≫ f = coprod.inr ≫ g) : f = g := BinaryCofan.IsColimit.hom_ext (colimit.isColimit _) h₁ h₂ #align category_theory.limits.coprod.hom_ext CategoryTheory.Limits.coprod.hom_ext abbrev prod.lift {W X Y : C} [HasBinaryProduct X Y] (f : W ⟶ X) (g : W ⟶ Y) : W ⟶ X ⨯ Y := limit.lift _ (BinaryFan.mk f g) #align category_theory.limits.prod.lift CategoryTheory.Limits.prod.lift abbrev diag (X : C) [HasBinaryProduct X X] : X ⟶ X ⨯ X := prod.lift (𝟙 _) (𝟙 _) #align category_theory.limits.diag CategoryTheory.Limits.diag abbrev coprod.desc {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) : X ⨿ Y ⟶ W := colimit.desc _ (BinaryCofan.mk f g) #align category_theory.limits.coprod.desc CategoryTheory.Limits.coprod.desc abbrev codiag (X : C) [HasBinaryCoproduct X X] : X ⨿ X ⟶ X := coprod.desc (𝟙 _) (𝟙 _) #align category_theory.limits.codiag CategoryTheory.Limits.codiag -- Porting note (#10618): simp removes as simp can prove this @[reassoc] theorem prod.lift_fst {W X Y : C} [HasBinaryProduct X Y] (f : W ⟶ X) (g : W ⟶ Y) : prod.lift f g ≫ prod.fst = f := limit.lift_π _ _ #align category_theory.limits.prod.lift_fst CategoryTheory.Limits.prod.lift_fst #align category_theory.limits.prod.lift_fst_assoc CategoryTheory.Limits.prod.lift_fst_assoc -- Porting note (#10618): simp removes as simp can prove this @[reassoc] theorem prod.lift_snd {W X Y : C} [HasBinaryProduct X Y] (f : W ⟶ X) (g : W ⟶ Y) : prod.lift f g ≫ prod.snd = g := limit.lift_π _ _ #align category_theory.limits.prod.lift_snd CategoryTheory.Limits.prod.lift_snd #align category_theory.limits.prod.lift_snd_assoc CategoryTheory.Limits.prod.lift_snd_assoc -- The simp linter says simp can prove the reassoc version of this lemma. -- Porting note: it can also prove the og version @[reassoc] theorem coprod.inl_desc {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) : coprod.inl ≫ coprod.desc f g = f := colimit.ι_desc _ _ #align category_theory.limits.coprod.inl_desc CategoryTheory.Limits.coprod.inl_desc #align category_theory.limits.coprod.inl_desc_assoc CategoryTheory.Limits.coprod.inl_desc_assoc -- The simp linter says simp can prove the reassoc version of this lemma. -- Porting note: it can also prove the og version @[reassoc] theorem coprod.inr_desc {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) : coprod.inr ≫ coprod.desc f g = g := colimit.ι_desc _ _ #align category_theory.limits.coprod.inr_desc CategoryTheory.Limits.coprod.inr_desc #align category_theory.limits.coprod.inr_desc_assoc CategoryTheory.Limits.coprod.inr_desc_assoc instance prod.mono_lift_of_mono_left {W X Y : C} [HasBinaryProduct X Y] (f : W ⟶ X) (g : W ⟶ Y) [Mono f] : Mono (prod.lift f g) := mono_of_mono_fac <| prod.lift_fst _ _ #align category_theory.limits.prod.mono_lift_of_mono_left CategoryTheory.Limits.prod.mono_lift_of_mono_left instance prod.mono_lift_of_mono_right {W X Y : C} [HasBinaryProduct X Y] (f : W ⟶ X) (g : W ⟶ Y) [Mono g] : Mono (prod.lift f g) := mono_of_mono_fac <| prod.lift_snd _ _ #align category_theory.limits.prod.mono_lift_of_mono_right CategoryTheory.Limits.prod.mono_lift_of_mono_right instance coprod.epi_desc_of_epi_left {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) [Epi f] : Epi (coprod.desc f g) := epi_of_epi_fac <| coprod.inl_desc _ _ #align category_theory.limits.coprod.epi_desc_of_epi_left CategoryTheory.Limits.coprod.epi_desc_of_epi_left instance coprod.epi_desc_of_epi_right {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) [Epi g] : Epi (coprod.desc f g) := epi_of_epi_fac <| coprod.inr_desc _ _ #align category_theory.limits.coprod.epi_desc_of_epi_right CategoryTheory.Limits.coprod.epi_desc_of_epi_right def prod.lift' {W X Y : C} [HasBinaryProduct X Y] (f : W ⟶ X) (g : W ⟶ Y) : { l : W ⟶ X ⨯ Y // l ≫ prod.fst = f ∧ l ≫ prod.snd = g } := ⟨prod.lift f g, prod.lift_fst _ _, prod.lift_snd _ _⟩ #align category_theory.limits.prod.lift' CategoryTheory.Limits.prod.lift' def coprod.desc' {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟶ W) (g : Y ⟶ W) : { l : X ⨿ Y ⟶ W // coprod.inl ≫ l = f ∧ coprod.inr ≫ l = g } := ⟨coprod.desc f g, coprod.inl_desc _ _, coprod.inr_desc _ _⟩ #align category_theory.limits.coprod.desc' CategoryTheory.Limits.coprod.desc' def prod.map {W X Y Z : C} [HasBinaryProduct W X] [HasBinaryProduct Y Z] (f : W ⟶ Y) (g : X ⟶ Z) : W ⨯ X ⟶ Y ⨯ Z := limMap (mapPair f g) #align category_theory.limits.prod.map CategoryTheory.Limits.prod.map def coprod.map {W X Y Z : C} [HasBinaryCoproduct W X] [HasBinaryCoproduct Y Z] (f : W ⟶ Y) (g : X ⟶ Z) : W ⨿ X ⟶ Y ⨿ Z := colimMap (mapPair f g) #align category_theory.limits.coprod.map CategoryTheory.Limits.coprod.map section ProdLemmas -- Making the reassoc version of this a simp lemma seems to be more harmful than helpful. @[reassoc, simp] theorem prod.comp_lift {V W X Y : C} [HasBinaryProduct X Y] (f : V ⟶ W) (g : W ⟶ X) (h : W ⟶ Y) : f ≫ prod.lift g h = prod.lift (f ≫ g) (f ≫ h) := by ext <;> simp #align category_theory.limits.prod.comp_lift CategoryTheory.Limits.prod.comp_lift #align category_theory.limits.prod.comp_lift_assoc CategoryTheory.Limits.prod.comp_lift_assoc theorem prod.comp_diag {X Y : C} [HasBinaryProduct Y Y] (f : X ⟶ Y) : f ≫ diag Y = prod.lift f f := by simp #align category_theory.limits.prod.comp_diag CategoryTheory.Limits.prod.comp_diag @[reassoc (attr := simp)] theorem prod.map_fst {W X Y Z : C} [HasBinaryProduct W X] [HasBinaryProduct Y Z] (f : W ⟶ Y) (g : X ⟶ Z) : prod.map f g ≫ prod.fst = prod.fst ≫ f := limMap_π _ _ #align category_theory.limits.prod.map_fst CategoryTheory.Limits.prod.map_fst #align category_theory.limits.prod.map_fst_assoc CategoryTheory.Limits.prod.map_fst_assoc @[reassoc (attr := simp)] theorem prod.map_snd {W X Y Z : C} [HasBinaryProduct W X] [HasBinaryProduct Y Z] (f : W ⟶ Y) (g : X ⟶ Z) : prod.map f g ≫ prod.snd = prod.snd ≫ g := limMap_π _ _ #align category_theory.limits.prod.map_snd CategoryTheory.Limits.prod.map_snd #align category_theory.limits.prod.map_snd_assoc CategoryTheory.Limits.prod.map_snd_assoc @[simp] theorem prod.map_id_id {X Y : C} [HasBinaryProduct X Y] : prod.map (𝟙 X) (𝟙 Y) = 𝟙 _ := by ext <;> simp #align category_theory.limits.prod.map_id_id CategoryTheory.Limits.prod.map_id_id @[simp] theorem prod.lift_fst_snd {X Y : C} [HasBinaryProduct X Y] : prod.lift prod.fst prod.snd = 𝟙 (X ⨯ Y) := by ext <;> simp #align category_theory.limits.prod.lift_fst_snd CategoryTheory.Limits.prod.lift_fst_snd @[reassoc (attr := simp)] theorem prod.lift_map {V W X Y Z : C} [HasBinaryProduct W X] [HasBinaryProduct Y Z] (f : V ⟶ W) (g : V ⟶ X) (h : W ⟶ Y) (k : X ⟶ Z) : prod.lift f g ≫ prod.map h k = prod.lift (f ≫ h) (g ≫ k) := by ext <;> simp #align category_theory.limits.prod.lift_map CategoryTheory.Limits.prod.lift_map #align category_theory.limits.prod.lift_map_assoc CategoryTheory.Limits.prod.lift_map_assoc @[simp] theorem prod.lift_fst_comp_snd_comp {W X Y Z : C} [HasBinaryProduct W Y] [HasBinaryProduct X Z] (g : W ⟶ X) (g' : Y ⟶ Z) : prod.lift (prod.fst ≫ g) (prod.snd ≫ g') = prod.map g g' := by rw [← prod.lift_map] simp #align category_theory.limits.prod.lift_fst_comp_snd_comp CategoryTheory.Limits.prod.lift_fst_comp_snd_comp -- We take the right hand side here to be simp normal form, as this way composition lemmas for -- `f ≫ h` and `g ≫ k` can fire (eg `id_comp`) , while `map_fst` and `map_snd` can still work just -- as well. @[reassoc (attr := simp)] theorem prod.map_map {A₁ A₂ A₃ B₁ B₂ B₃ : C} [HasBinaryProduct A₁ B₁] [HasBinaryProduct A₂ B₂] [HasBinaryProduct A₃ B₃] (f : A₁ ⟶ A₂) (g : B₁ ⟶ B₂) (h : A₂ ⟶ A₃) (k : B₂ ⟶ B₃) : prod.map f g ≫ prod.map h k = prod.map (f ≫ h) (g ≫ k) := by ext <;> simp #align category_theory.limits.prod.map_map CategoryTheory.Limits.prod.map_map #align category_theory.limits.prod.map_map_assoc CategoryTheory.Limits.prod.map_map_assoc -- TODO: is it necessary to weaken the assumption here? @[reassoc] theorem prod.map_swap {A B X Y : C} (f : A ⟶ B) (g : X ⟶ Y) [HasLimitsOfShape (Discrete WalkingPair) C] : prod.map (𝟙 X) f ≫ prod.map g (𝟙 B) = prod.map g (𝟙 A) ≫ prod.map (𝟙 Y) f := by simp #align category_theory.limits.prod.map_swap CategoryTheory.Limits.prod.map_swap #align category_theory.limits.prod.map_swap_assoc CategoryTheory.Limits.prod.map_swap_assoc @[reassoc]
Mathlib/CategoryTheory/Limits/Shapes/BinaryProducts.lean
772
774
theorem prod.map_comp_id {X Y Z W : C} (f : X ⟶ Y) (g : Y ⟶ Z) [HasBinaryProduct X W] [HasBinaryProduct Z W] [HasBinaryProduct Y W] : prod.map (f ≫ g) (𝟙 W) = prod.map f (𝟙 W) ≫ prod.map g (𝟙 W) := by
simp
import Mathlib.Data.Set.Function import Mathlib.Logic.Relation import Mathlib.Logic.Pairwise #align_import data.set.pairwise.basic from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Function Order Set variable {α β γ ι ι' : Type*} {r p q : α → α → Prop} section Pairwise variable {f g : ι → α} {s t u : Set α} {a b : α} theorem pairwise_on_bool (hr : Symmetric r) {a b : α} : Pairwise (r on fun c => cond c a b) ↔ r a b := by simpa [Pairwise, Function.onFun] using @hr a b #align pairwise_on_bool pairwise_on_bool theorem pairwise_disjoint_on_bool [SemilatticeInf α] [OrderBot α] {a b : α} : Pairwise (Disjoint on fun c => cond c a b) ↔ Disjoint a b := pairwise_on_bool Disjoint.symm #align pairwise_disjoint_on_bool pairwise_disjoint_on_bool theorem Symmetric.pairwise_on [LinearOrder ι] (hr : Symmetric r) (f : ι → α) : Pairwise (r on f) ↔ ∀ ⦃m n⦄, m < n → r (f m) (f n) := ⟨fun h _m _n hmn => h hmn.ne, fun h _m _n hmn => hmn.lt_or_lt.elim (@h _ _) fun h' => hr (h h')⟩ #align symmetric.pairwise_on Symmetric.pairwise_on theorem pairwise_disjoint_on [SemilatticeInf α] [OrderBot α] [LinearOrder ι] (f : ι → α) : Pairwise (Disjoint on f) ↔ ∀ ⦃m n⦄, m < n → Disjoint (f m) (f n) := Symmetric.pairwise_on Disjoint.symm f #align pairwise_disjoint_on pairwise_disjoint_on theorem pairwise_disjoint_mono [SemilatticeInf α] [OrderBot α] (hs : Pairwise (Disjoint on f)) (h : g ≤ f) : Pairwise (Disjoint on g) := hs.mono fun i j hij => Disjoint.mono (h i) (h j) hij #align pairwise_disjoint.mono pairwise_disjoint_mono namespace Set theorem Pairwise.mono (h : t ⊆ s) (hs : s.Pairwise r) : t.Pairwise r := fun _x xt _y yt => hs (h xt) (h yt) #align set.pairwise.mono Set.Pairwise.mono theorem Pairwise.mono' (H : r ≤ p) (hr : s.Pairwise r) : s.Pairwise p := hr.imp H #align set.pairwise.mono' Set.Pairwise.mono' theorem pairwise_top (s : Set α) : s.Pairwise ⊤ := pairwise_of_forall s _ fun _ _ => trivial #align set.pairwise_top Set.pairwise_top protected theorem Subsingleton.pairwise (h : s.Subsingleton) (r : α → α → Prop) : s.Pairwise r := fun _x hx _y hy hne => (hne (h hx hy)).elim #align set.subsingleton.pairwise Set.Subsingleton.pairwise @[simp] theorem pairwise_empty (r : α → α → Prop) : (∅ : Set α).Pairwise r := subsingleton_empty.pairwise r #align set.pairwise_empty Set.pairwise_empty @[simp] theorem pairwise_singleton (a : α) (r : α → α → Prop) : Set.Pairwise {a} r := subsingleton_singleton.pairwise r #align set.pairwise_singleton Set.pairwise_singleton theorem pairwise_iff_of_refl [IsRefl α r] : s.Pairwise r ↔ ∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → r a b := forall₄_congr fun _ _ _ _ => or_iff_not_imp_left.symm.trans <| or_iff_right_of_imp of_eq #align set.pairwise_iff_of_refl Set.pairwise_iff_of_refl alias ⟨Pairwise.of_refl, _⟩ := pairwise_iff_of_refl #align set.pairwise.of_refl Set.Pairwise.of_refl
Mathlib/Data/Set/Pairwise/Basic.lean
100
109
theorem Nonempty.pairwise_iff_exists_forall [IsEquiv α r] {s : Set ι} (hs : s.Nonempty) : s.Pairwise (r on f) ↔ ∃ z, ∀ x ∈ s, r (f x) z := by
constructor · rcases hs with ⟨y, hy⟩ refine fun H => ⟨f y, fun x hx => ?_⟩ rcases eq_or_ne x y with (rfl | hne) · apply IsRefl.refl · exact H hx hy hne · rintro ⟨z, hz⟩ x hx y hy _ exact @IsTrans.trans α r _ (f x) z (f y) (hz _ hx) (IsSymm.symm _ _ <| hz _ hy)
import Mathlib.CategoryTheory.Limits.Types import Mathlib.CategoryTheory.IsConnected import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.Conj universe w v u namespace CategoryTheory.Limits.Types variable (C : Type u) [Category.{v} C] def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1} @[simps] def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where pt := PUnit ι := { app := fun X => id } noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where desc s := s.ι.app Classical.ofNonempty fac s j := by ext ⟨⟩ apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit) intros X Y f exact congrFun (s.ι.naturality f).symm PUnit.unit uniq s m h := by ext ⟨⟩ simp [← h Classical.ofNonempty] instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) := ⟨_, isColimitPUnitCocone _⟩ instance instSubsingletonColimitPUnit [IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] : Subsingleton (colimit (constPUnitFunctor.{w} C)) where allEq a b := by obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit) exact fun c d f => colimit_sound f rfl noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] : colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} := IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C) theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j) (h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by induction h with | rel _ _ h => exact Zigzag.of_hom <| Exists.choose h | refl _ => exact Zigzag.refl _ | symm _ _ _ ih => exact zigzag_symmetric ih | trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
Mathlib/CategoryTheory/Limits/IsConnected.lean
97
104
theorem isConnected_iff_colimit_constPUnitFunctor_iso_pUnit [HasColimit (constPUnitFunctor.{w} C)] : IsConnected C ↔ Nonempty (colimit (constPUnitFunctor.{w} C) ≅ PUnit) := by
refine ⟨fun _ => ⟨colimitConstPUnitIsoPUnit.{w} C⟩, fun ⟨h⟩ => ?_⟩ have : Nonempty C := nonempty_of_nonempty_colimit <| Nonempty.map h.inv inferInstance refine zigzag_isConnected <| fun c d => ?_ refine zigzag_of_eqvGen_quot_rel _ (constPUnitFunctor C) ⟨c, PUnit.unit⟩ ⟨d, PUnit.unit⟩ ?_ exact colimit_eq <| h.toEquiv.injective rfl
import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.Matrix import Mathlib.LinearAlgebra.Matrix.ZPow import Mathlib.LinearAlgebra.Matrix.Hermitian import Mathlib.LinearAlgebra.Matrix.Symmetric import Mathlib.Topology.UniformSpace.Matrix #align_import analysis.normed_space.matrix_exponential from "leanprover-community/mathlib"@"1e3201306d4d9eb1fd54c60d7c4510ad5126f6f9" open scoped Matrix open NormedSpace -- For `exp`. variable (𝕂 : Type*) {m n p : Type*} {n' : m → Type*} {𝔸 : Type*} namespace Matrix section Topological section NormedComm variable [RCLike 𝕂] [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [∀ i, Fintype (n' i)] [∀ i, DecidableEq (n' i)] [NormedCommRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸]
Mathlib/Analysis/NormedSpace/MatrixExponential.lean
182
187
theorem exp_neg (A : Matrix m m 𝔸) : exp 𝕂 (-A) = (exp 𝕂 A)⁻¹ := by
rw [nonsing_inv_eq_ring_inverse] letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact (Ring.inverse_exp _ A).symm
import Mathlib.SetTheory.Ordinal.Arithmetic #align_import set_theory.ordinal.exponential from "leanprover-community/mathlib"@"b67044ba53af18680e1dd246861d9584e968495d" noncomputable section open Function Cardinal Set Equiv Order open scoped Classical open Cardinal Ordinal universe u v w namespace Ordinal instance pow : Pow Ordinal Ordinal := ⟨fun a b => if a = 0 then 1 - b else limitRecOn b 1 (fun _ IH => IH * a) fun b _ => bsup.{u, u} b⟩ -- Porting note: Ambiguous notations. -- local infixr:0 "^" => @Pow.pow Ordinal Ordinal Ordinal.instPowOrdinalOrdinal theorem opow_def (a b : Ordinal) : a ^ b = if a = 0 then 1 - b else limitRecOn b 1 (fun _ IH => IH * a) fun b _ => bsup.{u, u} b := rfl #align ordinal.opow_def Ordinal.opow_def -- Porting note: `if_pos rfl` → `if_true` theorem zero_opow' (a : Ordinal) : 0 ^ a = 1 - a := by simp only [opow_def, if_true] #align ordinal.zero_opow' Ordinal.zero_opow' @[simp] theorem zero_opow {a : Ordinal} (a0 : a ≠ 0) : (0 : Ordinal) ^ a = 0 := by rwa [zero_opow', Ordinal.sub_eq_zero_iff_le, one_le_iff_ne_zero] #align ordinal.zero_opow Ordinal.zero_opow @[simp] theorem opow_zero (a : Ordinal) : a ^ (0 : Ordinal) = 1 := by by_cases h : a = 0 · simp only [opow_def, if_pos h, sub_zero] · simp only [opow_def, if_neg h, limitRecOn_zero] #align ordinal.opow_zero Ordinal.opow_zero @[simp] theorem opow_succ (a b : Ordinal) : a ^ succ b = a ^ b * a := if h : a = 0 then by subst a; simp only [zero_opow (succ_ne_zero _), mul_zero] else by simp only [opow_def, limitRecOn_succ, if_neg h] #align ordinal.opow_succ Ordinal.opow_succ theorem opow_limit {a b : Ordinal} (a0 : a ≠ 0) (h : IsLimit b) : a ^ b = bsup.{u, u} b fun c _ => a ^ c := by simp only [opow_def, if_neg a0]; rw [limitRecOn_limit _ _ _ _ h] #align ordinal.opow_limit Ordinal.opow_limit theorem opow_le_of_limit {a b c : Ordinal} (a0 : a ≠ 0) (h : IsLimit b) : a ^ b ≤ c ↔ ∀ b' < b, a ^ b' ≤ c := by rw [opow_limit a0 h, bsup_le_iff] #align ordinal.opow_le_of_limit Ordinal.opow_le_of_limit theorem lt_opow_of_limit {a b c : Ordinal} (b0 : b ≠ 0) (h : IsLimit c) : a < b ^ c ↔ ∃ c' < c, a < b ^ c' := by rw [← not_iff_not, not_exists]; simp only [not_lt, opow_le_of_limit b0 h, exists_prop, not_and] #align ordinal.lt_opow_of_limit Ordinal.lt_opow_of_limit @[simp] theorem opow_one (a : Ordinal) : a ^ (1 : Ordinal) = a := by rw [← succ_zero, opow_succ]; simp only [opow_zero, one_mul] #align ordinal.opow_one Ordinal.opow_one @[simp] theorem one_opow (a : Ordinal) : (1 : Ordinal) ^ a = 1 := by induction a using limitRecOn with | H₁ => simp only [opow_zero] | H₂ _ ih => simp only [opow_succ, ih, mul_one] | H₃ b l IH => refine eq_of_forall_ge_iff fun c => ?_ rw [opow_le_of_limit Ordinal.one_ne_zero l] exact ⟨fun H => by simpa only [opow_zero] using H 0 l.pos, fun H b' h => by rwa [IH _ h]⟩ #align ordinal.one_opow Ordinal.one_opow theorem opow_pos {a : Ordinal} (b : Ordinal) (a0 : 0 < a) : 0 < a ^ b := by have h0 : 0 < a ^ (0 : Ordinal) := by simp only [opow_zero, zero_lt_one] induction b using limitRecOn with | H₁ => exact h0 | H₂ b IH => rw [opow_succ] exact mul_pos IH a0 | H₃ b l _ => exact (lt_opow_of_limit (Ordinal.pos_iff_ne_zero.1 a0) l).2 ⟨0, l.pos, h0⟩ #align ordinal.opow_pos Ordinal.opow_pos theorem opow_ne_zero {a : Ordinal} (b : Ordinal) (a0 : a ≠ 0) : a ^ b ≠ 0 := Ordinal.pos_iff_ne_zero.1 <| opow_pos b <| Ordinal.pos_iff_ne_zero.2 a0 #align ordinal.opow_ne_zero Ordinal.opow_ne_zero theorem opow_isNormal {a : Ordinal} (h : 1 < a) : IsNormal (a ^ ·) := have a0 : 0 < a := zero_lt_one.trans h ⟨fun b => by simpa only [mul_one, opow_succ] using (mul_lt_mul_iff_left (opow_pos b a0)).2 h, fun b l c => opow_le_of_limit (ne_of_gt a0) l⟩ #align ordinal.opow_is_normal Ordinal.opow_isNormal theorem opow_lt_opow_iff_right {a b c : Ordinal} (a1 : 1 < a) : a ^ b < a ^ c ↔ b < c := (opow_isNormal a1).lt_iff #align ordinal.opow_lt_opow_iff_right Ordinal.opow_lt_opow_iff_right theorem opow_le_opow_iff_right {a b c : Ordinal} (a1 : 1 < a) : a ^ b ≤ a ^ c ↔ b ≤ c := (opow_isNormal a1).le_iff #align ordinal.opow_le_opow_iff_right Ordinal.opow_le_opow_iff_right theorem opow_right_inj {a b c : Ordinal} (a1 : 1 < a) : a ^ b = a ^ c ↔ b = c := (opow_isNormal a1).inj #align ordinal.opow_right_inj Ordinal.opow_right_inj theorem opow_isLimit {a b : Ordinal} (a1 : 1 < a) : IsLimit b → IsLimit (a ^ b) := (opow_isNormal a1).isLimit #align ordinal.opow_is_limit Ordinal.opow_isLimit theorem opow_isLimit_left {a b : Ordinal} (l : IsLimit a) (hb : b ≠ 0) : IsLimit (a ^ b) := by rcases zero_or_succ_or_limit b with (e | ⟨b, rfl⟩ | l') · exact absurd e hb · rw [opow_succ] exact mul_isLimit (opow_pos _ l.pos) l · exact opow_isLimit l.one_lt l' #align ordinal.opow_is_limit_left Ordinal.opow_isLimit_left theorem opow_le_opow_right {a b c : Ordinal} (h₁ : 0 < a) (h₂ : b ≤ c) : a ^ b ≤ a ^ c := by rcases lt_or_eq_of_le (one_le_iff_pos.2 h₁) with h₁ | h₁ · exact (opow_le_opow_iff_right h₁).2 h₂ · subst a -- Porting note: `le_refl` is required. simp only [one_opow, le_refl] #align ordinal.opow_le_opow_right Ordinal.opow_le_opow_right theorem opow_le_opow_left {a b : Ordinal} (c : Ordinal) (ab : a ≤ b) : a ^ c ≤ b ^ c := by by_cases a0 : a = 0 -- Porting note: `le_refl` is required. · subst a by_cases c0 : c = 0 · subst c simp only [opow_zero, le_refl] · simp only [zero_opow c0, Ordinal.zero_le] · induction c using limitRecOn with | H₁ => simp only [opow_zero, le_refl] | H₂ c IH => simpa only [opow_succ] using mul_le_mul' IH ab | H₃ c l IH => exact (opow_le_of_limit a0 l).2 fun b' h => (IH _ h).trans (opow_le_opow_right ((Ordinal.pos_iff_ne_zero.2 a0).trans_le ab) h.le) #align ordinal.opow_le_opow_left Ordinal.opow_le_opow_left theorem left_le_opow (a : Ordinal) {b : Ordinal} (b1 : 0 < b) : a ≤ a ^ b := by nth_rw 1 [← opow_one a] cases' le_or_gt a 1 with a1 a1 · rcases lt_or_eq_of_le a1 with a0 | a1 · rw [lt_one_iff_zero] at a0 rw [a0, zero_opow Ordinal.one_ne_zero] exact Ordinal.zero_le _ rw [a1, one_opow, one_opow] rwa [opow_le_opow_iff_right a1, one_le_iff_pos] #align ordinal.left_le_opow Ordinal.left_le_opow theorem right_le_opow {a : Ordinal} (b : Ordinal) (a1 : 1 < a) : b ≤ a ^ b := (opow_isNormal a1).self_le _ #align ordinal.right_le_opow Ordinal.right_le_opow theorem opow_lt_opow_left_of_succ {a b c : Ordinal} (ab : a < b) : a ^ succ c < b ^ succ c := by rw [opow_succ, opow_succ] exact (mul_le_mul_right' (opow_le_opow_left c ab.le) a).trans_lt (mul_lt_mul_of_pos_left ab (opow_pos c ((Ordinal.zero_le a).trans_lt ab))) #align ordinal.opow_lt_opow_left_of_succ Ordinal.opow_lt_opow_left_of_succ theorem opow_add (a b c : Ordinal) : a ^ (b + c) = a ^ b * a ^ c := by rcases eq_or_ne a 0 with (rfl | a0) · rcases eq_or_ne c 0 with (rfl | c0) · simp have : b + c ≠ 0 := ((Ordinal.pos_iff_ne_zero.2 c0).trans_le (le_add_left _ _)).ne' simp only [zero_opow c0, zero_opow this, mul_zero] rcases eq_or_lt_of_le (one_le_iff_ne_zero.2 a0) with (rfl | a1) · simp only [one_opow, mul_one] induction c using limitRecOn with | H₁ => simp | H₂ c IH => rw [add_succ, opow_succ, IH, opow_succ, mul_assoc] | H₃ c l IH => refine eq_of_forall_ge_iff fun d => (((opow_isNormal a1).trans (add_isNormal b)).limit_le l).trans ?_ dsimp only [Function.comp_def] simp (config := { contextual := true }) only [IH] exact (((mul_isNormal <| opow_pos b (Ordinal.pos_iff_ne_zero.2 a0)).trans (opow_isNormal a1)).limit_le l).symm #align ordinal.opow_add Ordinal.opow_add theorem opow_one_add (a b : Ordinal) : a ^ (1 + b) = a * a ^ b := by rw [opow_add, opow_one] #align ordinal.opow_one_add Ordinal.opow_one_add theorem opow_dvd_opow (a : Ordinal) {b c : Ordinal} (h : b ≤ c) : a ^ b ∣ a ^ c := ⟨a ^ (c - b), by rw [← opow_add, Ordinal.add_sub_cancel_of_le h]⟩ #align ordinal.opow_dvd_opow Ordinal.opow_dvd_opow theorem opow_dvd_opow_iff {a b c : Ordinal} (a1 : 1 < a) : a ^ b ∣ a ^ c ↔ b ≤ c := ⟨fun h => le_of_not_lt fun hn => not_le_of_lt ((opow_lt_opow_iff_right a1).2 hn) <| le_of_dvd (opow_ne_zero _ <| one_le_iff_ne_zero.1 <| a1.le) h, opow_dvd_opow _⟩ #align ordinal.opow_dvd_opow_iff Ordinal.opow_dvd_opow_iff theorem opow_mul (a b c : Ordinal) : a ^ (b * c) = (a ^ b) ^ c := by by_cases b0 : b = 0; · simp only [b0, zero_mul, opow_zero, one_opow] by_cases a0 : a = 0 · subst a by_cases c0 : c = 0 · simp only [c0, mul_zero, opow_zero] simp only [zero_opow b0, zero_opow c0, zero_opow (mul_ne_zero b0 c0)] cases' eq_or_lt_of_le (one_le_iff_ne_zero.2 a0) with a1 a1 · subst a1 simp only [one_opow] induction c using limitRecOn with | H₁ => simp only [mul_zero, opow_zero] | H₂ c IH => rw [mul_succ, opow_add, IH, opow_succ] | H₃ c l IH => refine eq_of_forall_ge_iff fun d => (((opow_isNormal a1).trans (mul_isNormal (Ordinal.pos_iff_ne_zero.2 b0))).limit_le l).trans ?_ dsimp only [Function.comp_def] simp (config := { contextual := true }) only [IH] exact (opow_le_of_limit (opow_ne_zero _ a0) l).symm #align ordinal.opow_mul Ordinal.opow_mul -- @[pp_nodot] -- Porting note: Unknown attribute. def log (b : Ordinal) (x : Ordinal) : Ordinal := if _h : 1 < b then pred (sInf { o | x < b ^ o }) else 0 #align ordinal.log Ordinal.log theorem log_nonempty {b x : Ordinal} (h : 1 < b) : { o : Ordinal | x < b ^ o }.Nonempty := ⟨_, succ_le_iff.1 (right_le_opow _ h)⟩ #align ordinal.log_nonempty Ordinal.log_nonempty theorem log_def {b : Ordinal} (h : 1 < b) (x : Ordinal) : log b x = pred (sInf { o | x < b ^ o }) := by simp only [log, dif_pos h] #align ordinal.log_def Ordinal.log_def theorem log_of_not_one_lt_left {b : Ordinal} (h : ¬1 < b) (x : Ordinal) : log b x = 0 := by simp only [log, dif_neg h] #align ordinal.log_of_not_one_lt_left Ordinal.log_of_not_one_lt_left theorem log_of_left_le_one {b : Ordinal} (h : b ≤ 1) : ∀ x, log b x = 0 := log_of_not_one_lt_left h.not_lt #align ordinal.log_of_left_le_one Ordinal.log_of_left_le_one @[simp] theorem log_zero_left : ∀ b, log 0 b = 0 := log_of_left_le_one zero_le_one #align ordinal.log_zero_left Ordinal.log_zero_left @[simp] theorem log_zero_right (b : Ordinal) : log b 0 = 0 := if b1 : 1 < b then by rw [log_def b1, ← Ordinal.le_zero, pred_le] apply csInf_le' dsimp rw [succ_zero, opow_one] exact zero_lt_one.trans b1 else by simp only [log_of_not_one_lt_left b1] #align ordinal.log_zero_right Ordinal.log_zero_right @[simp] theorem log_one_left : ∀ b, log 1 b = 0 := log_of_left_le_one le_rfl #align ordinal.log_one_left Ordinal.log_one_left theorem succ_log_def {b x : Ordinal} (hb : 1 < b) (hx : x ≠ 0) : succ (log b x) = sInf { o : Ordinal | x < b ^ o } := by let t := sInf { o : Ordinal | x < b ^ o } have : x < (b^t) := csInf_mem (log_nonempty hb) rcases zero_or_succ_or_limit t with (h | h | h) · refine ((one_le_iff_ne_zero.2 hx).not_lt ?_).elim simpa only [h, opow_zero] using this · rw [show log b x = pred t from log_def hb x, succ_pred_iff_is_succ.2 h] · rcases (lt_opow_of_limit (zero_lt_one.trans hb).ne' h).1 this with ⟨a, h₁, h₂⟩ exact h₁.not_le.elim ((le_csInf_iff'' (log_nonempty hb)).1 le_rfl a h₂) #align ordinal.succ_log_def Ordinal.succ_log_def
Mathlib/SetTheory/Ordinal/Exponential.lean
311
316
theorem lt_opow_succ_log_self {b : Ordinal} (hb : 1 < b) (x : Ordinal) : x < b ^ succ (log b x) := by
rcases eq_or_ne x 0 with (rfl | hx) · apply opow_pos _ (zero_lt_one.trans hb) · rw [succ_log_def hb hx] exact csInf_mem (log_nonempty hb)
import Mathlib.Algebra.BigOperators.Group.List import Mathlib.Data.Vector.Defs import Mathlib.Data.List.Nodup import Mathlib.Data.List.OfFn import Mathlib.Data.List.InsertNth import Mathlib.Control.Applicative import Mathlib.Control.Traversable.Basic #align_import data.vector.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" set_option autoImplicit true universe u variable {n : ℕ} namespace Vector variable {α : Type*} @[inherit_doc] infixr:67 " ::ᵥ " => Vector.cons attribute [simp] head_cons tail_cons instance [Inhabited α] : Inhabited (Vector α n) := ⟨ofFn default⟩ theorem toList_injective : Function.Injective (@toList α n) := Subtype.val_injective #align vector.to_list_injective Vector.toList_injective @[ext] theorem ext : ∀ {v w : Vector α n} (_ : ∀ m : Fin n, Vector.get v m = Vector.get w m), v = w | ⟨v, hv⟩, ⟨w, hw⟩, h => Subtype.eq (List.ext_get (by rw [hv, hw]) fun m hm _ => h ⟨m, hv ▸ hm⟩) #align vector.ext Vector.ext instance zero_subsingleton : Subsingleton (Vector α 0) := ⟨fun _ _ => Vector.ext fun m => Fin.elim0 m⟩ #align vector.zero_subsingleton Vector.zero_subsingleton @[simp] theorem cons_val (a : α) : ∀ v : Vector α n, (a ::ᵥ v).val = a :: v.val | ⟨_, _⟩ => rfl #align vector.cons_val Vector.cons_val #align vector.cons_head Vector.head_cons #align vector.cons_tail Vector.tail_cons theorem eq_cons_iff (a : α) (v : Vector α n.succ) (v' : Vector α n) : v = a ::ᵥ v' ↔ v.head = a ∧ v.tail = v' := ⟨fun h => h.symm ▸ ⟨head_cons a v', tail_cons a v'⟩, fun h => _root_.trans (cons_head_tail v).symm (by rw [h.1, h.2])⟩ #align vector.eq_cons_iff Vector.eq_cons_iff theorem ne_cons_iff (a : α) (v : Vector α n.succ) (v' : Vector α n) : v ≠ a ::ᵥ v' ↔ v.head ≠ a ∨ v.tail ≠ v' := by rw [Ne, eq_cons_iff a v v', not_and_or] #align vector.ne_cons_iff Vector.ne_cons_iff theorem exists_eq_cons (v : Vector α n.succ) : ∃ (a : α) (as : Vector α n), v = a ::ᵥ as := ⟨v.head, v.tail, (eq_cons_iff v.head v v.tail).2 ⟨rfl, rfl⟩⟩ #align vector.exists_eq_cons Vector.exists_eq_cons @[simp] theorem toList_ofFn : ∀ {n} (f : Fin n → α), toList (ofFn f) = List.ofFn f | 0, f => by rw [ofFn, List.ofFn_zero, toList, nil] | n + 1, f => by rw [ofFn, List.ofFn_succ, toList_cons, toList_ofFn] #align vector.to_list_of_fn Vector.toList_ofFn @[simp] theorem mk_toList : ∀ (v : Vector α n) (h), (⟨toList v, h⟩ : Vector α n) = v | ⟨_, _⟩, _ => rfl #align vector.mk_to_list Vector.mk_toList @[simp] theorem length_val (v : Vector α n) : v.val.length = n := v.2 -- Porting note: not used in mathlib and coercions done differently in Lean 4 -- @[simp] -- theorem length_coe (v : Vector α n) : -- ((coe : { l : List α // l.length = n } → List α) v).length = n := -- v.2 #noalign vector.length_coe @[simp] theorem toList_map {β : Type*} (v : Vector α n) (f : α → β) : (v.map f).toList = v.toList.map f := by cases v; rfl #align vector.to_list_map Vector.toList_map @[simp]
Mathlib/Data/Vector/Basic.lean
106
108
theorem head_map {β : Type*} (v : Vector α (n + 1)) (f : α → β) : (v.map f).head = f v.head := by
obtain ⟨a, v', h⟩ := Vector.exists_eq_cons v rw [h, map_cons, head_cons, head_cons]
import Mathlib.Data.Int.ModEq import Mathlib.GroupTheory.QuotientGroup #align_import algebra.modeq from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c" namespace AddCommGroup variable {α : Type*} section AddCommGroup variable [AddCommGroup α] {p a a₁ a₂ b b₁ b₂ c : α} {n : ℕ} {z : ℤ} def ModEq (p a b : α) : Prop := ∃ z : ℤ, b - a = z • p #align add_comm_group.modeq AddCommGroup.ModEq @[inherit_doc] notation:50 a " ≡ " b " [PMOD " p "]" => ModEq p a b @[refl, simp] theorem modEq_refl (a : α) : a ≡ a [PMOD p] := ⟨0, by simp⟩ #align add_comm_group.modeq_refl AddCommGroup.modEq_refl theorem modEq_rfl : a ≡ a [PMOD p] := modEq_refl _ #align add_comm_group.modeq_rfl AddCommGroup.modEq_rfl theorem modEq_comm : a ≡ b [PMOD p] ↔ b ≡ a [PMOD p] := (Equiv.neg _).exists_congr_left.trans <| by simp [ModEq, ← neg_eq_iff_eq_neg] #align add_comm_group.modeq_comm AddCommGroup.modEq_comm alias ⟨ModEq.symm, _⟩ := modEq_comm #align add_comm_group.modeq.symm AddCommGroup.ModEq.symm attribute [symm] ModEq.symm @[trans] theorem ModEq.trans : a ≡ b [PMOD p] → b ≡ c [PMOD p] → a ≡ c [PMOD p] := fun ⟨m, hm⟩ ⟨n, hn⟩ => ⟨m + n, by simp [add_smul, ← hm, ← hn]⟩ #align add_comm_group.modeq.trans AddCommGroup.ModEq.trans instance : IsRefl _ (ModEq p) := ⟨modEq_refl⟩ @[simp] theorem neg_modEq_neg : -a ≡ -b [PMOD p] ↔ a ≡ b [PMOD p] := modEq_comm.trans <| by simp [ModEq, neg_add_eq_sub] #align add_comm_group.neg_modeq_neg AddCommGroup.neg_modEq_neg alias ⟨ModEq.of_neg, ModEq.neg⟩ := neg_modEq_neg #align add_comm_group.modeq.of_neg AddCommGroup.ModEq.of_neg #align add_comm_group.modeq.neg AddCommGroup.ModEq.neg @[simp] theorem modEq_neg : a ≡ b [PMOD -p] ↔ a ≡ b [PMOD p] := modEq_comm.trans <| by simp [ModEq, ← neg_eq_iff_eq_neg] #align add_comm_group.modeq_neg AddCommGroup.modEq_neg alias ⟨ModEq.of_neg', ModEq.neg'⟩ := modEq_neg #align add_comm_group.modeq.of_neg' AddCommGroup.ModEq.of_neg' #align add_comm_group.modeq.neg' AddCommGroup.ModEq.neg' theorem modEq_sub (a b : α) : a ≡ b [PMOD b - a] := ⟨1, (one_smul _ _).symm⟩ #align add_comm_group.modeq_sub AddCommGroup.modEq_sub @[simp] theorem modEq_zero : a ≡ b [PMOD 0] ↔ a = b := by simp [ModEq, sub_eq_zero, eq_comm] #align add_comm_group.modeq_zero AddCommGroup.modEq_zero @[simp] theorem self_modEq_zero : p ≡ 0 [PMOD p] := ⟨-1, by simp⟩ #align add_comm_group.self_modeq_zero AddCommGroup.self_modEq_zero @[simp] theorem zsmul_modEq_zero (z : ℤ) : z • p ≡ 0 [PMOD p] := ⟨-z, by simp⟩ #align add_comm_group.zsmul_modeq_zero AddCommGroup.zsmul_modEq_zero theorem add_zsmul_modEq (z : ℤ) : a + z • p ≡ a [PMOD p] := ⟨-z, by simp⟩ #align add_comm_group.add_zsmul_modeq AddCommGroup.add_zsmul_modEq theorem zsmul_add_modEq (z : ℤ) : z • p + a ≡ a [PMOD p] := ⟨-z, by simp [← sub_sub]⟩ #align add_comm_group.zsmul_add_modeq AddCommGroup.zsmul_add_modEq theorem add_nsmul_modEq (n : ℕ) : a + n • p ≡ a [PMOD p] := ⟨-n, by simp⟩ #align add_comm_group.add_nsmul_modeq AddCommGroup.add_nsmul_modEq theorem nsmul_add_modEq (n : ℕ) : n • p + a ≡ a [PMOD p] := ⟨-n, by simp [← sub_sub]⟩ #align add_comm_group.nsmul_add_modeq AddCommGroup.nsmul_add_modEq theorem modEq_sub_iff_add_modEq' : a ≡ b - c [PMOD p] ↔ c + a ≡ b [PMOD p] := by simp [ModEq, sub_sub] #align add_comm_group.modeq_sub_iff_add_modeq' AddCommGroup.modEq_sub_iff_add_modEq' theorem modEq_sub_iff_add_modEq : a ≡ b - c [PMOD p] ↔ a + c ≡ b [PMOD p] := modEq_sub_iff_add_modEq'.trans <| by rw [add_comm] #align add_comm_group.modeq_sub_iff_add_modeq AddCommGroup.modEq_sub_iff_add_modEq theorem sub_modEq_iff_modEq_add' : a - b ≡ c [PMOD p] ↔ a ≡ b + c [PMOD p] := modEq_comm.trans <| modEq_sub_iff_add_modEq'.trans modEq_comm #align add_comm_group.sub_modeq_iff_modeq_add' AddCommGroup.sub_modEq_iff_modEq_add' theorem sub_modEq_iff_modEq_add : a - b ≡ c [PMOD p] ↔ a ≡ c + b [PMOD p] := modEq_comm.trans <| modEq_sub_iff_add_modEq.trans modEq_comm #align add_comm_group.sub_modeq_iff_modeq_add AddCommGroup.sub_modEq_iff_modEq_add @[simp]
Mathlib/Algebra/ModEq.lean
279
279
theorem sub_modEq_zero : a - b ≡ 0 [PMOD p] ↔ a ≡ b [PMOD p] := by
simp [sub_modEq_iff_modEq_add]
import Mathlib.Algebra.Ring.Idempotents import Mathlib.RingTheory.Finiteness import Mathlib.Order.Basic #align_import ring_theory.ideal.idempotent_fg from "leanprover-community/mathlib"@"25cf7631da8ddc2d5f957c388bf5e4b25a77d8dc" namespace Ideal
Mathlib/RingTheory/Ideal/IdempotentFG.lean
20
35
theorem isIdempotentElem_iff_of_fg {R : Type*} [CommRing R] (I : Ideal R) (h : I.FG) : IsIdempotentElem I ↔ ∃ e : R, IsIdempotentElem e ∧ I = R ∙ e := by
constructor · intro e obtain ⟨r, hr, hr'⟩ := Submodule.exists_mem_and_smul_eq_self_of_fg_of_le_smul I I h (by rw [smul_eq_mul] exact e.ge) simp_rw [smul_eq_mul] at hr' refine ⟨r, hr' r hr, antisymm ?_ ((Submodule.span_singleton_le_iff_mem _ _).mpr hr)⟩ intro x hx rw [← hr' x hx] exact Ideal.mem_span_singleton'.mpr ⟨_, mul_comm _ _⟩ · rintro ⟨e, he, rfl⟩ simp [IsIdempotentElem, Ideal.span_singleton_mul_span_singleton, he.eq]
import Mathlib.Data.Finsupp.Multiset import Mathlib.Order.Bounded import Mathlib.SetTheory.Cardinal.PartENat import Mathlib.SetTheory.Ordinal.Principal import Mathlib.Tactic.Linarith #align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Set Cardinal Equiv Order Ordinal open scoped Classical universe u v w namespace Cardinal section UsingOrdinals theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩ · rw [← Ordinal.le_zero, ord_le] at h simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h · rw [ord_le] at h ⊢ rwa [← @add_one_of_aleph0_le (card a), ← card_succ] rw [← ord_le, ← le_succ_of_isLimit, ord_le] · exact co.trans h · rw [ord_aleph0] exact omega_isLimit #align cardinal.ord_is_limit Cardinal.ord_isLimit theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α := Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2 section aleph def alephIdx.initialSeg : @InitialSeg Cardinal Ordinal (· < ·) (· < ·) := @RelEmbedding.collapse Cardinal Ordinal (· < ·) (· < ·) _ Cardinal.ord.orderEmbedding.ltEmbedding #align cardinal.aleph_idx.initial_seg Cardinal.alephIdx.initialSeg def alephIdx : Cardinal → Ordinal := alephIdx.initialSeg #align cardinal.aleph_idx Cardinal.alephIdx @[simp] theorem alephIdx.initialSeg_coe : (alephIdx.initialSeg : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.initial_seg_coe Cardinal.alephIdx.initialSeg_coe @[simp] theorem alephIdx_lt {a b} : alephIdx a < alephIdx b ↔ a < b := alephIdx.initialSeg.toRelEmbedding.map_rel_iff #align cardinal.aleph_idx_lt Cardinal.alephIdx_lt @[simp]
Mathlib/SetTheory/Cardinal/Ordinal.lean
111
112
theorem alephIdx_le {a b} : alephIdx a ≤ alephIdx b ↔ a ≤ b := by
rw [← not_lt, ← not_lt, alephIdx_lt]
import Mathlib.Algebra.Group.Commute.Defs import Mathlib.Algebra.Group.Hom.Instances import Mathlib.Data.Set.Function import Mathlib.Logic.Pairwise #align_import algebra.group.pi from "leanprover-community/mathlib"@"e4bc74cbaf429d706cb9140902f7ca6c431e75a4" assert_not_exists AddMonoidWithOne assert_not_exists MonoidWithZero universe u v w variable {ι α : Type*} variable {I : Type u} -- The indexing type variable {f : I → Type v} -- The family of types already equipped with instances variable (x y : ∀ i, f i) (i j : I) @[to_additive (attr := simp)] theorem Set.range_one {α β : Type*} [One β] [Nonempty α] : Set.range (1 : α → β) = {1} := range_const @[to_additive] theorem Set.preimage_one {α β : Type*} [One β] (s : Set β) [Decidable ((1 : β) ∈ s)] : (1 : α → β) ⁻¹' s = if (1 : β) ∈ s then Set.univ else ∅ := Set.preimage_const 1 s #align set.preimage_one Set.preimage_one #align set.preimage_zero Set.preimage_zero namespace MulHom @[to_additive] theorem coe_mul {M N} {_ : Mul M} {_ : CommSemigroup N} (f g : M →ₙ* N) : (f * g : M → N) = fun x => f x * g x := rfl #align mul_hom.coe_mul MulHom.coe_mul #align add_hom.coe_add AddHom.coe_add end MulHom section Single variable [DecidableEq I] open Pi variable (f) @[to_additive "The zero-preserving homomorphism including a single value into a dependent family of values, as functions supported at a point. This is the `ZeroHom` version of `Pi.single`."] nonrec def OneHom.mulSingle [∀ i, One <| f i] (i : I) : OneHom (f i) (∀ i, f i) where toFun := mulSingle i map_one' := mulSingle_one i #align one_hom.single OneHom.mulSingle #align zero_hom.single ZeroHom.single @[to_additive (attr := simp)] theorem OneHom.mulSingle_apply [∀ i, One <| f i] (i : I) (x : f i) : mulSingle f i x = Pi.mulSingle i x := rfl #align one_hom.single_apply OneHom.mulSingle_apply #align zero_hom.single_apply ZeroHom.single_apply @[to_additive "The additive monoid homomorphism including a single additive monoid into a dependent family of additive monoids, as functions supported at a point. This is the `AddMonoidHom` version of `Pi.single`."] def MonoidHom.mulSingle [∀ i, MulOneClass <| f i] (i : I) : f i →* ∀ i, f i := { OneHom.mulSingle f i with map_mul' := mulSingle_op₂ (fun _ => (· * ·)) (fun _ => one_mul _) _ } #align monoid_hom.single MonoidHom.mulSingle #align add_monoid_hom.single AddMonoidHom.single @[to_additive (attr := simp)] theorem MonoidHom.mulSingle_apply [∀ i, MulOneClass <| f i] (i : I) (x : f i) : mulSingle f i x = Pi.mulSingle i x := rfl #align monoid_hom.single_apply MonoidHom.mulSingle_apply #align add_monoid_hom.single_apply AddMonoidHom.single_apply variable {f} @[to_additive] theorem Pi.mulSingle_sup [∀ i, SemilatticeSup (f i)] [∀ i, One (f i)] (i : I) (x y : f i) : Pi.mulSingle i (x ⊔ y) = Pi.mulSingle i x ⊔ Pi.mulSingle i y := Function.update_sup _ _ _ _ #align pi.mul_single_sup Pi.mulSingle_sup #align pi.single_sup Pi.single_sup @[to_additive] theorem Pi.mulSingle_inf [∀ i, SemilatticeInf (f i)] [∀ i, One (f i)] (i : I) (x y : f i) : Pi.mulSingle i (x ⊓ y) = Pi.mulSingle i x ⊓ Pi.mulSingle i y := Function.update_inf _ _ _ _ #align pi.mul_single_inf Pi.mulSingle_inf #align pi.single_inf Pi.single_inf @[to_additive] theorem Pi.mulSingle_mul [∀ i, MulOneClass <| f i] (i : I) (x y : f i) : mulSingle i (x * y) = mulSingle i x * mulSingle i y := (MonoidHom.mulSingle f i).map_mul x y #align pi.mul_single_mul Pi.mulSingle_mul #align pi.single_add Pi.single_add @[to_additive] theorem Pi.mulSingle_inv [∀ i, Group <| f i] (i : I) (x : f i) : mulSingle i x⁻¹ = (mulSingle i x)⁻¹ := (MonoidHom.mulSingle f i).map_inv x #align pi.mul_single_inv Pi.mulSingle_inv #align pi.single_neg Pi.single_neg @[to_additive] theorem Pi.mulSingle_div [∀ i, Group <| f i] (i : I) (x y : f i) : mulSingle i (x / y) = mulSingle i x / mulSingle i y := (MonoidHom.mulSingle f i).map_div x y #align pi.single_div Pi.mulSingle_div #align pi.single_sub Pi.single_sub section variable [∀ i, Mul <| f i] @[to_additive] theorem SemiconjBy.pi {x y z : ∀ i, f i} (h : ∀ i, SemiconjBy (x i) (y i) (z i)) : SemiconjBy x y z := funext h @[to_additive] theorem Pi.semiconjBy_iff {x y z : ∀ i, f i} : SemiconjBy x y z ↔ ∀ i, SemiconjBy (x i) (y i) (z i) := Function.funext_iff @[to_additive] theorem Commute.pi {x y : ∀ i, f i} (h : ∀ i, Commute (x i) (y i)) : Commute x y := .pi h @[to_additive] theorem Pi.commute_iff {x y : ∀ i, f i} : Commute x y ↔ ∀ i, Commute (x i) (y i) := semiconjBy_iff end @[to_additive "The injection into an additive pi group at different indices commutes. For injections of commuting elements at the same index, see `AddCommute.map`"] theorem Pi.mulSingle_commute [∀ i, MulOneClass <| f i] : Pairwise fun i j => ∀ (x : f i) (y : f j), Commute (mulSingle i x) (mulSingle j y) := by intro i j hij x y; ext k by_cases h1 : i = k; · subst h1 simp [hij] by_cases h2 : j = k; · subst h2 simp [hij] simp [h1, h2] #align pi.mul_single_commute Pi.mulSingle_commute #align pi.single_commute Pi.single_addCommute @[to_additive "The injection into an additive pi group with the same values commutes."]
Mathlib/Algebra/Group/Pi/Lemmas.lean
350
354
theorem Pi.mulSingle_apply_commute [∀ i, MulOneClass <| f i] (x : ∀ i, f i) (i j : I) : Commute (mulSingle i (x i)) (mulSingle j (x j)) := by
obtain rfl | hij := Decidable.eq_or_ne i j · rfl · exact Pi.mulSingle_commute hij _ _
import Mathlib.Algebra.Order.Monoid.Defs import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Util.AssertExists #align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce" open Function universe u variable {α : Type u} class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b #align ordered_add_comm_group OrderedAddCommGroup class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b #align ordered_comm_group OrderedCommGroup attribute [to_additive] OrderedCommGroup @[to_additive] instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] : CovariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a #align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le #align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le -- See note [lower instance priority] @[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid] instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] : OrderedCancelCommMonoid α := { ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' } #align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid #align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) := IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564 -- but without the motivation clearly explained. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le #align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (swap (· * ·)) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le #align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le section Group variable [Group α] section TypeclassesRightLE variable [LE α] [CovariantClass α α (swap (· * ·)) (· ≤ ·)] {a b c : α} @[to_additive (attr := simp) "Uses `right` co(ntra)variant."]
Mathlib/Algebra/Order/Group/Defs.lean
215
217
theorem Right.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a := by
rw [← mul_le_mul_iff_right a] simp
import Mathlib.Analysis.Calculus.FDeriv.Linear import Mathlib.Analysis.Calculus.FDeriv.Comp #align_import analysis.calculus.fderiv.prod from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} section CartesianProduct section Pi variable {ι : Type*} [Fintype ι] {F' : ι → Type*} [∀ i, NormedAddCommGroup (F' i)] [∀ i, NormedSpace 𝕜 (F' i)] {φ : ∀ i, E → F' i} {φ' : ∀ i, E →L[𝕜] F' i} {Φ : E → ∀ i, F' i} {Φ' : E →L[𝕜] ∀ i, F' i} @[simp] theorem hasStrictFDerivAt_pi' : HasStrictFDerivAt Φ Φ' x ↔ ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x := by simp only [HasStrictFDerivAt, ContinuousLinearMap.coe_pi] exact isLittleO_pi #align has_strict_fderiv_at_pi' hasStrictFDerivAt_pi' @[fun_prop] theorem hasStrictFDerivAt_pi'' (hφ : ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x) : HasStrictFDerivAt Φ Φ' x := hasStrictFDerivAt_pi'.2 hφ @[fun_prop] theorem hasStrictFDerivAt_apply (i : ι) (f : ∀ i, F' i) : HasStrictFDerivAt (𝕜:=𝕜) (fun f : ∀ i, F' i => f i) (proj i) f := by let id' := ContinuousLinearMap.id 𝕜 (∀ i, F' i) have h := ((hasStrictFDerivAt_pi' (Φ := fun (f : ∀ i, F' i) (i' : ι) => f i') (Φ':=id') (x:=f))).1 have h' : comp (proj i) id' = proj i := by rfl rw [← h']; apply h; apply hasStrictFDerivAt_id @[simp 1100] -- Porting note: increased priority to make lint happy theorem hasStrictFDerivAt_pi : HasStrictFDerivAt (fun x i => φ i x) (ContinuousLinearMap.pi φ') x ↔ ∀ i, HasStrictFDerivAt (φ i) (φ' i) x := hasStrictFDerivAt_pi' #align has_strict_fderiv_at_pi hasStrictFDerivAt_pi @[simp]
Mathlib/Analysis/Calculus/FDeriv/Prod.lean
427
431
theorem hasFDerivAtFilter_pi' : HasFDerivAtFilter Φ Φ' x L ↔ ∀ i, HasFDerivAtFilter (fun x => Φ x i) ((proj i).comp Φ') x L := by
simp only [hasFDerivAtFilter_iff_isLittleO, ContinuousLinearMap.coe_pi] exact isLittleO_pi
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
83
87
theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by
induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp]
import Mathlib.Order.Lattice #align_import order.min_max from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v variable {α : Type u} {β : Type v} attribute [simp] max_eq_left max_eq_right min_eq_left min_eq_right section variable [LinearOrder α] [LinearOrder β] {f : α → β} {s : Set α} {a b c d : α} -- translate from lattices to linear orders (sup → max, inf → min) @[simp] theorem le_min_iff : c ≤ min a b ↔ c ≤ a ∧ c ≤ b := le_inf_iff #align le_min_iff le_min_iff @[simp] theorem le_max_iff : a ≤ max b c ↔ a ≤ b ∨ a ≤ c := le_sup_iff #align le_max_iff le_max_iff @[simp] theorem min_le_iff : min a b ≤ c ↔ a ≤ c ∨ b ≤ c := inf_le_iff #align min_le_iff min_le_iff @[simp] theorem max_le_iff : max a b ≤ c ↔ a ≤ c ∧ b ≤ c := sup_le_iff #align max_le_iff max_le_iff @[simp] theorem lt_min_iff : a < min b c ↔ a < b ∧ a < c := lt_inf_iff #align lt_min_iff lt_min_iff @[simp] theorem lt_max_iff : a < max b c ↔ a < b ∨ a < c := lt_sup_iff #align lt_max_iff lt_max_iff @[simp] theorem min_lt_iff : min a b < c ↔ a < c ∨ b < c := inf_lt_iff #align min_lt_iff min_lt_iff @[simp] theorem max_lt_iff : max a b < c ↔ a < c ∧ b < c := sup_lt_iff #align max_lt_iff max_lt_iff @[gcongr] theorem max_le_max : a ≤ c → b ≤ d → max a b ≤ max c d := sup_le_sup #align max_le_max max_le_max @[gcongr] theorem max_le_max_left (c) (h : a ≤ b) : max c a ≤ max c b := sup_le_sup_left h c @[gcongr] theorem max_le_max_right (c) (h : a ≤ b) : max a c ≤ max b c := sup_le_sup_right h c @[gcongr] theorem min_le_min : a ≤ c → b ≤ d → min a b ≤ min c d := inf_le_inf #align min_le_min min_le_min @[gcongr] theorem min_le_min_left (c) (h : a ≤ b) : min c a ≤ min c b := inf_le_inf_left c h @[gcongr] theorem min_le_min_right (c) (h : a ≤ b) : min a c ≤ min b c := inf_le_inf_right c h theorem le_max_of_le_left : a ≤ b → a ≤ max b c := le_sup_of_le_left #align le_max_of_le_left le_max_of_le_left theorem le_max_of_le_right : a ≤ c → a ≤ max b c := le_sup_of_le_right #align le_max_of_le_right le_max_of_le_right theorem lt_max_of_lt_left (h : a < b) : a < max b c := h.trans_le (le_max_left b c) #align lt_max_of_lt_left lt_max_of_lt_left theorem lt_max_of_lt_right (h : a < c) : a < max b c := h.trans_le (le_max_right b c) #align lt_max_of_lt_right lt_max_of_lt_right theorem min_le_of_left_le : a ≤ c → min a b ≤ c := inf_le_of_left_le #align min_le_of_left_le min_le_of_left_le theorem min_le_of_right_le : b ≤ c → min a b ≤ c := inf_le_of_right_le #align min_le_of_right_le min_le_of_right_le theorem min_lt_of_left_lt (h : a < c) : min a b < c := (min_le_left a b).trans_lt h #align min_lt_of_left_lt min_lt_of_left_lt theorem min_lt_of_right_lt (h : b < c) : min a b < c := (min_le_right a b).trans_lt h #align min_lt_of_right_lt min_lt_of_right_lt lemma max_min_distrib_left (a b c : α) : max a (min b c) = min (max a b) (max a c) := sup_inf_left _ _ _ #align max_min_distrib_left max_min_distrib_left lemma max_min_distrib_right (a b c : α) : max (min a b) c = min (max a c) (max b c) := sup_inf_right _ _ _ #align max_min_distrib_right max_min_distrib_right lemma min_max_distrib_left (a b c : α) : min a (max b c) = max (min a b) (min a c) := inf_sup_left _ _ _ #align min_max_distrib_left min_max_distrib_left lemma min_max_distrib_right (a b c : α) : min (max a b) c = max (min a c) (min b c) := inf_sup_right _ _ _ #align min_max_distrib_right min_max_distrib_right theorem min_le_max : min a b ≤ max a b := le_trans (min_le_left a b) (le_max_left a b) #align min_le_max min_le_max @[simp] theorem min_eq_left_iff : min a b = a ↔ a ≤ b := inf_eq_left #align min_eq_left_iff min_eq_left_iff @[simp] theorem min_eq_right_iff : min a b = b ↔ b ≤ a := inf_eq_right #align min_eq_right_iff min_eq_right_iff @[simp] theorem max_eq_left_iff : max a b = a ↔ b ≤ a := sup_eq_left #align max_eq_left_iff max_eq_left_iff @[simp] theorem max_eq_right_iff : max a b = b ↔ a ≤ b := sup_eq_right #align max_eq_right_iff max_eq_right_iff theorem min_cases (a b : α) : min a b = a ∧ a ≤ b ∨ min a b = b ∧ b < a := by by_cases h : a ≤ b · left exact ⟨min_eq_left h, h⟩ · right exact ⟨min_eq_right (le_of_lt (not_le.mp h)), not_le.mp h⟩ #align min_cases min_cases theorem max_cases (a b : α) : max a b = a ∧ b ≤ a ∨ max a b = b ∧ a < b := @min_cases αᵒᵈ _ a b #align max_cases max_cases theorem min_eq_iff : min a b = c ↔ a = c ∧ a ≤ b ∨ b = c ∧ b ≤ a := by constructor · intro h refine Or.imp (fun h' => ?_) (fun h' => ?_) (le_total a b) <;> exact ⟨by simpa [h'] using h, h'⟩ · rintro (⟨rfl, h⟩ | ⟨rfl, h⟩) <;> simp [h] #align min_eq_iff min_eq_iff theorem max_eq_iff : max a b = c ↔ a = c ∧ b ≤ a ∨ b = c ∧ a ≤ b := @min_eq_iff αᵒᵈ _ a b c #align max_eq_iff max_eq_iff theorem min_lt_min_left_iff : min a c < min b c ↔ a < b ∧ a < c := by simp_rw [lt_min_iff, min_lt_iff, or_iff_left (lt_irrefl _)] exact and_congr_left fun h => or_iff_left_of_imp h.trans #align min_lt_min_left_iff min_lt_min_left_iff theorem min_lt_min_right_iff : min a b < min a c ↔ b < c ∧ b < a := by simp_rw [min_comm a, min_lt_min_left_iff] #align min_lt_min_right_iff min_lt_min_right_iff theorem max_lt_max_left_iff : max a c < max b c ↔ a < b ∧ c < b := @min_lt_min_left_iff αᵒᵈ _ _ _ _ #align max_lt_max_left_iff max_lt_max_left_iff theorem max_lt_max_right_iff : max a b < max a c ↔ b < c ∧ a < c := @min_lt_min_right_iff αᵒᵈ _ _ _ _ #align max_lt_max_right_iff max_lt_max_right_iff instance max_idem : Std.IdempotentOp (α := α) max where idempotent := by simp #align max_idem max_idem -- short-circuit type class inference instance min_idem : Std.IdempotentOp (α := α) min where idempotent := by simp #align min_idem min_idem -- short-circuit type class inference theorem min_lt_max : min a b < max a b ↔ a ≠ b := inf_lt_sup #align min_lt_max min_lt_max -- Porting note: was `by simp [lt_max_iff, max_lt_iff, *]` theorem max_lt_max (h₁ : a < c) (h₂ : b < d) : max a b < max c d := max_lt (lt_max_of_lt_left h₁) (lt_max_of_lt_right h₂) #align max_lt_max max_lt_max theorem min_lt_min (h₁ : a < c) (h₂ : b < d) : min a b < min c d := @max_lt_max αᵒᵈ _ _ _ _ _ h₁ h₂ #align min_lt_min min_lt_min theorem min_right_comm (a b c : α) : min (min a b) c = min (min a c) b := right_comm min min_comm min_assoc a b c #align min_right_comm min_right_comm theorem Max.left_comm (a b c : α) : max a (max b c) = max b (max a c) := _root_.left_comm max max_comm max_assoc a b c #align max.left_comm Max.left_comm theorem Max.right_comm (a b c : α) : max (max a b) c = max (max a c) b := _root_.right_comm max max_comm max_assoc a b c #align max.right_comm Max.right_comm theorem MonotoneOn.map_max (hf : MonotoneOn f s) (ha : a ∈ s) (hb : b ∈ s) : f (max a b) = max (f a) (f b) := by rcases le_total a b with h | h <;> simp only [max_eq_right, max_eq_left, hf ha hb, hf hb ha, h] #align monotone_on.map_max MonotoneOn.map_max theorem MonotoneOn.map_min (hf : MonotoneOn f s) (ha : a ∈ s) (hb : b ∈ s) : f (min a b) = min (f a) (f b) := hf.dual.map_max ha hb #align monotone_on.map_min MonotoneOn.map_min theorem AntitoneOn.map_max (hf : AntitoneOn f s) (ha : a ∈ s) (hb : b ∈ s) : f (max a b) = min (f a) (f b) := hf.dual_right.map_max ha hb #align antitone_on.map_max AntitoneOn.map_max theorem AntitoneOn.map_min (hf : AntitoneOn f s) (ha : a ∈ s) (hb : b ∈ s) : f (min a b) = max (f a) (f b) := hf.dual.map_max ha hb #align antitone_on.map_min AntitoneOn.map_min theorem Monotone.map_max (hf : Monotone f) : f (max a b) = max (f a) (f b) := by rcases le_total a b with h | h <;> simp [h, hf h] #align monotone.map_max Monotone.map_max theorem Monotone.map_min (hf : Monotone f) : f (min a b) = min (f a) (f b) := hf.dual.map_max #align monotone.map_min Monotone.map_min
Mathlib/Order/MinMax.lean
271
272
theorem Antitone.map_max (hf : Antitone f) : f (max a b) = min (f a) (f b) := by
rcases le_total a b with h | h <;> simp [h, hf h]
import Mathlib.Data.PFunctor.Multivariate.Basic #align_import data.pfunctor.multivariate.W from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" universe u v namespace MvPFunctor open TypeVec open MvFunctor variable {n : ℕ} (P : MvPFunctor.{u} (n + 1)) inductive WPath : P.last.W → Fin2 n → Type u | root (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (c : P.drop.B a i) : WPath ⟨a, f⟩ i | child (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (j : P.last.B a) (c : WPath (f j) i) : WPath ⟨a, f⟩ i set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path MvPFunctor.WPath instance WPath.inhabited (x : P.last.W) {i} [I : Inhabited (P.drop.B x.head i)] : Inhabited (WPath P x i) := ⟨match x, I with | ⟨a, f⟩, I => WPath.root a f i (@default _ I)⟩ set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path.inhabited MvPFunctor.WPath.inhabited def wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.WPath ⟨a, f⟩ ⟹ α := by intro i x; match x with | WPath.root _ _ i c => exact g' i c | WPath.child _ _ i j c => exact g j i c set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_cases_on MvPFunctor.wPathCasesOn def wPathDestLeft {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (h : P.WPath ⟨a, f⟩ ⟹ α) : P.drop.B a ⟹ α := fun i c => h i (WPath.root a f i c) set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_left MvPFunctor.wPathDestLeft def wPathDestRight {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (h : P.WPath ⟨a, f⟩ ⟹ α) : ∀ j : P.last.B a, P.WPath (f j) ⟹ α := fun j i c => h i (WPath.child a f i j c) set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_right MvPFunctor.wPathDestRight theorem wPathDestLeft_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.wPathDestLeft (P.wPathCasesOn g' g) = g' := rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_left_W_path_cases_on MvPFunctor.wPathDestLeft_wPathCasesOn theorem wPathDestRight_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.wPathDestRight (P.wPathCasesOn g' g) = g := rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_right_W_path_cases_on MvPFunctor.wPathDestRight_wPathCasesOn theorem wPathCasesOn_eta {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (h : P.WPath ⟨a, f⟩ ⟹ α) : P.wPathCasesOn (P.wPathDestLeft h) (P.wPathDestRight h) = h := by ext i x; cases x <;> rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_cases_on_eta MvPFunctor.wPathCasesOn_eta theorem comp_wPathCasesOn {α β : TypeVec n} (h : α ⟹ β) {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : h ⊚ P.wPathCasesOn g' g = P.wPathCasesOn (h ⊚ g') fun i => h ⊚ g i := by ext i x; cases x <;> rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.comp_W_path_cases_on MvPFunctor.comp_wPathCasesOn def wp : MvPFunctor n where A := P.last.W B := P.WPath set_option linter.uppercaseLean3 false in #align mvpfunctor.Wp MvPFunctor.wp -- Porting note(#5171): used to have @[nolint has_nonempty_instance] def W (α : TypeVec n) : Type _ := P.wp α set_option linter.uppercaseLean3 false in #align mvpfunctor.W MvPFunctor.W instance mvfunctorW : MvFunctor P.W := by delta MvPFunctor.W; infer_instance set_option linter.uppercaseLean3 false in #align mvpfunctor.mvfunctor_W MvPFunctor.mvfunctorW def wpMk {α : TypeVec n} (a : P.A) (f : P.last.B a → P.last.W) (f' : P.WPath ⟨a, f⟩ ⟹ α) : P.W α := ⟨⟨a, f⟩, f'⟩ set_option linter.uppercaseLean3 false in #align mvpfunctor.Wp_mk MvPFunctor.wpMk def wpRec {α : TypeVec n} {C : Type*} (g : ∀ (a : P.A) (f : P.last.B a → P.last.W), P.WPath ⟨a, f⟩ ⟹ α → (P.last.B a → C) → C) : ∀ (x : P.last.W) (_ : P.WPath x ⟹ α), C | ⟨a, f⟩, f' => g a f f' fun i => wpRec g (f i) (P.wPathDestRight f' i) set_option linter.uppercaseLean3 false in #align mvpfunctor.Wp_rec MvPFunctor.wpRec theorem wpRec_eq {α : TypeVec n} {C : Type*} (g : ∀ (a : P.A) (f : P.last.B a → P.last.W), P.WPath ⟨a, f⟩ ⟹ α → (P.last.B a → C) → C) (a : P.A) (f : P.last.B a → P.last.W) (f' : P.WPath ⟨a, f⟩ ⟹ α) : P.wpRec g ⟨a, f⟩ f' = g a f f' fun i => P.wpRec g (f i) (P.wPathDestRight f' i) := rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.Wp_rec_eq MvPFunctor.wpRec_eq -- Note: we could replace Prop by Type* and obtain a dependent recursor theorem wp_ind {α : TypeVec n} {C : ∀ x : P.last.W, P.WPath x ⟹ α → Prop} (ih : ∀ (a : P.A) (f : P.last.B a → P.last.W) (f' : P.WPath ⟨a, f⟩ ⟹ α), (∀ i : P.last.B a, C (f i) (P.wPathDestRight f' i)) → C ⟨a, f⟩ f') : ∀ (x : P.last.W) (f' : P.WPath x ⟹ α), C x f' | ⟨a, f⟩, f' => ih a f f' fun _i => wp_ind ih _ _ set_option linter.uppercaseLean3 false in #align mvpfunctor.Wp_ind MvPFunctor.wp_ind def wMk {α : TypeVec n} (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) : P.W α := let g : P.last.B a → P.last.W := fun i => (f i).fst let g' : P.WPath ⟨a, g⟩ ⟹ α := P.wPathCasesOn f' fun i => (f i).snd ⟨⟨a, g⟩, g'⟩ set_option linter.uppercaseLean3 false in #align mvpfunctor.W_mk MvPFunctor.wMk def wRec {α : TypeVec n} {C : Type*} (g : ∀ a : P.A, P.drop.B a ⟹ α → (P.last.B a → P.W α) → (P.last.B a → C) → C) : P.W α → C | ⟨a, f'⟩ => let g' (a : P.A) (f : P.last.B a → P.last.W) (h : P.WPath ⟨a, f⟩ ⟹ α) (h' : P.last.B a → C) : C := g a (P.wPathDestLeft h) (fun i => ⟨f i, P.wPathDestRight h i⟩) h' P.wpRec g' a f' set_option linter.uppercaseLean3 false in #align mvpfunctor.W_rec MvPFunctor.wRec theorem wRec_eq {α : TypeVec n} {C : Type*} (g : ∀ a : P.A, P.drop.B a ⟹ α → (P.last.B a → P.W α) → (P.last.B a → C) → C) (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) : P.wRec g (P.wMk a f' f) = g a f' f fun i => P.wRec g (f i) := by rw [wMk, wRec]; dsimp; rw [wpRec_eq] dsimp only [wPathDestLeft_wPathCasesOn, wPathDestRight_wPathCasesOn] congr set_option linter.uppercaseLean3 false in #align mvpfunctor.W_rec_eq MvPFunctor.wRec_eq theorem w_ind {α : TypeVec n} {C : P.W α → Prop} (ih : ∀ (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α), (∀ i, C (f i)) → C (P.wMk a f' f)) : ∀ x, C x := by intro x; cases' x with a f apply @wp_ind n P α fun a f => C ⟨a, f⟩ intro a f f' ih' dsimp [wMk] at ih let ih'' := ih a (P.wPathDestLeft f') fun i => ⟨f i, P.wPathDestRight f' i⟩ dsimp at ih''; rw [wPathCasesOn_eta] at ih'' apply ih'' apply ih' set_option linter.uppercaseLean3 false in #align mvpfunctor.W_ind MvPFunctor.w_ind theorem w_cases {α : TypeVec n} {C : P.W α → Prop} (ih : ∀ (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α), C (P.wMk a f' f)) : ∀ x, C x := P.w_ind fun a f' f _ih' => ih a f' f set_option linter.uppercaseLean3 false in #align mvpfunctor.W_cases MvPFunctor.w_cases def wMap {α β : TypeVec n} (g : α ⟹ β) : P.W α → P.W β := fun x => g <$$> x set_option linter.uppercaseLean3 false in #align mvpfunctor.W_map MvPFunctor.wMap theorem wMk_eq {α : TypeVec n} (a : P.A) (f : P.last.B a → P.last.W) (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : (P.wMk a g' fun i => ⟨f i, g i⟩) = ⟨⟨a, f⟩, P.wPathCasesOn g' g⟩ := rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.W_mk_eq MvPFunctor.wMk_eq theorem w_map_wMk {α β : TypeVec n} (g : α ⟹ β) (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) : g <$$> P.wMk a f' f = P.wMk a (g ⊚ f') fun i => g <$$> f i := by show _ = P.wMk a (g ⊚ f') (MvFunctor.map g ∘ f) have : MvFunctor.map g ∘ f = fun i => ⟨(f i).fst, g ⊚ (f i).snd⟩ := by ext i : 1 dsimp [Function.comp_def] cases f i rfl rw [this] have : f = fun i => ⟨(f i).fst, (f i).snd⟩ := by ext1 x cases f x rfl rw [this] dsimp rw [wMk_eq, wMk_eq] have h := MvPFunctor.map_eq P.wp g rw [h, comp_wPathCasesOn] set_option linter.uppercaseLean3 false in #align mvpfunctor.W_map_W_mk MvPFunctor.w_map_wMk -- TODO: this technical theorem is used in one place in constructing the initial algebra. -- Can it be avoided? abbrev objAppend1 {α : TypeVec n} {β : Type u} (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → β) : P (α ::: β) := ⟨a, splitFun f' f⟩ #align mvpfunctor.obj_append1 MvPFunctor.objAppend1 theorem map_objAppend1 {α γ : TypeVec n} (g : α ⟹ γ) (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) : appendFun g (P.wMap g) <$$> P.objAppend1 a f' f = P.objAppend1 a (g ⊚ f') fun x => P.wMap g (f x) := by rw [objAppend1, objAppend1, map_eq, appendFun, ← splitFun_comp]; rfl #align mvpfunctor.map_obj_append1 MvPFunctor.map_objAppend1 def wMk' {α : TypeVec n} : P (α ::: P.W α) → P.W α | ⟨a, f⟩ => P.wMk a (dropFun f) (lastFun f) set_option linter.uppercaseLean3 false in #align mvpfunctor.W_mk' MvPFunctor.wMk' def wDest' {α : TypeVec.{u} n} : P.W α → P (α.append1 (P.W α)) := P.wRec fun a f' f _ => ⟨a, splitFun f' f⟩ set_option linter.uppercaseLean3 false in #align mvpfunctor.W_dest' MvPFunctor.wDest' theorem wDest'_wMk {α : TypeVec n} (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) : P.wDest' (P.wMk a f' f) = ⟨a, splitFun f' f⟩ := by rw [wDest', wRec_eq] set_option linter.uppercaseLean3 false in #align mvpfunctor.W_dest'_W_mk MvPFunctor.wDest'_wMk
Mathlib/Data/PFunctor/Multivariate/W.lean
310
311
theorem wDest'_wMk' {α : TypeVec n} (x : P (α.append1 (P.W α))) : P.wDest' (P.wMk' x) = x := by
cases' x with a f; rw [wMk', wDest'_wMk, split_dropFun_lastFun]
import Mathlib.Data.Set.Prod #align_import data.set.n_ary from "leanprover-community/mathlib"@"5e526d18cea33550268dcbbddcb822d5cde40654" open Function namespace Set variable {α α' β β' γ γ' δ δ' ε ε' ζ ζ' ν : Type*} {f f' : α → β → γ} {g g' : α → β → γ → δ} variable {s s' : Set α} {t t' : Set β} {u u' : Set γ} {v : Set δ} {a a' : α} {b b' : β} {c c' : γ} {d d' : δ} theorem mem_image2_iff (hf : Injective2 f) : f a b ∈ image2 f s t ↔ a ∈ s ∧ b ∈ t := ⟨by rintro ⟨a', ha', b', hb', h⟩ rcases hf h with ⟨rfl, rfl⟩ exact ⟨ha', hb'⟩, fun ⟨ha, hb⟩ => mem_image2_of_mem ha hb⟩ #align set.mem_image2_iff Set.mem_image2_iff theorem image2_subset (hs : s ⊆ s') (ht : t ⊆ t') : image2 f s t ⊆ image2 f s' t' := by rintro _ ⟨a, ha, b, hb, rfl⟩ exact mem_image2_of_mem (hs ha) (ht hb) #align set.image2_subset Set.image2_subset theorem image2_subset_left (ht : t ⊆ t') : image2 f s t ⊆ image2 f s t' := image2_subset Subset.rfl ht #align set.image2_subset_left Set.image2_subset_left theorem image2_subset_right (hs : s ⊆ s') : image2 f s t ⊆ image2 f s' t := image2_subset hs Subset.rfl #align set.image2_subset_right Set.image2_subset_right theorem image_subset_image2_left (hb : b ∈ t) : (fun a => f a b) '' s ⊆ image2 f s t := forall_mem_image.2 fun _ ha => mem_image2_of_mem ha hb #align set.image_subset_image2_left Set.image_subset_image2_left theorem image_subset_image2_right (ha : a ∈ s) : f a '' t ⊆ image2 f s t := forall_mem_image.2 fun _ => mem_image2_of_mem ha #align set.image_subset_image2_right Set.image_subset_image2_right theorem forall_image2_iff {p : γ → Prop} : (∀ z ∈ image2 f s t, p z) ↔ ∀ x ∈ s, ∀ y ∈ t, p (f x y) := ⟨fun h x hx y hy => h _ ⟨x, hx, y, hy, rfl⟩, fun h _ ⟨x, hx, y, hy, hz⟩ => hz ▸ h x hx y hy⟩ #align set.forall_image2_iff Set.forall_image2_iff @[simp] theorem image2_subset_iff {u : Set γ} : image2 f s t ⊆ u ↔ ∀ x ∈ s, ∀ y ∈ t, f x y ∈ u := forall_image2_iff #align set.image2_subset_iff Set.image2_subset_iff theorem image2_subset_iff_left : image2 f s t ⊆ u ↔ ∀ a ∈ s, (fun b => f a b) '' t ⊆ u := by simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage] #align set.image2_subset_iff_left Set.image2_subset_iff_left theorem image2_subset_iff_right : image2 f s t ⊆ u ↔ ∀ b ∈ t, (fun a => f a b) '' s ⊆ u := by simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage, @forall₂_swap α] #align set.image2_subset_iff_right Set.image2_subset_iff_right variable (f) -- Porting note: Removing `simp` - LHS does not simplify lemma image_prod : (fun x : α × β ↦ f x.1 x.2) '' s ×ˢ t = image2 f s t := ext fun _ ↦ by simp [and_assoc] #align set.image_prod Set.image_prod @[simp] lemma image_uncurry_prod (s : Set α) (t : Set β) : uncurry f '' s ×ˢ t = image2 f s t := image_prod _ #align set.image_uncurry_prod Set.image_uncurry_prod @[simp] lemma image2_mk_eq_prod : image2 Prod.mk s t = s ×ˢ t := ext <| by simp #align set.image2_mk_eq_prod Set.image2_mk_eq_prod -- Porting note: Removing `simp` - LHS does not simplify lemma image2_curry (f : α × β → γ) (s : Set α) (t : Set β) : image2 (fun a b ↦ f (a, b)) s t = f '' s ×ˢ t := by simp [← image_uncurry_prod, uncurry] #align set.image2_curry Set.image2_curry theorem image2_swap (s : Set α) (t : Set β) : image2 f s t = image2 (fun a b => f b a) t s := by ext constructor <;> rintro ⟨a, ha, b, hb, rfl⟩ <;> exact ⟨b, hb, a, ha, rfl⟩ #align set.image2_swap Set.image2_swap variable {f}
Mathlib/Data/Set/NAry.lean
103
104
theorem image2_union_left : image2 f (s ∪ s') t = image2 f s t ∪ image2 f s' t := by
simp_rw [← image_prod, union_prod, image_union]
import Mathlib.Algebra.Group.Equiv.Basic import Mathlib.Algebra.Group.Aut import Mathlib.Data.ZMod.Defs import Mathlib.Tactic.Ring #align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33" open MulOpposite universe u v class Shelf (α : Type u) where act : α → α → α self_distrib : ∀ {x y z : α}, act x (act y z) = act (act x y) (act x z) #align shelf Shelf class UnitalShelf (α : Type u) extends Shelf α, One α := (one_act : ∀ a : α, act 1 a = a) (act_one : ∀ a : α, act a 1 = a) #align unital_shelf UnitalShelf @[ext] structure ShelfHom (S₁ : Type*) (S₂ : Type*) [Shelf S₁] [Shelf S₂] where toFun : S₁ → S₂ map_act' : ∀ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y) #align shelf_hom ShelfHom #align shelf_hom.ext_iff ShelfHom.ext_iff #align shelf_hom.ext ShelfHom.ext class Rack (α : Type u) extends Shelf α where invAct : α → α → α left_inv : ∀ x, Function.LeftInverse (invAct x) (act x) right_inv : ∀ x, Function.RightInverse (invAct x) (act x) #align rack Rack scoped[Quandles] infixr:65 " ◃ " => Shelf.act scoped[Quandles] infixr:65 " ◃⁻¹ " => Rack.invAct scoped[Quandles] infixr:25 " →◃ " => ShelfHom open Quandles namespace Rack variable {R : Type*} [Rack R] -- Porting note: No longer a need for `Rack.self_distrib` export Shelf (self_distrib) -- porting note, changed name to `act'` to not conflict with `Shelf.act` def act' (x : R) : R ≃ R where toFun := Shelf.act x invFun := invAct x left_inv := left_inv x right_inv := right_inv x #align rack.act Rack.act' @[simp] theorem act'_apply (x y : R) : act' x y = x ◃ y := rfl #align rack.act_apply Rack.act'_apply @[simp] theorem act'_symm_apply (x y : R) : (act' x).symm y = x ◃⁻¹ y := rfl #align rack.act_symm_apply Rack.act'_symm_apply @[simp] theorem invAct_apply (x y : R) : (act' x)⁻¹ y = x ◃⁻¹ y := rfl #align rack.inv_act_apply Rack.invAct_apply @[simp] theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = y := left_inv x y #align rack.inv_act_act_eq Rack.invAct_act_eq @[simp] theorem act_invAct_eq (x y : R) : x ◃ x ◃⁻¹ y = y := right_inv x y #align rack.act_inv_act_eq Rack.act_invAct_eq theorem left_cancel (x : R) {y y' : R} : x ◃ y = x ◃ y' ↔ y = y' := by constructor · apply (act' x).injective rintro rfl rfl #align rack.left_cancel Rack.left_cancel theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by constructor · apply (act' x).symm.injective rintro rfl rfl #align rack.left_cancel_inv Rack.left_cancel_inv
Mathlib/Algebra/Quandle.lean
239
241
theorem self_distrib_inv {x y z : R} : x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z := by
rw [← left_cancel (x ◃⁻¹ y), right_inv, ← left_cancel x, right_inv, self_distrib] repeat' rw [right_inv]
import Mathlib.MeasureTheory.Measure.VectorMeasure import Mathlib.MeasureTheory.Function.AEEqOfIntegral #align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1" noncomputable section open scoped Classical MeasureTheory NNReal ENNReal variable {α β : Type*} {m : MeasurableSpace α} namespace MeasureTheory open TopologicalSpace variable {μ ν : Measure α} variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] def Measure.withDensityᵥ {m : MeasurableSpace α} (μ : Measure α) (f : α → E) : VectorMeasure α E := if hf : Integrable f μ then { measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x ∂μ else 0 empty' := by simp not_measurable' := fun s hs => if_neg hs m_iUnion' := fun s hs₁ hs₂ => by dsimp only convert hasSum_integral_iUnion hs₁ hs₂ hf.integrableOn with n · rw [if_pos (hs₁ n)] · rw [if_pos (MeasurableSet.iUnion hs₁)] } else 0 #align measure_theory.measure.with_densityᵥ MeasureTheory.Measure.withDensityᵥ open Measure variable {f g : α → E} theorem withDensityᵥ_apply (hf : Integrable f μ) {s : Set α} (hs : MeasurableSet s) : μ.withDensityᵥ f s = ∫ x in s, f x ∂μ := by rw [withDensityᵥ, dif_pos hf]; exact dif_pos hs #align measure_theory.with_densityᵥ_apply MeasureTheory.withDensityᵥ_apply @[simp] theorem withDensityᵥ_zero : μ.withDensityᵥ (0 : α → E) = 0 := by ext1 s hs; erw [withDensityᵥ_apply (integrable_zero α E μ) hs]; simp #align measure_theory.with_densityᵥ_zero MeasureTheory.withDensityᵥ_zero @[simp]
Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean
69
76
theorem withDensityᵥ_neg : μ.withDensityᵥ (-f) = -μ.withDensityᵥ f := by
by_cases hf : Integrable f μ · ext1 i hi rw [VectorMeasure.neg_apply, withDensityᵥ_apply hf hi, ← integral_neg, withDensityᵥ_apply hf.neg hi] rfl · rw [withDensityᵥ, withDensityᵥ, dif_neg hf, dif_neg, neg_zero] rwa [integrable_neg_iff]
import Mathlib.NumberTheory.NumberField.Basic import Mathlib.RingTheory.Localization.NormTrace #align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" open scoped NumberField open Finset NumberField Algebra FiniteDimensional namespace RingOfIntegers variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L] noncomputable def norm [IsSeparable K L] : 𝓞 L →* 𝓞 K := RingOfIntegers.restrict_monoidHom ((Algebra.norm K).comp (algebraMap (𝓞 L) L : (𝓞 L) →* L)) fun x => isIntegral_norm K x.2 #align ring_of_integers.norm RingOfIntegers.norm @[simp] lemma coe_norm [IsSeparable K L] (x : 𝓞 L) : norm K x = Algebra.norm K (x : L) := rfl theorem coe_algebraMap_norm [IsSeparable K L] (x : 𝓞 L) : (algebraMap (𝓞 K) (𝓞 L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) := rfl #align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : algebraMap _ K (norm K (algebraMap (𝓞 K) (𝓞 L) x)) = Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl #align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap theorem norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : norm K (algebraMap (𝓞 K) (𝓞 L) x) = x ^ finrank K L := by rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap, RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap, RingOfIntegers.coe_eq_algebraMap, map_pow] #align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
Mathlib/NumberTheory/NumberField/Norm.lean
72
85
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : 𝓞 L} : IsUnit (norm K x) ↔ IsUnit x := by
classical refine ⟨fun hx => ?_, IsUnit.map _⟩ replace hx : IsUnit (algebraMap (𝓞 K) (𝓞 L) <| norm K x) := hx.map (algebraMap (𝓞 K) <| 𝓞 L) refine @isUnit_of_mul_isUnit_right (𝓞 L) _ ⟨(univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x, prod_mem fun σ _ => x.2.map (σ : L →+* L).toIntAlgHom⟩ _ ?_ convert hx using 1 ext convert_to ((univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x) * ∏ σ ∈ {(AlgEquiv.refl : L ≃ₐ[K] L)}, σ x = _ · rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul, RingOfIntegers.map_mk] · rw [prod_sdiff <| subset_univ _, ← norm_eq_prod_automorphisms, coe_algebraMap_norm]
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.Group.Indicator import Mathlib.Order.LiminfLimsup import Mathlib.Order.Filter.Archimedean import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Data.Set.Lattice import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.liminf_limsup from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451" open Filter TopologicalSpace open scoped Topology Classical universe u v variable {ι α β R S : Type*} {π : ι → Type*} class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) #align bounded_le_nhds_class BoundedLENhdsClass class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) #align bounded_ge_nhds_class BoundedGENhdsClass section Preorder variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β] section LiminfLimsup section Indicator theorem limsup_eq_tendsto_sum_indicator_nat_atTop (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω) atTop atTop } := by ext ω simp only [limsup_eq_iInf_iSup_of_nat, ge_iff_le, Set.iSup_eq_iUnion, Set.iInf_eq_iInter, Set.mem_iInter, Set.mem_iUnion, exists_prop] constructor · intro hω refine tendsto_atTop_atTop_of_monotone' (fun n m hnm ↦ Finset.sum_mono_set_of_nonneg (fun i ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) (Finset.range_mono hnm)) ?_ rintro ⟨i, h⟩ simp only [mem_upperBounds, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff] at h induction' i with k hk · obtain ⟨j, hj₁, hj₂⟩ := hω 1 refine not_lt.2 (h <| j + 1) (lt_of_le_of_lt (Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.range (j + 1), 0).le ?_) refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_range.2 (lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self), ?_⟩ rw [Nat.sub_add_cancel hj₁, Set.indicator_of_mem hj₂] exact zero_lt_one · rw [imp_false] at hk push_neg at hk obtain ⟨i, hi⟩ := hk obtain ⟨j, hj₁, hj₂⟩ := hω (i + 1) replace hi : (∑ k ∈ Finset.range i, (s (k + 1)).indicator 1 ω) = k + 1 := le_antisymm (h i) hi refine not_lt.2 (h <| j + 1) ?_ rw [← Finset.sum_range_add_sum_Ico _ (i.le_succ.trans (hj₁.trans j.le_succ)), hi] refine lt_add_of_pos_right _ ?_ rw [(Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.Ico i (j + 1), 0)] refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_Ico.2 ⟨(Nat.le_sub_iff_add_le (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁)).2 hj₁, lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self⟩, ?_⟩ rw [Nat.sub_add_cancel (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁), Set.indicator_of_mem hj₂] exact zero_lt_one · rintro hω i rw [Set.mem_setOf_eq, tendsto_atTop_atTop] at hω by_contra! hcon obtain ⟨j, h⟩ := hω (i + 1) have : (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by have hle : ∀ j ≤ i, (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by refine fun j hij ↦ (Finset.sum_le_card_nsmul _ _ _ ?_ : _ ≤ (Finset.range j).card • 1).trans ?_ · exact fun m _ ↦ Set.indicator_apply_le' (fun _ ↦ le_rfl) fun _ ↦ zero_le_one · simpa only [Finset.card_range, smul_eq_mul, mul_one] by_cases hij : j < i · exact hle _ hij.le · rw [← Finset.sum_range_add_sum_Ico _ (not_lt.1 hij)] suffices (∑ k ∈ Finset.Ico i j, (s (k + 1)).indicator 1 ω) = 0 by rw [this, add_zero] exact hle _ le_rfl refine Finset.sum_eq_zero fun m hm ↦ ?_ exact Set.indicator_of_not_mem (hcon _ <| (Finset.mem_Ico.1 hm).1.trans m.le_succ) _ exact not_le.2 (lt_of_lt_of_le i.lt_succ_self <| h _ le_rfl) this #align limsup_eq_tendsto_sum_indicator_nat_at_top limsup_eq_tendsto_sum_indicator_nat_atTop
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean
568
578
theorem limsup_eq_tendsto_sum_indicator_atTop (R : Type*) [StrictOrderedSemiring R] [Archimedean R] (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) atTop atTop } := by
rw [limsup_eq_tendsto_sum_indicator_nat_atTop s] ext ω simp only [Set.mem_setOf_eq] rw [(_ : (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) = fun n ↦ ↑(∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω))] · exact tendsto_natCast_atTop_iff.symm · ext n simp only [Set.indicator, Pi.one_apply, Finset.sum_boole, Nat.cast_id]
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.MeasureTheory.Group.Pointwise import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Basic import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric #align_import measure_theory.measure.lebesgue.eq_haar from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral open TopologicalSpace Set Filter Metric Bornology open scoped ENNReal Pointwise Topology NNReal def TopologicalSpace.PositiveCompacts.Icc01 : PositiveCompacts ℝ where carrier := Icc 0 1 isCompact' := isCompact_Icc interior_nonempty' := by simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one] #align topological_space.positive_compacts.Icc01 TopologicalSpace.PositiveCompacts.Icc01 universe u def TopologicalSpace.PositiveCompacts.piIcc01 (ι : Type*) [Finite ι] : PositiveCompacts (ι → ℝ) where carrier := pi univ fun _ => Icc 0 1 isCompact' := isCompact_univ_pi fun _ => isCompact_Icc interior_nonempty' := by simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo, imp_true_iff, zero_lt_one] #align topological_space.positive_compacts.pi_Icc01 TopologicalSpace.PositiveCompacts.piIcc01 theorem Basis.parallelepiped_basisFun (ι : Type*) [Fintype ι] : (Pi.basisFun ℝ ι).parallelepiped = TopologicalSpace.PositiveCompacts.piIcc01 ι := SetLike.coe_injective <| by refine Eq.trans ?_ ((uIcc_of_le ?_).trans (Set.pi_univ_Icc _ _).symm) · classical convert parallelepiped_single (ι := ι) 1 · exact zero_le_one #align basis.parallelepiped_basis_fun Basis.parallelepiped_basisFun theorem Basis.parallelepiped_eq_map {ι E : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] (b : Basis ι ℝ E) : b.parallelepiped = (PositiveCompacts.piIcc01 ι).map b.equivFun.symm b.equivFunL.symm.continuous b.equivFunL.symm.isOpenMap := by classical rw [← Basis.parallelepiped_basisFun, ← Basis.parallelepiped_map] congr with x simp open MeasureTheory MeasureTheory.Measure theorem Basis.map_addHaar {ι E F : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedSpace ℝ E] [NormedSpace ℝ F] [MeasurableSpace E] [MeasurableSpace F] [BorelSpace E] [BorelSpace F] [SecondCountableTopology F] [SigmaCompactSpace F] (b : Basis ι ℝ E) (f : E ≃L[ℝ] F) : map f b.addHaar = (b.map f.toLinearEquiv).addHaar := by have : IsAddHaarMeasure (map f b.addHaar) := AddEquiv.isAddHaarMeasure_map b.addHaar f.toAddEquiv f.continuous f.symm.continuous rw [eq_comm, Basis.addHaar_eq_iff, Measure.map_apply f.continuous.measurable (PositiveCompacts.isCompact _).measurableSet, Basis.coe_parallelepiped, Basis.coe_map] erw [← image_parallelepiped, f.toEquiv.preimage_image, addHaar_self] namespace MeasureTheory open Measure TopologicalSpace.PositiveCompacts FiniteDimensional theorem addHaarMeasure_eq_volume : addHaarMeasure Icc01 = volume := by convert (addHaarMeasure_unique volume Icc01).symm; simp [Icc01] #align measure_theory.add_haar_measure_eq_volume MeasureTheory.addHaarMeasure_eq_volume theorem addHaarMeasure_eq_volume_pi (ι : Type*) [Fintype ι] : addHaarMeasure (piIcc01 ι) = volume := by convert (addHaarMeasure_unique volume (piIcc01 ι)).symm simp only [piIcc01, volume_pi_pi fun _ => Icc (0 : ℝ) 1, PositiveCompacts.coe_mk, Compacts.coe_mk, Finset.prod_const_one, ENNReal.ofReal_one, Real.volume_Icc, one_smul, sub_zero] #align measure_theory.add_haar_measure_eq_volume_pi MeasureTheory.addHaarMeasure_eq_volume_pi -- Porting note (#11215): TODO: remove this instance? instance isAddHaarMeasure_volume_pi (ι : Type*) [Fintype ι] : IsAddHaarMeasure (volume : Measure (ι → ℝ)) := inferInstance #align measure_theory.is_add_haar_measure_volume_pi MeasureTheory.isAddHaarMeasure_volume_pi namespace Measure
Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean
142
155
theorem addHaar_eq_zero_of_disjoint_translates_aux {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {s : Set E} (u : ℕ → E) (sb : IsBounded s) (hu : IsBounded (range u)) (hs : Pairwise (Disjoint on fun n => {u n} + s)) (h's : MeasurableSet s) : μ s = 0 := by
by_contra h apply lt_irrefl ∞ calc ∞ = ∑' _ : ℕ, μ s := (ENNReal.tsum_const_eq_top_of_ne_zero h).symm _ = ∑' n : ℕ, μ ({u n} + s) := by congr 1; ext1 n; simp only [image_add_left, measure_preimage_add, singleton_add] _ = μ (⋃ n, {u n} + s) := Eq.symm <| measure_iUnion hs fun n => by simpa only [image_add_left, singleton_add] using measurable_id.const_add _ h's _ = μ (range u + s) := by rw [← iUnion_add, iUnion_singleton_eq_range] _ < ∞ := (hu.add sb).measure_lt_top
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Analysis.NormedSpace.Real #align_import analysis.special_functions.log.basic from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def log (x : ℝ) : ℝ := if hx : x = 0 then 0 else expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ #align real.log Real.log theorem log_of_ne_zero (hx : x ≠ 0) : log x = expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ := dif_neg hx #align real.log_of_ne_zero Real.log_of_ne_zero theorem log_of_pos (hx : 0 < x) : log x = expOrderIso.symm ⟨x, hx⟩ := by rw [log_of_ne_zero hx.ne'] congr exact abs_of_pos hx #align real.log_of_pos Real.log_of_pos theorem exp_log_eq_abs (hx : x ≠ 0) : exp (log x) = |x| := by rw [log_of_ne_zero hx, ← coe_expOrderIso_apply, OrderIso.apply_symm_apply, Subtype.coe_mk] #align real.exp_log_eq_abs Real.exp_log_eq_abs theorem exp_log (hx : 0 < x) : exp (log x) = x := by rw [exp_log_eq_abs hx.ne'] exact abs_of_pos hx #align real.exp_log Real.exp_log theorem exp_log_of_neg (hx : x < 0) : exp (log x) = -x := by rw [exp_log_eq_abs (ne_of_lt hx)] exact abs_of_neg hx #align real.exp_log_of_neg Real.exp_log_of_neg theorem le_exp_log (x : ℝ) : x ≤ exp (log x) := by by_cases h_zero : x = 0 · rw [h_zero, log, dif_pos rfl, exp_zero] exact zero_le_one · rw [exp_log_eq_abs h_zero] exact le_abs_self _ #align real.le_exp_log Real.le_exp_log @[simp] theorem log_exp (x : ℝ) : log (exp x) = x := exp_injective <| exp_log (exp_pos x) #align real.log_exp Real.log_exp theorem surjOn_log : SurjOn log (Ioi 0) univ := fun x _ => ⟨exp x, exp_pos x, log_exp x⟩ #align real.surj_on_log Real.surjOn_log theorem log_surjective : Surjective log := fun x => ⟨exp x, log_exp x⟩ #align real.log_surjective Real.log_surjective @[simp] theorem range_log : range log = univ := log_surjective.range_eq #align real.range_log Real.range_log @[simp] theorem log_zero : log 0 = 0 := dif_pos rfl #align real.log_zero Real.log_zero @[simp] theorem log_one : log 1 = 0 := exp_injective <| by rw [exp_log zero_lt_one, exp_zero] #align real.log_one Real.log_one @[simp] theorem log_abs (x : ℝ) : log |x| = log x := by by_cases h : x = 0 · simp [h] · rw [← exp_eq_exp, exp_log_eq_abs h, exp_log_eq_abs (abs_pos.2 h).ne', abs_abs] #align real.log_abs Real.log_abs @[simp] theorem log_neg_eq_log (x : ℝ) : log (-x) = log x := by rw [← log_abs x, ← log_abs (-x), abs_neg] #align real.log_neg_eq_log Real.log_neg_eq_log theorem sinh_log {x : ℝ} (hx : 0 < x) : sinh (log x) = (x - x⁻¹) / 2 := by rw [sinh_eq, exp_neg, exp_log hx] #align real.sinh_log Real.sinh_log theorem cosh_log {x : ℝ} (hx : 0 < x) : cosh (log x) = (x + x⁻¹) / 2 := by rw [cosh_eq, exp_neg, exp_log hx] #align real.cosh_log Real.cosh_log theorem surjOn_log' : SurjOn log (Iio 0) univ := fun x _ => ⟨-exp x, neg_lt_zero.2 <| exp_pos x, by rw [log_neg_eq_log, log_exp]⟩ #align real.surj_on_log' Real.surjOn_log' theorem log_mul (hx : x ≠ 0) (hy : y ≠ 0) : log (x * y) = log x + log y := exp_injective <| by rw [exp_log_eq_abs (mul_ne_zero hx hy), exp_add, exp_log_eq_abs hx, exp_log_eq_abs hy, abs_mul] #align real.log_mul Real.log_mul theorem log_div (hx : x ≠ 0) (hy : y ≠ 0) : log (x / y) = log x - log y := exp_injective <| by rw [exp_log_eq_abs (div_ne_zero hx hy), exp_sub, exp_log_eq_abs hx, exp_log_eq_abs hy, abs_div] #align real.log_div Real.log_div @[simp] theorem log_inv (x : ℝ) : log x⁻¹ = -log x := by by_cases hx : x = 0; · simp [hx] rw [← exp_eq_exp, exp_log_eq_abs (inv_ne_zero hx), exp_neg, exp_log_eq_abs hx, abs_inv] #align real.log_inv Real.log_inv theorem log_le_log_iff (h : 0 < x) (h₁ : 0 < y) : log x ≤ log y ↔ x ≤ y := by rw [← exp_le_exp, exp_log h, exp_log h₁] #align real.log_le_log Real.log_le_log_iff @[gcongr] lemma log_le_log (hx : 0 < x) (hxy : x ≤ y) : log x ≤ log y := (log_le_log_iff hx (hx.trans_le hxy)).2 hxy @[gcongr] theorem log_lt_log (hx : 0 < x) (h : x < y) : log x < log y := by rwa [← exp_lt_exp, exp_log hx, exp_log (lt_trans hx h)] #align real.log_lt_log Real.log_lt_log theorem log_lt_log_iff (hx : 0 < x) (hy : 0 < y) : log x < log y ↔ x < y := by rw [← exp_lt_exp, exp_log hx, exp_log hy] #align real.log_lt_log_iff Real.log_lt_log_iff theorem log_le_iff_le_exp (hx : 0 < x) : log x ≤ y ↔ x ≤ exp y := by rw [← exp_le_exp, exp_log hx] #align real.log_le_iff_le_exp Real.log_le_iff_le_exp theorem log_lt_iff_lt_exp (hx : 0 < x) : log x < y ↔ x < exp y := by rw [← exp_lt_exp, exp_log hx] #align real.log_lt_iff_lt_exp Real.log_lt_iff_lt_exp theorem le_log_iff_exp_le (hy : 0 < y) : x ≤ log y ↔ exp x ≤ y := by rw [← exp_le_exp, exp_log hy] #align real.le_log_iff_exp_le Real.le_log_iff_exp_le theorem lt_log_iff_exp_lt (hy : 0 < y) : x < log y ↔ exp x < y := by rw [← exp_lt_exp, exp_log hy] #align real.lt_log_iff_exp_lt Real.lt_log_iff_exp_lt theorem log_pos_iff (hx : 0 < x) : 0 < log x ↔ 1 < x := by rw [← log_one] exact log_lt_log_iff zero_lt_one hx #align real.log_pos_iff Real.log_pos_iff theorem log_pos (hx : 1 < x) : 0 < log x := (log_pos_iff (lt_trans zero_lt_one hx)).2 hx #align real.log_pos Real.log_pos theorem log_pos_of_lt_neg_one (hx : x < -1) : 0 < log x := by rw [← neg_neg x, log_neg_eq_log] have : 1 < -x := by linarith exact log_pos this theorem log_neg_iff (h : 0 < x) : log x < 0 ↔ x < 1 := by rw [← log_one] exact log_lt_log_iff h zero_lt_one #align real.log_neg_iff Real.log_neg_iff theorem log_neg (h0 : 0 < x) (h1 : x < 1) : log x < 0 := (log_neg_iff h0).2 h1 #align real.log_neg Real.log_neg theorem log_neg_of_lt_zero (h0 : x < 0) (h1 : -1 < x) : log x < 0 := by rw [← neg_neg x, log_neg_eq_log] have h0' : 0 < -x := by linarith have h1' : -x < 1 := by linarith exact log_neg h0' h1' theorem log_nonneg_iff (hx : 0 < x) : 0 ≤ log x ↔ 1 ≤ x := by rw [← not_lt, log_neg_iff hx, not_lt] #align real.log_nonneg_iff Real.log_nonneg_iff theorem log_nonneg (hx : 1 ≤ x) : 0 ≤ log x := (log_nonneg_iff (zero_lt_one.trans_le hx)).2 hx #align real.log_nonneg Real.log_nonneg
Mathlib/Analysis/SpecialFunctions/Log/Basic.lean
207
207
theorem log_nonpos_iff (hx : 0 < x) : log x ≤ 0 ↔ x ≤ 1 := by
rw [← not_lt, log_pos_iff hx, not_lt]
import Mathlib.Analysis.Calculus.Deriv.ZPow import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.SpecialFunctions.Log.Deriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv import Mathlib.Analysis.Convex.Deriv #align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39" open Real Set open scoped NNReal theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _) rw [deriv_pow', interior_Ici] exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left (pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity) #align strict_convex_on_pow strictConvexOn_pow theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) : StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n) rw [deriv_pow'] replace h := Nat.pos_of_ne_zero h exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl) (Nat.cast_pos.2 h) #align even.strict_convex_on_pow Even.strictConvexOn_pow theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β} [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) : 0 ≤ ∏ x ∈ s, f x := calc 0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x := Finset.prod_nonneg fun x _ => by split_ifs with hx · simp [hx] simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢ exact le_of_lt hx _ = _ := by rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one, Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul] #align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k ∈ Finset.range n, (m - k) := by rcases hn with ⟨n, rfl⟩ induction' n with n ihn · simp rw [← two_mul] at ihn rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc, Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc] refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k rcases le_or_lt m k with hmk | hmk · have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _ convert sub_nonpos_of_le this · exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk) #align int_prod_range_nonneg int_prod_range_nonneg theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) : 0 < ∏ k ∈ Finset.range n, (m - k) := by refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_ rw [eq_comm, Finset.prod_eq_zero_iff] at h obtain ⟨a, ha, h⟩ := h rw [sub_eq_zero.1 h] exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩ #align int_prod_range_pos int_prod_range_pos theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) : StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0) · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx intro x hx rw [mem_Ioi] at hx rw [iter_deriv_zpow] refine mul_pos ?_ (zpow_pos_of_pos hx _) norm_cast refine int_prod_range_pos (by decide) fun hm => ?_ rw [← Finset.coe_Ico] at hm norm_cast at hm fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc` #align strict_convex_on_zpow strictConvexOn_zpow section SqrtMulLog
Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean
115
119
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) : HasDerivAt (fun x => √x * log x) ((2 + log x) / (2 * √x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1 rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm, one_div, one_div, ← div_eq_inv_mul]
import Mathlib.Topology.Separation import Mathlib.Topology.UniformSpace.Basic import Mathlib.Topology.UniformSpace.Cauchy #align_import topology.uniform_space.uniform_convergence from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9" noncomputable section open Topology Uniformity Filter Set universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {ι : Type x} [UniformSpace β] variable {F : ι → α → β} {f : α → β} {s s' : Set α} {x : α} {p : Filter ι} {p' : Filter α} {g : ι → α} def TendstoUniformlyOnFilter (F : ι → α → β) (f : α → β) (p : Filter ι) (p' : Filter α) := ∀ u ∈ 𝓤 β, ∀ᶠ n : ι × α in p ×ˢ p', (f n.snd, F n.fst n.snd) ∈ u #align tendsto_uniformly_on_filter TendstoUniformlyOnFilter theorem tendstoUniformlyOnFilter_iff_tendsto : TendstoUniformlyOnFilter F f p p' ↔ Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ p') (𝓤 β) := Iff.rfl #align tendsto_uniformly_on_filter_iff_tendsto tendstoUniformlyOnFilter_iff_tendsto def TendstoUniformlyOn (F : ι → α → β) (f : α → β) (p : Filter ι) (s : Set α) := ∀ u ∈ 𝓤 β, ∀ᶠ n in p, ∀ x : α, x ∈ s → (f x, F n x) ∈ u #align tendsto_uniformly_on TendstoUniformlyOn theorem tendstoUniformlyOn_iff_tendstoUniformlyOnFilter : TendstoUniformlyOn F f p s ↔ TendstoUniformlyOnFilter F f p (𝓟 s) := by simp only [TendstoUniformlyOn, TendstoUniformlyOnFilter] apply forall₂_congr simp_rw [eventually_prod_principal_iff] simp #align tendsto_uniformly_on_iff_tendsto_uniformly_on_filter tendstoUniformlyOn_iff_tendstoUniformlyOnFilter alias ⟨TendstoUniformlyOn.tendstoUniformlyOnFilter, TendstoUniformlyOnFilter.tendstoUniformlyOn⟩ := tendstoUniformlyOn_iff_tendstoUniformlyOnFilter #align tendsto_uniformly_on.tendsto_uniformly_on_filter TendstoUniformlyOn.tendstoUniformlyOnFilter #align tendsto_uniformly_on_filter.tendsto_uniformly_on TendstoUniformlyOnFilter.tendstoUniformlyOn theorem tendstoUniformlyOn_iff_tendsto {F : ι → α → β} {f : α → β} {p : Filter ι} {s : Set α} : TendstoUniformlyOn F f p s ↔ Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ 𝓟 s) (𝓤 β) := by simp [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto] #align tendsto_uniformly_on_iff_tendsto tendstoUniformlyOn_iff_tendsto def TendstoUniformly (F : ι → α → β) (f : α → β) (p : Filter ι) := ∀ u ∈ 𝓤 β, ∀ᶠ n in p, ∀ x : α, (f x, F n x) ∈ u #align tendsto_uniformly TendstoUniformly -- Porting note: moved from below theorem tendstoUniformlyOn_univ : TendstoUniformlyOn F f p univ ↔ TendstoUniformly F f p := by simp [TendstoUniformlyOn, TendstoUniformly] #align tendsto_uniformly_on_univ tendstoUniformlyOn_univ theorem tendstoUniformly_iff_tendstoUniformlyOnFilter : TendstoUniformly F f p ↔ TendstoUniformlyOnFilter F f p ⊤ := by rw [← tendstoUniformlyOn_univ, tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, principal_univ] #align tendsto_uniformly_iff_tendsto_uniformly_on_filter tendstoUniformly_iff_tendstoUniformlyOnFilter theorem TendstoUniformly.tendstoUniformlyOnFilter (h : TendstoUniformly F f p) : TendstoUniformlyOnFilter F f p ⊤ := by rwa [← tendstoUniformly_iff_tendstoUniformlyOnFilter] #align tendsto_uniformly.tendsto_uniformly_on_filter TendstoUniformly.tendstoUniformlyOnFilter theorem tendstoUniformlyOn_iff_tendstoUniformly_comp_coe : TendstoUniformlyOn F f p s ↔ TendstoUniformly (fun i (x : s) => F i x) (f ∘ (↑)) p := forall₂_congr fun u _ => by simp #align tendsto_uniformly_on_iff_tendsto_uniformly_comp_coe tendstoUniformlyOn_iff_tendstoUniformly_comp_coe theorem tendstoUniformly_iff_tendsto {F : ι → α → β} {f : α → β} {p : Filter ι} : TendstoUniformly F f p ↔ Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ ⊤) (𝓤 β) := by simp [tendstoUniformly_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto] #align tendsto_uniformly_iff_tendsto tendstoUniformly_iff_tendsto theorem TendstoUniformlyOnFilter.tendsto_at (h : TendstoUniformlyOnFilter F f p p') (hx : 𝓟 {x} ≤ p') : Tendsto (fun n => F n x) p <| 𝓝 (f x) := by refine Uniform.tendsto_nhds_right.mpr fun u hu => mem_map.mpr ?_ filter_upwards [(h u hu).curry] intro i h simpa using h.filter_mono hx #align tendsto_uniformly_on_filter.tendsto_at TendstoUniformlyOnFilter.tendsto_at theorem TendstoUniformlyOn.tendsto_at (h : TendstoUniformlyOn F f p s) {x : α} (hx : x ∈ s) : Tendsto (fun n => F n x) p <| 𝓝 (f x) := h.tendstoUniformlyOnFilter.tendsto_at (le_principal_iff.mpr <| mem_principal.mpr <| singleton_subset_iff.mpr <| hx) #align tendsto_uniformly_on.tendsto_at TendstoUniformlyOn.tendsto_at theorem TendstoUniformly.tendsto_at (h : TendstoUniformly F f p) (x : α) : Tendsto (fun n => F n x) p <| 𝓝 (f x) := h.tendstoUniformlyOnFilter.tendsto_at le_top #align tendsto_uniformly.tendsto_at TendstoUniformly.tendsto_at -- Porting note: tendstoUniformlyOn_univ moved up theorem TendstoUniformlyOnFilter.mono_left {p'' : Filter ι} (h : TendstoUniformlyOnFilter F f p p') (hp : p'' ≤ p) : TendstoUniformlyOnFilter F f p'' p' := fun u hu => (h u hu).filter_mono (p'.prod_mono_left hp) #align tendsto_uniformly_on_filter.mono_left TendstoUniformlyOnFilter.mono_left theorem TendstoUniformlyOnFilter.mono_right {p'' : Filter α} (h : TendstoUniformlyOnFilter F f p p') (hp : p'' ≤ p') : TendstoUniformlyOnFilter F f p p'' := fun u hu => (h u hu).filter_mono (p.prod_mono_right hp) #align tendsto_uniformly_on_filter.mono_right TendstoUniformlyOnFilter.mono_right theorem TendstoUniformlyOn.mono {s' : Set α} (h : TendstoUniformlyOn F f p s) (h' : s' ⊆ s) : TendstoUniformlyOn F f p s' := tendstoUniformlyOn_iff_tendstoUniformlyOnFilter.mpr (h.tendstoUniformlyOnFilter.mono_right (le_principal_iff.mpr <| mem_principal.mpr h')) #align tendsto_uniformly_on.mono TendstoUniformlyOn.mono theorem TendstoUniformlyOnFilter.congr {F' : ι → α → β} (hf : TendstoUniformlyOnFilter F f p p') (hff' : ∀ᶠ n : ι × α in p ×ˢ p', F n.fst n.snd = F' n.fst n.snd) : TendstoUniformlyOnFilter F' f p p' := by refine fun u hu => ((hf u hu).and hff').mono fun n h => ?_ rw [← h.right] exact h.left #align tendsto_uniformly_on_filter.congr TendstoUniformlyOnFilter.congr theorem TendstoUniformlyOn.congr {F' : ι → α → β} (hf : TendstoUniformlyOn F f p s) (hff' : ∀ᶠ n in p, Set.EqOn (F n) (F' n) s) : TendstoUniformlyOn F' f p s := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] at hf ⊢ refine hf.congr ?_ rw [eventually_iff] at hff' ⊢ simp only [Set.EqOn] at hff' simp only [mem_prod_principal, hff', mem_setOf_eq] #align tendsto_uniformly_on.congr TendstoUniformlyOn.congr theorem TendstoUniformlyOn.congr_right {g : α → β} (hf : TendstoUniformlyOn F f p s) (hfg : EqOn f g s) : TendstoUniformlyOn F g p s := fun u hu => by filter_upwards [hf u hu] with i hi a ha using hfg ha ▸ hi a ha #align tendsto_uniformly_on.congr_right TendstoUniformlyOn.congr_right protected theorem TendstoUniformly.tendstoUniformlyOn (h : TendstoUniformly F f p) : TendstoUniformlyOn F f p s := (tendstoUniformlyOn_univ.2 h).mono (subset_univ s) #align tendsto_uniformly.tendsto_uniformly_on TendstoUniformly.tendstoUniformlyOn theorem TendstoUniformlyOnFilter.comp (h : TendstoUniformlyOnFilter F f p p') (g : γ → α) : TendstoUniformlyOnFilter (fun n => F n ∘ g) (f ∘ g) p (p'.comap g) := by rw [tendstoUniformlyOnFilter_iff_tendsto] at h ⊢ exact h.comp (tendsto_id.prod_map tendsto_comap) #align tendsto_uniformly_on_filter.comp TendstoUniformlyOnFilter.comp theorem TendstoUniformlyOn.comp (h : TendstoUniformlyOn F f p s) (g : γ → α) : TendstoUniformlyOn (fun n => F n ∘ g) (f ∘ g) p (g ⁻¹' s) := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] at h ⊢ simpa [TendstoUniformlyOn, comap_principal] using TendstoUniformlyOnFilter.comp h g #align tendsto_uniformly_on.comp TendstoUniformlyOn.comp theorem TendstoUniformly.comp (h : TendstoUniformly F f p) (g : γ → α) : TendstoUniformly (fun n => F n ∘ g) (f ∘ g) p := by rw [tendstoUniformly_iff_tendstoUniformlyOnFilter] at h ⊢ simpa [principal_univ, comap_principal] using h.comp g #align tendsto_uniformly.comp TendstoUniformly.comp theorem UniformContinuous.comp_tendstoUniformlyOnFilter [UniformSpace γ] {g : β → γ} (hg : UniformContinuous g) (h : TendstoUniformlyOnFilter F f p p') : TendstoUniformlyOnFilter (fun i => g ∘ F i) (g ∘ f) p p' := fun _u hu => h _ (hg hu) #align uniform_continuous.comp_tendsto_uniformly_on_filter UniformContinuous.comp_tendstoUniformlyOnFilter theorem UniformContinuous.comp_tendstoUniformlyOn [UniformSpace γ] {g : β → γ} (hg : UniformContinuous g) (h : TendstoUniformlyOn F f p s) : TendstoUniformlyOn (fun i => g ∘ F i) (g ∘ f) p s := fun _u hu => h _ (hg hu) #align uniform_continuous.comp_tendsto_uniformly_on UniformContinuous.comp_tendstoUniformlyOn theorem UniformContinuous.comp_tendstoUniformly [UniformSpace γ] {g : β → γ} (hg : UniformContinuous g) (h : TendstoUniformly F f p) : TendstoUniformly (fun i => g ∘ F i) (g ∘ f) p := fun _u hu => h _ (hg hu) #align uniform_continuous.comp_tendsto_uniformly UniformContinuous.comp_tendstoUniformly theorem TendstoUniformlyOnFilter.prod_map {ι' α' β' : Type*} [UniformSpace β'] {F' : ι' → α' → β'} {f' : α' → β'} {q : Filter ι'} {q' : Filter α'} (h : TendstoUniformlyOnFilter F f p p') (h' : TendstoUniformlyOnFilter F' f' q q') : TendstoUniformlyOnFilter (fun i : ι × ι' => Prod.map (F i.1) (F' i.2)) (Prod.map f f') (p ×ˢ q) (p' ×ˢ q') := by rw [tendstoUniformlyOnFilter_iff_tendsto] at h h' ⊢ rw [uniformity_prod_eq_comap_prod, tendsto_comap_iff, ← map_swap4_prod, tendsto_map'_iff] convert h.prod_map h' -- seems to be faster than `exact` here #align tendsto_uniformly_on_filter.prod_map TendstoUniformlyOnFilter.prod_map theorem TendstoUniformlyOn.prod_map {ι' α' β' : Type*} [UniformSpace β'] {F' : ι' → α' → β'} {f' : α' → β'} {p' : Filter ι'} {s' : Set α'} (h : TendstoUniformlyOn F f p s) (h' : TendstoUniformlyOn F' f' p' s') : TendstoUniformlyOn (fun i : ι × ι' => Prod.map (F i.1) (F' i.2)) (Prod.map f f') (p ×ˢ p') (s ×ˢ s') := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] at h h' ⊢ simpa only [prod_principal_principal] using h.prod_map h' #align tendsto_uniformly_on.prod_map TendstoUniformlyOn.prod_map theorem TendstoUniformly.prod_map {ι' α' β' : Type*} [UniformSpace β'] {F' : ι' → α' → β'} {f' : α' → β'} {p' : Filter ι'} (h : TendstoUniformly F f p) (h' : TendstoUniformly F' f' p') : TendstoUniformly (fun i : ι × ι' => Prod.map (F i.1) (F' i.2)) (Prod.map f f') (p ×ˢ p') := by rw [← tendstoUniformlyOn_univ, ← univ_prod_univ] at * exact h.prod_map h' #align tendsto_uniformly.prod_map TendstoUniformly.prod_map theorem TendstoUniformlyOnFilter.prod {ι' β' : Type*} [UniformSpace β'] {F' : ι' → α → β'} {f' : α → β'} {q : Filter ι'} (h : TendstoUniformlyOnFilter F f p p') (h' : TendstoUniformlyOnFilter F' f' q p') : TendstoUniformlyOnFilter (fun (i : ι × ι') a => (F i.1 a, F' i.2 a)) (fun a => (f a, f' a)) (p ×ˢ q) p' := fun u hu => ((h.prod_map h') u hu).diag_of_prod_right #align tendsto_uniformly_on_filter.prod TendstoUniformlyOnFilter.prod theorem TendstoUniformlyOn.prod {ι' β' : Type*} [UniformSpace β'] {F' : ι' → α → β'} {f' : α → β'} {p' : Filter ι'} (h : TendstoUniformlyOn F f p s) (h' : TendstoUniformlyOn F' f' p' s) : TendstoUniformlyOn (fun (i : ι × ι') a => (F i.1 a, F' i.2 a)) (fun a => (f a, f' a)) (p.prod p') s := (congr_arg _ s.inter_self).mp ((h.prod_map h').comp fun a => (a, a)) #align tendsto_uniformly_on.prod TendstoUniformlyOn.prod theorem TendstoUniformly.prod {ι' β' : Type*} [UniformSpace β'] {F' : ι' → α → β'} {f' : α → β'} {p' : Filter ι'} (h : TendstoUniformly F f p) (h' : TendstoUniformly F' f' p') : TendstoUniformly (fun (i : ι × ι') a => (F i.1 a, F' i.2 a)) (fun a => (f a, f' a)) (p ×ˢ p') := (h.prod_map h').comp fun a => (a, a) #align tendsto_uniformly.prod TendstoUniformly.prod theorem tendsto_prod_filter_iff {c : β} : Tendsto (↿F) (p ×ˢ p') (𝓝 c) ↔ TendstoUniformlyOnFilter F (fun _ => c) p p' := by simp_rw [nhds_eq_comap_uniformity, tendsto_comap_iff] rfl #align tendsto_prod_filter_iff tendsto_prod_filter_iff theorem tendsto_prod_principal_iff {c : β} : Tendsto (↿F) (p ×ˢ 𝓟 s) (𝓝 c) ↔ TendstoUniformlyOn F (fun _ => c) p s := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] exact tendsto_prod_filter_iff #align tendsto_prod_principal_iff tendsto_prod_principal_iff theorem tendsto_prod_top_iff {c : β} : Tendsto (↿F) (p ×ˢ ⊤) (𝓝 c) ↔ TendstoUniformly F (fun _ => c) p := by rw [tendstoUniformly_iff_tendstoUniformlyOnFilter] exact tendsto_prod_filter_iff #align tendsto_prod_top_iff tendsto_prod_top_iff theorem tendstoUniformlyOn_empty : TendstoUniformlyOn F f p ∅ := fun u _ => by simp #align tendsto_uniformly_on_empty tendstoUniformlyOn_empty theorem tendstoUniformlyOn_singleton_iff_tendsto : TendstoUniformlyOn F f p {x} ↔ Tendsto (fun n : ι => F n x) p (𝓝 (f x)) := by simp_rw [tendstoUniformlyOn_iff_tendsto, Uniform.tendsto_nhds_right, tendsto_def] exact forall₂_congr fun u _ => by simp [mem_prod_principal, preimage] #align tendsto_uniformly_on_singleton_iff_tendsto tendstoUniformlyOn_singleton_iff_tendsto theorem Filter.Tendsto.tendstoUniformlyOnFilter_const {g : ι → β} {b : β} (hg : Tendsto g p (𝓝 b)) (p' : Filter α) : TendstoUniformlyOnFilter (fun n : ι => fun _ : α => g n) (fun _ : α => b) p p' := by simpa only [nhds_eq_comap_uniformity, tendsto_comap_iff] using hg.comp (tendsto_fst (g := p')) #align filter.tendsto.tendsto_uniformly_on_filter_const Filter.Tendsto.tendstoUniformlyOnFilter_const theorem Filter.Tendsto.tendstoUniformlyOn_const {g : ι → β} {b : β} (hg : Tendsto g p (𝓝 b)) (s : Set α) : TendstoUniformlyOn (fun n : ι => fun _ : α => g n) (fun _ : α => b) p s := tendstoUniformlyOn_iff_tendstoUniformlyOnFilter.mpr (hg.tendstoUniformlyOnFilter_const (𝓟 s)) #align filter.tendsto.tendsto_uniformly_on_const Filter.Tendsto.tendstoUniformlyOn_const -- Porting note (#10756): new lemma theorem UniformContinuousOn.tendstoUniformlyOn [UniformSpace α] [UniformSpace γ] {x : α} {U : Set α} {V : Set β} {F : α → β → γ} (hF : UniformContinuousOn (↿F) (U ×ˢ V)) (hU : x ∈ U) : TendstoUniformlyOn F (F x) (𝓝[U] x) V := by set φ := fun q : α × β => ((x, q.2), q) rw [tendstoUniformlyOn_iff_tendsto] change Tendsto (Prod.map (↿F) ↿F ∘ φ) (𝓝[U] x ×ˢ 𝓟 V) (𝓤 γ) simp only [nhdsWithin, SProd.sprod, Filter.prod, comap_inf, inf_assoc, comap_principal, inf_principal] refine hF.comp (Tendsto.inf ?_ <| tendsto_principal_principal.2 fun x hx => ⟨⟨hU, hx.2⟩, hx⟩) simp only [uniformity_prod_eq_comap_prod, tendsto_comap_iff, (· ∘ ·), nhds_eq_comap_uniformity, comap_comap] exact tendsto_comap.prod_mk (tendsto_diag_uniformity _ _) theorem UniformContinuousOn.tendstoUniformly [UniformSpace α] [UniformSpace γ] {x : α} {U : Set α} (hU : U ∈ 𝓝 x) {F : α → β → γ} (hF : UniformContinuousOn (↿F) (U ×ˢ (univ : Set β))) : TendstoUniformly F (F x) (𝓝 x) := by simpa only [tendstoUniformlyOn_univ, nhdsWithin_eq_nhds.2 hU] using hF.tendstoUniformlyOn (mem_of_mem_nhds hU) #align uniform_continuous_on.tendsto_uniformly UniformContinuousOn.tendstoUniformly theorem UniformContinuous₂.tendstoUniformly [UniformSpace α] [UniformSpace γ] {f : α → β → γ} (h : UniformContinuous₂ f) {x : α} : TendstoUniformly f (f x) (𝓝 x) := UniformContinuousOn.tendstoUniformly univ_mem <| by rwa [univ_prod_univ, uniformContinuousOn_univ] #align uniform_continuous₂.tendsto_uniformly UniformContinuous₂.tendstoUniformly def UniformCauchySeqOnFilter (F : ι → α → β) (p : Filter ι) (p' : Filter α) : Prop := ∀ u ∈ 𝓤 β, ∀ᶠ m : (ι × ι) × α in (p ×ˢ p) ×ˢ p', (F m.fst.fst m.snd, F m.fst.snd m.snd) ∈ u #align uniform_cauchy_seq_on_filter UniformCauchySeqOnFilter def UniformCauchySeqOn (F : ι → α → β) (p : Filter ι) (s : Set α) : Prop := ∀ u ∈ 𝓤 β, ∀ᶠ m : ι × ι in p ×ˢ p, ∀ x : α, x ∈ s → (F m.fst x, F m.snd x) ∈ u #align uniform_cauchy_seq_on UniformCauchySeqOn theorem uniformCauchySeqOn_iff_uniformCauchySeqOnFilter : UniformCauchySeqOn F p s ↔ UniformCauchySeqOnFilter F p (𝓟 s) := by simp only [UniformCauchySeqOn, UniformCauchySeqOnFilter] refine forall₂_congr fun u hu => ?_ rw [eventually_prod_principal_iff] #align uniform_cauchy_seq_on_iff_uniform_cauchy_seq_on_filter uniformCauchySeqOn_iff_uniformCauchySeqOnFilter theorem UniformCauchySeqOn.uniformCauchySeqOnFilter (hF : UniformCauchySeqOn F p s) : UniformCauchySeqOnFilter F p (𝓟 s) := by rwa [← uniformCauchySeqOn_iff_uniformCauchySeqOnFilter] #align uniform_cauchy_seq_on.uniform_cauchy_seq_on_filter UniformCauchySeqOn.uniformCauchySeqOnFilter theorem TendstoUniformlyOnFilter.uniformCauchySeqOnFilter (hF : TendstoUniformlyOnFilter F f p p') : UniformCauchySeqOnFilter F p p' := by intro u hu rcases comp_symm_of_uniformity hu with ⟨t, ht, htsymm, htmem⟩ have := tendsto_swap4_prod.eventually ((hF t ht).prod_mk (hF t ht)) apply this.diag_of_prod_right.mono simp only [and_imp, Prod.forall] intro n1 n2 x hl hr exact Set.mem_of_mem_of_subset (prod_mk_mem_compRel (htsymm hl) hr) htmem #align tendsto_uniformly_on_filter.uniform_cauchy_seq_on_filter TendstoUniformlyOnFilter.uniformCauchySeqOnFilter theorem TendstoUniformlyOn.uniformCauchySeqOn (hF : TendstoUniformlyOn F f p s) : UniformCauchySeqOn F p s := uniformCauchySeqOn_iff_uniformCauchySeqOnFilter.mpr hF.tendstoUniformlyOnFilter.uniformCauchySeqOnFilter #align tendsto_uniformly_on.uniform_cauchy_seq_on TendstoUniformlyOn.uniformCauchySeqOn theorem UniformCauchySeqOnFilter.tendstoUniformlyOnFilter_of_tendsto [NeBot p] (hF : UniformCauchySeqOnFilter F p p') (hF' : ∀ᶠ x : α in p', Tendsto (fun n => F n x) p (𝓝 (f x))) : TendstoUniformlyOnFilter F f p p' := by -- Proof idea: |f_n(x) - f(x)| ≤ |f_n(x) - f_m(x)| + |f_m(x) - f(x)|. We choose `n` -- so that |f_n(x) - f_m(x)| is uniformly small across `s` whenever `m ≥ n`. Then for -- a fixed `x`, we choose `m` sufficiently large such that |f_m(x) - f(x)| is small. intro u hu rcases comp_symm_of_uniformity hu with ⟨t, ht, htsymm, htmem⟩ -- We will choose n, x, and m simultaneously. n and x come from hF. m comes from hF' -- But we need to promote hF' to the full product filter to use it have hmc : ∀ᶠ x in (p ×ˢ p) ×ˢ p', Tendsto (fun n : ι => F n x.snd) p (𝓝 (f x.snd)) := by rw [eventually_prod_iff] exact ⟨fun _ => True, by simp, _, hF', by simp⟩ -- To apply filter operations we'll need to do some order manipulation rw [Filter.eventually_swap_iff] have := tendsto_prodAssoc.eventually (tendsto_prod_swap.eventually ((hF t ht).and hmc)) apply this.curry.mono simp only [Equiv.prodAssoc_apply, eventually_and, eventually_const, Prod.snd_swap, Prod.fst_swap, and_imp, Prod.forall] -- Complete the proof intro x n hx hm' refine Set.mem_of_mem_of_subset (mem_compRel.mpr ?_) htmem rw [Uniform.tendsto_nhds_right] at hm' have := hx.and (hm' ht) obtain ⟨m, hm⟩ := this.exists exact ⟨F m x, ⟨hm.2, htsymm hm.1⟩⟩ #align uniform_cauchy_seq_on_filter.tendsto_uniformly_on_filter_of_tendsto UniformCauchySeqOnFilter.tendstoUniformlyOnFilter_of_tendsto theorem UniformCauchySeqOn.tendstoUniformlyOn_of_tendsto [NeBot p] (hF : UniformCauchySeqOn F p s) (hF' : ∀ x : α, x ∈ s → Tendsto (fun n => F n x) p (𝓝 (f x))) : TendstoUniformlyOn F f p s := tendstoUniformlyOn_iff_tendstoUniformlyOnFilter.mpr (hF.uniformCauchySeqOnFilter.tendstoUniformlyOnFilter_of_tendsto hF') #align uniform_cauchy_seq_on.tendsto_uniformly_on_of_tendsto UniformCauchySeqOn.tendstoUniformlyOn_of_tendsto theorem UniformCauchySeqOnFilter.mono_left {p'' : Filter ι} (hf : UniformCauchySeqOnFilter F p p') (hp : p'' ≤ p) : UniformCauchySeqOnFilter F p'' p' := by intro u hu have := (hf u hu).filter_mono (p'.prod_mono_left (Filter.prod_mono hp hp)) exact this.mono (by simp) #align uniform_cauchy_seq_on_filter.mono_left UniformCauchySeqOnFilter.mono_left theorem UniformCauchySeqOnFilter.mono_right {p'' : Filter α} (hf : UniformCauchySeqOnFilter F p p') (hp : p'' ≤ p') : UniformCauchySeqOnFilter F p p'' := fun u hu => have := (hf u hu).filter_mono ((p ×ˢ p).prod_mono_right hp) this.mono (by simp) #align uniform_cauchy_seq_on_filter.mono_right UniformCauchySeqOnFilter.mono_right theorem UniformCauchySeqOn.mono {s' : Set α} (hf : UniformCauchySeqOn F p s) (hss' : s' ⊆ s) : UniformCauchySeqOn F p s' := by rw [uniformCauchySeqOn_iff_uniformCauchySeqOnFilter] at hf ⊢ exact hf.mono_right (le_principal_iff.mpr <| mem_principal.mpr hss') #align uniform_cauchy_seq_on.mono UniformCauchySeqOn.mono theorem UniformCauchySeqOnFilter.comp {γ : Type*} (hf : UniformCauchySeqOnFilter F p p') (g : γ → α) : UniformCauchySeqOnFilter (fun n => F n ∘ g) p (p'.comap g) := fun u hu => by obtain ⟨pa, hpa, pb, hpb, hpapb⟩ := eventually_prod_iff.mp (hf u hu) rw [eventually_prod_iff] refine ⟨pa, hpa, pb ∘ g, ?_, fun hx _ hy => hpapb hx hy⟩ exact eventually_comap.mpr (hpb.mono fun x hx y hy => by simp only [hx, hy, Function.comp_apply]) #align uniform_cauchy_seq_on_filter.comp UniformCauchySeqOnFilter.comp theorem UniformCauchySeqOn.comp {γ : Type*} (hf : UniformCauchySeqOn F p s) (g : γ → α) : UniformCauchySeqOn (fun n => F n ∘ g) p (g ⁻¹' s) := by rw [uniformCauchySeqOn_iff_uniformCauchySeqOnFilter] at hf ⊢ simpa only [UniformCauchySeqOn, comap_principal] using hf.comp g #align uniform_cauchy_seq_on.comp UniformCauchySeqOn.comp theorem UniformContinuous.comp_uniformCauchySeqOn [UniformSpace γ] {g : β → γ} (hg : UniformContinuous g) (hf : UniformCauchySeqOn F p s) : UniformCauchySeqOn (fun n => g ∘ F n) p s := fun _u hu => hf _ (hg hu) #align uniform_continuous.comp_uniform_cauchy_seq_on UniformContinuous.comp_uniformCauchySeqOn theorem UniformCauchySeqOn.prod_map {ι' α' β' : Type*} [UniformSpace β'] {F' : ι' → α' → β'} {p' : Filter ι'} {s' : Set α'} (h : UniformCauchySeqOn F p s) (h' : UniformCauchySeqOn F' p' s') : UniformCauchySeqOn (fun i : ι × ι' => Prod.map (F i.1) (F' i.2)) (p ×ˢ p') (s ×ˢ s') := by intro u hu rw [uniformity_prod_eq_prod, mem_map, mem_prod_iff] at hu obtain ⟨v, hv, w, hw, hvw⟩ := hu simp_rw [mem_prod, Prod.map_apply, and_imp, Prod.forall] rw [← Set.image_subset_iff] at hvw apply (tendsto_swap4_prod.eventually ((h v hv).prod_mk (h' w hw))).mono intro x hx a b ha hb exact hvw ⟨_, mk_mem_prod (hx.1 a ha) (hx.2 b hb), rfl⟩ #align uniform_cauchy_seq_on.prod_map UniformCauchySeqOn.prod_map theorem UniformCauchySeqOn.prod {ι' β' : Type*} [UniformSpace β'] {F' : ι' → α → β'} {p' : Filter ι'} (h : UniformCauchySeqOn F p s) (h' : UniformCauchySeqOn F' p' s) : UniformCauchySeqOn (fun (i : ι × ι') a => (F i.fst a, F' i.snd a)) (p ×ˢ p') s := (congr_arg _ s.inter_self).mp ((h.prod_map h').comp fun a => (a, a)) #align uniform_cauchy_seq_on.prod UniformCauchySeqOn.prod theorem UniformCauchySeqOn.prod' {β' : Type*} [UniformSpace β'] {F' : ι → α → β'} (h : UniformCauchySeqOn F p s) (h' : UniformCauchySeqOn F' p s) : UniformCauchySeqOn (fun (i : ι) a => (F i a, F' i a)) p s := fun u hu => have hh : Tendsto (fun x : ι => (x, x)) p (p ×ˢ p) := tendsto_diag (hh.prod_map hh).eventually ((h.prod h') u hu) #align uniform_cauchy_seq_on.prod' UniformCauchySeqOn.prod' theorem UniformCauchySeqOn.cauchy_map [hp : NeBot p] (hf : UniformCauchySeqOn F p s) (hx : x ∈ s) : Cauchy (map (fun i => F i x) p) := by simp only [cauchy_map_iff, hp, true_and_iff] intro u hu rw [mem_map] filter_upwards [hf u hu] with p hp using hp x hx #align uniform_cauchy_seq_on.cauchy_map UniformCauchySeqOn.cauchy_map theorem UniformCauchySeqOn.cauchySeq [Nonempty ι] [SemilatticeSup ι] (hf : UniformCauchySeqOn F atTop s) (hx : x ∈ s) : CauchySeq fun i ↦ F i x := hf.cauchy_map (hp := atTop_neBot) hx variable [TopologicalSpace α] def TendstoLocallyUniformlyOn (F : ι → α → β) (f : α → β) (p : Filter ι) (s : Set α) := ∀ u ∈ 𝓤 β, ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, ∀ᶠ n in p, ∀ y ∈ t, (f y, F n y) ∈ u #align tendsto_locally_uniformly_on TendstoLocallyUniformlyOn def TendstoLocallyUniformly (F : ι → α → β) (f : α → β) (p : Filter ι) := ∀ u ∈ 𝓤 β, ∀ x : α, ∃ t ∈ 𝓝 x, ∀ᶠ n in p, ∀ y ∈ t, (f y, F n y) ∈ u #align tendsto_locally_uniformly TendstoLocallyUniformly theorem tendstoLocallyUniformlyOn_univ : TendstoLocallyUniformlyOn F f p univ ↔ TendstoLocallyUniformly F f p := by simp [TendstoLocallyUniformlyOn, TendstoLocallyUniformly, nhdsWithin_univ] #align tendsto_locally_uniformly_on_univ tendstoLocallyUniformlyOn_univ -- Porting note (#10756): new lemma theorem tendstoLocallyUniformlyOn_iff_forall_tendsto : TendstoLocallyUniformlyOn F f p s ↔ ∀ x ∈ s, Tendsto (fun y : ι × α => (f y.2, F y.1 y.2)) (p ×ˢ 𝓝[s] x) (𝓤 β) := forall₂_swap.trans <| forall₄_congr fun _ _ _ _ => by rw [mem_map, mem_prod_iff_right]; rfl nonrec theorem IsOpen.tendstoLocallyUniformlyOn_iff_forall_tendsto (hs : IsOpen s) : TendstoLocallyUniformlyOn F f p s ↔ ∀ x ∈ s, Tendsto (fun y : ι × α => (f y.2, F y.1 y.2)) (p ×ˢ 𝓝 x) (𝓤 β) := tendstoLocallyUniformlyOn_iff_forall_tendsto.trans <| forall₂_congr fun x hx => by rw [hs.nhdsWithin_eq hx] theorem tendstoLocallyUniformly_iff_forall_tendsto : TendstoLocallyUniformly F f p ↔ ∀ x, Tendsto (fun y : ι × α => (f y.2, F y.1 y.2)) (p ×ˢ 𝓝 x) (𝓤 β) := by simp [← tendstoLocallyUniformlyOn_univ, isOpen_univ.tendstoLocallyUniformlyOn_iff_forall_tendsto] #align tendsto_locally_uniformly_iff_forall_tendsto tendstoLocallyUniformly_iff_forall_tendsto theorem tendstoLocallyUniformlyOn_iff_tendstoLocallyUniformly_comp_coe : TendstoLocallyUniformlyOn F f p s ↔ TendstoLocallyUniformly (fun i (x : s) => F i x) (f ∘ (↑)) p := by simp only [tendstoLocallyUniformly_iff_forall_tendsto, Subtype.forall', tendsto_map'_iff, tendstoLocallyUniformlyOn_iff_forall_tendsto, ← map_nhds_subtype_val, prod_map_right]; rfl #align tendsto_locally_uniformly_on_iff_tendsto_locally_uniformly_comp_coe tendstoLocallyUniformlyOn_iff_tendstoLocallyUniformly_comp_coe protected theorem TendstoUniformlyOn.tendstoLocallyUniformlyOn (h : TendstoUniformlyOn F f p s) : TendstoLocallyUniformlyOn F f p s := fun u hu x _ => ⟨s, self_mem_nhdsWithin, by simpa using h u hu⟩ #align tendsto_uniformly_on.tendsto_locally_uniformly_on TendstoUniformlyOn.tendstoLocallyUniformlyOn protected theorem TendstoUniformly.tendstoLocallyUniformly (h : TendstoUniformly F f p) : TendstoLocallyUniformly F f p := fun u hu x => ⟨univ, univ_mem, by simpa using h u hu⟩ #align tendsto_uniformly.tendsto_locally_uniformly TendstoUniformly.tendstoLocallyUniformly theorem TendstoLocallyUniformlyOn.mono (h : TendstoLocallyUniformlyOn F f p s) (h' : s' ⊆ s) : TendstoLocallyUniformlyOn F f p s' := by intro u hu x hx rcases h u hu x (h' hx) with ⟨t, ht, H⟩ exact ⟨t, nhdsWithin_mono x h' ht, H.mono fun n => id⟩ #align tendsto_locally_uniformly_on.mono TendstoLocallyUniformlyOn.mono -- Porting note: generalized from `Type` to `Sort` theorem tendstoLocallyUniformlyOn_iUnion {ι' : Sort*} {S : ι' → Set α} (hS : ∀ i, IsOpen (S i)) (h : ∀ i, TendstoLocallyUniformlyOn F f p (S i)) : TendstoLocallyUniformlyOn F f p (⋃ i, S i) := (isOpen_iUnion hS).tendstoLocallyUniformlyOn_iff_forall_tendsto.2 fun _x hx => let ⟨i, hi⟩ := mem_iUnion.1 hx (hS i).tendstoLocallyUniformlyOn_iff_forall_tendsto.1 (h i) _ hi #align tendsto_locally_uniformly_on_Union tendstoLocallyUniformlyOn_iUnion theorem tendstoLocallyUniformlyOn_biUnion {s : Set γ} {S : γ → Set α} (hS : ∀ i ∈ s, IsOpen (S i)) (h : ∀ i ∈ s, TendstoLocallyUniformlyOn F f p (S i)) : TendstoLocallyUniformlyOn F f p (⋃ i ∈ s, S i) := tendstoLocallyUniformlyOn_iUnion (fun i => isOpen_iUnion (hS i)) fun i => tendstoLocallyUniformlyOn_iUnion (hS i) (h i) #align tendsto_locally_uniformly_on_bUnion tendstoLocallyUniformlyOn_biUnion theorem tendstoLocallyUniformlyOn_sUnion (S : Set (Set α)) (hS : ∀ s ∈ S, IsOpen s) (h : ∀ s ∈ S, TendstoLocallyUniformlyOn F f p s) : TendstoLocallyUniformlyOn F f p (⋃₀ S) := by rw [sUnion_eq_biUnion] exact tendstoLocallyUniformlyOn_biUnion hS h #align tendsto_locally_uniformly_on_sUnion tendstoLocallyUniformlyOn_sUnion theorem TendstoLocallyUniformlyOn.union {s₁ s₂ : Set α} (hs₁ : IsOpen s₁) (hs₂ : IsOpen s₂) (h₁ : TendstoLocallyUniformlyOn F f p s₁) (h₂ : TendstoLocallyUniformlyOn F f p s₂) : TendstoLocallyUniformlyOn F f p (s₁ ∪ s₂) := by rw [← sUnion_pair] refine tendstoLocallyUniformlyOn_sUnion _ ?_ ?_ <;> simp [*] #align tendsto_locally_uniformly_on.union TendstoLocallyUniformlyOn.union -- Porting note: tendstoLocallyUniformlyOn_univ moved up protected theorem TendstoLocallyUniformly.tendstoLocallyUniformlyOn (h : TendstoLocallyUniformly F f p) : TendstoLocallyUniformlyOn F f p s := (tendstoLocallyUniformlyOn_univ.mpr h).mono (subset_univ _) #align tendsto_locally_uniformly.tendsto_locally_uniformly_on TendstoLocallyUniformly.tendstoLocallyUniformlyOn theorem tendstoLocallyUniformly_iff_tendstoUniformly_of_compactSpace [CompactSpace α] : TendstoLocallyUniformly F f p ↔ TendstoUniformly F f p := by refine ⟨fun h V hV => ?_, TendstoUniformly.tendstoLocallyUniformly⟩ choose U hU using h V hV obtain ⟨t, ht⟩ := isCompact_univ.elim_nhds_subcover' (fun k _ => U k) fun k _ => (hU k).1 replace hU := fun x : t => (hU x).2 rw [← eventually_all] at hU refine hU.mono fun i hi x => ?_ specialize ht (mem_univ x) simp only [exists_prop, mem_iUnion, SetCoe.exists, exists_and_right, Subtype.coe_mk] at ht obtain ⟨y, ⟨hy₁, hy₂⟩, hy₃⟩ := ht exact hi ⟨⟨y, hy₁⟩, hy₂⟩ x hy₃ #align tendsto_locally_uniformly_iff_tendsto_uniformly_of_compact_space tendstoLocallyUniformly_iff_tendstoUniformly_of_compactSpace theorem tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact (hs : IsCompact s) : TendstoLocallyUniformlyOn F f p s ↔ TendstoUniformlyOn F f p s := by haveI : CompactSpace s := isCompact_iff_compactSpace.mp hs refine ⟨fun h => ?_, TendstoUniformlyOn.tendstoLocallyUniformlyOn⟩ rwa [tendstoLocallyUniformlyOn_iff_tendstoLocallyUniformly_comp_coe, tendstoLocallyUniformly_iff_tendstoUniformly_of_compactSpace, ← tendstoUniformlyOn_iff_tendstoUniformly_comp_coe] at h #align tendsto_locally_uniformly_on_iff_tendsto_uniformly_on_of_compact tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact theorem TendstoLocallyUniformlyOn.comp [TopologicalSpace γ] {t : Set γ} (h : TendstoLocallyUniformlyOn F f p s) (g : γ → α) (hg : MapsTo g t s) (cg : ContinuousOn g t) : TendstoLocallyUniformlyOn (fun n => F n ∘ g) (f ∘ g) p t := by intro u hu x hx rcases h u hu (g x) (hg hx) with ⟨a, ha, H⟩ have : g ⁻¹' a ∈ 𝓝[t] x := (cg x hx).preimage_mem_nhdsWithin' (nhdsWithin_mono (g x) hg.image_subset ha) exact ⟨g ⁻¹' a, this, H.mono fun n hn y hy => hn _ hy⟩ #align tendsto_locally_uniformly_on.comp TendstoLocallyUniformlyOn.comp theorem TendstoLocallyUniformly.comp [TopologicalSpace γ] (h : TendstoLocallyUniformly F f p) (g : γ → α) (cg : Continuous g) : TendstoLocallyUniformly (fun n => F n ∘ g) (f ∘ g) p := by rw [← tendstoLocallyUniformlyOn_univ] at h ⊢ rw [continuous_iff_continuousOn_univ] at cg exact h.comp _ (mapsTo_univ _ _) cg #align tendsto_locally_uniformly.comp TendstoLocallyUniformly.comp theorem tendstoLocallyUniformlyOn_TFAE [LocallyCompactSpace α] (G : ι → α → β) (g : α → β) (p : Filter ι) (hs : IsOpen s) : List.TFAE [ TendstoLocallyUniformlyOn G g p s, ∀ K, K ⊆ s → IsCompact K → TendstoUniformlyOn G g p K, ∀ x ∈ s, ∃ v ∈ 𝓝[s] x, TendstoUniformlyOn G g p v] := by tfae_have 1 → 2 · rintro h K hK1 hK2 exact (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact hK2).mp (h.mono hK1) tfae_have 2 → 3 · rintro h x hx obtain ⟨K, ⟨hK1, hK2⟩, hK3⟩ := (compact_basis_nhds x).mem_iff.mp (hs.mem_nhds hx) exact ⟨K, nhdsWithin_le_nhds hK1, h K hK3 hK2⟩ tfae_have 3 → 1 · rintro h u hu x hx obtain ⟨v, hv1, hv2⟩ := h x hx exact ⟨v, hv1, hv2 u hu⟩ tfae_finish #align tendsto_locally_uniformly_on_tfae tendstoLocallyUniformlyOn_TFAE theorem tendstoLocallyUniformlyOn_iff_forall_isCompact [LocallyCompactSpace α] (hs : IsOpen s) : TendstoLocallyUniformlyOn F f p s ↔ ∀ K, K ⊆ s → IsCompact K → TendstoUniformlyOn F f p K := (tendstoLocallyUniformlyOn_TFAE F f p hs).out 0 1 #align tendsto_locally_uniformly_on_iff_forall_is_compact tendstoLocallyUniformlyOn_iff_forall_isCompact lemma tendstoLocallyUniformly_iff_forall_isCompact [LocallyCompactSpace α] : TendstoLocallyUniformly F f p ↔ ∀ K : Set α, IsCompact K → TendstoUniformlyOn F f p K := by simp only [← tendstoLocallyUniformlyOn_univ, tendstoLocallyUniformlyOn_iff_forall_isCompact isOpen_univ, Set.subset_univ, forall_true_left]
Mathlib/Topology/UniformSpace/UniformConvergence.lean
766
775
theorem tendstoLocallyUniformlyOn_iff_filter : TendstoLocallyUniformlyOn F f p s ↔ ∀ x ∈ s, TendstoUniformlyOnFilter F f p (𝓝[s] x) := by
simp only [TendstoUniformlyOnFilter, eventually_prod_iff] constructor · rintro h x hx u hu obtain ⟨s, hs1, hs2⟩ := h u hu x hx exact ⟨_, hs2, _, eventually_of_mem hs1 fun x => id, fun hi y hy => hi y hy⟩ · rintro h u hu x hx obtain ⟨pa, hpa, pb, hpb, h⟩ := h x hx u hu exact ⟨pb, hpb, eventually_of_mem hpa fun i hi y hy => h hi hy⟩
import Mathlib.Logic.Equiv.Defs #align_import data.erased from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" universe u def Erased (α : Sort u) : Sort max 1 u := Σ's : α → Prop, ∃ a, (fun b => a = b) = s #align erased Erased namespace Erased @[inline] def mk {α} (a : α) : Erased α := ⟨fun b => a = b, a, rfl⟩ #align erased.mk Erased.mk noncomputable def out {α} : Erased α → α | ⟨_, h⟩ => Classical.choose h #align erased.out Erased.out abbrev OutType (a : Erased (Sort u)) : Sort u := out a #align erased.out_type Erased.OutType theorem out_proof {p : Prop} (a : Erased p) : p := out a #align erased.out_proof Erased.out_proof @[simp] theorem out_mk {α} (a : α) : (mk a).out = a := by let h := (mk a).2; show Classical.choose h = a have := Classical.choose_spec h exact cast (congr_fun this a).symm rfl #align erased.out_mk Erased.out_mk @[simp] theorem mk_out {α} : ∀ a : Erased α, mk (out a) = a | ⟨s, h⟩ => by simp only [mk]; congr; exact Classical.choose_spec h #align erased.mk_out Erased.mk_out @[ext] theorem out_inj {α} (a b : Erased α) (h : a.out = b.out) : a = b := by simpa using congr_arg mk h #align erased.out_inj Erased.out_inj noncomputable def equiv (α) : Erased α ≃ α := ⟨out, mk, mk_out, out_mk⟩ #align erased.equiv Erased.equiv instance (α : Type u) : Repr (Erased α) := ⟨fun _ _ => "Erased"⟩ instance (α : Type u) : ToString (Erased α) := ⟨fun _ => "Erased"⟩ -- Porting note: Deleted `has_to_format` def choice {α} (h : Nonempty α) : Erased α := mk (Classical.choice h) #align erased.choice Erased.choice @[simp] theorem nonempty_iff {α} : Nonempty (Erased α) ↔ Nonempty α := ⟨fun ⟨a⟩ => ⟨a.out⟩, fun ⟨a⟩ => ⟨mk a⟩⟩ #align erased.nonempty_iff Erased.nonempty_iff instance {α} [h : Nonempty α] : Inhabited (Erased α) := ⟨choice h⟩ def bind {α β} (a : Erased α) (f : α → Erased β) : Erased β := ⟨fun b => (f a.out).1 b, (f a.out).2⟩ #align erased.bind Erased.bind @[simp] theorem bind_eq_out {α β} (a f) : @bind α β a f = f a.out := rfl #align erased.bind_eq_out Erased.bind_eq_out def join {α} (a : Erased (Erased α)) : Erased α := bind a id #align erased.join Erased.join @[simp] theorem join_eq_out {α} (a) : @join α a = a.out := bind_eq_out _ _ #align erased.join_eq_out Erased.join_eq_out def map {α β} (f : α → β) (a : Erased α) : Erased β := bind a (mk ∘ f) #align erased.map Erased.map @[simp]
Mathlib/Data/Erased.lean
131
131
theorem map_out {α β} {f : α → β} (a : Erased α) : (a.map f).out = f a.out := by
simp [map]
import Mathlib.Combinatorics.SimpleGraph.Subgraph import Mathlib.Data.List.Rotate #align_import combinatorics.simple_graph.connectivity from "leanprover-community/mathlib"@"b99e2d58a5e6861833fa8de11e51a81144258db4" open Function universe u v w namespace SimpleGraph variable {V : Type u} {V' : Type v} {V'' : Type w} variable (G : SimpleGraph V) (G' : SimpleGraph V') (G'' : SimpleGraph V'') inductive Walk : V → V → Type u | nil {u : V} : Walk u u | cons {u v w : V} (h : G.Adj u v) (p : Walk v w) : Walk u w deriving DecidableEq #align simple_graph.walk SimpleGraph.Walk attribute [refl] Walk.nil @[simps] instance Walk.instInhabited (v : V) : Inhabited (G.Walk v v) := ⟨Walk.nil⟩ #align simple_graph.walk.inhabited SimpleGraph.Walk.instInhabited @[match_pattern, reducible] def Adj.toWalk {G : SimpleGraph V} {u v : V} (h : G.Adj u v) : G.Walk u v := Walk.cons h Walk.nil #align simple_graph.adj.to_walk SimpleGraph.Adj.toWalk namespace Walk variable {G} @[match_pattern] abbrev nil' (u : V) : G.Walk u u := Walk.nil #align simple_graph.walk.nil' SimpleGraph.Walk.nil' @[match_pattern] abbrev cons' (u v w : V) (h : G.Adj u v) (p : G.Walk v w) : G.Walk u w := Walk.cons h p #align simple_graph.walk.cons' SimpleGraph.Walk.cons' protected def copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : G.Walk u' v' := hu ▸ hv ▸ p #align simple_graph.walk.copy SimpleGraph.Walk.copy @[simp] theorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl #align simple_graph.walk.copy_rfl_rfl SimpleGraph.Walk.copy_rfl_rfl @[simp] theorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by subst_vars rfl #align simple_graph.walk.copy_copy SimpleGraph.Walk.copy_copy @[simp] theorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = Walk.nil := by subst_vars rfl #align simple_graph.walk.copy_nil SimpleGraph.Walk.copy_nil theorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') : (Walk.cons h p).copy hu hw = Walk.cons (hu ▸ h) (p.copy rfl hw) := by subst_vars rfl #align simple_graph.walk.copy_cons SimpleGraph.Walk.copy_cons @[simp] theorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) : Walk.cons h (p.copy hv hw) = (Walk.cons (hv ▸ h) p).copy rfl hw := by subst_vars rfl #align simple_graph.walk.cons_copy SimpleGraph.Walk.cons_copy theorem exists_eq_cons_of_ne {u v : V} (hne : u ≠ v) : ∀ (p : G.Walk u v), ∃ (w : V) (h : G.Adj u w) (p' : G.Walk w v), p = cons h p' | nil => (hne rfl).elim | cons h p' => ⟨_, h, p', rfl⟩ #align simple_graph.walk.exists_eq_cons_of_ne SimpleGraph.Walk.exists_eq_cons_of_ne def length {u v : V} : G.Walk u v → ℕ | nil => 0 | cons _ q => q.length.succ #align simple_graph.walk.length SimpleGraph.Walk.length @[trans] def append {u v w : V} : G.Walk u v → G.Walk v w → G.Walk u w | nil, q => q | cons h p, q => cons h (p.append q) #align simple_graph.walk.append SimpleGraph.Walk.append def concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : G.Walk u w := p.append (cons h nil) #align simple_graph.walk.concat SimpleGraph.Walk.concat theorem concat_eq_append {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : p.concat h = p.append (cons h nil) := rfl #align simple_graph.walk.concat_eq_append SimpleGraph.Walk.concat_eq_append protected def reverseAux {u v w : V} : G.Walk u v → G.Walk u w → G.Walk v w | nil, q => q | cons h p, q => Walk.reverseAux p (cons (G.symm h) q) #align simple_graph.walk.reverse_aux SimpleGraph.Walk.reverseAux @[symm] def reverse {u v : V} (w : G.Walk u v) : G.Walk v u := w.reverseAux nil #align simple_graph.walk.reverse SimpleGraph.Walk.reverse def getVert {u v : V} : G.Walk u v → ℕ → V | nil, _ => u | cons _ _, 0 => u | cons _ q, n + 1 => q.getVert n #align simple_graph.walk.get_vert SimpleGraph.Walk.getVert @[simp] theorem getVert_zero {u v} (w : G.Walk u v) : w.getVert 0 = u := by cases w <;> rfl #align simple_graph.walk.get_vert_zero SimpleGraph.Walk.getVert_zero theorem getVert_of_length_le {u v} (w : G.Walk u v) {i : ℕ} (hi : w.length ≤ i) : w.getVert i = v := by induction w generalizing i with | nil => rfl | cons _ _ ih => cases i · cases hi · exact ih (Nat.succ_le_succ_iff.1 hi) #align simple_graph.walk.get_vert_of_length_le SimpleGraph.Walk.getVert_of_length_le @[simp] theorem getVert_length {u v} (w : G.Walk u v) : w.getVert w.length = v := w.getVert_of_length_le rfl.le #align simple_graph.walk.get_vert_length SimpleGraph.Walk.getVert_length theorem adj_getVert_succ {u v} (w : G.Walk u v) {i : ℕ} (hi : i < w.length) : G.Adj (w.getVert i) (w.getVert (i + 1)) := by induction w generalizing i with | nil => cases hi | cons hxy _ ih => cases i · simp [getVert, hxy] · exact ih (Nat.succ_lt_succ_iff.1 hi) #align simple_graph.walk.adj_get_vert_succ SimpleGraph.Walk.adj_getVert_succ @[simp] theorem cons_append {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (q : G.Walk w x) : (cons h p).append q = cons h (p.append q) := rfl #align simple_graph.walk.cons_append SimpleGraph.Walk.cons_append @[simp] theorem cons_nil_append {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h nil).append p = cons h p := rfl #align simple_graph.walk.cons_nil_append SimpleGraph.Walk.cons_nil_append @[simp] theorem append_nil {u v : V} (p : G.Walk u v) : p.append nil = p := by induction p with | nil => rfl | cons _ _ ih => rw [cons_append, ih] #align simple_graph.walk.append_nil SimpleGraph.Walk.append_nil @[simp] theorem nil_append {u v : V} (p : G.Walk u v) : nil.append p = p := rfl #align simple_graph.walk.nil_append SimpleGraph.Walk.nil_append theorem append_assoc {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk w x) : p.append (q.append r) = (p.append q).append r := by induction p with | nil => rfl | cons h p' ih => dsimp only [append] rw [ih] #align simple_graph.walk.append_assoc SimpleGraph.Walk.append_assoc @[simp] theorem append_copy_copy {u v w u' v' w'} (p : G.Walk u v) (q : G.Walk v w) (hu : u = u') (hv : v = v') (hw : w = w') : (p.copy hu hv).append (q.copy hv hw) = (p.append q).copy hu hw := by subst_vars rfl #align simple_graph.walk.append_copy_copy SimpleGraph.Walk.append_copy_copy theorem concat_nil {u v : V} (h : G.Adj u v) : nil.concat h = cons h nil := rfl #align simple_graph.walk.concat_nil SimpleGraph.Walk.concat_nil @[simp] theorem concat_cons {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (h' : G.Adj w x) : (cons h p).concat h' = cons h (p.concat h') := rfl #align simple_graph.walk.concat_cons SimpleGraph.Walk.concat_cons theorem append_concat {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (h : G.Adj w x) : p.append (q.concat h) = (p.append q).concat h := append_assoc _ _ _ #align simple_graph.walk.append_concat SimpleGraph.Walk.append_concat theorem concat_append {u v w x : V} (p : G.Walk u v) (h : G.Adj v w) (q : G.Walk w x) : (p.concat h).append q = p.append (cons h q) := by rw [concat_eq_append, ← append_assoc, cons_nil_append] #align simple_graph.walk.concat_append SimpleGraph.Walk.concat_append theorem exists_cons_eq_concat {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : ∃ (x : V) (q : G.Walk u x) (h' : G.Adj x w), cons h p = q.concat h' := by induction p generalizing u with | nil => exact ⟨_, nil, h, rfl⟩ | cons h' p ih => obtain ⟨y, q, h'', hc⟩ := ih h' refine ⟨y, cons h q, h'', ?_⟩ rw [concat_cons, hc] #align simple_graph.walk.exists_cons_eq_concat SimpleGraph.Walk.exists_cons_eq_concat theorem exists_concat_eq_cons {u v w : V} : ∀ (p : G.Walk u v) (h : G.Adj v w), ∃ (x : V) (h' : G.Adj u x) (q : G.Walk x w), p.concat h = cons h' q | nil, h => ⟨_, h, nil, rfl⟩ | cons h' p, h => ⟨_, h', Walk.concat p h, concat_cons _ _ _⟩ #align simple_graph.walk.exists_concat_eq_cons SimpleGraph.Walk.exists_concat_eq_cons @[simp] theorem reverse_nil {u : V} : (nil : G.Walk u u).reverse = nil := rfl #align simple_graph.walk.reverse_nil SimpleGraph.Walk.reverse_nil theorem reverse_singleton {u v : V} (h : G.Adj u v) : (cons h nil).reverse = cons (G.symm h) nil := rfl #align simple_graph.walk.reverse_singleton SimpleGraph.Walk.reverse_singleton @[simp] theorem cons_reverseAux {u v w x : V} (p : G.Walk u v) (q : G.Walk w x) (h : G.Adj w u) : (cons h p).reverseAux q = p.reverseAux (cons (G.symm h) q) := rfl #align simple_graph.walk.cons_reverse_aux SimpleGraph.Walk.cons_reverseAux @[simp] protected theorem append_reverseAux {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk u x) : (p.append q).reverseAux r = q.reverseAux (p.reverseAux r) := by induction p with | nil => rfl | cons h _ ih => exact ih q (cons (G.symm h) r) #align simple_graph.walk.append_reverse_aux SimpleGraph.Walk.append_reverseAux @[simp] protected theorem reverseAux_append {u v w x : V} (p : G.Walk u v) (q : G.Walk u w) (r : G.Walk w x) : (p.reverseAux q).append r = p.reverseAux (q.append r) := by induction p with | nil => rfl | cons h _ ih => simp [ih (cons (G.symm h) q)] #align simple_graph.walk.reverse_aux_append SimpleGraph.Walk.reverseAux_append protected theorem reverseAux_eq_reverse_append {u v w : V} (p : G.Walk u v) (q : G.Walk u w) : p.reverseAux q = p.reverse.append q := by simp [reverse] #align simple_graph.walk.reverse_aux_eq_reverse_append SimpleGraph.Walk.reverseAux_eq_reverse_append @[simp] theorem reverse_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).reverse = p.reverse.append (cons (G.symm h) nil) := by simp [reverse] #align simple_graph.walk.reverse_cons SimpleGraph.Walk.reverse_cons @[simp] theorem reverse_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).reverse = p.reverse.copy hv hu := by subst_vars rfl #align simple_graph.walk.reverse_copy SimpleGraph.Walk.reverse_copy @[simp] theorem reverse_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : (p.append q).reverse = q.reverse.append p.reverse := by simp [reverse] #align simple_graph.walk.reverse_append SimpleGraph.Walk.reverse_append @[simp] theorem reverse_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).reverse = cons (G.symm h) p.reverse := by simp [concat_eq_append] #align simple_graph.walk.reverse_concat SimpleGraph.Walk.reverse_concat @[simp] theorem reverse_reverse {u v : V} (p : G.Walk u v) : p.reverse.reverse = p := by induction p with | nil => rfl | cons _ _ ih => simp [ih] #align simple_graph.walk.reverse_reverse SimpleGraph.Walk.reverse_reverse @[simp] theorem length_nil {u : V} : (nil : G.Walk u u).length = 0 := rfl #align simple_graph.walk.length_nil SimpleGraph.Walk.length_nil @[simp] theorem length_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).length = p.length + 1 := rfl #align simple_graph.walk.length_cons SimpleGraph.Walk.length_cons @[simp] theorem length_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).length = p.length := by subst_vars rfl #align simple_graph.walk.length_copy SimpleGraph.Walk.length_copy @[simp] theorem length_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : (p.append q).length = p.length + q.length := by induction p with | nil => simp | cons _ _ ih => simp [ih, add_comm, add_left_comm, add_assoc] #align simple_graph.walk.length_append SimpleGraph.Walk.length_append @[simp] theorem length_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).length = p.length + 1 := length_append _ _ #align simple_graph.walk.length_concat SimpleGraph.Walk.length_concat @[simp] protected theorem length_reverseAux {u v w : V} (p : G.Walk u v) (q : G.Walk u w) : (p.reverseAux q).length = p.length + q.length := by induction p with | nil => simp! | cons _ _ ih => simp [ih, Nat.succ_add, Nat.add_assoc] #align simple_graph.walk.length_reverse_aux SimpleGraph.Walk.length_reverseAux @[simp] theorem length_reverse {u v : V} (p : G.Walk u v) : p.reverse.length = p.length := by simp [reverse] #align simple_graph.walk.length_reverse SimpleGraph.Walk.length_reverse theorem eq_of_length_eq_zero {u v : V} : ∀ {p : G.Walk u v}, p.length = 0 → u = v | nil, _ => rfl #align simple_graph.walk.eq_of_length_eq_zero SimpleGraph.Walk.eq_of_length_eq_zero theorem adj_of_length_eq_one {u v : V} : ∀ {p : G.Walk u v}, p.length = 1 → G.Adj u v | cons h nil, _ => h @[simp] theorem exists_length_eq_zero_iff {u v : V} : (∃ p : G.Walk u v, p.length = 0) ↔ u = v := by constructor · rintro ⟨p, hp⟩ exact eq_of_length_eq_zero hp · rintro rfl exact ⟨nil, rfl⟩ #align simple_graph.walk.exists_length_eq_zero_iff SimpleGraph.Walk.exists_length_eq_zero_iff @[simp] theorem length_eq_zero_iff {u : V} {p : G.Walk u u} : p.length = 0 ↔ p = nil := by cases p <;> simp #align simple_graph.walk.length_eq_zero_iff SimpleGraph.Walk.length_eq_zero_iff theorem getVert_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) (i : ℕ) : (p.append q).getVert i = if i < p.length then p.getVert i else q.getVert (i - p.length) := by induction p generalizing i with | nil => simp | cons h p ih => cases i <;> simp [getVert, ih, Nat.succ_lt_succ_iff] theorem getVert_reverse {u v : V} (p : G.Walk u v) (i : ℕ) : p.reverse.getVert i = p.getVert (p.length - i) := by induction p with | nil => rfl | cons h p ih => simp only [reverse_cons, getVert_append, length_reverse, ih, length_cons] split_ifs next hi => rw [Nat.succ_sub hi.le] simp [getVert] next hi => obtain rfl | hi' := Nat.eq_or_lt_of_not_lt hi · simp [getVert] · rw [Nat.eq_add_of_sub_eq (Nat.sub_pos_of_lt hi') rfl, Nat.sub_eq_zero_of_le hi'] simp [getVert] theorem concat_ne_nil {u v : V} (p : G.Walk u v) (h : G.Adj v u) : p.concat h ≠ nil := by cases p <;> simp [concat] #align simple_graph.walk.concat_ne_nil SimpleGraph.Walk.concat_ne_nil theorem concat_inj {u v v' w : V} {p : G.Walk u v} {h : G.Adj v w} {p' : G.Walk u v'} {h' : G.Adj v' w} (he : p.concat h = p'.concat h') : ∃ hv : v = v', p.copy rfl hv = p' := by induction p with | nil => cases p' · exact ⟨rfl, rfl⟩ · exfalso simp only [concat_nil, concat_cons, cons.injEq] at he obtain ⟨rfl, he⟩ := he simp only [heq_iff_eq] at he exact concat_ne_nil _ _ he.symm | cons _ _ ih => rw [concat_cons] at he cases p' · exfalso simp only [concat_nil, cons.injEq] at he obtain ⟨rfl, he⟩ := he rw [heq_iff_eq] at he exact concat_ne_nil _ _ he · rw [concat_cons, cons.injEq] at he obtain ⟨rfl, he⟩ := he rw [heq_iff_eq] at he obtain ⟨rfl, rfl⟩ := ih he exact ⟨rfl, rfl⟩ #align simple_graph.walk.concat_inj SimpleGraph.Walk.concat_inj def support {u v : V} : G.Walk u v → List V | nil => [u] | cons _ p => u :: p.support #align simple_graph.walk.support SimpleGraph.Walk.support def darts {u v : V} : G.Walk u v → List G.Dart | nil => [] | cons h p => ⟨(u, _), h⟩ :: p.darts #align simple_graph.walk.darts SimpleGraph.Walk.darts def edges {u v : V} (p : G.Walk u v) : List (Sym2 V) := p.darts.map Dart.edge #align simple_graph.walk.edges SimpleGraph.Walk.edges @[simp] theorem support_nil {u : V} : (nil : G.Walk u u).support = [u] := rfl #align simple_graph.walk.support_nil SimpleGraph.Walk.support_nil @[simp] theorem support_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).support = u :: p.support := rfl #align simple_graph.walk.support_cons SimpleGraph.Walk.support_cons @[simp] theorem support_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).support = p.support.concat w := by induction p <;> simp [*, concat_nil] #align simple_graph.walk.support_concat SimpleGraph.Walk.support_concat @[simp] theorem support_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).support = p.support := by subst_vars rfl #align simple_graph.walk.support_copy SimpleGraph.Walk.support_copy theorem support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').support = p.support ++ p'.support.tail := by induction p <;> cases p' <;> simp [*] #align simple_graph.walk.support_append SimpleGraph.Walk.support_append @[simp] theorem support_reverse {u v : V} (p : G.Walk u v) : p.reverse.support = p.support.reverse := by induction p <;> simp [support_append, *] #align simple_graph.walk.support_reverse SimpleGraph.Walk.support_reverse @[simp] theorem support_ne_nil {u v : V} (p : G.Walk u v) : p.support ≠ [] := by cases p <;> simp #align simple_graph.walk.support_ne_nil SimpleGraph.Walk.support_ne_nil theorem tail_support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').support.tail = p.support.tail ++ p'.support.tail := by rw [support_append, List.tail_append_of_ne_nil _ _ (support_ne_nil _)] #align simple_graph.walk.tail_support_append SimpleGraph.Walk.tail_support_append theorem support_eq_cons {u v : V} (p : G.Walk u v) : p.support = u :: p.support.tail := by cases p <;> simp #align simple_graph.walk.support_eq_cons SimpleGraph.Walk.support_eq_cons @[simp] theorem start_mem_support {u v : V} (p : G.Walk u v) : u ∈ p.support := by cases p <;> simp #align simple_graph.walk.start_mem_support SimpleGraph.Walk.start_mem_support @[simp] theorem end_mem_support {u v : V} (p : G.Walk u v) : v ∈ p.support := by induction p <;> simp [*] #align simple_graph.walk.end_mem_support SimpleGraph.Walk.end_mem_support @[simp] theorem support_nonempty {u v : V} (p : G.Walk u v) : { w | w ∈ p.support }.Nonempty := ⟨u, by simp⟩ #align simple_graph.walk.support_nonempty SimpleGraph.Walk.support_nonempty theorem mem_support_iff {u v w : V} (p : G.Walk u v) : w ∈ p.support ↔ w = u ∨ w ∈ p.support.tail := by cases p <;> simp #align simple_graph.walk.mem_support_iff SimpleGraph.Walk.mem_support_iff theorem mem_support_nil_iff {u v : V} : u ∈ (nil : G.Walk v v).support ↔ u = v := by simp #align simple_graph.walk.mem_support_nil_iff SimpleGraph.Walk.mem_support_nil_iff @[simp] theorem mem_tail_support_append_iff {t u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : t ∈ (p.append p').support.tail ↔ t ∈ p.support.tail ∨ t ∈ p'.support.tail := by rw [tail_support_append, List.mem_append] #align simple_graph.walk.mem_tail_support_append_iff SimpleGraph.Walk.mem_tail_support_append_iff @[simp] theorem end_mem_tail_support_of_ne {u v : V} (h : u ≠ v) (p : G.Walk u v) : v ∈ p.support.tail := by obtain ⟨_, _, _, rfl⟩ := exists_eq_cons_of_ne h p simp #align simple_graph.walk.end_mem_tail_support_of_ne SimpleGraph.Walk.end_mem_tail_support_of_ne @[simp, nolint unusedHavesSuffices] theorem mem_support_append_iff {t u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : t ∈ (p.append p').support ↔ t ∈ p.support ∨ t ∈ p'.support := by simp only [mem_support_iff, mem_tail_support_append_iff] obtain rfl | h := eq_or_ne t v <;> obtain rfl | h' := eq_or_ne t u <;> -- this `have` triggers the unusedHavesSuffices linter: (try have := h'.symm) <;> simp [*] #align simple_graph.walk.mem_support_append_iff SimpleGraph.Walk.mem_support_append_iff @[simp] theorem subset_support_append_left {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : p.support ⊆ (p.append q).support := by simp only [Walk.support_append, List.subset_append_left] #align simple_graph.walk.subset_support_append_left SimpleGraph.Walk.subset_support_append_left @[simp]
Mathlib/Combinatorics/SimpleGraph/Connectivity.lean
639
642
theorem subset_support_append_right {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : q.support ⊆ (p.append q).support := by
intro h simp (config := { contextual := true }) only [mem_support_append_iff, or_true_iff, imp_true_iff]
import Mathlib.Data.SetLike.Basic import Mathlib.Data.Finset.Preimage import Mathlib.ModelTheory.Semantics #align_import model_theory.definability from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe u v w u₁ namespace Set variable {M : Type w} (A : Set M) (L : FirstOrder.Language.{u, v}) [L.Structure M] open FirstOrder FirstOrder.Language FirstOrder.Language.Structure variable {α : Type u₁} {β : Type*} def Definable (s : Set (α → M)) : Prop := ∃ φ : L[[A]].Formula α, s = setOf φ.Realize #align set.definable Set.Definable variable {L} {A} {B : Set M} {s : Set (α → M)} theorem Definable.map_expansion {L' : FirstOrder.Language} [L'.Structure M] (h : A.Definable L s) (φ : L →ᴸ L') [φ.IsExpansionOn M] : A.Definable L' s := by obtain ⟨ψ, rfl⟩ := h refine ⟨(φ.addConstants A).onFormula ψ, ?_⟩ ext x simp only [mem_setOf_eq, LHom.realize_onFormula] #align set.definable.map_expansion Set.Definable.map_expansion theorem definable_iff_exists_formula_sum : A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)] refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = ·) ?_)) ext simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations, BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq] refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl) intros simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants, coe_con, Term.realize_relabel] congr ext a rcases a with (_ | _) | _ <;> rfl theorem empty_definable_iff : (∅ : Set M).Definable L s ↔ ∃ φ : L.Formula α, s = setOf φ.Realize := by rw [Definable, Equiv.exists_congr_left (LEquiv.addEmptyConstants L (∅ : Set M)).onFormula] simp [-constantsOn] #align set.empty_definable_iff Set.empty_definable_iff theorem definable_iff_empty_definable_with_params : A.Definable L s ↔ (∅ : Set M).Definable (L[[A]]) s := empty_definable_iff.symm #align set.definable_iff_empty_definable_with_params Set.definable_iff_empty_definable_with_params theorem Definable.mono (hAs : A.Definable L s) (hAB : A ⊆ B) : B.Definable L s := by rw [definable_iff_empty_definable_with_params] at * exact hAs.map_expansion (L.lhomWithConstantsMap (Set.inclusion hAB)) #align set.definable.mono Set.Definable.mono @[simp] theorem definable_empty : A.Definable L (∅ : Set (α → M)) := ⟨⊥, by ext simp⟩ #align set.definable_empty Set.definable_empty @[simp] theorem definable_univ : A.Definable L (univ : Set (α → M)) := ⟨⊤, by ext simp⟩ #align set.definable_univ Set.definable_univ @[simp] theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) : A.Definable L (f ∩ g) := by rcases hf with ⟨φ, rfl⟩ rcases hg with ⟨θ, rfl⟩ refine ⟨φ ⊓ θ, ?_⟩ ext simp #align set.definable.inter Set.Definable.inter @[simp] theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) : A.Definable L (f ∪ g) := by rcases hf with ⟨φ, hφ⟩ rcases hg with ⟨θ, hθ⟩ refine ⟨φ ⊔ θ, ?_⟩ ext rw [hφ, hθ, mem_setOf_eq, Formula.realize_sup, mem_union, mem_setOf_eq, mem_setOf_eq] #align set.definable.union Set.Definable.union theorem definable_finset_inf {ι : Type*} {f : ι → Set (α → M)} (hf : ∀ i, A.Definable L (f i)) (s : Finset ι) : A.Definable L (s.inf f) := by classical refine Finset.induction definable_univ (fun i s _ h => ?_) s rw [Finset.inf_insert] exact (hf i).inter h #align set.definable_finset_inf Set.definable_finset_inf theorem definable_finset_sup {ι : Type*} {f : ι → Set (α → M)} (hf : ∀ i, A.Definable L (f i)) (s : Finset ι) : A.Definable L (s.sup f) := by classical refine Finset.induction definable_empty (fun i s _ h => ?_) s rw [Finset.sup_insert] exact (hf i).union h #align set.definable_finset_sup Set.definable_finset_sup theorem definable_finset_biInter {ι : Type*} {f : ι → Set (α → M)} (hf : ∀ i, A.Definable L (f i)) (s : Finset ι) : A.Definable L (⋂ i ∈ s, f i) := by rw [← Finset.inf_set_eq_iInter] exact definable_finset_inf hf s #align set.definable_finset_bInter Set.definable_finset_biInter theorem definable_finset_biUnion {ι : Type*} {f : ι → Set (α → M)} (hf : ∀ i, A.Definable L (f i)) (s : Finset ι) : A.Definable L (⋃ i ∈ s, f i) := by rw [← Finset.sup_set_eq_biUnion] exact definable_finset_sup hf s #align set.definable_finset_bUnion Set.definable_finset_biUnion @[simp] theorem Definable.compl {s : Set (α → M)} (hf : A.Definable L s) : A.Definable L sᶜ := by rcases hf with ⟨φ, hφ⟩ refine ⟨φ.not, ?_⟩ ext v rw [hφ, compl_setOf, mem_setOf, mem_setOf, Formula.realize_not] #align set.definable.compl Set.Definable.compl @[simp] theorem Definable.sdiff {s t : Set (α → M)} (hs : A.Definable L s) (ht : A.Definable L t) : A.Definable L (s \ t) := hs.inter ht.compl #align set.definable.sdiff Set.Definable.sdiff
Mathlib/ModelTheory/Definability.lean
167
172
theorem Definable.preimage_comp (f : α → β) {s : Set (α → M)} (h : A.Definable L s) : A.Definable L ((fun g : β → M => g ∘ f) ⁻¹' s) := by
obtain ⟨φ, rfl⟩ := h refine ⟨φ.relabel f, ?_⟩ ext simp only [Set.preimage_setOf_eq, mem_setOf_eq, Formula.realize_relabel]
import Mathlib.Algebra.DirectSum.Module import Mathlib.Algebra.Module.Submodule.Basic #align_import algebra.direct_sum.decomposition from "leanprover-community/mathlib"@"4e861f25ba5ceef42ba0712d8ffeb32f38ad6441" variable {ι R M σ : Type*} open DirectSum namespace DirectSum section AddCommMonoid variable [DecidableEq ι] [AddCommMonoid M] variable [SetLike σ M] [AddSubmonoidClass σ M] (ℳ : ι → σ) class Decomposition where decompose' : M → ⨁ i, ℳ i left_inv : Function.LeftInverse (DirectSum.coeAddMonoidHom ℳ) decompose' right_inv : Function.RightInverse (DirectSum.coeAddMonoidHom ℳ) decompose' #align direct_sum.decomposition DirectSum.Decomposition instance : Subsingleton (Decomposition ℳ) := ⟨fun x y ↦ by cases' x with x xl xr cases' y with y yl yr congr exact Function.LeftInverse.eq_rightInverse xr yl⟩ abbrev Decomposition.ofAddHom (decompose : M →+ ⨁ i, ℳ i) (h_left_inv : (DirectSum.coeAddMonoidHom ℳ).comp decompose = .id _) (h_right_inv : decompose.comp (DirectSum.coeAddMonoidHom ℳ) = .id _) : Decomposition ℳ where decompose' := decompose left_inv := DFunLike.congr_fun h_left_inv right_inv := DFunLike.congr_fun h_right_inv noncomputable def IsInternal.chooseDecomposition (h : IsInternal ℳ) : DirectSum.Decomposition ℳ where decompose' := (Equiv.ofBijective _ h).symm left_inv := (Equiv.ofBijective _ h).right_inv right_inv := (Equiv.ofBijective _ h).left_inv variable [Decomposition ℳ] protected theorem Decomposition.isInternal : DirectSum.IsInternal ℳ := ⟨Decomposition.right_inv.injective, Decomposition.left_inv.surjective⟩ #align direct_sum.decomposition.is_internal DirectSum.Decomposition.isInternal def decompose : M ≃ ⨁ i, ℳ i where toFun := Decomposition.decompose' invFun := DirectSum.coeAddMonoidHom ℳ left_inv := Decomposition.left_inv right_inv := Decomposition.right_inv #align direct_sum.decompose DirectSum.decompose protected theorem Decomposition.inductionOn {p : M → Prop} (h_zero : p 0) (h_homogeneous : ∀ {i} (m : ℳ i), p (m : M)) (h_add : ∀ m m' : M, p m → p m' → p (m + m')) : ∀ m, p m := by let ℳ' : ι → AddSubmonoid M := fun i ↦ (⟨⟨ℳ i, fun x y ↦ AddMemClass.add_mem x y⟩, (ZeroMemClass.zero_mem _)⟩ : AddSubmonoid M) haveI t : DirectSum.Decomposition ℳ' := { decompose' := DirectSum.decompose ℳ left_inv := fun _ ↦ (decompose ℳ).left_inv _ right_inv := fun _ ↦ (decompose ℳ).right_inv _ } have mem : ∀ m, m ∈ iSup ℳ' := fun _m ↦ (DirectSum.IsInternal.addSubmonoid_iSup_eq_top ℳ' (Decomposition.isInternal ℳ')).symm ▸ trivial -- Porting note: needs to use @ even though no implicit argument is provided exact fun m ↦ @AddSubmonoid.iSup_induction _ _ _ ℳ' _ _ (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add -- exact fun m ↦ -- AddSubmonoid.iSup_induction ℳ' (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add #align direct_sum.decomposition.induction_on DirectSum.Decomposition.inductionOn @[simp] theorem Decomposition.decompose'_eq : Decomposition.decompose' = decompose ℳ := rfl #align direct_sum.decomposition.decompose'_eq DirectSum.Decomposition.decompose'_eq @[simp] theorem decompose_symm_of {i : ι} (x : ℳ i) : (decompose ℳ).symm (DirectSum.of _ i x) = x := DirectSum.coeAddMonoidHom_of ℳ _ _ #align direct_sum.decompose_symm_of DirectSum.decompose_symm_of @[simp]
Mathlib/Algebra/DirectSum/Decomposition.lean
127
128
theorem decompose_coe {i : ι} (x : ℳ i) : decompose ℳ (x : M) = DirectSum.of _ i x := by
rw [← decompose_symm_of _, Equiv.apply_symm_apply]
import Mathlib.Probability.Martingale.Convergence import Mathlib.Probability.Martingale.OptionalStopping import Mathlib.Probability.Martingale.Centering #align_import probability.martingale.borel_cantelli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {ℱ : Filtration ℕ m0} {f : ℕ → Ω → ℝ} {ω : Ω} -- TODO: `leastGE` should be defined taking values in `WithTop ℕ` once the `stoppedProcess` -- refactor is complete noncomputable def leastGE (f : ℕ → Ω → ℝ) (r : ℝ) (n : ℕ) := hitting f (Set.Ici r) 0 n #align measure_theory.least_ge MeasureTheory.leastGE theorem Adapted.isStoppingTime_leastGE (r : ℝ) (n : ℕ) (hf : Adapted ℱ f) : IsStoppingTime ℱ (leastGE f r n) := hitting_isStoppingTime hf measurableSet_Ici #align measure_theory.adapted.is_stopping_time_least_ge MeasureTheory.Adapted.isStoppingTime_leastGE theorem leastGE_le {i : ℕ} {r : ℝ} (ω : Ω) : leastGE f r i ω ≤ i := hitting_le ω #align measure_theory.least_ge_le MeasureTheory.leastGE_le -- The following four lemmas shows `leastGE` behaves like a stopped process. Ideally we should -- define `leastGE` as a stopping time and take its stopped process. However, we can't do that -- with our current definition since a stopping time takes only finite indicies. An upcomming -- refactor should hopefully make it possible to have stopping times taking infinity as a value theorem leastGE_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGE f r n ω ≤ leastGE f r m ω := hitting_mono hnm #align measure_theory.least_ge_mono MeasureTheory.leastGE_mono theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) : leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by classical refine le_antisymm (le_min (leastGE_le _) (leastGE_mono (hπn ω) r ω)) ?_ by_cases hle : π ω ≤ leastGE f r n ω · rw [min_eq_left hle, leastGE] by_cases h : ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r · refine hle.trans (Eq.le ?_) rw [leastGE, ← hitting_eq_hitting_of_exists (hπn ω) h] · simp only [hitting, if_neg h, le_rfl] · rw [min_eq_right (not_le.1 hle).le, leastGE, leastGE, ← hitting_eq_hitting_of_exists (hπn ω) _] rw [not_le, leastGE, hitting_lt_iff _ (hπn ω)] at hle exact let ⟨j, hj₁, hj₂⟩ := hle ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩ #align measure_theory.least_ge_eq_min MeasureTheory.leastGE_eq_min theorem stoppedValue_stoppedValue_leastGE (f : ℕ → Ω → ℝ) (π : Ω → ℕ) (r : ℝ) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) : stoppedValue (fun i => stoppedValue f (leastGE f r i)) π = stoppedValue (stoppedProcess f (leastGE f r n)) π := by ext1 ω simp (config := { unfoldPartialApp := true }) only [stoppedProcess, stoppedValue] rw [leastGE_eq_min _ _ _ hπn] #align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGE theorem Submartingale.stoppedValue_leastGE [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) : Submartingale (fun i => stoppedValue f (leastGE f r i)) ℱ μ := by rw [submartingale_iff_expected_stoppedValue_mono] · intro σ π hσ hπ hσ_le_π hπ_bdd obtain ⟨n, hπ_le_n⟩ := hπ_bdd simp_rw [stoppedValue_stoppedValue_leastGE f σ r fun i => (hσ_le_π i).trans (hπ_le_n i)] simp_rw [stoppedValue_stoppedValue_leastGE f π r hπ_le_n] refine hf.expected_stoppedValue_mono ?_ ?_ ?_ fun ω => (min_le_left _ _).trans (hπ_le_n ω) · exact hσ.min (hf.adapted.isStoppingTime_leastGE _ _) · exact hπ.min (hf.adapted.isStoppingTime_leastGE _ _) · exact fun ω => min_le_min (hσ_le_π ω) le_rfl · exact fun i => stronglyMeasurable_stoppedValue_of_le hf.adapted.progMeasurable_of_discrete (hf.adapted.isStoppingTime_leastGE _ _) leastGE_le · exact fun i => integrable_stoppedValue _ (hf.adapted.isStoppingTime_leastGE _ _) hf.integrable leastGE_le #align measure_theory.submartingale.stopped_value_least_ge MeasureTheory.Submartingale.stoppedValue_leastGE variable {r : ℝ} {R : ℝ≥0} theorem norm_stoppedValue_leastGE_le (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) : ∀ᵐ ω ∂μ, stoppedValue f (leastGE f r i) ω ≤ r + R := by filter_upwards [hbdd] with ω hbddω change f (leastGE f r i ω) ω ≤ r + R by_cases heq : leastGE f r i ω = 0 · rw [heq, hf0, Pi.zero_apply] exact add_nonneg hr R.coe_nonneg · obtain ⟨k, hk⟩ := Nat.exists_eq_succ_of_ne_zero heq rw [hk, add_comm, ← sub_le_iff_le_add] have := not_mem_of_lt_hitting (hk.symm ▸ k.lt_succ_self : k < leastGE f r i ω) (zero_le _) simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, not_or, not_le] at this exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _)) #align measure_theory.norm_stopped_value_least_ge_le MeasureTheory.norm_stoppedValue_leastGE_le theorem Submartingale.stoppedValue_leastGE_snorm_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) : snorm (stoppedValue f (leastGE f r i)) 1 μ ≤ 2 * μ Set.univ * ENNReal.ofReal (r + R) := by refine snorm_one_le_of_le' ((hf.stoppedValue_leastGE r).integrable _) ?_ (norm_stoppedValue_leastGE_le hr hf0 hbdd i) rw [← integral_univ] refine le_trans ?_ ((hf.stoppedValue_leastGE r).setIntegral_le (zero_le _) MeasurableSet.univ) simp_rw [stoppedValue, leastGE, hitting_of_le le_rfl, hf0, integral_zero', le_rfl] #align measure_theory.submartingale.stopped_value_least_ge_snorm_le MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le theorem Submartingale.stoppedValue_leastGE_snorm_le' [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) : snorm (stoppedValue f (leastGE f r i)) 1 μ ≤ ENNReal.toNNReal (2 * μ Set.univ * ENNReal.ofReal (r + R)) := by refine (hf.stoppedValue_leastGE_snorm_le hr hf0 hbdd i).trans ?_ simp [ENNReal.coe_toNNReal (measure_ne_top μ _), ENNReal.coe_toNNReal] #align measure_theory.submartingale.stopped_value_least_ge_snorm_le' MeasureTheory.Submartingale.stoppedValue_leastGE_snorm_le' theorem Submartingale.exists_tendsto_of_abs_bddAbove_aux [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) : ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) → ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) := by have ht : ∀ᵐ ω ∂μ, ∀ i : ℕ, ∃ c, Tendsto (fun n => stoppedValue f (leastGE f i n) ω) atTop (𝓝 c) := by rw [ae_all_iff] exact fun i => Submartingale.exists_ae_tendsto_of_bdd (hf.stoppedValue_leastGE i) (hf.stoppedValue_leastGE_snorm_le' i.cast_nonneg hf0 hbdd) filter_upwards [ht] with ω hω hωb rw [BddAbove] at hωb obtain ⟨i, hi⟩ := exists_nat_gt hωb.some have hib : ∀ n, f n ω < i := by intro n exact lt_of_le_of_lt ((mem_upperBounds.1 hωb.some_mem) _ ⟨n, rfl⟩) hi have heq : ∀ n, stoppedValue f (leastGE f i n) ω = f n ω := by intro n rw [leastGE]; unfold hitting; rw [stoppedValue] rw [if_neg] simp only [Set.mem_Icc, Set.mem_union, Set.mem_Ici] push_neg exact fun j _ => hib j simp only [← heq, hω i] #align measure_theory.submartingale.exists_tendsto_of_abs_bdd_above_aux MeasureTheory.Submartingale.exists_tendsto_of_abs_bddAbove_aux theorem Submartingale.bddAbove_iff_exists_tendsto_aux [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) : ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) := by filter_upwards [hf.exists_tendsto_of_abs_bddAbove_aux hf0 hbdd] with ω hω using ⟨hω, fun ⟨c, hc⟩ => hc.bddAbove_range⟩ #align measure_theory.submartingale.bdd_above_iff_exists_tendsto_aux MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto_aux theorem Submartingale.bddAbove_iff_exists_tendsto [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) : ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ ∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c) := by set g : ℕ → Ω → ℝ := fun n ω => f n ω - f 0 ω have hg : Submartingale g ℱ μ := hf.sub_martingale (martingale_const_fun _ _ (hf.adapted 0) (hf.integrable 0)) have hg0 : g 0 = 0 := by ext ω simp only [g, sub_self, Pi.zero_apply] have hgbdd : ∀ᵐ ω ∂μ, ∀ i : ℕ, |g (i + 1) ω - g i ω| ≤ ↑R := by simpa only [g, sub_sub_sub_cancel_right] filter_upwards [hg.bddAbove_iff_exists_tendsto_aux hg0 hgbdd] with ω hω convert hω using 1 · refine ⟨fun h => ?_, fun h => ?_⟩ <;> obtain ⟨b, hb⟩ := h <;> refine ⟨b + |f 0 ω|, fun y hy => ?_⟩ <;> obtain ⟨n, rfl⟩ := hy · simp_rw [g, sub_eq_add_neg] exact add_le_add (hb ⟨n, rfl⟩) (neg_le_abs _) · exact sub_le_iff_le_add.1 (le_trans (sub_le_sub_left (le_abs_self _) _) (hb ⟨n, rfl⟩)) · refine ⟨fun h => ?_, fun h => ?_⟩ <;> obtain ⟨c, hc⟩ := h · exact ⟨c - f 0 ω, hc.sub_const _⟩ · refine ⟨c + f 0 ω, ?_⟩ have := hc.add_const (f 0 ω) simpa only [g, sub_add_cancel] #align measure_theory.submartingale.bdd_above_iff_exists_tendsto MeasureTheory.Submartingale.bddAbove_iff_exists_tendsto theorem Martingale.bddAbove_range_iff_bddBelow_range [IsFiniteMeasure μ] (hf : Martingale f ℱ μ) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) : ∀ᵐ ω ∂μ, BddAbove (Set.range fun n => f n ω) ↔ BddBelow (Set.range fun n => f n ω) := by have hbdd' : ∀ᵐ ω ∂μ, ∀ i, |(-f) (i + 1) ω - (-f) i ω| ≤ R := by filter_upwards [hbdd] with ω hω i erw [← abs_neg, neg_sub, sub_neg_eq_add, neg_add_eq_sub] exact hω i have hup := hf.submartingale.bddAbove_iff_exists_tendsto hbdd have hdown := hf.neg.submartingale.bddAbove_iff_exists_tendsto hbdd' filter_upwards [hup, hdown] with ω hω₁ hω₂ have : (∃ c, Tendsto (fun n => f n ω) atTop (𝓝 c)) ↔ ∃ c, Tendsto (fun n => (-f) n ω) atTop (𝓝 c) := by constructor <;> rintro ⟨c, hc⟩ · exact ⟨-c, hc.neg⟩ · refine ⟨-c, ?_⟩ convert hc.neg simp only [neg_neg, Pi.neg_apply] rw [hω₁, this, ← hω₂] constructor <;> rintro ⟨c, hc⟩ <;> refine ⟨-c, fun ω hω => ?_⟩ · rw [mem_upperBounds] at hc refine neg_le.2 (hc _ ?_) simpa only [Pi.neg_apply, Set.mem_range, neg_inj] · rw [mem_lowerBounds] at hc simp_rw [Set.mem_range, Pi.neg_apply, neg_eq_iff_eq_neg] at hω refine le_neg.1 (hc _ ?_) simpa only [Set.mem_range] #align measure_theory.martingale.bdd_above_range_iff_bdd_below_range MeasureTheory.Martingale.bddAbove_range_iff_bddBelow_range theorem Martingale.ae_not_tendsto_atTop_atTop [IsFiniteMeasure μ] (hf : Martingale f ℱ μ) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) : ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atTop := by filter_upwards [hf.bddAbove_range_iff_bddBelow_range hbdd] with ω hω htop using unbounded_of_tendsto_atTop htop (hω.2 <| bddBelow_range_of_tendsto_atTop_atTop htop) #align measure_theory.martingale.ae_not_tendsto_at_top_at_top MeasureTheory.Martingale.ae_not_tendsto_atTop_atTop
Mathlib/Probability/Martingale/BorelCantelli.lean
270
274
theorem Martingale.ae_not_tendsto_atTop_atBot [IsFiniteMeasure μ] (hf : Martingale f ℱ μ) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) : ∀ᵐ ω ∂μ, ¬Tendsto (fun n => f n ω) atTop atBot := by
filter_upwards [hf.bddAbove_range_iff_bddBelow_range hbdd] with ω hω htop using unbounded_of_tendsto_atBot htop (hω.1 <| bddAbove_range_of_tendsto_atTop_atBot htop)
import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Order.OrderClosed #align_import topology.algebra.with_zero_topology from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064" open Topology Filter TopologicalSpace Filter Set Function namespace WithZeroTopology variable {α Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] {γ γ₁ γ₂ : Γ₀} {l : Filter α} {f : α → Γ₀} scoped instance (priority := 100) topologicalSpace : TopologicalSpace Γ₀ := nhdsAdjoint 0 <| ⨅ γ ≠ 0, 𝓟 (Iio γ) #align with_zero_topology.topological_space WithZeroTopology.topologicalSpace theorem nhds_eq_update : (𝓝 : Γ₀ → Filter Γ₀) = update pure 0 (⨅ γ ≠ 0, 𝓟 (Iio γ)) := by rw [nhds_nhdsAdjoint, sup_of_le_right] exact le_iInf₂ fun γ hγ ↦ le_principal_iff.2 <| zero_lt_iff.2 hγ #align with_zero_topology.nhds_eq_update WithZeroTopology.nhds_eq_update theorem nhds_zero : 𝓝 (0 : Γ₀) = ⨅ γ ≠ 0, 𝓟 (Iio γ) := by rw [nhds_eq_update, update_same] #align with_zero_topology.nhds_zero WithZeroTopology.nhds_zero theorem hasBasis_nhds_zero : (𝓝 (0 : Γ₀)).HasBasis (fun γ : Γ₀ => γ ≠ 0) Iio := by rw [nhds_zero] refine hasBasis_biInf_principal ?_ ⟨1, one_ne_zero⟩ exact directedOn_iff_directed.2 (Monotone.directed_ge fun a b hab => Iio_subset_Iio hab) #align with_zero_topology.has_basis_nhds_zero WithZeroTopology.hasBasis_nhds_zero theorem Iio_mem_nhds_zero (hγ : γ ≠ 0) : Iio γ ∈ 𝓝 (0 : Γ₀) := hasBasis_nhds_zero.mem_of_mem hγ #align with_zero_topology.Iio_mem_nhds_zero WithZeroTopology.Iio_mem_nhds_zero theorem nhds_zero_of_units (γ : Γ₀ˣ) : Iio ↑γ ∈ 𝓝 (0 : Γ₀) := Iio_mem_nhds_zero γ.ne_zero #align with_zero_topology.nhds_zero_of_units WithZeroTopology.nhds_zero_of_units theorem tendsto_zero : Tendsto f l (𝓝 (0 : Γ₀)) ↔ ∀ (γ₀) (_ : γ₀ ≠ 0), ∀ᶠ x in l, f x < γ₀ := by simp [nhds_zero] #align with_zero_topology.tendsto_zero WithZeroTopology.tendsto_zero @[simp] theorem nhds_of_ne_zero {γ : Γ₀} (h₀ : γ ≠ 0) : 𝓝 γ = pure γ := nhds_nhdsAdjoint_of_ne _ h₀ #align with_zero_topology.nhds_of_ne_zero WithZeroTopology.nhds_of_ne_zero theorem nhds_coe_units (γ : Γ₀ˣ) : 𝓝 (γ : Γ₀) = pure (γ : Γ₀) := nhds_of_ne_zero γ.ne_zero #align with_zero_topology.nhds_coe_units WithZeroTopology.nhds_coe_units theorem singleton_mem_nhds_of_units (γ : Γ₀ˣ) : ({↑γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp #align with_zero_topology.singleton_mem_nhds_of_units WithZeroTopology.singleton_mem_nhds_of_units theorem singleton_mem_nhds_of_ne_zero (h : γ ≠ 0) : ({γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp [h] #align with_zero_topology.singleton_mem_nhds_of_ne_zero WithZeroTopology.singleton_mem_nhds_of_ne_zero theorem hasBasis_nhds_of_ne_zero {x : Γ₀} (h : x ≠ 0) : HasBasis (𝓝 x) (fun _ : Unit => True) fun _ => {x} := by rw [nhds_of_ne_zero h] exact hasBasis_pure _ #align with_zero_topology.has_basis_nhds_of_ne_zero WithZeroTopology.hasBasis_nhds_of_ne_zero theorem hasBasis_nhds_units (γ : Γ₀ˣ) : HasBasis (𝓝 (γ : Γ₀)) (fun _ : Unit => True) fun _ => {↑γ} := hasBasis_nhds_of_ne_zero γ.ne_zero #align with_zero_topology.has_basis_nhds_units WithZeroTopology.hasBasis_nhds_units theorem tendsto_of_ne_zero {γ : Γ₀} (h : γ ≠ 0) : Tendsto f l (𝓝 γ) ↔ ∀ᶠ x in l, f x = γ := by rw [nhds_of_ne_zero h, tendsto_pure] #align with_zero_topology.tendsto_of_ne_zero WithZeroTopology.tendsto_of_ne_zero theorem tendsto_units {γ₀ : Γ₀ˣ} : Tendsto f l (𝓝 (γ₀ : Γ₀)) ↔ ∀ᶠ x in l, f x = γ₀ := tendsto_of_ne_zero γ₀.ne_zero #align with_zero_topology.tendsto_units WithZeroTopology.tendsto_units theorem Iio_mem_nhds (h : γ₁ < γ₂) : Iio γ₂ ∈ 𝓝 γ₁ := by rcases eq_or_ne γ₁ 0 with (rfl | h₀) <;> simp [*, h.ne', Iio_mem_nhds_zero] #align with_zero_topology.Iio_mem_nhds WithZeroTopology.Iio_mem_nhds theorem isOpen_iff {s : Set Γ₀} : IsOpen s ↔ (0 : Γ₀) ∉ s ∨ ∃ γ, γ ≠ 0 ∧ Iio γ ⊆ s := by rw [isOpen_iff_mem_nhds, ← and_forall_ne (0 : Γ₀)] simp (config := { contextual := true }) [nhds_of_ne_zero, imp_iff_not_or, hasBasis_nhds_zero.mem_iff] #align with_zero_topology.is_open_iff WithZeroTopology.isOpen_iff
Mathlib/Topology/Algebra/WithZeroTopology.lean
142
144
theorem isClosed_iff {s : Set Γ₀} : IsClosed s ↔ (0 : Γ₀) ∈ s ∨ ∃ γ, γ ≠ 0 ∧ s ⊆ Ici γ := by
simp only [← isOpen_compl_iff, isOpen_iff, mem_compl_iff, not_not, ← compl_Ici, compl_subset_compl]
import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.BilinearForm.DualLattice import Mathlib.RingTheory.DedekindDomain.Basic import Mathlib.RingTheory.Localization.Module import Mathlib.RingTheory.Trace #align_import ring_theory.dedekind_domain.integral_closure from "leanprover-community/mathlib"@"4cf7ca0e69e048b006674cf4499e5c7d296a89e0" variable (R A K : Type*) [CommRing R] [CommRing A] [Field K] open scoped nonZeroDivisors Polynomial variable [IsDomain A] section IsIntegralClosure open Algebra variable [Algebra A K] [IsFractionRing A K] variable (L : Type*) [Field L] (C : Type*) [CommRing C] variable [Algebra K L] [Algebra A L] [IsScalarTower A K L] variable [Algebra C L] [IsIntegralClosure C A L] [Algebra A C] [IsScalarTower A C L]
Mathlib/RingTheory/DedekindDomain/IntegralClosure.lean
65
83
theorem IsIntegralClosure.isLocalization [Algebra.IsAlgebraic K L] : IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
haveI : IsDomain C := (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L) haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L refine ⟨?_, fun z => ?_, fun {x y} h => ⟨1, ?_⟩⟩ · rintro ⟨_, x, hx, rfl⟩ rw [isUnit_iff_ne_zero, map_ne_zero_iff _ (IsIntegralClosure.algebraMap_injective C A L), Subtype.coe_mk, map_ne_zero_iff _ (NoZeroSMulDivisors.algebraMap_injective A C)] exact mem_nonZeroDivisors_iff_ne_zero.mp hx · obtain ⟨m, hm⟩ := IsIntegral.exists_multiple_integral_of_isLocalization A⁰ z (Algebra.IsIntegral.isIntegral (R := K) z) obtain ⟨x, hx⟩ : ∃ x, algebraMap C L x = m • z := IsIntegralClosure.isIntegral_iff.mp hm refine ⟨⟨x, algebraMap A C m, m, SetLike.coe_mem m, rfl⟩, ?_⟩ rw [Subtype.coe_mk, ← IsScalarTower.algebraMap_apply, hx, mul_comm, Submonoid.smul_def, smul_def] · simp only [IsIntegralClosure.algebraMap_injective C A L h]
import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Data.Real.Sqrt import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed.group.quotient from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open QuotientAddGroup Metric Set Topology NNReal variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N] noncomputable instance normOnQuotient (S : AddSubgroup M) : Norm (M ⧸ S) where norm x := sInf (norm '' { m | mk' S m = x }) #align norm_on_quotient normOnQuotient theorem AddSubgroup.quotient_norm_eq {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = sInf (norm '' { m : M | (m : M ⧸ S) = x }) := rfl #align add_subgroup.quotient_norm_eq AddSubgroup.quotient_norm_eq theorem QuotientAddGroup.norm_eq_infDist {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = infDist 0 { m : M | (m : M ⧸ S) = x } := by simp only [AddSubgroup.quotient_norm_eq, infDist_eq_iInf, sInf_image', dist_zero_left] theorem QuotientAddGroup.norm_mk {S : AddSubgroup M} (x : M) : ‖(x : M ⧸ S)‖ = infDist x S := by rw [norm_eq_infDist, ← infDist_image (IsometryEquiv.subLeft x).isometry, IsometryEquiv.subLeft_apply, sub_zero, ← IsometryEquiv.preimage_symm] congr 1 with y simp only [mem_preimage, IsometryEquiv.subLeft_symm_apply, mem_setOf_eq, QuotientAddGroup.eq, neg_add, neg_neg, neg_add_cancel_right, SetLike.mem_coe] theorem image_norm_nonempty {S : AddSubgroup M} (x : M ⧸ S) : (norm '' { m | mk' S m = x }).Nonempty := .image _ <| Quot.exists_rep x #align image_norm_nonempty image_norm_nonempty theorem bddBelow_image_norm (s : Set M) : BddBelow (norm '' s) := ⟨0, forall_mem_image.2 fun _ _ ↦ norm_nonneg _⟩ #align bdd_below_image_norm bddBelow_image_norm theorem isGLB_quotient_norm {S : AddSubgroup M} (x : M ⧸ S) : IsGLB (norm '' { m | mk' S m = x }) (‖x‖) := isGLB_csInf (image_norm_nonempty x) (bddBelow_image_norm _) theorem quotient_norm_neg {S : AddSubgroup M} (x : M ⧸ S) : ‖-x‖ = ‖x‖ := by simp only [AddSubgroup.quotient_norm_eq] congr 1 with r constructor <;> { rintro ⟨m, hm, rfl⟩; use -m; simpa [neg_eq_iff_eq_neg] using hm } #align quotient_norm_neg quotient_norm_neg theorem quotient_norm_sub_rev {S : AddSubgroup M} (x y : M ⧸ S) : ‖x - y‖ = ‖y - x‖ := by rw [← neg_sub, quotient_norm_neg] #align quotient_norm_sub_rev quotient_norm_sub_rev theorem quotient_norm_mk_le (S : AddSubgroup M) (m : M) : ‖mk' S m‖ ≤ ‖m‖ := csInf_le (bddBelow_image_norm _) <| Set.mem_image_of_mem _ rfl #align quotient_norm_mk_le quotient_norm_mk_le theorem quotient_norm_mk_le' (S : AddSubgroup M) (m : M) : ‖(m : M ⧸ S)‖ ≤ ‖m‖ := quotient_norm_mk_le S m #align quotient_norm_mk_le' quotient_norm_mk_le' theorem quotient_norm_mk_eq (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = sInf ((‖m + ·‖) '' S) := by rw [mk'_apply, norm_mk, sInf_image', ← infDist_image isometry_neg, image_neg, neg_coe_set (H := S), infDist_eq_iInf] simp only [dist_eq_norm', sub_neg_eq_add, add_comm] #align quotient_norm_mk_eq quotient_norm_mk_eq theorem quotient_norm_nonneg (S : AddSubgroup M) (x : M ⧸ S) : 0 ≤ ‖x‖ := Real.sInf_nonneg _ <| forall_mem_image.2 fun _ _ ↦ norm_nonneg _ #align quotient_norm_nonneg quotient_norm_nonneg theorem norm_mk_nonneg (S : AddSubgroup M) (m : M) : 0 ≤ ‖mk' S m‖ := quotient_norm_nonneg S _ #align norm_mk_nonneg norm_mk_nonneg theorem quotient_norm_eq_zero_iff (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = 0 ↔ m ∈ closure (S : Set M) := by rw [mk'_apply, norm_mk, ← mem_closure_iff_infDist_zero] exact ⟨0, S.zero_mem⟩ #align quotient_norm_eq_zero_iff quotient_norm_eq_zero_iff
Mathlib/Analysis/Normed/Group/Quotient.lean
187
190
theorem QuotientAddGroup.norm_lt_iff {S : AddSubgroup M} {x : M ⧸ S} {r : ℝ} : ‖x‖ < r ↔ ∃ m : M, ↑m = x ∧ ‖m‖ < r := by
rw [isGLB_lt_iff (isGLB_quotient_norm _), exists_mem_image] rfl
import Mathlib.Tactic.CategoryTheory.Reassoc #align_import category_theory.isomorphism from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" universe v u -- morphism levels before object levels. See note [CategoryTheory universes]. namespace CategoryTheory open Category structure Iso {C : Type u} [Category.{v} C] (X Y : C) where hom : X ⟶ Y inv : Y ⟶ X hom_inv_id : hom ≫ inv = 𝟙 X := by aesop_cat inv_hom_id : inv ≫ hom = 𝟙 Y := by aesop_cat #align category_theory.iso CategoryTheory.Iso #align category_theory.iso.hom CategoryTheory.Iso.hom #align category_theory.iso.inv CategoryTheory.Iso.inv #align category_theory.iso.inv_hom_id CategoryTheory.Iso.inv_hom_id #align category_theory.iso.hom_inv_id CategoryTheory.Iso.hom_inv_id attribute [reassoc (attr := simp)] Iso.hom_inv_id Iso.inv_hom_id #align category_theory.iso.hom_inv_id_assoc CategoryTheory.Iso.hom_inv_id_assoc #align category_theory.iso.inv_hom_id_assoc CategoryTheory.Iso.inv_hom_id_assoc infixr:10 " ≅ " => Iso -- type as \cong or \iso variable {C : Type u} [Category.{v} C] {X Y Z : C} namespace Iso @[ext] theorem ext ⦃α β : X ≅ Y⦄ (w : α.hom = β.hom) : α = β := suffices α.inv = β.inv by cases α cases β cases w cases this rfl calc α.inv = α.inv ≫ β.hom ≫ β.inv := by rw [Iso.hom_inv_id, Category.comp_id] _ = (α.inv ≫ α.hom) ≫ β.inv := by rw [Category.assoc, ← w] _ = β.inv := by rw [Iso.inv_hom_id, Category.id_comp] #align category_theory.iso.ext CategoryTheory.Iso.ext @[symm] def symm (I : X ≅ Y) : Y ≅ X where hom := I.inv inv := I.hom #align category_theory.iso.symm CategoryTheory.Iso.symm @[simp] theorem symm_hom (α : X ≅ Y) : α.symm.hom = α.inv := rfl #align category_theory.iso.symm_hom CategoryTheory.Iso.symm_hom @[simp] theorem symm_inv (α : X ≅ Y) : α.symm.inv = α.hom := rfl #align category_theory.iso.symm_inv CategoryTheory.Iso.symm_inv @[simp] theorem symm_mk {X Y : C} (hom : X ⟶ Y) (inv : Y ⟶ X) (hom_inv_id) (inv_hom_id) : Iso.symm { hom, inv, hom_inv_id := hom_inv_id, inv_hom_id := inv_hom_id } = { hom := inv, inv := hom, hom_inv_id := inv_hom_id, inv_hom_id := hom_inv_id } := rfl #align category_theory.iso.symm_mk CategoryTheory.Iso.symm_mk @[simp] theorem symm_symm_eq {X Y : C} (α : X ≅ Y) : α.symm.symm = α := by cases α; rfl #align category_theory.iso.symm_symm_eq CategoryTheory.Iso.symm_symm_eq @[simp] theorem symm_eq_iff {X Y : C} {α β : X ≅ Y} : α.symm = β.symm ↔ α = β := ⟨fun h => symm_symm_eq α ▸ symm_symm_eq β ▸ congr_arg symm h, congr_arg symm⟩ #align category_theory.iso.symm_eq_iff CategoryTheory.Iso.symm_eq_iff theorem nonempty_iso_symm (X Y : C) : Nonempty (X ≅ Y) ↔ Nonempty (Y ≅ X) := ⟨fun h => ⟨h.some.symm⟩, fun h => ⟨h.some.symm⟩⟩ #align category_theory.iso.nonempty_iso_symm CategoryTheory.Iso.nonempty_iso_symm @[refl, simps] def refl (X : C) : X ≅ X where hom := 𝟙 X inv := 𝟙 X #align category_theory.iso.refl CategoryTheory.Iso.refl #align category_theory.iso.refl_inv CategoryTheory.Iso.refl_inv #align category_theory.iso.refl_hom CategoryTheory.Iso.refl_hom instance : Inhabited (X ≅ X) := ⟨Iso.refl X⟩ theorem nonempty_iso_refl (X : C) : Nonempty (X ≅ X) := ⟨default⟩ @[simp] theorem refl_symm (X : C) : (Iso.refl X).symm = Iso.refl X := rfl #align category_theory.iso.refl_symm CategoryTheory.Iso.refl_symm -- Porting note: It seems that the trans `trans` attribute isn't working properly -- in this case, so we have to manually add a `Trans` instance (with a `simps` tag). @[trans, simps] def trans (α : X ≅ Y) (β : Y ≅ Z) : X ≅ Z where hom := α.hom ≫ β.hom inv := β.inv ≫ α.inv #align category_theory.iso.trans CategoryTheory.Iso.trans #align category_theory.iso.trans_hom CategoryTheory.Iso.trans_hom #align category_theory.iso.trans_inv CategoryTheory.Iso.trans_inv @[simps] instance instTransIso : Trans (α := C) (· ≅ ·) (· ≅ ·) (· ≅ ·) where trans := trans infixr:80 " ≪≫ " => Iso.trans -- type as `\ll \gg`. @[simp] theorem trans_mk {X Y Z : C} (hom : X ⟶ Y) (inv : Y ⟶ X) (hom_inv_id) (inv_hom_id) (hom' : Y ⟶ Z) (inv' : Z ⟶ Y) (hom_inv_id') (inv_hom_id') (hom_inv_id'') (inv_hom_id'') : Iso.trans ⟨hom, inv, hom_inv_id, inv_hom_id⟩ ⟨hom', inv', hom_inv_id', inv_hom_id'⟩ = ⟨hom ≫ hom', inv' ≫ inv, hom_inv_id'', inv_hom_id''⟩ := rfl #align category_theory.iso.trans_mk CategoryTheory.Iso.trans_mk @[simp] theorem trans_symm (α : X ≅ Y) (β : Y ≅ Z) : (α ≪≫ β).symm = β.symm ≪≫ α.symm := rfl #align category_theory.iso.trans_symm CategoryTheory.Iso.trans_symm @[simp] theorem trans_assoc {Z' : C} (α : X ≅ Y) (β : Y ≅ Z) (γ : Z ≅ Z') : (α ≪≫ β) ≪≫ γ = α ≪≫ β ≪≫ γ := by ext; simp only [trans_hom, Category.assoc] #align category_theory.iso.trans_assoc CategoryTheory.Iso.trans_assoc @[simp] theorem refl_trans (α : X ≅ Y) : Iso.refl X ≪≫ α = α := by ext; apply Category.id_comp #align category_theory.iso.refl_trans CategoryTheory.Iso.refl_trans @[simp] theorem trans_refl (α : X ≅ Y) : α ≪≫ Iso.refl Y = α := by ext; apply Category.comp_id #align category_theory.iso.trans_refl CategoryTheory.Iso.trans_refl @[simp] theorem symm_self_id (α : X ≅ Y) : α.symm ≪≫ α = Iso.refl Y := ext α.inv_hom_id #align category_theory.iso.symm_self_id CategoryTheory.Iso.symm_self_id @[simp] theorem self_symm_id (α : X ≅ Y) : α ≪≫ α.symm = Iso.refl X := ext α.hom_inv_id #align category_theory.iso.self_symm_id CategoryTheory.Iso.self_symm_id @[simp] theorem symm_self_id_assoc (α : X ≅ Y) (β : Y ≅ Z) : α.symm ≪≫ α ≪≫ β = β := by rw [← trans_assoc, symm_self_id, refl_trans] #align category_theory.iso.symm_self_id_assoc CategoryTheory.Iso.symm_self_id_assoc @[simp] theorem self_symm_id_assoc (α : X ≅ Y) (β : X ≅ Z) : α ≪≫ α.symm ≪≫ β = β := by rw [← trans_assoc, self_symm_id, refl_trans] #align category_theory.iso.self_symm_id_assoc CategoryTheory.Iso.self_symm_id_assoc theorem inv_comp_eq (α : X ≅ Y) {f : X ⟶ Z} {g : Y ⟶ Z} : α.inv ≫ f = g ↔ f = α.hom ≫ g := ⟨fun H => by simp [H.symm], fun H => by simp [H]⟩ #align category_theory.iso.inv_comp_eq CategoryTheory.Iso.inv_comp_eq theorem eq_inv_comp (α : X ≅ Y) {f : X ⟶ Z} {g : Y ⟶ Z} : g = α.inv ≫ f ↔ α.hom ≫ g = f := (inv_comp_eq α.symm).symm #align category_theory.iso.eq_inv_comp CategoryTheory.Iso.eq_inv_comp theorem comp_inv_eq (α : X ≅ Y) {f : Z ⟶ Y} {g : Z ⟶ X} : f ≫ α.inv = g ↔ f = g ≫ α.hom := ⟨fun H => by simp [H.symm], fun H => by simp [H]⟩ #align category_theory.iso.comp_inv_eq CategoryTheory.Iso.comp_inv_eq theorem eq_comp_inv (α : X ≅ Y) {f : Z ⟶ Y} {g : Z ⟶ X} : g = f ≫ α.inv ↔ g ≫ α.hom = f := (comp_inv_eq α.symm).symm #align category_theory.iso.eq_comp_inv CategoryTheory.Iso.eq_comp_inv theorem inv_eq_inv (f g : X ≅ Y) : f.inv = g.inv ↔ f.hom = g.hom := have : ∀ {X Y : C} (f g : X ≅ Y), f.hom = g.hom → f.inv = g.inv := fun f g h => by rw [ext h] ⟨this f.symm g.symm, this f g⟩ #align category_theory.iso.inv_eq_inv CategoryTheory.Iso.inv_eq_inv theorem hom_comp_eq_id (α : X ≅ Y) {f : Y ⟶ X} : α.hom ≫ f = 𝟙 X ↔ f = α.inv := by rw [← eq_inv_comp, comp_id] #align category_theory.iso.hom_comp_eq_id CategoryTheory.Iso.hom_comp_eq_id theorem comp_hom_eq_id (α : X ≅ Y) {f : Y ⟶ X} : f ≫ α.hom = 𝟙 Y ↔ f = α.inv := by rw [← eq_comp_inv, id_comp] #align category_theory.iso.comp_hom_eq_id CategoryTheory.Iso.comp_hom_eq_id theorem inv_comp_eq_id (α : X ≅ Y) {f : X ⟶ Y} : α.inv ≫ f = 𝟙 Y ↔ f = α.hom := hom_comp_eq_id α.symm #align category_theory.iso.inv_comp_eq_id CategoryTheory.Iso.inv_comp_eq_id theorem comp_inv_eq_id (α : X ≅ Y) {f : X ⟶ Y} : f ≫ α.inv = 𝟙 X ↔ f = α.hom := comp_hom_eq_id α.symm #align category_theory.iso.comp_inv_eq_id CategoryTheory.Iso.comp_inv_eq_id
Mathlib/CategoryTheory/Iso.lean
248
250
theorem hom_eq_inv (α : X ≅ Y) (β : Y ≅ X) : α.hom = β.inv ↔ β.hom = α.inv := by
erw [inv_eq_inv α.symm β, eq_comm] rfl
import Mathlib.Data.SetLike.Fintype import Mathlib.Algebra.Divisibility.Prod import Mathlib.RingTheory.Nakayama import Mathlib.RingTheory.SimpleModule import Mathlib.Tactic.RSuffices #align_import ring_theory.artinian from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90" open Set Filter Pointwise class IsArtinian (R M) [Semiring R] [AddCommMonoid M] [Module R M] : Prop where wellFounded_submodule_lt' : WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) #align is_artinian IsArtinian section variable {R M P N : Type*} variable [Ring R] [AddCommGroup M] [AddCommGroup P] [AddCommGroup N] variable [Module R M] [Module R P] [Module R N] open IsArtinian theorem IsArtinian.wellFounded_submodule_lt (R M) [Semiring R] [AddCommMonoid M] [Module R M] [IsArtinian R M] : WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) := IsArtinian.wellFounded_submodule_lt' #align is_artinian.well_founded_submodule_lt IsArtinian.wellFounded_submodule_lt theorem isArtinian_of_injective (f : M →ₗ[R] P) (h : Function.Injective f) [IsArtinian R P] : IsArtinian R M := ⟨Subrelation.wf (fun {A B} hAB => show A.map f < B.map f from Submodule.map_strictMono_of_injective h hAB) (InvImage.wf (Submodule.map f) (IsArtinian.wellFounded_submodule_lt R P))⟩ #align is_artinian_of_injective isArtinian_of_injective instance isArtinian_submodule' [IsArtinian R M] (N : Submodule R M) : IsArtinian R N := isArtinian_of_injective N.subtype Subtype.val_injective #align is_artinian_submodule' isArtinian_submodule' theorem isArtinian_of_le {s t : Submodule R M} [IsArtinian R t] (h : s ≤ t) : IsArtinian R s := isArtinian_of_injective (Submodule.inclusion h) (Submodule.inclusion_injective h) #align is_artinian_of_le isArtinian_of_le variable (M) theorem isArtinian_of_surjective (f : M →ₗ[R] P) (hf : Function.Surjective f) [IsArtinian R M] : IsArtinian R P := ⟨Subrelation.wf (fun {A B} hAB => show A.comap f < B.comap f from Submodule.comap_strictMono_of_surjective hf hAB) (InvImage.wf (Submodule.comap f) (IsArtinian.wellFounded_submodule_lt R M))⟩ #align is_artinian_of_surjective isArtinian_of_surjective variable {M} theorem isArtinian_of_linearEquiv (f : M ≃ₗ[R] P) [IsArtinian R M] : IsArtinian R P := isArtinian_of_surjective _ f.toLinearMap f.toEquiv.surjective #align is_artinian_of_linear_equiv isArtinian_of_linearEquiv theorem isArtinian_of_range_eq_ker [IsArtinian R M] [IsArtinian R P] (f : M →ₗ[R] N) (g : N →ₗ[R] P) (hf : Function.Injective f) (hg : Function.Surjective g) (h : LinearMap.range f = LinearMap.ker g) : IsArtinian R N := ⟨wellFounded_lt_exact_sequence (IsArtinian.wellFounded_submodule_lt R M) (IsArtinian.wellFounded_submodule_lt R P) (LinearMap.range f) (Submodule.map f) (Submodule.comap f) (Submodule.comap g) (Submodule.map g) (Submodule.gciMapComap hf) (Submodule.giMapComap hg) (by simp [Submodule.map_comap_eq, inf_comm]) (by simp [Submodule.comap_map_eq, h])⟩ #align is_artinian_of_range_eq_ker isArtinian_of_range_eq_ker instance isArtinian_prod [IsArtinian R M] [IsArtinian R P] : IsArtinian R (M × P) := isArtinian_of_range_eq_ker (LinearMap.inl R M P) (LinearMap.snd R M P) LinearMap.inl_injective LinearMap.snd_surjective (LinearMap.range_inl R M P) #align is_artinian_prod isArtinian_prod instance (priority := 100) isArtinian_of_finite [Finite M] : IsArtinian R M := ⟨Finite.wellFounded_of_trans_of_irrefl _⟩ #align is_artinian_of_finite isArtinian_of_finite -- Porting note: elab_as_elim can only be global and cannot be changed on an imported decl -- attribute [local elab_as_elim] Finite.induction_empty_option instance isArtinian_pi {R ι : Type*} [Finite ι] : ∀ {M : ι → Type*} [Ring R] [∀ i, AddCommGroup (M i)], ∀ [∀ i, Module R (M i)], ∀ [∀ i, IsArtinian R (M i)], IsArtinian R (∀ i, M i) := by apply Finite.induction_empty_option _ _ _ ι · intro α β e hα M _ _ _ _ have := @hα exact isArtinian_of_linearEquiv (LinearEquiv.piCongrLeft R M e) · intro M _ _ _ _ infer_instance · intro α _ ih M _ _ _ _ have := @ih exact isArtinian_of_linearEquiv (LinearEquiv.piOptionEquivProd R).symm #align is_artinian_pi isArtinian_pi instance isArtinian_pi' {R ι M : Type*} [Ring R] [AddCommGroup M] [Module R M] [Finite ι] [IsArtinian R M] : IsArtinian R (ι → M) := isArtinian_pi #align is_artinian_pi' isArtinian_pi' --porting note (#10754): new instance instance isArtinian_finsupp {R ι M : Type*} [Ring R] [AddCommGroup M] [Module R M] [Finite ι] [IsArtinian R M] : IsArtinian R (ι →₀ M) := isArtinian_of_linearEquiv (Finsupp.linearEquivFunOnFinite _ _ _).symm end open IsArtinian Submodule Function section Ring variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] theorem isArtinian_iff_wellFounded : IsArtinian R M ↔ WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) := ⟨fun h => h.1, IsArtinian.mk⟩ #align is_artinian_iff_well_founded isArtinian_iff_wellFounded theorem IsArtinian.finite_of_linearIndependent [Nontrivial R] [IsArtinian R M] {s : Set M} (hs : LinearIndependent R ((↑) : s → M)) : s.Finite := by refine by_contradiction fun hf => (RelEmbedding.wellFounded_iff_no_descending_seq.1 (wellFounded_submodule_lt (R := R) (M := M))).elim' ?_ have f : ℕ ↪ s := Set.Infinite.natEmbedding s hf have : ∀ n, (↑) ∘ f '' { m | n ≤ m } ⊆ s := by rintro n x ⟨y, _, rfl⟩ exact (f y).2 have : ∀ a b : ℕ, a ≤ b ↔ span R (Subtype.val ∘ f '' { m | b ≤ m }) ≤ span R (Subtype.val ∘ f '' { m | a ≤ m }) := by intro a b rw [span_le_span_iff hs (this b) (this a), Set.image_subset_image_iff (Subtype.coe_injective.comp f.injective), Set.subset_def] simp only [Set.mem_setOf_eq] exact ⟨fun hab x => le_trans hab, fun h => h _ le_rfl⟩ exact ⟨⟨fun n => span R (Subtype.val ∘ f '' { m | n ≤ m }), fun x y => by rw [le_antisymm_iff, ← this y x, ← this x y] exact fun ⟨h₁, h₂⟩ => le_antisymm_iff.2 ⟨h₂, h₁⟩⟩, by intro a b conv_rhs => rw [GT.gt, lt_iff_le_not_le, this, this, ← lt_iff_le_not_le] rfl⟩ #align is_artinian.finite_of_linear_independent IsArtinian.finite_of_linearIndependent theorem set_has_minimal_iff_artinian : (∀ a : Set <| Submodule R M, a.Nonempty → ∃ M' ∈ a, ∀ I ∈ a, ¬I < M') ↔ IsArtinian R M := by rw [isArtinian_iff_wellFounded, WellFounded.wellFounded_iff_has_min] #align set_has_minimal_iff_artinian set_has_minimal_iff_artinian theorem IsArtinian.set_has_minimal [IsArtinian R M] (a : Set <| Submodule R M) (ha : a.Nonempty) : ∃ M' ∈ a, ∀ I ∈ a, ¬I < M' := set_has_minimal_iff_artinian.mpr ‹_› a ha #align is_artinian.set_has_minimal IsArtinian.set_has_minimal theorem monotone_stabilizes_iff_artinian : (∀ f : ℕ →o (Submodule R M)ᵒᵈ, ∃ n, ∀ m, n ≤ m → f n = f m) ↔ IsArtinian R M := by rw [isArtinian_iff_wellFounded] exact WellFounded.monotone_chain_condition.symm #align monotone_stabilizes_iff_artinian monotone_stabilizes_iff_artinian abbrev IsArtinianRing (R) [Ring R] := IsArtinian R R #align is_artinian_ring IsArtinianRing theorem isArtinianRing_iff {R} [Ring R] : IsArtinianRing R ↔ IsArtinian R R := Iff.rfl #align is_artinian_ring_iff isArtinianRing_iff instance DivisionRing.instIsArtinianRing {K : Type*} [DivisionRing K] : IsArtinianRing K := ⟨Finite.wellFounded_of_trans_of_irrefl _⟩ theorem Ring.isArtinian_of_zero_eq_one {R} [Ring R] (h01 : (0 : R) = 1) : IsArtinianRing R := have := subsingleton_of_zero_eq_one h01 inferInstance #align ring.is_artinian_of_zero_eq_one Ring.isArtinian_of_zero_eq_one theorem isArtinian_of_submodule_of_artinian (R M) [Ring R] [AddCommGroup M] [Module R M] (N : Submodule R M) (_ : IsArtinian R M) : IsArtinian R N := inferInstance #align is_artinian_of_submodule_of_artinian isArtinian_of_submodule_of_artinian instance isArtinian_of_quotient_of_artinian (R) [Ring R] (M) [AddCommGroup M] [Module R M] (N : Submodule R M) [IsArtinian R M] : IsArtinian R (M ⧸ N) := isArtinian_of_surjective M (Submodule.mkQ N) (Submodule.Quotient.mk_surjective N) #align is_artinian_of_quotient_of_artinian isArtinian_of_quotient_of_artinian theorem isArtinian_of_tower (R) {S M} [CommRing R] [Ring S] [AddCommGroup M] [Algebra R S] [Module S M] [Module R M] [IsScalarTower R S M] (h : IsArtinian R M) : IsArtinian S M := by rw [isArtinian_iff_wellFounded] at h ⊢ exact (Submodule.restrictScalarsEmbedding R S M).wellFounded h #align is_artinian_of_tower isArtinian_of_tower instance (R) [CommRing R] [IsArtinianRing R] (I : Ideal R) : IsArtinianRing (R ⧸ I) := isArtinian_of_tower R inferInstance
Mathlib/RingTheory/Artinian.lean
396
411
theorem isArtinian_of_fg_of_artinian {R M} [Ring R] [AddCommGroup M] [Module R M] (N : Submodule R M) [IsArtinianRing R] (hN : N.FG) : IsArtinian R N := by
let ⟨s, hs⟩ := hN haveI := Classical.decEq M haveI := Classical.decEq R have : ∀ x ∈ s, x ∈ N := fun x hx => hs ▸ Submodule.subset_span hx refine @isArtinian_of_surjective _ ((↑s : Set M) →₀ R) N _ _ _ _ _ ?_ ?_ isArtinian_finsupp · exact Finsupp.total (↑s : Set M) N R (fun i => ⟨i, hs ▸ subset_span i.2⟩) · rw [← LinearMap.range_eq_top, eq_top_iff, ← map_le_map_iff_of_injective (show Injective (Submodule.subtype N) from Subtype.val_injective), Submodule.map_top, range_subtype, ← Submodule.map_top, ← Submodule.map_comp, Submodule.map_top] subst N refine span_le.2 (fun i hi => ?_) use Finsupp.single ⟨i, hi⟩ 1 simp
import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact import Mathlib.Topology.QuasiSeparated #align_import algebraic_geometry.morphisms.quasi_separated from "leanprover-community/mathlib"@"1a51edf13debfcbe223fa06b1cb353b9ed9751cc" noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe u open scoped AlgebraicGeometry namespace AlgebraicGeometry variable {X Y : Scheme.{u}} (f : X ⟶ Y) @[mk_iff] class QuasiSeparated (f : X ⟶ Y) : Prop where diagonalQuasiCompact : QuasiCompact (pullback.diagonal f) := by infer_instance #align algebraic_geometry.quasi_separated AlgebraicGeometry.QuasiSeparated def QuasiSeparated.affineProperty : AffineTargetMorphismProperty := fun X _ _ _ => QuasiSeparatedSpace X.carrier #align algebraic_geometry.quasi_separated.affine_property AlgebraicGeometry.QuasiSeparated.affineProperty theorem quasiSeparatedSpace_iff_affine (X : Scheme) : QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by rw [quasiSeparatedSpace_iff] constructor · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact · intro H suffices ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1), IsCompact (U ⊓ V).1 by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV' intro U hU V hV -- Porting note: it complains "unable to find motive", but telling Lean that motive is -- underscore is actually sufficient, weird apply compact_open_induction_on (P := _) V hV · simp · intro S _ V hV change IsCompact (U.1 ∩ (S.1 ∪ V.1)) rw [Set.inter_union_distrib_left] apply hV.union clear hV apply compact_open_induction_on (P := _) U hU · simp · intro S _ W hW change IsCompact ((S.1 ∪ W.1) ∩ V.1) rw [Set.union_inter_distrib_right] apply hW.union apply H #align algebraic_geometry.quasi_separated_space_iff_affine AlgebraicGeometry.quasiSeparatedSpace_iff_affine theorem quasi_compact_affineProperty_iff_quasiSeparatedSpace {X Y : Scheme} [IsAffine Y] (f : X ⟶ Y) : QuasiCompact.affineProperty.diagonal f ↔ QuasiSeparatedSpace X.carrier := by delta AffineTargetMorphismProperty.diagonal rw [quasiSeparatedSpace_iff_affine] constructor · intro H U V haveI : IsAffine _ := U.2 haveI : IsAffine _ := V.2 let g : pullback (X.ofRestrict U.1.openEmbedding) (X.ofRestrict V.1.openEmbedding) ⟶ X := pullback.fst ≫ X.ofRestrict _ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e erw [Subtype.range_coe, Subtype.range_coe] at e rw [isCompact_iff_compactSpace] exact @Homeomorph.compactSpace _ _ _ _ (H _ _) e · introv H h₁ h₂ let g : pullback f₁ f₂ ⟶ X := pullback.fst ≫ f₁ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e simp_rw [isCompact_iff_compactSpace] at H exact @Homeomorph.compactSpace _ _ _ _ (H ⟨⟨_, h₁.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩ ⟨⟨_, h₂.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩) e.symm #align algebraic_geometry.quasi_compact_affine_property_iff_quasi_separated_space AlgebraicGeometry.quasi_compact_affineProperty_iff_quasiSeparatedSpace theorem quasiSeparated_eq_diagonal_is_quasiCompact : @QuasiSeparated = MorphismProperty.diagonal @QuasiCompact := by ext; exact quasiSeparated_iff _ #align algebraic_geometry.quasi_separated_eq_diagonal_is_quasi_compact AlgebraicGeometry.quasiSeparated_eq_diagonal_is_quasiCompact theorem quasi_compact_affineProperty_diagonal_eq : QuasiCompact.affineProperty.diagonal = QuasiSeparated.affineProperty := by funext; rw [quasi_compact_affineProperty_iff_quasiSeparatedSpace]; rfl #align algebraic_geometry.quasi_compact_affine_property_diagonal_eq AlgebraicGeometry.quasi_compact_affineProperty_diagonal_eq theorem quasiSeparated_eq_affineProperty_diagonal : @QuasiSeparated = targetAffineLocally QuasiCompact.affineProperty.diagonal := by rw [quasiSeparated_eq_diagonal_is_quasiCompact, quasiCompact_eq_affineProperty] exact diagonal_targetAffineLocally_eq_targetAffineLocally _ QuasiCompact.affineProperty_isLocal #align algebraic_geometry.quasi_separated_eq_affine_property_diagonal AlgebraicGeometry.quasiSeparated_eq_affineProperty_diagonal theorem quasiSeparated_eq_affineProperty : @QuasiSeparated = targetAffineLocally QuasiSeparated.affineProperty := by rw [quasiSeparated_eq_affineProperty_diagonal, quasi_compact_affineProperty_diagonal_eq] #align algebraic_geometry.quasi_separated_eq_affine_property AlgebraicGeometry.quasiSeparated_eq_affineProperty theorem QuasiSeparated.affineProperty_isLocal : QuasiSeparated.affineProperty.IsLocal := quasi_compact_affineProperty_diagonal_eq ▸ QuasiCompact.affineProperty_isLocal.diagonal #align algebraic_geometry.quasi_separated.affine_property_is_local AlgebraicGeometry.QuasiSeparated.affineProperty_isLocal instance (priority := 900) quasiSeparatedOfMono {X Y : Scheme} (f : X ⟶ Y) [Mono f] : QuasiSeparated f where #align algebraic_geometry.quasi_separated_of_mono AlgebraicGeometry.quasiSeparatedOfMono instance quasiSeparated_isStableUnderComposition : MorphismProperty.IsStableUnderComposition @QuasiSeparated := quasiSeparated_eq_diagonal_is_quasiCompact.symm ▸ (MorphismProperty.diagonal_isStableUnderComposition quasiCompact_respectsIso quasiCompact_stableUnderBaseChange) #align algebraic_geometry.quasi_separated_stable_under_composition AlgebraicGeometry.quasiSeparated_isStableUnderComposition theorem quasiSeparated_stableUnderBaseChange : MorphismProperty.StableUnderBaseChange @QuasiSeparated := quasiSeparated_eq_diagonal_is_quasiCompact.symm ▸ quasiCompact_stableUnderBaseChange.diagonal quasiCompact_respectsIso #align algebraic_geometry.quasi_separated_stable_under_base_change AlgebraicGeometry.quasiSeparated_stableUnderBaseChange instance quasiSeparatedComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [QuasiSeparated f] [QuasiSeparated g] : QuasiSeparated (f ≫ g) := MorphismProperty.comp_mem _ f g inferInstance inferInstance #align algebraic_geometry.quasi_separated_comp AlgebraicGeometry.quasiSeparatedComp theorem quasiSeparated_respectsIso : MorphismProperty.RespectsIso @QuasiSeparated := quasiSeparated_eq_diagonal_is_quasiCompact.symm ▸ quasiCompact_respectsIso.diagonal #align algebraic_geometry.quasi_separated_respects_iso AlgebraicGeometry.quasiSeparated_respectsIso open List in theorem QuasiSeparated.affine_openCover_TFAE {X Y : Scheme.{u}} (f : X ⟶ Y) : TFAE [QuasiSeparated f, ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)), ∀ i : 𝒰.J, QuasiSeparatedSpace (pullback f (𝒰.map i)).carrier, ∀ (𝒰 : Scheme.OpenCover.{u} Y) [∀ i, IsAffine (𝒰.obj i)] (i : 𝒰.J), QuasiSeparatedSpace (pullback f (𝒰.map i)).carrier, ∀ {U : Scheme} (g : U ⟶ Y) [IsAffine U] [IsOpenImmersion g], QuasiSeparatedSpace (pullback f g).carrier, ∃ (𝒰 : Scheme.OpenCover.{u} Y) (_ : ∀ i, IsAffine (𝒰.obj i)) (𝒰' : ∀ i : 𝒰.J, Scheme.OpenCover.{u} (pullback f (𝒰.map i))) (_ : ∀ i j, IsAffine ((𝒰' i).obj j)), ∀ (i : 𝒰.J) (j k : (𝒰' i).J), CompactSpace (pullback ((𝒰' i).map j) ((𝒰' i).map k)).carrier] := by have := QuasiCompact.affineProperty_isLocal.diagonal_affine_openCover_TFAE f simp_rw [← quasiCompact_eq_affineProperty, ← quasiSeparated_eq_diagonal_is_quasiCompact, quasi_compact_affineProperty_diagonal_eq] at this exact this #align algebraic_geometry.quasi_separated.affine_open_cover_tfae AlgebraicGeometry.QuasiSeparated.affine_openCover_TFAE theorem QuasiSeparated.is_local_at_target : PropertyIsLocalAtTarget @QuasiSeparated := quasiSeparated_eq_affineProperty_diagonal.symm ▸ QuasiCompact.affineProperty_isLocal.diagonal.targetAffineLocallyIsLocal #align algebraic_geometry.quasi_separated.is_local_at_target AlgebraicGeometry.QuasiSeparated.is_local_at_target open List in theorem QuasiSeparated.openCover_TFAE {X Y : Scheme.{u}} (f : X ⟶ Y) : TFAE [QuasiSeparated f, ∃ 𝒰 : Scheme.OpenCover.{u} Y, ∀ i : 𝒰.J, QuasiSeparated (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i), ∀ (𝒰 : Scheme.OpenCover.{u} Y) (i : 𝒰.J), QuasiSeparated (pullback.snd : (𝒰.pullbackCover f).obj i ⟶ 𝒰.obj i), ∀ U : Opens Y.carrier, QuasiSeparated (f ∣_ U), ∀ {U : Scheme} (g : U ⟶ Y) [IsOpenImmersion g], QuasiSeparated (pullback.snd : pullback f g ⟶ _), ∃ (ι : Type u) (U : ι → Opens Y.carrier) (_ : iSup U = ⊤), ∀ i, QuasiSeparated (f ∣_ U i)] := QuasiSeparated.is_local_at_target.openCover_TFAE f #align algebraic_geometry.quasi_separated.open_cover_tfae AlgebraicGeometry.QuasiSeparated.openCover_TFAE theorem quasiSeparated_over_affine_iff {X Y : Scheme} (f : X ⟶ Y) [IsAffine Y] : QuasiSeparated f ↔ QuasiSeparatedSpace X.carrier := by rw [quasiSeparated_eq_affineProperty, QuasiSeparated.affineProperty_isLocal.affine_target_iff f, QuasiSeparated.affineProperty] #align algebraic_geometry.quasi_separated_over_affine_iff AlgebraicGeometry.quasiSeparated_over_affine_iff theorem quasiSeparatedSpace_iff_quasiSeparated (X : Scheme) : QuasiSeparatedSpace X.carrier ↔ QuasiSeparated (terminal.from X) := (quasiSeparated_over_affine_iff _).symm #align algebraic_geometry.quasi_separated_space_iff_quasi_separated AlgebraicGeometry.quasiSeparatedSpace_iff_quasiSeparated theorem QuasiSeparated.affine_openCover_iff {X Y : Scheme.{u}} (𝒰 : Scheme.OpenCover.{u} Y) [∀ i, IsAffine (𝒰.obj i)] (f : X ⟶ Y) : QuasiSeparated f ↔ ∀ i, QuasiSeparatedSpace (pullback f (𝒰.map i)).carrier := by rw [quasiSeparated_eq_affineProperty, QuasiSeparated.affineProperty_isLocal.affine_openCover_iff f 𝒰] rfl #align algebraic_geometry.quasi_separated.affine_open_cover_iff AlgebraicGeometry.QuasiSeparated.affine_openCover_iff theorem QuasiSeparated.openCover_iff {X Y : Scheme.{u}} (𝒰 : Scheme.OpenCover.{u} Y) (f : X ⟶ Y) : QuasiSeparated f ↔ ∀ i, QuasiSeparated (pullback.snd : pullback f (𝒰.map i) ⟶ _) := QuasiSeparated.is_local_at_target.openCover_iff f 𝒰 #align algebraic_geometry.quasi_separated.open_cover_iff AlgebraicGeometry.QuasiSeparated.openCover_iff instance {X Y S : Scheme} (f : X ⟶ S) (g : Y ⟶ S) [QuasiSeparated g] : QuasiSeparated (pullback.fst : pullback f g ⟶ X) := quasiSeparated_stableUnderBaseChange.fst f g inferInstance instance {X Y S : Scheme} (f : X ⟶ S) (g : Y ⟶ S) [QuasiSeparated f] : QuasiSeparated (pullback.snd : pullback f g ⟶ Y) := quasiSeparated_stableUnderBaseChange.snd f g inferInstance instance {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [QuasiSeparated f] [QuasiSeparated g] : QuasiSeparated (f ≫ g) := MorphismProperty.comp_mem _ f g inferInstance inferInstance theorem quasiSeparatedSpace_of_quasiSeparated {X Y : Scheme} (f : X ⟶ Y) [hY : QuasiSeparatedSpace Y.carrier] [QuasiSeparated f] : QuasiSeparatedSpace X.carrier := by rw [quasiSeparatedSpace_iff_quasiSeparated] at hY ⊢ have : f ≫ terminal.from Y = terminal.from X := terminalIsTerminal.hom_ext _ _ rw [← this] infer_instance #align algebraic_geometry.quasi_separated_space_of_quasi_separated AlgebraicGeometry.quasiSeparatedSpace_of_quasiSeparated instance quasiSeparatedSpace_of_isAffine (X : Scheme) [IsAffine X] : QuasiSeparatedSpace X.carrier := by constructor intro U V hU hU' hV hV' obtain ⟨s, hs, e⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hU', hU⟩ obtain ⟨s', hs', e'⟩ := (isCompact_open_iff_eq_basicOpen_union _).mp ⟨hV', hV⟩ rw [e, e', Set.iUnion₂_inter] simp_rw [Set.inter_iUnion₂] apply hs.isCompact_biUnion intro i _ apply hs'.isCompact_biUnion intro i' _ change IsCompact (X.basicOpen i ⊓ X.basicOpen i').1 rw [← Scheme.basicOpen_mul] exact ((topIsAffineOpen _).basicOpenIsAffine _).isCompact #align algebraic_geometry.quasi_separated_space_of_is_affine AlgebraicGeometry.quasiSeparatedSpace_of_isAffine theorem IsAffineOpen.isQuasiSeparated {X : Scheme} {U : Opens X.carrier} (hU : IsAffineOpen U) : IsQuasiSeparated (U : Set X.carrier) := by rw [isQuasiSeparated_iff_quasiSeparatedSpace] exacts [@AlgebraicGeometry.quasiSeparatedSpace_of_isAffine _ hU, U.isOpen] #align algebraic_geometry.is_affine_open.is_quasi_separated AlgebraicGeometry.IsAffineOpen.isQuasiSeparated theorem quasiSeparatedOfComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [H : QuasiSeparated (f ≫ g)] : QuasiSeparated f := by -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE f).out 0 1` directly fails, but -- give it a name works have h01 := (QuasiSeparated.affine_openCover_TFAE f).out 0 1 rw [h01]; clear h01 -- Porting note: rewrite `(QuasiSeparated.affine_openCover_TFAE ...).out 0 2` directly fails, but -- give it a name works have h02 := (QuasiSeparated.affine_openCover_TFAE (f ≫ g)).out 0 2 rw [h02] at H; clear h02 refine ⟨(Z.affineCover.pullbackCover g).bind fun x => Scheme.affineCover _, ?_, ?_⟩ -- constructor · intro i; dsimp; infer_instance rintro ⟨i, j⟩; dsimp at i j -- replace H := H (Scheme.OpenCover.pullbackCover (Scheme.affineCover Z) g) i specialize H _ i -- rw [← isQuasiSeparated_iff_quasiSeparatedSpace] at H refine @quasiSeparatedSpace_of_quasiSeparated _ _ ?_ H ?_ · exact pullback.map _ _ _ _ (𝟙 _) _ _ (by simp) (Category.comp_id _) ≫ (pullbackRightPullbackFstIso g (Z.affineCover.map i) f).hom · exact inferInstance #align algebraic_geometry.quasi_separated_of_comp AlgebraicGeometry.quasiSeparatedOfComp
Mathlib/AlgebraicGeometry/Morphisms/QuasiSeparated.lean
300
307
theorem exists_eq_pow_mul_of_isAffineOpen (X : Scheme) (U : Opens X.carrier) (hU : IsAffineOpen U) (f : X.presheaf.obj (op U)) (x : X.presheaf.obj (op <| X.basicOpen f)) : ∃ (n : ℕ) (y : X.presheaf.obj (op U)), y |_ X.basicOpen f = (f |_ X.basicOpen f) ^ n * x := by
have := (hU.isLocalization_basicOpen f).2 obtain ⟨⟨y, _, n, rfl⟩, d⟩ := this x use n, y delta TopCat.Presheaf.restrictOpen TopCat.Presheaf.restrict simpa [mul_comm x] using d.symm
import Batteries.Tactic.Init import Batteries.Tactic.Alias import Batteries.Tactic.Lint.Misc instance {f : α → β} [DecidablePred p] : DecidablePred (p ∘ f) := inferInstanceAs <| DecidablePred fun x => p (f x) @[deprecated] alias proofIrrel := proof_irrel theorem Function.id_def : @id α = fun x => x := rfl alias ⟨forall_not_of_not_exists, not_exists_of_forall_not⟩ := not_exists protected alias ⟨Decidable.exists_not_of_not_forall, _⟩ := Decidable.not_forall theorem heq_iff_eq : HEq a b ↔ a = b := ⟨eq_of_heq, heq_of_eq⟩ @[simp] theorem eq_rec_constant {α : Sort _} {a a' : α} {β : Sort _} (y : β) (h : a = a') : (@Eq.rec α a (fun α _ => β) y a' h) = y := by cases h; rfl theorem congrArg₂ (f : α → β → γ) {x x' : α} {y y' : β} (hx : x = x') (hy : y = y') : f x y = f x' y' := by subst hx hy; rfl theorem congrFun₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : f = g) (a : α) (b : β a) : f a b = g a b := congrFun (congrFun h _) _ theorem congrFun₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : f = g) (a : α) (b : β a) (c : γ a b) : f a b c = g a b c := congrFun₂ (congrFun h _) _ _ theorem funext₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : ∀ a b, f a b = g a b) : f = g := funext fun _ => funext <| h _ theorem funext₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : ∀ a b c, f a b c = g a b c) : f = g := funext fun _ => funext₂ <| h _ theorem Function.funext_iff {β : α → Sort u} {f₁ f₂ : ∀ x : α, β x} : f₁ = f₂ ↔ ∀ a, f₁ a = f₂ a := ⟨congrFun, funext⟩ theorem ne_of_apply_ne {α β : Sort _} (f : α → β) {x y : α} : f x ≠ f y → x ≠ y := mt <| congrArg _ protected theorem Eq.congr (h₁ : x₁ = y₁) (h₂ : x₂ = y₂) : x₁ = x₂ ↔ y₁ = y₂ := by subst h₁; subst h₂; rfl theorem Eq.congr_left {x y z : α} (h : x = y) : x = z ↔ y = z := by rw [h] theorem Eq.congr_right {x y z : α} (h : x = y) : z = x ↔ z = y := by rw [h] alias congr_arg := congrArg alias congr_arg₂ := congrArg₂ alias congr_fun := congrFun alias congr_fun₂ := congrFun₂ alias congr_fun₃ := congrFun₃ theorem heq_of_cast_eq : ∀ (e : α = β) (_ : cast e a = a'), HEq a a' | rfl, rfl => .rfl theorem cast_eq_iff_heq : cast e a = a' ↔ HEq a a' := ⟨heq_of_cast_eq _, fun h => by cases h; rfl⟩ theorem eqRec_eq_cast {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') : @Eq.rec α a motive x a' e = cast (e ▸ rfl) x := by subst e; rfl --Porting note: new theorem. More general version of `eqRec_heq` theorem eqRec_heq_self {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') : HEq (@Eq.rec α a motive x a' e) x := by subst e; rfl @[simp] theorem eqRec_heq_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) : HEq (@Eq.rec α a motive x a' e) y ↔ HEq x y := by subst e; rfl @[simp] theorem heq_eqRec_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) : HEq y (@Eq.rec α a motive x a' e) ↔ HEq y x := by subst e; rfl @[simp] theorem not_nonempty_empty : ¬Nonempty Empty := fun ⟨h⟩ => h.elim @[simp] theorem not_nonempty_pempty : ¬Nonempty PEmpty := fun ⟨h⟩ => h.elim -- TODO(Mario): profile first, this is a dangerous instance -- instance (priority := 10) {α} [Subsingleton α] : DecidableEq α -- | a, b => isTrue (Subsingleton.elim a b) -- @[simp] -- TODO(Mario): profile theorem eq_iff_true_of_subsingleton [Subsingleton α] (x y : α) : x = y ↔ True := iff_true_intro (Subsingleton.elim ..) theorem subsingleton_of_forall_eq (x : α) (h : ∀ y, y = x) : Subsingleton α := ⟨fun a b => h a ▸ h b ▸ rfl⟩ theorem subsingleton_iff_forall_eq (x : α) : Subsingleton α ↔ ∀ y, y = x := ⟨fun _ y => Subsingleton.elim y x, subsingleton_of_forall_eq x⟩
.lake/packages/batteries/Batteries/Logic.lean
142
143
theorem congr_eqRec {β : α → Sort _} (f : (x : α) → β x → γ) (h : x = x') (y : β x) : f x' (Eq.rec y h) = f x y := by
cases h; rfl
import Mathlib.Algebra.Group.Hom.Defs import Mathlib.Data.Set.Lattice import Mathlib.Data.SetLike.Basic #align_import group_theory.subsemigroup.basic from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3" assert_not_exists MonoidWithZero -- Only needed for notation variable {M : Type*} {N : Type*} {A : Type*} section NonAssoc variable [Mul M] {s : Set M} variable [Add A] {t : Set A} class MulMemClass (S : Type*) (M : Type*) [Mul M] [SetLike S M] : Prop where mul_mem : ∀ {s : S} {a b : M}, a ∈ s → b ∈ s → a * b ∈ s #align mul_mem_class MulMemClass export MulMemClass (mul_mem) class AddMemClass (S : Type*) (M : Type*) [Add M] [SetLike S M] : Prop where add_mem : ∀ {s : S} {a b : M}, a ∈ s → b ∈ s → a + b ∈ s #align add_mem_class AddMemClass export AddMemClass (add_mem) attribute [to_additive] MulMemClass attribute [aesop safe apply (rule_sets := [SetLike])] mul_mem add_mem structure Subsemigroup (M : Type*) [Mul M] where carrier : Set M mul_mem' {a b} : a ∈ carrier → b ∈ carrier → a * b ∈ carrier #align subsemigroup Subsemigroup structure AddSubsemigroup (M : Type*) [Add M] where carrier : Set M add_mem' {a b} : a ∈ carrier → b ∈ carrier → a + b ∈ carrier #align add_subsemigroup AddSubsemigroup attribute [to_additive AddSubsemigroup] Subsemigroup namespace Subsemigroup @[to_additive] instance : SetLike (Subsemigroup M) M := ⟨Subsemigroup.carrier, fun p q h => by cases p; cases q; congr⟩ @[to_additive] instance : MulMemClass (Subsemigroup M) M where mul_mem := fun {_ _ _} => Subsemigroup.mul_mem' _ initialize_simps_projections Subsemigroup (carrier → coe) initialize_simps_projections AddSubsemigroup (carrier → coe) @[to_additive (attr := simp)] theorem mem_carrier {s : Subsemigroup M} {x : M} : x ∈ s.carrier ↔ x ∈ s := Iff.rfl #align subsemigroup.mem_carrier Subsemigroup.mem_carrier #align add_subsemigroup.mem_carrier AddSubsemigroup.mem_carrier @[to_additive (attr := simp)] theorem mem_mk {s : Set M} {x : M} (h_mul) : x ∈ mk s h_mul ↔ x ∈ s := Iff.rfl #align subsemigroup.mem_mk Subsemigroup.mem_mk #align add_subsemigroup.mem_mk AddSubsemigroup.mem_mk @[to_additive (attr := simp, norm_cast)] theorem coe_set_mk {s : Set M} (h_mul) : (mk s h_mul : Set M) = s := rfl #align subsemigroup.coe_set_mk Subsemigroup.coe_set_mk #align add_subsemigroup.coe_set_mk AddSubsemigroup.coe_set_mk @[to_additive (attr := simp)] theorem mk_le_mk {s t : Set M} (h_mul) (h_mul') : mk s h_mul ≤ mk t h_mul' ↔ s ⊆ t := Iff.rfl #align subsemigroup.mk_le_mk Subsemigroup.mk_le_mk #align add_subsemigroup.mk_le_mk AddSubsemigroup.mk_le_mk @[to_additive (attr := ext) "Two `AddSubsemigroup`s are equal if they have the same elements."] theorem ext {S T : Subsemigroup M} (h : ∀ x, x ∈ S ↔ x ∈ T) : S = T := SetLike.ext h #align subsemigroup.ext Subsemigroup.ext #align add_subsemigroup.ext AddSubsemigroup.ext @[to_additive "Copy an additive subsemigroup replacing `carrier` with a set that is equal to it."] protected def copy (S : Subsemigroup M) (s : Set M) (hs : s = S) : Subsemigroup M where carrier := s mul_mem' := hs.symm ▸ S.mul_mem' #align subsemigroup.copy Subsemigroup.copy #align add_subsemigroup.copy AddSubsemigroup.copy variable {S : Subsemigroup M} @[to_additive (attr := simp)] theorem coe_copy {s : Set M} (hs : s = S) : (S.copy s hs : Set M) = s := rfl #align subsemigroup.coe_copy Subsemigroup.coe_copy #align add_subsemigroup.coe_copy AddSubsemigroup.coe_copy @[to_additive] theorem copy_eq {s : Set M} (hs : s = S) : S.copy s hs = S := SetLike.coe_injective hs #align subsemigroup.copy_eq Subsemigroup.copy_eq #align add_subsemigroup.copy_eq AddSubsemigroup.copy_eq variable (S) @[to_additive "An `AddSubsemigroup` is closed under addition."] protected theorem mul_mem {x y : M} : x ∈ S → y ∈ S → x * y ∈ S := Subsemigroup.mul_mem' S #align subsemigroup.mul_mem Subsemigroup.mul_mem #align add_subsemigroup.add_mem AddSubsemigroup.add_mem @[to_additive "The additive subsemigroup `M` of the magma `M`."] instance : Top (Subsemigroup M) := ⟨{ carrier := Set.univ mul_mem' := fun _ _ => Set.mem_univ _ }⟩ @[to_additive "The trivial `AddSubsemigroup` `∅` of an additive magma `M`."] instance : Bot (Subsemigroup M) := ⟨{ carrier := ∅ mul_mem' := False.elim }⟩ @[to_additive] instance : Inhabited (Subsemigroup M) := ⟨⊥⟩ @[to_additive] theorem not_mem_bot {x : M} : x ∉ (⊥ : Subsemigroup M) := Set.not_mem_empty x #align subsemigroup.not_mem_bot Subsemigroup.not_mem_bot #align add_subsemigroup.not_mem_bot AddSubsemigroup.not_mem_bot @[to_additive (attr := simp)] theorem mem_top (x : M) : x ∈ (⊤ : Subsemigroup M) := Set.mem_univ x #align subsemigroup.mem_top Subsemigroup.mem_top #align add_subsemigroup.mem_top AddSubsemigroup.mem_top @[to_additive (attr := simp)] theorem coe_top : ((⊤ : Subsemigroup M) : Set M) = Set.univ := rfl #align subsemigroup.coe_top Subsemigroup.coe_top #align add_subsemigroup.coe_top AddSubsemigroup.coe_top @[to_additive (attr := simp)] theorem coe_bot : ((⊥ : Subsemigroup M) : Set M) = ∅ := rfl #align subsemigroup.coe_bot Subsemigroup.coe_bot #align add_subsemigroup.coe_bot AddSubsemigroup.coe_bot @[to_additive "The inf of two `AddSubsemigroup`s is their intersection."] instance : Inf (Subsemigroup M) := ⟨fun S₁ S₂ => { carrier := S₁ ∩ S₂ mul_mem' := fun ⟨hx, hx'⟩ ⟨hy, hy'⟩ => ⟨S₁.mul_mem hx hy, S₂.mul_mem hx' hy'⟩ }⟩ @[to_additive (attr := simp)] theorem coe_inf (p p' : Subsemigroup M) : ((p ⊓ p' : Subsemigroup M) : Set M) = (p : Set M) ∩ p' := rfl #align subsemigroup.coe_inf Subsemigroup.coe_inf #align add_subsemigroup.coe_inf AddSubsemigroup.coe_inf @[to_additive (attr := simp)] theorem mem_inf {p p' : Subsemigroup M} {x : M} : x ∈ p ⊓ p' ↔ x ∈ p ∧ x ∈ p' := Iff.rfl #align subsemigroup.mem_inf Subsemigroup.mem_inf #align add_subsemigroup.mem_inf AddSubsemigroup.mem_inf @[to_additive] instance : InfSet (Subsemigroup M) := ⟨fun s => { carrier := ⋂ t ∈ s, ↑t mul_mem' := fun hx hy => Set.mem_biInter fun i h => i.mul_mem (by apply Set.mem_iInter₂.1 hx i h) (by apply Set.mem_iInter₂.1 hy i h) }⟩ @[to_additive (attr := simp, norm_cast)] theorem coe_sInf (S : Set (Subsemigroup M)) : ((sInf S : Subsemigroup M) : Set M) = ⋂ s ∈ S, ↑s := rfl #align subsemigroup.coe_Inf Subsemigroup.coe_sInf #align add_subsemigroup.coe_Inf AddSubsemigroup.coe_sInf @[to_additive] theorem mem_sInf {S : Set (Subsemigroup M)} {x : M} : x ∈ sInf S ↔ ∀ p ∈ S, x ∈ p := Set.mem_iInter₂ #align subsemigroup.mem_Inf Subsemigroup.mem_sInf #align add_subsemigroup.mem_Inf AddSubsemigroup.mem_sInf @[to_additive] theorem mem_iInf {ι : Sort*} {S : ι → Subsemigroup M} {x : M} : (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i := by simp only [iInf, mem_sInf, Set.forall_mem_range] #align subsemigroup.mem_infi Subsemigroup.mem_iInf #align add_subsemigroup.mem_infi AddSubsemigroup.mem_iInf @[to_additive (attr := simp, norm_cast)] theorem coe_iInf {ι : Sort*} {S : ι → Subsemigroup M} : (↑(⨅ i, S i) : Set M) = ⋂ i, S i := by simp only [iInf, coe_sInf, Set.biInter_range] #align subsemigroup.coe_infi Subsemigroup.coe_iInf #align add_subsemigroup.coe_infi AddSubsemigroup.coe_iInf @[to_additive "The `AddSubsemigroup`s of an `AddMonoid` form a complete lattice."] instance : CompleteLattice (Subsemigroup M) := { completeLatticeOfInf (Subsemigroup M) fun _ => IsGLB.of_image SetLike.coe_subset_coe isGLB_biInf with le := (· ≤ ·) lt := (· < ·) bot := ⊥ bot_le := fun _ _ hx => (not_mem_bot hx).elim top := ⊤ le_top := fun _ x _ => mem_top x inf := (· ⊓ ·) sInf := InfSet.sInf le_inf := fun _ _ _ ha hb _ hx => ⟨ha hx, hb hx⟩ inf_le_left := fun _ _ _ => And.left inf_le_right := fun _ _ _ => And.right } @[to_additive]
Mathlib/Algebra/Group/Subsemigroup/Basic.lean
283
286
theorem subsingleton_of_subsingleton [Subsingleton (Subsemigroup M)] : Subsingleton M := by
constructor; intro x y have : ∀ a : M, a ∈ (⊥ : Subsemigroup M) := by simp [Subsingleton.elim (⊥ : Subsemigroup M) ⊤] exact absurd (this x) not_mem_bot
import Mathlib.Algebra.Order.Group.Nat import Mathlib.Data.List.Rotate import Mathlib.GroupTheory.Perm.Support #align_import group_theory.perm.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace List variable {α β : Type*} section FormPerm variable [DecidableEq α] (l : List α) open Equiv Equiv.Perm def formPerm : Equiv.Perm α := (zipWith Equiv.swap l l.tail).prod #align list.form_perm List.formPerm @[simp] theorem formPerm_nil : formPerm ([] : List α) = 1 := rfl #align list.form_perm_nil List.formPerm_nil @[simp] theorem formPerm_singleton (x : α) : formPerm [x] = 1 := rfl #align list.form_perm_singleton List.formPerm_singleton @[simp] theorem formPerm_cons_cons (x y : α) (l : List α) : formPerm (x :: y :: l) = swap x y * formPerm (y :: l) := prod_cons #align list.form_perm_cons_cons List.formPerm_cons_cons theorem formPerm_pair (x y : α) : formPerm [x, y] = swap x y := rfl #align list.form_perm_pair List.formPerm_pair theorem mem_or_mem_of_zipWith_swap_prod_ne : ∀ {l l' : List α} {x : α}, (zipWith swap l l').prod x ≠ x → x ∈ l ∨ x ∈ l' | [], _, _ => by simp | _, [], _ => by simp | a::l, b::l', x => fun hx ↦ if h : (zipWith swap l l').prod x = x then (eq_or_eq_of_swap_apply_ne_self (by simpa [h] using hx)).imp (by rintro rfl; exact .head _) (by rintro rfl; exact .head _) else (mem_or_mem_of_zipWith_swap_prod_ne h).imp (.tail _) (.tail _) theorem zipWith_swap_prod_support' (l l' : List α) : { x | (zipWith swap l l').prod x ≠ x } ≤ l.toFinset ⊔ l'.toFinset := fun _ h ↦ by simpa using mem_or_mem_of_zipWith_swap_prod_ne h #align list.zip_with_swap_prod_support' List.zipWith_swap_prod_support' theorem zipWith_swap_prod_support [Fintype α] (l l' : List α) : (zipWith swap l l').prod.support ≤ l.toFinset ⊔ l'.toFinset := by intro x hx have hx' : x ∈ { x | (zipWith swap l l').prod x ≠ x } := by simpa using hx simpa using zipWith_swap_prod_support' _ _ hx' #align list.zip_with_swap_prod_support List.zipWith_swap_prod_support theorem support_formPerm_le' : { x | formPerm l x ≠ x } ≤ l.toFinset := by refine (zipWith_swap_prod_support' l l.tail).trans ?_ simpa [Finset.subset_iff] using tail_subset l #align list.support_form_perm_le' List.support_formPerm_le' theorem support_formPerm_le [Fintype α] : support (formPerm l) ≤ l.toFinset := by intro x hx have hx' : x ∈ { x | formPerm l x ≠ x } := by simpa using hx simpa using support_formPerm_le' _ hx' #align list.support_form_perm_le List.support_formPerm_le variable {l} {x : α} theorem mem_of_formPerm_apply_ne (h : l.formPerm x ≠ x) : x ∈ l := by simpa [or_iff_left_of_imp mem_of_mem_tail] using mem_or_mem_of_zipWith_swap_prod_ne h #align list.mem_of_form_perm_apply_ne List.mem_of_formPerm_apply_ne theorem formPerm_apply_of_not_mem (h : x ∉ l) : formPerm l x = x := not_imp_comm.1 mem_of_formPerm_apply_ne h #align list.form_perm_apply_of_not_mem List.formPerm_apply_of_not_mem theorem formPerm_apply_mem_of_mem (h : x ∈ l) : formPerm l x ∈ l := by cases' l with y l · simp at h induction' l with z l IH generalizing x y · simpa using h · by_cases hx : x ∈ z :: l · rw [formPerm_cons_cons, mul_apply, swap_apply_def] split_ifs · simp [IH _ hx] · simp · simp [*] · replace h : x = y := Or.resolve_right (mem_cons.1 h) hx simp [formPerm_apply_of_not_mem hx, ← h] #align list.form_perm_apply_mem_of_mem List.formPerm_apply_mem_of_mem theorem mem_of_formPerm_apply_mem (h : l.formPerm x ∈ l) : x ∈ l := by contrapose h rwa [formPerm_apply_of_not_mem h] #align list.mem_of_form_perm_apply_mem List.mem_of_formPerm_apply_mem @[simp] theorem formPerm_mem_iff_mem : l.formPerm x ∈ l ↔ x ∈ l := ⟨l.mem_of_formPerm_apply_mem, l.formPerm_apply_mem_of_mem⟩ #align list.form_perm_mem_iff_mem List.formPerm_mem_iff_mem @[simp] theorem formPerm_cons_concat_apply_last (x y : α) (xs : List α) : formPerm (x :: (xs ++ [y])) y = x := by induction' xs with z xs IH generalizing x y · simp · simp [IH] #align list.form_perm_cons_concat_apply_last List.formPerm_cons_concat_apply_last @[simp] theorem formPerm_apply_getLast (x : α) (xs : List α) : formPerm (x :: xs) ((x :: xs).getLast (cons_ne_nil x xs)) = x := by induction' xs using List.reverseRecOn with xs y _ generalizing x <;> simp #align list.form_perm_apply_last List.formPerm_apply_getLast @[simp]
Mathlib/GroupTheory/Perm/List.lean
156
158
theorem formPerm_apply_get_length (x : α) (xs : List α) : formPerm (x :: xs) ((x :: xs).get (Fin.mk xs.length (by simp))) = x := by
rw [get_cons_length, formPerm_apply_getLast]; rfl;
import Mathlib.MeasureTheory.Measure.ProbabilityMeasure import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Integral.Layercake import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction #align_import measure_theory.measure.portmanteau from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open MeasureTheory Set Filter BoundedContinuousFunction open scoped Topology ENNReal NNReal BoundedContinuousFunction namespace MeasureTheory section LimsupClosedLEAndLELiminfOpen variable {Ω : Type*} [MeasurableSpace Ω] theorem le_measure_compl_liminf_of_limsup_measure_le {ι : Type*} {L : Filter ι} {μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω} (E_mble : MeasurableSet E) (h : (L.limsup fun i => μs i E) ≤ μ E) : μ Eᶜ ≤ L.liminf fun i => μs i Eᶜ := by rcases L.eq_or_neBot with rfl | hne · simp only [liminf_bot, le_top] have meas_Ec : μ Eᶜ = 1 - μ E := by simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by intro i simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne simp_rw [meas_Ec, meas_i_Ec] have obs : (L.liminf fun i : ι => 1 - μs i E) = L.liminf ((fun x => 1 - x) ∘ fun i : ι => μs i E) := rfl rw [obs] have := antitone_const_tsub.map_limsup_of_continuousAt (F := L) (fun i => μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt simp_rw [← this] exact antitone_const_tsub h #align measure_theory.le_measure_compl_liminf_of_limsup_measure_le MeasureTheory.le_measure_compl_liminf_of_limsup_measure_le theorem le_measure_liminf_of_limsup_measure_compl_le {ι : Type*} {L : Filter ι} {μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω} (E_mble : MeasurableSet E) (h : (L.limsup fun i => μs i Eᶜ) ≤ μ Eᶜ) : μ E ≤ L.liminf fun i => μs i E := compl_compl E ▸ le_measure_compl_liminf_of_limsup_measure_le (MeasurableSet.compl E_mble) h #align measure_theory.le_measure_liminf_of_limsup_measure_compl_le MeasureTheory.le_measure_liminf_of_limsup_measure_compl_le theorem limsup_measure_compl_le_of_le_liminf_measure {ι : Type*} {L : Filter ι} {μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω} (E_mble : MeasurableSet E) (h : μ E ≤ L.liminf fun i => μs i E) : (L.limsup fun i => μs i Eᶜ) ≤ μ Eᶜ := by rcases L.eq_or_neBot with rfl | hne · simp only [limsup_bot, bot_le] have meas_Ec : μ Eᶜ = 1 - μ E := by simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by intro i simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne simp_rw [meas_Ec, meas_i_Ec] have obs : (L.limsup fun i : ι => 1 - μs i E) = L.limsup ((fun x => 1 - x) ∘ fun i : ι => μs i E) := rfl rw [obs] have := antitone_const_tsub.map_liminf_of_continuousAt (F := L) (fun i => μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt simp_rw [← this] exact antitone_const_tsub h #align measure_theory.limsup_measure_compl_le_of_le_liminf_measure MeasureTheory.limsup_measure_compl_le_of_le_liminf_measure theorem limsup_measure_le_of_le_liminf_measure_compl {ι : Type*} {L : Filter ι} {μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω} (E_mble : MeasurableSet E) (h : μ Eᶜ ≤ L.liminf fun i => μs i Eᶜ) : (L.limsup fun i => μs i E) ≤ μ E := compl_compl E ▸ limsup_measure_compl_le_of_le_liminf_measure (MeasurableSet.compl E_mble) h #align measure_theory.limsup_measure_le_of_le_liminf_measure_compl MeasureTheory.limsup_measure_le_of_le_liminf_measure_compl variable [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
Mathlib/MeasureTheory/Measure/Portmanteau.lean
172
183
theorem limsup_measure_closed_le_iff_liminf_measure_open_ge {ι : Type*} {L : Filter ι} {μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] : (∀ F, IsClosed F → (L.limsup fun i => μs i F) ≤ μ F) ↔ ∀ G, IsOpen G → μ G ≤ L.liminf fun i => μs i G := by
constructor · intro h G G_open exact le_measure_liminf_of_limsup_measure_compl_le G_open.measurableSet (h Gᶜ (isClosed_compl_iff.mpr G_open)) · intro h F F_closed exact limsup_measure_le_of_le_liminf_measure_compl F_closed.measurableSet (h Fᶜ (isOpen_compl_iff.mpr F_closed))
import Mathlib.Algebra.Group.Fin import Mathlib.LinearAlgebra.Matrix.Symmetric #align_import linear_algebra.matrix.circulant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" variable {α β m n R : Type*} namespace Matrix open Function open Matrix def circulant [Sub n] (v : n → α) : Matrix n n α := of fun i j => v (i - j) #align matrix.circulant Matrix.circulant -- TODO: set as an equation lemma for `circulant`, see mathlib4#3024 @[simp] theorem circulant_apply [Sub n] (v : n → α) (i j) : circulant v i j = v (i - j) := rfl #align matrix.circulant_apply Matrix.circulant_apply theorem circulant_col_zero_eq [AddGroup n] (v : n → α) (i : n) : circulant v i 0 = v i := congr_arg v (sub_zero _) #align matrix.circulant_col_zero_eq Matrix.circulant_col_zero_eq theorem circulant_injective [AddGroup n] : Injective (circulant : (n → α) → Matrix n n α) := by intro v w h ext k rw [← circulant_col_zero_eq v, ← circulant_col_zero_eq w, h] #align matrix.circulant_injective Matrix.circulant_injective theorem Fin.circulant_injective : ∀ n, Injective fun v : Fin n → α => circulant v | 0 => by simp [Injective] | n + 1 => Matrix.circulant_injective #align matrix.fin.circulant_injective Matrix.Fin.circulant_injective @[simp] theorem circulant_inj [AddGroup n] {v w : n → α} : circulant v = circulant w ↔ v = w := circulant_injective.eq_iff #align matrix.circulant_inj Matrix.circulant_inj @[simp] theorem Fin.circulant_inj {n} {v w : Fin n → α} : circulant v = circulant w ↔ v = w := (Fin.circulant_injective n).eq_iff #align matrix.fin.circulant_inj Matrix.Fin.circulant_inj theorem transpose_circulant [AddGroup n] (v : n → α) : (circulant v)ᵀ = circulant fun i => v (-i) := by ext; simp #align matrix.transpose_circulant Matrix.transpose_circulant theorem conjTranspose_circulant [Star α] [AddGroup n] (v : n → α) : (circulant v)ᴴ = circulant (star fun i => v (-i)) := by ext; simp #align matrix.conj_transpose_circulant Matrix.conjTranspose_circulant theorem Fin.transpose_circulant : ∀ {n} (v : Fin n → α), (circulant v)ᵀ = circulant fun i => v (-i) | 0 => by simp [Injective, eq_iff_true_of_subsingleton] | n + 1 => Matrix.transpose_circulant #align matrix.fin.transpose_circulant Matrix.Fin.transpose_circulant theorem Fin.conjTranspose_circulant [Star α] : ∀ {n} (v : Fin n → α), (circulant v)ᴴ = circulant (star fun i => v (-i)) | 0 => by simp [Injective, eq_iff_true_of_subsingleton] | n + 1 => Matrix.conjTranspose_circulant #align matrix.fin.conj_transpose_circulant Matrix.Fin.conjTranspose_circulant theorem map_circulant [Sub n] (v : n → α) (f : α → β) : (circulant v).map f = circulant fun i => f (v i) := ext fun _ _ => rfl #align matrix.map_circulant Matrix.map_circulant theorem circulant_neg [Neg α] [Sub n] (v : n → α) : circulant (-v) = -circulant v := ext fun _ _ => rfl #align matrix.circulant_neg Matrix.circulant_neg @[simp] theorem circulant_zero (α n) [Zero α] [Sub n] : circulant 0 = (0 : Matrix n n α) := ext fun _ _ => rfl #align matrix.circulant_zero Matrix.circulant_zero theorem circulant_add [Add α] [Sub n] (v w : n → α) : circulant (v + w) = circulant v + circulant w := ext fun _ _ => rfl #align matrix.circulant_add Matrix.circulant_add theorem circulant_sub [Sub α] [Sub n] (v w : n → α) : circulant (v - w) = circulant v - circulant w := ext fun _ _ => rfl #align matrix.circulant_sub Matrix.circulant_sub theorem circulant_mul [Semiring α] [Fintype n] [AddGroup n] (v w : n → α) : circulant v * circulant w = circulant (circulant v *ᵥ w) := by ext i j simp only [mul_apply, mulVec, circulant_apply, dotProduct] refine Fintype.sum_equiv (Equiv.subRight j) _ _ ?_ intro x simp only [Equiv.subRight_apply, sub_sub_sub_cancel_right] #align matrix.circulant_mul Matrix.circulant_mul theorem Fin.circulant_mul [Semiring α] : ∀ {n} (v w : Fin n → α), circulant v * circulant w = circulant (circulant v *ᵥ w) | 0 => by simp [Injective, eq_iff_true_of_subsingleton] | n + 1 => Matrix.circulant_mul #align matrix.fin.circulant_mul Matrix.Fin.circulant_mul theorem circulant_mul_comm [CommSemigroup α] [AddCommMonoid α] [Fintype n] [AddCommGroup n] (v w : n → α) : circulant v * circulant w = circulant w * circulant v := by ext i j simp only [mul_apply, circulant_apply, mul_comm] refine Fintype.sum_equiv ((Equiv.subLeft i).trans (Equiv.addRight j)) _ _ ?_ intro x simp only [Equiv.trans_apply, Equiv.subLeft_apply, Equiv.coe_addRight, add_sub_cancel_right, mul_comm] congr 2 abel #align matrix.circulant_mul_comm Matrix.circulant_mul_comm theorem Fin.circulant_mul_comm [CommSemigroup α] [AddCommMonoid α] : ∀ {n} (v w : Fin n → α), circulant v * circulant w = circulant w * circulant v | 0 => by simp [Injective] | n + 1 => Matrix.circulant_mul_comm #align matrix.fin.circulant_mul_comm Matrix.Fin.circulant_mul_comm theorem circulant_smul [Sub n] [SMul R α] (k : R) (v : n → α) : circulant (k • v) = k • circulant v := rfl #align matrix.circulant_smul Matrix.circulant_smul @[simp]
Mathlib/LinearAlgebra/Matrix/Circulant.lean
166
169
theorem circulant_single_one (α n) [Zero α] [One α] [DecidableEq n] [AddGroup n] : circulant (Pi.single 0 1 : n → α) = (1 : Matrix n n α) := by
ext i j simp [one_apply, Pi.single_apply, sub_eq_zero]
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] -- Porting note: `Ideal.neg_mem_iff` was `neg_mem_iff` on line 142 but Lean was not able to find -- NegMemClass
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
128
138
theorem pow_natDegree_le_of_root_of_monic_mem {x : R} (hroot : IsRoot f x) (hmo : f.Monic) : ∀ i, f.natDegree ≤ i → x ^ i ∈ 𝓟 := by
intro i hi obtain ⟨k, hk⟩ := exists_add_of_le hi rw [hk, pow_add] suffices x ^ f.natDegree ∈ 𝓟 by exact mul_mem_right (x ^ k) 𝓟 this rw [IsRoot.def, eval_eq_sum_range, Finset.range_add_one, Finset.sum_insert Finset.not_mem_range_self, Finset.sum_range, hmo.coeff_natDegree, one_mul] at * rw [eq_neg_of_add_eq_zero_left hroot, Ideal.neg_mem_iff] exact Submodule.sum_mem _ fun i _ => mul_mem_right _ _ (hf.mem (Fin.is_lt i))
import Mathlib.LinearAlgebra.Span import Mathlib.LinearAlgebra.BilinearMap #align_import algebra.module.submodule.bilinear from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940" universe uι u v open Set open Pointwise namespace Submodule variable {ι : Sort uι} {R M N P : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] variable [Module R M] [Module R N] [Module R P] def map₂ (f : M →ₗ[R] N →ₗ[R] P) (p : Submodule R M) (q : Submodule R N) : Submodule R P := ⨆ s : p, q.map (f s) #align submodule.map₂ Submodule.map₂ theorem apply_mem_map₂ (f : M →ₗ[R] N →ₗ[R] P) {m : M} {n : N} {p : Submodule R M} {q : Submodule R N} (hm : m ∈ p) (hn : n ∈ q) : f m n ∈ map₂ f p q := (le_iSup _ ⟨m, hm⟩ : _ ≤ map₂ f p q) ⟨n, hn, by rfl⟩ #align submodule.apply_mem_map₂ Submodule.apply_mem_map₂ theorem map₂_le {f : M →ₗ[R] N →ₗ[R] P} {p : Submodule R M} {q : Submodule R N} {r : Submodule R P} : map₂ f p q ≤ r ↔ ∀ m ∈ p, ∀ n ∈ q, f m n ∈ r := ⟨fun H _m hm _n hn => H <| apply_mem_map₂ _ hm hn, fun H => iSup_le fun ⟨m, hm⟩ => map_le_iff_le_comap.2 fun n hn => H m hm n hn⟩ #align submodule.map₂_le Submodule.map₂_le variable (R) theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) : map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by apply le_antisymm · rw [map₂_le] apply @span_induction' R M _ _ _ s intro a ha apply @span_induction' R N _ _ _ t intro b hb exact subset_span ⟨_, ‹_›, _, ‹_›, rfl⟩ all_goals intros; simp only [*, add_mem, smul_mem, zero_mem, _root_.map_zero, map_add, LinearMap.zero_apply, LinearMap.add_apply, LinearMap.smul_apply, map_smul] · rw [span_le, image2_subset_iff] intro a ha b hb exact apply_mem_map₂ _ (subset_span ha) (subset_span hb) #align submodule.map₂_span_span Submodule.map₂_span_span variable {R} @[simp] theorem map₂_bot_right (f : M →ₗ[R] N →ₗ[R] P) (p : Submodule R M) : map₂ f p ⊥ = ⊥ := eq_bot_iff.2 <| map₂_le.2 fun m _hm n hn => by rw [Submodule.mem_bot] at hn rw [hn, LinearMap.map_zero]; simp only [mem_bot] #align submodule.map₂_bot_right Submodule.map₂_bot_right @[simp] theorem map₂_bot_left (f : M →ₗ[R] N →ₗ[R] P) (q : Submodule R N) : map₂ f ⊥ q = ⊥ := eq_bot_iff.2 <| map₂_le.2 fun m hm n hn => by rw [Submodule.mem_bot] at hm ⊢ rw [hm, LinearMap.map_zero₂] #align submodule.map₂_bot_left Submodule.map₂_bot_left @[mono] theorem map₂_le_map₂ {f : M →ₗ[R] N →ₗ[R] P} {p₁ p₂ : Submodule R M} {q₁ q₂ : Submodule R N} (hp : p₁ ≤ p₂) (hq : q₁ ≤ q₂) : map₂ f p₁ q₁ ≤ map₂ f p₂ q₂ := map₂_le.2 fun _m hm _n hn => apply_mem_map₂ _ (hp hm) (hq hn) #align submodule.map₂_le_map₂ Submodule.map₂_le_map₂ theorem map₂_le_map₂_left {f : M →ₗ[R] N →ₗ[R] P} {p₁ p₂ : Submodule R M} {q : Submodule R N} (h : p₁ ≤ p₂) : map₂ f p₁ q ≤ map₂ f p₂ q := map₂_le_map₂ h (le_refl q) #align submodule.map₂_le_map₂_left Submodule.map₂_le_map₂_left theorem map₂_le_map₂_right {f : M →ₗ[R] N →ₗ[R] P} {p : Submodule R M} {q₁ q₂ : Submodule R N} (h : q₁ ≤ q₂) : map₂ f p q₁ ≤ map₂ f p q₂ := map₂_le_map₂ (le_refl p) h #align submodule.map₂_le_map₂_right Submodule.map₂_le_map₂_right theorem map₂_sup_right (f : M →ₗ[R] N →ₗ[R] P) (p : Submodule R M) (q₁ q₂ : Submodule R N) : map₂ f p (q₁ ⊔ q₂) = map₂ f p q₁ ⊔ map₂ f p q₂ := le_antisymm (map₂_le.2 fun _m hm _np hnp => let ⟨_n, hn, _p, hp, hnp⟩ := mem_sup.1 hnp mem_sup.2 ⟨_, apply_mem_map₂ _ hm hn, _, apply_mem_map₂ _ hm hp, hnp ▸ (map_add _ _ _).symm⟩) (sup_le (map₂_le_map₂_right le_sup_left) (map₂_le_map₂_right le_sup_right)) #align submodule.map₂_sup_right Submodule.map₂_sup_right theorem map₂_sup_left (f : M →ₗ[R] N →ₗ[R] P) (p₁ p₂ : Submodule R M) (q : Submodule R N) : map₂ f (p₁ ⊔ p₂) q = map₂ f p₁ q ⊔ map₂ f p₂ q := le_antisymm (map₂_le.2 fun _mn hmn _p hp => let ⟨_m, hm, _n, hn, hmn⟩ := mem_sup.1 hmn mem_sup.2 ⟨_, apply_mem_map₂ _ hm hp, _, apply_mem_map₂ _ hn hp, hmn ▸ (LinearMap.map_add₂ _ _ _ _).symm⟩) (sup_le (map₂_le_map₂_left le_sup_left) (map₂_le_map₂_left le_sup_right)) #align submodule.map₂_sup_left Submodule.map₂_sup_left
Mathlib/Algebra/Module/Submodule/Bilinear.lean
129
132
theorem image2_subset_map₂ (f : M →ₗ[R] N →ₗ[R] P) (p : Submodule R M) (q : Submodule R N) : Set.image2 (fun m n => f m n) (↑p : Set M) (↑q : Set N) ⊆ (↑(map₂ f p q) : Set P) := by
rintro _ ⟨i, hi, j, hj, rfl⟩ exact apply_mem_map₂ _ hi hj
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Analysis.NormedSpace.HahnBanach.SeparatingDual #align_import analysis.calculus.parametric_integral from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section open TopologicalSpace MeasureTheory Filter Metric open scoped Topology Filter variable {α : Type*} [MeasurableSpace α] {μ : Measure α} {𝕜 : Type*} [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedSpace 𝕜 E] {H : Type*} [NormedAddCommGroup H] [NormedSpace 𝕜 H] variable {F : H → α → E} {x₀ : H} {bound : α → ℝ} {ε : ℝ}
Mathlib/Analysis/Calculus/ParametricIntegral.lean
75
155
theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F' : α → H →L[𝕜] E} (ε_pos : 0 < ε) (hF_meas : ∀ x ∈ ball x₀ ε, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable F' μ) (h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ bound a * ‖x - x₀‖) (bound_integrable : Integrable (bound : α → ℝ) μ) (h_diff : ∀ᵐ a ∂μ, HasFDerivAt (F · a) (F' a) x₀) : Integrable F' μ ∧ HasFDerivAt (fun x ↦ ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos have nneg : ∀ x, 0 ≤ ‖x - x₀‖⁻¹ := fun x ↦ inv_nonneg.mpr (norm_nonneg _) set b : α → ℝ := fun a ↦ |bound a| have b_int : Integrable b μ := bound_integrable.norm have b_nonneg : ∀ a, 0 ≤ b a := fun a ↦ abs_nonneg _ replace h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ := h_lipsch.mono fun a ha x hx ↦ (ha x hx).trans <| mul_le_mul_of_nonneg_right (le_abs_self _) (norm_nonneg _) have hF_int' : ∀ x ∈ ball x₀ ε, Integrable (F x) μ := fun x x_in ↦ by have : ∀ᵐ a ∂μ, ‖F x₀ a - F x a‖ ≤ ε * b a := by simp only [norm_sub_rev (F x₀ _)] refine h_lipsch.mono fun a ha ↦ (ha x x_in).trans ?_ rw [mul_comm ε] rw [mem_ball, dist_eq_norm] at x_in exact mul_le_mul_of_nonneg_left x_in.le (b_nonneg _) exact integrable_of_norm_sub_le (hF_meas x x_in) hF_int (bound_integrable.norm.const_mul ε) this have hF'_int : Integrable F' μ := have : ∀ᵐ a ∂μ, ‖F' a‖ ≤ b a := by apply (h_diff.and h_lipsch).mono rintro a ⟨ha_diff, ha_lip⟩ exact ha_diff.le_of_lip' (b_nonneg a) (mem_of_superset (ball_mem_nhds _ ε_pos) <| ha_lip) b_int.mono' hF'_meas this refine ⟨hF'_int, ?_⟩ /- Discard the trivial case where `E` is not complete, as all integrals vanish. -/ by_cases hE : CompleteSpace E; swap · rcases subsingleton_or_nontrivial H with hH|hH · have : Subsingleton (H →L[𝕜] E) := inferInstance convert hasFDerivAt_of_subsingleton _ x₀ · have : ¬(CompleteSpace (H →L[𝕜] E)) := by simpa [SeparatingDual.completeSpace_continuousLinearMap_iff] using hE simp only [integral, hE, ↓reduceDite, this] exact hasFDerivAt_const 0 x₀ have h_ball : ball x₀ ε ∈ 𝓝 x₀ := ball_mem_nhds x₀ ε_pos have : ∀ᶠ x in 𝓝 x₀, ‖x - x₀‖⁻¹ * ‖((∫ a, F x a ∂μ) - ∫ a, F x₀ a ∂μ) - (∫ a, F' a ∂μ) (x - x₀)‖ = ‖∫ a, ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀)) ∂μ‖ := by apply mem_of_superset (ball_mem_nhds _ ε_pos) intro x x_in; simp only rw [Set.mem_setOf_eq, ← norm_smul_of_nonneg (nneg _), integral_smul, integral_sub, integral_sub, ← ContinuousLinearMap.integral_apply hF'_int] exacts [hF_int' x x_in, hF_int, (hF_int' x x_in).sub hF_int, hF'_int.apply_continuousLinearMap _] rw [hasFDerivAt_iff_tendsto, tendsto_congr' this, ← tendsto_zero_iff_norm_tendsto_zero, ← show (∫ a : α, ‖x₀ - x₀‖⁻¹ • (F x₀ a - F x₀ a - (F' a) (x₀ - x₀)) ∂μ) = 0 by simp] apply tendsto_integral_filter_of_dominated_convergence · filter_upwards [h_ball] with _ x_in apply AEStronglyMeasurable.const_smul exact ((hF_meas _ x_in).sub (hF_meas _ x₀_in)).sub (hF'_meas.apply_continuousLinearMap _) · refine mem_of_superset h_ball fun x hx ↦ ?_ apply (h_diff.and h_lipsch).mono on_goal 1 => rintro a ⟨-, ha_bound⟩ show ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ ≤ b a + ‖F' a‖ replace ha_bound : ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ := ha_bound x hx calc ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ = ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a) - ‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := by rw [smul_sub] _ ≤ ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a)‖ + ‖‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := norm_sub_le _ _ _ = ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a‖ + ‖x - x₀‖⁻¹ * ‖F' a (x - x₀)‖ := by rw [norm_smul_of_nonneg, norm_smul_of_nonneg] <;> exact nneg _ _ ≤ ‖x - x₀‖⁻¹ * (b a * ‖x - x₀‖) + ‖x - x₀‖⁻¹ * (‖F' a‖ * ‖x - x₀‖) := by gcongr; exact (F' a).le_opNorm _ _ ≤ b a + ‖F' a‖ := ?_ simp only [← div_eq_inv_mul] apply_rules [add_le_add, div_le_of_nonneg_of_le_mul] <;> first | rfl | positivity · exact b_int.add hF'_int.norm · apply h_diff.mono intro a ha suffices Tendsto (fun x ↦ ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))) (𝓝 x₀) (𝓝 0) by simpa rw [tendsto_zero_iff_norm_tendsto_zero] have : (fun x ↦ ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a - F' a (x - x₀)‖) = fun x ↦ ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ := by ext x rw [norm_smul_of_nonneg (nneg _)] rwa [hasFDerivAt_iff_tendsto, this] at ha
import Mathlib.MeasureTheory.Function.L1Space import Mathlib.MeasureTheory.Function.SimpleFuncDense #align_import measure_theory.function.simple_func_dense_lp from "leanprover-community/mathlib"@"5a2df4cd59cb31e97a516d4603a14bed5c2f9425" noncomputable section set_option linter.uppercaseLean3 false open Set Function Filter TopologicalSpace ENNReal EMetric Finset open scoped Classical Topology ENNReal MeasureTheory variable {α β ι E F 𝕜 : Type*} namespace MeasureTheory local infixr:25 " →ₛ " => SimpleFunc namespace SimpleFunc section SimpleFuncProperties variable [MeasurableSpace α] variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable {μ : Measure α} {p : ℝ≥0∞} theorem exists_forall_norm_le (f : α →ₛ F) : ∃ C, ∀ x, ‖f x‖ ≤ C := exists_forall_le (f.map fun x => ‖x‖) #align measure_theory.simple_func.exists_forall_norm_le MeasureTheory.SimpleFunc.exists_forall_norm_le theorem memℒp_zero (f : α →ₛ E) (μ : Measure α) : Memℒp f 0 μ := memℒp_zero_iff_aestronglyMeasurable.mpr f.aestronglyMeasurable #align measure_theory.simple_func.mem_ℒp_zero MeasureTheory.SimpleFunc.memℒp_zero theorem memℒp_top (f : α →ₛ E) (μ : Measure α) : Memℒp f ∞ μ := let ⟨C, hfC⟩ := f.exists_forall_norm_le memℒp_top_of_bound f.aestronglyMeasurable C <| eventually_of_forall hfC #align measure_theory.simple_func.mem_ℒp_top MeasureTheory.SimpleFunc.memℒp_top protected theorem snorm'_eq {p : ℝ} (f : α →ₛ F) (μ : Measure α) : snorm' f p μ = (∑ y ∈ f.range, (‖y‖₊ : ℝ≥0∞) ^ p * μ (f ⁻¹' {y})) ^ (1 / p) := by have h_map : (fun a => (‖f a‖₊ : ℝ≥0∞) ^ p) = f.map fun a : F => (‖a‖₊ : ℝ≥0∞) ^ p := by simp; rfl rw [snorm', h_map, lintegral_eq_lintegral, map_lintegral] #align measure_theory.simple_func.snorm'_eq MeasureTheory.SimpleFunc.snorm'_eq theorem measure_preimage_lt_top_of_memℒp (hp_pos : p ≠ 0) (hp_ne_top : p ≠ ∞) (f : α →ₛ E) (hf : Memℒp f p μ) (y : E) (hy_ne : y ≠ 0) : μ (f ⁻¹' {y}) < ∞ := by have hp_pos_real : 0 < p.toReal := ENNReal.toReal_pos hp_pos hp_ne_top have hf_snorm := Memℒp.snorm_lt_top hf rw [snorm_eq_snorm' hp_pos hp_ne_top, f.snorm'_eq, ← @ENNReal.lt_rpow_one_div_iff _ _ (1 / p.toReal) (by simp [hp_pos_real]), @ENNReal.top_rpow_of_pos (1 / (1 / p.toReal)) (by simp [hp_pos_real]), ENNReal.sum_lt_top_iff] at hf_snorm by_cases hyf : y ∈ f.range swap · suffices h_empty : f ⁻¹' {y} = ∅ by rw [h_empty, measure_empty]; exact ENNReal.coe_lt_top ext1 x rw [Set.mem_preimage, Set.mem_singleton_iff, mem_empty_iff_false, iff_false_iff] refine fun hxy => hyf ?_ rw [mem_range, Set.mem_range] exact ⟨x, hxy⟩ specialize hf_snorm y hyf rw [ENNReal.mul_lt_top_iff] at hf_snorm cases hf_snorm with | inl hf_snorm => exact hf_snorm.2 | inr hf_snorm => cases hf_snorm with | inl hf_snorm => refine absurd ?_ hy_ne simpa [hp_pos_real] using hf_snorm | inr hf_snorm => simp [hf_snorm] #align measure_theory.simple_func.measure_preimage_lt_top_of_mem_ℒp MeasureTheory.SimpleFunc.measure_preimage_lt_top_of_memℒp
Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean
325
337
theorem memℒp_of_finite_measure_preimage (p : ℝ≥0∞) {f : α →ₛ E} (hf : ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞) : Memℒp f p μ := by
by_cases hp0 : p = 0 · rw [hp0, memℒp_zero_iff_aestronglyMeasurable]; exact f.aestronglyMeasurable by_cases hp_top : p = ∞ · rw [hp_top]; exact memℒp_top f μ refine ⟨f.aestronglyMeasurable, ?_⟩ rw [snorm_eq_snorm' hp0 hp_top, f.snorm'_eq] refine ENNReal.rpow_lt_top_of_nonneg (by simp) (ENNReal.sum_lt_top_iff.mpr fun y _ => ?_).ne by_cases hy0 : y = 0 · simp [hy0, ENNReal.toReal_pos hp0 hp_top] · refine ENNReal.mul_lt_top ?_ (hf y hy0).ne exact (ENNReal.rpow_lt_top_of_nonneg ENNReal.toReal_nonneg ENNReal.coe_ne_top).ne
import Mathlib.Algebra.CharZero.Defs import Mathlib.Algebra.Group.Pi.Basic import Mathlib.Algebra.Group.Units import Mathlib.Algebra.GroupWithZero.NeZero import Mathlib.Algebra.Order.Group.Defs import Mathlib.Algebra.Order.GroupWithZero.Unbundled import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.Order.Monoid.NatCast import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax import Mathlib.Algebra.Ring.Defs import Mathlib.Tactic.Tauto #align_import algebra.order.ring.char_zero from "leanprover-community/mathlib"@"655994e298904d7e5bbd1e18c95defd7b543eb94" #align_import algebra.order.ring.defs from "leanprover-community/mathlib"@"44e29dbcff83ba7114a464d592b8c3743987c1e5" open Function universe u variable {α : Type u} {β : Type*} theorem add_one_le_two_mul [LE α] [Semiring α] [CovariantClass α α (· + ·) (· ≤ ·)] {a : α} (a1 : 1 ≤ a) : a + 1 ≤ 2 * a := calc a + 1 ≤ a + a := add_le_add_left a1 a _ = 2 * a := (two_mul _).symm #align add_one_le_two_mul add_one_le_two_mul class OrderedSemiring (α : Type u) extends Semiring α, OrderedAddCommMonoid α where protected zero_le_one : (0 : α) ≤ 1 protected mul_le_mul_of_nonneg_left : ∀ a b c : α, a ≤ b → 0 ≤ c → c * a ≤ c * b protected mul_le_mul_of_nonneg_right : ∀ a b c : α, a ≤ b → 0 ≤ c → a * c ≤ b * c #align ordered_semiring OrderedSemiring class OrderedCommSemiring (α : Type u) extends OrderedSemiring α, CommSemiring α where mul_le_mul_of_nonneg_right a b c ha hc := -- parentheses ensure this generates an `optParam` rather than an `autoParam` (by simpa only [mul_comm] using mul_le_mul_of_nonneg_left a b c ha hc) #align ordered_comm_semiring OrderedCommSemiring class OrderedRing (α : Type u) extends Ring α, OrderedAddCommGroup α where protected zero_le_one : 0 ≤ (1 : α) protected mul_nonneg : ∀ a b : α, 0 ≤ a → 0 ≤ b → 0 ≤ a * b #align ordered_ring OrderedRing class OrderedCommRing (α : Type u) extends OrderedRing α, CommRing α #align ordered_comm_ring OrderedCommRing class StrictOrderedSemiring (α : Type u) extends Semiring α, OrderedCancelAddCommMonoid α, Nontrivial α where protected zero_le_one : (0 : α) ≤ 1 protected mul_lt_mul_of_pos_left : ∀ a b c : α, a < b → 0 < c → c * a < c * b protected mul_lt_mul_of_pos_right : ∀ a b c : α, a < b → 0 < c → a * c < b * c #align strict_ordered_semiring StrictOrderedSemiring class StrictOrderedCommSemiring (α : Type u) extends StrictOrderedSemiring α, CommSemiring α #align strict_ordered_comm_semiring StrictOrderedCommSemiring class StrictOrderedRing (α : Type u) extends Ring α, OrderedAddCommGroup α, Nontrivial α where protected zero_le_one : 0 ≤ (1 : α) protected mul_pos : ∀ a b : α, 0 < a → 0 < b → 0 < a * b #align strict_ordered_ring StrictOrderedRing class StrictOrderedCommRing (α : Type*) extends StrictOrderedRing α, CommRing α #align strict_ordered_comm_ring StrictOrderedCommRing class LinearOrderedSemiring (α : Type u) extends StrictOrderedSemiring α, LinearOrderedAddCommMonoid α #align linear_ordered_semiring LinearOrderedSemiring class LinearOrderedCommSemiring (α : Type*) extends StrictOrderedCommSemiring α, LinearOrderedSemiring α #align linear_ordered_comm_semiring LinearOrderedCommSemiring class LinearOrderedRing (α : Type u) extends StrictOrderedRing α, LinearOrder α #align linear_ordered_ring LinearOrderedRing class LinearOrderedCommRing (α : Type u) extends LinearOrderedRing α, CommMonoid α #align linear_ordered_comm_ring LinearOrderedCommRing section OrderedSemiring variable [OrderedSemiring α] {a b c d : α} -- see Note [lower instance priority] instance (priority := 100) OrderedSemiring.zeroLEOneClass : ZeroLEOneClass α := { ‹OrderedSemiring α› with } #align ordered_semiring.zero_le_one_class OrderedSemiring.zeroLEOneClass -- see Note [lower instance priority] instance (priority := 200) OrderedSemiring.toPosMulMono : PosMulMono α := ⟨fun x _ _ h => OrderedSemiring.mul_le_mul_of_nonneg_left _ _ _ h x.2⟩ #align ordered_semiring.to_pos_mul_mono OrderedSemiring.toPosMulMono -- see Note [lower instance priority] instance (priority := 200) OrderedSemiring.toMulPosMono : MulPosMono α := ⟨fun x _ _ h => OrderedSemiring.mul_le_mul_of_nonneg_right _ _ _ h x.2⟩ #align ordered_semiring.to_mul_pos_mono OrderedSemiring.toMulPosMono set_option linter.deprecated false in theorem bit1_mono : Monotone (bit1 : α → α) := fun _ _ h => add_le_add_right (bit0_mono h) _ #align bit1_mono bit1_mono @[simp] theorem pow_nonneg (H : 0 ≤ a) : ∀ n : ℕ, 0 ≤ a ^ n | 0 => by rw [pow_zero] exact zero_le_one | n + 1 => by rw [pow_succ] exact mul_nonneg (pow_nonneg H _) H #align pow_nonneg pow_nonneg lemma pow_le_pow_of_le_one (ha₀ : 0 ≤ a) (ha₁ : a ≤ 1) : ∀ {m n : ℕ}, m ≤ n → a ^ n ≤ a ^ m | _, _, Nat.le.refl => le_rfl | _, _, Nat.le.step h => by rw [pow_succ'] exact (mul_le_of_le_one_left (pow_nonneg ha₀ _) ha₁).trans $ pow_le_pow_of_le_one ha₀ ha₁ h #align pow_le_pow_of_le_one pow_le_pow_of_le_one lemma pow_le_of_le_one (h₀ : 0 ≤ a) (h₁ : a ≤ 1) {n : ℕ} (hn : n ≠ 0) : a ^ n ≤ a := (pow_one a).subst (pow_le_pow_of_le_one h₀ h₁ (Nat.pos_of_ne_zero hn)) #align pow_le_of_le_one pow_le_of_le_one lemma sq_le (h₀ : 0 ≤ a) (h₁ : a ≤ 1) : a ^ 2 ≤ a := pow_le_of_le_one h₀ h₁ two_ne_zero #align sq_le sq_le -- Porting note: it's unfortunate we need to write `(@one_le_two α)` here. theorem add_le_mul_two_add (a2 : 2 ≤ a) (b0 : 0 ≤ b) : a + (2 + b) ≤ a * (2 + b) := calc a + (2 + b) ≤ a + (a + a * b) := add_le_add_left (add_le_add a2 <| le_mul_of_one_le_left b0 <| (@one_le_two α).trans a2) a _ ≤ a * (2 + b) := by rw [mul_add, mul_two, add_assoc] #align add_le_mul_two_add add_le_mul_two_add theorem one_le_mul_of_one_le_of_one_le (ha : 1 ≤ a) (hb : 1 ≤ b) : (1 : α) ≤ a * b := Left.one_le_mul_of_le_of_le ha hb <| zero_le_one.trans ha #align one_le_mul_of_one_le_of_one_le one_le_mul_of_one_le_of_one_le section set_option linter.deprecated false theorem bit1_pos [Nontrivial α] (h : 0 ≤ a) : 0 < bit1 a := zero_lt_one.trans_le <| bit1_zero.symm.trans_le <| bit1_mono h #align bit1_pos bit1_pos theorem bit1_pos' (h : 0 < a) : 0 < bit1 a := by nontriviality exact bit1_pos h.le #align bit1_pos' bit1_pos' end theorem mul_le_one (ha : a ≤ 1) (hb' : 0 ≤ b) (hb : b ≤ 1) : a * b ≤ 1 := one_mul (1 : α) ▸ mul_le_mul ha hb hb' zero_le_one #align mul_le_one mul_le_one theorem one_lt_mul_of_le_of_lt (ha : 1 ≤ a) (hb : 1 < b) : 1 < a * b := hb.trans_le <| le_mul_of_one_le_left (zero_le_one.trans hb.le) ha #align one_lt_mul_of_le_of_lt one_lt_mul_of_le_of_lt theorem one_lt_mul_of_lt_of_le (ha : 1 < a) (hb : 1 ≤ b) : 1 < a * b := ha.trans_le <| le_mul_of_one_le_right (zero_le_one.trans ha.le) hb #align one_lt_mul_of_lt_of_le one_lt_mul_of_lt_of_le alias one_lt_mul := one_lt_mul_of_le_of_lt #align one_lt_mul one_lt_mul theorem mul_lt_one_of_nonneg_of_lt_one_left (ha₀ : 0 ≤ a) (ha : a < 1) (hb : b ≤ 1) : a * b < 1 := (mul_le_of_le_one_right ha₀ hb).trans_lt ha #align mul_lt_one_of_nonneg_of_lt_one_left mul_lt_one_of_nonneg_of_lt_one_left theorem mul_lt_one_of_nonneg_of_lt_one_right (ha : a ≤ 1) (hb₀ : 0 ≤ b) (hb : b < 1) : a * b < 1 := (mul_le_of_le_one_left hb₀ ha).trans_lt hb #align mul_lt_one_of_nonneg_of_lt_one_right mul_lt_one_of_nonneg_of_lt_one_right variable [ExistsAddOfLE α] [ContravariantClass α α (swap (· + ·)) (· ≤ ·)] theorem mul_le_mul_of_nonpos_left (h : b ≤ a) (hc : c ≤ 0) : c * a ≤ c * b := by obtain ⟨d, hcd⟩ := exists_add_of_le hc refine le_of_add_le_add_right (a := d * b + d * a) ?_ calc _ = d * b := by rw [add_left_comm, ← add_mul, ← hcd, zero_mul, add_zero] _ ≤ d * a := mul_le_mul_of_nonneg_left h <| hcd.trans_le <| add_le_of_nonpos_left hc _ = _ := by rw [← add_assoc, ← add_mul, ← hcd, zero_mul, zero_add] #align mul_le_mul_of_nonpos_left mul_le_mul_of_nonpos_left
Mathlib/Algebra/Order/Ring/Defs.lean
360
366
theorem mul_le_mul_of_nonpos_right (h : b ≤ a) (hc : c ≤ 0) : a * c ≤ b * c := by
obtain ⟨d, hcd⟩ := exists_add_of_le hc refine le_of_add_le_add_right (a := b * d + a * d) ?_ calc _ = b * d := by rw [add_left_comm, ← mul_add, ← hcd, mul_zero, add_zero] _ ≤ a * d := mul_le_mul_of_nonneg_right h <| hcd.trans_le <| add_le_of_nonpos_left hc _ = _ := by rw [← add_assoc, ← mul_add, ← hcd, mul_zero, zero_add]
import Mathlib.LinearAlgebra.Span import Mathlib.RingTheory.Ideal.IsPrimary import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Noetherian #align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M] def IsAssociatedPrime : Prop := I.IsPrime ∧ ∃ x : M, I = (R ∙ x).annihilator #align is_associated_prime IsAssociatedPrime variable (R) def associatedPrimes : Set (Ideal R) := { I | IsAssociatedPrime I M } #align associated_primes associatedPrimes variable {I J M R} variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M →ₗ[R] M') theorem AssociatePrimes.mem_iff : I ∈ associatedPrimes R M ↔ IsAssociatedPrime I M := Iff.rfl #align associate_primes.mem_iff AssociatePrimes.mem_iff theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1 #align is_associated_prime.is_prime IsAssociatedPrime.isPrime theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) : IsAssociatedPrime I M' := by obtain ⟨x, rfl⟩ := h.2 refine ⟨h.1, ⟨f x, ?_⟩⟩ ext r rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, ← map_smul, ← f.map_zero, hf.eq_iff] #align is_associated_prime.map_of_injective IsAssociatedPrime.map_of_injective theorem LinearEquiv.isAssociatedPrime_iff (l : M ≃ₗ[R] M') : IsAssociatedPrime I M ↔ IsAssociatedPrime I M' := ⟨fun h => h.map_of_injective l l.injective, fun h => h.map_of_injective l.symm l.symm.injective⟩ #align linear_equiv.is_associated_prime_iff LinearEquiv.isAssociatedPrime_iff
Mathlib/RingTheory/Ideal/AssociatedPrime.lean
74
78
theorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : ¬IsAssociatedPrime I M := by
rintro ⟨hI, x, hx⟩ apply hI.ne_top rwa [Subsingleton.elim x 0, Submodule.span_singleton_eq_bot.mpr rfl, Submodule.annihilator_bot] at hx
import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.centering from "leanprover-community/mathlib"@"bea6c853b6edbd15e9d0941825abd04d77933ed0" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory variable {Ω E : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℕ → Ω → E} {ℱ : Filtration ℕ m0} {n : ℕ} noncomputable def predictablePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => ∑ i ∈ Finset.range n, μ[f (i + 1) - f i|ℱ i] #align measure_theory.predictable_part MeasureTheory.predictablePart @[simp] theorem predictablePart_zero : predictablePart f ℱ μ 0 = 0 := by simp_rw [predictablePart, Finset.range_zero, Finset.sum_empty] #align measure_theory.predictable_part_zero MeasureTheory.predictablePart_zero theorem adapted_predictablePart : Adapted ℱ fun n => predictablePart f ℱ μ (n + 1) := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_succ_iff.mp hin)) #align measure_theory.adapted_predictable_part MeasureTheory.adapted_predictablePart theorem adapted_predictablePart' : Adapted ℱ fun n => predictablePart f ℱ μ n := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_le hin)) #align measure_theory.adapted_predictable_part' MeasureTheory.adapted_predictablePart' noncomputable def martingalePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => f n - predictablePart f ℱ μ n #align measure_theory.martingale_part MeasureTheory.martingalePart theorem martingalePart_add_predictablePart (ℱ : Filtration ℕ m0) (μ : Measure Ω) (f : ℕ → Ω → E) : martingalePart f ℱ μ + predictablePart f ℱ μ = f := sub_add_cancel _ _ #align measure_theory.martingale_part_add_predictable_part MeasureTheory.martingalePart_add_predictablePart theorem martingalePart_eq_sum : martingalePart f ℱ μ = fun n => f 0 + ∑ i ∈ Finset.range n, (f (i + 1) - f i - μ[f (i + 1) - f i|ℱ i]) := by unfold martingalePart predictablePart ext1 n rw [Finset.eq_sum_range_sub f n, ← add_sub, ← Finset.sum_sub_distrib] #align measure_theory.martingale_part_eq_sum MeasureTheory.martingalePart_eq_sum theorem adapted_martingalePart (hf : Adapted ℱ f) : Adapted ℱ (martingalePart f ℱ μ) := Adapted.sub hf adapted_predictablePart' #align measure_theory.adapted_martingale_part MeasureTheory.adapted_martingalePart theorem integrable_martingalePart (hf_int : ∀ n, Integrable (f n) μ) (n : ℕ) : Integrable (martingalePart f ℱ μ n) μ := by rw [martingalePart_eq_sum] exact (hf_int 0).add (integrable_finset_sum' _ fun i _ => ((hf_int _).sub (hf_int _)).sub integrable_condexp) #align measure_theory.integrable_martingale_part MeasureTheory.integrable_martingalePart theorem martingale_martingalePart (hf : Adapted ℱ f) (hf_int : ∀ n, Integrable (f n) μ) [SigmaFiniteFiltration μ ℱ] : Martingale (martingalePart f ℱ μ) ℱ μ := by refine ⟨adapted_martingalePart hf, fun i j hij => ?_⟩ -- ⊢ μ[martingalePart f ℱ μ j | ℱ i] =ᵐ[μ] martingalePart f ℱ μ i have h_eq_sum : μ[martingalePart f ℱ μ j|ℱ i] =ᵐ[μ] f 0 + ∑ k ∈ Finset.range j, (μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i]) := by rw [martingalePart_eq_sum] refine (condexp_add (hf_int 0) ?_).trans ?_ · exact integrable_finset_sum' _ fun i _ => ((hf_int _).sub (hf_int _)).sub integrable_condexp refine (EventuallyEq.add EventuallyEq.rfl (condexp_finset_sum fun i _ => ?_)).trans ?_ · exact ((hf_int _).sub (hf_int _)).sub integrable_condexp refine EventuallyEq.add ?_ ?_ · rw [condexp_of_stronglyMeasurable (ℱ.le _) _ (hf_int 0)] · exact (hf 0).mono (ℱ.mono (zero_le i)) · exact eventuallyEq_sum fun k _ => condexp_sub ((hf_int _).sub (hf_int _)) integrable_condexp refine h_eq_sum.trans ?_ have h_ge : ∀ k, i ≤ k → μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] 0 := by intro k hk have : μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] μ[f (k + 1) - f k|ℱ i] := condexp_condexp_of_le (ℱ.mono hk) (ℱ.le k) filter_upwards [this] with x hx rw [Pi.sub_apply, Pi.zero_apply, hx, sub_self] have h_lt : ∀ k, k < i → μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] f (k + 1) - f k - μ[f (k + 1) - f k|ℱ k] := by refine fun k hk => EventuallyEq.sub ?_ ?_ · rw [condexp_of_stronglyMeasurable] · exact ((hf (k + 1)).mono (ℱ.mono (Nat.succ_le_of_lt hk))).sub ((hf k).mono (ℱ.mono hk.le)) · exact (hf_int _).sub (hf_int _) · rw [condexp_of_stronglyMeasurable] · exact stronglyMeasurable_condexp.mono (ℱ.mono hk.le) · exact integrable_condexp rw [martingalePart_eq_sum] refine EventuallyEq.add EventuallyEq.rfl ?_ rw [← Finset.sum_range_add_sum_Ico _ hij, ← add_zero (∑ i ∈ Finset.range i, (f (i + 1) - f i - μ[f (i + 1) - f i|ℱ i]))] refine (eventuallyEq_sum fun k hk => h_lt k (Finset.mem_range.mp hk)).add ?_ refine (eventuallyEq_sum fun k hk => h_ge k (Finset.mem_Ico.mp hk).1).trans ?_ simp only [Finset.sum_const_zero, Pi.zero_apply] rfl #align measure_theory.martingale_martingale_part MeasureTheory.martingale_martingalePart -- The following two lemmas demonstrate the essential uniqueness of the decomposition theorem martingalePart_add_ae_eq [SigmaFiniteFiltration μ ℱ] {f g : ℕ → Ω → E} (hf : Martingale f ℱ μ) (hg : Adapted ℱ fun n => g (n + 1)) (hg0 : g 0 = 0) (hgint : ∀ n, Integrable (g n) μ) (n : ℕ) : martingalePart (f + g) ℱ μ n =ᵐ[μ] f n := by set h := f - martingalePart (f + g) ℱ μ with hhdef have hh : h = predictablePart (f + g) ℱ μ - g := by rw [hhdef, sub_eq_sub_iff_add_eq_add, add_comm (predictablePart (f + g) ℱ μ), martingalePart_add_predictablePart] have hhpred : Adapted ℱ fun n => h (n + 1) := by rw [hh] exact adapted_predictablePart.sub hg have hhmgle : Martingale h ℱ μ := hf.sub (martingale_martingalePart (hf.adapted.add <| Predictable.adapted hg <| hg0.symm ▸ stronglyMeasurable_zero) fun n => (hf.integrable n).add <| hgint n) refine (eventuallyEq_iff_sub.2 ?_).symm filter_upwards [hhmgle.eq_zero_of_predictable hhpred n] with ω hω unfold_let h at hω rw [Pi.sub_apply] at hω rw [hω, Pi.sub_apply, martingalePart] simp [hg0] #align measure_theory.martingale_part_add_ae_eq MeasureTheory.martingalePart_add_ae_eq theorem predictablePart_add_ae_eq [SigmaFiniteFiltration μ ℱ] {f g : ℕ → Ω → E} (hf : Martingale f ℱ μ) (hg : Adapted ℱ fun n => g (n + 1)) (hg0 : g 0 = 0) (hgint : ∀ n, Integrable (g n) μ) (n : ℕ) : predictablePart (f + g) ℱ μ n =ᵐ[μ] g n := by filter_upwards [martingalePart_add_ae_eq hf hg hg0 hgint n] with ω hω rw [← add_right_inj (f n ω)] conv_rhs => rw [← Pi.add_apply, ← Pi.add_apply, ← martingalePart_add_predictablePart ℱ μ (f + g)] rw [Pi.add_apply, Pi.add_apply, hω] #align measure_theory.predictable_part_add_ae_eq MeasureTheory.predictablePart_add_ae_eq section Difference
Mathlib/Probability/Martingale/Centering.lean
167
171
theorem predictablePart_bdd_difference {R : ℝ≥0} {f : ℕ → Ω → ℝ} (ℱ : Filtration ℕ m0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) : ∀ᵐ ω ∂μ, ∀ i, |predictablePart f ℱ μ (i + 1) ω - predictablePart f ℱ μ i ω| ≤ R := by
simp_rw [predictablePart, Finset.sum_apply, Finset.sum_range_succ_sub_sum] exact ae_all_iff.2 fun i => ae_bdd_condexp_of_ae_bdd <| ae_all_iff.1 hbdd i
import Mathlib.Analysis.SpecialFunctions.Complex.Circle import Mathlib.Geometry.Euclidean.Angle.Oriented.Basic #align_import geometry.euclidean.angle.oriented.rotation from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open FiniteDimensional Complex open scoped Real RealInnerProductSpace ComplexConjugate namespace Orientation attribute [local instance] Complex.finrank_real_complex_fact variable {V V' : Type*} variable [NormedAddCommGroup V] [NormedAddCommGroup V'] variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V'] variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2)) local notation "J" => o.rightAngleRotation def rotationAux (θ : Real.Angle) : V →ₗᵢ[ℝ] V := LinearMap.isometryOfInner (Real.Angle.cos θ • LinearMap.id + Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap) (by intro x y simp only [RCLike.conj_to_real, id, LinearMap.smul_apply, LinearMap.add_apply, LinearMap.id_coe, LinearEquiv.coe_coe, LinearIsometryEquiv.coe_toLinearEquiv, Orientation.areaForm_rightAngleRotation_left, Orientation.inner_rightAngleRotation_left, Orientation.inner_rightAngleRotation_right, inner_add_left, inner_smul_left, inner_add_right, inner_smul_right] linear_combination inner (𝕜 := ℝ) x y * θ.cos_sq_add_sin_sq) #align orientation.rotation_aux Orientation.rotationAux @[simp] theorem rotationAux_apply (θ : Real.Angle) (x : V) : o.rotationAux θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x := rfl #align orientation.rotation_aux_apply Orientation.rotationAux_apply def rotation (θ : Real.Angle) : V ≃ₗᵢ[ℝ] V := LinearIsometryEquiv.ofLinearIsometry (o.rotationAux θ) (Real.Angle.cos θ • LinearMap.id - Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap) (by ext x convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1 · simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply, Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap, LinearIsometryEquiv.coe_toLinearEquiv, map_smul, map_sub, LinearMap.coe_comp, LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply, ← mul_smul, add_smul, smul_add, smul_neg, smul_sub, mul_comm, sq] abel · simp) (by ext x convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1 · simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply, Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap, LinearIsometryEquiv.coe_toLinearEquiv, map_add, map_smul, LinearMap.coe_comp, LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply, add_smul, smul_neg, smul_sub, smul_smul] ring_nf abel · simp) #align orientation.rotation Orientation.rotation theorem rotation_apply (θ : Real.Angle) (x : V) : o.rotation θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x := rfl #align orientation.rotation_apply Orientation.rotation_apply theorem rotation_symm_apply (θ : Real.Angle) (x : V) : (o.rotation θ).symm x = Real.Angle.cos θ • x - Real.Angle.sin θ • J x := rfl #align orientation.rotation_symm_apply Orientation.rotation_symm_apply theorem rotation_eq_matrix_toLin (θ : Real.Angle) {x : V} (hx : x ≠ 0) : (o.rotation θ).toLinearMap = Matrix.toLin (o.basisRightAngleRotation x hx) (o.basisRightAngleRotation x hx) !![θ.cos, -θ.sin; θ.sin, θ.cos] := by apply (o.basisRightAngleRotation x hx).ext intro i fin_cases i · rw [Matrix.toLin_self] simp [rotation_apply, Fin.sum_univ_succ] · rw [Matrix.toLin_self] simp [rotation_apply, Fin.sum_univ_succ, add_comm] #align orientation.rotation_eq_matrix_to_lin Orientation.rotation_eq_matrix_toLin @[simp] theorem det_rotation (θ : Real.Angle) : LinearMap.det (o.rotation θ).toLinearMap = 1 := by haveI : Nontrivial V := FiniteDimensional.nontrivial_of_finrank_eq_succ (@Fact.out (finrank ℝ V = 2) _) obtain ⟨x, hx⟩ : ∃ x, x ≠ (0 : V) := exists_ne (0 : V) rw [o.rotation_eq_matrix_toLin θ hx] simpa [sq] using θ.cos_sq_add_sin_sq #align orientation.det_rotation Orientation.det_rotation @[simp] theorem linearEquiv_det_rotation (θ : Real.Angle) : LinearEquiv.det (o.rotation θ).toLinearEquiv = 1 := Units.ext <| by -- Porting note: Lean can't see through `LinearEquiv.coe_det` and needed the rewrite -- in mathlib3 this was just `units.ext <| o.det_rotation θ` simpa only [LinearEquiv.coe_det, Units.val_one] using o.det_rotation θ #align orientation.linear_equiv_det_rotation Orientation.linearEquiv_det_rotation @[simp] theorem rotation_symm (θ : Real.Angle) : (o.rotation θ).symm = o.rotation (-θ) := by ext; simp [o.rotation_apply, o.rotation_symm_apply, sub_eq_add_neg] #align orientation.rotation_symm Orientation.rotation_symm @[simp] theorem rotation_zero : o.rotation 0 = LinearIsometryEquiv.refl ℝ V := by ext; simp [rotation] #align orientation.rotation_zero Orientation.rotation_zero @[simp] theorem rotation_pi : o.rotation π = LinearIsometryEquiv.neg ℝ := by ext x simp [rotation] #align orientation.rotation_pi Orientation.rotation_pi theorem rotation_pi_apply (x : V) : o.rotation π x = -x := by simp #align orientation.rotation_pi_apply Orientation.rotation_pi_apply theorem rotation_pi_div_two : o.rotation (π / 2 : ℝ) = J := by ext x simp [rotation] #align orientation.rotation_pi_div_two Orientation.rotation_pi_div_two @[simp] theorem rotation_rotation (θ₁ θ₂ : Real.Angle) (x : V) : o.rotation θ₁ (o.rotation θ₂ x) = o.rotation (θ₁ + θ₂) x := by simp only [o.rotation_apply, ← mul_smul, Real.Angle.cos_add, Real.Angle.sin_add, add_smul, sub_smul, LinearIsometryEquiv.trans_apply, smul_add, LinearIsometryEquiv.map_add, LinearIsometryEquiv.map_smul, rightAngleRotation_rightAngleRotation, smul_neg] ring_nf abel #align orientation.rotation_rotation Orientation.rotation_rotation @[simp] theorem rotation_trans (θ₁ θ₂ : Real.Angle) : (o.rotation θ₁).trans (o.rotation θ₂) = o.rotation (θ₂ + θ₁) := LinearIsometryEquiv.ext fun _ => by rw [← rotation_rotation, LinearIsometryEquiv.trans_apply] #align orientation.rotation_trans Orientation.rotation_trans @[simp] theorem kahler_rotation_left (x y : V) (θ : Real.Angle) : o.kahler (o.rotation θ x) y = conj (θ.expMapCircle : ℂ) * o.kahler x y := by -- Porting note: this needed the `Complex.conj_ofReal` instead of `RCLike.conj_ofReal`; -- I believe this is because the respective coercions are no longer defeq, and -- `Real.Angle.coe_expMapCircle` uses the `Complex` version. simp only [o.rotation_apply, map_add, map_mul, LinearMap.map_smulₛₗ, RingHom.id_apply, LinearMap.add_apply, LinearMap.smul_apply, real_smul, kahler_rightAngleRotation_left, Real.Angle.coe_expMapCircle, Complex.conj_ofReal, conj_I] ring #align orientation.kahler_rotation_left Orientation.kahler_rotation_left theorem neg_rotation (θ : Real.Angle) (x : V) : -o.rotation θ x = o.rotation (π + θ) x := by rw [← o.rotation_pi_apply, rotation_rotation] #align orientation.neg_rotation Orientation.neg_rotation @[simp]
Mathlib/Geometry/Euclidean/Angle/Oriented/Rotation.lean
198
200
theorem neg_rotation_neg_pi_div_two (x : V) : -o.rotation (-π / 2 : ℝ) x = o.rotation (π / 2 : ℝ) x := by
rw [neg_rotation, ← Real.Angle.coe_add, neg_div, ← sub_eq_add_neg, sub_half]
import Mathlib.Topology.Bases import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Compactness.SigmaCompact open Set Filter Topology TopologicalSpace universe u v variable {X : Type u} {Y : Type v} {ι : Type*} variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X} section Lindelof def IsLindelof (s : Set X) := ∀ ⦃f⦄ [NeBot f] [CountableInterFilter f], f ≤ 𝓟 s → ∃ x ∈ s, ClusterPt x f theorem IsLindelof.compl_mem_sets (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f] (hf : ∀ x ∈ s, sᶜ ∈ 𝓝 x ⊓ f) : sᶜ ∈ f := by contrapose! hf simp only [not_mem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf ⊢ exact hs inf_le_right theorem IsLindelof.compl_mem_sets_of_nhdsWithin (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f] (hf : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, tᶜ ∈ f) : sᶜ ∈ f := by refine hs.compl_mem_sets fun x hx ↦ ?_ rw [← disjoint_principal_right, disjoint_right_comm, (basis_sets _).disjoint_iff_left] exact hf x hx @[elab_as_elim] theorem IsLindelof.induction_on (hs : IsLindelof s) {p : Set X → Prop} (hmono : ∀ ⦃s t⦄, s ⊆ t → p t → p s) (hcountable_union : ∀ (S : Set (Set X)), S.Countable → (∀ s ∈ S, p s) → p (⋃₀ S)) (hnhds : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, p t) : p s := by let f : Filter X := ofCountableUnion p hcountable_union (fun t ht _ hsub ↦ hmono hsub ht) have : sᶜ ∈ f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds) rwa [← compl_compl s] theorem IsLindelof.inter_right (hs : IsLindelof s) (ht : IsClosed t) : IsLindelof (s ∩ t) := by intro f hnf _ hstf rw [← inf_principal, le_inf_iff] at hstf obtain ⟨x, hsx, hx⟩ : ∃ x ∈ s, ClusterPt x f := hs hstf.1 have hxt : x ∈ t := ht.mem_of_nhdsWithin_neBot <| hx.mono hstf.2 exact ⟨x, ⟨hsx, hxt⟩, hx⟩ theorem IsLindelof.inter_left (ht : IsLindelof t) (hs : IsClosed s) : IsLindelof (s ∩ t) := inter_comm t s ▸ ht.inter_right hs theorem IsLindelof.diff (hs : IsLindelof s) (ht : IsOpen t) : IsLindelof (s \ t) := hs.inter_right (isClosed_compl_iff.mpr ht) theorem IsLindelof.of_isClosed_subset (hs : IsLindelof s) (ht : IsClosed t) (h : t ⊆ s) : IsLindelof t := inter_eq_self_of_subset_right h ▸ hs.inter_right ht theorem IsLindelof.image_of_continuousOn {f : X → Y} (hs : IsLindelof s) (hf : ContinuousOn f s) : IsLindelof (f '' s) := by intro l lne _ ls have : NeBot (l.comap f ⊓ 𝓟 s) := comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls) obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, ClusterPt x (l.comap f ⊓ 𝓟 s) := @hs _ this _ inf_le_right haveI := hx.neBot use f x, mem_image_of_mem f hxs have : Tendsto f (𝓝 x ⊓ (comap f l ⊓ 𝓟 s)) (𝓝 (f x) ⊓ l) := by convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1 rw [nhdsWithin] ac_rfl exact this.neBot theorem IsLindelof.image {f : X → Y} (hs : IsLindelof s) (hf : Continuous f) : IsLindelof (f '' s) := hs.image_of_continuousOn hf.continuousOn theorem IsLindelof.adherence_nhdset {f : Filter X} [CountableInterFilter f] (hs : IsLindelof s) (hf₂ : f ≤ 𝓟 s) (ht₁ : IsOpen t) (ht₂ : ∀ x ∈ s, ClusterPt x f → x ∈ t) : t ∈ f := (eq_or_neBot _).casesOn mem_of_eq_bot fun _ ↦ let ⟨x, hx, hfx⟩ := @hs (f ⊓ 𝓟 tᶜ) _ _ <| inf_le_of_left_le hf₂ have : x ∈ t := ht₂ x hx hfx.of_inf_left have : tᶜ ∩ t ∈ 𝓝[tᶜ] x := inter_mem_nhdsWithin _ (ht₁.mem_nhds this) have A : 𝓝[tᶜ] x = ⊥ := empty_mem_iff_bot.1 <| compl_inter_self t ▸ this have : 𝓝[tᶜ] x ≠ ⊥ := hfx.of_inf_right.ne absurd A this theorem IsLindelof.elim_countable_subcover {ι : Type v} (hs : IsLindelof s) (U : ι → Set X) (hUo : ∀ i, IsOpen (U i)) (hsU : s ⊆ ⋃ i, U i) : ∃ r : Set ι, r.Countable ∧ (s ⊆ ⋃ i ∈ r, U i) := by have hmono : ∀ ⦃s t : Set X⦄, s ⊆ t → (∃ r : Set ι, r.Countable ∧ t ⊆ ⋃ i ∈ r, U i) → (∃ r : Set ι, r.Countable ∧ s ⊆ ⋃ i ∈ r, U i) := by intro _ _ hst ⟨r, ⟨hrcountable, hsub⟩⟩ exact ⟨r, hrcountable, Subset.trans hst hsub⟩ have hcountable_union : ∀ (S : Set (Set X)), S.Countable → (∀ s ∈ S, ∃ r : Set ι, r.Countable ∧ (s ⊆ ⋃ i ∈ r, U i)) → ∃ r : Set ι, r.Countable ∧ (⋃₀ S ⊆ ⋃ i ∈ r, U i) := by intro S hS hsr choose! r hr using hsr refine ⟨⋃ s ∈ S, r s, hS.biUnion_iff.mpr (fun s hs ↦ (hr s hs).1), ?_⟩ refine sUnion_subset ?h.right.h simp only [mem_iUnion, exists_prop, iUnion_exists, biUnion_and'] exact fun i is x hx ↦ mem_biUnion is ((hr i is).2 hx) have h_nhds : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, ∃ r : Set ι, r.Countable ∧ (t ⊆ ⋃ i ∈ r, U i) := by intro x hx let ⟨i, hi⟩ := mem_iUnion.1 (hsU hx) refine ⟨U i, mem_nhdsWithin_of_mem_nhds ((hUo i).mem_nhds hi), {i}, by simp, ?_⟩ simp only [mem_singleton_iff, iUnion_iUnion_eq_left] exact Subset.refl _ exact hs.induction_on hmono hcountable_union h_nhds theorem IsLindelof.elim_nhds_subcover' (hs : IsLindelof s) (U : ∀ x ∈ s, Set X) (hU : ∀ x (hx : x ∈ s), U x ‹x ∈ s› ∈ 𝓝 x) : ∃ t : Set s, t.Countable ∧ s ⊆ ⋃ x ∈ t, U (x : s) x.2 := by have := hs.elim_countable_subcover (fun x : s ↦ interior (U x x.2)) (fun _ ↦ isOpen_interior) fun x hx ↦ mem_iUnion.2 ⟨⟨x, hx⟩, mem_interior_iff_mem_nhds.2 <| hU _ _⟩ rcases this with ⟨r, ⟨hr, hs⟩⟩ use r, hr apply Subset.trans hs apply iUnion₂_subset intro i hi apply Subset.trans interior_subset exact subset_iUnion_of_subset i (subset_iUnion_of_subset hi (Subset.refl _)) theorem IsLindelof.elim_nhds_subcover (hs : IsLindelof s) (U : X → Set X) (hU : ∀ x ∈ s, U x ∈ 𝓝 x) : ∃ t : Set X, t.Countable ∧ (∀ x ∈ t, x ∈ s) ∧ s ⊆ ⋃ x ∈ t, U x := by let ⟨t, ⟨htc, htsub⟩⟩ := hs.elim_nhds_subcover' (fun x _ ↦ U x) hU refine ⟨↑t, Countable.image htc Subtype.val, ?_⟩ constructor · intro _ simp only [mem_image, Subtype.exists, exists_and_right, exists_eq_right, forall_exists_index] tauto · have : ⋃ x ∈ t, U ↑x = ⋃ x ∈ Subtype.val '' t, U x := biUnion_image.symm rwa [← this] theorem IsLindelof.disjoint_nhdsSet_left {l : Filter X} [CountableInterFilter l] (hs : IsLindelof s) : Disjoint (𝓝ˢ s) l ↔ ∀ x ∈ s, Disjoint (𝓝 x) l := by refine ⟨fun h x hx ↦ h.mono_left <| nhds_le_nhdsSet hx, fun H ↦ ?_⟩ choose! U hxU hUl using fun x hx ↦ (nhds_basis_opens x).disjoint_iff_left.1 (H x hx) choose hxU hUo using hxU rcases hs.elim_nhds_subcover U fun x hx ↦ (hUo x hx).mem_nhds (hxU x hx) with ⟨t, htc, hts, hst⟩ refine (hasBasis_nhdsSet _).disjoint_iff_left.2 ⟨⋃ x ∈ t, U x, ⟨isOpen_biUnion fun x hx ↦ hUo x (hts x hx), hst⟩, ?_⟩ rw [compl_iUnion₂] exact (countable_bInter_mem htc).mpr (fun i hi ↦ hUl _ (hts _ hi)) theorem IsLindelof.disjoint_nhdsSet_right {l : Filter X} [CountableInterFilter l] (hs : IsLindelof s) : Disjoint l (𝓝ˢ s) ↔ ∀ x ∈ s, Disjoint l (𝓝 x) := by simpa only [disjoint_comm] using hs.disjoint_nhdsSet_left theorem IsLindelof.elim_countable_subfamily_closed {ι : Type v} (hs : IsLindelof s) (t : ι → Set X) (htc : ∀ i, IsClosed (t i)) (hst : (s ∩ ⋂ i, t i) = ∅) : ∃ u : Set ι, u.Countable ∧ (s ∩ ⋂ i ∈ u, t i) = ∅ := by let U := tᶜ have hUo : ∀ i, IsOpen (U i) := by simp only [U, Pi.compl_apply, isOpen_compl_iff]; exact htc have hsU : s ⊆ ⋃ i, U i := by simp only [U, Pi.compl_apply] rw [← compl_iInter] apply disjoint_compl_left_iff_subset.mp simp only [compl_iInter, compl_iUnion, compl_compl] apply Disjoint.symm exact disjoint_iff_inter_eq_empty.mpr hst rcases hs.elim_countable_subcover U hUo hsU with ⟨u, ⟨hucount, husub⟩⟩ use u, hucount rw [← disjoint_compl_left_iff_subset] at husub simp only [U, Pi.compl_apply, compl_iUnion, compl_compl] at husub exact disjoint_iff_inter_eq_empty.mp (Disjoint.symm husub)
Mathlib/Topology/Compactness/Lindelof.lean
223
228
theorem IsLindelof.inter_iInter_nonempty {ι : Type v} (hs : IsLindelof s) (t : ι → Set X) (htc : ∀ i, IsClosed (t i)) (hst : ∀ u : Set ι, u.Countable ∧ (s ∩ ⋂ i ∈ u, t i).Nonempty) : (s ∩ ⋂ i, t i).Nonempty := by
contrapose! hst rcases hs.elim_countable_subfamily_closed t htc hst with ⟨u, ⟨_, husub⟩⟩ exact ⟨u, fun _ ↦ husub⟩
import Mathlib.MeasureTheory.Function.AEEqOfIntegral import Mathlib.MeasureTheory.Function.ConditionalExpectation.AEMeasurable #align_import measure_theory.function.conditional_expectation.unique from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e" set_option linter.uppercaseLean3 false open scoped ENNReal MeasureTheory namespace MeasureTheory variable {α E' F' 𝕜 : Type*} {p : ℝ≥0∞} {m m0 : MeasurableSpace α} {μ : Measure α} [RCLike 𝕜] -- 𝕜 for ℝ or ℂ -- E' for an inner product space on which we compute integrals [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] [CompleteSpace E'] [NormedSpace ℝ E'] -- F' for integrals on a Lp submodule [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] [NormedSpace ℝ F'] [CompleteSpace F'] section UniquenessOfConditionalExpectation theorem lpMeas.ae_eq_zero_of_forall_setIntegral_eq_zero (hm : m ≤ m0) (f : lpMeas E' 𝕜 m p μ) (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) -- Porting note: needed to add explicit casts in the next two hypotheses (hf_int_finite : ∀ s, MeasurableSet[m] s → μ s < ∞ → IntegrableOn (f : Lp E' p μ) s μ) (hf_zero : ∀ s : Set α, MeasurableSet[m] s → μ s < ∞ → ∫ x in s, (f : Lp E' p μ) x ∂μ = 0) : f =ᵐ[μ] (0 : α → E') := by obtain ⟨g, hg_sm, hfg⟩ := lpMeas.ae_fin_strongly_measurable' hm f hp_ne_zero hp_ne_top refine hfg.trans ?_ -- Porting note: added unfold Filter.EventuallyEq at hfg refine ae_eq_zero_of_forall_setIntegral_eq_of_finStronglyMeasurable_trim hm ?_ ?_ hg_sm · intro s hs hμs have hfg_restrict : f =ᵐ[μ.restrict s] g := ae_restrict_of_ae hfg rw [IntegrableOn, integrable_congr hfg_restrict.symm] exact hf_int_finite s hs hμs · intro s hs hμs have hfg_restrict : f =ᵐ[μ.restrict s] g := ae_restrict_of_ae hfg rw [integral_congr_ae hfg_restrict.symm] exact hf_zero s hs hμs #align measure_theory.Lp_meas.ae_eq_zero_of_forall_set_integral_eq_zero MeasureTheory.lpMeas.ae_eq_zero_of_forall_setIntegral_eq_zero @[deprecated (since := "2024-04-17")] alias lpMeas.ae_eq_zero_of_forall_set_integral_eq_zero := lpMeas.ae_eq_zero_of_forall_setIntegral_eq_zero variable (𝕜) theorem Lp.ae_eq_zero_of_forall_setIntegral_eq_zero' (hm : m ≤ m0) (f : Lp E' p μ) (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) (hf_int_finite : ∀ s, MeasurableSet[m] s → μ s < ∞ → IntegrableOn f s μ) (hf_zero : ∀ s : Set α, MeasurableSet[m] s → μ s < ∞ → ∫ x in s, f x ∂μ = 0) (hf_meas : AEStronglyMeasurable' m f μ) : f =ᵐ[μ] 0 := by let f_meas : lpMeas E' 𝕜 m p μ := ⟨f, hf_meas⟩ -- Porting note: `simp only` does not call `rfl` to try to close the goal. See https://github.com/leanprover-community/mathlib4/issues/5025 have hf_f_meas : f =ᵐ[μ] f_meas := by simp only [Subtype.coe_mk]; rfl refine hf_f_meas.trans ?_ refine lpMeas.ae_eq_zero_of_forall_setIntegral_eq_zero hm f_meas hp_ne_zero hp_ne_top ?_ ?_ · intro s hs hμs have hfg_restrict : f =ᵐ[μ.restrict s] f_meas := ae_restrict_of_ae hf_f_meas rw [IntegrableOn, integrable_congr hfg_restrict.symm] exact hf_int_finite s hs hμs · intro s hs hμs have hfg_restrict : f =ᵐ[μ.restrict s] f_meas := ae_restrict_of_ae hf_f_meas rw [integral_congr_ae hfg_restrict.symm] exact hf_zero s hs hμs #align measure_theory.Lp.ae_eq_zero_of_forall_set_integral_eq_zero' MeasureTheory.Lp.ae_eq_zero_of_forall_setIntegral_eq_zero' @[deprecated (since := "2024-04-17")] alias Lp.ae_eq_zero_of_forall_set_integral_eq_zero' := Lp.ae_eq_zero_of_forall_setIntegral_eq_zero' theorem Lp.ae_eq_of_forall_setIntegral_eq' (hm : m ≤ m0) (f g : Lp E' p μ) (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) (hf_int_finite : ∀ s, MeasurableSet[m] s → μ s < ∞ → IntegrableOn f s μ) (hg_int_finite : ∀ s, MeasurableSet[m] s → μ s < ∞ → IntegrableOn g s μ) (hfg : ∀ s : Set α, MeasurableSet[m] s → μ s < ∞ → ∫ x in s, f x ∂μ = ∫ x in s, g x ∂μ) (hf_meas : AEStronglyMeasurable' m f μ) (hg_meas : AEStronglyMeasurable' m g μ) : f =ᵐ[μ] g := by suffices h_sub : ⇑(f - g) =ᵐ[μ] 0 by rw [← sub_ae_eq_zero]; exact (Lp.coeFn_sub f g).symm.trans h_sub have hfg' : ∀ s : Set α, MeasurableSet[m] s → μ s < ∞ → (∫ x in s, (f - g) x ∂μ) = 0 := by intro s hs hμs rw [integral_congr_ae (ae_restrict_of_ae (Lp.coeFn_sub f g))] rw [integral_sub' (hf_int_finite s hs hμs) (hg_int_finite s hs hμs)] exact sub_eq_zero.mpr (hfg s hs hμs) have hfg_int : ∀ s, MeasurableSet[m] s → μ s < ∞ → IntegrableOn (⇑(f - g)) s μ := by intro s hs hμs rw [IntegrableOn, integrable_congr (ae_restrict_of_ae (Lp.coeFn_sub f g))] exact (hf_int_finite s hs hμs).sub (hg_int_finite s hs hμs) have hfg_meas : AEStronglyMeasurable' m (⇑(f - g)) μ := AEStronglyMeasurable'.congr (hf_meas.sub hg_meas) (Lp.coeFn_sub f g).symm exact Lp.ae_eq_zero_of_forall_setIntegral_eq_zero' 𝕜 hm (f - g) hp_ne_zero hp_ne_top hfg_int hfg' hfg_meas #align measure_theory.Lp.ae_eq_of_forall_set_integral_eq' MeasureTheory.Lp.ae_eq_of_forall_setIntegral_eq' @[deprecated (since := "2024-04-17")] alias Lp.ae_eq_of_forall_set_integral_eq' := Lp.ae_eq_of_forall_setIntegral_eq' variable {𝕜}
Mathlib/MeasureTheory/Function/ConditionalExpectation/Unique.lean
130
169
theorem ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' (hm : m ≤ m0) [SigmaFinite (μ.trim hm)] {f g : α → F'} (hf_int_finite : ∀ s, MeasurableSet[m] s → μ s < ∞ → IntegrableOn f s μ) (hg_int_finite : ∀ s, MeasurableSet[m] s → μ s < ∞ → IntegrableOn g s μ) (hfg_eq : ∀ s : Set α, MeasurableSet[m] s → μ s < ∞ → ∫ x in s, f x ∂μ = ∫ x in s, g x ∂μ) (hfm : AEStronglyMeasurable' m f μ) (hgm : AEStronglyMeasurable' m g μ) : f =ᵐ[μ] g := by
rw [← ae_eq_trim_iff_of_aeStronglyMeasurable' hm hfm hgm] have hf_mk_int_finite : ∀ s, MeasurableSet[m] s → μ.trim hm s < ∞ → @IntegrableOn _ _ m _ (hfm.mk f) s (μ.trim hm) := by intro s hs hμs rw [trim_measurableSet_eq hm hs] at hμs -- Porting note: `rw [IntegrableOn]` fails with -- synthesized type class instance is not definitionally equal to expression inferred by typing -- rules, synthesized m0 inferred m unfold IntegrableOn rw [restrict_trim hm _ hs] refine Integrable.trim hm ?_ hfm.stronglyMeasurable_mk exact Integrable.congr (hf_int_finite s hs hμs) (ae_restrict_of_ae hfm.ae_eq_mk) have hg_mk_int_finite : ∀ s, MeasurableSet[m] s → μ.trim hm s < ∞ → @IntegrableOn _ _ m _ (hgm.mk g) s (μ.trim hm) := by intro s hs hμs rw [trim_measurableSet_eq hm hs] at hμs -- Porting note: `rw [IntegrableOn]` fails with -- synthesized type class instance is not definitionally equal to expression inferred by typing -- rules, synthesized m0 inferred m unfold IntegrableOn rw [restrict_trim hm _ hs] refine Integrable.trim hm ?_ hgm.stronglyMeasurable_mk exact Integrable.congr (hg_int_finite s hs hμs) (ae_restrict_of_ae hgm.ae_eq_mk) have hfg_mk_eq : ∀ s : Set α, MeasurableSet[m] s → μ.trim hm s < ∞ → ∫ x in s, hfm.mk f x ∂μ.trim hm = ∫ x in s, hgm.mk g x ∂μ.trim hm := by intro s hs hμs rw [trim_measurableSet_eq hm hs] at hμs rw [restrict_trim hm _ hs, ← integral_trim hm hfm.stronglyMeasurable_mk, ← integral_trim hm hgm.stronglyMeasurable_mk, integral_congr_ae (ae_restrict_of_ae hfm.ae_eq_mk.symm), integral_congr_ae (ae_restrict_of_ae hgm.ae_eq_mk.symm)] exact hfg_eq s hs hμs exact ae_eq_of_forall_setIntegral_eq_of_sigmaFinite hf_mk_int_finite hg_mk_int_finite hfg_mk_eq
import Mathlib.MeasureTheory.Measure.Typeclasses import Mathlib.MeasureTheory.Measure.MutuallySingular import Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated open Function Set open scoped ENNReal Classical noncomputable section variable {α β δ : Type*} [MeasurableSpace α] [MeasurableSpace β] {s : Set α} {a : α} namespace MeasureTheory namespace Measure def dirac (a : α) : Measure α := (OuterMeasure.dirac a).toMeasure (by simp) #align measure_theory.measure.dirac MeasureTheory.Measure.dirac instance : MeasureSpace PUnit := ⟨dirac PUnit.unit⟩ theorem le_dirac_apply {a} : s.indicator 1 a ≤ dirac a s := OuterMeasure.dirac_apply a s ▸ le_toMeasure_apply _ _ _ #align measure_theory.measure.le_dirac_apply MeasureTheory.Measure.le_dirac_apply @[simp] theorem dirac_apply' (a : α) (hs : MeasurableSet s) : dirac a s = s.indicator 1 a := toMeasure_apply _ _ hs #align measure_theory.measure.dirac_apply' MeasureTheory.Measure.dirac_apply' @[simp]
Mathlib/MeasureTheory/Measure/Dirac.lean
45
49
theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by
have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1 refine le_antisymm (this univ trivial ▸ ?_) (this s h ▸ le_dirac_apply) rw [← dirac_apply' a MeasurableSet.univ] exact measure_mono (subset_univ s)
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} variable [TopologicalSpace α] @[simp] theorem nhds_bind_nhdsWithin {a : α} {s : Set α} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_arg₂ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : α} {s : Set α} {p : α → Prop} : (∀ᶠ y in 𝓝 a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : α} {s : Set α} {p : α → Prop} : (∀ᶠ x in 𝓝[s] a, p x) ↔ ∀ᶠ x in 𝓝 a, x ∈ s → p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : α} {s : Set α} {p : α → Prop} : (∃ᶠ x in 𝓝[s] z, p x) ↔ ∃ᶠ x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff theorem mem_closure_ne_iff_frequently_within {z : α} {s : Set α} : z ∈ closure (s \ {z}) ↔ ∃ᶠ x in 𝓝[≠] z, x ∈ s := by simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff] #align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within @[simp] theorem eventually_nhdsWithin_nhdsWithin {a : α} {s : Set α} {p : α → Prop} : (∀ᶠ y in 𝓝[s] a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x := by refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩ simp only [eventually_nhdsWithin_iff] at h ⊢ exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs #align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin theorem nhdsWithin_eq (a : α) (s : Set α) : 𝓝[s] a = ⨅ t ∈ { t : Set α | a ∈ t ∧ IsOpen t }, 𝓟 (t ∩ s) := ((nhds_basis_opens a).inf_principal s).eq_biInf #align nhds_within_eq nhdsWithin_eq theorem nhdsWithin_univ (a : α) : 𝓝[Set.univ] a = 𝓝 a := by rw [nhdsWithin, principal_univ, inf_top_eq] #align nhds_within_univ nhdsWithin_univ theorem nhdsWithin_hasBasis {p : β → Prop} {s : β → Set α} {a : α} (h : (𝓝 a).HasBasis p s) (t : Set α) : (𝓝[t] a).HasBasis p fun i => s i ∩ t := h.inf_principal t #align nhds_within_has_basis nhdsWithin_hasBasis theorem nhdsWithin_basis_open (a : α) (t : Set α) : (𝓝[t] a).HasBasis (fun u => a ∈ u ∧ IsOpen u) fun u => u ∩ t := nhdsWithin_hasBasis (nhds_basis_opens a) t #align nhds_within_basis_open nhdsWithin_basis_open theorem mem_nhdsWithin {t : Set α} {a : α} {s : Set α} : t ∈ 𝓝[s] a ↔ ∃ u, IsOpen u ∧ a ∈ u ∧ u ∩ s ⊆ t := by simpa only [and_assoc, and_left_comm] using (nhdsWithin_basis_open a s).mem_iff #align mem_nhds_within mem_nhdsWithin theorem mem_nhdsWithin_iff_exists_mem_nhds_inter {t : Set α} {a : α} {s : Set α} : t ∈ 𝓝[s] a ↔ ∃ u ∈ 𝓝 a, u ∩ s ⊆ t := (nhdsWithin_hasBasis (𝓝 a).basis_sets s).mem_iff #align mem_nhds_within_iff_exists_mem_nhds_inter mem_nhdsWithin_iff_exists_mem_nhds_inter theorem diff_mem_nhdsWithin_compl {x : α} {s : Set α} (hs : s ∈ 𝓝 x) (t : Set α) : s \ t ∈ 𝓝[tᶜ] x := diff_mem_inf_principal_compl hs t #align diff_mem_nhds_within_compl diff_mem_nhdsWithin_compl theorem diff_mem_nhdsWithin_diff {x : α} {s t : Set α} (hs : s ∈ 𝓝[t] x) (t' : Set α) : s \ t' ∈ 𝓝[t \ t'] x := by rw [nhdsWithin, diff_eq, diff_eq, ← inf_principal, ← inf_assoc] exact inter_mem_inf hs (mem_principal_self _) #align diff_mem_nhds_within_diff diff_mem_nhdsWithin_diff theorem nhds_of_nhdsWithin_of_nhds {s t : Set α} {a : α} (h1 : s ∈ 𝓝 a) (h2 : t ∈ 𝓝[s] a) : t ∈ 𝓝 a := by rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.mp h2 with ⟨_, Hw, hw⟩ exact (𝓝 a).sets_of_superset ((𝓝 a).inter_sets Hw h1) hw #align nhds_of_nhds_within_of_nhds nhds_of_nhdsWithin_of_nhds theorem mem_nhdsWithin_iff_eventually {s t : Set α} {x : α} : t ∈ 𝓝[s] x ↔ ∀ᶠ y in 𝓝 x, y ∈ s → y ∈ t := eventually_inf_principal #align mem_nhds_within_iff_eventually mem_nhdsWithin_iff_eventually theorem mem_nhdsWithin_iff_eventuallyEq {s t : Set α} {x : α} : t ∈ 𝓝[s] x ↔ s =ᶠ[𝓝 x] (s ∩ t : Set α) := by simp_rw [mem_nhdsWithin_iff_eventually, eventuallyEq_set, mem_inter_iff, iff_self_and] #align mem_nhds_within_iff_eventually_eq mem_nhdsWithin_iff_eventuallyEq theorem nhdsWithin_eq_iff_eventuallyEq {s t : Set α} {x : α} : 𝓝[s] x = 𝓝[t] x ↔ s =ᶠ[𝓝 x] t := set_eventuallyEq_iff_inf_principal.symm #align nhds_within_eq_iff_eventually_eq nhdsWithin_eq_iff_eventuallyEq theorem nhdsWithin_le_iff {s t : Set α} {x : α} : 𝓝[s] x ≤ 𝓝[t] x ↔ t ∈ 𝓝[s] x := set_eventuallyLE_iff_inf_principal_le.symm.trans set_eventuallyLE_iff_mem_inf_principal #align nhds_within_le_iff nhdsWithin_le_iff -- Porting note: golfed, dropped an unneeded assumption theorem preimage_nhdsWithin_coinduced' {π : α → β} {s : Set β} {t : Set α} {a : α} (h : a ∈ t) (hs : s ∈ @nhds β (.coinduced (fun x : t => π x) inferInstance) (π a)) : π ⁻¹' s ∈ 𝓝[t] a := by lift a to t using h replace hs : (fun x : t => π x) ⁻¹' s ∈ 𝓝 a := preimage_nhds_coinduced hs rwa [← map_nhds_subtype_val, mem_map] #align preimage_nhds_within_coinduced' preimage_nhdsWithin_coinduced'ₓ theorem mem_nhdsWithin_of_mem_nhds {s t : Set α} {a : α} (h : s ∈ 𝓝 a) : s ∈ 𝓝[t] a := mem_inf_of_left h #align mem_nhds_within_of_mem_nhds mem_nhdsWithin_of_mem_nhds theorem self_mem_nhdsWithin {a : α} {s : Set α} : s ∈ 𝓝[s] a := mem_inf_of_right (mem_principal_self s) #align self_mem_nhds_within self_mem_nhdsWithin theorem eventually_mem_nhdsWithin {a : α} {s : Set α} : ∀ᶠ x in 𝓝[s] a, x ∈ s := self_mem_nhdsWithin #align eventually_mem_nhds_within eventually_mem_nhdsWithin theorem inter_mem_nhdsWithin (s : Set α) {t : Set α} {a : α} (h : t ∈ 𝓝 a) : s ∩ t ∈ 𝓝[s] a := inter_mem self_mem_nhdsWithin (mem_inf_of_left h) #align inter_mem_nhds_within inter_mem_nhdsWithin theorem nhdsWithin_mono (a : α) {s t : Set α} (h : s ⊆ t) : 𝓝[s] a ≤ 𝓝[t] a := inf_le_inf_left _ (principal_mono.mpr h) #align nhds_within_mono nhdsWithin_mono theorem pure_le_nhdsWithin {a : α} {s : Set α} (ha : a ∈ s) : pure a ≤ 𝓝[s] a := le_inf (pure_le_nhds a) (le_principal_iff.2 ha) #align pure_le_nhds_within pure_le_nhdsWithin theorem mem_of_mem_nhdsWithin {a : α} {s t : Set α} (ha : a ∈ s) (ht : t ∈ 𝓝[s] a) : a ∈ t := pure_le_nhdsWithin ha ht #align mem_of_mem_nhds_within mem_of_mem_nhdsWithin theorem Filter.Eventually.self_of_nhdsWithin {p : α → Prop} {s : Set α} {x : α} (h : ∀ᶠ y in 𝓝[s] x, p y) (hx : x ∈ s) : p x := mem_of_mem_nhdsWithin hx h #align filter.eventually.self_of_nhds_within Filter.Eventually.self_of_nhdsWithin theorem tendsto_const_nhdsWithin {l : Filter β} {s : Set α} {a : α} (ha : a ∈ s) : Tendsto (fun _ : β => a) l (𝓝[s] a) := tendsto_const_pure.mono_right <| pure_le_nhdsWithin ha #align tendsto_const_nhds_within tendsto_const_nhdsWithin theorem nhdsWithin_restrict'' {a : α} (s : Set α) {t : Set α} (h : t ∈ 𝓝[s] a) : 𝓝[s] a = 𝓝[s ∩ t] a := le_antisymm (le_inf inf_le_left (le_principal_iff.mpr (inter_mem self_mem_nhdsWithin h))) (inf_le_inf_left _ (principal_mono.mpr Set.inter_subset_left)) #align nhds_within_restrict'' nhdsWithin_restrict'' theorem nhdsWithin_restrict' {a : α} (s : Set α) {t : Set α} (h : t ∈ 𝓝 a) : 𝓝[s] a = 𝓝[s ∩ t] a := nhdsWithin_restrict'' s <| mem_inf_of_left h #align nhds_within_restrict' nhdsWithin_restrict' theorem nhdsWithin_restrict {a : α} (s : Set α) {t : Set α} (h₀ : a ∈ t) (h₁ : IsOpen t) : 𝓝[s] a = 𝓝[s ∩ t] a := nhdsWithin_restrict' s (IsOpen.mem_nhds h₁ h₀) #align nhds_within_restrict nhdsWithin_restrict theorem nhdsWithin_le_of_mem {a : α} {s t : Set α} (h : s ∈ 𝓝[t] a) : 𝓝[t] a ≤ 𝓝[s] a := nhdsWithin_le_iff.mpr h #align nhds_within_le_of_mem nhdsWithin_le_of_mem theorem nhdsWithin_le_nhds {a : α} {s : Set α} : 𝓝[s] a ≤ 𝓝 a := by rw [← nhdsWithin_univ] apply nhdsWithin_le_of_mem exact univ_mem #align nhds_within_le_nhds nhdsWithin_le_nhds theorem nhdsWithin_eq_nhdsWithin' {a : α} {s t u : Set α} (hs : s ∈ 𝓝 a) (h₂ : t ∩ s = u ∩ s) : 𝓝[t] a = 𝓝[u] a := by rw [nhdsWithin_restrict' t hs, nhdsWithin_restrict' u hs, h₂] #align nhds_within_eq_nhds_within' nhdsWithin_eq_nhdsWithin' theorem nhdsWithin_eq_nhdsWithin {a : α} {s t u : Set α} (h₀ : a ∈ s) (h₁ : IsOpen s) (h₂ : t ∩ s = u ∩ s) : 𝓝[t] a = 𝓝[u] a := by rw [nhdsWithin_restrict t h₀ h₁, nhdsWithin_restrict u h₀ h₁, h₂] #align nhds_within_eq_nhds_within nhdsWithin_eq_nhdsWithin @[simp] theorem nhdsWithin_eq_nhds {a : α} {s : Set α} : 𝓝[s] a = 𝓝 a ↔ s ∈ 𝓝 a := inf_eq_left.trans le_principal_iff #align nhds_within_eq_nhds nhdsWithin_eq_nhds theorem IsOpen.nhdsWithin_eq {a : α} {s : Set α} (h : IsOpen s) (ha : a ∈ s) : 𝓝[s] a = 𝓝 a := nhdsWithin_eq_nhds.2 <| h.mem_nhds ha #align is_open.nhds_within_eq IsOpen.nhdsWithin_eq theorem preimage_nhds_within_coinduced {π : α → β} {s : Set β} {t : Set α} {a : α} (h : a ∈ t) (ht : IsOpen t) (hs : s ∈ @nhds β (.coinduced (fun x : t => π x) inferInstance) (π a)) : π ⁻¹' s ∈ 𝓝 a := by rw [← ht.nhdsWithin_eq h] exact preimage_nhdsWithin_coinduced' h hs #align preimage_nhds_within_coinduced preimage_nhds_within_coinduced @[simp] theorem nhdsWithin_empty (a : α) : 𝓝[∅] a = ⊥ := by rw [nhdsWithin, principal_empty, inf_bot_eq] #align nhds_within_empty nhdsWithin_empty theorem nhdsWithin_union (a : α) (s t : Set α) : 𝓝[s ∪ t] a = 𝓝[s] a ⊔ 𝓝[t] a := by delta nhdsWithin rw [← inf_sup_left, sup_principal] #align nhds_within_union nhdsWithin_union theorem nhdsWithin_biUnion {ι} {I : Set ι} (hI : I.Finite) (s : ι → Set α) (a : α) : 𝓝[⋃ i ∈ I, s i] a = ⨆ i ∈ I, 𝓝[s i] a := Set.Finite.induction_on hI (by simp) fun _ _ hT ↦ by simp only [hT, nhdsWithin_union, iSup_insert, biUnion_insert] #align nhds_within_bUnion nhdsWithin_biUnion theorem nhdsWithin_sUnion {S : Set (Set α)} (hS : S.Finite) (a : α) : 𝓝[⋃₀ S] a = ⨆ s ∈ S, 𝓝[s] a := by rw [sUnion_eq_biUnion, nhdsWithin_biUnion hS] #align nhds_within_sUnion nhdsWithin_sUnion theorem nhdsWithin_iUnion {ι} [Finite ι] (s : ι → Set α) (a : α) : 𝓝[⋃ i, s i] a = ⨆ i, 𝓝[s i] a := by rw [← sUnion_range, nhdsWithin_sUnion (finite_range s), iSup_range] #align nhds_within_Union nhdsWithin_iUnion theorem nhdsWithin_inter (a : α) (s t : Set α) : 𝓝[s ∩ t] a = 𝓝[s] a ⊓ 𝓝[t] a := by delta nhdsWithin rw [inf_left_comm, inf_assoc, inf_principal, ← inf_assoc, inf_idem] #align nhds_within_inter nhdsWithin_inter theorem nhdsWithin_inter' (a : α) (s t : Set α) : 𝓝[s ∩ t] a = 𝓝[s] a ⊓ 𝓟 t := by delta nhdsWithin rw [← inf_principal, inf_assoc] #align nhds_within_inter' nhdsWithin_inter' theorem nhdsWithin_inter_of_mem {a : α} {s t : Set α} (h : s ∈ 𝓝[t] a) : 𝓝[s ∩ t] a = 𝓝[t] a := by rw [nhdsWithin_inter, inf_eq_right] exact nhdsWithin_le_of_mem h #align nhds_within_inter_of_mem nhdsWithin_inter_of_mem theorem nhdsWithin_inter_of_mem' {a : α} {s t : Set α} (h : t ∈ 𝓝[s] a) : 𝓝[s ∩ t] a = 𝓝[s] a := by rw [inter_comm, nhdsWithin_inter_of_mem h] #align nhds_within_inter_of_mem' nhdsWithin_inter_of_mem' @[simp] theorem nhdsWithin_singleton (a : α) : 𝓝[{a}] a = pure a := by rw [nhdsWithin, principal_singleton, inf_eq_right.2 (pure_le_nhds a)] #align nhds_within_singleton nhdsWithin_singleton @[simp] theorem nhdsWithin_insert (a : α) (s : Set α) : 𝓝[insert a s] a = pure a ⊔ 𝓝[s] a := by rw [← singleton_union, nhdsWithin_union, nhdsWithin_singleton] #align nhds_within_insert nhdsWithin_insert theorem mem_nhdsWithin_insert {a : α} {s t : Set α} : t ∈ 𝓝[insert a s] a ↔ a ∈ t ∧ t ∈ 𝓝[s] a := by simp #align mem_nhds_within_insert mem_nhdsWithin_insert theorem insert_mem_nhdsWithin_insert {a : α} {s t : Set α} (h : t ∈ 𝓝[s] a) : insert a t ∈ 𝓝[insert a s] a := by simp [mem_of_superset h] #align insert_mem_nhds_within_insert insert_mem_nhdsWithin_insert theorem insert_mem_nhds_iff {a : α} {s : Set α} : insert a s ∈ 𝓝 a ↔ s ∈ 𝓝[≠] a := by simp only [nhdsWithin, mem_inf_principal, mem_compl_iff, mem_singleton_iff, or_iff_not_imp_left, insert_def] #align insert_mem_nhds_iff insert_mem_nhds_iff @[simp] theorem nhdsWithin_compl_singleton_sup_pure (a : α) : 𝓝[≠] a ⊔ pure a = 𝓝 a := by rw [← nhdsWithin_singleton, ← nhdsWithin_union, compl_union_self, nhdsWithin_univ] #align nhds_within_compl_singleton_sup_pure nhdsWithin_compl_singleton_sup_pure theorem nhdsWithin_prod {α : Type*} [TopologicalSpace α] {β : Type*} [TopologicalSpace β] {s u : Set α} {t v : Set β} {a : α} {b : β} (hu : u ∈ 𝓝[s] a) (hv : v ∈ 𝓝[t] b) : u ×ˢ v ∈ 𝓝[s ×ˢ t] (a, b) := by rw [nhdsWithin_prod_eq] exact prod_mem_prod hu hv #align nhds_within_prod nhdsWithin_prod theorem nhdsWithin_pi_eq' {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] {I : Set ι} (hI : I.Finite) (s : ∀ i, Set (α i)) (x : ∀ i, α i) : 𝓝[pi I s] x = ⨅ i, comap (fun x => x i) (𝓝 (x i) ⊓ ⨅ (_ : i ∈ I), 𝓟 (s i)) := by simp only [nhdsWithin, nhds_pi, Filter.pi, comap_inf, comap_iInf, pi_def, comap_principal, ← iInf_principal_finite hI, ← iInf_inf_eq] #align nhds_within_pi_eq' nhdsWithin_pi_eq' theorem nhdsWithin_pi_eq {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] {I : Set ι} (hI : I.Finite) (s : ∀ i, Set (α i)) (x : ∀ i, α i) : 𝓝[pi I s] x = (⨅ i ∈ I, comap (fun x => x i) (𝓝[s i] x i)) ⊓ ⨅ (i) (_ : i ∉ I), comap (fun x => x i) (𝓝 (x i)) := by simp only [nhdsWithin, nhds_pi, Filter.pi, pi_def, ← iInf_principal_finite hI, comap_inf, comap_principal, eval] rw [iInf_split _ fun i => i ∈ I, inf_right_comm] simp only [iInf_inf_eq] #align nhds_within_pi_eq nhdsWithin_pi_eq theorem nhdsWithin_pi_univ_eq {ι : Type*} {α : ι → Type*} [Finite ι] [∀ i, TopologicalSpace (α i)] (s : ∀ i, Set (α i)) (x : ∀ i, α i) : 𝓝[pi univ s] x = ⨅ i, comap (fun x => x i) (𝓝[s i] x i) := by simpa [nhdsWithin] using nhdsWithin_pi_eq finite_univ s x #align nhds_within_pi_univ_eq nhdsWithin_pi_univ_eq theorem nhdsWithin_pi_eq_bot {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] {I : Set ι} {s : ∀ i, Set (α i)} {x : ∀ i, α i} : 𝓝[pi I s] x = ⊥ ↔ ∃ i ∈ I, 𝓝[s i] x i = ⊥ := by simp only [nhdsWithin, nhds_pi, pi_inf_principal_pi_eq_bot] #align nhds_within_pi_eq_bot nhdsWithin_pi_eq_bot theorem nhdsWithin_pi_neBot {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] {I : Set ι} {s : ∀ i, Set (α i)} {x : ∀ i, α i} : (𝓝[pi I s] x).NeBot ↔ ∀ i ∈ I, (𝓝[s i] x i).NeBot := by simp [neBot_iff, nhdsWithin_pi_eq_bot] #align nhds_within_pi_ne_bot nhdsWithin_pi_neBot theorem Filter.Tendsto.piecewise_nhdsWithin {f g : α → β} {t : Set α} [∀ x, Decidable (x ∈ t)] {a : α} {s : Set α} {l : Filter β} (h₀ : Tendsto f (𝓝[s ∩ t] a) l) (h₁ : Tendsto g (𝓝[s ∩ tᶜ] a) l) : Tendsto (piecewise t f g) (𝓝[s] a) l := by apply Tendsto.piecewise <;> rwa [← nhdsWithin_inter'] #align filter.tendsto.piecewise_nhds_within Filter.Tendsto.piecewise_nhdsWithin theorem Filter.Tendsto.if_nhdsWithin {f g : α → β} {p : α → Prop} [DecidablePred p] {a : α} {s : Set α} {l : Filter β} (h₀ : Tendsto f (𝓝[s ∩ { x | p x }] a) l) (h₁ : Tendsto g (𝓝[s ∩ { x | ¬p x }] a) l) : Tendsto (fun x => if p x then f x else g x) (𝓝[s] a) l := h₀.piecewise_nhdsWithin h₁ #align filter.tendsto.if_nhds_within Filter.Tendsto.if_nhdsWithin theorem map_nhdsWithin (f : α → β) (a : α) (s : Set α) : map f (𝓝[s] a) = ⨅ t ∈ { t : Set α | a ∈ t ∧ IsOpen t }, 𝓟 (f '' (t ∩ s)) := ((nhdsWithin_basis_open a s).map f).eq_biInf #align map_nhds_within map_nhdsWithin theorem tendsto_nhdsWithin_mono_left {f : α → β} {a : α} {s t : Set α} {l : Filter β} (hst : s ⊆ t) (h : Tendsto f (𝓝[t] a) l) : Tendsto f (𝓝[s] a) l := h.mono_left <| nhdsWithin_mono a hst #align tendsto_nhds_within_mono_left tendsto_nhdsWithin_mono_left theorem tendsto_nhdsWithin_mono_right {f : β → α} {l : Filter β} {a : α} {s t : Set α} (hst : s ⊆ t) (h : Tendsto f l (𝓝[s] a)) : Tendsto f l (𝓝[t] a) := h.mono_right (nhdsWithin_mono a hst) #align tendsto_nhds_within_mono_right tendsto_nhdsWithin_mono_right theorem tendsto_nhdsWithin_of_tendsto_nhds {f : α → β} {a : α} {s : Set α} {l : Filter β} (h : Tendsto f (𝓝 a) l) : Tendsto f (𝓝[s] a) l := h.mono_left inf_le_left #align tendsto_nhds_within_of_tendsto_nhds tendsto_nhdsWithin_of_tendsto_nhds theorem eventually_mem_of_tendsto_nhdsWithin {f : β → α} {a : α} {s : Set α} {l : Filter β} (h : Tendsto f l (𝓝[s] a)) : ∀ᶠ i in l, f i ∈ s := by simp_rw [nhdsWithin_eq, tendsto_iInf, mem_setOf_eq, tendsto_principal, mem_inter_iff, eventually_and] at h exact (h univ ⟨mem_univ a, isOpen_univ⟩).2 #align eventually_mem_of_tendsto_nhds_within eventually_mem_of_tendsto_nhdsWithin theorem tendsto_nhds_of_tendsto_nhdsWithin {f : β → α} {a : α} {s : Set α} {l : Filter β} (h : Tendsto f l (𝓝[s] a)) : Tendsto f l (𝓝 a) := h.mono_right nhdsWithin_le_nhds #align tendsto_nhds_of_tendsto_nhds_within tendsto_nhds_of_tendsto_nhdsWithin theorem nhdsWithin_neBot_of_mem {s : Set α} {x : α} (hx : x ∈ s) : NeBot (𝓝[s] x) := mem_closure_iff_nhdsWithin_neBot.1 <| subset_closure hx #align nhds_within_ne_bot_of_mem nhdsWithin_neBot_of_mem theorem IsClosed.mem_of_nhdsWithin_neBot {s : Set α} (hs : IsClosed s) {x : α} (hx : NeBot <| 𝓝[s] x) : x ∈ s := hs.closure_eq ▸ mem_closure_iff_nhdsWithin_neBot.2 hx #align is_closed.mem_of_nhds_within_ne_bot IsClosed.mem_of_nhdsWithin_neBot theorem DenseRange.nhdsWithin_neBot {ι : Type*} {f : ι → α} (h : DenseRange f) (x : α) : NeBot (𝓝[range f] x) := mem_closure_iff_clusterPt.1 (h x) #align dense_range.nhds_within_ne_bot DenseRange.nhdsWithin_neBot theorem mem_closure_pi {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] {I : Set ι} {s : ∀ i, Set (α i)} {x : ∀ i, α i} : x ∈ closure (pi I s) ↔ ∀ i ∈ I, x i ∈ closure (s i) := by simp only [mem_closure_iff_nhdsWithin_neBot, nhdsWithin_pi_neBot] #align mem_closure_pi mem_closure_pi theorem closure_pi_set {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] (I : Set ι) (s : ∀ i, Set (α i)) : closure (pi I s) = pi I fun i => closure (s i) := Set.ext fun _ => mem_closure_pi #align closure_pi_set closure_pi_set theorem dense_pi {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] {s : ∀ i, Set (α i)} (I : Set ι) (hs : ∀ i ∈ I, Dense (s i)) : Dense (pi I s) := by simp only [dense_iff_closure_eq, closure_pi_set, pi_congr rfl fun i hi => (hs i hi).closure_eq, pi_univ] #align dense_pi dense_pi theorem eventuallyEq_nhdsWithin_iff {f g : α → β} {s : Set α} {a : α} : f =ᶠ[𝓝[s] a] g ↔ ∀ᶠ x in 𝓝 a, x ∈ s → f x = g x := mem_inf_principal #align eventually_eq_nhds_within_iff eventuallyEq_nhdsWithin_iff theorem eventuallyEq_nhdsWithin_of_eqOn {f g : α → β} {s : Set α} {a : α} (h : EqOn f g s) : f =ᶠ[𝓝[s] a] g := mem_inf_of_right h #align eventually_eq_nhds_within_of_eq_on eventuallyEq_nhdsWithin_of_eqOn theorem Set.EqOn.eventuallyEq_nhdsWithin {f g : α → β} {s : Set α} {a : α} (h : EqOn f g s) : f =ᶠ[𝓝[s] a] g := eventuallyEq_nhdsWithin_of_eqOn h #align set.eq_on.eventually_eq_nhds_within Set.EqOn.eventuallyEq_nhdsWithin theorem tendsto_nhdsWithin_congr {f g : α → β} {s : Set α} {a : α} {l : Filter β} (hfg : ∀ x ∈ s, f x = g x) (hf : Tendsto f (𝓝[s] a) l) : Tendsto g (𝓝[s] a) l := (tendsto_congr' <| eventuallyEq_nhdsWithin_of_eqOn hfg).1 hf #align tendsto_nhds_within_congr tendsto_nhdsWithin_congr theorem eventually_nhdsWithin_of_forall {s : Set α} {a : α} {p : α → Prop} (h : ∀ x ∈ s, p x) : ∀ᶠ x in 𝓝[s] a, p x := mem_inf_of_right h #align eventually_nhds_within_of_forall eventually_nhdsWithin_of_forall theorem tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within {a : α} {l : Filter β} {s : Set α} (f : β → α) (h1 : Tendsto f l (𝓝 a)) (h2 : ∀ᶠ x in l, f x ∈ s) : Tendsto f l (𝓝[s] a) := tendsto_inf.2 ⟨h1, tendsto_principal.2 h2⟩ #align tendsto_nhds_within_of_tendsto_nhds_of_eventually_within tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within theorem tendsto_nhdsWithin_iff {a : α} {l : Filter β} {s : Set α} {f : β → α} : Tendsto f l (𝓝[s] a) ↔ Tendsto f l (𝓝 a) ∧ ∀ᶠ n in l, f n ∈ s := ⟨fun h => ⟨tendsto_nhds_of_tendsto_nhdsWithin h, eventually_mem_of_tendsto_nhdsWithin h⟩, fun h => tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ h.1 h.2⟩ #align tendsto_nhds_within_iff tendsto_nhdsWithin_iff @[simp] theorem tendsto_nhdsWithin_range {a : α} {l : Filter β} {f : β → α} : Tendsto f l (𝓝[range f] a) ↔ Tendsto f l (𝓝 a) := ⟨fun h => h.mono_right inf_le_left, fun h => tendsto_inf.2 ⟨h, tendsto_principal.2 <| eventually_of_forall mem_range_self⟩⟩ #align tendsto_nhds_within_range tendsto_nhdsWithin_range theorem Filter.EventuallyEq.eq_of_nhdsWithin {s : Set α} {f g : α → β} {a : α} (h : f =ᶠ[𝓝[s] a] g) (hmem : a ∈ s) : f a = g a := h.self_of_nhdsWithin hmem #align filter.eventually_eq.eq_of_nhds_within Filter.EventuallyEq.eq_of_nhdsWithin theorem eventually_nhdsWithin_of_eventually_nhds {α : Type*} [TopologicalSpace α] {s : Set α} {a : α} {p : α → Prop} (h : ∀ᶠ x in 𝓝 a, p x) : ∀ᶠ x in 𝓝[s] a, p x := mem_nhdsWithin_of_mem_nhds h #align eventually_nhds_within_of_eventually_nhds eventually_nhdsWithin_of_eventually_nhds theorem mem_nhdsWithin_subtype {s : Set α} {a : { x // x ∈ s }} {t u : Set { x // x ∈ s }} : t ∈ 𝓝[u] a ↔ t ∈ comap ((↑) : s → α) (𝓝[(↑) '' u] a) := by rw [nhdsWithin, nhds_subtype, principal_subtype, ← comap_inf, ← nhdsWithin] #align mem_nhds_within_subtype mem_nhdsWithin_subtype theorem nhdsWithin_subtype (s : Set α) (a : { x // x ∈ s }) (t : Set { x // x ∈ s }) : 𝓝[t] a = comap ((↑) : s → α) (𝓝[(↑) '' t] a) := Filter.ext fun _ => mem_nhdsWithin_subtype #align nhds_within_subtype nhdsWithin_subtype theorem nhdsWithin_eq_map_subtype_coe {s : Set α} {a : α} (h : a ∈ s) : 𝓝[s] a = map ((↑) : s → α) (𝓝 ⟨a, h⟩) := (map_nhds_subtype_val ⟨a, h⟩).symm #align nhds_within_eq_map_subtype_coe nhdsWithin_eq_map_subtype_coe theorem mem_nhds_subtype_iff_nhdsWithin {s : Set α} {a : s} {t : Set s} : t ∈ 𝓝 a ↔ (↑) '' t ∈ 𝓝[s] (a : α) := by rw [← map_nhds_subtype_val, image_mem_map_iff Subtype.val_injective] #align mem_nhds_subtype_iff_nhds_within mem_nhds_subtype_iff_nhdsWithin theorem preimage_coe_mem_nhds_subtype {s t : Set α} {a : s} : (↑) ⁻¹' t ∈ 𝓝 a ↔ t ∈ 𝓝[s] ↑a := by rw [← map_nhds_subtype_val, mem_map] #align preimage_coe_mem_nhds_subtype preimage_coe_mem_nhds_subtype theorem eventually_nhds_subtype_iff (s : Set α) (a : s) (P : α → Prop) : (∀ᶠ x : s in 𝓝 a, P x) ↔ ∀ᶠ x in 𝓝[s] a, P x := preimage_coe_mem_nhds_subtype theorem frequently_nhds_subtype_iff (s : Set α) (a : s) (P : α → Prop) : (∃ᶠ x : s in 𝓝 a, P x) ↔ ∃ᶠ x in 𝓝[s] a, P x := eventually_nhds_subtype_iff s a (¬ P ·) |>.not theorem tendsto_nhdsWithin_iff_subtype {s : Set α} {a : α} (h : a ∈ s) (f : α → β) (l : Filter β) : Tendsto f (𝓝[s] a) l ↔ Tendsto (s.restrict f) (𝓝 ⟨a, h⟩) l := by rw [nhdsWithin_eq_map_subtype_coe h, tendsto_map'_iff]; rfl #align tendsto_nhds_within_iff_subtype tendsto_nhdsWithin_iff_subtype variable [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] theorem ContinuousWithinAt.tendsto {f : α → β} {s : Set α} {x : α} (h : ContinuousWithinAt f s x) : Tendsto f (𝓝[s] x) (𝓝 (f x)) := h #align continuous_within_at.tendsto ContinuousWithinAt.tendsto theorem ContinuousOn.continuousWithinAt {f : α → β} {s : Set α} {x : α} (hf : ContinuousOn f s) (hx : x ∈ s) : ContinuousWithinAt f s x := hf x hx #align continuous_on.continuous_within_at ContinuousOn.continuousWithinAt theorem continuousWithinAt_univ (f : α → β) (x : α) : ContinuousWithinAt f Set.univ x ↔ ContinuousAt f x := by rw [ContinuousAt, ContinuousWithinAt, nhdsWithin_univ] #align continuous_within_at_univ continuousWithinAt_univ theorem continuous_iff_continuousOn_univ {f : α → β} : Continuous f ↔ ContinuousOn f univ := by simp [continuous_iff_continuousAt, ContinuousOn, ContinuousAt, ContinuousWithinAt, nhdsWithin_univ] #align continuous_iff_continuous_on_univ continuous_iff_continuousOn_univ theorem continuousWithinAt_iff_continuousAt_restrict (f : α → β) {x : α} {s : Set α} (h : x ∈ s) : ContinuousWithinAt f s x ↔ ContinuousAt (s.restrict f) ⟨x, h⟩ := tendsto_nhdsWithin_iff_subtype h f _ #align continuous_within_at_iff_continuous_at_restrict continuousWithinAt_iff_continuousAt_restrict theorem ContinuousWithinAt.tendsto_nhdsWithin {f : α → β} {x : α} {s : Set α} {t : Set β} (h : ContinuousWithinAt f s x) (ht : MapsTo f s t) : Tendsto f (𝓝[s] x) (𝓝[t] f x) := tendsto_inf.2 ⟨h, tendsto_principal.2 <| mem_inf_of_right <| mem_principal.2 <| ht⟩ #align continuous_within_at.tendsto_nhds_within ContinuousWithinAt.tendsto_nhdsWithin theorem ContinuousWithinAt.tendsto_nhdsWithin_image {f : α → β} {x : α} {s : Set α} (h : ContinuousWithinAt f s x) : Tendsto f (𝓝[s] x) (𝓝[f '' s] f x) := h.tendsto_nhdsWithin (mapsTo_image _ _) #align continuous_within_at.tendsto_nhds_within_image ContinuousWithinAt.tendsto_nhdsWithin_image theorem ContinuousWithinAt.prod_map {f : α → γ} {g : β → δ} {s : Set α} {t : Set β} {x : α} {y : β} (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g t y) : ContinuousWithinAt (Prod.map f g) (s ×ˢ t) (x, y) := by unfold ContinuousWithinAt at * rw [nhdsWithin_prod_eq, Prod.map, nhds_prod_eq] exact hf.prod_map hg #align continuous_within_at.prod_map ContinuousWithinAt.prod_map theorem continuousWithinAt_prod_of_discrete_left [DiscreteTopology α] {f : α × β → γ} {s : Set (α × β)} {x : α × β} : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ⟨x.1, ·⟩) {b | (x.1, b) ∈ s} x.2 := by rw [← x.eta]; simp_rw [ContinuousWithinAt, nhdsWithin, nhds_prod_eq, nhds_discrete, pure_prod, ← map_inf_principal_preimage]; rfl theorem continuousWithinAt_prod_of_discrete_right [DiscreteTopology β] {f : α × β → γ} {s : Set (α × β)} {x : α × β} : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ⟨·, x.2⟩) {a | (a, x.2) ∈ s} x.1 := by rw [← x.eta]; simp_rw [ContinuousWithinAt, nhdsWithin, nhds_prod_eq, nhds_discrete, prod_pure, ← map_inf_principal_preimage]; rfl theorem continuousAt_prod_of_discrete_left [DiscreteTopology α] {f : α × β → γ} {x : α × β} : ContinuousAt f x ↔ ContinuousAt (f ⟨x.1, ·⟩) x.2 := by simp_rw [← continuousWithinAt_univ]; exact continuousWithinAt_prod_of_discrete_left
Mathlib/Topology/ContinuousOn.lean
577
579
theorem continuousAt_prod_of_discrete_right [DiscreteTopology β] {f : α × β → γ} {x : α × β} : ContinuousAt f x ↔ ContinuousAt (f ⟨·, x.2⟩) x.1 := by
simp_rw [← continuousWithinAt_univ]; exact continuousWithinAt_prod_of_discrete_right
import Mathlib.SetTheory.Ordinal.Arithmetic namespace OrdinalApprox universe u variable {α : Type u} variable [CompleteLattice α] (f : α →o α) (x : α) open Function fixedPoints Cardinal Order OrderHom set_option linter.unusedVariables false in def lfpApprox (a : Ordinal.{u}) : α := sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } ∪ {x}) termination_by a decreasing_by exact h
Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean
77
85
theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by
unfold Monotone; intros a b h; unfold lfpApprox refine sSup_le_sSup ?h apply sup_le_sup_right simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intros a' h' use a' exact ⟨lt_of_lt_of_le h' h, rfl⟩
import Mathlib.MeasureTheory.Integral.IntegrableOn import Mathlib.MeasureTheory.Integral.Bochner import Mathlib.MeasureTheory.Function.LocallyIntegrable import Mathlib.Topology.MetricSpace.ThickenedIndicator import Mathlib.Topology.ContinuousFunction.Compact import Mathlib.Analysis.NormedSpace.HahnBanach.SeparatingDual #align_import measure_theory.integral.setIntegral from "leanprover-community/mathlib"@"24e0c85412ff6adbeca08022c25ba4876eedf37a" assert_not_exists InnerProductSpace noncomputable section open Set Filter TopologicalSpace MeasureTheory Function RCLike open scoped Classical Topology ENNReal NNReal variable {X Y E F : Type*} [MeasurableSpace X] namespace MeasureTheory section NormedAddCommGroup variable [NormedAddCommGroup E] [NormedSpace ℝ E] {f g : X → E} {s t : Set X} {μ ν : Measure X} {l l' : Filter X} theorem setIntegral_congr_ae₀ (hs : NullMeasurableSet s μ) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : ∫ x in s, f x ∂μ = ∫ x in s, g x ∂μ := integral_congr_ae ((ae_restrict_iff'₀ hs).2 h) #align measure_theory.set_integral_congr_ae₀ MeasureTheory.setIntegral_congr_ae₀ @[deprecated (since := "2024-04-17")] alias set_integral_congr_ae₀ := setIntegral_congr_ae₀ theorem setIntegral_congr_ae (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : ∫ x in s, f x ∂μ = ∫ x in s, g x ∂μ := integral_congr_ae ((ae_restrict_iff' hs).2 h) #align measure_theory.set_integral_congr_ae MeasureTheory.setIntegral_congr_ae @[deprecated (since := "2024-04-17")] alias set_integral_congr_ae := setIntegral_congr_ae theorem setIntegral_congr₀ (hs : NullMeasurableSet s μ) (h : EqOn f g s) : ∫ x in s, f x ∂μ = ∫ x in s, g x ∂μ := setIntegral_congr_ae₀ hs <| eventually_of_forall h #align measure_theory.set_integral_congr₀ MeasureTheory.setIntegral_congr₀ @[deprecated (since := "2024-04-17")] alias set_integral_congr₀ := setIntegral_congr₀ theorem setIntegral_congr (hs : MeasurableSet s) (h : EqOn f g s) : ∫ x in s, f x ∂μ = ∫ x in s, g x ∂μ := setIntegral_congr_ae hs <| eventually_of_forall h #align measure_theory.set_integral_congr MeasureTheory.setIntegral_congr @[deprecated (since := "2024-04-17")] alias set_integral_congr := setIntegral_congr theorem setIntegral_congr_set_ae (hst : s =ᵐ[μ] t) : ∫ x in s, f x ∂μ = ∫ x in t, f x ∂μ := by rw [Measure.restrict_congr_set hst] #align measure_theory.set_integral_congr_set_ae MeasureTheory.setIntegral_congr_set_ae @[deprecated (since := "2024-04-17")] alias set_integral_congr_set_ae := setIntegral_congr_set_ae theorem integral_union_ae (hst : AEDisjoint μ s t) (ht : NullMeasurableSet t μ) (hfs : IntegrableOn f s μ) (hft : IntegrableOn f t μ) : ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ + ∫ x in t, f x ∂μ := by simp only [IntegrableOn, Measure.restrict_union₀ hst ht, integral_add_measure hfs hft] #align measure_theory.integral_union_ae MeasureTheory.integral_union_ae theorem integral_union (hst : Disjoint s t) (ht : MeasurableSet t) (hfs : IntegrableOn f s μ) (hft : IntegrableOn f t μ) : ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ + ∫ x in t, f x ∂μ := integral_union_ae hst.aedisjoint ht.nullMeasurableSet hfs hft #align measure_theory.integral_union MeasureTheory.integral_union theorem integral_diff (ht : MeasurableSet t) (hfs : IntegrableOn f s μ) (hts : t ⊆ s) : ∫ x in s \ t, f x ∂μ = ∫ x in s, f x ∂μ - ∫ x in t, f x ∂μ := by rw [eq_sub_iff_add_eq, ← integral_union, diff_union_of_subset hts] exacts [disjoint_sdiff_self_left, ht, hfs.mono_set diff_subset, hfs.mono_set hts] #align measure_theory.integral_diff MeasureTheory.integral_diff theorem integral_inter_add_diff₀ (ht : NullMeasurableSet t μ) (hfs : IntegrableOn f s μ) : ∫ x in s ∩ t, f x ∂μ + ∫ x in s \ t, f x ∂μ = ∫ x in s, f x ∂μ := by rw [← Measure.restrict_inter_add_diff₀ s ht, integral_add_measure] · exact Integrable.mono_measure hfs (Measure.restrict_mono inter_subset_left le_rfl) · exact Integrable.mono_measure hfs (Measure.restrict_mono diff_subset le_rfl) #align measure_theory.integral_inter_add_diff₀ MeasureTheory.integral_inter_add_diff₀ theorem integral_inter_add_diff (ht : MeasurableSet t) (hfs : IntegrableOn f s μ) : ∫ x in s ∩ t, f x ∂μ + ∫ x in s \ t, f x ∂μ = ∫ x in s, f x ∂μ := integral_inter_add_diff₀ ht.nullMeasurableSet hfs #align measure_theory.integral_inter_add_diff MeasureTheory.integral_inter_add_diff theorem integral_finset_biUnion {ι : Type*} (t : Finset ι) {s : ι → Set X} (hs : ∀ i ∈ t, MeasurableSet (s i)) (h's : Set.Pairwise (↑t) (Disjoint on s)) (hf : ∀ i ∈ t, IntegrableOn f (s i) μ) : ∫ x in ⋃ i ∈ t, s i, f x ∂μ = ∑ i ∈ t, ∫ x in s i, f x ∂μ := by induction' t using Finset.induction_on with a t hat IH hs h's · simp · simp only [Finset.coe_insert, Finset.forall_mem_insert, Set.pairwise_insert, Finset.set_biUnion_insert] at hs hf h's ⊢ rw [integral_union _ _ hf.1 (integrableOn_finset_iUnion.2 hf.2)] · rw [Finset.sum_insert hat, IH hs.2 h's.1 hf.2] · simp only [disjoint_iUnion_right] exact fun i hi => (h's.2 i hi (ne_of_mem_of_not_mem hi hat).symm).1 · exact Finset.measurableSet_biUnion _ hs.2 #align measure_theory.integral_finset_bUnion MeasureTheory.integral_finset_biUnion theorem integral_fintype_iUnion {ι : Type*} [Fintype ι] {s : ι → Set X} (hs : ∀ i, MeasurableSet (s i)) (h's : Pairwise (Disjoint on s)) (hf : ∀ i, IntegrableOn f (s i) μ) : ∫ x in ⋃ i, s i, f x ∂μ = ∑ i, ∫ x in s i, f x ∂μ := by convert integral_finset_biUnion Finset.univ (fun i _ => hs i) _ fun i _ => hf i · simp · simp [pairwise_univ, h's] #align measure_theory.integral_fintype_Union MeasureTheory.integral_fintype_iUnion theorem integral_empty : ∫ x in ∅, f x ∂μ = 0 := by rw [Measure.restrict_empty, integral_zero_measure] #align measure_theory.integral_empty MeasureTheory.integral_empty theorem integral_univ : ∫ x in univ, f x ∂μ = ∫ x, f x ∂μ := by rw [Measure.restrict_univ] #align measure_theory.integral_univ MeasureTheory.integral_univ theorem integral_add_compl₀ (hs : NullMeasurableSet s μ) (hfi : Integrable f μ) : ∫ x in s, f x ∂μ + ∫ x in sᶜ, f x ∂μ = ∫ x, f x ∂μ := by rw [ ← integral_union_ae disjoint_compl_right.aedisjoint hs.compl hfi.integrableOn hfi.integrableOn, union_compl_self, integral_univ] #align measure_theory.integral_add_compl₀ MeasureTheory.integral_add_compl₀ theorem integral_add_compl (hs : MeasurableSet s) (hfi : Integrable f μ) : ∫ x in s, f x ∂μ + ∫ x in sᶜ, f x ∂μ = ∫ x, f x ∂μ := integral_add_compl₀ hs.nullMeasurableSet hfi #align measure_theory.integral_add_compl MeasureTheory.integral_add_compl theorem integral_indicator (hs : MeasurableSet s) : ∫ x, indicator s f x ∂μ = ∫ x in s, f x ∂μ := by by_cases hfi : IntegrableOn f s μ; swap · rw [integral_undef hfi, integral_undef] rwa [integrable_indicator_iff hs] calc ∫ x, indicator s f x ∂μ = ∫ x in s, indicator s f x ∂μ + ∫ x in sᶜ, indicator s f x ∂μ := (integral_add_compl hs (hfi.integrable_indicator hs)).symm _ = ∫ x in s, f x ∂μ + ∫ x in sᶜ, 0 ∂μ := (congr_arg₂ (· + ·) (integral_congr_ae (indicator_ae_eq_restrict hs)) (integral_congr_ae (indicator_ae_eq_restrict_compl hs))) _ = ∫ x in s, f x ∂μ := by simp #align measure_theory.integral_indicator MeasureTheory.integral_indicator theorem setIntegral_indicator (ht : MeasurableSet t) : ∫ x in s, t.indicator f x ∂μ = ∫ x in s ∩ t, f x ∂μ := by rw [integral_indicator ht, Measure.restrict_restrict ht, Set.inter_comm] #align measure_theory.set_integral_indicator MeasureTheory.setIntegral_indicator @[deprecated (since := "2024-04-17")] alias set_integral_indicator := setIntegral_indicator theorem ofReal_setIntegral_one_of_measure_ne_top {X : Type*} {m : MeasurableSpace X} {μ : Measure X} {s : Set X} (hs : μ s ≠ ∞) : ENNReal.ofReal (∫ _ in s, (1 : ℝ) ∂μ) = μ s := calc ENNReal.ofReal (∫ _ in s, (1 : ℝ) ∂μ) = ENNReal.ofReal (∫ _ in s, ‖(1 : ℝ)‖ ∂μ) := by simp only [norm_one] _ = ∫⁻ _ in s, 1 ∂μ := by rw [ofReal_integral_norm_eq_lintegral_nnnorm (integrableOn_const.2 (Or.inr hs.lt_top))] simp only [nnnorm_one, ENNReal.coe_one] _ = μ s := set_lintegral_one _ #align measure_theory.of_real_set_integral_one_of_measure_ne_top MeasureTheory.ofReal_setIntegral_one_of_measure_ne_top @[deprecated (since := "2024-04-17")] alias ofReal_set_integral_one_of_measure_ne_top := ofReal_setIntegral_one_of_measure_ne_top theorem ofReal_setIntegral_one {X : Type*} {_ : MeasurableSpace X} (μ : Measure X) [IsFiniteMeasure μ] (s : Set X) : ENNReal.ofReal (∫ _ in s, (1 : ℝ) ∂μ) = μ s := ofReal_setIntegral_one_of_measure_ne_top (measure_ne_top μ s) #align measure_theory.of_real_set_integral_one MeasureTheory.ofReal_setIntegral_one @[deprecated (since := "2024-04-17")] alias ofReal_set_integral_one := ofReal_setIntegral_one theorem integral_piecewise [DecidablePred (· ∈ s)] (hs : MeasurableSet s) (hf : IntegrableOn f s μ) (hg : IntegrableOn g sᶜ μ) : ∫ x, s.piecewise f g x ∂μ = ∫ x in s, f x ∂μ + ∫ x in sᶜ, g x ∂μ := by rw [← Set.indicator_add_compl_eq_piecewise, integral_add' (hf.integrable_indicator hs) (hg.integrable_indicator hs.compl), integral_indicator hs, integral_indicator hs.compl] #align measure_theory.integral_piecewise MeasureTheory.integral_piecewise theorem tendsto_setIntegral_of_monotone {ι : Type*} [Countable ι] [SemilatticeSup ι] {s : ι → Set X} (hsm : ∀ i, MeasurableSet (s i)) (h_mono : Monotone s) (hfi : IntegrableOn f (⋃ n, s n) μ) : Tendsto (fun i => ∫ x in s i, f x ∂μ) atTop (𝓝 (∫ x in ⋃ n, s n, f x ∂μ)) := by have hfi' : ∫⁻ x in ⋃ n, s n, ‖f x‖₊ ∂μ < ∞ := hfi.2 set S := ⋃ i, s i have hSm : MeasurableSet S := MeasurableSet.iUnion hsm have hsub : ∀ {i}, s i ⊆ S := @(subset_iUnion s) rw [← withDensity_apply _ hSm] at hfi' set ν := μ.withDensity fun x => ‖f x‖₊ with hν refine Metric.nhds_basis_closedBall.tendsto_right_iff.2 fun ε ε0 => ?_ lift ε to ℝ≥0 using ε0.le have : ∀ᶠ i in atTop, ν (s i) ∈ Icc (ν S - ε) (ν S + ε) := tendsto_measure_iUnion h_mono (ENNReal.Icc_mem_nhds hfi'.ne (ENNReal.coe_pos.2 ε0).ne') filter_upwards [this] with i hi rw [mem_closedBall_iff_norm', ← integral_diff (hsm i) hfi hsub, ← coe_nnnorm, NNReal.coe_le_coe, ← ENNReal.coe_le_coe] refine (ennnorm_integral_le_lintegral_ennnorm _).trans ?_ rw [← withDensity_apply _ (hSm.diff (hsm _)), ← hν, measure_diff hsub (hsm _)] exacts [tsub_le_iff_tsub_le.mp hi.1, (hi.2.trans_lt <| ENNReal.add_lt_top.2 ⟨hfi', ENNReal.coe_lt_top⟩).ne] #align measure_theory.tendsto_set_integral_of_monotone MeasureTheory.tendsto_setIntegral_of_monotone @[deprecated (since := "2024-04-17")] alias tendsto_set_integral_of_monotone := tendsto_setIntegral_of_monotone theorem tendsto_setIntegral_of_antitone {ι : Type*} [Countable ι] [SemilatticeSup ι] {s : ι → Set X} (hsm : ∀ i, MeasurableSet (s i)) (h_anti : Antitone s) (hfi : ∃ i, IntegrableOn f (s i) μ) : Tendsto (fun i ↦ ∫ x in s i, f x ∂μ) atTop (𝓝 (∫ x in ⋂ n, s n, f x ∂μ)) := by set S := ⋂ i, s i have hSm : MeasurableSet S := MeasurableSet.iInter hsm have hsub i : S ⊆ s i := iInter_subset _ _ set ν := μ.withDensity fun x => ‖f x‖₊ with hν refine Metric.nhds_basis_closedBall.tendsto_right_iff.2 fun ε ε0 => ?_ lift ε to ℝ≥0 using ε0.le rcases hfi with ⟨i₀, hi₀⟩ have νi₀ : ν (s i₀) ≠ ∞ := by simpa [hsm i₀, ν, ENNReal.ofReal, norm_toNNReal] using hi₀.norm.lintegral_lt_top.ne have νS : ν S ≠ ∞ := ((measure_mono (hsub i₀)).trans_lt νi₀.lt_top).ne have : ∀ᶠ i in atTop, ν (s i) ∈ Icc (ν S - ε) (ν S + ε) := by apply tendsto_measure_iInter hsm h_anti ⟨i₀, νi₀⟩ apply ENNReal.Icc_mem_nhds νS (ENNReal.coe_pos.2 ε0).ne' filter_upwards [this, Ici_mem_atTop i₀] with i hi h'i rw [mem_closedBall_iff_norm, ← integral_diff hSm (hi₀.mono_set (h_anti h'i)) (hsub i), ← coe_nnnorm, NNReal.coe_le_coe, ← ENNReal.coe_le_coe] refine (ennnorm_integral_le_lintegral_ennnorm _).trans ?_ rw [← withDensity_apply _ ((hsm _).diff hSm), ← hν, measure_diff (hsub i) hSm νS] exact tsub_le_iff_left.2 hi.2 @[deprecated (since := "2024-04-17")] alias tendsto_set_integral_of_antitone := tendsto_setIntegral_of_antitone theorem hasSum_integral_iUnion_ae {ι : Type*} [Countable ι] {s : ι → Set X} (hm : ∀ i, NullMeasurableSet (s i) μ) (hd : Pairwise (AEDisjoint μ on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : HasSum (fun n => ∫ x in s n, f x ∂μ) (∫ x in ⋃ n, s n, f x ∂μ) := by simp only [IntegrableOn, Measure.restrict_iUnion_ae hd hm] at hfi ⊢ exact hasSum_integral_measure hfi #align measure_theory.has_sum_integral_Union_ae MeasureTheory.hasSum_integral_iUnion_ae theorem hasSum_integral_iUnion {ι : Type*} [Countable ι] {s : ι → Set X} (hm : ∀ i, MeasurableSet (s i)) (hd : Pairwise (Disjoint on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : HasSum (fun n => ∫ x in s n, f x ∂μ) (∫ x in ⋃ n, s n, f x ∂μ) := hasSum_integral_iUnion_ae (fun i => (hm i).nullMeasurableSet) (hd.mono fun _ _ h => h.aedisjoint) hfi #align measure_theory.has_sum_integral_Union MeasureTheory.hasSum_integral_iUnion theorem integral_iUnion {ι : Type*} [Countable ι] {s : ι → Set X} (hm : ∀ i, MeasurableSet (s i)) (hd : Pairwise (Disjoint on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : ∫ x in ⋃ n, s n, f x ∂μ = ∑' n, ∫ x in s n, f x ∂μ := (HasSum.tsum_eq (hasSum_integral_iUnion hm hd hfi)).symm #align measure_theory.integral_Union MeasureTheory.integral_iUnion theorem integral_iUnion_ae {ι : Type*} [Countable ι] {s : ι → Set X} (hm : ∀ i, NullMeasurableSet (s i) μ) (hd : Pairwise (AEDisjoint μ on s)) (hfi : IntegrableOn f (⋃ i, s i) μ) : ∫ x in ⋃ n, s n, f x ∂μ = ∑' n, ∫ x in s n, f x ∂μ := (HasSum.tsum_eq (hasSum_integral_iUnion_ae hm hd hfi)).symm #align measure_theory.integral_Union_ae MeasureTheory.integral_iUnion_ae theorem setIntegral_eq_zero_of_ae_eq_zero (ht_eq : ∀ᵐ x ∂μ, x ∈ t → f x = 0) : ∫ x in t, f x ∂μ = 0 := by by_cases hf : AEStronglyMeasurable f (μ.restrict t); swap · rw [integral_undef] contrapose! hf exact hf.1 have : ∫ x in t, hf.mk f x ∂μ = 0 := by refine integral_eq_zero_of_ae ?_ rw [EventuallyEq, ae_restrict_iff (hf.stronglyMeasurable_mk.measurableSet_eq_fun stronglyMeasurable_zero)] filter_upwards [ae_imp_of_ae_restrict hf.ae_eq_mk, ht_eq] with x hx h'x h''x rw [← hx h''x] exact h'x h''x rw [← this] exact integral_congr_ae hf.ae_eq_mk #align measure_theory.set_integral_eq_zero_of_ae_eq_zero MeasureTheory.setIntegral_eq_zero_of_ae_eq_zero @[deprecated (since := "2024-04-17")] alias set_integral_eq_zero_of_ae_eq_zero := setIntegral_eq_zero_of_ae_eq_zero theorem setIntegral_eq_zero_of_forall_eq_zero (ht_eq : ∀ x ∈ t, f x = 0) : ∫ x in t, f x ∂μ = 0 := setIntegral_eq_zero_of_ae_eq_zero (eventually_of_forall ht_eq) #align measure_theory.set_integral_eq_zero_of_forall_eq_zero MeasureTheory.setIntegral_eq_zero_of_forall_eq_zero @[deprecated (since := "2024-04-17")] alias set_integral_eq_zero_of_forall_eq_zero := setIntegral_eq_zero_of_forall_eq_zero theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) : ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by let k := f ⁻¹' {0} have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _) have h's : IntegrableOn f s μ := H.mono subset_union_left le_rfl have A : ∀ u : Set X, ∫ x in u ∩ k, f x ∂μ = 0 := fun u => setIntegral_eq_zero_of_forall_eq_zero fun x hx => hx.2 rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add, union_diff_distrib, union_comm] apply setIntegral_congr_set_ae rw [union_ae_eq_right] apply measure_mono_null diff_subset rw [measure_zero_iff_ae_nmem] filter_upwards [ae_imp_of_ae_restrict ht_eq] with x hx h'x using h'x.2 (hx h'x.1) #align measure_theory.integral_union_eq_left_of_ae_aux MeasureTheory.integral_union_eq_left_of_ae_aux theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) : ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq by_cases H : IntegrableOn f (s ∪ t) μ; swap · rw [integral_undef H, integral_undef]; simpa [integrableOn_union, ht] using H let f' := H.1.mk f calc ∫ x : X in s ∪ t, f x ∂μ = ∫ x : X in s ∪ t, f' x ∂μ := integral_congr_ae H.1.ae_eq_mk _ = ∫ x in s, f' x ∂μ := by apply integral_union_eq_left_of_ae_aux _ H.1.stronglyMeasurable_mk (H.congr_fun_ae H.1.ae_eq_mk) filter_upwards [ht_eq, ae_mono (Measure.restrict_mono subset_union_right le_rfl) H.1.ae_eq_mk] with x hx h'x rw [← h'x, hx] _ = ∫ x in s, f x ∂μ := integral_congr_ae (ae_mono (Measure.restrict_mono subset_union_left le_rfl) H.1.ae_eq_mk.symm) #align measure_theory.integral_union_eq_left_of_ae MeasureTheory.integral_union_eq_left_of_ae theorem integral_union_eq_left_of_forall₀ {f : X → E} (ht : NullMeasurableSet t μ) (ht_eq : ∀ x ∈ t, f x = 0) : ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := integral_union_eq_left_of_ae ((ae_restrict_iff'₀ ht).2 (eventually_of_forall ht_eq)) #align measure_theory.integral_union_eq_left_of_forall₀ MeasureTheory.integral_union_eq_left_of_forall₀ theorem integral_union_eq_left_of_forall {f : X → E} (ht : MeasurableSet t) (ht_eq : ∀ x ∈ t, f x = 0) : ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := integral_union_eq_left_of_forall₀ ht.nullMeasurableSet ht_eq #align measure_theory.integral_union_eq_left_of_forall MeasureTheory.integral_union_eq_left_of_forall theorem setIntegral_eq_of_subset_of_ae_diff_eq_zero_aux (hts : s ⊆ t) (h't : ∀ᵐ x ∂μ, x ∈ t \ s → f x = 0) (haux : StronglyMeasurable f) (h'aux : IntegrableOn f t μ) : ∫ x in t, f x ∂μ = ∫ x in s, f x ∂μ := by let k := f ⁻¹' {0} have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _) calc ∫ x in t, f x ∂μ = ∫ x in t ∩ k, f x ∂μ + ∫ x in t \ k, f x ∂μ := by rw [integral_inter_add_diff hk h'aux] _ = ∫ x in t \ k, f x ∂μ := by rw [setIntegral_eq_zero_of_forall_eq_zero fun x hx => ?_, zero_add]; exact hx.2 _ = ∫ x in s \ k, f x ∂μ := by apply setIntegral_congr_set_ae filter_upwards [h't] with x hx change (x ∈ t \ k) = (x ∈ s \ k) simp only [mem_preimage, mem_singleton_iff, eq_iff_iff, and_congr_left_iff, mem_diff] intro h'x by_cases xs : x ∈ s · simp only [xs, hts xs] · simp only [xs, iff_false_iff] intro xt exact h'x (hx ⟨xt, xs⟩) _ = ∫ x in s ∩ k, f x ∂μ + ∫ x in s \ k, f x ∂μ := by have : ∀ x ∈ s ∩ k, f x = 0 := fun x hx => hx.2 rw [setIntegral_eq_zero_of_forall_eq_zero this, zero_add] _ = ∫ x in s, f x ∂μ := by rw [integral_inter_add_diff hk (h'aux.mono hts le_rfl)] #align measure_theory.set_integral_eq_of_subset_of_ae_diff_eq_zero_aux MeasureTheory.setIntegral_eq_of_subset_of_ae_diff_eq_zero_aux @[deprecated (since := "2024-04-17")] alias set_integral_eq_of_subset_of_ae_diff_eq_zero_aux := setIntegral_eq_of_subset_of_ae_diff_eq_zero_aux theorem setIntegral_eq_of_subset_of_ae_diff_eq_zero (ht : NullMeasurableSet t μ) (hts : s ⊆ t) (h't : ∀ᵐ x ∂μ, x ∈ t \ s → f x = 0) : ∫ x in t, f x ∂μ = ∫ x in s, f x ∂μ := by by_cases h : IntegrableOn f t μ; swap · have : ¬IntegrableOn f s μ := fun H => h (H.of_ae_diff_eq_zero ht h't) rw [integral_undef h, integral_undef this] let f' := h.1.mk f calc ∫ x in t, f x ∂μ = ∫ x in t, f' x ∂μ := integral_congr_ae h.1.ae_eq_mk _ = ∫ x in s, f' x ∂μ := by apply setIntegral_eq_of_subset_of_ae_diff_eq_zero_aux hts _ h.1.stronglyMeasurable_mk (h.congr h.1.ae_eq_mk) filter_upwards [h't, ae_imp_of_ae_restrict h.1.ae_eq_mk] with x hx h'x h''x rw [← h'x h''x.1, hx h''x] _ = ∫ x in s, f x ∂μ := by apply integral_congr_ae apply ae_restrict_of_ae_restrict_of_subset hts exact h.1.ae_eq_mk.symm #align measure_theory.set_integral_eq_of_subset_of_ae_diff_eq_zero MeasureTheory.setIntegral_eq_of_subset_of_ae_diff_eq_zero @[deprecated (since := "2024-04-17")] alias set_integral_eq_of_subset_of_ae_diff_eq_zero := setIntegral_eq_of_subset_of_ae_diff_eq_zero theorem setIntegral_eq_of_subset_of_forall_diff_eq_zero (ht : MeasurableSet t) (hts : s ⊆ t) (h't : ∀ x ∈ t \ s, f x = 0) : ∫ x in t, f x ∂μ = ∫ x in s, f x ∂μ := setIntegral_eq_of_subset_of_ae_diff_eq_zero ht.nullMeasurableSet hts (eventually_of_forall fun x hx => h't x hx) #align measure_theory.set_integral_eq_of_subset_of_forall_diff_eq_zero MeasureTheory.setIntegral_eq_of_subset_of_forall_diff_eq_zero @[deprecated (since := "2024-04-17")] alias set_integral_eq_of_subset_of_forall_diff_eq_zero := setIntegral_eq_of_subset_of_forall_diff_eq_zero theorem setIntegral_eq_integral_of_ae_compl_eq_zero (h : ∀ᵐ x ∂μ, x ∉ s → f x = 0) : ∫ x in s, f x ∂μ = ∫ x, f x ∂μ := by symm nth_rw 1 [← integral_univ] apply setIntegral_eq_of_subset_of_ae_diff_eq_zero nullMeasurableSet_univ (subset_univ _) filter_upwards [h] with x hx h'x using hx h'x.2 #align measure_theory.set_integral_eq_integral_of_ae_compl_eq_zero MeasureTheory.setIntegral_eq_integral_of_ae_compl_eq_zero @[deprecated (since := "2024-04-17")] alias set_integral_eq_integral_of_ae_compl_eq_zero := setIntegral_eq_integral_of_ae_compl_eq_zero theorem setIntegral_eq_integral_of_forall_compl_eq_zero (h : ∀ x, x ∉ s → f x = 0) : ∫ x in s, f x ∂μ = ∫ x, f x ∂μ := setIntegral_eq_integral_of_ae_compl_eq_zero (eventually_of_forall h) #align measure_theory.set_integral_eq_integral_of_forall_compl_eq_zero MeasureTheory.setIntegral_eq_integral_of_forall_compl_eq_zero @[deprecated (since := "2024-04-17")] alias set_integral_eq_integral_of_forall_compl_eq_zero := setIntegral_eq_integral_of_forall_compl_eq_zero theorem setIntegral_neg_eq_setIntegral_nonpos [LinearOrder E] {f : X → E} (hf : AEStronglyMeasurable f μ) : ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by simp_rw [le_iff_lt_or_eq, setOf_or] rw [h_union] have B : NullMeasurableSet {x | f x = 0} μ := hf.nullMeasurableSet_eq_fun aestronglyMeasurable_zero symm refine integral_union_eq_left_of_ae ?_ filter_upwards [ae_restrict_mem₀ B] with x hx using hx #align measure_theory.set_integral_neg_eq_set_integral_nonpos MeasureTheory.setIntegral_neg_eq_setIntegral_nonpos @[deprecated (since := "2024-04-17")] alias set_integral_neg_eq_set_integral_nonpos := setIntegral_neg_eq_setIntegral_nonpos theorem integral_norm_eq_pos_sub_neg {f : X → ℝ} (hfi : Integrable f μ) : ∫ x, ‖f x‖ ∂μ = ∫ x in {x | 0 ≤ f x}, f x ∂μ - ∫ x in {x | f x ≤ 0}, f x ∂μ := have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ := aestronglyMeasurable_const.nullMeasurableSet_le hfi.1 calc ∫ x, ‖f x‖ ∂μ = ∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by rw [← integral_add_compl₀ h_meas hfi.norm] _ = ∫ x in {x | 0 ≤ f x}, f x ∂μ + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by congr 1 refine setIntegral_congr₀ h_meas fun x hx => ?_ dsimp only rw [Real.norm_eq_abs, abs_eq_self.mpr _] exact hx _ = ∫ x in {x | 0 ≤ f x}, f x ∂μ - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by congr 1 rw [← integral_neg] refine setIntegral_congr₀ h_meas.compl fun x hx => ?_ dsimp only rw [Real.norm_eq_abs, abs_eq_neg_self.mpr _] rw [Set.mem_compl_iff, Set.nmem_setOf_iff] at hx linarith _ = ∫ x in {x | 0 ≤ f x}, f x ∂μ - ∫ x in {x | f x ≤ 0}, f x ∂μ := by rw [← setIntegral_neg_eq_setIntegral_nonpos hfi.1, compl_setOf]; simp only [not_le] #align measure_theory.integral_norm_eq_pos_sub_neg MeasureTheory.integral_norm_eq_pos_sub_neg theorem setIntegral_const [CompleteSpace E] (c : E) : ∫ _ in s, c ∂μ = (μ s).toReal • c := by rw [integral_const, Measure.restrict_apply_univ] #align measure_theory.set_integral_const MeasureTheory.setIntegral_const @[deprecated (since := "2024-04-17")] alias set_integral_const := setIntegral_const @[simp] theorem integral_indicator_const [CompleteSpace E] (e : E) ⦃s : Set X⦄ (s_meas : MeasurableSet s) : ∫ x : X, s.indicator (fun _ : X => e) x ∂μ = (μ s).toReal • e := by rw [integral_indicator s_meas, ← setIntegral_const] #align measure_theory.integral_indicator_const MeasureTheory.integral_indicator_const @[simp] theorem integral_indicator_one ⦃s : Set X⦄ (hs : MeasurableSet s) : ∫ x, s.indicator 1 x ∂μ = (μ s).toReal := (integral_indicator_const 1 hs).trans ((smul_eq_mul _).trans (mul_one _)) #align measure_theory.integral_indicator_one MeasureTheory.integral_indicator_one theorem setIntegral_indicatorConstLp [CompleteSpace E] {p : ℝ≥0∞} (hs : MeasurableSet s) (ht : MeasurableSet t) (hμt : μ t ≠ ∞) (e : E) : ∫ x in s, indicatorConstLp p ht hμt e x ∂μ = (μ (t ∩ s)).toReal • e := calc ∫ x in s, indicatorConstLp p ht hμt e x ∂μ = ∫ x in s, t.indicator (fun _ => e) x ∂μ := by rw [setIntegral_congr_ae hs (indicatorConstLp_coeFn.mono fun x hx _ => hx)] _ = (μ (t ∩ s)).toReal • e := by rw [integral_indicator_const _ ht, Measure.restrict_apply ht] set_option linter.uppercaseLean3 false in #align measure_theory.set_integral_indicator_const_Lp MeasureTheory.setIntegral_indicatorConstLp @[deprecated (since := "2024-04-17")] alias set_integral_indicatorConstLp := setIntegral_indicatorConstLp theorem integral_indicatorConstLp [CompleteSpace E] {p : ℝ≥0∞} (ht : MeasurableSet t) (hμt : μ t ≠ ∞) (e : E) : ∫ x, indicatorConstLp p ht hμt e x ∂μ = (μ t).toReal • e := calc ∫ x, indicatorConstLp p ht hμt e x ∂μ = ∫ x in univ, indicatorConstLp p ht hμt e x ∂μ := by rw [integral_univ] _ = (μ (t ∩ univ)).toReal • e := setIntegral_indicatorConstLp MeasurableSet.univ ht hμt e _ = (μ t).toReal • e := by rw [inter_univ] set_option linter.uppercaseLean3 false in #align measure_theory.integral_indicator_const_Lp MeasureTheory.integral_indicatorConstLp theorem setIntegral_map {Y} [MeasurableSpace Y] {g : X → Y} {f : Y → E} {s : Set Y} (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (Measure.map g μ)) (hg : AEMeasurable g μ) : ∫ y in s, f y ∂Measure.map g μ = ∫ x in g ⁻¹' s, f (g x) ∂μ := by rw [Measure.restrict_map_of_aemeasurable hg hs, integral_map (hg.mono_measure Measure.restrict_le_self) (hf.mono_measure _)] exact Measure.map_mono_of_aemeasurable Measure.restrict_le_self hg #align measure_theory.set_integral_map MeasureTheory.setIntegral_map @[deprecated (since := "2024-04-17")] alias set_integral_map := setIntegral_map theorem _root_.MeasurableEmbedding.setIntegral_map {Y} {_ : MeasurableSpace Y} {f : X → Y} (hf : MeasurableEmbedding f) (g : Y → E) (s : Set Y) : ∫ y in s, g y ∂Measure.map f μ = ∫ x in f ⁻¹' s, g (f x) ∂μ := by rw [hf.restrict_map, hf.integral_map] #align measurable_embedding.set_integral_map MeasurableEmbedding.setIntegral_map @[deprecated (since := "2024-04-17")] alias _root_.MeasurableEmbedding.set_integral_map := _root_.MeasurableEmbedding.setIntegral_map theorem _root_.ClosedEmbedding.setIntegral_map [TopologicalSpace X] [BorelSpace X] {Y} [MeasurableSpace Y] [TopologicalSpace Y] [BorelSpace Y] {g : X → Y} {f : Y → E} (s : Set Y) (hg : ClosedEmbedding g) : ∫ y in s, f y ∂Measure.map g μ = ∫ x in g ⁻¹' s, f (g x) ∂μ := hg.measurableEmbedding.setIntegral_map _ _ #align closed_embedding.set_integral_map ClosedEmbedding.setIntegral_map @[deprecated (since := "2024-04-17")] alias _root_.ClosedEmbedding.set_integral_map := _root_.ClosedEmbedding.setIntegral_map theorem MeasurePreserving.setIntegral_preimage_emb {Y} {_ : MeasurableSpace Y} {f : X → Y} {ν} (h₁ : MeasurePreserving f μ ν) (h₂ : MeasurableEmbedding f) (g : Y → E) (s : Set Y) : ∫ x in f ⁻¹' s, g (f x) ∂μ = ∫ y in s, g y ∂ν := (h₁.restrict_preimage_emb h₂ s).integral_comp h₂ _ #align measure_theory.measure_preserving.set_integral_preimage_emb MeasureTheory.MeasurePreserving.setIntegral_preimage_emb @[deprecated (since := "2024-04-17")] alias MeasurePreserving.set_integral_preimage_emb := MeasurePreserving.setIntegral_preimage_emb theorem MeasurePreserving.setIntegral_image_emb {Y} {_ : MeasurableSpace Y} {f : X → Y} {ν} (h₁ : MeasurePreserving f μ ν) (h₂ : MeasurableEmbedding f) (g : Y → E) (s : Set X) : ∫ y in f '' s, g y ∂ν = ∫ x in s, g (f x) ∂μ := Eq.symm <| (h₁.restrict_image_emb h₂ s).integral_comp h₂ _ #align measure_theory.measure_preserving.set_integral_image_emb MeasureTheory.MeasurePreserving.setIntegral_image_emb @[deprecated (since := "2024-04-17")] alias MeasurePreserving.set_integral_image_emb := MeasurePreserving.setIntegral_image_emb theorem setIntegral_map_equiv {Y} [MeasurableSpace Y] (e : X ≃ᵐ Y) (f : Y → E) (s : Set Y) : ∫ y in s, f y ∂Measure.map e μ = ∫ x in e ⁻¹' s, f (e x) ∂μ := e.measurableEmbedding.setIntegral_map f s #align measure_theory.set_integral_map_equiv MeasureTheory.setIntegral_map_equiv @[deprecated (since := "2024-04-17")] alias set_integral_map_equiv := setIntegral_map_equiv
Mathlib/MeasureTheory/Integral/SetIntegral.lean
621
625
theorem norm_setIntegral_le_of_norm_le_const_ae {C : ℝ} (hs : μ s < ∞) (hC : ∀ᵐ x ∂μ.restrict s, ‖f x‖ ≤ C) : ‖∫ x in s, f x ∂μ‖ ≤ C * (μ s).toReal := by
rw [← Measure.restrict_apply_univ] at * haveI : IsFiniteMeasure (μ.restrict s) := ⟨hs⟩ exact norm_integral_le_of_norm_le_const hC
import Mathlib.CategoryTheory.Category.Basic import Mathlib.CategoryTheory.Functor.Basic import Mathlib.CategoryTheory.Groupoid import Mathlib.Tactic.NthRewrite import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Quotient import Mathlib.Combinatorics.Quiver.Symmetric #align_import category_theory.groupoid.free_groupoid from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2" open Set Classical Function attribute [local instance] propDecidable namespace CategoryTheory namespace Groupoid namespace Free universe u v u' v' u'' v'' variable {V : Type u} [Quiver.{v + 1} V] abbrev _root_.Quiver.Hom.toPosPath {X Y : V} (f : X ⟶ Y) : (CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom X Y := f.toPos.toPath #align category_theory.groupoid.free.quiver.hom.to_pos_path Quiver.Hom.toPosPath abbrev _root_.Quiver.Hom.toNegPath {X Y : V} (f : X ⟶ Y) : (CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom Y X := f.toNeg.toPath #align category_theory.groupoid.free.quiver.hom.to_neg_path Quiver.Hom.toNegPath inductive redStep : HomRel (Paths (Quiver.Symmetrify V)) | step (X Z : Quiver.Symmetrify V) (f : X ⟶ Z) : redStep (𝟙 (Paths.of.obj X)) (f.toPath ≫ (Quiver.reverse f).toPath) #align category_theory.groupoid.free.red_step CategoryTheory.Groupoid.Free.redStep def _root_.CategoryTheory.FreeGroupoid (V) [Q : Quiver V] := Quotient (@redStep V Q) #align category_theory.free_groupoid CategoryTheory.FreeGroupoid instance {V} [Quiver V] [Nonempty V] : Nonempty (FreeGroupoid V) := by inhabit V; exact ⟨⟨@default V _⟩⟩ theorem congr_reverse {X Y : Paths <| Quiver.Symmetrify V} (p q : X ⟶ Y) : Quotient.CompClosure redStep p q → Quotient.CompClosure redStep p.reverse q.reverse := by rintro ⟨XW, pp, qq, WY, _, Z, f⟩ have : Quotient.CompClosure redStep (WY.reverse ≫ 𝟙 _ ≫ XW.reverse) (WY.reverse ≫ (f.toPath ≫ (Quiver.reverse f).toPath) ≫ XW.reverse) := by constructor constructor simpa only [CategoryStruct.comp, CategoryStruct.id, Quiver.Path.reverse, Quiver.Path.nil_comp, Quiver.Path.reverse_comp, Quiver.reverse_reverse, Quiver.Path.reverse_toPath, Quiver.Path.comp_assoc] using this #align category_theory.groupoid.free.congr_reverse CategoryTheory.Groupoid.Free.congr_reverse theorem congr_comp_reverse {X Y : Paths <| Quiver.Symmetrify V} (p : X ⟶ Y) : Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (p ≫ p.reverse) = Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (𝟙 X) := by apply Quot.EqvGen_sound induction' p with a b q f ih · apply EqvGen.refl · simp only [Quiver.Path.reverse] fapply EqvGen.trans -- Porting note: `Quiver.Path.*` and `Quiver.Hom.*` notation not working · exact q ≫ Quiver.Path.reverse q · apply EqvGen.symm apply EqvGen.rel have : Quotient.CompClosure redStep (q ≫ 𝟙 _ ≫ Quiver.Path.reverse q) (q ≫ (Quiver.Hom.toPath f ≫ Quiver.Hom.toPath (Quiver.reverse f)) ≫ Quiver.Path.reverse q) := by apply Quotient.CompClosure.intro apply redStep.step simp only [Category.assoc, Category.id_comp] at this ⊢ -- Porting note: `simp` cannot see how `Quiver.Path.comp_assoc` is relevant, so change to -- category notation change Quotient.CompClosure redStep (q ≫ Quiver.Path.reverse q) (Quiver.Path.cons q f ≫ (Quiver.Hom.toPath (Quiver.reverse f)) ≫ (Quiver.Path.reverse q)) simp only [← Category.assoc] at this ⊢ exact this · exact ih #align category_theory.groupoid.free.congr_comp_reverse CategoryTheory.Groupoid.Free.congr_comp_reverse
Mathlib/CategoryTheory/Groupoid/FreeGroupoid.lean
120
124
theorem congr_reverse_comp {X Y : Paths <| Quiver.Symmetrify V} (p : X ⟶ Y) : Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (p.reverse ≫ p) = Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (𝟙 Y) := by
nth_rw 2 [← Quiver.Path.reverse_reverse p] apply congr_comp_reverse
import Mathlib.Order.BooleanAlgebra import Mathlib.Logic.Equiv.Basic #align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904" open Function OrderDual variable {ι α β : Type*} {π : ι → Type*} def symmDiff [Sup α] [SDiff α] (a b : α) : α := a \ b ⊔ b \ a #align symm_diff symmDiff def bihimp [Inf α] [HImp α] (a b : α) : α := (b ⇨ a) ⊓ (a ⇨ b) #align bihimp bihimp scoped[symmDiff] infixl:100 " ∆ " => symmDiff scoped[symmDiff] infixl:100 " ⇔ " => bihimp open scoped symmDiff theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a := rfl #align symm_diff_def symmDiff_def theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) := rfl #align bihimp_def bihimp_def theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q := rfl #align symm_diff_eq_xor symmDiff_eq_Xor' @[simp] theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) := (iff_iff_implies_and_implies _ _).symm.trans Iff.comm #align bihimp_iff_iff bihimp_iff_iff @[simp] theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide #align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor section GeneralizedCoheytingAlgebra variable [GeneralizedCoheytingAlgebra α] (a b c d : α) @[simp] theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b := rfl #align to_dual_symm_diff toDual_symmDiff @[simp] theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b := rfl #align of_dual_bihimp ofDual_bihimp theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm] #align symm_diff_comm symmDiff_comm instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) := ⟨symmDiff_comm⟩ #align symm_diff_is_comm symmDiff_isCommutative @[simp] theorem symmDiff_self : a ∆ a = ⊥ := by rw [symmDiff, sup_idem, sdiff_self] #align symm_diff_self symmDiff_self @[simp] theorem symmDiff_bot : a ∆ ⊥ = a := by rw [symmDiff, sdiff_bot, bot_sdiff, sup_bot_eq] #align symm_diff_bot symmDiff_bot @[simp] theorem bot_symmDiff : ⊥ ∆ a = a := by rw [symmDiff_comm, symmDiff_bot] #align bot_symm_diff bot_symmDiff @[simp] theorem symmDiff_eq_bot {a b : α} : a ∆ b = ⊥ ↔ a = b := by simp_rw [symmDiff, sup_eq_bot_iff, sdiff_eq_bot_iff, le_antisymm_iff] #align symm_diff_eq_bot symmDiff_eq_bot
Mathlib/Order/SymmDiff.lean
137
138
theorem symmDiff_of_le {a b : α} (h : a ≤ b) : a ∆ b = b \ a := by
rw [symmDiff, sdiff_eq_bot_iff.2 h, bot_sup_eq]
import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Group.Int import Mathlib.Data.Nat.Dist import Mathlib.Data.Ordmap.Ordnode import Mathlib.Tactic.Abel import Mathlib.Tactic.Linarith #align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" variable {α : Type*} namespace Ordnode theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 := not_le_of_gt H #align ordnode.not_le_delta Ordnode.not_le_delta theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False := not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta) #align ordnode.delta_lt_false Ordnode.delta_lt_false def realSize : Ordnode α → ℕ | nil => 0 | node _ l _ r => realSize l + realSize r + 1 #align ordnode.real_size Ordnode.realSize def Sized : Ordnode α → Prop | nil => True | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r #align ordnode.sized Ordnode.Sized theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) := ⟨rfl, hl, hr⟩ #align ordnode.sized.node' Ordnode.Sized.node' theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by rw [h.1] #align ordnode.sized.eq_node' Ordnode.Sized.eq_node' theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) : size (@node α s l x r) = size l + size r + 1 := H.1 #align ordnode.sized.size_eq Ordnode.Sized.size_eq @[elab_as_elim] theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil) (H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t := by induction t with | nil => exact H0 | node _ _ _ _ t_ih_l t_ih_r => rw [hl.eq_node'] exact H1 _ _ _ (t_ih_l hl.2.1) (t_ih_r hl.2.2) #align ordnode.sized.induction Ordnode.Sized.induction theorem size_eq_realSize : ∀ {t : Ordnode α}, Sized t → size t = realSize t | nil, _ => rfl | node s l x r, ⟨h₁, h₂, h₃⟩ => by rw [size, h₁, size_eq_realSize h₂, size_eq_realSize h₃]; rfl #align ordnode.size_eq_real_size Ordnode.size_eq_realSize @[simp] theorem Sized.size_eq_zero {t : Ordnode α} (ht : Sized t) : size t = 0 ↔ t = nil := by cases t <;> [simp;simp [ht.1]] #align ordnode.sized.size_eq_zero Ordnode.Sized.size_eq_zero theorem Sized.pos {s l x r} (h : Sized (@node α s l x r)) : 0 < s := by rw [h.1]; apply Nat.le_add_left #align ordnode.sized.pos Ordnode.Sized.pos theorem dual_dual : ∀ t : Ordnode α, dual (dual t) = t | nil => rfl | node s l x r => by rw [dual, dual, dual_dual l, dual_dual r] #align ordnode.dual_dual Ordnode.dual_dual @[simp] theorem size_dual (t : Ordnode α) : size (dual t) = size t := by cases t <;> rfl #align ordnode.size_dual Ordnode.size_dual def BalancedSz (l r : ℕ) : Prop := l + r ≤ 1 ∨ l ≤ delta * r ∧ r ≤ delta * l #align ordnode.balanced_sz Ordnode.BalancedSz instance BalancedSz.dec : DecidableRel BalancedSz := fun _ _ => Or.decidable #align ordnode.balanced_sz.dec Ordnode.BalancedSz.dec def Balanced : Ordnode α → Prop | nil => True | node _ l _ r => BalancedSz (size l) (size r) ∧ Balanced l ∧ Balanced r #align ordnode.balanced Ordnode.Balanced instance Balanced.dec : DecidablePred (@Balanced α) | nil => by unfold Balanced infer_instance | node _ l _ r => by unfold Balanced haveI := Balanced.dec l haveI := Balanced.dec r infer_instance #align ordnode.balanced.dec Ordnode.Balanced.dec @[symm] theorem BalancedSz.symm {l r : ℕ} : BalancedSz l r → BalancedSz r l := Or.imp (by rw [add_comm]; exact id) And.symm #align ordnode.balanced_sz.symm Ordnode.BalancedSz.symm theorem balancedSz_zero {l : ℕ} : BalancedSz l 0 ↔ l ≤ 1 := by simp (config := { contextual := true }) [BalancedSz] #align ordnode.balanced_sz_zero Ordnode.balancedSz_zero theorem balancedSz_up {l r₁ r₂ : ℕ} (h₁ : r₁ ≤ r₂) (h₂ : l + r₂ ≤ 1 ∨ r₂ ≤ delta * l) (H : BalancedSz l r₁) : BalancedSz l r₂ := by refine or_iff_not_imp_left.2 fun h => ?_ refine ⟨?_, h₂.resolve_left h⟩ cases H with | inl H => cases r₂ · cases h (le_trans (Nat.add_le_add_left (Nat.zero_le _) _) H) · exact le_trans (le_trans (Nat.le_add_right _ _) H) (Nat.le_add_left 1 _) | inr H => exact le_trans H.1 (Nat.mul_le_mul_left _ h₁) #align ordnode.balanced_sz_up Ordnode.balancedSz_up theorem balancedSz_down {l r₁ r₂ : ℕ} (h₁ : r₁ ≤ r₂) (h₂ : l + r₂ ≤ 1 ∨ l ≤ delta * r₁) (H : BalancedSz l r₂) : BalancedSz l r₁ := have : l + r₂ ≤ 1 → BalancedSz l r₁ := fun H => Or.inl (le_trans (Nat.add_le_add_left h₁ _) H) Or.casesOn H this fun H => Or.casesOn h₂ this fun h₂ => Or.inr ⟨h₂, le_trans h₁ H.2⟩ #align ordnode.balanced_sz_down Ordnode.balancedSz_down theorem Balanced.dual : ∀ {t : Ordnode α}, Balanced t → Balanced (dual t) | nil, _ => ⟨⟩ | node _ l _ r, ⟨b, bl, br⟩ => ⟨by rw [size_dual, size_dual]; exact b.symm, br.dual, bl.dual⟩ #align ordnode.balanced.dual Ordnode.Balanced.dual def node3L (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : Ordnode α := node' (node' l x m) y r #align ordnode.node3_l Ordnode.node3L def node3R (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : Ordnode α := node' l x (node' m y r) #align ordnode.node3_r Ordnode.node3R def node4L : Ordnode α → α → Ordnode α → α → Ordnode α → Ordnode α | l, x, node _ ml y mr, z, r => node' (node' l x ml) y (node' mr z r) | l, x, nil, z, r => node3L l x nil z r #align ordnode.node4_l Ordnode.node4L -- should not happen def node4R : Ordnode α → α → Ordnode α → α → Ordnode α → Ordnode α | l, x, node _ ml y mr, z, r => node' (node' l x ml) y (node' mr z r) | l, x, nil, z, r => node3R l x nil z r #align ordnode.node4_r Ordnode.node4R -- should not happen def rotateL : Ordnode α → α → Ordnode α → Ordnode α | l, x, node _ m y r => if size m < ratio * size r then node3L l x m y r else node4L l x m y r | l, x, nil => node' l x nil #align ordnode.rotate_l Ordnode.rotateL -- Porting note (#11467): during the port we marked these lemmas with `@[eqns]` -- to emulate the old Lean 3 behaviour. theorem rotateL_node (l : Ordnode α) (x : α) (sz : ℕ) (m : Ordnode α) (y : α) (r : Ordnode α) : rotateL l x (node sz m y r) = if size m < ratio * size r then node3L l x m y r else node4L l x m y r := rfl theorem rotateL_nil (l : Ordnode α) (x : α) : rotateL l x nil = node' l x nil := rfl -- should not happen def rotateR : Ordnode α → α → Ordnode α → Ordnode α | node _ l x m, y, r => if size m < ratio * size l then node3R l x m y r else node4R l x m y r | nil, y, r => node' nil y r #align ordnode.rotate_r Ordnode.rotateR -- Porting note (#11467): during the port we marked these lemmas with `@[eqns]` -- to emulate the old Lean 3 behaviour. theorem rotateR_node (sz : ℕ) (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : rotateR (node sz l x m) y r = if size m < ratio * size l then node3R l x m y r else node4R l x m y r := rfl theorem rotateR_nil (y : α) (r : Ordnode α) : rotateR nil y r = node' nil y r := rfl -- should not happen def balanceL' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α := if size l + size r ≤ 1 then node' l x r else if size l > delta * size r then rotateR l x r else node' l x r #align ordnode.balance_l' Ordnode.balanceL' def balanceR' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α := if size l + size r ≤ 1 then node' l x r else if size r > delta * size l then rotateL l x r else node' l x r #align ordnode.balance_r' Ordnode.balanceR' def balance' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α := if size l + size r ≤ 1 then node' l x r else if size r > delta * size l then rotateL l x r else if size l > delta * size r then rotateR l x r else node' l x r #align ordnode.balance' Ordnode.balance' theorem dual_node' (l : Ordnode α) (x : α) (r : Ordnode α) : dual (node' l x r) = node' (dual r) x (dual l) := by simp [node', add_comm] #align ordnode.dual_node' Ordnode.dual_node' theorem dual_node3L (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node3L l x m y r) = node3R (dual r) y (dual m) x (dual l) := by simp [node3L, node3R, dual_node', add_comm] #align ordnode.dual_node3_l Ordnode.dual_node3L theorem dual_node3R (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node3R l x m y r) = node3L (dual r) y (dual m) x (dual l) := by simp [node3L, node3R, dual_node', add_comm] #align ordnode.dual_node3_r Ordnode.dual_node3R theorem dual_node4L (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node4L l x m y r) = node4R (dual r) y (dual m) x (dual l) := by cases m <;> simp [node4L, node4R, node3R, dual_node3L, dual_node', add_comm] #align ordnode.dual_node4_l Ordnode.dual_node4L theorem dual_node4R (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node4R l x m y r) = node4L (dual r) y (dual m) x (dual l) := by cases m <;> simp [node4L, node4R, node3L, dual_node3R, dual_node', add_comm] #align ordnode.dual_node4_r Ordnode.dual_node4R theorem dual_rotateL (l : Ordnode α) (x : α) (r : Ordnode α) : dual (rotateL l x r) = rotateR (dual r) x (dual l) := by cases r <;> simp [rotateL, rotateR, dual_node']; split_ifs <;> simp [dual_node3L, dual_node4L, node3R, add_comm] #align ordnode.dual_rotate_l Ordnode.dual_rotateL theorem dual_rotateR (l : Ordnode α) (x : α) (r : Ordnode α) : dual (rotateR l x r) = rotateL (dual r) x (dual l) := by rw [← dual_dual (rotateL _ _ _), dual_rotateL, dual_dual, dual_dual] #align ordnode.dual_rotate_r Ordnode.dual_rotateR theorem dual_balance' (l : Ordnode α) (x : α) (r : Ordnode α) : dual (balance' l x r) = balance' (dual r) x (dual l) := by simp [balance', add_comm]; split_ifs with h h_1 h_2 <;> simp [dual_node', dual_rotateL, dual_rotateR, add_comm] cases delta_lt_false h_1 h_2 #align ordnode.dual_balance' Ordnode.dual_balance' theorem dual_balanceL (l : Ordnode α) (x : α) (r : Ordnode α) : dual (balanceL l x r) = balanceR (dual r) x (dual l) := by unfold balanceL balanceR cases' r with rs rl rx rr · cases' l with ls ll lx lr; · rfl cases' ll with lls lll llx llr <;> cases' lr with lrs lrl lrx lrr <;> dsimp only [dual, id] <;> try rfl split_ifs with h <;> repeat simp [h, add_comm] · cases' l with ls ll lx lr; · rfl dsimp only [dual, id] split_ifs; swap; · simp [add_comm] cases' ll with lls lll llx llr <;> cases' lr with lrs lrl lrx lrr <;> try rfl dsimp only [dual, id] split_ifs with h <;> simp [h, add_comm] #align ordnode.dual_balance_l Ordnode.dual_balanceL theorem dual_balanceR (l : Ordnode α) (x : α) (r : Ordnode α) : dual (balanceR l x r) = balanceL (dual r) x (dual l) := by rw [← dual_dual (balanceL _ _ _), dual_balanceL, dual_dual, dual_dual] #align ordnode.dual_balance_r Ordnode.dual_balanceR theorem Sized.node3L {l x m y r} (hl : @Sized α l) (hm : Sized m) (hr : Sized r) : Sized (node3L l x m y r) := (hl.node' hm).node' hr #align ordnode.sized.node3_l Ordnode.Sized.node3L theorem Sized.node3R {l x m y r} (hl : @Sized α l) (hm : Sized m) (hr : Sized r) : Sized (node3R l x m y r) := hl.node' (hm.node' hr) #align ordnode.sized.node3_r Ordnode.Sized.node3R theorem Sized.node4L {l x m y r} (hl : @Sized α l) (hm : Sized m) (hr : Sized r) : Sized (node4L l x m y r) := by cases m <;> [exact (hl.node' hm).node' hr; exact (hl.node' hm.2.1).node' (hm.2.2.node' hr)] #align ordnode.sized.node4_l Ordnode.Sized.node4L theorem node3L_size {l x m y r} : size (@node3L α l x m y r) = size l + size m + size r + 2 := by dsimp [node3L, node', size]; rw [add_right_comm _ 1] #align ordnode.node3_l_size Ordnode.node3L_size theorem node3R_size {l x m y r} : size (@node3R α l x m y r) = size l + size m + size r + 2 := by dsimp [node3R, node', size]; rw [← add_assoc, ← add_assoc] #align ordnode.node3_r_size Ordnode.node3R_size theorem node4L_size {l x m y r} (hm : Sized m) : size (@node4L α l x m y r) = size l + size m + size r + 2 := by cases m <;> simp [node4L, node3L, node'] <;> [abel; (simp [size, hm.1]; abel)] #align ordnode.node4_l_size Ordnode.node4L_size theorem Sized.dual : ∀ {t : Ordnode α}, Sized t → Sized (dual t) | nil, _ => ⟨⟩ | node _ l _ r, ⟨rfl, sl, sr⟩ => ⟨by simp [size_dual, add_comm], Sized.dual sr, Sized.dual sl⟩ #align ordnode.sized.dual Ordnode.Sized.dual theorem Sized.dual_iff {t : Ordnode α} : Sized (.dual t) ↔ Sized t := ⟨fun h => by rw [← dual_dual t]; exact h.dual, Sized.dual⟩ #align ordnode.sized.dual_iff Ordnode.Sized.dual_iff theorem Sized.rotateL {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (rotateL l x r) := by cases r; · exact hl.node' hr rw [Ordnode.rotateL_node]; split_ifs · exact hl.node3L hr.2.1 hr.2.2 · exact hl.node4L hr.2.1 hr.2.2 #align ordnode.sized.rotate_l Ordnode.Sized.rotateL theorem Sized.rotateR {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (rotateR l x r) := Sized.dual_iff.1 <| by rw [dual_rotateR]; exact hr.dual.rotateL hl.dual #align ordnode.sized.rotate_r Ordnode.Sized.rotateR theorem Sized.rotateL_size {l x r} (hm : Sized r) : size (@Ordnode.rotateL α l x r) = size l + size r + 1 := by cases r <;> simp [Ordnode.rotateL] simp only [hm.1] split_ifs <;> simp [node3L_size, node4L_size hm.2.1] <;> abel #align ordnode.sized.rotate_l_size Ordnode.Sized.rotateL_size theorem Sized.rotateR_size {l x r} (hl : Sized l) : size (@Ordnode.rotateR α l x r) = size l + size r + 1 := by rw [← size_dual, dual_rotateR, hl.dual.rotateL_size, size_dual, size_dual, add_comm (size l)] #align ordnode.sized.rotate_r_size Ordnode.Sized.rotateR_size theorem Sized.balance' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (balance' l x r) := by unfold balance'; split_ifs · exact hl.node' hr · exact hl.rotateL hr · exact hl.rotateR hr · exact hl.node' hr #align ordnode.sized.balance' Ordnode.Sized.balance' theorem size_balance' {l x r} (hl : @Sized α l) (hr : Sized r) : size (@balance' α l x r) = size l + size r + 1 := by unfold balance'; split_ifs · rfl · exact hr.rotateL_size · exact hl.rotateR_size · rfl #align ordnode.size_balance' Ordnode.size_balance' theorem All.imp {P Q : α → Prop} (H : ∀ a, P a → Q a) : ∀ {t}, All P t → All Q t | nil, _ => ⟨⟩ | node _ _ _ _, ⟨h₁, h₂, h₃⟩ => ⟨h₁.imp H, H _ h₂, h₃.imp H⟩ #align ordnode.all.imp Ordnode.All.imp theorem Any.imp {P Q : α → Prop} (H : ∀ a, P a → Q a) : ∀ {t}, Any P t → Any Q t | nil => id | node _ _ _ _ => Or.imp (Any.imp H) <| Or.imp (H _) (Any.imp H) #align ordnode.any.imp Ordnode.Any.imp theorem all_singleton {P : α → Prop} {x : α} : All P (singleton x) ↔ P x := ⟨fun h => h.2.1, fun h => ⟨⟨⟩, h, ⟨⟩⟩⟩ #align ordnode.all_singleton Ordnode.all_singleton theorem any_singleton {P : α → Prop} {x : α} : Any P (singleton x) ↔ P x := ⟨by rintro (⟨⟨⟩⟩ | h | ⟨⟨⟩⟩); exact h, fun h => Or.inr (Or.inl h)⟩ #align ordnode.any_singleton Ordnode.any_singleton theorem all_dual {P : α → Prop} : ∀ {t : Ordnode α}, All P (dual t) ↔ All P t | nil => Iff.rfl | node _ _l _x _r => ⟨fun ⟨hr, hx, hl⟩ => ⟨all_dual.1 hl, hx, all_dual.1 hr⟩, fun ⟨hl, hx, hr⟩ => ⟨all_dual.2 hr, hx, all_dual.2 hl⟩⟩ #align ordnode.all_dual Ordnode.all_dual theorem all_iff_forall {P : α → Prop} : ∀ {t}, All P t ↔ ∀ x, Emem x t → P x | nil => (iff_true_intro <| by rintro _ ⟨⟩).symm | node _ l x r => by simp [All, Emem, all_iff_forall, Any, or_imp, forall_and] #align ordnode.all_iff_forall Ordnode.all_iff_forall theorem any_iff_exists {P : α → Prop} : ∀ {t}, Any P t ↔ ∃ x, Emem x t ∧ P x | nil => ⟨by rintro ⟨⟩, by rintro ⟨_, ⟨⟩, _⟩⟩ | node _ l x r => by simp only [Emem]; simp [Any, any_iff_exists, or_and_right, exists_or] #align ordnode.any_iff_exists Ordnode.any_iff_exists theorem emem_iff_all {x : α} {t} : Emem x t ↔ ∀ P, All P t → P x := ⟨fun h _ al => all_iff_forall.1 al _ h, fun H => H _ <| all_iff_forall.2 fun _ => id⟩ #align ordnode.emem_iff_all Ordnode.emem_iff_all theorem all_node' {P l x r} : @All α P (node' l x r) ↔ All P l ∧ P x ∧ All P r := Iff.rfl #align ordnode.all_node' Ordnode.all_node' theorem all_node3L {P l x m y r} : @All α P (node3L l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := by simp [node3L, all_node', and_assoc] #align ordnode.all_node3_l Ordnode.all_node3L theorem all_node3R {P l x m y r} : @All α P (node3R l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := Iff.rfl #align ordnode.all_node3_r Ordnode.all_node3R theorem all_node4L {P l x m y r} : @All α P (node4L l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := by cases m <;> simp [node4L, all_node', All, all_node3L, and_assoc] #align ordnode.all_node4_l Ordnode.all_node4L theorem all_node4R {P l x m y r} : @All α P (node4R l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := by cases m <;> simp [node4R, all_node', All, all_node3R, and_assoc] #align ordnode.all_node4_r Ordnode.all_node4R theorem all_rotateL {P l x r} : @All α P (rotateL l x r) ↔ All P l ∧ P x ∧ All P r := by cases r <;> simp [rotateL, all_node']; split_ifs <;> simp [all_node3L, all_node4L, All, and_assoc] #align ordnode.all_rotate_l Ordnode.all_rotateL theorem all_rotateR {P l x r} : @All α P (rotateR l x r) ↔ All P l ∧ P x ∧ All P r := by rw [← all_dual, dual_rotateR, all_rotateL]; simp [all_dual, and_comm, and_left_comm, and_assoc] #align ordnode.all_rotate_r Ordnode.all_rotateR theorem all_balance' {P l x r} : @All α P (balance' l x r) ↔ All P l ∧ P x ∧ All P r := by rw [balance']; split_ifs <;> simp [all_node', all_rotateL, all_rotateR] #align ordnode.all_balance' Ordnode.all_balance' theorem foldr_cons_eq_toList : ∀ (t : Ordnode α) (r : List α), t.foldr List.cons r = toList t ++ r | nil, r => rfl | node _ l x r, r' => by rw [foldr, foldr_cons_eq_toList l, foldr_cons_eq_toList r, ← List.cons_append, ← List.append_assoc, ← foldr_cons_eq_toList l]; rfl #align ordnode.foldr_cons_eq_to_list Ordnode.foldr_cons_eq_toList @[simp] theorem toList_nil : toList (@nil α) = [] := rfl #align ordnode.to_list_nil Ordnode.toList_nil @[simp] theorem toList_node (s l x r) : toList (@node α s l x r) = toList l ++ x :: toList r := by rw [toList, foldr, foldr_cons_eq_toList]; rfl #align ordnode.to_list_node Ordnode.toList_node theorem emem_iff_mem_toList {x : α} {t} : Emem x t ↔ x ∈ toList t := by unfold Emem; induction t <;> simp [Any, *, or_assoc] #align ordnode.emem_iff_mem_to_list Ordnode.emem_iff_mem_toList theorem length_toList' : ∀ t : Ordnode α, (toList t).length = t.realSize | nil => rfl | node _ l _ r => by rw [toList_node, List.length_append, List.length_cons, length_toList' l, length_toList' r]; rfl #align ordnode.length_to_list' Ordnode.length_toList' theorem length_toList {t : Ordnode α} (h : Sized t) : (toList t).length = t.size := by rw [length_toList', size_eq_realSize h] #align ordnode.length_to_list Ordnode.length_toList theorem equiv_iff {t₁ t₂ : Ordnode α} (h₁ : Sized t₁) (h₂ : Sized t₂) : Equiv t₁ t₂ ↔ toList t₁ = toList t₂ := and_iff_right_of_imp fun h => by rw [← length_toList h₁, h, length_toList h₂] #align ordnode.equiv_iff Ordnode.equiv_iff theorem pos_size_of_mem [LE α] [@DecidableRel α (· ≤ ·)] {x : α} {t : Ordnode α} (h : Sized t) (h_mem : x ∈ t) : 0 < size t := by cases t; · { contradiction }; · { simp [h.1] } #align ordnode.pos_size_of_mem Ordnode.pos_size_of_mem theorem findMin'_dual : ∀ (t) (x : α), findMin' (dual t) x = findMax' x t | nil, _ => rfl | node _ _ x r, _ => findMin'_dual r x #align ordnode.find_min'_dual Ordnode.findMin'_dual theorem findMax'_dual (t) (x : α) : findMax' x (dual t) = findMin' t x := by rw [← findMin'_dual, dual_dual] #align ordnode.find_max'_dual Ordnode.findMax'_dual theorem findMin_dual : ∀ t : Ordnode α, findMin (dual t) = findMax t | nil => rfl | node _ _ _ _ => congr_arg some <| findMin'_dual _ _ #align ordnode.find_min_dual Ordnode.findMin_dual theorem findMax_dual (t : Ordnode α) : findMax (dual t) = findMin t := by rw [← findMin_dual, dual_dual] #align ordnode.find_max_dual Ordnode.findMax_dual theorem dual_eraseMin : ∀ t : Ordnode α, dual (eraseMin t) = eraseMax (dual t) | nil => rfl | node _ nil x r => rfl | node _ (node sz l' y r') x r => by rw [eraseMin, dual_balanceR, dual_eraseMin (node sz l' y r'), dual, dual, dual, eraseMax] #align ordnode.dual_erase_min Ordnode.dual_eraseMin theorem dual_eraseMax (t : Ordnode α) : dual (eraseMax t) = eraseMin (dual t) := by rw [← dual_dual (eraseMin _), dual_eraseMin, dual_dual] #align ordnode.dual_erase_max Ordnode.dual_eraseMax theorem splitMin_eq : ∀ (s l) (x : α) (r), splitMin' l x r = (findMin' l x, eraseMin (node s l x r)) | _, nil, x, r => rfl | _, node ls ll lx lr, x, r => by rw [splitMin', splitMin_eq ls ll lx lr, findMin', eraseMin] #align ordnode.split_min_eq Ordnode.splitMin_eq theorem splitMax_eq : ∀ (s l) (x : α) (r), splitMax' l x r = (eraseMax (node s l x r), findMax' x r) | _, l, x, nil => rfl | _, l, x, node ls ll lx lr => by rw [splitMax', splitMax_eq ls ll lx lr, findMax', eraseMax] #align ordnode.split_max_eq Ordnode.splitMax_eq -- @[elab_as_elim] -- Porting note: unexpected eliminator resulting type theorem findMin'_all {P : α → Prop} : ∀ (t) (x : α), All P t → P x → P (findMin' t x) | nil, _x, _, hx => hx | node _ ll lx _, _, ⟨h₁, h₂, _⟩, _ => findMin'_all ll lx h₁ h₂ #align ordnode.find_min'_all Ordnode.findMin'_all -- @[elab_as_elim] -- Porting note: unexpected eliminator resulting type theorem findMax'_all {P : α → Prop} : ∀ (x : α) (t), P x → All P t → P (findMax' x t) | _x, nil, hx, _ => hx | _, node _ _ lx lr, _, ⟨_, h₂, h₃⟩ => findMax'_all lx lr h₂ h₃ #align ordnode.find_max'_all Ordnode.findMax'_all @[simp] theorem merge_nil_left (t : Ordnode α) : merge t nil = t := by cases t <;> rfl #align ordnode.merge_nil_left Ordnode.merge_nil_left @[simp] theorem merge_nil_right (t : Ordnode α) : merge nil t = t := rfl #align ordnode.merge_nil_right Ordnode.merge_nil_right @[simp] theorem merge_node {ls ll lx lr rs rl rx rr} : merge (@node α ls ll lx lr) (node rs rl rx rr) = if delta * ls < rs then balanceL (merge (node ls ll lx lr) rl) rx rr else if delta * rs < ls then balanceR ll lx (merge lr (node rs rl rx rr)) else glue (node ls ll lx lr) (node rs rl rx rr) := rfl #align ordnode.merge_node Ordnode.merge_node theorem dual_insert [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x : α) : ∀ t : Ordnode α, dual (Ordnode.insert x t) = @Ordnode.insert αᵒᵈ _ _ x (dual t) | nil => rfl | node _ l y r => by have : @cmpLE αᵒᵈ _ _ x y = cmpLE y x := rfl rw [Ordnode.insert, dual, Ordnode.insert, this, ← cmpLE_swap x y] cases cmpLE x y <;> simp [Ordering.swap, Ordnode.insert, dual_balanceL, dual_balanceR, dual_insert] #align ordnode.dual_insert Ordnode.dual_insert theorem balance_eq_balance' {l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) : @balance α l x r = balance' l x r := by cases' l with ls ll lx lr · cases' r with rs rl rx rr · rfl · rw [sr.eq_node'] at hr ⊢ cases' rl with rls rll rlx rlr <;> cases' rr with rrs rrl rrx rrr <;> dsimp [balance, balance'] · rfl · have : size rrl = 0 ∧ size rrr = 0 := by have := balancedSz_zero.1 hr.1.symm rwa [size, sr.2.2.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sr.2.2.2.1.size_eq_zero.1 this.1 cases sr.2.2.2.2.size_eq_zero.1 this.2 obtain rfl : rrs = 1 := sr.2.2.1 rw [if_neg, if_pos, rotateL_node, if_pos]; · rfl all_goals dsimp only [size]; decide · have : size rll = 0 ∧ size rlr = 0 := by have := balancedSz_zero.1 hr.1 rwa [size, sr.2.1.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sr.2.1.2.1.size_eq_zero.1 this.1 cases sr.2.1.2.2.size_eq_zero.1 this.2 obtain rfl : rls = 1 := sr.2.1.1 rw [if_neg, if_pos, rotateL_node, if_neg]; · rfl all_goals dsimp only [size]; decide · symm; rw [zero_add, if_neg, if_pos, rotateL] · dsimp only [size_node]; split_ifs · simp [node3L, node']; abel · simp [node4L, node', sr.2.1.1]; abel · apply Nat.zero_lt_succ · exact not_le_of_gt (Nat.succ_lt_succ (add_pos sr.2.1.pos sr.2.2.pos)) · cases' r with rs rl rx rr · rw [sl.eq_node'] at hl ⊢ cases' ll with lls lll llx llr <;> cases' lr with lrs lrl lrx lrr <;> dsimp [balance, balance'] · rfl · have : size lrl = 0 ∧ size lrr = 0 := by have := balancedSz_zero.1 hl.1.symm rwa [size, sl.2.2.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sl.2.2.2.1.size_eq_zero.1 this.1 cases sl.2.2.2.2.size_eq_zero.1 this.2 obtain rfl : lrs = 1 := sl.2.2.1 rw [if_neg, if_neg, if_pos, rotateR_node, if_neg]; · rfl all_goals dsimp only [size]; decide · have : size lll = 0 ∧ size llr = 0 := by have := balancedSz_zero.1 hl.1 rwa [size, sl.2.1.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sl.2.1.2.1.size_eq_zero.1 this.1 cases sl.2.1.2.2.size_eq_zero.1 this.2 obtain rfl : lls = 1 := sl.2.1.1 rw [if_neg, if_neg, if_pos, rotateR_node, if_pos]; · rfl all_goals dsimp only [size]; decide · symm; rw [if_neg, if_neg, if_pos, rotateR] · dsimp only [size_node]; split_ifs · simp [node3R, node']; abel · simp [node4R, node', sl.2.2.1]; abel · apply Nat.zero_lt_succ · apply Nat.not_lt_zero · exact not_le_of_gt (Nat.succ_lt_succ (add_pos sl.2.1.pos sl.2.2.pos)) · simp [balance, balance'] symm; rw [if_neg] · split_ifs with h h_1 · have rd : delta ≤ size rl + size rr := by have := lt_of_le_of_lt (Nat.mul_le_mul_left _ sl.pos) h rwa [sr.1, Nat.lt_succ_iff] at this cases' rl with rls rll rlx rlr · rw [size, zero_add] at rd exact absurd (le_trans rd (balancedSz_zero.1 hr.1.symm)) (by decide) cases' rr with rrs rrl rrx rrr · exact absurd (le_trans rd (balancedSz_zero.1 hr.1)) (by decide) dsimp [rotateL]; split_ifs · simp [node3L, node', sr.1]; abel · simp [node4L, node', sr.1, sr.2.1.1]; abel · have ld : delta ≤ size ll + size lr := by have := lt_of_le_of_lt (Nat.mul_le_mul_left _ sr.pos) h_1 rwa [sl.1, Nat.lt_succ_iff] at this cases' ll with lls lll llx llr · rw [size, zero_add] at ld exact absurd (le_trans ld (balancedSz_zero.1 hl.1.symm)) (by decide) cases' lr with lrs lrl lrx lrr · exact absurd (le_trans ld (balancedSz_zero.1 hl.1)) (by decide) dsimp [rotateR]; split_ifs · simp [node3R, node', sl.1]; abel · simp [node4R, node', sl.1, sl.2.2.1]; abel · simp [node'] · exact not_le_of_gt (add_le_add (Nat.succ_le_of_lt sl.pos) (Nat.succ_le_of_lt sr.pos)) #align ordnode.balance_eq_balance' Ordnode.balance_eq_balance' theorem balanceL_eq_balance {l x r} (sl : Sized l) (sr : Sized r) (H1 : size l = 0 → size r ≤ 1) (H2 : 1 ≤ size l → 1 ≤ size r → size r ≤ delta * size l) : @balanceL α l x r = balance l x r := by cases' r with rs rl rx rr · rfl · cases' l with ls ll lx lr · have : size rl = 0 ∧ size rr = 0 := by have := H1 rfl rwa [size, sr.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sr.2.1.size_eq_zero.1 this.1 cases sr.2.2.size_eq_zero.1 this.2 rw [sr.eq_node']; rfl · replace H2 : ¬rs > delta * ls := not_lt_of_le (H2 sl.pos sr.pos) simp [balanceL, balance, H2]; split_ifs <;> simp [add_comm] #align ordnode.balance_l_eq_balance Ordnode.balanceL_eq_balance def Raised (n m : ℕ) : Prop := m = n ∨ m = n + 1 #align ordnode.raised Ordnode.Raised theorem raised_iff {n m} : Raised n m ↔ n ≤ m ∧ m ≤ n + 1 := by constructor · rintro (rfl | rfl) · exact ⟨le_rfl, Nat.le_succ _⟩ · exact ⟨Nat.le_succ _, le_rfl⟩ · rintro ⟨h₁, h₂⟩ rcases eq_or_lt_of_le h₁ with (rfl | h₁) · exact Or.inl rfl · exact Or.inr (le_antisymm h₂ h₁) #align ordnode.raised_iff Ordnode.raised_iff theorem Raised.dist_le {n m} (H : Raised n m) : Nat.dist n m ≤ 1 := by cases' raised_iff.1 H with H1 H2; rwa [Nat.dist_eq_sub_of_le H1, tsub_le_iff_left] #align ordnode.raised.dist_le Ordnode.Raised.dist_le theorem Raised.dist_le' {n m} (H : Raised n m) : Nat.dist m n ≤ 1 := by rw [Nat.dist_comm]; exact H.dist_le #align ordnode.raised.dist_le' Ordnode.Raised.dist_le' theorem Raised.add_left (k) {n m} (H : Raised n m) : Raised (k + n) (k + m) := by rcases H with (rfl | rfl) · exact Or.inl rfl · exact Or.inr rfl #align ordnode.raised.add_left Ordnode.Raised.add_left theorem Raised.add_right (k) {n m} (H : Raised n m) : Raised (n + k) (m + k) := by rw [add_comm, add_comm m]; exact H.add_left _ #align ordnode.raised.add_right Ordnode.Raised.add_right
Mathlib/Data/Ordmap/Ordset.lean
812
817
theorem Raised.right {l x₁ x₂ r₁ r₂} (H : Raised (size r₁) (size r₂)) : Raised (size (@node' α l x₁ r₁)) (size (@node' α l x₂ r₂)) := by
rw [node', size_node, size_node]; generalize size r₂ = m at H ⊢ rcases H with (rfl | rfl) · exact Or.inl rfl · exact Or.inr rfl
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type w} {ι' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section RankCondition variable [RankCondition R]
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
109
118
theorem Basis.le_span'' {ι : Type*} [Fintype ι] (b : Basis ι R M) {w : Set M} [Fintype w] (s : span R w = ⊤) : Fintype.card ι ≤ Fintype.card w := by
-- We construct a surjective linear map `(w → R) →ₗ[R] (ι → R)`, -- by expressing a linear combination in `w` as a linear combination in `ι`. fapply card_le_of_surjective' R · exact b.repr.toLinearMap.comp (Finsupp.total w M R (↑)) · apply Surjective.comp (g := b.repr.toLinearMap) · apply LinearEquiv.surjective rw [← LinearMap.range_eq_top, Finsupp.range_total] simpa using s
import Mathlib.Analysis.Convex.Side import Mathlib.Geometry.Euclidean.Angle.Oriented.Rotation import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine #align_import geometry.euclidean.angle.oriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open FiniteDimensional Complex open scoped Affine EuclideanGeometry Real RealInnerProductSpace ComplexConjugate namespace EuclideanGeometry variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)] abbrev o := @Module.Oriented.positiveOrientation def oangle (p₁ p₂ p₃ : P) : Real.Angle := o.oangle (p₁ -ᵥ p₂) (p₃ -ᵥ p₂) #align euclidean_geometry.oangle EuclideanGeometry.oangle @[inherit_doc] scoped notation "∡" => EuclideanGeometry.oangle theorem continuousAt_oangle {x : P × P × P} (hx12 : x.1 ≠ x.2.1) (hx32 : x.2.2 ≠ x.2.1) : ContinuousAt (fun y : P × P × P => ∡ y.1 y.2.1 y.2.2) x := by let f : P × P × P → V × V := fun y => (y.1 -ᵥ y.2.1, y.2.2 -ᵥ y.2.1) have hf1 : (f x).1 ≠ 0 := by simp [hx12] have hf2 : (f x).2 ≠ 0 := by simp [hx32] exact (o.continuousAt_oangle hf1 hf2).comp ((continuous_fst.vsub continuous_snd.fst).prod_mk (continuous_snd.snd.vsub continuous_snd.fst)).continuousAt #align euclidean_geometry.continuous_at_oangle EuclideanGeometry.continuousAt_oangle @[simp] theorem oangle_self_left (p₁ p₂ : P) : ∡ p₁ p₁ p₂ = 0 := by simp [oangle] #align euclidean_geometry.oangle_self_left EuclideanGeometry.oangle_self_left @[simp] theorem oangle_self_right (p₁ p₂ : P) : ∡ p₁ p₂ p₂ = 0 := by simp [oangle] #align euclidean_geometry.oangle_self_right EuclideanGeometry.oangle_self_right @[simp] theorem oangle_self_left_right (p₁ p₂ : P) : ∡ p₁ p₂ p₁ = 0 := o.oangle_self _ #align euclidean_geometry.oangle_self_left_right EuclideanGeometry.oangle_self_left_right theorem left_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₁ ≠ p₂ := by rw [← @vsub_ne_zero V]; exact o.left_ne_zero_of_oangle_ne_zero h #align euclidean_geometry.left_ne_of_oangle_ne_zero EuclideanGeometry.left_ne_of_oangle_ne_zero theorem right_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₃ ≠ p₂ := by rw [← @vsub_ne_zero V]; exact o.right_ne_zero_of_oangle_ne_zero h #align euclidean_geometry.right_ne_of_oangle_ne_zero EuclideanGeometry.right_ne_of_oangle_ne_zero theorem left_ne_right_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₁ ≠ p₃ := by rw [← (vsub_left_injective p₂).ne_iff]; exact o.ne_of_oangle_ne_zero h #align euclidean_geometry.left_ne_right_of_oangle_ne_zero EuclideanGeometry.left_ne_right_of_oangle_ne_zero theorem left_ne_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_pi EuclideanGeometry.left_ne_of_oangle_eq_pi theorem right_ne_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_pi EuclideanGeometry.right_ne_of_oangle_eq_pi theorem left_ne_right_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_pi EuclideanGeometry.left_ne_right_of_oangle_eq_pi theorem left_ne_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_pi_div_two EuclideanGeometry.left_ne_of_oangle_eq_pi_div_two theorem right_ne_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_pi_div_two EuclideanGeometry.right_ne_of_oangle_eq_pi_div_two theorem left_ne_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_pi_div_two EuclideanGeometry.left_ne_right_of_oangle_eq_pi_div_two theorem left_ne_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_neg_pi_div_two EuclideanGeometry.left_ne_of_oangle_eq_neg_pi_div_two theorem right_ne_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_neg_pi_div_two EuclideanGeometry.right_ne_of_oangle_eq_neg_pi_div_two theorem left_ne_right_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_neg_pi_div_two EuclideanGeometry.left_ne_right_of_oangle_eq_neg_pi_div_two theorem left_ne_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.left_ne_of_oangle_sign_ne_zero EuclideanGeometry.left_ne_of_oangle_sign_ne_zero theorem right_ne_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.right_ne_of_oangle_sign_ne_zero EuclideanGeometry.right_ne_of_oangle_sign_ne_zero theorem left_ne_right_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.left_ne_right_of_oangle_sign_ne_zero EuclideanGeometry.left_ne_right_of_oangle_sign_ne_zero theorem left_ne_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₁ ≠ p₂ := left_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_of_oangle_sign_eq_one EuclideanGeometry.left_ne_of_oangle_sign_eq_one theorem right_ne_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₃ ≠ p₂ := right_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.right_ne_of_oangle_sign_eq_one EuclideanGeometry.right_ne_of_oangle_sign_eq_one theorem left_ne_right_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₁ ≠ p₃ := left_ne_right_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_sign_eq_one EuclideanGeometry.left_ne_right_of_oangle_sign_eq_one theorem left_ne_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₁ ≠ p₂ := left_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_of_oangle_sign_eq_neg_one EuclideanGeometry.left_ne_of_oangle_sign_eq_neg_one theorem right_ne_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₃ ≠ p₂ := right_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.right_ne_of_oangle_sign_eq_neg_one EuclideanGeometry.right_ne_of_oangle_sign_eq_neg_one theorem left_ne_right_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₁ ≠ p₃ := left_ne_right_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_sign_eq_neg_one EuclideanGeometry.left_ne_right_of_oangle_sign_eq_neg_one theorem oangle_rev (p₁ p₂ p₃ : P) : ∡ p₃ p₂ p₁ = -∡ p₁ p₂ p₃ := o.oangle_rev _ _ #align euclidean_geometry.oangle_rev EuclideanGeometry.oangle_rev @[simp] theorem oangle_add_oangle_rev (p₁ p₂ p₃ : P) : ∡ p₁ p₂ p₃ + ∡ p₃ p₂ p₁ = 0 := o.oangle_add_oangle_rev _ _ #align euclidean_geometry.oangle_add_oangle_rev EuclideanGeometry.oangle_add_oangle_rev theorem oangle_eq_zero_iff_oangle_rev_eq_zero {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ↔ ∡ p₃ p₂ p₁ = 0 := o.oangle_eq_zero_iff_oangle_rev_eq_zero #align euclidean_geometry.oangle_eq_zero_iff_oangle_rev_eq_zero EuclideanGeometry.oangle_eq_zero_iff_oangle_rev_eq_zero theorem oangle_eq_pi_iff_oangle_rev_eq_pi {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = π ↔ ∡ p₃ p₂ p₁ = π := o.oangle_eq_pi_iff_oangle_rev_eq_pi #align euclidean_geometry.oangle_eq_pi_iff_oangle_rev_eq_pi EuclideanGeometry.oangle_eq_pi_iff_oangle_rev_eq_pi theorem oangle_ne_zero_and_ne_pi_iff_affineIndependent {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ ≠ 0 ∧ ∡ p₁ p₂ p₃ ≠ π ↔ AffineIndependent ℝ ![p₁, p₂, p₃] := by rw [oangle, o.oangle_ne_zero_and_ne_pi_iff_linearIndependent, affineIndependent_iff_linearIndependent_vsub ℝ _ (1 : Fin 3), ← linearIndependent_equiv (finSuccAboveEquiv (1 : Fin 3)).toEquiv] convert Iff.rfl ext i fin_cases i <;> rfl #align euclidean_geometry.oangle_ne_zero_and_ne_pi_iff_affine_independent EuclideanGeometry.oangle_ne_zero_and_ne_pi_iff_affineIndependent theorem oangle_eq_zero_or_eq_pi_iff_collinear {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ∨ ∡ p₁ p₂ p₃ = π ↔ Collinear ℝ ({p₁, p₂, p₃} : Set P) := by rw [← not_iff_not, not_or, oangle_ne_zero_and_ne_pi_iff_affineIndependent, affineIndependent_iff_not_collinear_set] #align euclidean_geometry.oangle_eq_zero_or_eq_pi_iff_collinear EuclideanGeometry.oangle_eq_zero_or_eq_pi_iff_collinear theorem oangle_sign_eq_zero_iff_collinear {p₁ p₂ p₃ : P} : (∡ p₁ p₂ p₃).sign = 0 ↔ Collinear ℝ ({p₁, p₂, p₃} : Set P) := by rw [Real.Angle.sign_eq_zero_iff, oangle_eq_zero_or_eq_pi_iff_collinear] theorem affineIndependent_iff_of_two_zsmul_oangle_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆) : AffineIndependent ℝ ![p₁, p₂, p₃] ↔ AffineIndependent ℝ ![p₄, p₅, p₆] := by simp_rw [← oangle_ne_zero_and_ne_pi_iff_affineIndependent, ← Real.Angle.two_zsmul_ne_zero_iff, h] #align euclidean_geometry.affine_independent_iff_of_two_zsmul_oangle_eq EuclideanGeometry.affineIndependent_iff_of_two_zsmul_oangle_eq theorem collinear_iff_of_two_zsmul_oangle_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆) : Collinear ℝ ({p₁, p₂, p₃} : Set P) ↔ Collinear ℝ ({p₄, p₅, p₆} : Set P) := by simp_rw [← oangle_eq_zero_or_eq_pi_iff_collinear, ← Real.Angle.two_zsmul_eq_zero_iff, h] #align euclidean_geometry.collinear_iff_of_two_zsmul_oangle_eq EuclideanGeometry.collinear_iff_of_two_zsmul_oangle_eq theorem two_zsmul_oangle_of_vectorSpan_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h₁₂₄₅ : vectorSpan ℝ ({p₁, p₂} : Set P) = vectorSpan ℝ ({p₄, p₅} : Set P)) (h₃₂₆₅ : vectorSpan ℝ ({p₃, p₂} : Set P) = vectorSpan ℝ ({p₆, p₅} : Set P)) : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆ := by simp_rw [vectorSpan_pair] at h₁₂₄₅ h₃₂₆₅ exact o.two_zsmul_oangle_of_span_eq_of_span_eq h₁₂₄₅ h₃₂₆₅ #align euclidean_geometry.two_zsmul_oangle_of_vector_span_eq EuclideanGeometry.two_zsmul_oangle_of_vectorSpan_eq theorem two_zsmul_oangle_of_parallel {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h₁₂₄₅ : line[ℝ, p₁, p₂] ∥ line[ℝ, p₄, p₅]) (h₃₂₆₅ : line[ℝ, p₃, p₂] ∥ line[ℝ, p₆, p₅]) : (2 : ℤ) • ∡ p₁ p₂ p₃ = (2 : ℤ) • ∡ p₄ p₅ p₆ := by rw [AffineSubspace.affineSpan_pair_parallel_iff_vectorSpan_eq] at h₁₂₄₅ h₃₂₆₅ exact two_zsmul_oangle_of_vectorSpan_eq h₁₂₄₅ h₃₂₆₅ #align euclidean_geometry.two_zsmul_oangle_of_parallel EuclideanGeometry.two_zsmul_oangle_of_parallel @[simp] theorem oangle_add {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₂ + ∡ p₂ p p₃ = ∡ p₁ p p₃ := o.oangle_add (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_add EuclideanGeometry.oangle_add @[simp] theorem oangle_add_swap {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₂ p p₃ + ∡ p₁ p p₂ = ∡ p₁ p p₃ := o.oangle_add_swap (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_add_swap EuclideanGeometry.oangle_add_swap @[simp] theorem oangle_sub_left {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₃ - ∡ p₁ p p₂ = ∡ p₂ p p₃ := o.oangle_sub_left (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_sub_left EuclideanGeometry.oangle_sub_left @[simp] theorem oangle_sub_right {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₃ - ∡ p₂ p p₃ = ∡ p₁ p p₂ := o.oangle_sub_right (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_sub_right EuclideanGeometry.oangle_sub_right @[simp] theorem oangle_add_cyc3 {p p₁ p₂ p₃ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) (hp₃ : p₃ ≠ p) : ∡ p₁ p p₂ + ∡ p₂ p p₃ + ∡ p₃ p p₁ = 0 := o.oangle_add_cyc3 (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) (vsub_ne_zero.2 hp₃) #align euclidean_geometry.oangle_add_cyc3 EuclideanGeometry.oangle_add_cyc3 theorem oangle_eq_oangle_of_dist_eq {p₁ p₂ p₃ : P} (h : dist p₁ p₂ = dist p₁ p₃) : ∡ p₁ p₂ p₃ = ∡ p₂ p₃ p₁ := by simp_rw [dist_eq_norm_vsub V] at h rw [oangle, oangle, ← vsub_sub_vsub_cancel_left p₃ p₂ p₁, ← vsub_sub_vsub_cancel_left p₂ p₃ p₁, o.oangle_sub_eq_oangle_sub_rev_of_norm_eq h] #align euclidean_geometry.oangle_eq_oangle_of_dist_eq EuclideanGeometry.oangle_eq_oangle_of_dist_eq theorem oangle_eq_pi_sub_two_zsmul_oangle_of_dist_eq {p₁ p₂ p₃ : P} (hn : p₂ ≠ p₃) (h : dist p₁ p₂ = dist p₁ p₃) : ∡ p₃ p₁ p₂ = π - (2 : ℤ) • ∡ p₁ p₂ p₃ := by simp_rw [dist_eq_norm_vsub V] at h rw [oangle, oangle] convert o.oangle_eq_pi_sub_two_zsmul_oangle_sub_of_norm_eq _ h using 1 · rw [← neg_vsub_eq_vsub_rev p₁ p₃, ← neg_vsub_eq_vsub_rev p₁ p₂, o.oangle_neg_neg] · rw [← o.oangle_sub_eq_oangle_sub_rev_of_norm_eq h]; simp · simpa using hn #align euclidean_geometry.oangle_eq_pi_sub_two_zsmul_oangle_of_dist_eq EuclideanGeometry.oangle_eq_pi_sub_two_zsmul_oangle_of_dist_eq theorem abs_oangle_right_toReal_lt_pi_div_two_of_dist_eq {p₁ p₂ p₃ : P} (h : dist p₁ p₂ = dist p₁ p₃) : |(∡ p₁ p₂ p₃).toReal| < π / 2 := by simp_rw [dist_eq_norm_vsub V] at h rw [oangle, ← vsub_sub_vsub_cancel_left p₃ p₂ p₁] exact o.abs_oangle_sub_right_toReal_lt_pi_div_two h #align euclidean_geometry.abs_oangle_right_to_real_lt_pi_div_two_of_dist_eq EuclideanGeometry.abs_oangle_right_toReal_lt_pi_div_two_of_dist_eq theorem abs_oangle_left_toReal_lt_pi_div_two_of_dist_eq {p₁ p₂ p₃ : P} (h : dist p₁ p₂ = dist p₁ p₃) : |(∡ p₂ p₃ p₁).toReal| < π / 2 := oangle_eq_oangle_of_dist_eq h ▸ abs_oangle_right_toReal_lt_pi_div_two_of_dist_eq h #align euclidean_geometry.abs_oangle_left_to_real_lt_pi_div_two_of_dist_eq EuclideanGeometry.abs_oangle_left_toReal_lt_pi_div_two_of_dist_eq theorem cos_oangle_eq_cos_angle {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : Real.Angle.cos (∡ p₁ p p₂) = Real.cos (∠ p₁ p p₂) := o.cos_oangle_eq_cos_angle (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.cos_oangle_eq_cos_angle EuclideanGeometry.cos_oangle_eq_cos_angle theorem oangle_eq_angle_or_eq_neg_angle {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : ∡ p₁ p p₂ = ∠ p₁ p p₂ ∨ ∡ p₁ p p₂ = -∠ p₁ p p₂ := o.oangle_eq_angle_or_eq_neg_angle (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.oangle_eq_angle_or_eq_neg_angle EuclideanGeometry.oangle_eq_angle_or_eq_neg_angle theorem angle_eq_abs_oangle_toReal {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : ∠ p₁ p p₂ = |(∡ p₁ p p₂).toReal| := o.angle_eq_abs_oangle_toReal (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.angle_eq_abs_oangle_to_real EuclideanGeometry.angle_eq_abs_oangle_toReal theorem eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero {p p₁ p₂ : P} (h : (∡ p₁ p p₂).sign = 0) : p₁ = p ∨ p₂ = p ∨ ∠ p₁ p p₂ = 0 ∨ ∠ p₁ p p₂ = π := by convert o.eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero h <;> simp #align euclidean_geometry.eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero EuclideanGeometry.eq_zero_or_angle_eq_zero_or_pi_of_sign_oangle_eq_zero theorem oangle_eq_of_angle_eq_of_sign_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (h : ∠ p₁ p₂ p₃ = ∠ p₄ p₅ p₆) (hs : (∡ p₁ p₂ p₃).sign = (∡ p₄ p₅ p₆).sign) : ∡ p₁ p₂ p₃ = ∡ p₄ p₅ p₆ := o.oangle_eq_of_angle_eq_of_sign_eq h hs #align euclidean_geometry.oangle_eq_of_angle_eq_of_sign_eq EuclideanGeometry.oangle_eq_of_angle_eq_of_sign_eq theorem angle_eq_iff_oangle_eq_of_sign_eq {p₁ p₂ p₃ p₄ p₅ p₆ : P} (hp₁ : p₁ ≠ p₂) (hp₃ : p₃ ≠ p₂) (hp₄ : p₄ ≠ p₅) (hp₆ : p₆ ≠ p₅) (hs : (∡ p₁ p₂ p₃).sign = (∡ p₄ p₅ p₆).sign) : ∠ p₁ p₂ p₃ = ∠ p₄ p₅ p₆ ↔ ∡ p₁ p₂ p₃ = ∡ p₄ p₅ p₆ := o.angle_eq_iff_oangle_eq_of_sign_eq (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₃) (vsub_ne_zero.2 hp₄) (vsub_ne_zero.2 hp₆) hs #align euclidean_geometry.angle_eq_iff_oangle_eq_of_sign_eq EuclideanGeometry.angle_eq_iff_oangle_eq_of_sign_eq theorem oangle_eq_angle_of_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : ∡ p₁ p₂ p₃ = ∠ p₁ p₂ p₃ := o.oangle_eq_angle_of_sign_eq_one h #align euclidean_geometry.oangle_eq_angle_of_sign_eq_one EuclideanGeometry.oangle_eq_angle_of_sign_eq_one theorem oangle_eq_neg_angle_of_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : ∡ p₁ p₂ p₃ = -∠ p₁ p₂ p₃ := o.oangle_eq_neg_angle_of_sign_eq_neg_one h #align euclidean_geometry.oangle_eq_neg_angle_of_sign_eq_neg_one EuclideanGeometry.oangle_eq_neg_angle_of_sign_eq_neg_one theorem oangle_eq_zero_iff_angle_eq_zero {p p₁ p₂ : P} (hp₁ : p₁ ≠ p) (hp₂ : p₂ ≠ p) : ∡ p₁ p p₂ = 0 ↔ ∠ p₁ p p₂ = 0 := o.oangle_eq_zero_iff_angle_eq_zero (vsub_ne_zero.2 hp₁) (vsub_ne_zero.2 hp₂) #align euclidean_geometry.oangle_eq_zero_iff_angle_eq_zero EuclideanGeometry.oangle_eq_zero_iff_angle_eq_zero theorem oangle_eq_pi_iff_angle_eq_pi {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = π ↔ ∠ p₁ p₂ p₃ = π := o.oangle_eq_pi_iff_angle_eq_pi #align euclidean_geometry.oangle_eq_pi_iff_angle_eq_pi EuclideanGeometry.oangle_eq_pi_iff_angle_eq_pi theorem angle_eq_pi_div_two_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∠ p₁ p₂ p₃ = π / 2 := by rw [angle, ← InnerProductGeometry.inner_eq_zero_iff_angle_eq_pi_div_two] exact o.inner_eq_zero_of_oangle_eq_pi_div_two h #align euclidean_geometry.angle_eq_pi_div_two_of_oangle_eq_pi_div_two EuclideanGeometry.angle_eq_pi_div_two_of_oangle_eq_pi_div_two theorem angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∠ p₃ p₂ p₁ = π / 2 := by rw [angle_comm] exact angle_eq_pi_div_two_of_oangle_eq_pi_div_two h #align euclidean_geometry.angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two EuclideanGeometry.angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two theorem angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(-π / 2)) : ∠ p₁ p₂ p₃ = π / 2 := by rw [angle, ← InnerProductGeometry.inner_eq_zero_iff_angle_eq_pi_div_two] exact o.inner_eq_zero_of_oangle_eq_neg_pi_div_two h #align euclidean_geometry.angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two EuclideanGeometry.angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two theorem angle_rev_eq_pi_div_two_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(-π / 2)) : ∠ p₃ p₂ p₁ = π / 2 := by rw [angle_comm] exact angle_eq_pi_div_two_of_oangle_eq_neg_pi_div_two h #align euclidean_geometry.angle_rev_eq_pi_div_two_of_oangle_eq_neg_pi_div_two EuclideanGeometry.angle_rev_eq_pi_div_two_of_oangle_eq_neg_pi_div_two theorem oangle_swap₁₂_sign (p₁ p₂ p₃ : P) : -(∡ p₁ p₂ p₃).sign = (∡ p₂ p₁ p₃).sign := by rw [eq_comm, oangle, oangle, ← o.oangle_neg_neg, neg_vsub_eq_vsub_rev, neg_vsub_eq_vsub_rev, ← vsub_sub_vsub_cancel_left p₁ p₃ p₂, ← neg_vsub_eq_vsub_rev p₃ p₂, sub_eq_add_neg, neg_vsub_eq_vsub_rev p₂ p₁, add_comm, ← @neg_one_smul ℝ] nth_rw 2 [← one_smul ℝ (p₁ -ᵥ p₂)] rw [o.oangle_sign_smul_add_smul_right] simp #align euclidean_geometry.oangle_swap₁₂_sign EuclideanGeometry.oangle_swap₁₂_sign theorem oangle_swap₁₃_sign (p₁ p₂ p₃ : P) : -(∡ p₁ p₂ p₃).sign = (∡ p₃ p₂ p₁).sign := by rw [oangle_rev, Real.Angle.sign_neg, neg_neg] #align euclidean_geometry.oangle_swap₁₃_sign EuclideanGeometry.oangle_swap₁₃_sign theorem oangle_swap₂₃_sign (p₁ p₂ p₃ : P) : -(∡ p₁ p₂ p₃).sign = (∡ p₁ p₃ p₂).sign := by rw [oangle_swap₁₃_sign, ← oangle_swap₁₂_sign, oangle_swap₁₃_sign] #align euclidean_geometry.oangle_swap₂₃_sign EuclideanGeometry.oangle_swap₂₃_sign theorem oangle_rotate_sign (p₁ p₂ p₃ : P) : (∡ p₂ p₃ p₁).sign = (∡ p₁ p₂ p₃).sign := by rw [← oangle_swap₁₂_sign, oangle_swap₁₃_sign] #align euclidean_geometry.oangle_rotate_sign EuclideanGeometry.oangle_rotate_sign theorem oangle_eq_pi_iff_sbtw {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = π ↔ Sbtw ℝ p₁ p₂ p₃ := by rw [oangle_eq_pi_iff_angle_eq_pi, angle_eq_pi_iff_sbtw] #align euclidean_geometry.oangle_eq_pi_iff_sbtw EuclideanGeometry.oangle_eq_pi_iff_sbtw theorem _root_.Sbtw.oangle₁₂₃_eq_pi {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₁ p₂ p₃ = π := oangle_eq_pi_iff_sbtw.2 h #align sbtw.oangle₁₂₃_eq_pi Sbtw.oangle₁₂₃_eq_pi theorem _root_.Sbtw.oangle₃₂₁_eq_pi {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₃ p₂ p₁ = π := by rw [oangle_eq_pi_iff_oangle_rev_eq_pi, ← h.oangle₁₂₃_eq_pi] #align sbtw.oangle₃₂₁_eq_pi Sbtw.oangle₃₂₁_eq_pi theorem _root_.Wbtw.oangle₂₁₃_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₁ p₃ = 0 := by by_cases hp₂p₁ : p₂ = p₁; · simp [hp₂p₁] by_cases hp₃p₁ : p₃ = p₁; · simp [hp₃p₁] rw [oangle_eq_zero_iff_angle_eq_zero hp₂p₁ hp₃p₁] exact h.angle₂₁₃_eq_zero_of_ne hp₂p₁ #align wbtw.oangle₂₁₃_eq_zero Wbtw.oangle₂₁₃_eq_zero theorem _root_.Sbtw.oangle₂₁₃_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₁ p₃ = 0 := h.wbtw.oangle₂₁₃_eq_zero #align sbtw.oangle₂₁₃_eq_zero Sbtw.oangle₂₁₃_eq_zero theorem _root_.Wbtw.oangle₃₁₂_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₃ p₁ p₂ = 0 := by rw [oangle_eq_zero_iff_oangle_rev_eq_zero, h.oangle₂₁₃_eq_zero] #align wbtw.oangle₃₁₂_eq_zero Wbtw.oangle₃₁₂_eq_zero theorem _root_.Sbtw.oangle₃₁₂_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₃ p₁ p₂ = 0 := h.wbtw.oangle₃₁₂_eq_zero #align sbtw.oangle₃₁₂_eq_zero Sbtw.oangle₃₁₂_eq_zero theorem _root_.Wbtw.oangle₂₃₁_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₃ p₁ = 0 := h.symm.oangle₂₁₃_eq_zero #align wbtw.oangle₂₃₁_eq_zero Wbtw.oangle₂₃₁_eq_zero theorem _root_.Sbtw.oangle₂₃₁_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₂ p₃ p₁ = 0 := h.wbtw.oangle₂₃₁_eq_zero #align sbtw.oangle₂₃₁_eq_zero Sbtw.oangle₂₃₁_eq_zero theorem _root_.Wbtw.oangle₁₃₂_eq_zero {p₁ p₂ p₃ : P} (h : Wbtw ℝ p₁ p₂ p₃) : ∡ p₁ p₃ p₂ = 0 := h.symm.oangle₃₁₂_eq_zero #align wbtw.oangle₁₃₂_eq_zero Wbtw.oangle₁₃₂_eq_zero theorem _root_.Sbtw.oangle₁₃₂_eq_zero {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∡ p₁ p₃ p₂ = 0 := h.wbtw.oangle₁₃₂_eq_zero #align sbtw.oangle₁₃₂_eq_zero Sbtw.oangle₁₃₂_eq_zero theorem oangle_eq_zero_iff_wbtw {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ↔ Wbtw ℝ p₂ p₁ p₃ ∨ Wbtw ℝ p₂ p₃ p₁ := by by_cases hp₁p₂ : p₁ = p₂; · simp [hp₁p₂] by_cases hp₃p₂ : p₃ = p₂; · simp [hp₃p₂] rw [oangle_eq_zero_iff_angle_eq_zero hp₁p₂ hp₃p₂, angle_eq_zero_iff_ne_and_wbtw] simp [hp₁p₂, hp₃p₂] #align euclidean_geometry.oangle_eq_zero_iff_wbtw EuclideanGeometry.oangle_eq_zero_iff_wbtw theorem _root_.Wbtw.oangle_eq_left {p₁ p₁' p₂ p₃ : P} (h : Wbtw ℝ p₂ p₁ p₁') (hp₁p₂ : p₁ ≠ p₂) : ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ := by by_cases hp₃p₂ : p₃ = p₂; · simp [hp₃p₂] by_cases hp₁'p₂ : p₁' = p₂; · rw [hp₁'p₂, wbtw_self_iff] at h; exact False.elim (hp₁p₂ h) rw [← oangle_add hp₁'p₂ hp₁p₂ hp₃p₂, h.oangle₃₁₂_eq_zero, zero_add] #align wbtw.oangle_eq_left Wbtw.oangle_eq_left theorem _root_.Sbtw.oangle_eq_left {p₁ p₁' p₂ p₃ : P} (h : Sbtw ℝ p₂ p₁ p₁') : ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ := h.wbtw.oangle_eq_left h.ne_left #align sbtw.oangle_eq_left Sbtw.oangle_eq_left theorem _root_.Wbtw.oangle_eq_right {p₁ p₂ p₃ p₃' : P} (h : Wbtw ℝ p₂ p₃ p₃') (hp₃p₂ : p₃ ≠ p₂) : ∡ p₁ p₂ p₃ = ∡ p₁ p₂ p₃' := by rw [oangle_rev, h.oangle_eq_left hp₃p₂, ← oangle_rev] #align wbtw.oangle_eq_right Wbtw.oangle_eq_right theorem _root_.Sbtw.oangle_eq_right {p₁ p₂ p₃ p₃' : P} (h : Sbtw ℝ p₂ p₃ p₃') : ∡ p₁ p₂ p₃ = ∡ p₁ p₂ p₃' := h.wbtw.oangle_eq_right h.ne_left #align sbtw.oangle_eq_right Sbtw.oangle_eq_right @[simp] theorem oangle_midpoint_left (p₁ p₂ p₃ : P) : ∡ (midpoint ℝ p₁ p₂) p₂ p₃ = ∡ p₁ p₂ p₃ := by by_cases h : p₁ = p₂; · simp [h] exact (sbtw_midpoint_of_ne ℝ h).symm.oangle_eq_left #align euclidean_geometry.oangle_midpoint_left EuclideanGeometry.oangle_midpoint_left @[simp] theorem oangle_midpoint_rev_left (p₁ p₂ p₃ : P) : ∡ (midpoint ℝ p₂ p₁) p₂ p₃ = ∡ p₁ p₂ p₃ := by rw [midpoint_comm, oangle_midpoint_left] #align euclidean_geometry.oangle_midpoint_rev_left EuclideanGeometry.oangle_midpoint_rev_left @[simp] theorem oangle_midpoint_right (p₁ p₂ p₃ : P) : ∡ p₁ p₂ (midpoint ℝ p₃ p₂) = ∡ p₁ p₂ p₃ := by by_cases h : p₃ = p₂; · simp [h] exact (sbtw_midpoint_of_ne ℝ h).symm.oangle_eq_right #align euclidean_geometry.oangle_midpoint_right EuclideanGeometry.oangle_midpoint_right @[simp] theorem oangle_midpoint_rev_right (p₁ p₂ p₃ : P) : ∡ p₁ p₂ (midpoint ℝ p₂ p₃) = ∡ p₁ p₂ p₃ := by rw [midpoint_comm, oangle_midpoint_right] #align euclidean_geometry.oangle_midpoint_rev_right EuclideanGeometry.oangle_midpoint_rev_right
Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean
614
617
theorem _root_.Sbtw.oangle_eq_add_pi_left {p₁ p₁' p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₁') (hp₃p₂ : p₃ ≠ p₂) : ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ + π := by
rw [← h.oangle₁₂₃_eq_pi, oangle_add_swap h.left_ne h.right_ne hp₃p₂]
import Mathlib.Analysis.Calculus.FDeriv.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace #align_import analysis.calculus.deriv.basic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open scoped Classical Topology Filter ENNReal NNReal open Filter Asymptotics Set open ContinuousLinearMap (smulRight smulRight_one_eq_iff) variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] def HasDerivAtFilter (f : 𝕜 → F) (f' : F) (x : 𝕜) (L : Filter 𝕜) := HasFDerivAtFilter f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') x L #align has_deriv_at_filter HasDerivAtFilter def HasDerivWithinAt (f : 𝕜 → F) (f' : F) (s : Set 𝕜) (x : 𝕜) := HasDerivAtFilter f f' x (𝓝[s] x) #align has_deriv_within_at HasDerivWithinAt def HasDerivAt (f : 𝕜 → F) (f' : F) (x : 𝕜) := HasDerivAtFilter f f' x (𝓝 x) #align has_deriv_at HasDerivAt def HasStrictDerivAt (f : 𝕜 → F) (f' : F) (x : 𝕜) := HasStrictFDerivAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') x #align has_strict_deriv_at HasStrictDerivAt def derivWithin (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) := fderivWithin 𝕜 f s x 1 #align deriv_within derivWithin def deriv (f : 𝕜 → F) (x : 𝕜) := fderiv 𝕜 f x 1 #align deriv deriv variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} theorem hasFDerivAtFilter_iff_hasDerivAtFilter {f' : 𝕜 →L[𝕜] F} : HasFDerivAtFilter f f' x L ↔ HasDerivAtFilter f (f' 1) x L := by simp [HasDerivAtFilter] #align has_fderiv_at_filter_iff_has_deriv_at_filter hasFDerivAtFilter_iff_hasDerivAtFilter theorem HasFDerivAtFilter.hasDerivAtFilter {f' : 𝕜 →L[𝕜] F} : HasFDerivAtFilter f f' x L → HasDerivAtFilter f (f' 1) x L := hasFDerivAtFilter_iff_hasDerivAtFilter.mp #align has_fderiv_at_filter.has_deriv_at_filter HasFDerivAtFilter.hasDerivAtFilter theorem hasFDerivWithinAt_iff_hasDerivWithinAt {f' : 𝕜 →L[𝕜] F} : HasFDerivWithinAt f f' s x ↔ HasDerivWithinAt f (f' 1) s x := hasFDerivAtFilter_iff_hasDerivAtFilter #align has_fderiv_within_at_iff_has_deriv_within_at hasFDerivWithinAt_iff_hasDerivWithinAt theorem hasDerivWithinAt_iff_hasFDerivWithinAt {f' : F} : HasDerivWithinAt f f' s x ↔ HasFDerivWithinAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') s x := Iff.rfl #align has_deriv_within_at_iff_has_fderiv_within_at hasDerivWithinAt_iff_hasFDerivWithinAt theorem HasFDerivWithinAt.hasDerivWithinAt {f' : 𝕜 →L[𝕜] F} : HasFDerivWithinAt f f' s x → HasDerivWithinAt f (f' 1) s x := hasFDerivWithinAt_iff_hasDerivWithinAt.mp #align has_fderiv_within_at.has_deriv_within_at HasFDerivWithinAt.hasDerivWithinAt theorem HasDerivWithinAt.hasFDerivWithinAt {f' : F} : HasDerivWithinAt f f' s x → HasFDerivWithinAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') s x := hasDerivWithinAt_iff_hasFDerivWithinAt.mp #align has_deriv_within_at.has_fderiv_within_at HasDerivWithinAt.hasFDerivWithinAt theorem hasFDerivAt_iff_hasDerivAt {f' : 𝕜 →L[𝕜] F} : HasFDerivAt f f' x ↔ HasDerivAt f (f' 1) x := hasFDerivAtFilter_iff_hasDerivAtFilter #align has_fderiv_at_iff_has_deriv_at hasFDerivAt_iff_hasDerivAt theorem HasFDerivAt.hasDerivAt {f' : 𝕜 →L[𝕜] F} : HasFDerivAt f f' x → HasDerivAt f (f' 1) x := hasFDerivAt_iff_hasDerivAt.mp #align has_fderiv_at.has_deriv_at HasFDerivAt.hasDerivAt theorem hasStrictFDerivAt_iff_hasStrictDerivAt {f' : 𝕜 →L[𝕜] F} : HasStrictFDerivAt f f' x ↔ HasStrictDerivAt f (f' 1) x := by simp [HasStrictDerivAt, HasStrictFDerivAt] #align has_strict_fderiv_at_iff_has_strict_deriv_at hasStrictFDerivAt_iff_hasStrictDerivAt protected theorem HasStrictFDerivAt.hasStrictDerivAt {f' : 𝕜 →L[𝕜] F} : HasStrictFDerivAt f f' x → HasStrictDerivAt f (f' 1) x := hasStrictFDerivAt_iff_hasStrictDerivAt.mp #align has_strict_fderiv_at.has_strict_deriv_at HasStrictFDerivAt.hasStrictDerivAt theorem hasStrictDerivAt_iff_hasStrictFDerivAt : HasStrictDerivAt f f' x ↔ HasStrictFDerivAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') x := Iff.rfl #align has_strict_deriv_at_iff_has_strict_fderiv_at hasStrictDerivAt_iff_hasStrictFDerivAt alias ⟨HasStrictDerivAt.hasStrictFDerivAt, _⟩ := hasStrictDerivAt_iff_hasStrictFDerivAt #align has_strict_deriv_at.has_strict_fderiv_at HasStrictDerivAt.hasStrictFDerivAt theorem hasDerivAt_iff_hasFDerivAt {f' : F} : HasDerivAt f f' x ↔ HasFDerivAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') x := Iff.rfl #align has_deriv_at_iff_has_fderiv_at hasDerivAt_iff_hasFDerivAt alias ⟨HasDerivAt.hasFDerivAt, _⟩ := hasDerivAt_iff_hasFDerivAt #align has_deriv_at.has_fderiv_at HasDerivAt.hasFDerivAt theorem derivWithin_zero_of_not_differentiableWithinAt (h : ¬DifferentiableWithinAt 𝕜 f s x) : derivWithin f s x = 0 := by unfold derivWithin rw [fderivWithin_zero_of_not_differentiableWithinAt h] simp #align deriv_within_zero_of_not_differentiable_within_at derivWithin_zero_of_not_differentiableWithinAt theorem derivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : derivWithin f s x = 0 := by rw [derivWithin, fderivWithin_zero_of_isolated h, ContinuousLinearMap.zero_apply] theorem derivWithin_zero_of_nmem_closure (h : x ∉ closure s) : derivWithin f s x = 0 := by rw [derivWithin, fderivWithin_zero_of_nmem_closure h, ContinuousLinearMap.zero_apply] theorem differentiableWithinAt_of_derivWithin_ne_zero (h : derivWithin f s x ≠ 0) : DifferentiableWithinAt 𝕜 f s x := not_imp_comm.1 derivWithin_zero_of_not_differentiableWithinAt h #align differentiable_within_at_of_deriv_within_ne_zero differentiableWithinAt_of_derivWithin_ne_zero
Mathlib/Analysis/Calculus/Deriv/Basic.lean
246
249
theorem deriv_zero_of_not_differentiableAt (h : ¬DifferentiableAt 𝕜 f x) : deriv f x = 0 := by
unfold deriv rw [fderiv_zero_of_not_differentiableAt h] simp
import Mathlib.Geometry.Euclidean.Angle.Oriented.Affine import Mathlib.Geometry.Euclidean.Angle.Unoriented.RightAngle #align_import geometry.euclidean.angle.oriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped EuclideanGeometry open scoped Real open scoped RealInnerProductSpace namespace EuclideanGeometry open FiniteDimensional variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)] theorem oangle_right_eq_arccos_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∡ p₂ p₃ p₁ = Real.arccos (dist p₃ p₂ / dist p₁ p₃) := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_eq_arccos_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.oangle_right_eq_arccos_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_right_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_left_eq_arccos_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∡ p₃ p₁ p₂ = Real.arccos (dist p₁ p₂ / dist p₁ p₃) := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, angle_eq_arccos_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h), dist_comm p₁ p₃] #align euclidean_geometry.oangle_left_eq_arccos_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_left_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_right_eq_arcsin_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∡ p₂ p₃ p₁ = Real.arcsin (dist p₁ p₂ / dist p₁ p₃) := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_eq_arcsin_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inl (left_ne_of_oangle_eq_pi_div_two h))] #align euclidean_geometry.oangle_right_eq_arcsin_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_right_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_left_eq_arcsin_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∡ p₃ p₁ p₂ = Real.arcsin (dist p₃ p₂ / dist p₁ p₃) := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, angle_eq_arcsin_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inr (left_ne_of_oangle_eq_pi_div_two h)), dist_comm p₁ p₃] #align euclidean_geometry.oangle_left_eq_arcsin_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_left_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_right_eq_arctan_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∡ p₂ p₃ p₁ = Real.arctan (dist p₁ p₂ / dist p₃ p₂) := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_eq_arctan_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h) (right_ne_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.oangle_right_eq_arctan_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_right_eq_arctan_of_oangle_eq_pi_div_two theorem oangle_left_eq_arctan_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : ∡ p₃ p₁ p₂ = Real.arctan (dist p₃ p₂ / dist p₁ p₂) := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, angle_eq_arctan_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h) (left_ne_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.oangle_left_eq_arctan_of_oangle_eq_pi_div_two EuclideanGeometry.oangle_left_eq_arctan_of_oangle_eq_pi_div_two theorem cos_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.cos (∡ p₂ p₃ p₁) = dist p₃ p₂ / dist p₁ p₃ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, cos_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.cos_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_right_of_oangle_eq_pi_div_two theorem cos_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.cos (∡ p₃ p₁ p₂) = dist p₁ p₂ / dist p₁ p₃ := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.cos_coe, cos_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h), dist_comm p₁ p₃] #align euclidean_geometry.cos_oangle_left_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_left_of_oangle_eq_pi_div_two theorem sin_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.sin (∡ p₂ p₃ p₁) = dist p₁ p₂ / dist p₁ p₃ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe, sin_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inl (left_ne_of_oangle_eq_pi_div_two h))] #align euclidean_geometry.sin_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.sin_oangle_right_of_oangle_eq_pi_div_two theorem sin_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.sin (∡ p₃ p₁ p₂) = dist p₃ p₂ / dist p₁ p₃ := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.sin_coe, sin_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inr (left_ne_of_oangle_eq_pi_div_two h)), dist_comm p₁ p₃] #align euclidean_geometry.sin_oangle_left_of_oangle_eq_pi_div_two EuclideanGeometry.sin_oangle_left_of_oangle_eq_pi_div_two theorem tan_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.tan (∡ p₂ p₃ p₁) = dist p₁ p₂ / dist p₃ p₂ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.tan_coe, tan_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.tan_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.tan_oangle_right_of_oangle_eq_pi_div_two theorem tan_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.tan (∡ p₃ p₁ p₂) = dist p₃ p₂ / dist p₁ p₂ := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.tan_coe, tan_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.tan_oangle_left_of_oangle_eq_pi_div_two EuclideanGeometry.tan_oangle_left_of_oangle_eq_pi_div_two theorem cos_oangle_right_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.cos (∡ p₂ p₃ p₁) * dist p₁ p₃ = dist p₃ p₂ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, cos_angle_mul_dist_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.cos_oangle_right_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_right_mul_dist_of_oangle_eq_pi_div_two theorem cos_oangle_left_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.cos (∡ p₃ p₁ p₂) * dist p₁ p₃ = dist p₁ p₂ := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.cos_coe, dist_comm p₁ p₃, cos_angle_mul_dist_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.cos_oangle_left_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.cos_oangle_left_mul_dist_of_oangle_eq_pi_div_two theorem sin_oangle_right_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.sin (∡ p₂ p₃ p₁) * dist p₁ p₃ = dist p₁ p₂ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe, sin_angle_mul_dist_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.sin_oangle_right_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.sin_oangle_right_mul_dist_of_oangle_eq_pi_div_two theorem sin_oangle_left_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.sin (∡ p₃ p₁ p₂) * dist p₁ p₃ = dist p₃ p₂ := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.sin_coe, dist_comm p₁ p₃, sin_angle_mul_dist_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h)] #align euclidean_geometry.sin_oangle_left_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.sin_oangle_left_mul_dist_of_oangle_eq_pi_div_two theorem tan_oangle_right_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.tan (∡ p₂ p₃ p₁) * dist p₃ p₂ = dist p₁ p₂ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.tan_coe, tan_angle_mul_dist_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inr (right_ne_of_oangle_eq_pi_div_two h))] #align euclidean_geometry.tan_oangle_right_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.tan_oangle_right_mul_dist_of_oangle_eq_pi_div_two theorem tan_oangle_left_mul_dist_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : Real.Angle.tan (∡ p₃ p₁ p₂) * dist p₁ p₂ = dist p₃ p₂ := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.tan_coe, tan_angle_mul_dist_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inr (left_ne_of_oangle_eq_pi_div_two h))] #align euclidean_geometry.tan_oangle_left_mul_dist_of_oangle_eq_pi_div_two EuclideanGeometry.tan_oangle_left_mul_dist_of_oangle_eq_pi_div_two theorem dist_div_cos_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : dist p₃ p₂ / Real.Angle.cos (∡ p₂ p₃ p₁) = dist p₁ p₃ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, dist_div_cos_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inr (right_ne_of_oangle_eq_pi_div_two h))] #align euclidean_geometry.dist_div_cos_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.dist_div_cos_oangle_right_of_oangle_eq_pi_div_two theorem dist_div_cos_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : dist p₁ p₂ / Real.Angle.cos (∡ p₃ p₁ p₂) = dist p₁ p₃ := by have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.cos_coe, dist_comm p₁ p₃, dist_div_cos_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inr (left_ne_of_oangle_eq_pi_div_two h))] #align euclidean_geometry.dist_div_cos_oangle_left_of_oangle_eq_pi_div_two EuclideanGeometry.dist_div_cos_oangle_left_of_oangle_eq_pi_div_two theorem dist_div_sin_oangle_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : dist p₁ p₂ / Real.Angle.sin (∡ p₂ p₃ p₁) = dist p₁ p₃ := by have hs : (∡ p₂ p₃ p₁).sign = 1 := by rw [oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe, dist_div_sin_angle_of_angle_eq_pi_div_two (angle_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inl (left_ne_of_oangle_eq_pi_div_two h))] #align euclidean_geometry.dist_div_sin_oangle_right_of_oangle_eq_pi_div_two EuclideanGeometry.dist_div_sin_oangle_right_of_oangle_eq_pi_div_two
Mathlib/Geometry/Euclidean/Angle/Oriented/RightAngle.lean
777
782
theorem dist_div_sin_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : dist p₃ p₂ / Real.Angle.sin (∡ p₃ p₁ p₂) = dist p₁ p₃ := by
have hs : (∡ p₃ p₁ p₂).sign = 1 := by rw [← oangle_rotate_sign, h, Real.Angle.sign_coe_pi_div_two] rw [oangle_eq_angle_of_sign_eq_one hs, angle_comm, Real.Angle.sin_coe, dist_comm p₁ p₃, dist_div_sin_angle_of_angle_eq_pi_div_two (angle_rev_eq_pi_div_two_of_oangle_eq_pi_div_two h) (Or.inl (right_ne_of_oangle_eq_pi_div_two h))]
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Finset.Sort import Mathlib.Data.Set.Subsingleton #align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open List variable {n : ℕ} @[ext] structure Composition (n : ℕ) where blocks : List ℕ blocks_pos : ∀ {i}, i ∈ blocks → 0 < i blocks_sum : blocks.sum = n #align composition Composition @[ext] structure CompositionAsSet (n : ℕ) where boundaries : Finset (Fin n.succ) zero_mem : (0 : Fin n.succ) ∈ boundaries getLast_mem : Fin.last n ∈ boundaries #align composition_as_set CompositionAsSet instance {n : ℕ} : Inhabited (CompositionAsSet n) := ⟨⟨Finset.univ, Finset.mem_univ _, Finset.mem_univ _⟩⟩ namespace Composition variable (c : Composition n) instance (n : ℕ) : ToString (Composition n) := ⟨fun c => toString c.blocks⟩ abbrev length : ℕ := c.blocks.length #align composition.length Composition.length theorem blocks_length : c.blocks.length = c.length := rfl #align composition.blocks_length Composition.blocks_length def blocksFun : Fin c.length → ℕ := c.blocks.get #align composition.blocks_fun Composition.blocksFun theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks := ofFn_get _ #align composition.of_fn_blocks_fun Composition.ofFn_blocksFun theorem sum_blocksFun : ∑ i, c.blocksFun i = n := by conv_rhs => rw [← c.blocks_sum, ← ofFn_blocksFun, sum_ofFn] #align composition.sum_blocks_fun Composition.sum_blocksFun theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i ∈ c.blocks := get_mem _ _ _ #align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks @[simp] theorem one_le_blocks {i : ℕ} (h : i ∈ c.blocks) : 1 ≤ i := c.blocks_pos h #align composition.one_le_blocks Composition.one_le_blocks @[simp] theorem one_le_blocks' {i : ℕ} (h : i < c.length) : 1 ≤ c.blocks.get ⟨i, h⟩ := c.one_le_blocks (get_mem (blocks c) i h) #align composition.one_le_blocks' Composition.one_le_blocks' @[simp] theorem blocks_pos' (i : ℕ) (h : i < c.length) : 0 < c.blocks.get ⟨i, h⟩ := c.one_le_blocks' h #align composition.blocks_pos' Composition.blocks_pos' theorem one_le_blocksFun (i : Fin c.length) : 1 ≤ c.blocksFun i := c.one_le_blocks (c.blocksFun_mem_blocks i) #align composition.one_le_blocks_fun Composition.one_le_blocksFun theorem length_le : c.length ≤ n := by conv_rhs => rw [← c.blocks_sum] exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi #align composition.length_le Composition.length_le theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by apply length_pos_of_sum_pos convert h exact c.blocks_sum #align composition.length_pos_of_pos Composition.length_pos_of_pos def sizeUpTo (i : ℕ) : ℕ := (c.blocks.take i).sum #align composition.size_up_to Composition.sizeUpTo @[simp] theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo] #align composition.size_up_to_zero Composition.sizeUpTo_zero theorem sizeUpTo_ofLength_le (i : ℕ) (h : c.length ≤ i) : c.sizeUpTo i = n := by dsimp [sizeUpTo] convert c.blocks_sum exact take_all_of_le h #align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le @[simp] theorem sizeUpTo_length : c.sizeUpTo c.length = n := c.sizeUpTo_ofLength_le c.length le_rfl #align composition.size_up_to_length Composition.sizeUpTo_length theorem sizeUpTo_le (i : ℕ) : c.sizeUpTo i ≤ n := by conv_rhs => rw [← c.blocks_sum, ← sum_take_add_sum_drop _ i] exact Nat.le_add_right _ _ #align composition.size_up_to_le Composition.sizeUpTo_le theorem sizeUpTo_succ {i : ℕ} (h : i < c.length) : c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get ⟨i, h⟩ := by simp only [sizeUpTo] rw [sum_take_succ _ _ h] #align composition.size_up_to_succ Composition.sizeUpTo_succ theorem sizeUpTo_succ' (i : Fin c.length) : c.sizeUpTo ((i : ℕ) + 1) = c.sizeUpTo i + c.blocksFun i := c.sizeUpTo_succ i.2 #align composition.size_up_to_succ' Composition.sizeUpTo_succ' theorem sizeUpTo_strict_mono {i : ℕ} (h : i < c.length) : c.sizeUpTo i < c.sizeUpTo (i + 1) := by rw [c.sizeUpTo_succ h] simp #align composition.size_up_to_strict_mono Composition.sizeUpTo_strict_mono theorem monotone_sizeUpTo : Monotone c.sizeUpTo := monotone_sum_take _ #align composition.monotone_size_up_to Composition.monotone_sizeUpTo def boundary : Fin (c.length + 1) ↪o Fin (n + 1) := (OrderEmbedding.ofStrictMono fun i => ⟨c.sizeUpTo i, Nat.lt_succ_of_le (c.sizeUpTo_le i)⟩) <| Fin.strictMono_iff_lt_succ.2 fun ⟨_, hi⟩ => c.sizeUpTo_strict_mono hi #align composition.boundary Composition.boundary @[simp] theorem boundary_zero : c.boundary 0 = 0 := by simp [boundary, Fin.ext_iff] #align composition.boundary_zero Composition.boundary_zero @[simp] theorem boundary_last : c.boundary (Fin.last c.length) = Fin.last n := by simp [boundary, Fin.ext_iff] #align composition.boundary_last Composition.boundary_last def boundaries : Finset (Fin (n + 1)) := Finset.univ.map c.boundary.toEmbedding #align composition.boundaries Composition.boundaries theorem card_boundaries_eq_succ_length : c.boundaries.card = c.length + 1 := by simp [boundaries] #align composition.card_boundaries_eq_succ_length Composition.card_boundaries_eq_succ_length def toCompositionAsSet : CompositionAsSet n where boundaries := c.boundaries zero_mem := by simp only [boundaries, Finset.mem_univ, exists_prop_of_true, Finset.mem_map] exact ⟨0, And.intro True.intro rfl⟩ getLast_mem := by simp only [boundaries, Finset.mem_univ, exists_prop_of_true, Finset.mem_map] exact ⟨Fin.last c.length, And.intro True.intro c.boundary_last⟩ #align composition.to_composition_as_set Composition.toCompositionAsSet theorem orderEmbOfFin_boundaries : c.boundaries.orderEmbOfFin c.card_boundaries_eq_succ_length = c.boundary := by refine (Finset.orderEmbOfFin_unique' _ ?_).symm exact fun i => (Finset.mem_map' _).2 (Finset.mem_univ _) #align composition.order_emb_of_fin_boundaries Composition.orderEmbOfFin_boundaries def embedding (i : Fin c.length) : Fin (c.blocksFun i) ↪o Fin n := (Fin.natAddOrderEmb <| c.sizeUpTo i).trans <| Fin.castLEOrderEmb <| calc c.sizeUpTo i + c.blocksFun i = c.sizeUpTo (i + 1) := (c.sizeUpTo_succ _).symm _ ≤ c.sizeUpTo c.length := monotone_sum_take _ i.2 _ = n := c.sizeUpTo_length #align composition.embedding Composition.embedding @[simp] theorem coe_embedding (i : Fin c.length) (j : Fin (c.blocksFun i)) : (c.embedding i j : ℕ) = c.sizeUpTo i + j := rfl #align composition.coe_embedding Composition.coe_embedding theorem index_exists {j : ℕ} (h : j < n) : ∃ i : ℕ, j < c.sizeUpTo (i + 1) ∧ i < c.length := by have n_pos : 0 < n := lt_of_le_of_lt (zero_le j) h have : 0 < c.blocks.sum := by rwa [← c.blocks_sum] at n_pos have length_pos : 0 < c.blocks.length := length_pos_of_sum_pos (blocks c) this refine ⟨c.length - 1, ?_, Nat.pred_lt (ne_of_gt length_pos)⟩ have : c.length - 1 + 1 = c.length := Nat.succ_pred_eq_of_pos length_pos simp [this, h] #align composition.index_exists Composition.index_exists def index (j : Fin n) : Fin c.length := ⟨Nat.find (c.index_exists j.2), (Nat.find_spec (c.index_exists j.2)).2⟩ #align composition.index Composition.index theorem lt_sizeUpTo_index_succ (j : Fin n) : (j : ℕ) < c.sizeUpTo (c.index j).succ := (Nat.find_spec (c.index_exists j.2)).1 #align composition.lt_size_up_to_index_succ Composition.lt_sizeUpTo_index_succ theorem sizeUpTo_index_le (j : Fin n) : c.sizeUpTo (c.index j) ≤ j := by by_contra H set i := c.index j push_neg at H have i_pos : (0 : ℕ) < i := by by_contra! i_pos revert H simp [nonpos_iff_eq_zero.1 i_pos, c.sizeUpTo_zero] let i₁ := (i : ℕ).pred have i₁_lt_i : i₁ < i := Nat.pred_lt (ne_of_gt i_pos) have i₁_succ : i₁ + 1 = i := Nat.succ_pred_eq_of_pos i_pos have := Nat.find_min (c.index_exists j.2) i₁_lt_i simp [lt_trans i₁_lt_i (c.index j).2, i₁_succ] at this exact Nat.lt_le_asymm H this #align composition.size_up_to_index_le Composition.sizeUpTo_index_le def invEmbedding (j : Fin n) : Fin (c.blocksFun (c.index j)) := ⟨j - c.sizeUpTo (c.index j), by rw [tsub_lt_iff_right, add_comm, ← sizeUpTo_succ'] · exact lt_sizeUpTo_index_succ _ _ · exact sizeUpTo_index_le _ _⟩ #align composition.inv_embedding Composition.invEmbedding @[simp] theorem coe_invEmbedding (j : Fin n) : (c.invEmbedding j : ℕ) = j - c.sizeUpTo (c.index j) := rfl #align composition.coe_inv_embedding Composition.coe_invEmbedding theorem embedding_comp_inv (j : Fin n) : c.embedding (c.index j) (c.invEmbedding j) = j := by rw [Fin.ext_iff] apply add_tsub_cancel_of_le (c.sizeUpTo_index_le j) #align composition.embedding_comp_inv Composition.embedding_comp_inv theorem mem_range_embedding_iff {j : Fin n} {i : Fin c.length} : j ∈ Set.range (c.embedding i) ↔ c.sizeUpTo i ≤ j ∧ (j : ℕ) < c.sizeUpTo (i : ℕ).succ := by constructor · intro h rcases Set.mem_range.2 h with ⟨k, hk⟩ rw [Fin.ext_iff] at hk dsimp at hk rw [← hk] simp [sizeUpTo_succ', k.is_lt] · intro h apply Set.mem_range.2 refine ⟨⟨j - c.sizeUpTo i, ?_⟩, ?_⟩ · rw [tsub_lt_iff_left, ← sizeUpTo_succ'] · exact h.2 · exact h.1 · rw [Fin.ext_iff] exact add_tsub_cancel_of_le h.1 #align composition.mem_range_embedding_iff Composition.mem_range_embedding_iff theorem disjoint_range {i₁ i₂ : Fin c.length} (h : i₁ ≠ i₂) : Disjoint (Set.range (c.embedding i₁)) (Set.range (c.embedding i₂)) := by classical wlog h' : i₁ < i₂ · exact (this c h.symm (h.lt_or_lt.resolve_left h')).symm by_contra d obtain ⟨x, hx₁, hx₂⟩ : ∃ x : Fin n, x ∈ Set.range (c.embedding i₁) ∧ x ∈ Set.range (c.embedding i₂) := Set.not_disjoint_iff.1 d have A : (i₁ : ℕ).succ ≤ i₂ := Nat.succ_le_of_lt h' apply lt_irrefl (x : ℕ) calc (x : ℕ) < c.sizeUpTo (i₁ : ℕ).succ := (c.mem_range_embedding_iff.1 hx₁).2 _ ≤ c.sizeUpTo (i₂ : ℕ) := monotone_sum_take _ A _ ≤ x := (c.mem_range_embedding_iff.1 hx₂).1 #align composition.disjoint_range Composition.disjoint_range theorem mem_range_embedding (j : Fin n) : j ∈ Set.range (c.embedding (c.index j)) := by have : c.embedding (c.index j) (c.invEmbedding j) ∈ Set.range (c.embedding (c.index j)) := Set.mem_range_self _ rwa [c.embedding_comp_inv j] at this #align composition.mem_range_embedding Composition.mem_range_embedding theorem mem_range_embedding_iff' {j : Fin n} {i : Fin c.length} : j ∈ Set.range (c.embedding i) ↔ i = c.index j := by constructor · rw [← not_imp_not] intro h exact Set.disjoint_right.1 (c.disjoint_range h) (c.mem_range_embedding j) · intro h rw [h] exact c.mem_range_embedding j #align composition.mem_range_embedding_iff' Composition.mem_range_embedding_iff' theorem index_embedding (i : Fin c.length) (j : Fin (c.blocksFun i)) : c.index (c.embedding i j) = i := by symm rw [← mem_range_embedding_iff'] apply Set.mem_range_self #align composition.index_embedding Composition.index_embedding theorem invEmbedding_comp (i : Fin c.length) (j : Fin (c.blocksFun i)) : (c.invEmbedding (c.embedding i j) : ℕ) = j := by simp_rw [coe_invEmbedding, index_embedding, coe_embedding, add_tsub_cancel_left] #align composition.inv_embedding_comp Composition.invEmbedding_comp def blocksFinEquiv : (Σi : Fin c.length, Fin (c.blocksFun i)) ≃ Fin n where toFun x := c.embedding x.1 x.2 invFun j := ⟨c.index j, c.invEmbedding j⟩ left_inv x := by rcases x with ⟨i, y⟩ dsimp congr; · exact c.index_embedding _ _ rw [Fin.heq_ext_iff] · exact c.invEmbedding_comp _ _ · rw [c.index_embedding] right_inv j := c.embedding_comp_inv j #align composition.blocks_fin_equiv Composition.blocksFinEquiv theorem blocksFun_congr {n₁ n₂ : ℕ} (c₁ : Composition n₁) (c₂ : Composition n₂) (i₁ : Fin c₁.length) (i₂ : Fin c₂.length) (hn : n₁ = n₂) (hc : c₁.blocks = c₂.blocks) (hi : (i₁ : ℕ) = i₂) : c₁.blocksFun i₁ = c₂.blocksFun i₂ := by cases hn rw [← Composition.ext_iff] at hc cases hc congr rwa [Fin.ext_iff] #align composition.blocks_fun_congr Composition.blocksFun_congr theorem sigma_eq_iff_blocks_eq {c : Σn, Composition n} {c' : Σn, Composition n} : c = c' ↔ c.2.blocks = c'.2.blocks := by refine ⟨fun H => by rw [H], fun H => ?_⟩ rcases c with ⟨n, c⟩ rcases c' with ⟨n', c'⟩ have : n = n' := by rw [← c.blocks_sum, ← c'.blocks_sum, H] induction this congr ext1 exact H #align composition.sigma_eq_iff_blocks_eq Composition.sigma_eq_iff_blocks_eq def ones (n : ℕ) : Composition n := ⟨replicate n (1 : ℕ), fun {i} hi => by simp [List.eq_of_mem_replicate hi], by simp⟩ #align composition.ones Composition.ones instance {n : ℕ} : Inhabited (Composition n) := ⟨Composition.ones n⟩ @[simp] theorem ones_length (n : ℕ) : (ones n).length = n := List.length_replicate n 1 #align composition.ones_length Composition.ones_length @[simp] theorem ones_blocks (n : ℕ) : (ones n).blocks = replicate n (1 : ℕ) := rfl #align composition.ones_blocks Composition.ones_blocks @[simp]
Mathlib/Combinatorics/Enumerative/Composition.lean
489
490
theorem ones_blocksFun (n : ℕ) (i : Fin (ones n).length) : (ones n).blocksFun i = 1 := by
simp only [blocksFun, ones, blocks, i.2, List.get_replicate]
import Mathlib.Algebra.Order.Ring.Int import Mathlib.Data.Nat.Cast.Order import Mathlib.Order.UpperLower.Basic open Set namespace Nat @[simp] theorem range_cast_int : range ((↑) : ℕ → ℤ) = Ici 0 := Subset.antisymm (range_subset_iff.2 Int.ofNat_nonneg) CanLift.prf theorem image_cast_int_Icc (a b : ℕ) : (↑) '' Icc a b = Icc (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Icc (by simp [ordConnected_Ici]) a b theorem image_cast_int_Ico (a b : ℕ) : (↑) '' Ico a b = Ico (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Ico (by simp [ordConnected_Ici]) a b theorem image_cast_int_Ioc (a b : ℕ) : (↑) '' Ioc a b = Ioc (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Ioc (by simp [ordConnected_Ici]) a b theorem image_cast_int_Ioo (a b : ℕ) : (↑) '' Ioo a b = Ioo (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Ioo (by simp [ordConnected_Ici]) a b theorem image_cast_int_Iic (a : ℕ) : (↑) '' Iic a = Icc (0 : ℤ) a := by rw [← Icc_bot, image_cast_int_Icc]; rfl
Mathlib/Data/Nat/Cast/SetInterval.lean
40
41
theorem image_cast_int_Iio (a : ℕ) : (↑) '' Iio a = Ico (0 : ℤ) a := by
rw [← Ico_bot, image_cast_int_Ico]; rfl
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Normed.Group.Lemmas import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.NormedSpace.RieszLemma import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Topology.Algebra.Module.FiniteDimension import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.Matrix #align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057" universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology NNReal Metric section CompleteField variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Type v} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type w} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul 𝕜 F'] [CompleteSpace 𝕜] theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E) -- Porting note: this could be easier with `det_cases` by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E) · rcases h with ⟨s, ⟨b⟩⟩ haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b] refine Continuous.matrix_det ?_ exact ((LinearMap.toMatrix b b).toLinearMap.comp (ContinuousLinearMap.coeLM 𝕜)).continuous_of_finiteDimensional · -- Porting note: was `unfold LinearMap.det` rw [LinearMap.det_def] simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const #align continuous_linear_map.continuous_det ContinuousLinearMap.continuous_det irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : ℝ≥0 := let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv max (‖A.symm.toContinuousLinearMap‖₊ * ‖A.toContinuousLinearMap‖₊) 1 #align lipschitz_extension_constant lipschitzExtensionConstant theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : 0 < lipschitzExtensionConstant E' := by rw [lipschitzExtensionConstant] exact zero_lt_one.trans_le (le_max_right _ _) #align lipschitz_extension_constant_pos lipschitzExtensionConstant_pos theorem LipschitzOnWith.extend_finite_dimension {α : Type*} [PseudoMetricSpace α] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] {s : Set α} {f : α → E'} {K : ℝ≥0} (hf : LipschitzOnWith K f s) : ∃ g : α → E', LipschitzWith (lipschitzExtensionConstant E' * K) g ∧ EqOn f g s := by let ι : Type _ := Basis.ofVectorSpaceIndex ℝ E' let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv have LA : LipschitzWith ‖A.toContinuousLinearMap‖₊ A := by apply A.lipschitz have L : LipschitzOnWith (‖A.toContinuousLinearMap‖₊ * K) (A ∘ f) s := LA.comp_lipschitzOnWith hf obtain ⟨g, hg, gs⟩ : ∃ g : α → ι → ℝ, LipschitzWith (‖A.toContinuousLinearMap‖₊ * K) g ∧ EqOn (A ∘ f) g s := L.extend_pi refine ⟨A.symm ∘ g, ?_, ?_⟩ · have LAsymm : LipschitzWith ‖A.symm.toContinuousLinearMap‖₊ A.symm := by apply A.symm.lipschitz apply (LAsymm.comp hg).weaken rw [lipschitzExtensionConstant, ← mul_assoc] exact mul_le_mul' (le_max_left _ _) le_rfl · intro x hx have : A (f x) = g x := gs hx simp only [(· ∘ ·), ← this, A.symm_apply_apply] #align lipschitz_on_with.extend_finite_dimension LipschitzOnWith.extend_finite_dimension
Mathlib/Analysis/NormedSpace/FiniteDimension.lean
223
229
theorem LinearMap.exists_antilipschitzWith [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F) (hf : LinearMap.ker f = ⊥) : ∃ K > 0, AntilipschitzWith K f := by
cases subsingleton_or_nontrivial E · exact ⟨1, zero_lt_one, AntilipschitzWith.of_subsingleton⟩ · rw [LinearMap.ker_eq_bot] at hf let e : E ≃L[𝕜] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv exact ⟨_, e.nnnorm_symm_pos, e.antilipschitz⟩
import Mathlib.Topology.MetricSpace.PseudoMetric #align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Bornology open scoped NNReal Uniformity universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y #align metric_space MetricSpace @[ext] theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) : m = m' := by cases m; cases m'; congr; ext1; assumption #align metric_space.ext MetricSpace.ext def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) (eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α := { PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ } #align metric_space.of_dist_topology MetricSpace.ofDistTopology variable {γ : Type w} [MetricSpace γ] theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y := MetricSpace.eq_of_dist_eq_zero #align eq_of_dist_eq_zero eq_of_dist_eq_zero @[simp] theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y := Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _ #align dist_eq_zero dist_eq_zero @[simp] theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero] #align zero_eq_dist zero_eq_dist
Mathlib/Topology/MetricSpace/Basic.lean
77
78
theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by
simpa only [not_iff_not] using dist_eq_zero
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one] #align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
Mathlib/FieldTheory/Finite/Basic.lean
115
139
theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K] (G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by
let n := Fintype.card G intro nzero have ⟨p, char_p⟩ := CharP.exists K have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero cases CharP.char_is_prime_or_zero K p with | inr pzero => exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd | inl pprime => have fact_pprime := Fact.mk pprime -- G has an element x of order p by Cauchy's theorem have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd -- F has an element u (= ↑↑x) of order p let u := ((x : Kˣ) : K) have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe] -- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ... have h : u = 1 := by rw [← sub_left_inj, sub_self 1] apply pow_eq_zero (n := p) rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self] exact Commute.one_right u -- ... meaning x didn't have order p after all, contradiction apply pprime.one_lt.ne rw [← hu, h, orderOf_one]
import Mathlib.Order.Filter.Lift import Mathlib.Topology.Separation import Mathlib.Order.Interval.Set.Monotone #align_import topology.filter from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set Filter TopologicalSpace open Filter Topology variable {ι : Sort*} {α β X Y : Type*} namespace Filter instance : TopologicalSpace (Filter α) := generateFrom <| range <| Iic ∘ 𝓟 theorem isOpen_Iic_principal {s : Set α} : IsOpen (Iic (𝓟 s)) := GenerateOpen.basic _ (mem_range_self _) #align filter.is_open_Iic_principal Filter.isOpen_Iic_principal theorem isOpen_setOf_mem {s : Set α} : IsOpen { l : Filter α | s ∈ l } := by simpa only [Iic_principal] using isOpen_Iic_principal #align filter.is_open_set_of_mem Filter.isOpen_setOf_mem theorem isTopologicalBasis_Iic_principal : IsTopologicalBasis (range (Iic ∘ 𝓟 : Set α → Set (Filter α))) := { exists_subset_inter := by rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩ l hl exact ⟨Iic (𝓟 s) ∩ Iic (𝓟 t), ⟨s ∩ t, by simp⟩, hl, Subset.rfl⟩ sUnion_eq := sUnion_eq_univ_iff.2 fun l => ⟨Iic ⊤, ⟨univ, congr_arg Iic principal_univ⟩, mem_Iic.2 le_top⟩ eq_generateFrom := rfl } #align filter.is_topological_basis_Iic_principal Filter.isTopologicalBasis_Iic_principal theorem isOpen_iff {s : Set (Filter α)} : IsOpen s ↔ ∃ T : Set (Set α), s = ⋃ t ∈ T, Iic (𝓟 t) := isTopologicalBasis_Iic_principal.open_iff_eq_sUnion.trans <| by simp only [exists_subset_range_and_iff, sUnion_image, (· ∘ ·)] #align filter.is_open_iff Filter.isOpen_iff theorem nhds_eq (l : Filter α) : 𝓝 l = l.lift' (Iic ∘ 𝓟) := nhds_generateFrom.trans <| by simp only [mem_setOf_eq, @and_comm (l ∈ _), iInf_and, iInf_range, Filter.lift', Filter.lift, (· ∘ ·), mem_Iic, le_principal_iff] #align filter.nhds_eq Filter.nhds_eq theorem nhds_eq' (l : Filter α) : 𝓝 l = l.lift' fun s => { l' | s ∈ l' } := by simpa only [(· ∘ ·), Iic_principal] using nhds_eq l #align filter.nhds_eq' Filter.nhds_eq' protected theorem tendsto_nhds {la : Filter α} {lb : Filter β} {f : α → Filter β} : Tendsto f la (𝓝 lb) ↔ ∀ s ∈ lb, ∀ᶠ a in la, s ∈ f a := by simp only [nhds_eq', tendsto_lift', mem_setOf_eq] #align filter.tendsto_nhds Filter.tendsto_nhds protected theorem HasBasis.nhds {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis (𝓝 l) p fun i => Iic (𝓟 (s i)) := by rw [nhds_eq] exact h.lift' monotone_principal.Iic #align filter.has_basis.nhds Filter.HasBasis.nhds protected theorem tendsto_pure_self (l : Filter X) : Tendsto (pure : X → Filter X) l (𝓝 l) := by rw [Filter.tendsto_nhds] exact fun s hs ↦ Eventually.mono hs fun x ↦ id instance {l : Filter α} [IsCountablyGenerated l] : IsCountablyGenerated (𝓝 l) := let ⟨_b, hb⟩ := l.exists_antitone_basis HasCountableBasis.isCountablyGenerated <| ⟨hb.nhds, Set.to_countable _⟩
Mathlib/Topology/Filter.lean
105
106
theorem HasBasis.nhds' {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis (𝓝 l) p fun i => { l' | s i ∈ l' } := by
simpa only [Iic_principal] using h.nhds
import Mathlib.Topology.UniformSpace.UniformConvergenceTopology #align_import topology.uniform_space.equicontinuity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" section open UniformSpace Filter Set Uniformity Topology UniformConvergence Function variable {ι κ X X' Y Z α α' β β' γ 𝓕 : Type*} [tX : TopologicalSpace X] [tY : TopologicalSpace Y] [tZ : TopologicalSpace Z] [uα : UniformSpace α] [uβ : UniformSpace β] [uγ : UniformSpace γ] def EquicontinuousAt (F : ι → X → α) (x₀ : X) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝 x₀, ∀ i, (F i x₀, F i x) ∈ U #align equicontinuous_at EquicontinuousAt protected abbrev Set.EquicontinuousAt (H : Set <| X → α) (x₀ : X) : Prop := EquicontinuousAt ((↑) : H → X → α) x₀ #align set.equicontinuous_at Set.EquicontinuousAt def EquicontinuousWithinAt (F : ι → X → α) (S : Set X) (x₀ : X) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝[S] x₀, ∀ i, (F i x₀, F i x) ∈ U protected abbrev Set.EquicontinuousWithinAt (H : Set <| X → α) (S : Set X) (x₀ : X) : Prop := EquicontinuousWithinAt ((↑) : H → X → α) S x₀ def Equicontinuous (F : ι → X → α) : Prop := ∀ x₀, EquicontinuousAt F x₀ #align equicontinuous Equicontinuous protected abbrev Set.Equicontinuous (H : Set <| X → α) : Prop := Equicontinuous ((↑) : H → X → α) #align set.equicontinuous Set.Equicontinuous def EquicontinuousOn (F : ι → X → α) (S : Set X) : Prop := ∀ x₀ ∈ S, EquicontinuousWithinAt F S x₀ protected abbrev Set.EquicontinuousOn (H : Set <| X → α) (S : Set X) : Prop := EquicontinuousOn ((↑) : H → X → α) S def UniformEquicontinuous (F : ι → β → α) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β, ∀ i, (F i xy.1, F i xy.2) ∈ U #align uniform_equicontinuous UniformEquicontinuous protected abbrev Set.UniformEquicontinuous (H : Set <| β → α) : Prop := UniformEquicontinuous ((↑) : H → β → α) #align set.uniform_equicontinuous Set.UniformEquicontinuous def UniformEquicontinuousOn (F : ι → β → α) (S : Set β) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β ⊓ 𝓟 (S ×ˢ S), ∀ i, (F i xy.1, F i xy.2) ∈ U protected abbrev Set.UniformEquicontinuousOn (H : Set <| β → α) (S : Set β) : Prop := UniformEquicontinuousOn ((↑) : H → β → α) S lemma EquicontinuousAt.equicontinuousWithinAt {F : ι → X → α} {x₀ : X} (H : EquicontinuousAt F x₀) (S : Set X) : EquicontinuousWithinAt F S x₀ := fun U hU ↦ (H U hU).filter_mono inf_le_left lemma EquicontinuousWithinAt.mono {F : ι → X → α} {x₀ : X} {S T : Set X} (H : EquicontinuousWithinAt F T x₀) (hST : S ⊆ T) : EquicontinuousWithinAt F S x₀ := fun U hU ↦ (H U hU).filter_mono <| nhdsWithin_mono x₀ hST @[simp] lemma equicontinuousWithinAt_univ (F : ι → X → α) (x₀ : X) : EquicontinuousWithinAt F univ x₀ ↔ EquicontinuousAt F x₀ := by rw [EquicontinuousWithinAt, EquicontinuousAt, nhdsWithin_univ] lemma equicontinuousAt_restrict_iff (F : ι → X → α) {S : Set X} (x₀ : S) : EquicontinuousAt (S.restrict ∘ F) x₀ ↔ EquicontinuousWithinAt F S x₀ := by simp [EquicontinuousWithinAt, EquicontinuousAt, ← eventually_nhds_subtype_iff] lemma Equicontinuous.equicontinuousOn {F : ι → X → α} (H : Equicontinuous F) (S : Set X) : EquicontinuousOn F S := fun x _ ↦ (H x).equicontinuousWithinAt S lemma EquicontinuousOn.mono {F : ι → X → α} {S T : Set X} (H : EquicontinuousOn F T) (hST : S ⊆ T) : EquicontinuousOn F S := fun x hx ↦ (H x (hST hx)).mono hST lemma equicontinuousOn_univ (F : ι → X → α) : EquicontinuousOn F univ ↔ Equicontinuous F := by simp [EquicontinuousOn, Equicontinuous] lemma equicontinuous_restrict_iff (F : ι → X → α) {S : Set X} : Equicontinuous (S.restrict ∘ F) ↔ EquicontinuousOn F S := by simp [Equicontinuous, EquicontinuousOn, equicontinuousAt_restrict_iff] lemma UniformEquicontinuous.uniformEquicontinuousOn {F : ι → β → α} (H : UniformEquicontinuous F) (S : Set β) : UniformEquicontinuousOn F S := fun U hU ↦ (H U hU).filter_mono inf_le_left lemma UniformEquicontinuousOn.mono {F : ι → β → α} {S T : Set β} (H : UniformEquicontinuousOn F T) (hST : S ⊆ T) : UniformEquicontinuousOn F S := fun U hU ↦ (H U hU).filter_mono <| by gcongr lemma uniformEquicontinuousOn_univ (F : ι → β → α) : UniformEquicontinuousOn F univ ↔ UniformEquicontinuous F := by simp [UniformEquicontinuousOn, UniformEquicontinuous] lemma uniformEquicontinuous_restrict_iff (F : ι → β → α) {S : Set β} : UniformEquicontinuous (S.restrict ∘ F) ↔ UniformEquicontinuousOn F S := by rw [UniformEquicontinuous, UniformEquicontinuousOn] conv in _ ⊓ _ => rw [← Subtype.range_val (s := S), ← range_prod_map, ← map_comap] rfl @[simp] lemma equicontinuousAt_empty [h : IsEmpty ι] (F : ι → X → α) (x₀ : X) : EquicontinuousAt F x₀ := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma equicontinuousWithinAt_empty [h : IsEmpty ι] (F : ι → X → α) (S : Set X) (x₀ : X) : EquicontinuousWithinAt F S x₀ := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma equicontinuous_empty [IsEmpty ι] (F : ι → X → α) : Equicontinuous F := equicontinuousAt_empty F @[simp] lemma equicontinuousOn_empty [IsEmpty ι] (F : ι → X → α) (S : Set X) : EquicontinuousOn F S := fun x₀ _ ↦ equicontinuousWithinAt_empty F S x₀ @[simp] lemma uniformEquicontinuous_empty [h : IsEmpty ι] (F : ι → β → α) : UniformEquicontinuous F := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma uniformEquicontinuousOn_empty [h : IsEmpty ι] (F : ι → β → α) (S : Set β) : UniformEquicontinuousOn F S := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) theorem equicontinuousAt_finite [Finite ι] {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ∀ i, ContinuousAt (F i) x₀ := by simp [EquicontinuousAt, ContinuousAt, (nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff, UniformSpace.ball, @forall_swap _ ι] theorem equicontinuousWithinAt_finite [Finite ι] {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ ∀ i, ContinuousWithinAt (F i) S x₀ := by simp [EquicontinuousWithinAt, ContinuousWithinAt, (nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff, UniformSpace.ball, @forall_swap _ ι] theorem equicontinuous_finite [Finite ι] {F : ι → X → α} : Equicontinuous F ↔ ∀ i, Continuous (F i) := by simp only [Equicontinuous, equicontinuousAt_finite, continuous_iff_continuousAt, @forall_swap ι] theorem equicontinuousOn_finite [Finite ι] {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ∀ i, ContinuousOn (F i) S := by simp only [EquicontinuousOn, equicontinuousWithinAt_finite, ContinuousOn, @forall_swap ι] theorem uniformEquicontinuous_finite [Finite ι] {F : ι → β → α} : UniformEquicontinuous F ↔ ∀ i, UniformContinuous (F i) := by simp only [UniformEquicontinuous, eventually_all, @forall_swap _ ι]; rfl theorem uniformEquicontinuousOn_finite [Finite ι] {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ ∀ i, UniformContinuousOn (F i) S := by simp only [UniformEquicontinuousOn, eventually_all, @forall_swap _ ι]; rfl theorem equicontinuousAt_unique [Unique ι] {F : ι → X → α} {x : X} : EquicontinuousAt F x ↔ ContinuousAt (F default) x := equicontinuousAt_finite.trans Unique.forall_iff theorem equicontinuousWithinAt_unique [Unique ι] {F : ι → X → α} {S : Set X} {x : X} : EquicontinuousWithinAt F S x ↔ ContinuousWithinAt (F default) S x := equicontinuousWithinAt_finite.trans Unique.forall_iff theorem equicontinuous_unique [Unique ι] {F : ι → X → α} : Equicontinuous F ↔ Continuous (F default) := equicontinuous_finite.trans Unique.forall_iff theorem equicontinuousOn_unique [Unique ι] {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ContinuousOn (F default) S := equicontinuousOn_finite.trans Unique.forall_iff theorem uniformEquicontinuous_unique [Unique ι] {F : ι → β → α} : UniformEquicontinuous F ↔ UniformContinuous (F default) := uniformEquicontinuous_finite.trans Unique.forall_iff theorem uniformEquicontinuousOn_unique [Unique ι] {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformContinuousOn (F default) S := uniformEquicontinuousOn_finite.trans Unique.forall_iff theorem equicontinuousWithinAt_iff_pair {F : ι → X → α} {S : Set X} {x₀ : X} (hx₀ : x₀ ∈ S) : EquicontinuousWithinAt F S x₀ ↔ ∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝[S] x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by constructor <;> intro H U hU · rcases comp_symm_mem_uniformity_sets hU with ⟨V, hV, hVsymm, hVU⟩ refine ⟨_, H V hV, fun x hx y hy i => hVU (prod_mk_mem_compRel ?_ (hy i))⟩ exact hVsymm.mk_mem_comm.mp (hx i) · rcases H U hU with ⟨V, hV, hVU⟩ filter_upwards [hV] using fun x hx i => hVU x₀ (mem_of_mem_nhdsWithin hx₀ hV) x hx i theorem equicontinuousAt_iff_pair {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝 x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by simp_rw [← equicontinuousWithinAt_univ, equicontinuousWithinAt_iff_pair (mem_univ x₀), nhdsWithin_univ] #align equicontinuous_at_iff_pair equicontinuousAt_iff_pair theorem UniformEquicontinuous.equicontinuous {F : ι → β → α} (h : UniformEquicontinuous F) : Equicontinuous F := fun x₀ U hU ↦ mem_of_superset (ball_mem_nhds x₀ (h U hU)) fun _ hx i ↦ hx i #align uniform_equicontinuous.equicontinuous UniformEquicontinuous.equicontinuous theorem UniformEquicontinuousOn.equicontinuousOn {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) : EquicontinuousOn F S := fun _ hx₀ U hU ↦ mem_of_superset (ball_mem_nhdsWithin hx₀ (h U hU)) fun _ hx i ↦ hx i theorem EquicontinuousAt.continuousAt {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (i : ι) : ContinuousAt (F i) x₀ := (UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i #align equicontinuous_at.continuous_at EquicontinuousAt.continuousAt theorem EquicontinuousWithinAt.continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X} (h : EquicontinuousWithinAt F S x₀) (i : ι) : ContinuousWithinAt (F i) S x₀ := (UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i protected theorem Set.EquicontinuousAt.continuousAt_of_mem {H : Set <| X → α} {x₀ : X} (h : H.EquicontinuousAt x₀) {f : X → α} (hf : f ∈ H) : ContinuousAt f x₀ := h.continuousAt ⟨f, hf⟩ #align set.equicontinuous_at.continuous_at_of_mem Set.EquicontinuousAt.continuousAt_of_mem protected theorem Set.EquicontinuousWithinAt.continuousWithinAt_of_mem {H : Set <| X → α} {S : Set X} {x₀ : X} (h : H.EquicontinuousWithinAt S x₀) {f : X → α} (hf : f ∈ H) : ContinuousWithinAt f S x₀ := h.continuousWithinAt ⟨f, hf⟩ theorem Equicontinuous.continuous {F : ι → X → α} (h : Equicontinuous F) (i : ι) : Continuous (F i) := continuous_iff_continuousAt.mpr fun x => (h x).continuousAt i #align equicontinuous.continuous Equicontinuous.continuous theorem EquicontinuousOn.continuousOn {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S) (i : ι) : ContinuousOn (F i) S := fun x hx ↦ (h x hx).continuousWithinAt i protected theorem Set.Equicontinuous.continuous_of_mem {H : Set <| X → α} (h : H.Equicontinuous) {f : X → α} (hf : f ∈ H) : Continuous f := h.continuous ⟨f, hf⟩ #align set.equicontinuous.continuous_of_mem Set.Equicontinuous.continuous_of_mem protected theorem Set.EquicontinuousOn.continuousOn_of_mem {H : Set <| X → α} {S : Set X} (h : H.EquicontinuousOn S) {f : X → α} (hf : f ∈ H) : ContinuousOn f S := h.continuousOn ⟨f, hf⟩ theorem UniformEquicontinuous.uniformContinuous {F : ι → β → α} (h : UniformEquicontinuous F) (i : ι) : UniformContinuous (F i) := fun U hU => mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i) #align uniform_equicontinuous.uniform_continuous UniformEquicontinuous.uniformContinuous theorem UniformEquicontinuousOn.uniformContinuousOn {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) (i : ι) : UniformContinuousOn (F i) S := fun U hU => mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i) protected theorem Set.UniformEquicontinuous.uniformContinuous_of_mem {H : Set <| β → α} (h : H.UniformEquicontinuous) {f : β → α} (hf : f ∈ H) : UniformContinuous f := h.uniformContinuous ⟨f, hf⟩ #align set.uniform_equicontinuous.uniform_continuous_of_mem Set.UniformEquicontinuous.uniformContinuous_of_mem protected theorem Set.UniformEquicontinuousOn.uniformContinuousOn_of_mem {H : Set <| β → α} {S : Set β} (h : H.UniformEquicontinuousOn S) {f : β → α} (hf : f ∈ H) : UniformContinuousOn f S := h.uniformContinuousOn ⟨f, hf⟩ theorem EquicontinuousAt.comp {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (u : κ → ι) : EquicontinuousAt (F ∘ u) x₀ := fun U hU => (h U hU).mono fun _ H k => H (u k) #align equicontinuous_at.comp EquicontinuousAt.comp theorem EquicontinuousWithinAt.comp {F : ι → X → α} {S : Set X} {x₀ : X} (h : EquicontinuousWithinAt F S x₀) (u : κ → ι) : EquicontinuousWithinAt (F ∘ u) S x₀ := fun U hU ↦ (h U hU).mono fun _ H k => H (u k) protected theorem Set.EquicontinuousAt.mono {H H' : Set <| X → α} {x₀ : X} (h : H.EquicontinuousAt x₀) (hH : H' ⊆ H) : H'.EquicontinuousAt x₀ := h.comp (inclusion hH) #align set.equicontinuous_at.mono Set.EquicontinuousAt.mono protected theorem Set.EquicontinuousWithinAt.mono {H H' : Set <| X → α} {S : Set X} {x₀ : X} (h : H.EquicontinuousWithinAt S x₀) (hH : H' ⊆ H) : H'.EquicontinuousWithinAt S x₀ := h.comp (inclusion hH) theorem Equicontinuous.comp {F : ι → X → α} (h : Equicontinuous F) (u : κ → ι) : Equicontinuous (F ∘ u) := fun x => (h x).comp u #align equicontinuous.comp Equicontinuous.comp theorem EquicontinuousOn.comp {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S) (u : κ → ι) : EquicontinuousOn (F ∘ u) S := fun x hx ↦ (h x hx).comp u protected theorem Set.Equicontinuous.mono {H H' : Set <| X → α} (h : H.Equicontinuous) (hH : H' ⊆ H) : H'.Equicontinuous := h.comp (inclusion hH) #align set.equicontinuous.mono Set.Equicontinuous.mono protected theorem Set.EquicontinuousOn.mono {H H' : Set <| X → α} {S : Set X} (h : H.EquicontinuousOn S) (hH : H' ⊆ H) : H'.EquicontinuousOn S := h.comp (inclusion hH) theorem UniformEquicontinuous.comp {F : ι → β → α} (h : UniformEquicontinuous F) (u : κ → ι) : UniformEquicontinuous (F ∘ u) := fun U hU => (h U hU).mono fun _ H k => H (u k) #align uniform_equicontinuous.comp UniformEquicontinuous.comp theorem UniformEquicontinuousOn.comp {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) (u : κ → ι) : UniformEquicontinuousOn (F ∘ u) S := fun U hU ↦ (h U hU).mono fun _ H k => H (u k) protected theorem Set.UniformEquicontinuous.mono {H H' : Set <| β → α} (h : H.UniformEquicontinuous) (hH : H' ⊆ H) : H'.UniformEquicontinuous := h.comp (inclusion hH) #align set.uniform_equicontinuous.mono Set.UniformEquicontinuous.mono protected theorem Set.UniformEquicontinuousOn.mono {H H' : Set <| β → α} {S : Set β} (h : H.UniformEquicontinuousOn S) (hH : H' ⊆ H) : H'.UniformEquicontinuousOn S := h.comp (inclusion hH) theorem equicontinuousAt_iff_range {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ EquicontinuousAt ((↑) : range F → X → α) x₀ := by simp only [EquicontinuousAt, forall_subtype_range_iff] #align equicontinuous_at_iff_range equicontinuousAt_iff_range theorem equicontinuousWithinAt_iff_range {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ EquicontinuousWithinAt ((↑) : range F → X → α) S x₀ := by simp only [EquicontinuousWithinAt, forall_subtype_range_iff] theorem equicontinuous_iff_range {F : ι → X → α} : Equicontinuous F ↔ Equicontinuous ((↑) : range F → X → α) := forall_congr' fun _ => equicontinuousAt_iff_range #align equicontinuous_iff_range equicontinuous_iff_range theorem equicontinuousOn_iff_range {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ EquicontinuousOn ((↑) : range F → X → α) S := forall_congr' fun _ ↦ forall_congr' fun _ ↦ equicontinuousWithinAt_iff_range theorem uniformEquicontinuous_iff_range {F : ι → β → α} : UniformEquicontinuous F ↔ UniformEquicontinuous ((↑) : range F → β → α) := ⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h => h.comp (rangeFactorization F)⟩ #align uniform_equicontinuous_at_iff_range uniformEquicontinuous_iff_range theorem uniformEquicontinuousOn_iff_range {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformEquicontinuousOn ((↑) : range F → β → α) S := ⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h => h.comp (rangeFactorization F)⟩ section open UniformFun theorem equicontinuousAt_iff_continuousAt {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ContinuousAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) x₀ := by rw [ContinuousAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff] rfl #align equicontinuous_at_iff_continuous_at equicontinuousAt_iff_continuousAt theorem equicontinuousWithinAt_iff_continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ ContinuousWithinAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) S x₀ := by rw [ContinuousWithinAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff] rfl theorem equicontinuous_iff_continuous {F : ι → X → α} : Equicontinuous F ↔ Continuous (ofFun ∘ Function.swap F : X → ι →ᵤ α) := by simp_rw [Equicontinuous, continuous_iff_continuousAt, equicontinuousAt_iff_continuousAt] #align equicontinuous_iff_continuous equicontinuous_iff_continuous theorem equicontinuousOn_iff_continuousOn {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ContinuousOn (ofFun ∘ Function.swap F : X → ι →ᵤ α) S := by simp_rw [EquicontinuousOn, ContinuousOn, equicontinuousWithinAt_iff_continuousWithinAt] theorem uniformEquicontinuous_iff_uniformContinuous {F : ι → β → α} : UniformEquicontinuous F ↔ UniformContinuous (ofFun ∘ Function.swap F : β → ι →ᵤ α) := by rw [UniformContinuous, (UniformFun.hasBasis_uniformity ι α).tendsto_right_iff] rfl #align uniform_equicontinuous_iff_uniform_continuous uniformEquicontinuous_iff_uniformContinuous theorem uniformEquicontinuousOn_iff_uniformContinuousOn {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformContinuousOn (ofFun ∘ Function.swap F : β → ι →ᵤ α) S := by rw [UniformContinuousOn, (UniformFun.hasBasis_uniformity ι α).tendsto_right_iff] rfl theorem equicontinuousWithinAt_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} {S : Set X} {x₀ : X} : EquicontinuousWithinAt (uα := ⨅ k, u k) F S x₀ ↔ ∀ k, EquicontinuousWithinAt (uα := u k) F S x₀ := by simp only [equicontinuousWithinAt_iff_continuousWithinAt (uα := _), topologicalSpace] unfold ContinuousWithinAt rw [UniformFun.iInf_eq, toTopologicalSpace_iInf, nhds_iInf, tendsto_iInf] theorem equicontinuousAt_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} {x₀ : X} : EquicontinuousAt (uα := ⨅ k, u k) F x₀ ↔ ∀ k, EquicontinuousAt (uα := u k) F x₀ := by simp only [← equicontinuousWithinAt_univ (uα := _), equicontinuousWithinAt_iInf_rng] theorem equicontinuous_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} : Equicontinuous (uα := ⨅ k, u k) F ↔ ∀ k, Equicontinuous (uα := u k) F := by simp_rw [equicontinuous_iff_continuous (uα := _), UniformFun.topologicalSpace] rw [UniformFun.iInf_eq, toTopologicalSpace_iInf, continuous_iInf_rng] theorem equicontinuousOn_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} {S : Set X} : EquicontinuousOn (uα := ⨅ k, u k) F S ↔ ∀ k, EquicontinuousOn (uα := u k) F S := by simp_rw [EquicontinuousOn, equicontinuousWithinAt_iInf_rng, @forall_swap _ κ] theorem uniformEquicontinuous_iInf_rng {u : κ → UniformSpace α'} {F : ι → β → α'} : UniformEquicontinuous (uα := ⨅ k, u k) F ↔ ∀ k, UniformEquicontinuous (uα := u k) F := by simp_rw [uniformEquicontinuous_iff_uniformContinuous (uα := _)] rw [UniformFun.iInf_eq, uniformContinuous_iInf_rng] theorem uniformEquicontinuousOn_iInf_rng {u : κ → UniformSpace α'} {F : ι → β → α'} {S : Set β} : UniformEquicontinuousOn (uα := ⨅ k, u k) F S ↔ ∀ k, UniformEquicontinuousOn (uα := u k) F S := by simp_rw [uniformEquicontinuousOn_iff_uniformContinuousOn (uα := _)] unfold UniformContinuousOn rw [UniformFun.iInf_eq, iInf_uniformity, tendsto_iInf] theorem equicontinuousWithinAt_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {S : Set X'} {x₀ : X'} {k : κ} (hk : EquicontinuousWithinAt (tX := t k) F S x₀) : EquicontinuousWithinAt (tX := ⨅ k, t k) F S x₀ := by simp [equicontinuousWithinAt_iff_continuousWithinAt (tX := _)] at hk ⊢ unfold ContinuousWithinAt nhdsWithin at hk ⊢ rw [nhds_iInf] exact hk.mono_left <| inf_le_inf_right _ <| iInf_le _ k theorem equicontinuousAt_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {x₀ : X'} {k : κ} (hk : EquicontinuousAt (tX := t k) F x₀) : EquicontinuousAt (tX := ⨅ k, t k) F x₀ := by rw [← equicontinuousWithinAt_univ (tX := _)] at hk ⊢ exact equicontinuousWithinAt_iInf_dom hk theorem equicontinuous_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {k : κ} (hk : Equicontinuous (tX := t k) F) : Equicontinuous (tX := ⨅ k, t k) F := fun x ↦ equicontinuousAt_iInf_dom (hk x) theorem equicontinuousOn_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {S : Set X'} {k : κ} (hk : EquicontinuousOn (tX := t k) F S) : EquicontinuousOn (tX := ⨅ k, t k) F S := fun x hx ↦ equicontinuousWithinAt_iInf_dom (hk x hx) theorem uniformEquicontinuous_iInf_dom {u : κ → UniformSpace β'} {F : ι → β' → α} {k : κ} (hk : UniformEquicontinuous (uβ := u k) F) : UniformEquicontinuous (uβ := ⨅ k, u k) F := by simp_rw [uniformEquicontinuous_iff_uniformContinuous (uβ := _)] at hk ⊢ exact uniformContinuous_iInf_dom hk theorem uniformEquicontinuousOn_iInf_dom {u : κ → UniformSpace β'} {F : ι → β' → α} {S : Set β'} {k : κ} (hk : UniformEquicontinuousOn (uβ := u k) F S) : UniformEquicontinuousOn (uβ := ⨅ k, u k) F S := by simp_rw [uniformEquicontinuousOn_iff_uniformContinuousOn (uβ := _)] at hk ⊢ unfold UniformContinuousOn rw [iInf_uniformity] exact hk.mono_left <| inf_le_inf_right _ <| iInf_le _ k
Mathlib/Topology/UniformSpace/Equicontinuity.lean
633
638
theorem Filter.HasBasis.equicontinuousAt_iff_left {p : κ → Prop} {s : κ → Set X} {F : ι → X → α} {x₀ : X} (hX : (𝓝 x₀).HasBasis p s) : EquicontinuousAt F x₀ ↔ ∀ U ∈ 𝓤 α, ∃ k, p k ∧ ∀ x ∈ s k, ∀ i, (F i x₀, F i x) ∈ U := by
rw [equicontinuousAt_iff_continuousAt, ContinuousAt, hX.tendsto_iff (UniformFun.hasBasis_nhds ι α _)] rfl
import Mathlib.Analysis.SpecialFunctions.ExpDeriv #align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] open Metric Set Asymptotics Filter Real open scoped Classical Topology NNReal noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ := if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1) #align gronwall_bound gronwallBound theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x := funext fun _ => if_pos rfl set_option linter.uppercaseLean3 false in #align gronwall_bound_K0 gronwallBound_K0 theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) : gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) := funext fun _ => if_neg hK set_option linter.uppercaseLean3 false in #align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0 theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) : HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by by_cases hK : K = 0 · subst K simp only [gronwallBound_K0, zero_mul, zero_add] convert ((hasDerivAt_id x).const_mul ε).const_add δ rw [mul_one] · simp only [gronwallBound_of_K_ne_0 hK] convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add ((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1 simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK] ring #align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) : HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1 rw [id, mul_one] #align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by by_cases hK : K = 0 · simp only [gronwallBound, if_pos hK, mul_zero, add_zero] · simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one, add_zero] #align gronwall_bound_x0 gronwallBound_x0 theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by by_cases hK : K = 0 · simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one] · simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero] #align gronwall_bound_ε0 gronwallBound_ε0 theorem gronwallBound_ε0_δ0 (K x : ℝ) : gronwallBound 0 K 0 x = 0 := by simp only [gronwallBound_ε0, zero_mul] #align gronwall_bound_ε0_δ0 gronwallBound_ε0_δ0 theorem gronwallBound_continuous_ε (δ K x : ℝ) : Continuous fun ε => gronwallBound δ K ε x := by by_cases hK : K = 0 · simp only [gronwallBound_K0, hK] exact continuous_const.add (continuous_id.mul continuous_const) · simp only [gronwallBound_of_K_ne_0 hK] exact continuous_const.add ((continuous_id.mul continuous_const).mul continuous_const) #align gronwall_bound_continuous_ε gronwallBound_continuous_ε theorem le_gronwallBound_of_liminf_deriv_right_le {f f' : ℝ → ℝ} {δ K ε : ℝ} {a b : ℝ} (hf : ContinuousOn f (Icc a b)) (hf' : ∀ x ∈ Ico a b, ∀ r, f' x < r → ∃ᶠ z in 𝓝[>] x, (z - x)⁻¹ * (f z - f x) < r) (ha : f a ≤ δ) (bound : ∀ x ∈ Ico a b, f' x ≤ K * f x + ε) : ∀ x ∈ Icc a b, f x ≤ gronwallBound δ K ε (x - a) := by have H : ∀ x ∈ Icc a b, ∀ ε' ∈ Ioi ε, f x ≤ gronwallBound δ K ε' (x - a) := by intro x hx ε' hε' apply image_le_of_liminf_slope_right_lt_deriv_boundary hf hf' · rwa [sub_self, gronwallBound_x0] · exact fun x => hasDerivAt_gronwallBound_shift δ K ε' x a · intro x hx hfB rw [← hfB] apply lt_of_le_of_lt (bound x hx) exact add_lt_add_left (mem_Ioi.1 hε') _ · exact hx intro x hx change f x ≤ (fun ε' => gronwallBound δ K ε' (x - a)) ε convert continuousWithinAt_const.closure_le _ _ (H x hx) · simp only [closure_Ioi, left_mem_Ici] exact (gronwallBound_continuous_ε δ K (x - a)).continuousWithinAt #align le_gronwall_bound_of_liminf_deriv_right_le le_gronwallBound_of_liminf_deriv_right_le theorem norm_le_gronwallBound_of_norm_deriv_right_le {f f' : ℝ → E} {δ K ε : ℝ} {a b : ℝ} (hf : ContinuousOn f (Icc a b)) (hf' : ∀ x ∈ Ico a b, HasDerivWithinAt f (f' x) (Ici x) x) (ha : ‖f a‖ ≤ δ) (bound : ∀ x ∈ Ico a b, ‖f' x‖ ≤ K * ‖f x‖ + ε) : ∀ x ∈ Icc a b, ‖f x‖ ≤ gronwallBound δ K ε (x - a) := le_gronwallBound_of_liminf_deriv_right_le (continuous_norm.comp_continuousOn hf) (fun x hx _r hr => (hf' x hx).liminf_right_slope_norm_le hr) ha bound #align norm_le_gronwall_bound_of_norm_deriv_right_le norm_le_gronwallBound_of_norm_deriv_right_le variable {v : ℝ → E → E} {s : ℝ → Set E} {K : ℝ≥0} {f g f' g' : ℝ → E} {a b t₀ : ℝ} {εf εg δ : ℝ} (hv : ∀ t, LipschitzOnWith K (v t) (s t)) theorem dist_le_of_approx_trajectories_ODE_of_mem (hf : ContinuousOn f (Icc a b)) (hf' : ∀ t ∈ Ico a b, HasDerivWithinAt f (f' t) (Ici t) t) (f_bound : ∀ t ∈ Ico a b, dist (f' t) (v t (f t)) ≤ εf) (hfs : ∀ t ∈ Ico a b, f t ∈ s t) (hg : ContinuousOn g (Icc a b)) (hg' : ∀ t ∈ Ico a b, HasDerivWithinAt g (g' t) (Ici t) t) (g_bound : ∀ t ∈ Ico a b, dist (g' t) (v t (g t)) ≤ εg) (hgs : ∀ t ∈ Ico a b, g t ∈ s t) (ha : dist (f a) (g a) ≤ δ) : ∀ t ∈ Icc a b, dist (f t) (g t) ≤ gronwallBound δ K (εf + εg) (t - a) := by simp only [dist_eq_norm] at ha ⊢ have h_deriv : ∀ t ∈ Ico a b, HasDerivWithinAt (fun t => f t - g t) (f' t - g' t) (Ici t) t := fun t ht => (hf' t ht).sub (hg' t ht) apply norm_le_gronwallBound_of_norm_deriv_right_le (hf.sub hg) h_deriv ha intro t ht have := dist_triangle4_right (f' t) (g' t) (v t (f t)) (v t (g t)) have hv := (hv t).dist_le_mul _ (hfs t ht) _ (hgs t ht) rw [← dist_eq_norm, ← dist_eq_norm] refine this.trans ((add_le_add (add_le_add (f_bound t ht) (g_bound t ht)) hv).trans ?_) rw [add_comm] set_option linter.uppercaseLean3 false in #align dist_le_of_approx_trajectories_ODE_of_mem_set dist_le_of_approx_trajectories_ODE_of_mem theorem dist_le_of_approx_trajectories_ODE (hv : ∀ t, LipschitzWith K (v t)) (hf : ContinuousOn f (Icc a b)) (hf' : ∀ t ∈ Ico a b, HasDerivWithinAt f (f' t) (Ici t) t) (f_bound : ∀ t ∈ Ico a b, dist (f' t) (v t (f t)) ≤ εf) (hg : ContinuousOn g (Icc a b)) (hg' : ∀ t ∈ Ico a b, HasDerivWithinAt g (g' t) (Ici t) t) (g_bound : ∀ t ∈ Ico a b, dist (g' t) (v t (g t)) ≤ εg) (ha : dist (f a) (g a) ≤ δ) : ∀ t ∈ Icc a b, dist (f t) (g t) ≤ gronwallBound δ K (εf + εg) (t - a) := have hfs : ∀ t ∈ Ico a b, f t ∈ @univ E := fun _ _ => trivial dist_le_of_approx_trajectories_ODE_of_mem (fun t => (hv t).lipschitzOnWith _) hf hf' f_bound hfs hg hg' g_bound (fun _ _ => trivial) ha set_option linter.uppercaseLean3 false in #align dist_le_of_approx_trajectories_ODE dist_le_of_approx_trajectories_ODE
Mathlib/Analysis/ODE/Gronwall.lean
207
219
theorem dist_le_of_trajectories_ODE_of_mem (hf : ContinuousOn f (Icc a b)) (hf' : ∀ t ∈ Ico a b, HasDerivWithinAt f (v t (f t)) (Ici t) t) (hfs : ∀ t ∈ Ico a b, f t ∈ s t) (hg : ContinuousOn g (Icc a b)) (hg' : ∀ t ∈ Ico a b, HasDerivWithinAt g (v t (g t)) (Ici t) t) (hgs : ∀ t ∈ Ico a b, g t ∈ s t) (ha : dist (f a) (g a) ≤ δ) : ∀ t ∈ Icc a b, dist (f t) (g t) ≤ δ * exp (K * (t - a)) := by
have f_bound : ∀ t ∈ Ico a b, dist (v t (f t)) (v t (f t)) ≤ 0 := by intros; rw [dist_self] have g_bound : ∀ t ∈ Ico a b, dist (v t (g t)) (v t (g t)) ≤ 0 := by intros; rw [dist_self] intro t ht have := dist_le_of_approx_trajectories_ODE_of_mem hv hf hf' f_bound hfs hg hg' g_bound hgs ha t ht rwa [zero_add, gronwallBound_ε0] at this
import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Metric Set open Pointwise Topology variable {𝕜 E : Type*} variable [NormedField 𝕜] section SeminormedAddCommGroup variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀] #align smul_ball smul_ball theorem smul_unitBall {c : 𝕜} (hc : c ≠ 0) : c • ball (0 : E) (1 : ℝ) = ball (0 : E) ‖c‖ := by rw [_root_.smul_ball hc, smul_zero, mul_one] #align smul_unit_ball smul_unitBall theorem smul_sphere' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • sphere x r = sphere (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r] #align smul_sphere' smul_sphere' theorem smul_closedBall' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • closedBall x r = closedBall (c • x) (‖c‖ * r) := by simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc] #align smul_closed_ball' smul_closedBall' theorem set_smul_sphere_zero {s : Set 𝕜} (hs : 0 ∉ s) (r : ℝ) : s • sphere (0 : E) r = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := calc s • sphere (0 : E) r = ⋃ c ∈ s, c • sphere (0 : E) r := iUnion_smul_left_image.symm _ = ⋃ c ∈ s, sphere (0 : E) (‖c‖ * r) := iUnion₂_congr fun c hc ↦ by rw [smul_sphere' (ne_of_mem_of_not_mem hc hs), smul_zero] _ = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := by ext; simp [eq_comm] theorem Bornology.IsBounded.smul₀ {s : Set E} (hs : IsBounded s) (c : 𝕜) : IsBounded (c • s) := (lipschitzWith_smul c).isBounded_image hs #align metric.bounded.smul Bornology.IsBounded.smul₀ theorem eventually_singleton_add_smul_subset {x : E} {s : Set E} (hs : Bornology.IsBounded s) {u : Set E} (hu : u ∈ 𝓝 x) : ∀ᶠ r in 𝓝 (0 : 𝕜), {x} + r • s ⊆ u := by obtain ⟨ε, εpos, hε⟩ : ∃ ε : ℝ, 0 < ε ∧ closedBall x ε ⊆ u := nhds_basis_closedBall.mem_iff.1 hu obtain ⟨R, Rpos, hR⟩ : ∃ R : ℝ, 0 < R ∧ s ⊆ closedBall 0 R := hs.subset_closedBall_lt 0 0 have : Metric.closedBall (0 : 𝕜) (ε / R) ∈ 𝓝 (0 : 𝕜) := closedBall_mem_nhds _ (div_pos εpos Rpos) filter_upwards [this] with r hr simp only [image_add_left, singleton_add] intro y hy obtain ⟨z, zs, hz⟩ : ∃ z : E, z ∈ s ∧ r • z = -x + y := by simpa [mem_smul_set] using hy have I : ‖r • z‖ ≤ ε := calc ‖r • z‖ = ‖r‖ * ‖z‖ := norm_smul _ _ _ ≤ ε / R * R := (mul_le_mul (mem_closedBall_zero_iff.1 hr) (mem_closedBall_zero_iff.1 (hR zs)) (norm_nonneg _) (div_pos εpos Rpos).le) _ = ε := by field_simp have : y = x + r • z := by simp only [hz, add_neg_cancel_left] apply hε simpa only [this, dist_eq_norm, add_sub_cancel_left, mem_closedBall] using I #align eventually_singleton_add_smul_subset eventually_singleton_add_smul_subset variable [NormedSpace ℝ E] {x y z : E} {δ ε : ℝ}
Mathlib/Analysis/NormedSpace/Pointwise.lean
150
151
theorem smul_unitBall_of_pos {r : ℝ} (hr : 0 < r) : r • ball (0 : E) 1 = ball (0 : E) r := by
rw [smul_unitBall hr.ne', Real.norm_of_nonneg hr.le]
import Mathlib.Geometry.Manifold.MFDeriv.Atlas noncomputable section open scoped Manifold open Set section UniqueMDiff variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] [SmoothManifoldWithCorners I' M'] {s : Set M} {x : M} theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x) {f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f') (hd : DenseRange f') : UniqueMDiffWithinAt I' (f '' s) (f x) := by have := hs.inter' <| hf.1 (extChartAt_source_mem_nhds I' (f x)) refine (((hf.2.mono ?sub1).uniqueDiffWithinAt this hd).mono ?sub2).congr_pt ?pt case pt => simp only [mfld_simps] case sub1 => mfld_set_tac case sub2 => rintro _ ⟨y, ⟨⟨hys, hfy⟩, -⟩, rfl⟩ exact ⟨⟨_, hys, ((extChartAt I' (f x)).left_inv hfy).symm⟩, mem_range_self _⟩ theorem UniqueMDiffOn.image_denseRange' (hs : UniqueMDiffOn I s) {f : M → M'} {f' : M → E →L[𝕜] E'} (hf : ∀ x ∈ s, HasMFDerivWithinAt I I' f s x (f' x)) (hd : ∀ x ∈ s, DenseRange (f' x)) : UniqueMDiffOn I' (f '' s) := forall_mem_image.2 fun x hx ↦ (hs x hx).image_denseRange (hf x hx) (hd x hx) theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'} (hf : MDifferentiableOn I I' f s) (hd : ∀ x ∈ s, DenseRange (mfderivWithin I I' f s x)) : UniqueMDiffOn I' (f '' s) := hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph (hs : UniqueMDiffWithinAt I s x) {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) : UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by rw [← e.image_source_inter_eq', inter_comm] exact (hs.inter (e.open_source.mem_nhds hx)).image_denseRange (he.mdifferentiableAt hx).hasMFDerivAt.hasMFDerivWithinAt (he.mfderiv_surjective hx).denseRange theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') : UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) := fun _x hx ↦ e.right_inv hx.1 ▸ (hs _ hx.2).preimage_partialHomeomorph he (e.map_target hx.1) #align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage
Mathlib/Geometry/Manifold/MFDeriv/UniqueDifferential.lean
84
92
theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M) : UniqueDiffOn 𝕜 ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) := by
-- this is just a reformulation of `UniqueMDiffOn.uniqueMDiffOn_preimage`, using as `e` -- the local chart at `x`. apply UniqueMDiffOn.uniqueDiffOn rw [← PartialEquiv.image_source_inter_eq', inter_comm, extChartAt_source] exact (hs.inter (chartAt H x).open_source).image_denseRange' (fun y hy ↦ hasMFDerivWithinAt_extChartAt I hy.2) fun y hy ↦ ((mdifferentiable_chart _ _).mfderiv_surjective hy.2).denseRange
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.Enumerative.DoubleCounting import Mathlib.Data.Finset.Pointwise import Mathlib.Tactic.GCongr #align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd" open Nat open NNRat Pointwise namespace Finset variable {α : Type*} [CommGroup α] [DecidableEq α] {A B C : Finset α} @[to_additive card_sub_mul_le_card_sub_mul_card_sub "**Ruzsa's triangle inequality**. Subtraction version."] theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset α) : (A / C).card * B.card ≤ (A / B).card * (B / C).card := by rw [← card_product (A / B), ← mul_one ((A / B) ×ˢ (B / C)).card] refine card_mul_le_card_mul (fun b ac ↦ ac.1 * ac.2 = b) (fun x hx ↦ ?_) fun x _ ↦ card_le_one_iff.2 fun hu hv ↦ ((mem_bipartiteBelow _).1 hu).2.symm.trans ?_ obtain ⟨a, ha, c, hc, rfl⟩ := mem_div.1 hx refine card_le_card_of_inj_on (fun b ↦ (a / b, b / c)) (fun b hb ↦ ?_) fun b₁ _ b₂ _ h ↦ ?_ · rw [mem_bipartiteAbove] exact ⟨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _⟩ · exact div_right_injective (Prod.ext_iff.1 h).1 · exact ((mem_bipartiteBelow _).1 hv).2 #align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div #align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub @[to_additive card_sub_mul_le_card_add_mul_card_add "**Ruzsa's triangle inequality**. Sub-add-add version."] theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset α) : (A / C).card * B.card ≤ (A * B).card * (B * C).card := by rw [← div_inv_eq_mul, ← card_inv B, ← card_inv (B * C), mul_inv, ← div_eq_mul_inv] exact card_div_mul_le_card_div_mul_card_div _ _ _ #align finset.card_div_mul_le_card_mul_mul_card_mul Finset.card_div_mul_le_card_mul_mul_card_mul #align finset.card_sub_mul_le_card_add_mul_card_add Finset.card_sub_mul_le_card_add_mul_card_add @[to_additive card_add_mul_le_card_sub_mul_card_add "**Ruzsa's triangle inequality**. Add-sub-sub version."] theorem card_mul_mul_le_card_div_mul_card_mul (A B C : Finset α) : (A * C).card * B.card ≤ (A / B).card * (B * C).card := by rw [← div_inv_eq_mul, ← div_inv_eq_mul B] exact card_div_mul_le_card_div_mul_card_div _ _ _ #align finset.card_mul_mul_le_card_div_mul_card_mul Finset.card_mul_mul_le_card_div_mul_card_mul #align finset.card_add_mul_le_card_sub_mul_card_add Finset.card_add_mul_le_card_sub_mul_card_add @[to_additive card_add_mul_le_card_add_mul_card_sub "**Ruzsa's triangle inequality**. Add-add-sub version."] theorem card_mul_mul_le_card_mul_mul_card_div (A B C : Finset α) : (A * C).card * B.card ≤ (A * B).card * (B / C).card := by rw [← div_inv_eq_mul, div_eq_mul_inv B] exact card_div_mul_le_card_mul_mul_card_mul _ _ _ #align finset.card_mul_mul_le_card_mul_mul_card_div Finset.card_mul_mul_le_card_mul_mul_card_div #align finset.card_add_mul_le_card_add_mul_card_sub Finset.card_add_mul_le_card_add_mul_card_sub set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 @[to_additive]
Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean
92
118
theorem mul_pluennecke_petridis (C : Finset α) (hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card) : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card := by
induction' C using Finset.induction_on with x C _ ih · simp set A' := A ∩ (A * C / {x}) with hA' set C' := insert x C with hC' have h₀ : A' * {x} = A * {x} ∩ (A * C) := by rw [hA', inter_mul_singleton, (isUnit_singleton x).div_mul_cancel] have h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x}) := by rw [hC', insert_eq, union_comm, mul_union] refine (sup_sdiff_eq_sup ?_).symm rw [mul_right_comm, mul_right_comm A, h₀] exact mul_subset_mul_right inter_subset_right have h₂ : A' * B * {x} ⊆ A * B * {x} := mul_subset_mul_right (mul_subset_mul_right inter_subset_left) have h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card := by rw [h₁] refine (card_union_le _ _).trans_eq ?_ rw [card_sdiff h₂, ← add_tsub_assoc_of_le (card_le_card h₂), card_mul_singleton, card_mul_singleton] refine (mul_le_mul_right' h₃ _).trans ?_ rw [tsub_mul, add_mul] refine (tsub_le_tsub (add_le_add_right ih _) <| hA _ inter_subset_left).trans_eq ?_ rw [← mul_add, ← mul_tsub, ← hA', hC', insert_eq, mul_union, ← card_mul_singleton A x, ← card_mul_singleton A' x, add_comm (card _), h₀, eq_tsub_of_add_eq (card_union_add_card_inter _ _)]
import Mathlib.RingTheory.Polynomial.Hermite.Basic import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Analysis.SpecialFunctions.ExpDeriv #align_import ring_theory.polynomial.hermite.gaussian from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Polynomial namespace Polynomial
Mathlib/RingTheory/Polynomial/Hermite/Gaussian.lean
40
55
theorem deriv_gaussian_eq_hermite_mul_gaussian (n : ℕ) (x : ℝ) : deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x = (-1 : ℝ) ^ n * aeval x (hermite n) * Real.exp (-(x ^ 2 / 2)) := by
rw [mul_assoc] induction' n with n ih generalizing x · rw [Function.iterate_zero_apply, pow_zero, one_mul, hermite_zero, C_1, map_one, one_mul] · replace ih : deriv^[n] _ = _ := _root_.funext ih have deriv_gaussian : deriv (fun y => Real.exp (-(y ^ 2 / 2))) x = -x * Real.exp (-(x ^ 2 / 2)) := by -- porting note (#10745): was `simp [mul_comm, ← neg_mul]` rw [deriv_exp (by simp)]; simp; ring rw [Function.iterate_succ_apply', ih, deriv_const_mul_field, deriv_mul, pow_succ (-1 : ℝ), deriv_gaussian, hermite_succ, map_sub, map_mul, aeval_X, Polynomial.deriv_aeval] · ring · apply Polynomial.differentiable_aeval · apply DifferentiableAt.exp; simp -- Porting note: was just `simp`
import Mathlib.Algebra.QuadraticDiscriminant import Mathlib.Analysis.Convex.SpecificFunctions.Deriv import Mathlib.Analysis.SpecialFunctions.Pow.Complex #align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section namespace Complex open Set Filter open scoped Real theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul, add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub] ring_nf rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm] refine exists_congr fun x => ?_ refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero) field_simp; ring #align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by rw [← not_exists, not_iff_not, cos_eq_zero_iff] #align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff] constructor · rintro ⟨k, hk⟩ use k + 1 field_simp [eq_add_of_sub_eq hk] ring · rintro ⟨k, rfl⟩ use k - 1 field_simp ring #align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by rw [← not_exists, not_iff_not, sin_eq_zero_iff] #align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero, ← mul_assoc, ← sin_two_mul, sin_eq_zero_iff] field_simp [mul_comm, eq_comm] #align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by rw [← not_exists, not_iff_not, tan_eq_zero_iff] #align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 := tan_eq_zero_iff.mpr (by use n) #align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm] theorem cos_eq_cos_iff {x y : ℂ} : cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := calc cos x = cos y ↔ cos x - cos y = 0 := sub_eq_zero.symm _ ↔ -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by rw [cos_sub_cos] _ ↔ sin ((x + y) / 2) = 0 ∨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : ℂ) ≠ 0)] _ ↔ sin ((x - y) / 2) = 0 ∨ sin ((x + y) / 2) = 0 := or_comm _ ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ ∃ k : ℤ, y = 2 * k * π - x := by apply or_congr <;> field_simp [sin_eq_zero_iff, (by norm_num : -(2 : ℂ) ≠ 0), eq_sub_iff_add_eq', sub_eq_iff_eq_add, mul_comm (2 : ℂ), mul_right_comm _ (2 : ℂ)] constructor <;> · rintro ⟨k, rfl⟩; use -k; simp _ ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := exists_or.symm #align complex.cos_eq_cos_iff Complex.cos_eq_cos_iff theorem sin_eq_sin_iff {x y : ℂ} : sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1) * π - x := by simp only [← Complex.cos_sub_pi_div_two, cos_eq_cos_iff, sub_eq_iff_eq_add] refine exists_congr fun k => or_congr ?_ ?_ <;> refine Eq.congr rfl ?_ <;> field_simp <;> ring #align complex.sin_eq_sin_iff Complex.sin_eq_sin_iff
Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean
110
112
theorem cos_eq_one_iff {x : ℂ} : cos x = 1 ↔ ∃ k : ℤ, k * (2 * π) = x := by
rw [← cos_zero, eq_comm, cos_eq_cos_iff] simp [mul_assoc, mul_left_comm, eq_comm]
import Mathlib.Topology.Algebra.Polynomial import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Topology.UnitInterval import Mathlib.Algebra.Star.Subalgebra #align_import topology.continuous_function.polynomial from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" variable {R : Type*} open Polynomial namespace Polynomial section variable [Semiring R] [TopologicalSpace R] [TopologicalSemiring R] @[simps] def toContinuousMap (p : R[X]) : C(R, R) := ⟨fun x : R => p.eval x, by fun_prop⟩ #align polynomial.to_continuous_map Polynomial.toContinuousMap open ContinuousMap in lemma toContinuousMap_X_eq_id : X.toContinuousMap = .id R := by ext; simp @[simps] def toContinuousMapOn (p : R[X]) (X : Set R) : C(X, R) := -- Porting note: Old proof was `⟨fun x : X => p.toContinuousMap x, by continuity⟩` ⟨fun x : X => p.toContinuousMap x, Continuous.comp (by continuity) (by continuity)⟩ #align polynomial.to_continuous_map_on Polynomial.toContinuousMapOn open ContinuousMap in lemma toContinuousMapOn_X_eq_restrict_id (s : Set R) : X.toContinuousMapOn s = restrict s (.id R) := by ext; simp -- TODO some lemmas about when `toContinuousMapOn` is injective? end section variable {α : Type*} [TopologicalSpace α] [CommSemiring R] [TopologicalSpace R] [TopologicalSemiring R] @[simp]
Mathlib/Topology/ContinuousFunction/Polynomial.lean
76
82
theorem aeval_continuousMap_apply (g : R[X]) (f : C(α, R)) (x : α) : ((Polynomial.aeval f) g) x = g.eval (f x) := by
refine Polynomial.induction_on' g ?_ ?_ · intro p q hp hq simp [hp, hq] · intro n a simp [Pi.pow_apply]
import Mathlib.Combinatorics.SimpleGraph.Finite import Mathlib.Combinatorics.SimpleGraph.Maps #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" universe u v namespace SimpleGraph @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := s(v, w) = s(a, b) adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by apply_fun fun e ↦ a ∈ e at h simp only [Sym2.mem_iff, true_or, eq_iff_iff, iff_true] at h exact h #align simple_graph.subgraph_of_adj SimpleGraph.subgraphOfAdj namespace Subgraph variable {G : SimpleGraph V} {G₁ G₂ : G.Subgraph} {a b : V} protected theorem loopless (G' : Subgraph G) : Irreflexive G'.Adj := fun v h ↦ G.loopless v (G'.adj_sub h) #align simple_graph.subgraph.loopless SimpleGraph.Subgraph.loopless theorem adj_comm (G' : Subgraph G) (v w : V) : G'.Adj v w ↔ G'.Adj w v := ⟨fun x ↦ G'.symm x, fun x ↦ G'.symm x⟩ #align simple_graph.subgraph.adj_comm SimpleGraph.Subgraph.adj_comm @[symm] theorem adj_symm (G' : Subgraph G) {u v : V} (h : G'.Adj u v) : G'.Adj v u := G'.symm h #align simple_graph.subgraph.adj_symm SimpleGraph.Subgraph.adj_symm protected theorem Adj.symm {G' : Subgraph G} {u v : V} (h : G'.Adj u v) : G'.Adj v u := G'.symm h #align simple_graph.subgraph.adj.symm SimpleGraph.Subgraph.Adj.symm protected theorem Adj.adj_sub {H : G.Subgraph} {u v : V} (h : H.Adj u v) : G.Adj u v := H.adj_sub h #align simple_graph.subgraph.adj.adj_sub SimpleGraph.Subgraph.Adj.adj_sub protected theorem Adj.fst_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ∈ H.verts := H.edge_vert h #align simple_graph.subgraph.adj.fst_mem SimpleGraph.Subgraph.Adj.fst_mem protected theorem Adj.snd_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : v ∈ H.verts := h.symm.fst_mem #align simple_graph.subgraph.adj.snd_mem SimpleGraph.Subgraph.Adj.snd_mem protected theorem Adj.ne {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ≠ v := h.adj_sub.ne #align simple_graph.subgraph.adj.ne SimpleGraph.Subgraph.Adj.ne @[simps] protected def coe (G' : Subgraph G) : SimpleGraph G'.verts where Adj v w := G'.Adj v w symm _ _ h := G'.symm h loopless v h := loopless G v (G'.adj_sub h) #align simple_graph.subgraph.coe SimpleGraph.Subgraph.coe @[simp] theorem coe_adj_sub (G' : Subgraph G) (u v : G'.verts) (h : G'.coe.Adj u v) : G.Adj u v := G'.adj_sub h #align simple_graph.subgraph.coe_adj_sub SimpleGraph.Subgraph.coe_adj_sub -- Given `h : H.Adj u v`, then `h.coe : H.coe.Adj ⟨u, _⟩ ⟨v, _⟩`. protected theorem Adj.coe {H : G.Subgraph} {u v : V} (h : H.Adj u v) : H.coe.Adj ⟨u, H.edge_vert h⟩ ⟨v, H.edge_vert h.symm⟩ := h #align simple_graph.subgraph.adj.coe SimpleGraph.Subgraph.Adj.coe def IsSpanning (G' : Subgraph G) : Prop := ∀ v : V, v ∈ G'.verts #align simple_graph.subgraph.is_spanning SimpleGraph.Subgraph.IsSpanning theorem isSpanning_iff {G' : Subgraph G} : G'.IsSpanning ↔ G'.verts = Set.univ := Set.eq_univ_iff_forall.symm #align simple_graph.subgraph.is_spanning_iff SimpleGraph.Subgraph.isSpanning_iff @[simps] protected def spanningCoe (G' : Subgraph G) : SimpleGraph V where Adj := G'.Adj symm := G'.symm loopless v hv := G.loopless v (G'.adj_sub hv) #align simple_graph.subgraph.spanning_coe SimpleGraph.Subgraph.spanningCoe @[simp] theorem Adj.of_spanningCoe {G' : Subgraph G} {u v : G'.verts} (h : G'.spanningCoe.Adj u v) : G.Adj u v := G'.adj_sub h #align simple_graph.subgraph.adj.of_spanning_coe SimpleGraph.Subgraph.Adj.of_spanningCoe theorem spanningCoe_inj : G₁.spanningCoe = G₂.spanningCoe ↔ G₁.Adj = G₂.Adj := by simp [Subgraph.spanningCoe] #align simple_graph.subgraph.spanning_coe_inj SimpleGraph.Subgraph.spanningCoe_inj @[simps] def spanningCoeEquivCoeOfSpanning (G' : Subgraph G) (h : G'.IsSpanning) : G'.spanningCoe ≃g G'.coe where toFun v := ⟨v, h v⟩ invFun v := v left_inv _ := rfl right_inv _ := rfl map_rel_iff' := Iff.rfl #align simple_graph.subgraph.spanning_coe_equiv_coe_of_spanning SimpleGraph.Subgraph.spanningCoeEquivCoeOfSpanning def IsInduced (G' : Subgraph G) : Prop := ∀ {v w : V}, v ∈ G'.verts → w ∈ G'.verts → G.Adj v w → G'.Adj v w #align simple_graph.subgraph.is_induced SimpleGraph.Subgraph.IsInduced def support (H : Subgraph G) : Set V := Rel.dom H.Adj #align simple_graph.subgraph.support SimpleGraph.Subgraph.support theorem mem_support (H : Subgraph G) {v : V} : v ∈ H.support ↔ ∃ w, H.Adj v w := Iff.rfl #align simple_graph.subgraph.mem_support SimpleGraph.Subgraph.mem_support theorem support_subset_verts (H : Subgraph G) : H.support ⊆ H.verts := fun _ ⟨_, h⟩ ↦ H.edge_vert h #align simple_graph.subgraph.support_subset_verts SimpleGraph.Subgraph.support_subset_verts def neighborSet (G' : Subgraph G) (v : V) : Set V := {w | G'.Adj v w} #align simple_graph.subgraph.neighbor_set SimpleGraph.Subgraph.neighborSet theorem neighborSet_subset (G' : Subgraph G) (v : V) : G'.neighborSet v ⊆ G.neighborSet v := fun _ ↦ G'.adj_sub #align simple_graph.subgraph.neighbor_set_subset SimpleGraph.Subgraph.neighborSet_subset theorem neighborSet_subset_verts (G' : Subgraph G) (v : V) : G'.neighborSet v ⊆ G'.verts := fun _ h ↦ G'.edge_vert (adj_symm G' h) #align simple_graph.subgraph.neighbor_set_subset_verts SimpleGraph.Subgraph.neighborSet_subset_verts @[simp] theorem mem_neighborSet (G' : Subgraph G) (v w : V) : w ∈ G'.neighborSet v ↔ G'.Adj v w := Iff.rfl #align simple_graph.subgraph.mem_neighbor_set SimpleGraph.Subgraph.mem_neighborSet def coeNeighborSetEquiv {G' : Subgraph G} (v : G'.verts) : G'.coe.neighborSet v ≃ G'.neighborSet v where toFun w := ⟨w, w.2⟩ invFun w := ⟨⟨w, G'.edge_vert (G'.adj_symm w.2)⟩, w.2⟩ left_inv _ := rfl right_inv _ := rfl #align simple_graph.subgraph.coe_neighbor_set_equiv SimpleGraph.Subgraph.coeNeighborSetEquiv def edgeSet (G' : Subgraph G) : Set (Sym2 V) := Sym2.fromRel G'.symm #align simple_graph.subgraph.edge_set SimpleGraph.Subgraph.edgeSet theorem edgeSet_subset (G' : Subgraph G) : G'.edgeSet ⊆ G.edgeSet := Sym2.ind (fun _ _ ↦ G'.adj_sub) #align simple_graph.subgraph.edge_set_subset SimpleGraph.Subgraph.edgeSet_subset @[simp] theorem mem_edgeSet {G' : Subgraph G} {v w : V} : s(v, w) ∈ G'.edgeSet ↔ G'.Adj v w := Iff.rfl #align simple_graph.subgraph.mem_edge_set SimpleGraph.Subgraph.mem_edgeSet theorem mem_verts_if_mem_edge {G' : Subgraph G} {e : Sym2 V} {v : V} (he : e ∈ G'.edgeSet) (hv : v ∈ e) : v ∈ G'.verts := by revert hv refine Sym2.ind (fun v w he ↦ ?_) e he intro hv rcases Sym2.mem_iff.mp hv with (rfl | rfl) · exact G'.edge_vert he · exact G'.edge_vert (G'.symm he) #align simple_graph.subgraph.mem_verts_if_mem_edge SimpleGraph.Subgraph.mem_verts_if_mem_edge def incidenceSet (G' : Subgraph G) (v : V) : Set (Sym2 V) := {e ∈ G'.edgeSet | v ∈ e} #align simple_graph.subgraph.incidence_set SimpleGraph.Subgraph.incidenceSet theorem incidenceSet_subset_incidenceSet (G' : Subgraph G) (v : V) : G'.incidenceSet v ⊆ G.incidenceSet v := fun _ h ↦ ⟨G'.edgeSet_subset h.1, h.2⟩ #align simple_graph.subgraph.incidence_set_subset_incidence_set SimpleGraph.Subgraph.incidenceSet_subset_incidenceSet theorem incidenceSet_subset (G' : Subgraph G) (v : V) : G'.incidenceSet v ⊆ G'.edgeSet := fun _ h ↦ h.1 #align simple_graph.subgraph.incidence_set_subset SimpleGraph.Subgraph.incidenceSet_subset abbrev vert (G' : Subgraph G) (v : V) (h : v ∈ G'.verts) : G'.verts := ⟨v, h⟩ #align simple_graph.subgraph.vert SimpleGraph.Subgraph.vert def copy (G' : Subgraph G) (V'' : Set V) (hV : V'' = G'.verts) (adj' : V → V → Prop) (hadj : adj' = G'.Adj) : Subgraph G where verts := V'' Adj := adj' adj_sub := hadj.symm ▸ G'.adj_sub edge_vert := hV.symm ▸ hadj.symm ▸ G'.edge_vert symm := hadj.symm ▸ G'.symm #align simple_graph.subgraph.copy SimpleGraph.Subgraph.copy theorem copy_eq (G' : Subgraph G) (V'' : Set V) (hV : V'' = G'.verts) (adj' : V → V → Prop) (hadj : adj' = G'.Adj) : G'.copy V'' hV adj' hadj = G' := Subgraph.ext _ _ hV hadj #align simple_graph.subgraph.copy_eq SimpleGraph.Subgraph.copy_eq instance : Sup G.Subgraph where sup G₁ G₂ := { verts := G₁.verts ∪ G₂.verts Adj := G₁.Adj ⊔ G₂.Adj adj_sub := fun hab => Or.elim hab (fun h => G₁.adj_sub h) fun h => G₂.adj_sub h edge_vert := Or.imp (fun h => G₁.edge_vert h) fun h => G₂.edge_vert h symm := fun _ _ => Or.imp G₁.adj_symm G₂.adj_symm } instance : Inf G.Subgraph where inf G₁ G₂ := { verts := G₁.verts ∩ G₂.verts Adj := G₁.Adj ⊓ G₂.Adj adj_sub := fun hab => G₁.adj_sub hab.1 edge_vert := And.imp (fun h => G₁.edge_vert h) fun h => G₂.edge_vert h symm := fun _ _ => And.imp G₁.adj_symm G₂.adj_symm } instance : Top G.Subgraph where top := { verts := Set.univ Adj := G.Adj adj_sub := id edge_vert := @fun v _ _ => Set.mem_univ v symm := G.symm } instance : Bot G.Subgraph where bot := { verts := ∅ Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm := fun _ _ => id } instance : SupSet G.Subgraph where sSup s := { verts := ⋃ G' ∈ s, verts G' Adj := fun a b => ∃ G' ∈ s, Adj G' a b adj_sub := by rintro a b ⟨G', -, hab⟩ exact G'.adj_sub hab edge_vert := by rintro a b ⟨G', hG', hab⟩ exact Set.mem_iUnion₂_of_mem hG' (G'.edge_vert hab) symm := fun a b h => by simpa [adj_comm] using h } instance : InfSet G.Subgraph where sInf s := { verts := ⋂ G' ∈ s, verts G' Adj := fun a b => (∀ ⦃G'⦄, G' ∈ s → Adj G' a b) ∧ G.Adj a b adj_sub := And.right edge_vert := fun hab => Set.mem_iInter₂_of_mem fun G' hG' => G'.edge_vert <| hab.1 hG' symm := fun _ _ => And.imp (forall₂_imp fun _ _ => Adj.symm) G.adj_symm } @[simp] theorem sup_adj : (G₁ ⊔ G₂).Adj a b ↔ G₁.Adj a b ∨ G₂.Adj a b := Iff.rfl #align simple_graph.subgraph.sup_adj SimpleGraph.Subgraph.sup_adj @[simp] theorem inf_adj : (G₁ ⊓ G₂).Adj a b ↔ G₁.Adj a b ∧ G₂.Adj a b := Iff.rfl #align simple_graph.subgraph.inf_adj SimpleGraph.Subgraph.inf_adj @[simp] theorem top_adj : (⊤ : Subgraph G).Adj a b ↔ G.Adj a b := Iff.rfl #align simple_graph.subgraph.top_adj SimpleGraph.Subgraph.top_adj @[simp] theorem not_bot_adj : ¬ (⊥ : Subgraph G).Adj a b := not_false #align simple_graph.subgraph.not_bot_adj SimpleGraph.Subgraph.not_bot_adj @[simp] theorem verts_sup (G₁ G₂ : G.Subgraph) : (G₁ ⊔ G₂).verts = G₁.verts ∪ G₂.verts := rfl #align simple_graph.subgraph.verts_sup SimpleGraph.Subgraph.verts_sup @[simp] theorem verts_inf (G₁ G₂ : G.Subgraph) : (G₁ ⊓ G₂).verts = G₁.verts ∩ G₂.verts := rfl #align simple_graph.subgraph.verts_inf SimpleGraph.Subgraph.verts_inf @[simp] theorem verts_top : (⊤ : G.Subgraph).verts = Set.univ := rfl #align simple_graph.subgraph.verts_top SimpleGraph.Subgraph.verts_top @[simp] theorem verts_bot : (⊥ : G.Subgraph).verts = ∅ := rfl #align simple_graph.subgraph.verts_bot SimpleGraph.Subgraph.verts_bot @[simp] theorem sSup_adj {s : Set G.Subgraph} : (sSup s).Adj a b ↔ ∃ G ∈ s, Adj G a b := Iff.rfl #align simple_graph.subgraph.Sup_adj SimpleGraph.Subgraph.sSup_adj @[simp] theorem sInf_adj {s : Set G.Subgraph} : (sInf s).Adj a b ↔ (∀ G' ∈ s, Adj G' a b) ∧ G.Adj a b := Iff.rfl #align simple_graph.subgraph.Inf_adj SimpleGraph.Subgraph.sInf_adj @[simp] theorem iSup_adj {f : ι → G.Subgraph} : (⨆ i, f i).Adj a b ↔ ∃ i, (f i).Adj a b := by simp [iSup] #align simple_graph.subgraph.supr_adj SimpleGraph.Subgraph.iSup_adj @[simp] theorem iInf_adj {f : ι → G.Subgraph} : (⨅ i, f i).Adj a b ↔ (∀ i, (f i).Adj a b) ∧ G.Adj a b := by simp [iInf] #align simple_graph.subgraph.infi_adj SimpleGraph.Subgraph.iInf_adj theorem sInf_adj_of_nonempty {s : Set G.Subgraph} (hs : s.Nonempty) : (sInf s).Adj a b ↔ ∀ G' ∈ s, Adj G' a b := sInf_adj.trans <| and_iff_left_of_imp <| by obtain ⟨G', hG'⟩ := hs exact fun h => G'.adj_sub (h _ hG') #align simple_graph.subgraph.Inf_adj_of_nonempty SimpleGraph.Subgraph.sInf_adj_of_nonempty theorem iInf_adj_of_nonempty [Nonempty ι] {f : ι → G.Subgraph} : (⨅ i, f i).Adj a b ↔ ∀ i, (f i).Adj a b := by rw [iInf, sInf_adj_of_nonempty (Set.range_nonempty _)] simp #align simple_graph.subgraph.infi_adj_of_nonempty SimpleGraph.Subgraph.iInf_adj_of_nonempty @[simp] theorem verts_sSup (s : Set G.Subgraph) : (sSup s).verts = ⋃ G' ∈ s, verts G' := rfl #align simple_graph.subgraph.verts_Sup SimpleGraph.Subgraph.verts_sSup @[simp] theorem verts_sInf (s : Set G.Subgraph) : (sInf s).verts = ⋂ G' ∈ s, verts G' := rfl #align simple_graph.subgraph.verts_Inf SimpleGraph.Subgraph.verts_sInf @[simp] theorem verts_iSup {f : ι → G.Subgraph} : (⨆ i, f i).verts = ⋃ i, (f i).verts := by simp [iSup] #align simple_graph.subgraph.verts_supr SimpleGraph.Subgraph.verts_iSup @[simp] theorem verts_iInf {f : ι → G.Subgraph} : (⨅ i, f i).verts = ⋂ i, (f i).verts := by simp [iInf] #align simple_graph.subgraph.verts_infi SimpleGraph.Subgraph.verts_iInf theorem verts_spanningCoe_injective : (fun G' : Subgraph G => (G'.verts, G'.spanningCoe)).Injective := by intro G₁ G₂ h rw [Prod.ext_iff] at h exact Subgraph.ext _ _ h.1 (spanningCoe_inj.1 h.2) instance distribLattice : DistribLattice G.Subgraph := { show DistribLattice G.Subgraph from verts_spanningCoe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl with le := fun x y => x.verts ⊆ y.verts ∧ ∀ ⦃v w : V⦄, x.Adj v w → y.Adj v w } instance : BoundedOrder (Subgraph G) where top := ⊤ bot := ⊥ le_top x := ⟨Set.subset_univ _, fun _ _ => x.adj_sub⟩ bot_le _ := ⟨Set.empty_subset _, fun _ _ => False.elim⟩ -- Note that subgraphs do not form a Boolean algebra, because of `verts`. instance : CompletelyDistribLattice G.Subgraph := { Subgraph.distribLattice with le := (· ≤ ·) sup := (· ⊔ ·) inf := (· ⊓ ·) top := ⊤ bot := ⊥ le_top := fun G' => ⟨Set.subset_univ _, fun a b => G'.adj_sub⟩ bot_le := fun G' => ⟨Set.empty_subset _, fun a b => False.elim⟩ sSup := sSup -- Porting note: needed `apply` here to modify elaboration; previously the term itself was fine. le_sSup := fun s G' hG' => ⟨by apply Set.subset_iUnion₂ G' hG', fun a b hab => ⟨G', hG', hab⟩⟩ sSup_le := fun s G' hG' => ⟨Set.iUnion₂_subset fun H hH => (hG' _ hH).1, by rintro a b ⟨H, hH, hab⟩ exact (hG' _ hH).2 hab⟩ sInf := sInf sInf_le := fun s G' hG' => ⟨Set.iInter₂_subset G' hG', fun a b hab => hab.1 hG'⟩ le_sInf := fun s G' hG' => ⟨Set.subset_iInter₂ fun H hH => (hG' _ hH).1, fun a b hab => ⟨fun H hH => (hG' _ hH).2 hab, G'.adj_sub hab⟩⟩ iInf_iSup_eq := fun f => Subgraph.ext _ _ (by simpa using iInf_iSup_eq) (by ext; simp [Classical.skolem]) } @[simps] instance subgraphInhabited : Inhabited (Subgraph G) := ⟨⊥⟩ #align simple_graph.subgraph.subgraph_inhabited SimpleGraph.Subgraph.subgraphInhabited @[simp] theorem neighborSet_sup {H H' : G.Subgraph} (v : V) : (H ⊔ H').neighborSet v = H.neighborSet v ∪ H'.neighborSet v := rfl #align simple_graph.subgraph.neighbor_set_sup SimpleGraph.Subgraph.neighborSet_sup @[simp] theorem neighborSet_inf {H H' : G.Subgraph} (v : V) : (H ⊓ H').neighborSet v = H.neighborSet v ∩ H'.neighborSet v := rfl #align simple_graph.subgraph.neighbor_set_inf SimpleGraph.Subgraph.neighborSet_inf @[simp] theorem neighborSet_top (v : V) : (⊤ : G.Subgraph).neighborSet v = G.neighborSet v := rfl #align simple_graph.subgraph.neighbor_set_top SimpleGraph.Subgraph.neighborSet_top @[simp] theorem neighborSet_bot (v : V) : (⊥ : G.Subgraph).neighborSet v = ∅ := rfl #align simple_graph.subgraph.neighbor_set_bot SimpleGraph.Subgraph.neighborSet_bot @[simp] theorem neighborSet_sSup (s : Set G.Subgraph) (v : V) : (sSup s).neighborSet v = ⋃ G' ∈ s, neighborSet G' v := by ext simp #align simple_graph.subgraph.neighbor_set_Sup SimpleGraph.Subgraph.neighborSet_sSup @[simp] theorem neighborSet_sInf (s : Set G.Subgraph) (v : V) : (sInf s).neighborSet v = (⋂ G' ∈ s, neighborSet G' v) ∩ G.neighborSet v := by ext simp #align simple_graph.subgraph.neighbor_set_Inf SimpleGraph.Subgraph.neighborSet_sInf @[simp] theorem neighborSet_iSup (f : ι → G.Subgraph) (v : V) : (⨆ i, f i).neighborSet v = ⋃ i, (f i).neighborSet v := by simp [iSup] #align simple_graph.subgraph.neighbor_set_supr SimpleGraph.Subgraph.neighborSet_iSup @[simp] theorem neighborSet_iInf (f : ι → G.Subgraph) (v : V) : (⨅ i, f i).neighborSet v = (⋂ i, (f i).neighborSet v) ∩ G.neighborSet v := by simp [iInf] #align simple_graph.subgraph.neighbor_set_infi SimpleGraph.Subgraph.neighborSet_iInf @[simp] theorem edgeSet_top : (⊤ : Subgraph G).edgeSet = G.edgeSet := rfl #align simple_graph.subgraph.edge_set_top SimpleGraph.Subgraph.edgeSet_top @[simp] theorem edgeSet_bot : (⊥ : Subgraph G).edgeSet = ∅ := Set.ext <| Sym2.ind (by simp) #align simple_graph.subgraph.edge_set_bot SimpleGraph.Subgraph.edgeSet_bot @[simp] theorem edgeSet_inf {H₁ H₂ : Subgraph G} : (H₁ ⊓ H₂).edgeSet = H₁.edgeSet ∩ H₂.edgeSet := Set.ext <| Sym2.ind (by simp) #align simple_graph.subgraph.edge_set_inf SimpleGraph.Subgraph.edgeSet_inf @[simp] theorem edgeSet_sup {H₁ H₂ : Subgraph G} : (H₁ ⊔ H₂).edgeSet = H₁.edgeSet ∪ H₂.edgeSet := Set.ext <| Sym2.ind (by simp) #align simple_graph.subgraph.edge_set_sup SimpleGraph.Subgraph.edgeSet_sup @[simp] theorem edgeSet_sSup (s : Set G.Subgraph) : (sSup s).edgeSet = ⋃ G' ∈ s, edgeSet G' := by ext e induction e using Sym2.ind simp #align simple_graph.subgraph.edge_set_Sup SimpleGraph.Subgraph.edgeSet_sSup @[simp]
Mathlib/Combinatorics/SimpleGraph/Subgraph.lean
557
561
theorem edgeSet_sInf (s : Set G.Subgraph) : (sInf s).edgeSet = (⋂ G' ∈ s, edgeSet G') ∩ G.edgeSet := by
ext e induction e using Sym2.ind simp
import Mathlib.CategoryTheory.NatIso #align_import category_theory.bicategory.basic from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" namespace CategoryTheory universe w v u open Category Iso -- intended to be used with explicit universe parameters @[nolint checkUnivs] class Bicategory (B : Type u) extends CategoryStruct.{v} B where -- category structure on the collection of 1-morphisms: homCategory : ∀ a b : B, Category.{w} (a ⟶ b) := by infer_instance -- left whiskering: whiskerLeft {a b c : B} (f : a ⟶ b) {g h : b ⟶ c} (η : g ⟶ h) : f ≫ g ⟶ f ≫ h -- right whiskering: whiskerRight {a b c : B} {f g : a ⟶ b} (η : f ⟶ g) (h : b ⟶ c) : f ≫ h ⟶ g ≫ h -- associator: associator {a b c d : B} (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) : (f ≫ g) ≫ h ≅ f ≫ g ≫ h -- left unitor: leftUnitor {a b : B} (f : a ⟶ b) : 𝟙 a ≫ f ≅ f -- right unitor: rightUnitor {a b : B} (f : a ⟶ b) : f ≫ 𝟙 b ≅ f -- axioms for left whiskering: whiskerLeft_id : ∀ {a b c} (f : a ⟶ b) (g : b ⟶ c), whiskerLeft f (𝟙 g) = 𝟙 (f ≫ g) := by aesop_cat whiskerLeft_comp : ∀ {a b c} (f : a ⟶ b) {g h i : b ⟶ c} (η : g ⟶ h) (θ : h ⟶ i), whiskerLeft f (η ≫ θ) = whiskerLeft f η ≫ whiskerLeft f θ := by aesop_cat id_whiskerLeft : ∀ {a b} {f g : a ⟶ b} (η : f ⟶ g), whiskerLeft (𝟙 a) η = (leftUnitor f).hom ≫ η ≫ (leftUnitor g).inv := by aesop_cat comp_whiskerLeft : ∀ {a b c d} (f : a ⟶ b) (g : b ⟶ c) {h h' : c ⟶ d} (η : h ⟶ h'), whiskerLeft (f ≫ g) η = (associator f g h).hom ≫ whiskerLeft f (whiskerLeft g η) ≫ (associator f g h').inv := by aesop_cat -- axioms for right whiskering: id_whiskerRight : ∀ {a b c} (f : a ⟶ b) (g : b ⟶ c), whiskerRight (𝟙 f) g = 𝟙 (f ≫ g) := by aesop_cat comp_whiskerRight : ∀ {a b c} {f g h : a ⟶ b} (η : f ⟶ g) (θ : g ⟶ h) (i : b ⟶ c), whiskerRight (η ≫ θ) i = whiskerRight η i ≫ whiskerRight θ i := by aesop_cat whiskerRight_id : ∀ {a b} {f g : a ⟶ b} (η : f ⟶ g), whiskerRight η (𝟙 b) = (rightUnitor f).hom ≫ η ≫ (rightUnitor g).inv := by aesop_cat whiskerRight_comp : ∀ {a b c d} {f f' : a ⟶ b} (η : f ⟶ f') (g : b ⟶ c) (h : c ⟶ d), whiskerRight η (g ≫ h) = (associator f g h).inv ≫ whiskerRight (whiskerRight η g) h ≫ (associator f' g h).hom := by aesop_cat -- associativity of whiskerings: whisker_assoc : ∀ {a b c d} (f : a ⟶ b) {g g' : b ⟶ c} (η : g ⟶ g') (h : c ⟶ d), whiskerRight (whiskerLeft f η) h = (associator f g h).hom ≫ whiskerLeft f (whiskerRight η h) ≫ (associator f g' h).inv := by aesop_cat -- exchange law of left and right whiskerings: whisker_exchange : ∀ {a b c} {f g : a ⟶ b} {h i : b ⟶ c} (η : f ⟶ g) (θ : h ⟶ i), whiskerLeft f θ ≫ whiskerRight η i = whiskerRight η h ≫ whiskerLeft g θ := by aesop_cat -- pentagon identity: pentagon : ∀ {a b c d e} (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e), whiskerRight (associator f g h).hom i ≫ (associator f (g ≫ h) i).hom ≫ whiskerLeft f (associator g h i).hom = (associator (f ≫ g) h i).hom ≫ (associator f g (h ≫ i)).hom := by aesop_cat -- triangle identity: triangle : ∀ {a b c} (f : a ⟶ b) (g : b ⟶ c), (associator f (𝟙 b) g).hom ≫ whiskerLeft f (leftUnitor g).hom = whiskerRight (rightUnitor f).hom g := by aesop_cat #align category_theory.bicategory CategoryTheory.Bicategory #align category_theory.bicategory.hom_category CategoryTheory.Bicategory.homCategory #align category_theory.bicategory.whisker_left CategoryTheory.Bicategory.whiskerLeft #align category_theory.bicategory.whisker_right CategoryTheory.Bicategory.whiskerRight #align category_theory.bicategory.left_unitor CategoryTheory.Bicategory.leftUnitor #align category_theory.bicategory.right_unitor CategoryTheory.Bicategory.rightUnitor #align category_theory.bicategory.whisker_left_id' CategoryTheory.Bicategory.whiskerLeft_id #align category_theory.bicategory.whisker_left_comp' CategoryTheory.Bicategory.whiskerLeft_comp #align category_theory.bicategory.id_whisker_left' CategoryTheory.Bicategory.id_whiskerLeft #align category_theory.bicategory.comp_whisker_left' CategoryTheory.Bicategory.comp_whiskerLeft #align category_theory.bicategory.id_whisker_right' CategoryTheory.Bicategory.id_whiskerRight #align category_theory.bicategory.comp_whisker_right' CategoryTheory.Bicategory.comp_whiskerRight #align category_theory.bicategory.whisker_right_id' CategoryTheory.Bicategory.whiskerRight_id #align category_theory.bicategory.whisker_right_comp' CategoryTheory.Bicategory.whiskerRight_comp #align category_theory.bicategory.whisker_assoc' CategoryTheory.Bicategory.whisker_assoc #align category_theory.bicategory.whisker_exchange' CategoryTheory.Bicategory.whisker_exchange #align category_theory.bicategory.pentagon' CategoryTheory.Bicategory.pentagon #align category_theory.bicategory.triangle' CategoryTheory.Bicategory.triangle namespace Bicategory scoped infixr:81 " ◁ " => Bicategory.whiskerLeft scoped infixl:81 " ▷ " => Bicategory.whiskerRight scoped notation "α_" => Bicategory.associator scoped notation "λ_" => Bicategory.leftUnitor scoped notation "ρ_" => Bicategory.rightUnitor attribute [instance] homCategory attribute [reassoc] whiskerLeft_comp id_whiskerLeft comp_whiskerLeft comp_whiskerRight whiskerRight_id whiskerRight_comp whisker_assoc whisker_exchange attribute [reassoc (attr := simp)] pentagon triangle attribute [simp] whiskerLeft_id whiskerLeft_comp id_whiskerLeft comp_whiskerLeft id_whiskerRight comp_whiskerRight whiskerRight_id whiskerRight_comp whisker_assoc variable {B : Type u} [Bicategory.{w, v} B] {a b c d e : B} @[reassoc (attr := simp)] theorem whiskerLeft_hom_inv (f : a ⟶ b) {g h : b ⟶ c} (η : g ≅ h) : f ◁ η.hom ≫ f ◁ η.inv = 𝟙 (f ≫ g) := by rw [← whiskerLeft_comp, hom_inv_id, whiskerLeft_id] #align category_theory.bicategory.hom_inv_whisker_left CategoryTheory.Bicategory.whiskerLeft_hom_inv @[reassoc (attr := simp)] theorem hom_inv_whiskerRight {f g : a ⟶ b} (η : f ≅ g) (h : b ⟶ c) : η.hom ▷ h ≫ η.inv ▷ h = 𝟙 (f ≫ h) := by rw [← comp_whiskerRight, hom_inv_id, id_whiskerRight] #align category_theory.bicategory.hom_inv_whisker_right CategoryTheory.Bicategory.hom_inv_whiskerRight @[reassoc (attr := simp)] theorem whiskerLeft_inv_hom (f : a ⟶ b) {g h : b ⟶ c} (η : g ≅ h) : f ◁ η.inv ≫ f ◁ η.hom = 𝟙 (f ≫ h) := by rw [← whiskerLeft_comp, inv_hom_id, whiskerLeft_id] #align category_theory.bicategory.inv_hom_whisker_left CategoryTheory.Bicategory.whiskerLeft_inv_hom @[reassoc (attr := simp)] theorem inv_hom_whiskerRight {f g : a ⟶ b} (η : f ≅ g) (h : b ⟶ c) : η.inv ▷ h ≫ η.hom ▷ h = 𝟙 (g ≫ h) := by rw [← comp_whiskerRight, inv_hom_id, id_whiskerRight] #align category_theory.bicategory.inv_hom_whisker_right CategoryTheory.Bicategory.inv_hom_whiskerRight @[simps] def whiskerLeftIso (f : a ⟶ b) {g h : b ⟶ c} (η : g ≅ h) : f ≫ g ≅ f ≫ h where hom := f ◁ η.hom inv := f ◁ η.inv #align category_theory.bicategory.whisker_left_iso CategoryTheory.Bicategory.whiskerLeftIso instance whiskerLeft_isIso (f : a ⟶ b) {g h : b ⟶ c} (η : g ⟶ h) [IsIso η] : IsIso (f ◁ η) := (whiskerLeftIso f (asIso η)).isIso_hom #align category_theory.bicategory.whisker_left_is_iso CategoryTheory.Bicategory.whiskerLeft_isIso @[simp] theorem inv_whiskerLeft (f : a ⟶ b) {g h : b ⟶ c} (η : g ⟶ h) [IsIso η] : inv (f ◁ η) = f ◁ inv η := by apply IsIso.inv_eq_of_hom_inv_id simp only [← whiskerLeft_comp, whiskerLeft_id, IsIso.hom_inv_id] #align category_theory.bicategory.inv_whisker_left CategoryTheory.Bicategory.inv_whiskerLeft @[simps!] def whiskerRightIso {f g : a ⟶ b} (η : f ≅ g) (h : b ⟶ c) : f ≫ h ≅ g ≫ h where hom := η.hom ▷ h inv := η.inv ▷ h #align category_theory.bicategory.whisker_right_iso CategoryTheory.Bicategory.whiskerRightIso instance whiskerRight_isIso {f g : a ⟶ b} (η : f ⟶ g) (h : b ⟶ c) [IsIso η] : IsIso (η ▷ h) := (whiskerRightIso (asIso η) h).isIso_hom #align category_theory.bicategory.whisker_right_is_iso CategoryTheory.Bicategory.whiskerRight_isIso @[simp] theorem inv_whiskerRight {f g : a ⟶ b} (η : f ⟶ g) (h : b ⟶ c) [IsIso η] : inv (η ▷ h) = inv η ▷ h := by apply IsIso.inv_eq_of_hom_inv_id simp only [← comp_whiskerRight, id_whiskerRight, IsIso.hom_inv_id] #align category_theory.bicategory.inv_whisker_right CategoryTheory.Bicategory.inv_whiskerRight @[reassoc (attr := simp)] theorem pentagon_inv (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : f ◁ (α_ g h i).inv ≫ (α_ f (g ≫ h) i).inv ≫ (α_ f g h).inv ▷ i = (α_ f g (h ≫ i)).inv ≫ (α_ (f ≫ g) h i).inv := eq_of_inv_eq_inv (by simp) #align category_theory.bicategory.pentagon_inv CategoryTheory.Bicategory.pentagon_inv @[reassoc (attr := simp)] theorem pentagon_inv_inv_hom_hom_inv (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : (α_ f (g ≫ h) i).inv ≫ (α_ f g h).inv ▷ i ≫ (α_ (f ≫ g) h i).hom = f ◁ (α_ g h i).hom ≫ (α_ f g (h ≫ i)).inv := by rw [← cancel_epi (f ◁ (α_ g h i).inv), ← cancel_mono (α_ (f ≫ g) h i).inv] simp #align category_theory.bicategory.pentagon_inv_inv_hom_hom_inv CategoryTheory.Bicategory.pentagon_inv_inv_hom_hom_inv @[reassoc (attr := simp)] theorem pentagon_inv_hom_hom_hom_inv (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : (α_ (f ≫ g) h i).inv ≫ (α_ f g h).hom ▷ i ≫ (α_ f (g ≫ h) i).hom = (α_ f g (h ≫ i)).hom ≫ f ◁ (α_ g h i).inv := eq_of_inv_eq_inv (by simp) #align category_theory.bicategory.pentagon_inv_hom_hom_hom_inv CategoryTheory.Bicategory.pentagon_inv_hom_hom_hom_inv @[reassoc (attr := simp)] theorem pentagon_hom_inv_inv_inv_inv (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : f ◁ (α_ g h i).hom ≫ (α_ f g (h ≫ i)).inv ≫ (α_ (f ≫ g) h i).inv = (α_ f (g ≫ h) i).inv ≫ (α_ f g h).inv ▷ i := by simp [← cancel_epi (f ◁ (α_ g h i).inv)] #align category_theory.bicategory.pentagon_hom_inv_inv_inv_inv CategoryTheory.Bicategory.pentagon_hom_inv_inv_inv_inv @[reassoc (attr := simp)] theorem pentagon_hom_hom_inv_hom_hom (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : (α_ (f ≫ g) h i).hom ≫ (α_ f g (h ≫ i)).hom ≫ f ◁ (α_ g h i).inv = (α_ f g h).hom ▷ i ≫ (α_ f (g ≫ h) i).hom := eq_of_inv_eq_inv (by simp) #align category_theory.bicategory.pentagon_hom_hom_inv_hom_hom CategoryTheory.Bicategory.pentagon_hom_hom_inv_hom_hom @[reassoc (attr := simp)] theorem pentagon_hom_inv_inv_inv_hom (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : (α_ f g (h ≫ i)).hom ≫ f ◁ (α_ g h i).inv ≫ (α_ f (g ≫ h) i).inv = (α_ (f ≫ g) h i).inv ≫ (α_ f g h).hom ▷ i := by rw [← cancel_epi (α_ f g (h ≫ i)).inv, ← cancel_mono ((α_ f g h).inv ▷ i)] simp #align category_theory.bicategory.pentagon_hom_inv_inv_inv_hom CategoryTheory.Bicategory.pentagon_hom_inv_inv_inv_hom @[reassoc (attr := simp)] theorem pentagon_hom_hom_inv_inv_hom (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : (α_ f (g ≫ h) i).hom ≫ f ◁ (α_ g h i).hom ≫ (α_ f g (h ≫ i)).inv = (α_ f g h).inv ▷ i ≫ (α_ (f ≫ g) h i).hom := eq_of_inv_eq_inv (by simp) #align category_theory.bicategory.pentagon_hom_hom_inv_inv_hom CategoryTheory.Bicategory.pentagon_hom_hom_inv_inv_hom @[reassoc (attr := simp)] theorem pentagon_inv_hom_hom_hom_hom (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : (α_ f g h).inv ▷ i ≫ (α_ (f ≫ g) h i).hom ≫ (α_ f g (h ≫ i)).hom = (α_ f (g ≫ h) i).hom ≫ f ◁ (α_ g h i).hom := by simp [← cancel_epi ((α_ f g h).hom ▷ i)] #align category_theory.bicategory.pentagon_inv_hom_hom_hom_hom CategoryTheory.Bicategory.pentagon_inv_hom_hom_hom_hom @[reassoc (attr := simp)] theorem pentagon_inv_inv_hom_inv_inv (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e) : (α_ f g (h ≫ i)).inv ≫ (α_ (f ≫ g) h i).inv ≫ (α_ f g h).hom ▷ i = f ◁ (α_ g h i).inv ≫ (α_ f (g ≫ h) i).inv := eq_of_inv_eq_inv (by simp) #align category_theory.bicategory.pentagon_inv_inv_hom_inv_inv CategoryTheory.Bicategory.pentagon_inv_inv_hom_inv_inv theorem triangle_assoc_comp_left (f : a ⟶ b) (g : b ⟶ c) : (α_ f (𝟙 b) g).hom ≫ f ◁ (λ_ g).hom = (ρ_ f).hom ▷ g := triangle f g #align category_theory.bicategory.triangle_assoc_comp_left CategoryTheory.Bicategory.triangle_assoc_comp_left @[reassoc (attr := simp)] theorem triangle_assoc_comp_right (f : a ⟶ b) (g : b ⟶ c) : (α_ f (𝟙 b) g).inv ≫ (ρ_ f).hom ▷ g = f ◁ (λ_ g).hom := by rw [← triangle, inv_hom_id_assoc] #align category_theory.bicategory.triangle_assoc_comp_right CategoryTheory.Bicategory.triangle_assoc_comp_right @[reassoc (attr := simp)] theorem triangle_assoc_comp_right_inv (f : a ⟶ b) (g : b ⟶ c) : (ρ_ f).inv ▷ g ≫ (α_ f (𝟙 b) g).hom = f ◁ (λ_ g).inv := by simp [← cancel_mono (f ◁ (λ_ g).hom)] #align category_theory.bicategory.triangle_assoc_comp_right_inv CategoryTheory.Bicategory.triangle_assoc_comp_right_inv @[reassoc (attr := simp)] theorem triangle_assoc_comp_left_inv (f : a ⟶ b) (g : b ⟶ c) : f ◁ (λ_ g).inv ≫ (α_ f (𝟙 b) g).inv = (ρ_ f).inv ▷ g := by simp [← cancel_mono ((ρ_ f).hom ▷ g)] #align category_theory.bicategory.triangle_assoc_comp_left_inv CategoryTheory.Bicategory.triangle_assoc_comp_left_inv @[reassoc] theorem associator_naturality_left {f f' : a ⟶ b} (η : f ⟶ f') (g : b ⟶ c) (h : c ⟶ d) : η ▷ g ▷ h ≫ (α_ f' g h).hom = (α_ f g h).hom ≫ η ▷ (g ≫ h) := by simp #align category_theory.bicategory.associator_naturality_left CategoryTheory.Bicategory.associator_naturality_left @[reassoc] theorem associator_inv_naturality_left {f f' : a ⟶ b} (η : f ⟶ f') (g : b ⟶ c) (h : c ⟶ d) : η ▷ (g ≫ h) ≫ (α_ f' g h).inv = (α_ f g h).inv ≫ η ▷ g ▷ h := by simp #align category_theory.bicategory.associator_inv_naturality_left CategoryTheory.Bicategory.associator_inv_naturality_left @[reassoc] theorem whiskerRight_comp_symm {f f' : a ⟶ b} (η : f ⟶ f') (g : b ⟶ c) (h : c ⟶ d) : η ▷ g ▷ h = (α_ f g h).hom ≫ η ▷ (g ≫ h) ≫ (α_ f' g h).inv := by simp #align category_theory.bicategory.whisker_right_comp_symm CategoryTheory.Bicategory.whiskerRight_comp_symm @[reassoc] theorem associator_naturality_middle (f : a ⟶ b) {g g' : b ⟶ c} (η : g ⟶ g') (h : c ⟶ d) : (f ◁ η) ▷ h ≫ (α_ f g' h).hom = (α_ f g h).hom ≫ f ◁ η ▷ h := by simp #align category_theory.bicategory.associator_naturality_middle CategoryTheory.Bicategory.associator_naturality_middle @[reassoc] theorem associator_inv_naturality_middle (f : a ⟶ b) {g g' : b ⟶ c} (η : g ⟶ g') (h : c ⟶ d) : f ◁ η ▷ h ≫ (α_ f g' h).inv = (α_ f g h).inv ≫ (f ◁ η) ▷ h := by simp #align category_theory.bicategory.associator_inv_naturality_middle CategoryTheory.Bicategory.associator_inv_naturality_middle @[reassoc] theorem whisker_assoc_symm (f : a ⟶ b) {g g' : b ⟶ c} (η : g ⟶ g') (h : c ⟶ d) : f ◁ η ▷ h = (α_ f g h).inv ≫ (f ◁ η) ▷ h ≫ (α_ f g' h).hom := by simp #align category_theory.bicategory.whisker_assoc_symm CategoryTheory.Bicategory.whisker_assoc_symm @[reassoc] theorem associator_naturality_right (f : a ⟶ b) (g : b ⟶ c) {h h' : c ⟶ d} (η : h ⟶ h') : (f ≫ g) ◁ η ≫ (α_ f g h').hom = (α_ f g h).hom ≫ f ◁ g ◁ η := by simp #align category_theory.bicategory.associator_naturality_right CategoryTheory.Bicategory.associator_naturality_right @[reassoc] theorem associator_inv_naturality_right (f : a ⟶ b) (g : b ⟶ c) {h h' : c ⟶ d} (η : h ⟶ h') : f ◁ g ◁ η ≫ (α_ f g h').inv = (α_ f g h).inv ≫ (f ≫ g) ◁ η := by simp #align category_theory.bicategory.associator_inv_naturality_right CategoryTheory.Bicategory.associator_inv_naturality_right @[reassoc] theorem comp_whiskerLeft_symm (f : a ⟶ b) (g : b ⟶ c) {h h' : c ⟶ d} (η : h ⟶ h') : f ◁ g ◁ η = (α_ f g h).inv ≫ (f ≫ g) ◁ η ≫ (α_ f g h').hom := by simp #align category_theory.bicategory.comp_whisker_left_symm CategoryTheory.Bicategory.comp_whiskerLeft_symm @[reassoc]
Mathlib/CategoryTheory/Bicategory/Basic.lean
384
386
theorem leftUnitor_naturality {f g : a ⟶ b} (η : f ⟶ g) : 𝟙 a ◁ η ≫ (λ_ g).hom = (λ_ f).hom ≫ η := by
simp
import Mathlib.Analysis.Convex.Side import Mathlib.Geometry.Euclidean.Angle.Oriented.Rotation import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine #align_import geometry.euclidean.angle.oriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open FiniteDimensional Complex open scoped Affine EuclideanGeometry Real RealInnerProductSpace ComplexConjugate namespace EuclideanGeometry variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)] abbrev o := @Module.Oriented.positiveOrientation def oangle (p₁ p₂ p₃ : P) : Real.Angle := o.oangle (p₁ -ᵥ p₂) (p₃ -ᵥ p₂) #align euclidean_geometry.oangle EuclideanGeometry.oangle @[inherit_doc] scoped notation "∡" => EuclideanGeometry.oangle theorem continuousAt_oangle {x : P × P × P} (hx12 : x.1 ≠ x.2.1) (hx32 : x.2.2 ≠ x.2.1) : ContinuousAt (fun y : P × P × P => ∡ y.1 y.2.1 y.2.2) x := by let f : P × P × P → V × V := fun y => (y.1 -ᵥ y.2.1, y.2.2 -ᵥ y.2.1) have hf1 : (f x).1 ≠ 0 := by simp [hx12] have hf2 : (f x).2 ≠ 0 := by simp [hx32] exact (o.continuousAt_oangle hf1 hf2).comp ((continuous_fst.vsub continuous_snd.fst).prod_mk (continuous_snd.snd.vsub continuous_snd.fst)).continuousAt #align euclidean_geometry.continuous_at_oangle EuclideanGeometry.continuousAt_oangle @[simp] theorem oangle_self_left (p₁ p₂ : P) : ∡ p₁ p₁ p₂ = 0 := by simp [oangle] #align euclidean_geometry.oangle_self_left EuclideanGeometry.oangle_self_left @[simp] theorem oangle_self_right (p₁ p₂ : P) : ∡ p₁ p₂ p₂ = 0 := by simp [oangle] #align euclidean_geometry.oangle_self_right EuclideanGeometry.oangle_self_right @[simp] theorem oangle_self_left_right (p₁ p₂ : P) : ∡ p₁ p₂ p₁ = 0 := o.oangle_self _ #align euclidean_geometry.oangle_self_left_right EuclideanGeometry.oangle_self_left_right theorem left_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₁ ≠ p₂ := by rw [← @vsub_ne_zero V]; exact o.left_ne_zero_of_oangle_ne_zero h #align euclidean_geometry.left_ne_of_oangle_ne_zero EuclideanGeometry.left_ne_of_oangle_ne_zero theorem right_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₃ ≠ p₂ := by rw [← @vsub_ne_zero V]; exact o.right_ne_zero_of_oangle_ne_zero h #align euclidean_geometry.right_ne_of_oangle_ne_zero EuclideanGeometry.right_ne_of_oangle_ne_zero theorem left_ne_right_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₁ ≠ p₃ := by rw [← (vsub_left_injective p₂).ne_iff]; exact o.ne_of_oangle_ne_zero h #align euclidean_geometry.left_ne_right_of_oangle_ne_zero EuclideanGeometry.left_ne_right_of_oangle_ne_zero theorem left_ne_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_pi EuclideanGeometry.left_ne_of_oangle_eq_pi theorem right_ne_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_pi EuclideanGeometry.right_ne_of_oangle_eq_pi theorem left_ne_right_of_oangle_eq_pi {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = π) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_pi EuclideanGeometry.left_ne_right_of_oangle_eq_pi theorem left_ne_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_pi_div_two EuclideanGeometry.left_ne_of_oangle_eq_pi_div_two theorem right_ne_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_pi_div_two EuclideanGeometry.right_ne_of_oangle_eq_pi_div_two theorem left_ne_right_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (π / 2 : ℝ)) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_pi_div_two EuclideanGeometry.left_ne_right_of_oangle_eq_pi_div_two theorem left_ne_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_of_oangle_eq_neg_pi_div_two EuclideanGeometry.left_ne_of_oangle_eq_neg_pi_div_two theorem right_ne_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.right_ne_of_oangle_eq_neg_pi_div_two EuclideanGeometry.right_ne_of_oangle_eq_neg_pi_div_two theorem left_ne_right_of_oangle_eq_neg_pi_div_two {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ = (-π / 2 : ℝ)) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (h.symm ▸ Real.Angle.neg_pi_div_two_ne_zero : ∡ p₁ p₂ p₃ ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_eq_neg_pi_div_two EuclideanGeometry.left_ne_right_of_oangle_eq_neg_pi_div_two theorem left_ne_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₁ ≠ p₂ := left_ne_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.left_ne_of_oangle_sign_ne_zero EuclideanGeometry.left_ne_of_oangle_sign_ne_zero theorem right_ne_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₃ ≠ p₂ := right_ne_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.right_ne_of_oangle_sign_ne_zero EuclideanGeometry.right_ne_of_oangle_sign_ne_zero theorem left_ne_right_of_oangle_sign_ne_zero {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign ≠ 0) : p₁ ≠ p₃ := left_ne_right_of_oangle_ne_zero (Real.Angle.sign_ne_zero_iff.1 h).1 #align euclidean_geometry.left_ne_right_of_oangle_sign_ne_zero EuclideanGeometry.left_ne_right_of_oangle_sign_ne_zero theorem left_ne_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₁ ≠ p₂ := left_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_of_oangle_sign_eq_one EuclideanGeometry.left_ne_of_oangle_sign_eq_one theorem right_ne_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₃ ≠ p₂ := right_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.right_ne_of_oangle_sign_eq_one EuclideanGeometry.right_ne_of_oangle_sign_eq_one theorem left_ne_right_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₁ ≠ p₃ := left_ne_right_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_sign_eq_one EuclideanGeometry.left_ne_right_of_oangle_sign_eq_one theorem left_ne_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₁ ≠ p₂ := left_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_of_oangle_sign_eq_neg_one EuclideanGeometry.left_ne_of_oangle_sign_eq_neg_one theorem right_ne_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₃ ≠ p₂ := right_ne_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.right_ne_of_oangle_sign_eq_neg_one EuclideanGeometry.right_ne_of_oangle_sign_eq_neg_one theorem left_ne_right_of_oangle_sign_eq_neg_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = -1) : p₁ ≠ p₃ := left_ne_right_of_oangle_sign_ne_zero (h.symm ▸ by decide : (∡ p₁ p₂ p₃).sign ≠ 0) #align euclidean_geometry.left_ne_right_of_oangle_sign_eq_neg_one EuclideanGeometry.left_ne_right_of_oangle_sign_eq_neg_one theorem oangle_rev (p₁ p₂ p₃ : P) : ∡ p₃ p₂ p₁ = -∡ p₁ p₂ p₃ := o.oangle_rev _ _ #align euclidean_geometry.oangle_rev EuclideanGeometry.oangle_rev @[simp] theorem oangle_add_oangle_rev (p₁ p₂ p₃ : P) : ∡ p₁ p₂ p₃ + ∡ p₃ p₂ p₁ = 0 := o.oangle_add_oangle_rev _ _ #align euclidean_geometry.oangle_add_oangle_rev EuclideanGeometry.oangle_add_oangle_rev theorem oangle_eq_zero_iff_oangle_rev_eq_zero {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ↔ ∡ p₃ p₂ p₁ = 0 := o.oangle_eq_zero_iff_oangle_rev_eq_zero #align euclidean_geometry.oangle_eq_zero_iff_oangle_rev_eq_zero EuclideanGeometry.oangle_eq_zero_iff_oangle_rev_eq_zero theorem oangle_eq_pi_iff_oangle_rev_eq_pi {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = π ↔ ∡ p₃ p₂ p₁ = π := o.oangle_eq_pi_iff_oangle_rev_eq_pi #align euclidean_geometry.oangle_eq_pi_iff_oangle_rev_eq_pi EuclideanGeometry.oangle_eq_pi_iff_oangle_rev_eq_pi theorem oangle_ne_zero_and_ne_pi_iff_affineIndependent {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ ≠ 0 ∧ ∡ p₁ p₂ p₃ ≠ π ↔ AffineIndependent ℝ ![p₁, p₂, p₃] := by rw [oangle, o.oangle_ne_zero_and_ne_pi_iff_linearIndependent, affineIndependent_iff_linearIndependent_vsub ℝ _ (1 : Fin 3), ← linearIndependent_equiv (finSuccAboveEquiv (1 : Fin 3)).toEquiv] convert Iff.rfl ext i fin_cases i <;> rfl #align euclidean_geometry.oangle_ne_zero_and_ne_pi_iff_affine_independent EuclideanGeometry.oangle_ne_zero_and_ne_pi_iff_affineIndependent theorem oangle_eq_zero_or_eq_pi_iff_collinear {p₁ p₂ p₃ : P} : ∡ p₁ p₂ p₃ = 0 ∨ ∡ p₁ p₂ p₃ = π ↔ Collinear ℝ ({p₁, p₂, p₃} : Set P) := by rw [← not_iff_not, not_or, oangle_ne_zero_and_ne_pi_iff_affineIndependent, affineIndependent_iff_not_collinear_set] #align euclidean_geometry.oangle_eq_zero_or_eq_pi_iff_collinear EuclideanGeometry.oangle_eq_zero_or_eq_pi_iff_collinear
Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean
236
238
theorem oangle_sign_eq_zero_iff_collinear {p₁ p₂ p₃ : P} : (∡ p₁ p₂ p₃).sign = 0 ↔ Collinear ℝ ({p₁, p₂, p₃} : Set P) := by
rw [Real.Angle.sign_eq_zero_iff, oangle_eq_zero_or_eq_pi_iff_collinear]