Context stringlengths 57 92.3k | file_name stringlengths 21 79 | start int64 14 3.67k | end int64 18 3.69k | theorem stringlengths 25 2.71k | proof stringlengths 5 10.6k |
|---|---|---|---|---|---|
import Mathlib.Algebra.Category.ModuleCat.Free
import Mathlib.Topology.Category.Profinite.CofilteredLimit
import Mathlib.Topology.Category.Profinite.Product
import Mathlib.Topology.LocallyConstant.Algebra
import Mathlib.Init.Data.Bool.Lemmas
universe u
namespace Profinite
namespace NobelingProof
variable {I : Type u} [LinearOrder I] [IsWellOrder I (·<·)] (C : Set (I → Bool))
open Profinite ContinuousMap CategoryTheory Limits Opposite Submodule
def GoodProducts := {l : Products I | l.isGood C}
namespace GoodProducts
def eval (l : {l : Products I // l.isGood C}) : LocallyConstant C ℤ :=
Products.eval C l.1
theorem injective : Function.Injective (eval C) := by
intro ⟨a, ha⟩ ⟨b, hb⟩ h
dsimp [eval] at h
rcases lt_trichotomy a b with (h'|rfl|h')
· exfalso; apply hb; rw [← h]
exact Submodule.subset_span ⟨a, h', rfl⟩
· rfl
· exfalso; apply ha; rw [h]
exact Submodule.subset_span ⟨b, ⟨h',rfl⟩⟩
def range := Set.range (GoodProducts.eval C)
noncomputable
def equiv_range : GoodProducts C ≃ range C :=
Equiv.ofInjective (eval C) (injective C)
theorem equiv_toFun_eq_eval : (equiv_range C).toFun = Set.rangeFactorization (eval C) := rfl
theorem linearIndependent_iff_range : LinearIndependent ℤ (GoodProducts.eval C) ↔
LinearIndependent ℤ (fun (p : range C) ↦ p.1) := by
rw [← @Set.rangeFactorization_eq _ _ (GoodProducts.eval C), ← equiv_toFun_eq_eval C]
exact linearIndependent_equiv (equiv_range C)
end GoodProducts
namespace Products
theorem eval_eq (l : Products I) (x : C) :
l.eval C x = if ∀ i, i ∈ l.val → (x.val i = true) then 1 else 0 := by
change LocallyConstant.evalMonoidHom x (l.eval C) = _
rw [eval, map_list_prod]
split_ifs with h
· simp only [List.map_map]
apply List.prod_eq_one
simp only [List.mem_map, Function.comp_apply]
rintro _ ⟨i, hi, rfl⟩
exact if_pos (h i hi)
· simp only [List.map_map, List.prod_eq_zero_iff, List.mem_map, Function.comp_apply]
push_neg at h
convert h with i
dsimp [LocallyConstant.evalMonoidHom, e]
simp only [ite_eq_right_iff, one_ne_zero]
theorem evalFacProp {l : Products I} (J : I → Prop)
(h : ∀ a, a ∈ l.val → J a) [∀ j, Decidable (J j)] :
l.eval (π C J) ∘ ProjRestrict C J = l.eval C := by
ext x
dsimp [ProjRestrict]
rw [Products.eval_eq, Products.eval_eq]
congr
apply forall_congr; intro i
apply forall_congr; intro hi
simp [h i hi, Proj]
theorem evalFacProps {l : Products I} (J K : I → Prop)
(h : ∀ a, a ∈ l.val → J a) [∀ j, Decidable (J j)] [∀ j, Decidable (K j)]
(hJK : ∀ i, J i → K i) :
l.eval (π C J) ∘ ProjRestricts C hJK = l.eval (π C K) := by
have : l.eval (π C J) ∘ Homeomorph.setCongr (proj_eq_of_subset C J K hJK) =
l.eval (π (π C K) J) := by
ext; simp [Homeomorph.setCongr, Products.eval_eq]
rw [ProjRestricts, ← Function.comp.assoc, this, ← evalFacProp (π C K) J h]
theorem prop_of_isGood {l : Products I} (J : I → Prop) [∀ j, Decidable (J j)]
(h : l.isGood (π C J)) : ∀ a, a ∈ l.val → J a := by
intro i hi
by_contra h'
apply h
suffices eval (π C J) l = 0 by
rw [this]
exact Submodule.zero_mem _
ext ⟨_, _, _, rfl⟩
rw [eval_eq, if_neg fun h ↦ ?_, LocallyConstant.zero_apply]
simpa [Proj, h'] using h i hi
end Products
theorem GoodProducts.span_iff_products : ⊤ ≤ span ℤ (Set.range (eval C)) ↔
⊤ ≤ span ℤ (Set.range (Products.eval C)) := by
refine ⟨fun h ↦ le_trans h (span_mono (fun a ⟨b, hb⟩ ↦ ⟨b.val, hb⟩)), fun h ↦ le_trans h ?_⟩
rw [span_le]
rintro f ⟨l, rfl⟩
let L : Products I → Prop := fun m ↦ m.eval C ∈ span ℤ (Set.range (GoodProducts.eval C))
suffices L l by assumption
apply IsWellFounded.induction (·<· : Products I → Products I → Prop)
intro l h
dsimp
by_cases hl : l.isGood C
· apply subset_span
exact ⟨⟨l, hl⟩, rfl⟩
· simp only [Products.isGood, not_not] at hl
suffices Products.eval C '' {m | m < l} ⊆ span ℤ (Set.range (GoodProducts.eval C)) by
rw [← span_le] at this
exact this hl
rintro a ⟨m, hm, rfl⟩
exact h m hm
end Products
section Span
section Fin
variable (s : Finset I)
noncomputable
def πJ : LocallyConstant (π C (· ∈ s)) ℤ →ₗ[ℤ] LocallyConstant C ℤ :=
LocallyConstant.comapₗ ℤ ⟨_, (continuous_projRestrict C (· ∈ s))⟩
theorem eval_eq_πJ (l : Products I) (hl : l.isGood (π C (· ∈ s))) :
l.eval C = πJ C s (l.eval (π C (· ∈ s))) := by
ext f
simp only [πJ, LocallyConstant.comapₗ, LinearMap.coe_mk, AddHom.coe_mk,
(continuous_projRestrict C (· ∈ s)), LocallyConstant.coe_comap, Function.comp_apply]
exact (congr_fun (Products.evalFacProp C (· ∈ s) (Products.prop_of_isGood C (· ∈ s) hl)) _).symm
noncomputable
instance : Fintype (π C (· ∈ s)) := by
let f : π C (· ∈ s) → (s → Bool) := fun x j ↦ x.val j.val
refine Fintype.ofInjective f ?_
intro ⟨_, x, hx, rfl⟩ ⟨_, y, hy, rfl⟩ h
ext i
by_cases hi : i ∈ s
· exact congrFun h ⟨i, hi⟩
· simp only [Proj, if_neg hi]
open scoped Classical in
noncomputable
def spanFinBasis (x : π C (· ∈ s)) : LocallyConstant (π C (· ∈ s)) ℤ where
toFun := fun y ↦ if y = x then 1 else 0
isLocallyConstant :=
haveI : DiscreteTopology (π C (· ∈ s)) := discrete_of_t1_of_finite
IsLocallyConstant.of_discrete _
open scoped Classical in
theorem spanFinBasis.span : ⊤ ≤ Submodule.span ℤ (Set.range (spanFinBasis C s)) := by
intro f _
rw [Finsupp.mem_span_range_iff_exists_finsupp]
use Finsupp.onFinset (Finset.univ) f.toFun (fun _ _ ↦ Finset.mem_univ _)
ext x
change LocallyConstant.evalₗ ℤ x _ = _
simp only [zsmul_eq_mul, map_finsupp_sum, LocallyConstant.evalₗ_apply,
LocallyConstant.coe_mul, Pi.mul_apply, spanFinBasis, LocallyConstant.coe_mk, mul_ite, mul_one,
mul_zero, Finsupp.sum_ite_eq, Finsupp.mem_support_iff, ne_eq, ite_not]
split_ifs with h <;> [exact h.symm; rfl]
def factors (x : π C (· ∈ s)) : List (LocallyConstant (π C (· ∈ s)) ℤ) :=
List.map (fun i ↦ if x.val i = true then e (π C (· ∈ s)) i else (1 - (e (π C (· ∈ s)) i)))
(s.sort (·≥·))
theorem list_prod_apply (x : C) (l : List (LocallyConstant C ℤ)) :
l.prod x = (l.map (LocallyConstant.evalMonoidHom x)).prod := by
rw [← map_list_prod (LocallyConstant.evalMonoidHom x) l]
rfl
theorem factors_prod_eq_basis_of_eq {x y : (π C fun x ↦ x ∈ s)} (h : y = x) :
(factors C s x).prod y = 1 := by
rw [list_prod_apply (π C (· ∈ s)) y _]
apply List.prod_eq_one
simp only [h, List.mem_map, LocallyConstant.evalMonoidHom, factors]
rintro _ ⟨a, ⟨b, _, rfl⟩, rfl⟩
dsimp
split_ifs with hh
· rw [e, LocallyConstant.coe_mk, if_pos hh]
· rw [LocallyConstant.sub_apply, e, LocallyConstant.coe_mk, LocallyConstant.coe_mk, if_neg hh]
simp only [LocallyConstant.toFun_eq_coe, LocallyConstant.coe_one, Pi.one_apply, sub_zero]
theorem e_mem_of_eq_true {x : (π C (· ∈ s))} {a : I} (hx : x.val a = true) :
e (π C (· ∈ s)) a ∈ factors C s x := by
rcases x with ⟨_, z, hz, rfl⟩
simp only [factors, List.mem_map, Finset.mem_sort]
refine ⟨a, ?_, if_pos hx⟩
aesop (add simp Proj)
theorem one_sub_e_mem_of_false {x y : (π C (· ∈ s))} {a : I} (ha : y.val a = true)
(hx : x.val a = false) : 1 - e (π C (· ∈ s)) a ∈ factors C s x := by
simp only [factors, List.mem_map, Finset.mem_sort]
use a
simp only [hx, ite_false, and_true]
rcases y with ⟨_, z, hz, rfl⟩
aesop (add simp Proj)
theorem factors_prod_eq_basis_of_ne {x y : (π C (· ∈ s))} (h : y ≠ x) :
(factors C s x).prod y = 0 := by
rw [list_prod_apply (π C (· ∈ s)) y _]
apply List.prod_eq_zero
simp only [List.mem_map]
obtain ⟨a, ha⟩ : ∃ a, y.val a ≠ x.val a := by contrapose! h; ext; apply h
cases hx : x.val a
· rw [hx, ne_eq, Bool.not_eq_false] at ha
refine ⟨1 - (e (π C (· ∈ s)) a), ⟨one_sub_e_mem_of_false _ _ ha hx, ?_⟩⟩
rw [e, LocallyConstant.evalMonoidHom_apply, LocallyConstant.sub_apply,
LocallyConstant.coe_one, Pi.one_apply, LocallyConstant.coe_mk, if_pos ha, sub_self]
· refine ⟨e (π C (· ∈ s)) a, ⟨e_mem_of_eq_true _ _ hx, ?_⟩⟩
rw [hx] at ha
rw [LocallyConstant.evalMonoidHom_apply, e, LocallyConstant.coe_mk, if_neg ha]
theorem factors_prod_eq_basis (x : π C (· ∈ s)) :
(factors C s x).prod = spanFinBasis C s x := by
ext y
dsimp [spanFinBasis]
split_ifs with h <;> [exact factors_prod_eq_basis_of_eq _ _ h;
exact factors_prod_eq_basis_of_ne _ _ h]
theorem GoodProducts.finsupp_sum_mem_span_eval {a : I} {as : List I}
(ha : List.Chain' (· > ·) (a :: as)) {c : Products I →₀ ℤ}
(hc : (c.support : Set (Products I)) ⊆ {m | m.val ≤ as}) :
(Finsupp.sum c fun a_1 b ↦ e (π C (· ∈ s)) a * b • Products.eval (π C (· ∈ s)) a_1) ∈
Submodule.span ℤ (Products.eval (π C (· ∈ s)) '' {m | m.val ≤ a :: as}) := by
apply Submodule.finsupp_sum_mem
intro m hm
have hsm := (LinearMap.mulLeft ℤ (e (π C (· ∈ s)) a)).map_smul
dsimp at hsm
rw [hsm]
apply Submodule.smul_mem
apply Submodule.subset_span
have hmas : m.val ≤ as := by
apply hc
simpa only [Finset.mem_coe, Finsupp.mem_support_iff] using hm
refine ⟨⟨a :: m.val, ha.cons_of_le m.prop hmas⟩, ⟨List.cons_le_cons a hmas, ?_⟩⟩
simp only [Products.eval, List.map, List.prod_cons]
theorem GoodProducts.spanFin : ⊤ ≤ Submodule.span ℤ (Set.range (eval (π C (· ∈ s)))) := by
rw [span_iff_products]
refine le_trans (spanFinBasis.span C s) ?_
rw [Submodule.span_le]
rintro _ ⟨x, rfl⟩
rw [← factors_prod_eq_basis]
let l := s.sort (·≥·)
dsimp [factors]
suffices l.Chain' (·>·) → (l.map (fun i ↦ if x.val i = true then e (π C (· ∈ s)) i
else (1 - (e (π C (· ∈ s)) i)))).prod ∈
Submodule.span ℤ ((Products.eval (π C (· ∈ s))) '' {m | m.val ≤ l}) from
Submodule.span_mono (Set.image_subset_range _ _) (this (Finset.sort_sorted_gt _).chain')
induction l with
| nil =>
intro _
apply Submodule.subset_span
exact ⟨⟨[], List.chain'_nil⟩,⟨Or.inl rfl, rfl⟩⟩
| cons a as ih =>
rw [List.map_cons, List.prod_cons]
intro ha
specialize ih (by rw [List.chain'_cons'] at ha; exact ha.2)
rw [Finsupp.mem_span_image_iff_total] at ih
simp only [Finsupp.mem_supported, Finsupp.total_apply] at ih
obtain ⟨c, hc, hc'⟩ := ih
rw [← hc']; clear hc'
have hmap := fun g ↦ map_finsupp_sum (LinearMap.mulLeft ℤ (e (π C (· ∈ s)) a)) c g
dsimp at hmap ⊢
split_ifs
· rw [hmap]
exact finsupp_sum_mem_span_eval _ _ ha hc
· ring_nf
rw [hmap]
apply Submodule.add_mem
· apply Submodule.neg_mem
exact finsupp_sum_mem_span_eval _ _ ha hc
· apply Submodule.finsupp_sum_mem
intro m hm
apply Submodule.smul_mem
apply Submodule.subset_span
refine ⟨m, ⟨?_, rfl⟩⟩
simp only [Set.mem_setOf_eq]
have hmas : m.val ≤ as :=
hc (by simpa only [Finset.mem_coe, Finsupp.mem_support_iff] using hm)
refine le_trans hmas ?_
cases as with
| nil => exact (List.nil_lt_cons a []).le
| cons b bs =>
apply le_of_lt
rw [List.chain'_cons] at ha
have hlex := List.lt.head bs (b :: bs) ha.1
exact (List.lt_iff_lex_lt _ _).mp hlex
end Fin
theorem fin_comap_jointlySurjective
(hC : IsClosed C)
(f : LocallyConstant C ℤ) : ∃ (s : Finset I)
(g : LocallyConstant (π C (· ∈ s)) ℤ), f = g.comap ⟨(ProjRestrict C (· ∈ s)),
continuous_projRestrict _ _⟩ := by
obtain ⟨J, g, h⟩ := @Profinite.exists_locallyConstant.{0, u, u} (Finset I)ᵒᵖ _ _ _
(spanCone hC.isCompact) ℤ
(spanCone_isLimit hC.isCompact) f
exact ⟨(Opposite.unop J), g, h⟩
theorem GoodProducts.span (hC : IsClosed C) :
⊤ ≤ Submodule.span ℤ (Set.range (eval C)) := by
rw [span_iff_products]
intro f _
obtain ⟨K, f', rfl⟩ : ∃ K f', f = πJ C K f' := fin_comap_jointlySurjective C hC f
refine Submodule.span_mono ?_ <| Submodule.apply_mem_span_image_of_mem_span (πJ C K) <|
spanFin C K (Submodule.mem_top : f' ∈ ⊤)
rintro l ⟨y, ⟨m, rfl⟩, rfl⟩
exact ⟨m.val, eval_eq_πJ C K m.val m.prop⟩
end Span
section Ordinal
variable (I)
def ord (i : I) : Ordinal := Ordinal.typein ((·<·) : I → I → Prop) i
noncomputable
def term {o : Ordinal} (ho : o < Ordinal.type ((·<·) : I → I → Prop)) : I :=
Ordinal.enum ((·<·) : I → I → Prop) o ho
variable {I}
theorem term_ord_aux {i : I} (ho : ord I i < Ordinal.type ((·<·) : I → I → Prop)) :
term I ho = i := by
simp only [term, ord, Ordinal.enum_typein]
@[simp]
theorem ord_term_aux {o : Ordinal} (ho : o < Ordinal.type ((·<·) : I → I → Prop)) :
ord I (term I ho) = o := by
simp only [ord, term, Ordinal.typein_enum]
theorem ord_term {o : Ordinal} (ho : o < Ordinal.type ((·<·) : I → I → Prop)) (i : I) :
ord I i = o ↔ term I ho = i := by
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· subst h
exact term_ord_aux ho
· subst h
exact ord_term_aux ho
def contained (o : Ordinal) : Prop := ∀ f, f ∈ C → ∀ (i : I), f i = true → ord I i < o
variable (I) in
def P (o : Ordinal) : Prop :=
o ≤ Ordinal.type (·<· : I → I → Prop) →
(∀ (C : Set (I → Bool)), IsClosed C → contained C o →
LinearIndependent ℤ (GoodProducts.eval C))
theorem Products.prop_of_isGood_of_contained {l : Products I} (o : Ordinal) (h : l.isGood C)
(hsC : contained C o) (i : I) (hi : i ∈ l.val) : ord I i < o := by
by_contra h'
apply h
suffices eval C l = 0 by simp [this, Submodule.zero_mem]
ext x
simp only [eval_eq, LocallyConstant.coe_zero, Pi.zero_apply, ite_eq_right_iff, one_ne_zero]
contrapose! h'
exact hsC x.val x.prop i (h'.1 i hi)
end Ordinal
section Zero
instance : Subsingleton (LocallyConstant (∅ : Set (I → Bool)) ℤ) :=
subsingleton_iff.mpr (fun _ _ ↦ LocallyConstant.ext isEmptyElim)
instance : IsEmpty { l // Products.isGood (∅ : Set (I → Bool)) l } :=
isEmpty_iff.mpr fun ⟨l, hl⟩ ↦ hl <| by
rw [subsingleton_iff.mp inferInstance (Products.eval ∅ l) 0]
exact Submodule.zero_mem _
theorem GoodProducts.linearIndependentEmpty :
LinearIndependent ℤ (eval (∅ : Set (I → Bool))) := linearIndependent_empty_type
def Products.nil : Products I := ⟨[], by simp only [List.chain'_nil]⟩
theorem Products.lt_nil_empty : { m : Products I | m < Products.nil } = ∅ := by
ext ⟨m, hm⟩
refine ⟨fun h ↦ ?_, by tauto⟩
simp only [Set.mem_setOf_eq, lt_iff_lex_lt, nil, List.Lex.not_nil_right] at h
instance {α : Type*} [TopologicalSpace α] [Nonempty α] : Nontrivial (LocallyConstant α ℤ) :=
⟨0, 1, ne_of_apply_ne DFunLike.coe <| (Function.const_injective (β := ℤ)).ne zero_ne_one⟩
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
theorem Products.isGood_nil : Products.isGood ({fun _ ↦ false} : Set (I → Bool)) Products.nil := by
intro h
simp only [Products.lt_nil_empty, Products.eval, List.map, List.prod_nil, Set.image_empty,
Submodule.span_empty, Submodule.mem_bot, one_ne_zero] at h
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
theorem Products.span_nil_eq_top :
Submodule.span ℤ (eval ({fun _ ↦ false} : Set (I → Bool)) '' {nil}) = ⊤ := by
rw [Set.image_singleton, eq_top_iff]
intro f _
rw [Submodule.mem_span_singleton]
refine ⟨f default, ?_⟩
simp only [eval, List.map, List.prod_nil, zsmul_eq_mul, mul_one]
ext x
obtain rfl : x = default := by simp only [Set.default_coe_singleton, eq_iff_true_of_subsingleton]
rfl
noncomputable
instance : Unique { l // Products.isGood ({fun _ ↦ false} : Set (I → Bool)) l } where
default := ⟨Products.nil, Products.isGood_nil⟩
uniq := by
intro ⟨⟨l, hl⟩, hll⟩
ext
apply Subtype.ext
apply (List.Lex.nil_left_or_eq_nil l (r := (·<·))).resolve_left
intro _
apply hll
have he : {Products.nil} ⊆ {m | m < ⟨l,hl⟩} := by
simpa only [Products.nil, Products.lt_iff_lex_lt, Set.singleton_subset_iff, Set.mem_setOf_eq]
apply Submodule.span_mono (Set.image_subset _ he)
rw [Products.span_nil_eq_top]
exact Submodule.mem_top
instance (α : Type*) [TopologicalSpace α] : NoZeroSMulDivisors ℤ (LocallyConstant α ℤ) := by
constructor
intro c f h
rw [or_iff_not_imp_left]
intro hc
ext x
apply mul_right_injective₀ hc
simp [LocallyConstant.ext_iff] at h ⊢
exact h x
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
theorem GoodProducts.linearIndependentSingleton :
LinearIndependent ℤ (eval ({fun _ ↦ false} : Set (I → Bool))) := by
refine linearIndependent_unique (eval ({fun _ ↦ false} : Set (I → Bool))) ?_
simp only [eval, Products.eval, List.map, List.prod_nil, ne_eq, one_ne_zero, not_false_eq_true]
end Zero
section Maps
theorem contained_eq_proj (o : Ordinal) (h : contained C o) :
C = π C (ord I · < o) := by
have := proj_prop_eq_self C (ord I · < o)
simp [π, Bool.not_eq_false] at this
exact (this (fun i x hx ↦ h x hx i)).symm
theorem isClosed_proj (o : Ordinal) (hC : IsClosed C) : IsClosed (π C (ord I · < o)) :=
(continuous_proj (ord I · < o)).isClosedMap C hC
theorem contained_proj (o : Ordinal) : contained (π C (ord I · < o)) o := by
intro x ⟨_, _, h⟩ j hj
aesop (add simp Proj)
@[simps!]
noncomputable
def πs (o : Ordinal) : LocallyConstant (π C (ord I · < o)) ℤ →ₗ[ℤ] LocallyConstant C ℤ :=
LocallyConstant.comapₗ ℤ ⟨(ProjRestrict C (ord I · < o)), (continuous_projRestrict _ _)⟩
theorem coe_πs (o : Ordinal) (f : LocallyConstant (π C (ord I · < o)) ℤ) :
πs C o f = f ∘ ProjRestrict C (ord I · < o) := by
rfl
theorem injective_πs (o : Ordinal) : Function.Injective (πs C o) :=
LocallyConstant.comap_injective ⟨_, (continuous_projRestrict _ _)⟩
(Set.surjective_mapsTo_image_restrict _ _)
@[simps!]
noncomputable
def πs' {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) :
LocallyConstant (π C (ord I · < o₁)) ℤ →ₗ[ℤ] LocallyConstant (π C (ord I · < o₂)) ℤ :=
LocallyConstant.comapₗ ℤ ⟨(ProjRestricts C (fun _ hh ↦ lt_of_lt_of_le hh h)),
(continuous_projRestricts _ _)⟩
theorem coe_πs' {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) (f : LocallyConstant (π C (ord I · < o₁)) ℤ) :
(πs' C h f).toFun = f.toFun ∘ (ProjRestricts C (fun _ hh ↦ lt_of_lt_of_le hh h)) := by
rfl
theorem injective_πs' {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) : Function.Injective (πs' C h) :=
LocallyConstant.comap_injective ⟨_, (continuous_projRestricts _ _)⟩
(surjective_projRestricts _ fun _ hi ↦ lt_of_lt_of_le hi h)
namespace Products
theorem lt_ord_of_lt {l m : Products I} {o : Ordinal} (h₁ : m < l)
(h₂ : ∀ i ∈ l.val, ord I i < o) : ∀ i ∈ m.val, ord I i < o :=
List.Sorted.lt_ord_of_lt (List.chain'_iff_pairwise.mp l.2) (List.chain'_iff_pairwise.mp m.2) h₁ h₂
theorem eval_πs {l : Products I} {o : Ordinal} (hlt : ∀ i ∈ l.val, ord I i < o) :
πs C o (l.eval (π C (ord I · < o))) = l.eval C := by
simpa only [← LocallyConstant.coe_inj] using evalFacProp C (ord I · < o) hlt
theorem eval_πs' {l : Products I} {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂)
(hlt : ∀ i ∈ l.val, ord I i < o₁) :
πs' C h (l.eval (π C (ord I · < o₁))) = l.eval (π C (ord I · < o₂)) := by
rw [← LocallyConstant.coe_inj, ← LocallyConstant.toFun_eq_coe]
exact evalFacProps C (fun (i : I) ↦ ord I i < o₁) (fun (i : I) ↦ ord I i < o₂) hlt
(fun _ hh ↦ lt_of_lt_of_le hh h)
theorem eval_πs_image {l : Products I} {o : Ordinal}
(hl : ∀ i ∈ l.val, ord I i < o) : eval C '' { m | m < l } =
(πs C o) '' (eval (π C (ord I · < o)) '' { m | m < l }) := by
ext f
simp only [Set.mem_image, Set.mem_setOf_eq, exists_exists_and_eq_and]
apply exists_congr; intro m
apply and_congr_right; intro hm
rw [eval_πs C (lt_ord_of_lt hm hl)]
theorem eval_πs_image' {l : Products I} {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂)
(hl : ∀ i ∈ l.val, ord I i < o₁) : eval (π C (ord I · < o₂)) '' { m | m < l } =
(πs' C h) '' (eval (π C (ord I · < o₁)) '' { m | m < l }) := by
ext f
simp only [Set.mem_image, Set.mem_setOf_eq, exists_exists_and_eq_and]
apply exists_congr; intro m
apply and_congr_right; intro hm
rw [eval_πs' C h (lt_ord_of_lt hm hl)]
theorem head_lt_ord_of_isGood [Inhabited I] {l : Products I} {o : Ordinal}
(h : l.isGood (π C (ord I · < o))) (hn : l.val ≠ []) : ord I (l.val.head!) < o :=
prop_of_isGood C (ord I · < o) h l.val.head! (List.head!_mem_self hn)
theorem isGood_mono {l : Products I} {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂)
(hl : l.isGood (π C (ord I · < o₁))) : l.isGood (π C (ord I · < o₂)) := by
intro hl'
apply hl
rwa [eval_πs_image' C h (prop_of_isGood C _ hl), ← eval_πs' C h (prop_of_isGood C _ hl),
Submodule.apply_mem_span_image_iff_mem_span (injective_πs' C h)] at hl'
end Products
end Maps
section Limit
namespace GoodProducts
def smaller (o : Ordinal) : Set (LocallyConstant C ℤ) :=
(πs C o) '' (range (π C (ord I · < o)))
noncomputable
def range_equiv_smaller_toFun (o : Ordinal) (x : range (π C (ord I · < o))) : smaller C o :=
⟨πs C o ↑x, x.val, x.property, rfl⟩
theorem range_equiv_smaller_toFun_bijective (o : Ordinal) :
Function.Bijective (range_equiv_smaller_toFun C o) := by
dsimp (config := { unfoldPartialApp := true }) [range_equiv_smaller_toFun]
refine ⟨fun a b hab ↦ ?_, fun ⟨a, b, hb⟩ ↦ ?_⟩
· ext1
simp only [Subtype.mk.injEq] at hab
exact injective_πs C o hab
· use ⟨b, hb.1⟩
simpa only [Subtype.mk.injEq] using hb.2
noncomputable
def range_equiv_smaller (o : Ordinal) : range (π C (ord I · < o)) ≃ smaller C o :=
Equiv.ofBijective (range_equiv_smaller_toFun C o) (range_equiv_smaller_toFun_bijective C o)
theorem smaller_factorization (o : Ordinal) :
(fun (p : smaller C o) ↦ p.1) ∘ (range_equiv_smaller C o).toFun =
(πs C o) ∘ (fun (p : range (π C (ord I · < o))) ↦ p.1) := by rfl
theorem linearIndependent_iff_smaller (o : Ordinal) :
LinearIndependent ℤ (GoodProducts.eval (π C (ord I · < o))) ↔
LinearIndependent ℤ (fun (p : smaller C o) ↦ p.1) := by
rw [GoodProducts.linearIndependent_iff_range,
← LinearMap.linearIndependent_iff (πs C o)
(LinearMap.ker_eq_bot_of_injective (injective_πs _ _)), ← smaller_factorization C o]
exact linearIndependent_equiv _
theorem smaller_mono {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) : smaller C o₁ ⊆ smaller C o₂ := by
rintro f ⟨g, hg, rfl⟩
simp only [smaller, Set.mem_image]
use πs' C h g
obtain ⟨⟨l, gl⟩, rfl⟩ := hg
refine ⟨?_, ?_⟩
· use ⟨l, Products.isGood_mono C h gl⟩
ext x
rw [eval, ← Products.eval_πs' _ h (Products.prop_of_isGood C _ gl), eval]
· rw [← LocallyConstant.coe_inj, coe_πs C o₂, ← LocallyConstant.toFun_eq_coe, coe_πs',
Function.comp.assoc, projRestricts_comp_projRestrict C _, coe_πs]
rfl
end GoodProducts
variable {o : Ordinal} (ho : o.IsLimit) (hsC : contained C o)
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o := by
simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
refine ⟨hslt, fun he ↦ h ?_⟩
have hlt : ∀ i ∈ l.val, ord I i < Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) := by
intro i hi
simp only [Finset.lt_sup_iff, List.mem_toFinset, Order.lt_succ_iff]
exact ⟨i, hi, le_rfl⟩
rwa [eval_πs_image' C (le_of_lt hslt) hlt, ← eval_πs' C (le_of_lt hslt) hlt,
Submodule.apply_mem_span_image_iff_mem_span (injective_πs' C _)]
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
ext p
simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
· obtain ⟨l, hl, rfl⟩ := hp
rw [contained_eq_proj C o hsC, Products.limitOrdinal C ho] at hl
obtain ⟨o', ho'⟩ := hl
refine ⟨o', ho'.1, eval (π C (ord I · < o')) ⟨l, ho'.2⟩, ⟨l, ho'.2, rfl⟩, ?_⟩
exact Products.eval_πs C (Products.prop_of_isGood C _ ho'.2)
· obtain ⟨o', h, _, ⟨l, hl, rfl⟩, rfl⟩ := hp
refine ⟨l, ?_, (Products.eval_πs C (Products.prop_of_isGood C _ hl)).symm⟩
rw [contained_eq_proj C o hsC]
exact Products.isGood_mono C (le_of_lt h) hl
def GoodProducts.range_equiv : range C ≃ ⋃ (e : {o' // o' < o}), (smaller C e.val) :=
Equiv.Set.ofEq (union C ho hsC)
theorem GoodProducts.range_equiv_factorization :
(fun (p : ⋃ (e : {o' // o' < o}), (smaller C e.val)) ↦ p.1) ∘ (range_equiv C ho hsC).toFun =
(fun (p : range C) ↦ (p.1 : LocallyConstant C ℤ)) := rfl
theorem GoodProducts.linearIndependent_iff_union_smaller {o : Ordinal} (ho : o.IsLimit)
(hsC : contained C o) : LinearIndependent ℤ (GoodProducts.eval C) ↔
LinearIndependent ℤ (fun (p : ⋃ (e : {o' // o' < o}), (smaller C e.val)) ↦ p.1) := by
rw [GoodProducts.linearIndependent_iff_range, ← range_equiv_factorization C ho hsC]
exact linearIndependent_equiv (range_equiv C ho hsC)
end Limit
section Successor
variable {o : Ordinal} (hC : IsClosed C) (hsC : contained C (Order.succ o))
(ho : o < Ordinal.type (·<· : I → I → Prop))
section ExactSequence
def C0 := C ∩ {f | f (term I ho) = false}
def C1 := C ∩ {f | f (term I ho) = true}
theorem isClosed_C0 : IsClosed (C0 C ho) := by
refine hC.inter ?_
have h : Continuous (fun (f : I → Bool) ↦ f (term I ho)) := continuous_apply (term I ho)
exact IsClosed.preimage h (t := {false}) (isClosed_discrete _)
theorem isClosed_C1 : IsClosed (C1 C ho) := by
refine hC.inter ?_
have h : Continuous (fun (f : I → Bool) ↦ f (term I ho)) := continuous_apply (term I ho)
exact IsClosed.preimage h (t := {true}) (isClosed_discrete _)
theorem contained_C1 : contained (π (C1 C ho) (ord I · < o)) o :=
contained_proj _ _
theorem union_C0C1_eq : (C0 C ho) ∪ (C1 C ho) = C := by
ext x
simp only [C0, C1, Set.mem_union, Set.mem_inter_iff, Set.mem_setOf_eq,
← and_or_left, and_iff_left_iff_imp, Bool.dichotomy (x (term I ho)), implies_true]
def C' := C0 C ho ∩ π (C1 C ho) (ord I · < o)
theorem isClosed_C' : IsClosed (C' C ho) :=
IsClosed.inter (isClosed_C0 _ hC _) (isClosed_proj _ _ (isClosed_C1 _ hC _))
theorem contained_C' : contained (C' C ho) o := fun f hf i hi ↦ contained_C1 C ho f hf.2 i hi
variable (o)
noncomputable
def SwapTrue : (I → Bool) → I → Bool :=
fun f i ↦ if ord I i = o then true else f i
theorem continuous_swapTrue :
Continuous (SwapTrue o : (I → Bool) → I → Bool) := by
dsimp (config := { unfoldPartialApp := true }) [SwapTrue]
apply continuous_pi
intro i
apply Continuous.comp'
· apply continuous_bot
· apply continuous_apply
variable {o}
theorem swapTrue_mem_C1 (f : π (C1 C ho) (ord I · < o)) :
SwapTrue o f.val ∈ C1 C ho := by
obtain ⟨f, g, hg, rfl⟩ := f
convert hg
dsimp (config := { unfoldPartialApp := true }) [SwapTrue]
ext i
split_ifs with h
· rw [ord_term ho] at h
simpa only [← h] using hg.2.symm
· simp only [Proj, ite_eq_left_iff, not_lt, @eq_comm _ false, ← Bool.not_eq_true]
specialize hsC g hg.1 i
intro h'
contrapose! hsC
exact ⟨hsC, Order.succ_le_of_lt (h'.lt_of_ne' h)⟩
def CC'₀ : C' C ho → C := fun g ↦ ⟨g.val,g.prop.1.1⟩
noncomputable
def CC'₁ : C' C ho → C :=
fun g ↦ ⟨SwapTrue o g.val, (swapTrue_mem_C1 C hsC ho ⟨g.val,g.prop.2⟩).1⟩
theorem continuous_CC'₀ : Continuous (CC'₀ C ho) := Continuous.subtype_mk continuous_subtype_val _
theorem continuous_CC'₁ : Continuous (CC'₁ C hsC ho) :=
Continuous.subtype_mk (Continuous.comp (continuous_swapTrue o) continuous_subtype_val) _
noncomputable
def Linear_CC'₀ : LocallyConstant C ℤ →ₗ[ℤ] LocallyConstant (C' C ho) ℤ :=
LocallyConstant.comapₗ ℤ ⟨(CC'₀ C ho), (continuous_CC'₀ C ho)⟩
noncomputable
def Linear_CC'₁ : LocallyConstant C ℤ →ₗ[ℤ] LocallyConstant (C' C ho) ℤ :=
LocallyConstant.comapₗ ℤ ⟨(CC'₁ C hsC ho), (continuous_CC'₁ C hsC ho)⟩
noncomputable
def Linear_CC' : LocallyConstant C ℤ →ₗ[ℤ] LocallyConstant (C' C ho) ℤ :=
Linear_CC'₁ C hsC ho - Linear_CC'₀ C ho
theorem CC_comp_zero : ∀ y, (Linear_CC' C hsC ho) ((πs C o) y) = 0 := by
intro y
ext x
dsimp [Linear_CC', Linear_CC'₀, Linear_CC'₁, LocallyConstant.sub_apply]
simp only [continuous_CC'₀, continuous_CC'₁, LocallyConstant.coe_comap, continuous_projRestrict,
Function.comp_apply, sub_eq_zero]
congr 1
ext i
dsimp [CC'₀, CC'₁, ProjRestrict, Proj]
apply if_ctx_congr Iff.rfl _ (fun _ ↦ rfl)
simp only [SwapTrue, ite_eq_right_iff]
intro h₁ h₂
exact (h₁.ne h₂).elim
theorem C0_projOrd {x : I → Bool} (hx : x ∈ C0 C ho) : Proj (ord I · < o) x = x := by
ext i
simp only [Proj, Set.mem_setOf, ite_eq_left_iff, not_lt]
intro hi
rw [le_iff_lt_or_eq] at hi
cases' hi with hi hi
· specialize hsC x hx.1 i
rw [← not_imp_not] at hsC
simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC
exact (hsC hi).symm
· simp only [C0, Set.mem_inter_iff, Set.mem_setOf_eq] at hx
rw [eq_comm, ord_term ho] at hi
rw [← hx.2, hi]
theorem C1_projOrd {x : I → Bool} (hx : x ∈ C1 C ho) : SwapTrue o (Proj (ord I · < o) x) = x := by
ext i
dsimp [SwapTrue, Proj]
split_ifs with hi h
· rw [ord_term ho] at hi
rw [← hx.2, hi]
· rfl
· simp only [not_lt] at h
have h' : o < ord I i := lt_of_le_of_ne h (Ne.symm hi)
specialize hsC x hx.1 i
rw [← not_imp_not] at hsC
simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC
exact (hsC h').symm
open scoped Classical in
theorem CC_exact {f : LocallyConstant C ℤ} (hf : Linear_CC' C hsC ho f = 0) :
∃ y, πs C o y = f := by
dsimp [Linear_CC', Linear_CC'₀, Linear_CC'₁] at hf
simp only [sub_eq_zero, ← LocallyConstant.coe_inj, LocallyConstant.coe_comap,
continuous_CC'₀, continuous_CC'₁] at hf
let C₀C : C0 C ho → C := fun x ↦ ⟨x.val, x.prop.1⟩
have h₀ : Continuous C₀C := Continuous.subtype_mk continuous_induced_dom _
let C₁C : π (C1 C ho) (ord I · < o) → C :=
fun x ↦ ⟨SwapTrue o x.val, (swapTrue_mem_C1 C hsC ho x).1⟩
have h₁ : Continuous C₁C := Continuous.subtype_mk
((continuous_swapTrue o).comp continuous_subtype_val) _
refine ⟨LocallyConstant.piecewise' ?_ (isClosed_C0 C hC ho)
(isClosed_proj _ o (isClosed_C1 C hC ho)) (f.comap ⟨C₀C, h₀⟩) (f.comap ⟨C₁C, h₁⟩) ?_, ?_⟩
· rintro _ ⟨y, hyC, rfl⟩
simp only [Set.mem_union, Set.mem_setOf_eq, Set.mem_univ, iff_true]
rw [← union_C0C1_eq C ho] at hyC
refine hyC.imp (fun hyC ↦ ?_) (fun hyC ↦ ⟨y, hyC, rfl⟩)
rwa [C0_projOrd C hsC ho hyC]
· intro x hx
simpa only [h₀, h₁, LocallyConstant.coe_comap] using (congrFun hf ⟨x, hx⟩).symm
· ext ⟨x, hx⟩
rw [← union_C0C1_eq C ho] at hx
cases' hx with hx₀ hx₁
· have hx₀' : ProjRestrict C (ord I · < o) ⟨x, hx⟩ = x := by
simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using C0_projOrd C hsC ho hx₀
simp only [πs_apply_apply, hx₀', hx₀, LocallyConstant.piecewise'_apply_left,
LocallyConstant.coe_comap, ContinuousMap.coe_mk, Function.comp_apply]
· have hx₁' : (ProjRestrict C (ord I · < o) ⟨x, hx⟩).val ∈ π (C1 C ho) (ord I · < o) := by
simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using ⟨x, hx₁, rfl⟩
simp only [C₁C, πs_apply_apply, continuous_projRestrict, LocallyConstant.coe_comap,
Function.comp_apply, hx₁', LocallyConstant.piecewise'_apply_right, h₁]
congr
simp only [ContinuousMap.coe_mk, Subtype.mk.injEq]
exact C1_projOrd C hsC ho hx₁
variable (o) in
theorem succ_mono : CategoryTheory.Mono (ModuleCat.ofHom (πs C o)) := by
rw [ModuleCat.mono_iff_injective]
exact injective_πs _ _
theorem succ_exact :
(ShortComplex.mk (ModuleCat.ofHom (πs C o)) (ModuleCat.ofHom (Linear_CC' C hsC ho))
(by ext; apply CC_comp_zero)).Exact := by
rw [ShortComplex.moduleCat_exact_iff]
intro f
exact CC_exact C hC hsC ho
end ExactSequence
section Span
section Limit
namespace GoodProducts
def smaller (o : Ordinal) : Set (LocallyConstant C ℤ) :=
(πs C o) '' (range (π C (ord I · < o)))
noncomputable
def range_equiv_smaller_toFun (o : Ordinal) (x : range (π C (ord I · < o))) : smaller C o :=
⟨πs C o ↑x, x.val, x.property, rfl⟩
theorem range_equiv_smaller_toFun_bijective (o : Ordinal) :
Function.Bijective (range_equiv_smaller_toFun C o) := by
dsimp (config := { unfoldPartialApp := true }) [range_equiv_smaller_toFun]
refine ⟨fun a b hab ↦ ?_, fun ⟨a, b, hb⟩ ↦ ?_⟩
· ext1
simp only [Subtype.mk.injEq] at hab
exact injective_πs C o hab
· use ⟨b, hb.1⟩
simpa only [Subtype.mk.injEq] using hb.2
noncomputable
def range_equiv_smaller (o : Ordinal) : range (π C (ord I · < o)) ≃ smaller C o :=
Equiv.ofBijective (range_equiv_smaller_toFun C o) (range_equiv_smaller_toFun_bijective C o)
theorem smaller_factorization (o : Ordinal) :
(fun (p : smaller C o) ↦ p.1) ∘ (range_equiv_smaller C o).toFun =
(πs C o) ∘ (fun (p : range (π C (ord I · < o))) ↦ p.1) := by rfl
theorem linearIndependent_iff_smaller (o : Ordinal) :
LinearIndependent ℤ (GoodProducts.eval (π C (ord I · < o))) ↔
LinearIndependent ℤ (fun (p : smaller C o) ↦ p.1) := by
rw [GoodProducts.linearIndependent_iff_range,
← LinearMap.linearIndependent_iff (πs C o)
(LinearMap.ker_eq_bot_of_injective (injective_πs _ _)), ← smaller_factorization C o]
exact linearIndependent_equiv _
theorem smaller_mono {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) : smaller C o₁ ⊆ smaller C o₂ := by
rintro f ⟨g, hg, rfl⟩
simp only [smaller, Set.mem_image]
use πs' C h g
obtain ⟨⟨l, gl⟩, rfl⟩ := hg
refine ⟨?_, ?_⟩
· use ⟨l, Products.isGood_mono C h gl⟩
ext x
rw [eval, ← Products.eval_πs' _ h (Products.prop_of_isGood C _ gl), eval]
· rw [← LocallyConstant.coe_inj, coe_πs C o₂, ← LocallyConstant.toFun_eq_coe, coe_πs',
Function.comp.assoc, projRestricts_comp_projRestrict C _, coe_πs]
rfl
end GoodProducts
variable {o : Ordinal} (ho : o.IsLimit) (hsC : contained C o)
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o := by
simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
refine ⟨hslt, fun he ↦ h ?_⟩
have hlt : ∀ i ∈ l.val, ord I i < Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) := by
intro i hi
simp only [Finset.lt_sup_iff, List.mem_toFinset, Order.lt_succ_iff]
exact ⟨i, hi, le_rfl⟩
rwa [eval_πs_image' C (le_of_lt hslt) hlt, ← eval_πs' C (le_of_lt hslt) hlt,
Submodule.apply_mem_span_image_iff_mem_span (injective_πs' C _)]
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
ext p
simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
· obtain ⟨l, hl, rfl⟩ := hp
rw [contained_eq_proj C o hsC, Products.limitOrdinal C ho] at hl
obtain ⟨o', ho'⟩ := hl
refine ⟨o', ho'.1, eval (π C (ord I · < o')) ⟨l, ho'.2⟩, ⟨l, ho'.2, rfl⟩, ?_⟩
exact Products.eval_πs C (Products.prop_of_isGood C _ ho'.2)
· obtain ⟨o', h, _, ⟨l, hl, rfl⟩, rfl⟩ := hp
refine ⟨l, ?_, (Products.eval_πs C (Products.prop_of_isGood C _ hl)).symm⟩
rw [contained_eq_proj C o hsC]
exact Products.isGood_mono C (le_of_lt h) hl
def GoodProducts.range_equiv : range C ≃ ⋃ (e : {o' // o' < o}), (smaller C e.val) :=
Equiv.Set.ofEq (union C ho hsC)
theorem GoodProducts.range_equiv_factorization :
(fun (p : ⋃ (e : {o' // o' < o}), (smaller C e.val)) ↦ p.1) ∘ (range_equiv C ho hsC).toFun =
(fun (p : range C) ↦ (p.1 : LocallyConstant C ℤ)) := rfl
theorem GoodProducts.linearIndependent_iff_union_smaller {o : Ordinal} (ho : o.IsLimit)
(hsC : contained C o) : LinearIndependent ℤ (GoodProducts.eval C) ↔
LinearIndependent ℤ (fun (p : ⋃ (e : {o' // o' < o}), (smaller C e.val)) ↦ p.1) := by
rw [GoodProducts.linearIndependent_iff_range, ← range_equiv_factorization C ho hsC]
exact linearIndependent_equiv (range_equiv C ho hsC)
end Limit
section Successor
variable {o : Ordinal} (hC : IsClosed C) (hsC : contained C (Order.succ o))
(ho : o < Ordinal.type (·<· : I → I → Prop))
section ExactSequence
def C0 := C ∩ {f | f (term I ho) = false}
def C1 := C ∩ {f | f (term I ho) = true}
theorem isClosed_C0 : IsClosed (C0 C ho) := by
refine hC.inter ?_
have h : Continuous (fun (f : I → Bool) ↦ f (term I ho)) := continuous_apply (term I ho)
exact IsClosed.preimage h (t := {false}) (isClosed_discrete _)
theorem isClosed_C1 : IsClosed (C1 C ho) := by
refine hC.inter ?_
have h : Continuous (fun (f : I → Bool) ↦ f (term I ho)) := continuous_apply (term I ho)
exact IsClosed.preimage h (t := {true}) (isClosed_discrete _)
theorem contained_C1 : contained (π (C1 C ho) (ord I · < o)) o :=
contained_proj _ _
theorem union_C0C1_eq : (C0 C ho) ∪ (C1 C ho) = C := by
ext x
simp only [C0, C1, Set.mem_union, Set.mem_inter_iff, Set.mem_setOf_eq,
← and_or_left, and_iff_left_iff_imp, Bool.dichotomy (x (term I ho)), implies_true]
def C' := C0 C ho ∩ π (C1 C ho) (ord I · < o)
theorem isClosed_C' : IsClosed (C' C ho) :=
IsClosed.inter (isClosed_C0 _ hC _) (isClosed_proj _ _ (isClosed_C1 _ hC _))
theorem contained_C' : contained (C' C ho) o := fun f hf i hi ↦ contained_C1 C ho f hf.2 i hi
variable (o)
noncomputable
def SwapTrue : (I → Bool) → I → Bool :=
fun f i ↦ if ord I i = o then true else f i
theorem continuous_swapTrue :
Continuous (SwapTrue o : (I → Bool) → I → Bool) := by
dsimp (config := { unfoldPartialApp := true }) [SwapTrue]
apply continuous_pi
intro i
apply Continuous.comp'
· apply continuous_bot
· apply continuous_apply
variable {o}
theorem swapTrue_mem_C1 (f : π (C1 C ho) (ord I · < o)) :
SwapTrue o f.val ∈ C1 C ho := by
obtain ⟨f, g, hg, rfl⟩ := f
convert hg
dsimp (config := { unfoldPartialApp := true }) [SwapTrue]
ext i
split_ifs with h
· rw [ord_term ho] at h
simpa only [← h] using hg.2.symm
· simp only [Proj, ite_eq_left_iff, not_lt, @eq_comm _ false, ← Bool.not_eq_true]
specialize hsC g hg.1 i
intro h'
contrapose! hsC
exact ⟨hsC, Order.succ_le_of_lt (h'.lt_of_ne' h)⟩
def CC'₀ : C' C ho → C := fun g ↦ ⟨g.val,g.prop.1.1⟩
noncomputable
def CC'₁ : C' C ho → C :=
fun g ↦ ⟨SwapTrue o g.val, (swapTrue_mem_C1 C hsC ho ⟨g.val,g.prop.2⟩).1⟩
theorem continuous_CC'₀ : Continuous (CC'₀ C ho) := Continuous.subtype_mk continuous_subtype_val _
theorem continuous_CC'₁ : Continuous (CC'₁ C hsC ho) :=
Continuous.subtype_mk (Continuous.comp (continuous_swapTrue o) continuous_subtype_val) _
noncomputable
def Linear_CC'₀ : LocallyConstant C ℤ →ₗ[ℤ] LocallyConstant (C' C ho) ℤ :=
LocallyConstant.comapₗ ℤ ⟨(CC'₀ C ho), (continuous_CC'₀ C ho)⟩
noncomputable
def Linear_CC'₁ : LocallyConstant C ℤ →ₗ[ℤ] LocallyConstant (C' C ho) ℤ :=
LocallyConstant.comapₗ ℤ ⟨(CC'₁ C hsC ho), (continuous_CC'₁ C hsC ho)⟩
noncomputable
def Linear_CC' : LocallyConstant C ℤ →ₗ[ℤ] LocallyConstant (C' C ho) ℤ :=
Linear_CC'₁ C hsC ho - Linear_CC'₀ C ho
theorem CC_comp_zero : ∀ y, (Linear_CC' C hsC ho) ((πs C o) y) = 0 := by
intro y
ext x
dsimp [Linear_CC', Linear_CC'₀, Linear_CC'₁, LocallyConstant.sub_apply]
simp only [continuous_CC'₀, continuous_CC'₁, LocallyConstant.coe_comap, continuous_projRestrict,
Function.comp_apply, sub_eq_zero]
congr 1
ext i
dsimp [CC'₀, CC'₁, ProjRestrict, Proj]
apply if_ctx_congr Iff.rfl _ (fun _ ↦ rfl)
simp only [SwapTrue, ite_eq_right_iff]
intro h₁ h₂
exact (h₁.ne h₂).elim
theorem C0_projOrd {x : I → Bool} (hx : x ∈ C0 C ho) : Proj (ord I · < o) x = x := by
ext i
simp only [Proj, Set.mem_setOf, ite_eq_left_iff, not_lt]
intro hi
rw [le_iff_lt_or_eq] at hi
cases' hi with hi hi
· specialize hsC x hx.1 i
rw [← not_imp_not] at hsC
simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC
exact (hsC hi).symm
· simp only [C0, Set.mem_inter_iff, Set.mem_setOf_eq] at hx
rw [eq_comm, ord_term ho] at hi
rw [← hx.2, hi]
theorem C1_projOrd {x : I → Bool} (hx : x ∈ C1 C ho) : SwapTrue o (Proj (ord I · < o) x) = x := by
ext i
dsimp [SwapTrue, Proj]
split_ifs with hi h
· rw [ord_term ho] at hi
rw [← hx.2, hi]
· rfl
· simp only [not_lt] at h
have h' : o < ord I i := lt_of_le_of_ne h (Ne.symm hi)
specialize hsC x hx.1 i
rw [← not_imp_not] at hsC
simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC
exact (hsC h').symm
open scoped Classical in
theorem CC_exact {f : LocallyConstant C ℤ} (hf : Linear_CC' C hsC ho f = 0) :
∃ y, πs C o y = f := by
dsimp [Linear_CC', Linear_CC'₀, Linear_CC'₁] at hf
simp only [sub_eq_zero, ← LocallyConstant.coe_inj, LocallyConstant.coe_comap,
continuous_CC'₀, continuous_CC'₁] at hf
let C₀C : C0 C ho → C := fun x ↦ ⟨x.val, x.prop.1⟩
have h₀ : Continuous C₀C := Continuous.subtype_mk continuous_induced_dom _
let C₁C : π (C1 C ho) (ord I · < o) → C :=
fun x ↦ ⟨SwapTrue o x.val, (swapTrue_mem_C1 C hsC ho x).1⟩
have h₁ : Continuous C₁C := Continuous.subtype_mk
((continuous_swapTrue o).comp continuous_subtype_val) _
refine ⟨LocallyConstant.piecewise' ?_ (isClosed_C0 C hC ho)
(isClosed_proj _ o (isClosed_C1 C hC ho)) (f.comap ⟨C₀C, h₀⟩) (f.comap ⟨C₁C, h₁⟩) ?_, ?_⟩
· rintro _ ⟨y, hyC, rfl⟩
simp only [Set.mem_union, Set.mem_setOf_eq, Set.mem_univ, iff_true]
rw [← union_C0C1_eq C ho] at hyC
refine hyC.imp (fun hyC ↦ ?_) (fun hyC ↦ ⟨y, hyC, rfl⟩)
rwa [C0_projOrd C hsC ho hyC]
· intro x hx
simpa only [h₀, h₁, LocallyConstant.coe_comap] using (congrFun hf ⟨x, hx⟩).symm
· ext ⟨x, hx⟩
rw [← union_C0C1_eq C ho] at hx
cases' hx with hx₀ hx₁
· have hx₀' : ProjRestrict C (ord I · < o) ⟨x, hx⟩ = x := by
simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using C0_projOrd C hsC ho hx₀
simp only [πs_apply_apply, hx₀', hx₀, LocallyConstant.piecewise'_apply_left,
LocallyConstant.coe_comap, ContinuousMap.coe_mk, Function.comp_apply]
· have hx₁' : (ProjRestrict C (ord I · < o) ⟨x, hx⟩).val ∈ π (C1 C ho) (ord I · < o) := by
simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using ⟨x, hx₁, rfl⟩
simp only [C₁C, πs_apply_apply, continuous_projRestrict, LocallyConstant.coe_comap,
Function.comp_apply, hx₁', LocallyConstant.piecewise'_apply_right, h₁]
congr
simp only [ContinuousMap.coe_mk, Subtype.mk.injEq]
exact C1_projOrd C hsC ho hx₁
variable (o) in
theorem succ_mono : CategoryTheory.Mono (ModuleCat.ofHom (πs C o)) := by
rw [ModuleCat.mono_iff_injective]
exact injective_πs _ _
theorem succ_exact :
(ShortComplex.mk (ModuleCat.ofHom (πs C o)) (ModuleCat.ofHom (Linear_CC' C hsC ho))
(by ext; apply CC_comp_zero)).Exact := by
rw [ShortComplex.moduleCat_exact_iff]
intro f
exact CC_exact C hC hsC ho
end ExactSequence
section Successor
variable {o : Ordinal} (hC : IsClosed C) (hsC : contained C (Order.succ o))
(ho : o < Ordinal.type (·<· : I → I → Prop))
theorem swapTrue_eq_true (x : I → Bool) : SwapTrue o x (term I ho) = true := by
simp only [SwapTrue, ord_term_aux, ite_true]
theorem mem_C'_eq_false : ∀ x, x ∈ C' C ho → x (term I ho) = false := by
rintro x ⟨_, y, _, rfl⟩
simp only [Proj, ord_term_aux, lt_self_iff_false, ite_false]
def Products.Tail (l : Products I) : Products I :=
⟨l.val.tail, List.Chain'.tail l.prop⟩
theorem Products.max_eq_o_cons_tail [Inhabited I] (l : Products I) (hl : l.val ≠ [])
(hlh : l.val.head! = term I ho) : l.val = term I ho :: l.Tail.val := by
rw [← List.cons_head!_tail hl, hlh]
rfl
theorem Products.max_eq_o_cons_tail' [Inhabited I] (l : Products I) (hl : l.val ≠ [])
(hlh : l.val.head! = term I ho) (hlc : List.Chain' (·>·) (term I ho :: l.Tail.val)) :
l = ⟨term I ho :: l.Tail.val, hlc⟩ := by
simp_rw [← max_eq_o_cons_tail ho l hl hlh]
rfl
theorem GoodProducts.head!_eq_o_of_maxProducts [Inhabited I] (l : ↑(MaxProducts C ho)) :
l.val.val.head! = term I ho := by
rw [eq_comm, ← ord_term ho]
have hm := l.prop.2
have := Products.prop_of_isGood_of_contained C _ l.prop.1 hsC l.val.val.head!
(List.head!_mem_self (List.ne_nil_of_mem hm))
simp only [Order.lt_succ_iff] at this
refine eq_of_le_of_not_lt this (not_lt.mpr ?_)
have h : ord I (term I ho) ≤ ord I l.val.val.head! := by
simp only [← ord_term_aux, ord, Ordinal.typein_le_typein, not_lt]
exact Products.rel_head!_of_mem hm
rwa [ord_term_aux] at h
theorem GoodProducts.max_eq_o_cons_tail (l : MaxProducts C ho) :
l.val.val = (term I ho) :: l.val.Tail.val :=
have : Inhabited I := ⟨term I ho⟩
Products.max_eq_o_cons_tail ho l.val (List.ne_nil_of_mem l.prop.2)
(head!_eq_o_of_maxProducts _ hsC ho l)
theorem Products.evalCons {l : List I} {a : I}
(hla : (a::l).Chain' (·>·)) : Products.eval C ⟨a::l,hla⟩ =
(e C a) * Products.eval C ⟨l,List.Chain'.sublist hla (List.tail_sublist (a::l))⟩ := by
simp only [eval.eq_1, List.map, List.prod_cons]
| Mathlib/Topology/Category/Profinite/Nobeling.lean | 1,513 | 1,540 | theorem Products.max_eq_eval [Inhabited I] (l : Products I) (hl : l.val ≠ [])
(hlh : l.val.head! = term I ho) :
Linear_CC' C hsC ho (l.eval C) = l.Tail.eval (C' C ho) := by |
have hlc : ((term I ho) :: l.Tail.val).Chain' (·>·) := by
rw [← max_eq_o_cons_tail ho l hl hlh]; exact l.prop
rw [max_eq_o_cons_tail' ho l hl hlh hlc, Products.evalCons]
ext x
simp only [Linear_CC', Linear_CC'₁, LocallyConstant.comapₗ, Linear_CC'₀, Subtype.coe_eta,
LinearMap.sub_apply, LinearMap.coe_mk, AddHom.coe_mk, LocallyConstant.sub_apply,
LocallyConstant.coe_comap, LocallyConstant.coe_mul, ContinuousMap.coe_mk, Function.comp_apply,
Pi.mul_apply]
rw [CC'₁, CC'₀, Products.eval_eq, Products.eval_eq, Products.eval_eq]
simp only [mul_ite, mul_one, mul_zero]
have hi' : ∀ i, i ∈ l.Tail.val → (x.val i = SwapTrue o x.val i) := by
intro i hi
simp only [SwapTrue, @eq_comm _ (x.val i), ite_eq_right_iff, ord_term ho]
rintro rfl
exact ((List.Chain.rel hlc hi).ne rfl).elim
have H : (∀ i, i ∈ l.Tail.val → (x.val i = true)) =
(∀ i, i ∈ l.Tail.val → (SwapTrue o x.val i = true)) := by
apply forall_congr; intro i; apply forall_congr; intro hi; rw [hi' i hi]
simp only [H]
split_ifs with h₁ h₂ h₃ <;> try (dsimp [e])
· rw [if_pos (swapTrue_eq_true _ _), if_neg]
· rfl
· simp [mem_C'_eq_false C ho x x.prop, Bool.coe_false]
· push_neg at h₂; obtain ⟨i, hi⟩ := h₂; exfalso; rw [hi' i hi.1] at hi; exact hi.2 (h₁ i hi.1)
· push_neg at h₁; obtain ⟨i, hi⟩ := h₁; exfalso; rw [← hi' i hi.1] at hi; exact hi.2 (h₃ i hi.1)
|
import Mathlib.Order.UpperLower.Basic
import Mathlib.Data.Finset.Preimage
#align_import combinatorics.young.young_diagram from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
open Function
@[ext]
structure YoungDiagram where
cells : Finset (ℕ × ℕ)
isLowerSet : IsLowerSet (cells : Set (ℕ × ℕ))
#align young_diagram YoungDiagram
namespace YoungDiagram
instance : SetLike YoungDiagram (ℕ × ℕ) where
-- Porting note (#11215): TODO: figure out how to do this correctly
coe := fun y => y.cells
coe_injective' μ ν h := by rwa [YoungDiagram.ext_iff, ← Finset.coe_inj]
@[simp]
theorem mem_cells {μ : YoungDiagram} (c : ℕ × ℕ) : c ∈ μ.cells ↔ c ∈ μ :=
Iff.rfl
#align young_diagram.mem_cells YoungDiagram.mem_cells
@[simp]
theorem mem_mk (c : ℕ × ℕ) (cells) (isLowerSet) :
c ∈ YoungDiagram.mk cells isLowerSet ↔ c ∈ cells :=
Iff.rfl
#align young_diagram.mem_mk YoungDiagram.mem_mk
instance decidableMem (μ : YoungDiagram) : DecidablePred (· ∈ μ) :=
inferInstanceAs (DecidablePred (· ∈ μ.cells))
#align young_diagram.decidable_mem YoungDiagram.decidableMem
theorem up_left_mem (μ : YoungDiagram) {i1 i2 j1 j2 : ℕ} (hi : i1 ≤ i2) (hj : j1 ≤ j2)
(hcell : (i2, j2) ∈ μ) : (i1, j1) ∈ μ :=
μ.isLowerSet (Prod.mk_le_mk.mpr ⟨hi, hj⟩) hcell
#align young_diagram.up_left_mem YoungDiagram.up_left_mem
protected abbrev card (μ : YoungDiagram) : ℕ :=
μ.cells.card
#align young_diagram.card YoungDiagram.card
section EquivListRowLens
protected def cellsOfRowLens : List ℕ → Finset (ℕ × ℕ)
| [] => ∅
| w::ws =>
({0} : Finset ℕ) ×ˢ Finset.range w ∪
(YoungDiagram.cellsOfRowLens ws).map
(Embedding.prodMap ⟨_, Nat.succ_injective⟩ (Embedding.refl ℕ))
#align young_diagram.cells_of_row_lens YoungDiagram.cellsOfRowLens
protected theorem mem_cellsOfRowLens {w : List ℕ} {c : ℕ × ℕ} :
c ∈ YoungDiagram.cellsOfRowLens w ↔ ∃ h : c.fst < w.length, c.snd < w.get ⟨c.fst, h⟩ := by
induction' w with w_hd w_tl w_ih generalizing c <;> rw [YoungDiagram.cellsOfRowLens]
· simp [YoungDiagram.cellsOfRowLens]
· rcases c with ⟨⟨_, _⟩, _⟩
· simp
-- Porting note: was `simpa`
· simp [w_ih, -Finset.singleton_product, Nat.succ_lt_succ_iff]
#align young_diagram.mem_cells_of_row_lens YoungDiagram.mem_cellsOfRowLens
def ofRowLens (w : List ℕ) (hw : w.Sorted (· ≥ ·)) : YoungDiagram where
cells := YoungDiagram.cellsOfRowLens w
isLowerSet := by
rintro ⟨i2, j2⟩ ⟨i1, j1⟩ ⟨hi : i1 ≤ i2, hj : j1 ≤ j2⟩ hcell
rw [Finset.mem_coe, YoungDiagram.mem_cellsOfRowLens] at hcell ⊢
obtain ⟨h1, h2⟩ := hcell
refine ⟨hi.trans_lt h1, ?_⟩
calc
j1 ≤ j2 := hj
_ < w.get ⟨i2, _⟩ := h2
_ ≤ w.get ⟨i1, _⟩ := by
obtain rfl | h := eq_or_lt_of_le hi
· convert le_refl (w.get ⟨i1, h1⟩)
· exact List.pairwise_iff_get.mp hw _ _ h
#align young_diagram.of_row_lens YoungDiagram.ofRowLens
theorem mem_ofRowLens {w : List ℕ} {hw : w.Sorted (· ≥ ·)} {c : ℕ × ℕ} :
c ∈ ofRowLens w hw ↔ ∃ h : c.fst < w.length, c.snd < w.get ⟨c.fst, h⟩ :=
YoungDiagram.mem_cellsOfRowLens
#align young_diagram.mem_of_row_lens YoungDiagram.mem_ofRowLens
theorem rowLens_length_ofRowLens {w : List ℕ} {hw : w.Sorted (· ≥ ·)} (hpos : ∀ x ∈ w, 0 < x) :
(ofRowLens w hw).rowLens.length = w.length := by
simp only [length_rowLens, colLen, Nat.find_eq_iff, mem_cells, mem_ofRowLens,
lt_self_iff_false, IsEmpty.exists_iff, Classical.not_not]
exact ⟨not_false, fun n hn => ⟨hn, hpos _ (List.get_mem _ _ hn)⟩⟩
#align young_diagram.row_lens_length_of_row_lens YoungDiagram.rowLens_length_ofRowLens
theorem rowLen_ofRowLens {w : List ℕ} {hw : w.Sorted (· ≥ ·)} (i : Fin w.length) :
(ofRowLens w hw).rowLen i = w.get i := by
simp [rowLen, Nat.find_eq_iff, mem_ofRowLens]
#align young_diagram.row_len_of_row_lens YoungDiagram.rowLen_ofRowLens
| Mathlib/Combinatorics/Young/YoungDiagram.lean | 506 | 509 | theorem ofRowLens_to_rowLens_eq_self {μ : YoungDiagram} : ofRowLens _ (rowLens_sorted μ) = μ := by |
ext ⟨i, j⟩
simp only [mem_cells, mem_ofRowLens, length_rowLens, get_rowLens]
simpa [← mem_iff_lt_colLen, mem_iff_lt_rowLen] using j.zero_le.trans_lt
|
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Perm.Basic
#align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Equiv Finset
namespace Equiv.Perm
variable {α : Type*}
section support
variable [DecidableEq α] [Fintype α] {f g : Perm α}
def support (f : Perm α) : Finset α :=
univ.filter fun x => f x ≠ x
#align equiv.perm.support Equiv.Perm.support
@[simp]
theorem mem_support {x : α} : x ∈ f.support ↔ f x ≠ x := by
rw [support, mem_filter, and_iff_right (mem_univ x)]
#align equiv.perm.mem_support Equiv.Perm.mem_support
theorem not_mem_support {x : α} : x ∉ f.support ↔ f x = x := by simp
#align equiv.perm.not_mem_support Equiv.Perm.not_mem_support
theorem coe_support_eq_set_support (f : Perm α) : (f.support : Set α) = { x | f x ≠ x } := by
ext
simp
#align equiv.perm.coe_support_eq_set_support Equiv.Perm.coe_support_eq_set_support
@[simp]
theorem support_eq_empty_iff {σ : Perm α} : σ.support = ∅ ↔ σ = 1 := by
simp_rw [Finset.ext_iff, mem_support, Finset.not_mem_empty, iff_false_iff, not_not,
Equiv.Perm.ext_iff, one_apply]
#align equiv.perm.support_eq_empty_iff Equiv.Perm.support_eq_empty_iff
@[simp]
theorem support_one : (1 : Perm α).support = ∅ := by rw [support_eq_empty_iff]
#align equiv.perm.support_one Equiv.Perm.support_one
@[simp]
theorem support_refl : support (Equiv.refl α) = ∅ :=
support_one
#align equiv.perm.support_refl Equiv.Perm.support_refl
theorem support_congr (h : f.support ⊆ g.support) (h' : ∀ x ∈ g.support, f x = g x) : f = g := by
ext x
by_cases hx : x ∈ g.support
· exact h' x hx
· rw [not_mem_support.mp hx, ← not_mem_support]
exact fun H => hx (h H)
#align equiv.perm.support_congr Equiv.Perm.support_congr
theorem support_mul_le (f g : Perm α) : (f * g).support ≤ f.support ⊔ g.support := fun x => by
simp only [sup_eq_union]
rw [mem_union, mem_support, mem_support, mem_support, mul_apply, ← not_and_or, not_imp_not]
rintro ⟨hf, hg⟩
rw [hg, hf]
#align equiv.perm.support_mul_le Equiv.Perm.support_mul_le
theorem exists_mem_support_of_mem_support_prod {l : List (Perm α)} {x : α}
(hx : x ∈ l.prod.support) : ∃ f : Perm α, f ∈ l ∧ x ∈ f.support := by
contrapose! hx
simp_rw [mem_support, not_not] at hx ⊢
induction' l with f l ih
· rfl
· rw [List.prod_cons, mul_apply, ih, hx]
· simp only [List.find?, List.mem_cons, true_or]
intros f' hf'
refine hx f' ?_
simp only [List.find?, List.mem_cons]
exact Or.inr hf'
#align equiv.perm.exists_mem_support_of_mem_support_prod Equiv.Perm.exists_mem_support_of_mem_support_prod
theorem support_pow_le (σ : Perm α) (n : ℕ) : (σ ^ n).support ≤ σ.support := fun _ h1 =>
mem_support.mpr fun h2 => mem_support.mp h1 (pow_apply_eq_self_of_apply_eq_self h2 n)
#align equiv.perm.support_pow_le Equiv.Perm.support_pow_le
@[simp]
theorem support_inv (σ : Perm α) : support σ⁻¹ = σ.support := by
simp_rw [Finset.ext_iff, mem_support, not_iff_not, inv_eq_iff_eq.trans eq_comm, imp_true_iff]
#align equiv.perm.support_inv Equiv.Perm.support_inv
-- @[simp] -- Porting note (#10618): simp can prove this
theorem apply_mem_support {x : α} : f x ∈ f.support ↔ x ∈ f.support := by
rw [mem_support, mem_support, Ne, Ne, apply_eq_iff_eq]
#align equiv.perm.apply_mem_support Equiv.Perm.apply_mem_support
-- Porting note (#10756): new theorem
@[simp]
| Mathlib/GroupTheory/Perm/Support.lean | 369 | 371 | theorem apply_pow_apply_eq_iff (f : Perm α) (n : ℕ) {x : α} :
f ((f ^ n) x) = (f ^ n) x ↔ f x = x := by |
rw [← mul_apply, Commute.self_pow f, mul_apply, apply_eq_iff_eq]
|
import Mathlib.Probability.Kernel.Basic
import Mathlib.MeasureTheory.Constructions.Prod.Basic
import Mathlib.MeasureTheory.Integral.DominatedConvergence
#align_import probability.kernel.measurable_integral from "leanprover-community/mathlib"@"28b2a92f2996d28e580450863c130955de0ed398"
open MeasureTheory ProbabilityTheory Function Set Filter
open scoped MeasureTheory ENNReal Topology
variable {α β γ : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
{κ : kernel α β} {η : kernel (α × β) γ} {a : α}
namespace ProbabilityTheory
open ProbabilityTheory.kernel
open ProbabilityTheory ProbabilityTheory.kernel
namespace MeasureTheory
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [IsSFiniteKernel κ]
[IsSFiniteKernel η]
| Mathlib/Probability/Kernel/MeasurableIntegral.lean | 257 | 302 | theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
(hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by |
classical
by_cases hE : CompleteSpace E; swap
· simp [integral, hE, stronglyMeasurable_const]
borelize E
haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
hf.separableSpace_range_union_singleton
let s : ℕ → SimpleFunc (α × β) E :=
SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
let f' : ℕ → α → E := fun n =>
{x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
have hf' : ∀ n, StronglyMeasurable (f' n) := by
intro n; refine StronglyMeasurable.indicator ?_ (measurableSet_kernel_integrable hf)
have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
intro x; refine Finset.Subset.trans (Finset.filter_subset _ _) ?_; intro y
simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
refine Finset.stronglyMeasurable_sum _ fun x _ => ?_
refine (Measurable.ennreal_toReal ?_).stronglyMeasurable.smul_const _
simp only [s', SimpleFunc.coe_comp, preimage_comp]
apply kernel.measurable_kernel_prod_mk_left
exact (s n).measurableSet_fiber x
have h2f' : Tendsto f' atTop (𝓝 fun x : α => ∫ y : β, f x y ∂κ x) := by
rw [tendsto_pi_nhds]; intro x
by_cases hfx : Integrable (f x) (κ x)
· have (n) : Integrable (s' n x) (κ x) := by
apply (hfx.norm.add hfx.norm).mono' (s' n x).aestronglyMeasurable
filter_upwards with y
simp_rw [s', SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n
simp only [f', hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem,
mem_setOf_eq]
refine
tendsto_integral_of_dominated_convergence (fun y => ‖f x y‖ + ‖f x y‖)
(fun n => (s' n x).aestronglyMeasurable) (hfx.norm.add hfx.norm) ?_ ?_
· -- Porting note: was
-- exact fun n => eventually_of_forall fun y =>
-- SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n
exact fun n => eventually_of_forall fun y =>
SimpleFunc.norm_approxOn_zero_le hf.measurable (by simp) (x, y) n
· refine eventually_of_forall fun y => SimpleFunc.tendsto_approxOn hf.measurable (by simp) ?_
apply subset_closure
simp [-uncurry_apply_pair]
· simp [f', hfx, integral_undef]
exact stronglyMeasurable_of_tendsto _ hf' h2f'
|
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.LinearAlgebra.Matrix.Block
#align_import analysis.inner_product_space.gram_schmidt_ortho from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0"
open Finset Submodule FiniteDimensional
variable (𝕜 : Type*) {E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
variable {ι : Type*} [LinearOrder ι] [LocallyFiniteOrderBot ι] [IsWellOrder ι (· < ·)]
attribute [local instance] IsWellOrder.toHasWellFounded
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
noncomputable def gramSchmidt [IsWellOrder ι (· < ·)] (f : ι → E) (n : ι) : E :=
f n - ∑ i : Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt f i) (f n)
termination_by n
decreasing_by exact mem_Iio.1 i.2
#align gram_schmidt gramSchmidt
theorem gramSchmidt_def (f : ι → E) (n : ι) :
gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by
rw [← sum_attach, attach_eq_univ, gramSchmidt]
#align gram_schmidt_def gramSchmidt_def
theorem gramSchmidt_def' (f : ι → E) (n : ι) :
f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by
rw [gramSchmidt_def, sub_add_cancel]
#align gram_schmidt_def' gramSchmidt_def'
theorem gramSchmidt_def'' (f : ι → E) (n : ι) :
f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n,
(⟪gramSchmidt 𝕜 f i, f n⟫ / (‖gramSchmidt 𝕜 f i‖ : 𝕜) ^ 2) • gramSchmidt 𝕜 f i := by
convert gramSchmidt_def' 𝕜 f n
rw [orthogonalProjection_singleton, RCLike.ofReal_pow]
#align gram_schmidt_def'' gramSchmidt_def''
@[simp]
theorem gramSchmidt_zero {ι : Type*} [LinearOrder ι] [LocallyFiniteOrder ι] [OrderBot ι]
[IsWellOrder ι (· < ·)] (f : ι → E) : gramSchmidt 𝕜 f ⊥ = f ⊥ := by
rw [gramSchmidt_def, Iio_eq_Ico, Finset.Ico_self, Finset.sum_empty, sub_zero]
#align gram_schmidt_zero gramSchmidt_zero
theorem gramSchmidt_orthogonal (f : ι → E) {a b : ι} (h₀ : a ≠ b) :
⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := by
suffices ∀ a b : ι, a < b → ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 by
cases' h₀.lt_or_lt with ha hb
· exact this _ _ ha
· rw [inner_eq_zero_symm]
exact this _ _ hb
clear h₀ a b
intro a b h₀
revert a
apply wellFounded_lt.induction b
intro b ih a h₀
simp only [gramSchmidt_def 𝕜 f b, inner_sub_right, inner_sum, orthogonalProjection_singleton,
inner_smul_right]
rw [Finset.sum_eq_single_of_mem a (Finset.mem_Iio.mpr h₀)]
· by_cases h : gramSchmidt 𝕜 f a = 0
· simp only [h, inner_zero_left, zero_div, zero_mul, sub_zero]
· rw [RCLike.ofReal_pow, ← inner_self_eq_norm_sq_to_K, div_mul_cancel₀, sub_self]
rwa [inner_self_ne_zero]
intro i hi hia
simp only [mul_eq_zero, div_eq_zero_iff, inner_self_eq_zero]
right
cases' hia.lt_or_lt with hia₁ hia₂
· rw [inner_eq_zero_symm]
exact ih a h₀ i hia₁
· exact ih i (mem_Iio.1 hi) a hia₂
#align gram_schmidt_orthogonal gramSchmidt_orthogonal
theorem gramSchmidt_pairwise_orthogonal (f : ι → E) :
Pairwise fun a b => ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := fun _ _ =>
gramSchmidt_orthogonal 𝕜 f
#align gram_schmidt_pairwise_orthogonal gramSchmidt_pairwise_orthogonal
theorem gramSchmidt_inv_triangular (v : ι → E) {i j : ι} (hij : i < j) :
⟪gramSchmidt 𝕜 v j, v i⟫ = 0 := by
rw [gramSchmidt_def'' 𝕜 v]
simp only [inner_add_right, inner_sum, inner_smul_right]
set b : ι → E := gramSchmidt 𝕜 v
convert zero_add (0 : 𝕜)
· exact gramSchmidt_orthogonal 𝕜 v hij.ne'
apply Finset.sum_eq_zero
rintro k hki'
have hki : k < i := by simpa using hki'
have : ⟪b j, b k⟫ = 0 := gramSchmidt_orthogonal 𝕜 v (hki.trans hij).ne'
simp [this]
#align gram_schmidt_inv_triangular gramSchmidt_inv_triangular
open Submodule Set Order
theorem mem_span_gramSchmidt (f : ι → E) {i j : ι} (hij : i ≤ j) :
f i ∈ span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic j) := by
rw [gramSchmidt_def' 𝕜 f i]
simp_rw [orthogonalProjection_singleton]
exact Submodule.add_mem _ (subset_span <| mem_image_of_mem _ hij)
(Submodule.sum_mem _ fun k hk => smul_mem (span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic j)) _ <|
subset_span <| mem_image_of_mem (gramSchmidt 𝕜 f) <| (Finset.mem_Iio.1 hk).le.trans hij)
#align mem_span_gram_schmidt mem_span_gramSchmidt
theorem gramSchmidt_mem_span (f : ι → E) :
∀ {j i}, i ≤ j → gramSchmidt 𝕜 f i ∈ span 𝕜 (f '' Set.Iic j) := by
intro j i hij
rw [gramSchmidt_def 𝕜 f i]
simp_rw [orthogonalProjection_singleton]
refine Submodule.sub_mem _ (subset_span (mem_image_of_mem _ hij))
(Submodule.sum_mem _ fun k hk => ?_)
let hkj : k < j := (Finset.mem_Iio.1 hk).trans_le hij
exact smul_mem _ _
(span_mono (image_subset f <| Iic_subset_Iic.2 hkj.le) <| gramSchmidt_mem_span _ le_rfl)
termination_by j => j
#align gram_schmidt_mem_span gramSchmidt_mem_span
theorem span_gramSchmidt_Iic (f : ι → E) (c : ι) :
span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic c) = span 𝕜 (f '' Set.Iic c) :=
span_eq_span (Set.image_subset_iff.2 fun _ => gramSchmidt_mem_span _ _) <|
Set.image_subset_iff.2 fun _ => mem_span_gramSchmidt _ _
#align span_gram_schmidt_Iic span_gramSchmidt_Iic
theorem span_gramSchmidt_Iio (f : ι → E) (c : ι) :
span 𝕜 (gramSchmidt 𝕜 f '' Set.Iio c) = span 𝕜 (f '' Set.Iio c) :=
span_eq_span (Set.image_subset_iff.2 fun _ hi =>
span_mono (image_subset _ <| Iic_subset_Iio.2 hi) <| gramSchmidt_mem_span _ _ le_rfl) <|
Set.image_subset_iff.2 fun _ hi =>
span_mono (image_subset _ <| Iic_subset_Iio.2 hi) <| mem_span_gramSchmidt _ _ le_rfl
#align span_gram_schmidt_Iio span_gramSchmidt_Iio
theorem span_gramSchmidt (f : ι → E) : span 𝕜 (range (gramSchmidt 𝕜 f)) = span 𝕜 (range f) :=
span_eq_span (range_subset_iff.2 fun _ =>
span_mono (image_subset_range _ _) <| gramSchmidt_mem_span _ _ le_rfl) <|
range_subset_iff.2 fun _ =>
span_mono (image_subset_range _ _) <| mem_span_gramSchmidt _ _ le_rfl
#align span_gram_schmidt span_gramSchmidt
theorem gramSchmidt_of_orthogonal {f : ι → E} (hf : Pairwise fun i j => ⟪f i, f j⟫ = 0) :
gramSchmidt 𝕜 f = f := by
ext i
rw [gramSchmidt_def]
trans f i - 0
· congr
apply Finset.sum_eq_zero
intro j hj
rw [Submodule.coe_eq_zero]
suffices span 𝕜 (f '' Set.Iic j) ⟂ 𝕜 ∙ f i by
apply orthogonalProjection_mem_subspace_orthogonalComplement_eq_zero
rw [mem_orthogonal_singleton_iff_inner_left]
rw [← mem_orthogonal_singleton_iff_inner_right]
exact this (gramSchmidt_mem_span 𝕜 f (le_refl j))
rw [isOrtho_span]
rintro u ⟨k, hk, rfl⟩ v (rfl : v = f i)
apply hf
exact (lt_of_le_of_lt hk (Finset.mem_Iio.mp hj)).ne
· simp
#align gram_schmidt_of_orthogonal gramSchmidt_of_orthogonal
variable {𝕜}
theorem gramSchmidt_ne_zero_coe {f : ι → E} (n : ι)
(h₀ : LinearIndependent 𝕜 (f ∘ ((↑) : Set.Iic n → ι))) : gramSchmidt 𝕜 f n ≠ 0 := by
by_contra h
have h₁ : f n ∈ span 𝕜 (f '' Set.Iio n) := by
rw [← span_gramSchmidt_Iio 𝕜 f n, gramSchmidt_def' 𝕜 f, h, zero_add]
apply Submodule.sum_mem _ _
intro a ha
simp only [Set.mem_image, Set.mem_Iio, orthogonalProjection_singleton]
apply Submodule.smul_mem _ _ _
rw [Finset.mem_Iio] at ha
exact subset_span ⟨a, ha, by rfl⟩
have h₂ : (f ∘ ((↑) : Set.Iic n → ι)) ⟨n, le_refl n⟩ ∈
span 𝕜 (f ∘ ((↑) : Set.Iic n → ι) '' Set.Iio ⟨n, le_refl n⟩) := by
rw [image_comp]
simpa using h₁
apply LinearIndependent.not_mem_span_image h₀ _ h₂
simp only [Set.mem_Iio, lt_self_iff_false, not_false_iff]
#align gram_schmidt_ne_zero_coe gramSchmidt_ne_zero_coe
theorem gramSchmidt_ne_zero {f : ι → E} (n : ι) (h₀ : LinearIndependent 𝕜 f) :
gramSchmidt 𝕜 f n ≠ 0 :=
gramSchmidt_ne_zero_coe _ (LinearIndependent.comp h₀ _ Subtype.coe_injective)
#align gram_schmidt_ne_zero gramSchmidt_ne_zero
theorem gramSchmidt_triangular {i j : ι} (hij : i < j) (b : Basis ι 𝕜 E) :
b.repr (gramSchmidt 𝕜 b i) j = 0 := by
have : gramSchmidt 𝕜 b i ∈ span 𝕜 (gramSchmidt 𝕜 b '' Set.Iio j) :=
subset_span ((Set.mem_image _ _ _).2 ⟨i, hij, rfl⟩)
have : gramSchmidt 𝕜 b i ∈ span 𝕜 (b '' Set.Iio j) := by rwa [← span_gramSchmidt_Iio 𝕜 b j]
have : ↑(b.repr (gramSchmidt 𝕜 b i)).support ⊆ Set.Iio j :=
Basis.repr_support_subset_of_mem_span b (Set.Iio j) this
exact (Finsupp.mem_supported' _ _).1 ((Finsupp.mem_supported 𝕜 _).2 this) j Set.not_mem_Iio_self
#align gram_schmidt_triangular gramSchmidt_triangular
theorem gramSchmidt_linearIndependent {f : ι → E} (h₀ : LinearIndependent 𝕜 f) :
LinearIndependent 𝕜 (gramSchmidt 𝕜 f) :=
linearIndependent_of_ne_zero_of_inner_eq_zero (fun _ => gramSchmidt_ne_zero _ h₀) fun _ _ =>
gramSchmidt_orthogonal 𝕜 f
#align gram_schmidt_linear_independent gramSchmidt_linearIndependent
noncomputable def gramSchmidtBasis (b : Basis ι 𝕜 E) : Basis ι 𝕜 E :=
Basis.mk (gramSchmidt_linearIndependent b.linearIndependent)
((span_gramSchmidt 𝕜 b).trans b.span_eq).ge
#align gram_schmidt_basis gramSchmidtBasis
theorem coe_gramSchmidtBasis (b : Basis ι 𝕜 E) : (gramSchmidtBasis b : ι → E) = gramSchmidt 𝕜 b :=
Basis.coe_mk _ _
#align coe_gram_schmidt_basis coe_gramSchmidtBasis
variable (𝕜)
noncomputable def gramSchmidtNormed (f : ι → E) (n : ι) : E :=
(‖gramSchmidt 𝕜 f n‖ : 𝕜)⁻¹ • gramSchmidt 𝕜 f n
#align gram_schmidt_normed gramSchmidtNormed
variable {𝕜}
theorem gramSchmidtNormed_unit_length_coe {f : ι → E} (n : ι)
(h₀ : LinearIndependent 𝕜 (f ∘ ((↑) : Set.Iic n → ι))) : ‖gramSchmidtNormed 𝕜 f n‖ = 1 := by
simp only [gramSchmidt_ne_zero_coe n h₀, gramSchmidtNormed, norm_smul_inv_norm, Ne,
not_false_iff]
#align gram_schmidt_normed_unit_length_coe gramSchmidtNormed_unit_length_coe
theorem gramSchmidtNormed_unit_length {f : ι → E} (n : ι) (h₀ : LinearIndependent 𝕜 f) :
‖gramSchmidtNormed 𝕜 f n‖ = 1 :=
gramSchmidtNormed_unit_length_coe _ (LinearIndependent.comp h₀ _ Subtype.coe_injective)
#align gram_schmidt_normed_unit_length gramSchmidtNormed_unit_length
theorem gramSchmidtNormed_unit_length' {f : ι → E} {n : ι} (hn : gramSchmidtNormed 𝕜 f n ≠ 0) :
‖gramSchmidtNormed 𝕜 f n‖ = 1 := by
rw [gramSchmidtNormed] at *
rw [norm_smul_inv_norm]
simpa using hn
#align gram_schmidt_normed_unit_length' gramSchmidtNormed_unit_length'
theorem gramSchmidt_orthonormal {f : ι → E} (h₀ : LinearIndependent 𝕜 f) :
Orthonormal 𝕜 (gramSchmidtNormed 𝕜 f) := by
unfold Orthonormal
constructor
· simp only [gramSchmidtNormed_unit_length, h₀, eq_self_iff_true, imp_true_iff]
· intro i j hij
simp only [gramSchmidtNormed, inner_smul_left, inner_smul_right, RCLike.conj_inv,
RCLike.conj_ofReal, mul_eq_zero, inv_eq_zero, RCLike.ofReal_eq_zero, norm_eq_zero]
repeat' right
exact gramSchmidt_orthogonal 𝕜 f hij
#align gram_schmidt_orthonormal gramSchmidt_orthonormal
theorem gramSchmidt_orthonormal' (f : ι → E) :
Orthonormal 𝕜 fun i : { i | gramSchmidtNormed 𝕜 f i ≠ 0 } => gramSchmidtNormed 𝕜 f i := by
refine ⟨fun i => gramSchmidtNormed_unit_length' i.prop, ?_⟩
rintro i j (hij : ¬_)
rw [Subtype.ext_iff] at hij
simp [gramSchmidtNormed, inner_smul_left, inner_smul_right, gramSchmidt_orthogonal 𝕜 f hij]
#align gram_schmidt_orthonormal' gramSchmidt_orthonormal'
theorem span_gramSchmidtNormed (f : ι → E) (s : Set ι) :
span 𝕜 (gramSchmidtNormed 𝕜 f '' s) = span 𝕜 (gramSchmidt 𝕜 f '' s) := by
refine span_eq_span
(Set.image_subset_iff.2 fun i hi => smul_mem _ _ <| subset_span <| mem_image_of_mem _ hi)
(Set.image_subset_iff.2 fun i hi =>
span_mono (image_subset _ <| singleton_subset_set_iff.2 hi) ?_)
simp only [coe_singleton, Set.image_singleton]
by_cases h : gramSchmidt 𝕜 f i = 0
· simp [h]
· refine mem_span_singleton.2 ⟨‖gramSchmidt 𝕜 f i‖, smul_inv_smul₀ ?_ _⟩
exact mod_cast norm_ne_zero_iff.2 h
#align span_gram_schmidt_normed span_gramSchmidtNormed
| Mathlib/Analysis/InnerProductSpace/GramSchmidtOrtho.lean | 321 | 323 | theorem span_gramSchmidtNormed_range (f : ι → E) :
span 𝕜 (range (gramSchmidtNormed 𝕜 f)) = span 𝕜 (range (gramSchmidt 𝕜 f)) := by |
simpa only [image_univ.symm] using span_gramSchmidtNormed f univ
|
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.NumberTheory.Bernoulli
#align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a"
noncomputable section
open Nat Polynomial
open Nat Finset
namespace Polynomial
def bernoulli (n : ℕ) : ℚ[X] :=
∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i)
#align polynomial.bernoulli Polynomial.bernoulli
theorem bernoulli_def (n : ℕ) : bernoulli n =
∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by
rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli]
apply sum_congr rfl
rintro x hx
rw [mem_range_succ_iff] at hx
rw [choose_symm hx, tsub_tsub_cancel_of_le hx]
#align polynomial.bernoulli_def Polynomial.bernoulli_def
theorem derivative_bernoulli_add_one (k : ℕ) :
Polynomial.derivative (bernoulli (k + 1)) = (k + 1) * bernoulli k := by
simp_rw [bernoulli, derivative_sum, derivative_monomial, Nat.sub_sub, Nat.add_sub_add_right]
-- LHS sum has an extra term, but the coefficient is zero:
rw [range_add_one, sum_insert not_mem_range_self, tsub_self, cast_zero, mul_zero,
map_zero, zero_add, mul_sum]
-- the rest of the sum is termwise equal:
refine sum_congr (by rfl) fun m _ => ?_
conv_rhs => rw [← Nat.cast_one, ← Nat.cast_add, ← C_eq_natCast, C_mul_monomial, mul_comm]
rw [mul_assoc, mul_assoc, ← Nat.cast_mul, ← Nat.cast_mul]
congr 3
rw [(choose_mul_succ_eq k m).symm]
#align polynomial.derivative_bernoulli_add_one Polynomial.derivative_bernoulli_add_one
theorem derivative_bernoulli (k : ℕ) :
Polynomial.derivative (bernoulli k) = k * bernoulli (k - 1) := by
cases k with
| zero => rw [Nat.cast_zero, zero_mul, bernoulli_zero, derivative_one]
| succ k => exact mod_cast derivative_bernoulli_add_one k
#align polynomial.derivative_bernoulli Polynomial.derivative_bernoulli
@[simp]
nonrec theorem sum_bernoulli (n : ℕ) :
(∑ k ∈ range (n + 1), ((n + 1).choose k : ℚ) • bernoulli k) = monomial n (n + 1 : ℚ) := by
simp_rw [bernoulli_def, Finset.smul_sum, Finset.range_eq_Ico, ← Finset.sum_Ico_Ico_comm,
Finset.sum_Ico_eq_sum_range]
simp only [add_tsub_cancel_left, tsub_zero, zero_add, map_add]
simp_rw [smul_monomial, mul_comm (_root_.bernoulli _) _, smul_eq_mul, ← mul_assoc]
conv_lhs =>
apply_congr
· skip
· conv =>
apply_congr
· skip
· rw [← Nat.cast_mul, choose_mul ((le_tsub_iff_left <| mem_range_le (by assumption)).1 <|
mem_range_le (by assumption)) (le.intro rfl),
Nat.cast_mul, add_tsub_cancel_left, mul_assoc, mul_comm, ← smul_eq_mul, ←
smul_monomial]
simp_rw [← sum_smul]
rw [sum_range_succ_comm]
simp only [add_right_eq_self, mul_one, cast_one, cast_add, add_tsub_cancel_left,
choose_succ_self_right, one_smul, _root_.bernoulli_zero, sum_singleton, zero_add,
map_add, range_one, bernoulli_zero, mul_one, one_mul, add_zero, choose_self]
apply sum_eq_zero fun x hx => _
have f : ∀ x ∈ range n, ¬n + 1 - x = 1 := by
rintro x H
rw [mem_range] at H
rw [eq_comm]
exact _root_.ne_of_lt (Nat.lt_of_lt_of_le one_lt_two (le_tsub_of_add_le_left (succ_le_succ H)))
intro x hx
rw [sum_bernoulli]
have g : ite (n + 1 - x = 1) (1 : ℚ) 0 = 0 := by
simp only [ite_eq_right_iff, one_ne_zero]
intro h₁
exact (f x hx) h₁
rw [g, zero_smul]
#align polynomial.sum_bernoulli Polynomial.sum_bernoulli
theorem bernoulli_eq_sub_sum (n : ℕ) :
(n.succ : ℚ) • bernoulli n =
monomial n (n.succ : ℚ) - ∑ k ∈ Finset.range n, ((n + 1).choose k : ℚ) • bernoulli k := by
rw [Nat.cast_succ, ← sum_bernoulli n, sum_range_succ, add_sub_cancel_left, choose_succ_self_right,
Nat.cast_succ]
#align polynomial.bernoulli_eq_sub_sum Polynomial.bernoulli_eq_sub_sum
theorem sum_range_pow_eq_bernoulli_sub (n p : ℕ) :
((p + 1 : ℚ) * ∑ k ∈ range n, (k : ℚ) ^ p) = (bernoulli p.succ).eval (n : ℚ) -
_root_.bernoulli p.succ := by
rw [sum_range_pow, bernoulli_def, eval_finset_sum, ← sum_div, mul_div_cancel₀ _ _]
· simp_rw [eval_monomial]
symm
rw [← sum_flip _, sum_range_succ]
simp only [tsub_self, tsub_zero, choose_zero_right, cast_one, mul_one, _root_.pow_zero,
add_tsub_cancel_right]
apply sum_congr rfl fun x hx => _
intro x hx
apply congr_arg₂ _ (congr_arg₂ _ _ _) rfl
· rw [Nat.sub_sub_self (mem_range_le hx)]
· rw [← choose_symm (mem_range_le hx)]
· norm_cast
#align polynomial.sum_range_pow_eq_bernoulli_sub Polynomial.sum_range_pow_eq_bernoulli_sub
theorem bernoulli_succ_eval (n p : ℕ) : (bernoulli p.succ).eval (n : ℚ) =
_root_.bernoulli p.succ + (p + 1 : ℚ) * ∑ k ∈ range n, (k : ℚ) ^ p := by
apply eq_add_of_sub_eq'
rw [sum_range_pow_eq_bernoulli_sub]
#align polynomial.bernoulli_succ_eval Polynomial.bernoulli_succ_eval
| Mathlib/NumberTheory/BernoulliPolynomials.lean | 188 | 211 | theorem bernoulli_eval_one_add (n : ℕ) (x : ℚ) :
(bernoulli n).eval (1 + x) = (bernoulli n).eval x + n * x ^ (n - 1) := by |
refine Nat.strong_induction_on n fun d hd => ?_
have nz : ((d.succ : ℕ) : ℚ) ≠ 0 := by
norm_cast
apply (mul_right_inj' nz).1
rw [← smul_eq_mul, ← eval_smul, bernoulli_eq_sub_sum, mul_add, ← smul_eq_mul, ← eval_smul,
bernoulli_eq_sub_sum, eval_sub, eval_finset_sum]
conv_lhs =>
congr
· skip
· apply_congr
· skip
· rw [eval_smul, hd _ (mem_range.1 (by assumption))]
rw [eval_sub, eval_finset_sum]
simp_rw [eval_smul, smul_add]
rw [sum_add_distrib, sub_add, sub_eq_sub_iff_sub_eq_sub, _root_.add_sub_sub_cancel]
conv_rhs =>
congr
· skip
· congr
rw [succ_eq_add_one, ← choose_succ_self_right d]
rw [Nat.cast_succ, ← smul_eq_mul, ← sum_range_succ _ d, eval_monomial_one_add_sub]
simp_rw [smul_eq_mul]
|
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.Order.Fin
import Mathlib.Order.PiLex
import Mathlib.Order.Interval.Set.Basic
#align_import data.fin.tuple.basic from "leanprover-community/mathlib"@"ef997baa41b5c428be3fb50089a7139bf4ee886b"
assert_not_exists MonoidWithZero
universe u v
namespace Fin
variable {m n : ℕ}
open Function
section Tuple
example (α : Fin 0 → Sort u) : Unique (∀ i : Fin 0, α i) := by infer_instance
theorem tuple0_le {α : Fin 0 → Type*} [∀ i, Preorder (α i)] (f g : ∀ i, α i) : f ≤ g :=
finZeroElim
#align fin.tuple0_le Fin.tuple0_le
variable {α : Fin (n + 1) → Type u} (x : α 0) (q : ∀ i, α i) (p : ∀ i : Fin n, α i.succ) (i : Fin n)
(y : α i.succ) (z : α 0)
def tail (q : ∀ i, α i) : ∀ i : Fin n, α i.succ := fun i ↦ q i.succ
#align fin.tail Fin.tail
theorem tail_def {n : ℕ} {α : Fin (n + 1) → Type*} {q : ∀ i, α i} :
(tail fun k : Fin (n + 1) ↦ q k) = fun k : Fin n ↦ q k.succ :=
rfl
#align fin.tail_def Fin.tail_def
def cons (x : α 0) (p : ∀ i : Fin n, α i.succ) : ∀ i, α i := fun j ↦ Fin.cases x p j
#align fin.cons Fin.cons
@[simp]
theorem tail_cons : tail (cons x p) = p := by
simp (config := { unfoldPartialApp := true }) [tail, cons]
#align fin.tail_cons Fin.tail_cons
@[simp]
theorem cons_succ : cons x p i.succ = p i := by simp [cons]
#align fin.cons_succ Fin.cons_succ
@[simp]
theorem cons_zero : cons x p 0 = x := by simp [cons]
#align fin.cons_zero Fin.cons_zero
@[simp]
theorem cons_one {α : Fin (n + 2) → Type*} (x : α 0) (p : ∀ i : Fin n.succ, α i.succ) :
cons x p 1 = p 0 := by
rw [← cons_succ x p]; rfl
@[simp]
theorem cons_update : cons x (update p i y) = update (cons x p) i.succ y := by
ext j
by_cases h : j = 0
· rw [h]
simp [Ne.symm (succ_ne_zero i)]
· let j' := pred j h
have : j'.succ = j := succ_pred j h
rw [← this, cons_succ]
by_cases h' : j' = i
· rw [h']
simp
· have : j'.succ ≠ i.succ := by rwa [Ne, succ_inj]
rw [update_noteq h', update_noteq this, cons_succ]
#align fin.cons_update Fin.cons_update
theorem cons_injective2 : Function.Injective2 (@cons n α) := fun x₀ y₀ x y h ↦
⟨congr_fun h 0, funext fun i ↦ by simpa using congr_fun h (Fin.succ i)⟩
#align fin.cons_injective2 Fin.cons_injective2
@[simp]
theorem cons_eq_cons {x₀ y₀ : α 0} {x y : ∀ i : Fin n, α i.succ} :
cons x₀ x = cons y₀ y ↔ x₀ = y₀ ∧ x = y :=
cons_injective2.eq_iff
#align fin.cons_eq_cons Fin.cons_eq_cons
theorem cons_left_injective (x : ∀ i : Fin n, α i.succ) : Function.Injective fun x₀ ↦ cons x₀ x :=
cons_injective2.left _
#align fin.cons_left_injective Fin.cons_left_injective
theorem cons_right_injective (x₀ : α 0) : Function.Injective (cons x₀) :=
cons_injective2.right _
#align fin.cons_right_injective Fin.cons_right_injective
| Mathlib/Data/Fin/Tuple/Basic.lean | 128 | 136 | theorem update_cons_zero : update (cons x p) 0 z = cons z p := by |
ext j
by_cases h : j = 0
· rw [h]
simp
· simp only [h, update_noteq, Ne, not_false_iff]
let j' := pred j h
have : j'.succ = j := succ_pred j h
rw [← this, cons_succ, cons_succ]
|
import Mathlib.Combinatorics.SimpleGraph.Regularity.Bound
import Mathlib.Combinatorics.SimpleGraph.Regularity.Equitabilise
import Mathlib.Combinatorics.SimpleGraph.Regularity.Uniform
#align_import combinatorics.simple_graph.regularity.chunk from "leanprover-community/mathlib"@"bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d"
open Finpartition Finset Fintype Rel Nat
open scoped SzemerediRegularity.Positivity
namespace SzemerediRegularity
variable {α : Type*} [Fintype α] [DecidableEq α] {P : Finpartition (univ : Finset α)}
(hP : P.IsEquipartition) (G : SimpleGraph α) [DecidableRel G.Adj] (ε : ℝ) {U : Finset α}
(hU : U ∈ P.parts) (V : Finset α)
local notation3 "m" => (card α / stepBound P.parts.card : ℕ)
noncomputable def chunk : Finpartition U :=
if hUcard : U.card = m * 4 ^ P.parts.card + (card α / P.parts.card - m * 4 ^ P.parts.card) then
(atomise U <| P.nonuniformWitnesses G ε U).equitabilise <| card_aux₁ hUcard
else (atomise U <| P.nonuniformWitnesses G ε U).equitabilise <| card_aux₂ hP hU hUcard
#align szemeredi_regularity.chunk SzemerediRegularity.chunk
-- `hP` and `hU` are used to get that `U` has size
-- `m * 4 ^ P.parts.card + a or m * 4 ^ P.parts.card + a + 1`
noncomputable def star (V : Finset α) : Finset (Finset α) :=
(chunk hP G ε hU).parts.filter (· ⊆ G.nonuniformWitness ε U V)
#align szemeredi_regularity.star SzemerediRegularity.star
theorem biUnion_star_subset_nonuniformWitness :
(star hP G ε hU V).biUnion id ⊆ G.nonuniformWitness ε U V :=
biUnion_subset_iff_forall_subset.2 fun _ hA => (mem_filter.1 hA).2
#align szemeredi_regularity.bUnion_star_subset_nonuniform_witness SzemerediRegularity.biUnion_star_subset_nonuniformWitness
variable {hP G ε hU V} {𝒜 : Finset (Finset α)} {s : Finset α}
theorem star_subset_chunk : star hP G ε hU V ⊆ (chunk hP G ε hU).parts :=
filter_subset _ _
#align szemeredi_regularity.star_subset_chunk SzemerediRegularity.star_subset_chunk
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
(h₂ : ¬G.IsUniform ε U V) :
(G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
2 ^ (P.parts.card - 1) * m := by
have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
intro x hx
rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
mem_biUnion] at hx
simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
not_and, mem_sdiff, id, mem_sdiff] at hx ⊢
obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
apply (card_le_card q).trans (card_biUnion_le.trans _)
trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
· suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
(B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
intro B hB
unfold chunk
split_ifs with h₁
· convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
· convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB
rw [sum_const]
refine mul_le_mul_right' ?_ _
have t := card_filter_atomise_le_two_pow (s := U) hX
refine t.trans (pow_le_pow_right (by norm_num) <| tsub_le_tsub_right ?_ _)
exact card_image_le.trans (card_le_card <| filter_subset _ _)
private theorem one_sub_eps_mul_card_nonuniformWitness_le_card_star (hV : V ∈ P.parts)
(hUV : U ≠ V) (hunif : ¬G.IsUniform ε U V) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
(hε₁ : ε ≤ 1) :
(1 - ε / 10) * (G.nonuniformWitness ε U V).card ≤ ((star hP G ε hU V).biUnion id).card := by
have hP₁ : 0 < P.parts.card := Finset.card_pos.2 ⟨_, hU⟩
have : (↑2 ^ P.parts.card : ℝ) * m / (U.card * ε) ≤ ε / 10 := by
rw [← div_div, div_le_iff']
swap
· sz_positivity
refine le_of_mul_le_mul_left ?_ (pow_pos zero_lt_two P.parts.card)
calc
↑2 ^ P.parts.card * ((↑2 ^ P.parts.card * m : ℝ) / U.card) =
((2 : ℝ) * 2) ^ P.parts.card * m / U.card := by
rw [mul_pow, ← mul_div_assoc, mul_assoc]
_ = ↑4 ^ P.parts.card * m / U.card := by norm_num
_ ≤ 1 := div_le_one_of_le (pow_mul_m_le_card_part hP hU) (cast_nonneg _)
_ ≤ ↑2 ^ P.parts.card * ε ^ 2 / 10 := by
refine (one_le_sq_iff <| by positivity).1 ?_
rw [div_pow, mul_pow, pow_right_comm, ← pow_mul ε,
one_le_div (sq_pos_of_ne_zero <| by norm_num)]
calc
(↑10 ^ 2) = 100 := by norm_num
_ ≤ ↑4 ^ P.parts.card * ε ^ 5 := hPε
_ ≤ ↑4 ^ P.parts.card * ε ^ 4 :=
(mul_le_mul_of_nonneg_left (pow_le_pow_of_le_one (by sz_positivity) hε₁ <| le_succ _)
(by positivity))
_ = (↑2 ^ 2) ^ P.parts.card * ε ^ (2 * 2) := by norm_num
_ = ↑2 ^ P.parts.card * (ε * (ε / 10)) := by rw [mul_div_assoc, sq, mul_div_assoc]
calc
(↑1 - ε / 10) * (G.nonuniformWitness ε U V).card ≤
(↑1 - ↑2 ^ P.parts.card * m / (U.card * ε)) * (G.nonuniformWitness ε U V).card :=
mul_le_mul_of_nonneg_right (sub_le_sub_left this _) (cast_nonneg _)
_ = (G.nonuniformWitness ε U V).card -
↑2 ^ P.parts.card * m / (U.card * ε) * (G.nonuniformWitness ε U V).card := by
rw [sub_mul, one_mul]
_ ≤ (G.nonuniformWitness ε U V).card - ↑2 ^ (P.parts.card - 1) * m := by
refine sub_le_sub_left ?_ _
have : (2 : ℝ) ^ P.parts.card = ↑2 ^ (P.parts.card - 1) * 2 := by
rw [← _root_.pow_succ, tsub_add_cancel_of_le (succ_le_iff.2 hP₁)]
rw [← mul_div_right_comm, this, mul_right_comm _ (2 : ℝ), mul_assoc, le_div_iff]
· refine mul_le_mul_of_nonneg_left ?_ (by positivity)
exact (G.le_card_nonuniformWitness hunif).trans
(le_mul_of_one_le_left (cast_nonneg _) one_le_two)
have := Finset.card_pos.mpr (P.nonempty_of_mem_parts hU)
sz_positivity
_ ≤ ((star hP G ε hU V).biUnion id).card := by
rw [sub_le_comm, ←
cast_sub (card_le_card <| biUnion_star_subset_nonuniformWitness hP G ε hU V), ←
card_sdiff (biUnion_star_subset_nonuniformWitness hP G ε hU V)]
exact mod_cast card_nonuniformWitness_sdiff_biUnion_star hV hUV hunif
theorem card_chunk (hm : m ≠ 0) : (chunk hP G ε hU).parts.card = 4 ^ P.parts.card := by
unfold chunk
split_ifs
· rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le]
exact le_of_lt a_add_one_le_four_pow_parts_card
· rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le a_add_one_le_four_pow_parts_card]
#align szemeredi_regularity.card_chunk SzemerediRegularity.card_chunk
theorem card_eq_of_mem_parts_chunk (hs : s ∈ (chunk hP G ε hU).parts) :
s.card = m ∨ s.card = m + 1 := by
unfold chunk at hs
split_ifs at hs <;> exact card_eq_of_mem_parts_equitabilise hs
#align szemeredi_regularity.card_eq_of_mem_parts_chunk SzemerediRegularity.card_eq_of_mem_parts_chunk
theorem m_le_card_of_mem_chunk_parts (hs : s ∈ (chunk hP G ε hU).parts) : m ≤ s.card :=
(card_eq_of_mem_parts_chunk hs).elim ge_of_eq fun i => by simp [i]
#align szemeredi_regularity.m_le_card_of_mem_chunk_parts SzemerediRegularity.m_le_card_of_mem_chunk_parts
theorem card_le_m_add_one_of_mem_chunk_parts (hs : s ∈ (chunk hP G ε hU).parts) : s.card ≤ m + 1 :=
(card_eq_of_mem_parts_chunk hs).elim (fun i => by simp [i]) fun i => i.le
#align szemeredi_regularity.card_le_m_add_one_of_mem_chunk_parts SzemerediRegularity.card_le_m_add_one_of_mem_chunk_parts
theorem card_biUnion_star_le_m_add_one_card_star_mul :
(((star hP G ε hU V).biUnion id).card : ℝ) ≤ (star hP G ε hU V).card * (m + 1) :=
mod_cast card_biUnion_le_card_mul _ _ _ fun _ hs =>
card_le_m_add_one_of_mem_chunk_parts <| star_subset_chunk hs
#align szemeredi_regularity.card_bUnion_star_le_m_add_one_card_star_mul SzemerediRegularity.card_biUnion_star_le_m_add_one_card_star_mul
private theorem le_sum_card_subset_chunk_parts (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
(𝒜.card : ℝ) * s.card * (m / (m + 1)) ≤ (𝒜.sup id).card := by
rw [mul_div_assoc', div_le_iff coe_m_add_one_pos, mul_right_comm]
refine mul_le_mul ?_ ?_ (cast_nonneg _) (cast_nonneg _)
· rw [← (ofSubset _ h𝒜 rfl).sum_card_parts, ofSubset_parts, ← cast_mul, cast_le]
exact card_nsmul_le_sum _ _ _ fun x hx => m_le_card_of_mem_chunk_parts <| h𝒜 hx
· exact mod_cast card_le_m_add_one_of_mem_chunk_parts (h𝒜 hs)
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
(h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := by
rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
refine mul_le_mul ?_ ?_ (cast_nonneg _) (by positivity)
· norm_cast
refine card_biUnion_le_card_mul _ _ _ fun x hx => ?_
apply card_le_m_add_one_of_mem_chunk_parts (h𝒜 hx)
· exact mod_cast m_le_card_of_mem_chunk_parts (h𝒜 hs)
private theorem one_sub_le_m_div_m_add_one_sq [Nonempty α]
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
↑1 - ε ^ 5 / ↑50 ≤ (m / (m + 1 : ℝ)) ^ 2 := by
have : (m : ℝ) / (m + 1) = 1 - 1 / (m + 1) := by
rw [one_sub_div coe_m_add_one_pos.ne', add_sub_cancel_right]
rw [this, sub_sq, one_pow, mul_one]
refine le_trans ?_ (le_add_of_nonneg_right <| sq_nonneg _)
rw [sub_le_sub_iff_left, ← le_div_iff' (show (0 : ℝ) < 2 by norm_num), div_div,
one_div_le coe_m_add_one_pos, one_div_div]
· refine le_trans ?_ (le_add_of_nonneg_right zero_le_one)
set_option tactic.skipAssignedInstances false in norm_num
apply hundred_div_ε_pow_five_le_m hPα hPε
sz_positivity
private theorem m_add_one_div_m_le_one_add [Nonempty α]
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
(hε₁ : ε ≤ 1) : ((m + 1 : ℝ) / m) ^ 2 ≤ ↑1 + ε ^ 5 / 49 := by
rw [same_add_div]
swap; · sz_positivity
have : ↑1 + ↑1 / (m : ℝ) ≤ ↑1 + ε ^ 5 / 100 := by
rw [add_le_add_iff_left, ← one_div_div (100 : ℝ)]
exact one_div_le_one_div_of_le (by sz_positivity) (hundred_div_ε_pow_five_le_m hPα hPε)
refine (pow_le_pow_left ?_ this 2).trans ?_
· positivity
rw [add_sq, one_pow, add_assoc, add_le_add_iff_left, mul_one, ← le_sub_iff_add_le',
div_eq_mul_one_div _ (49 : ℝ), mul_div_left_comm (2 : ℝ), ← mul_sub_left_distrib, div_pow,
div_le_iff (show (0 : ℝ) < ↑100 ^ 2 by norm_num), mul_assoc, sq]
refine mul_le_mul_of_nonneg_left ?_ (by sz_positivity)
exact (pow_le_one 5 (by sz_positivity) hε₁).trans (by norm_num)
private theorem density_sub_eps_le_sum_density_div_card [Nonempty α]
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
{hU : U ∈ P.parts} {hV : V ∈ P.parts} {A B : Finset (Finset α)}
(hA : A ⊆ (chunk hP G ε hU).parts) (hB : B ⊆ (chunk hP G ε hV).parts) :
(G.edgeDensity (A.biUnion id) (B.biUnion id)) - ε ^ 5 / 50 ≤
(∑ ab ∈ A.product B, (G.edgeDensity ab.1 ab.2 : ℝ)) / (A.card * B.card) := by
have : ↑(G.edgeDensity (A.biUnion id) (B.biUnion id)) - ε ^ 5 / ↑50 ≤
(↑1 - ε ^ 5 / 50) * G.edgeDensity (A.biUnion id) (B.biUnion id) := by
rw [sub_mul, one_mul, sub_le_sub_iff_left]
refine mul_le_of_le_one_right (by sz_positivity) ?_
exact mod_cast G.edgeDensity_le_one _ _
refine this.trans ?_
conv_rhs => -- Porting note: LHS and RHS need separate treatment to get the desired form
simp only [SimpleGraph.edgeDensity_def, sum_div, Rat.cast_div, div_div]
conv_lhs =>
rw [SimpleGraph.edgeDensity_def, SimpleGraph.interedges, ← sup_eq_biUnion, ← sup_eq_biUnion,
Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl), ofSubset_parts,
ofSubset_parts]
simp only [cast_sum, sum_div, mul_sum, Rat.cast_sum, Rat.cast_div,
mul_div_left_comm ((1 : ℝ) - _)]
push_cast
apply sum_le_sum
simp only [and_imp, Prod.forall, mem_product]
rintro x y hx hy
rw [mul_mul_mul_comm, mul_comm (x.card : ℝ), mul_comm (y.card : ℝ), le_div_iff, mul_assoc]
· refine mul_le_of_le_one_right (cast_nonneg _) ?_
rw [div_mul_eq_mul_div, ← mul_assoc, mul_assoc]
refine div_le_one_of_le ?_ (by positivity)
refine (mul_le_mul_of_nonneg_right (one_sub_le_m_div_m_add_one_sq hPα hPε) ?_).trans ?_
· exact mod_cast _root_.zero_le _
rw [sq, mul_mul_mul_comm, mul_comm ((m : ℝ) / _), mul_comm ((m : ℝ) / _)]
refine mul_le_mul ?_ ?_ ?_ (cast_nonneg _)
· apply le_sum_card_subset_chunk_parts hA hx
· apply le_sum_card_subset_chunk_parts hB hy
· positivity
refine mul_pos (mul_pos ?_ ?_) (mul_pos ?_ ?_) <;> rw [cast_pos, Finset.card_pos]
exacts [⟨_, hx⟩, nonempty_of_mem_parts _ (hA hx), ⟨_, hy⟩, nonempty_of_mem_parts _ (hB hy)]
private theorem sum_density_div_card_le_density_add_eps [Nonempty α]
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
(hε₁ : ε ≤ 1) {hU : U ∈ P.parts} {hV : V ∈ P.parts} {A B : Finset (Finset α)}
(hA : A ⊆ (chunk hP G ε hU).parts) (hB : B ⊆ (chunk hP G ε hV).parts) :
(∑ ab ∈ A.product B, G.edgeDensity ab.1 ab.2 : ℝ) / (A.card * B.card) ≤
G.edgeDensity (A.biUnion id) (B.biUnion id) + ε ^ 5 / 49 := by
have : (↑1 + ε ^ 5 / ↑49) * G.edgeDensity (A.biUnion id) (B.biUnion id) ≤
G.edgeDensity (A.biUnion id) (B.biUnion id) + ε ^ 5 / 49 := by
rw [add_mul, one_mul, add_le_add_iff_left]
refine mul_le_of_le_one_right (by sz_positivity) ?_
exact mod_cast G.edgeDensity_le_one _ _
refine le_trans ?_ this
conv_lhs => -- Porting note: LHS and RHS need separate treatment to get the desired form
simp only [SimpleGraph.edgeDensity, edgeDensity, sum_div, Rat.cast_div, div_div]
conv_rhs =>
rw [SimpleGraph.edgeDensity, edgeDensity, ← sup_eq_biUnion, ← sup_eq_biUnion,
Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl)]
simp only [cast_sum, mul_sum, sum_div, Rat.cast_sum, Rat.cast_div,
mul_div_left_comm ((1 : ℝ) + _)]
push_cast
apply sum_le_sum
simp only [and_imp, Prod.forall, mem_product, show A.product B = A ×ˢ B by rfl]
intro x y hx hy
rw [mul_mul_mul_comm, mul_comm (x.card : ℝ), mul_comm (y.card : ℝ), div_le_iff, mul_assoc]
· refine le_mul_of_one_le_right (cast_nonneg _) ?_
rw [div_mul_eq_mul_div, one_le_div]
· refine le_trans ?_ (mul_le_mul_of_nonneg_right (m_add_one_div_m_le_one_add hPα hPε hε₁) ?_)
· rw [sq, mul_mul_mul_comm, mul_comm (_ / (m : ℝ)), mul_comm (_ / (m : ℝ))]
exact mul_le_mul (sum_card_subset_chunk_parts_le (by sz_positivity) hA hx)
(sum_card_subset_chunk_parts_le (by sz_positivity) hB hy) (by positivity) (by positivity)
· exact mod_cast _root_.zero_le _
rw [← cast_mul, cast_pos]
apply mul_pos <;> rw [Finset.card_pos, sup_eq_biUnion, biUnion_nonempty]
· exact ⟨_, hx, nonempty_of_mem_parts _ (hA hx)⟩
· exact ⟨_, hy, nonempty_of_mem_parts _ (hB hy)⟩
refine mul_pos (mul_pos ?_ ?_) (mul_pos ?_ ?_) <;> rw [cast_pos, Finset.card_pos]
exacts [⟨_, hx⟩, nonempty_of_mem_parts _ (hA hx), ⟨_, hy⟩, nonempty_of_mem_parts _ (hB hy)]
private theorem average_density_near_total_density [Nonempty α]
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
(hε₁ : ε ≤ 1) {hU : U ∈ P.parts} {hV : V ∈ P.parts} {A B : Finset (Finset α)}
(hA : A ⊆ (chunk hP G ε hU).parts) (hB : B ⊆ (chunk hP G ε hV).parts) :
|(∑ ab ∈ A.product B, G.edgeDensity ab.1 ab.2 : ℝ) / (A.card * B.card) -
G.edgeDensity (A.biUnion id) (B.biUnion id)| ≤ ε ^ 5 / 49 := by
rw [abs_sub_le_iff]
constructor
· rw [sub_le_iff_le_add']
exact sum_density_div_card_le_density_add_eps hPα hPε hε₁ hA hB
suffices (G.edgeDensity (A.biUnion id) (B.biUnion id) : ℝ) -
(∑ ab ∈ A.product B, (G.edgeDensity ab.1 ab.2 : ℝ)) / (A.card * B.card) ≤ ε ^ 5 / 50 by
apply this.trans
gcongr <;> [sz_positivity; norm_num]
rw [sub_le_iff_le_add, ← sub_le_iff_le_add']
apply density_sub_eps_le_sum_density_div_card hPα hPε hA hB
private theorem edgeDensity_chunk_aux [Nonempty α]
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
(hU : U ∈ P.parts) (hV : V ∈ P.parts) :
(G.edgeDensity U V : ℝ) ^ 2 - ε ^ 5 / ↑25 ≤
((∑ ab ∈ (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
(G.edgeDensity ab.1 ab.2 : ℝ)) / ↑16 ^ P.parts.card) ^ 2 := by
obtain hGε | hGε := le_total (G.edgeDensity U V : ℝ) (ε ^ 5 / 50)
· refine (sub_nonpos_of_le <| (sq_le ?_ ?_).trans <| hGε.trans ?_).trans (sq_nonneg _)
· exact mod_cast G.edgeDensity_nonneg _ _
· exact mod_cast G.edgeDensity_le_one _ _
· exact div_le_div_of_nonneg_left (by sz_positivity) (by norm_num) (by norm_num)
rw [← sub_nonneg] at hGε
have : ↑(G.edgeDensity U V) - ε ^ 5 / ↑50 ≤
(∑ ab ∈ (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
(G.edgeDensity ab.1 ab.2 : ℝ)) / ↑16 ^ P.parts.card := by
have rflU := Set.Subset.refl (chunk hP G ε hU).parts.toSet
have rflV := Set.Subset.refl (chunk hP G ε hV).parts.toSet
refine (le_trans ?_ <| density_sub_eps_le_sum_density_div_card hPα hPε rflU rflV).trans ?_
· rw [biUnion_parts, biUnion_parts]
· rw [card_chunk (m_pos hPα).ne', card_chunk (m_pos hPα).ne', ← cast_mul, ← mul_pow, cast_pow]
norm_cast
refine le_trans ?_ (pow_le_pow_left hGε this 2)
rw [sub_sq, sub_add, sub_le_sub_iff_left]
refine (sub_le_self _ <| sq_nonneg <| ε ^ 5 / 50).trans ?_
rw [mul_right_comm, mul_div_left_comm, div_eq_mul_inv (ε ^ 5),
show (2 : ℝ) / 50 = 25⁻¹ by norm_num]
exact mul_le_of_le_one_right (by sz_positivity) (mod_cast G.edgeDensity_le_one _ _)
private theorem abs_density_star_sub_density_le_eps (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
(hε₁ : ε ≤ 1) {hU : U ∈ P.parts} {hV : V ∈ P.parts} (hUV' : U ≠ V) (hUV : ¬G.IsUniform ε U V) :
|(G.edgeDensity ((star hP G ε hU V).biUnion id) ((star hP G ε hV U).biUnion id) : ℝ) -
G.edgeDensity (G.nonuniformWitness ε U V) (G.nonuniformWitness ε V U)| ≤ ε / 5 := by
convert abs_edgeDensity_sub_edgeDensity_le_two_mul G.Adj
(biUnion_star_subset_nonuniformWitness hP G ε hU V)
(biUnion_star_subset_nonuniformWitness hP G ε hV U) (by sz_positivity)
(one_sub_eps_mul_card_nonuniformWitness_le_card_star hV hUV' hUV hPε hε₁)
(one_sub_eps_mul_card_nonuniformWitness_le_card_star hU hUV'.symm (fun hVU => hUV hVU.symm)
hPε hε₁) using 1
linarith
private theorem eps_le_card_star_div [Nonempty α] (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α)
(hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) (hε₁ : ε ≤ 1) (hU : U ∈ P.parts) (hV : V ∈ P.parts)
(hUV : U ≠ V) (hunif : ¬G.IsUniform ε U V) :
↑4 / ↑5 * ε ≤ (star hP G ε hU V).card / ↑4 ^ P.parts.card := by
have hm : (0 : ℝ) ≤ 1 - (↑m)⁻¹ := sub_nonneg_of_le (inv_le_one <| one_le_m_coe hPα)
have hε : 0 ≤ 1 - ε / 10 :=
sub_nonneg_of_le (div_le_one_of_le (hε₁.trans <| by norm_num) <| by norm_num)
have hε₀ : 0 < ε := by sz_positivity
calc
4 / 5 * ε = (1 - 1 / 10) * (1 - 9⁻¹) * ε := by norm_num
_ ≤ (1 - ε / 10) * (1 - (↑m)⁻¹) * ((G.nonuniformWitness ε U V).card / U.card) := by
gcongr
exacts [mod_cast (show 9 ≤ 100 by norm_num).trans (hundred_le_m hPα hPε hε₁),
(le_div_iff' <| cast_pos.2 (P.nonempty_of_mem_parts hU).card_pos).2 <|
G.le_card_nonuniformWitness hunif]
_ = (1 - ε / 10) * (G.nonuniformWitness ε U V).card * ((1 - (↑m)⁻¹) / U.card) := by
rw [mul_assoc, mul_assoc, mul_div_left_comm]
_ ≤ ((star hP G ε hU V).biUnion id).card * ((1 - (↑m)⁻¹) / U.card) :=
(mul_le_mul_of_nonneg_right
(one_sub_eps_mul_card_nonuniformWitness_le_card_star hV hUV hunif hPε hε₁) (by positivity))
_ ≤ (star hP G ε hU V).card * (m + 1) * ((1 - (↑m)⁻¹) / U.card) :=
(mul_le_mul_of_nonneg_right card_biUnion_star_le_m_add_one_card_star_mul (by positivity))
_ ≤ (star hP G ε hU V).card * (m + ↑1) * ((↑1 - (↑m)⁻¹) / (↑4 ^ P.parts.card * m)) :=
(mul_le_mul_of_nonneg_left (div_le_div_of_nonneg_left hm (by sz_positivity) <|
pow_mul_m_le_card_part hP hU) (by positivity))
_ ≤ (star hP G ε hU V).card / ↑4 ^ P.parts.card := by
rw [mul_assoc, mul_comm ((4 : ℝ) ^ P.parts.card), ← div_div, ← mul_div_assoc, ← mul_comm_div]
refine mul_le_of_le_one_right (by positivity) ?_
have hm : (0 : ℝ) < m := by sz_positivity
rw [mul_div_assoc', div_le_one hm, ← one_div, one_sub_div hm.ne', mul_div_assoc',
div_le_iff hm]
linarith
private theorem edgeDensity_star_not_uniform [Nonempty α]
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
(hε₁ : ε ≤ 1) {hU : U ∈ P.parts} {hV : V ∈ P.parts} (hUVne : U ≠ V) (hUV : ¬G.IsUniform ε U V) :
↑3 / ↑4 * ε ≤
|(∑ ab ∈ (star hP G ε hU V).product (star hP G ε hV U), (G.edgeDensity ab.1 ab.2 : ℝ)) /
((star hP G ε hU V).card * (star hP G ε hV U).card) -
(∑ ab ∈ (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
(G.edgeDensity ab.1 ab.2 : ℝ)) / (16 : ℝ) ^ P.parts.card| := by
rw [show (16 : ℝ) = ↑4 ^ 2 by norm_num, pow_right_comm, sq ((4 : ℝ) ^ _)]
set p : ℝ :=
(∑ ab ∈ (star hP G ε hU V).product (star hP G ε hV U), (G.edgeDensity ab.1 ab.2 : ℝ)) /
((star hP G ε hU V).card * (star hP G ε hV U).card)
set q : ℝ :=
(∑ ab ∈ (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
(G.edgeDensity ab.1 ab.2 : ℝ)) / (↑4 ^ P.parts.card * ↑4 ^ P.parts.card)
change _ ≤ |p - q|
set r : ℝ := ↑(G.edgeDensity ((star hP G ε hU V).biUnion id) ((star hP G ε hV U).biUnion id))
set s : ℝ := ↑(G.edgeDensity (G.nonuniformWitness ε U V) (G.nonuniformWitness ε V U))
set t : ℝ := ↑(G.edgeDensity U V)
have hrs : |r - s| ≤ ε / 5 := abs_density_star_sub_density_le_eps hPε hε₁ hUVne hUV
have hst : ε ≤ |s - t| := by
-- After leanprover/lean4#2734, we need to do the zeta reduction before `mod_cast`.
unfold_let s t
exact mod_cast G.nonuniformWitness_spec hUVne hUV
have hpr : |p - r| ≤ ε ^ 5 / 49 :=
average_density_near_total_density hPα hPε hε₁ star_subset_chunk star_subset_chunk
have hqt : |q - t| ≤ ε ^ 5 / 49 := by
have := average_density_near_total_density hPα hPε hε₁
(Subset.refl (chunk hP G ε hU).parts) (Subset.refl (chunk hP G ε hV).parts)
simp_rw [← sup_eq_biUnion, sup_parts, card_chunk (m_pos hPα).ne', cast_pow] at this
set_option tactic.skipAssignedInstances false in norm_num at this
exact this
have hε' : ε ^ 5 ≤ ε := by
simpa using pow_le_pow_of_le_one (by sz_positivity) hε₁ (show 1 ≤ 5 by norm_num)
rw [abs_sub_le_iff] at hrs hpr hqt
rw [le_abs] at hst ⊢
cases hst
· left; linarith
· right; linarith
set_option tactic.skipAssignedInstances false in
| Mathlib/Combinatorics/SimpleGraph/Regularity/Chunk.lean | 473 | 521 | theorem edgeDensity_chunk_not_uniform [Nonempty α] (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α)
(hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) (hε₁ : ε ≤ 1) {hU : U ∈ P.parts} {hV : V ∈ P.parts}
(hUVne : U ≠ V) (hUV : ¬G.IsUniform ε U V) :
(G.edgeDensity U V : ℝ) ^ 2 - ε ^ 5 / ↑25 + ε ^ 4 / ↑3 ≤
(∑ ab ∈ (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
(G.edgeDensity ab.1 ab.2 : ℝ) ^ 2) / ↑16 ^ P.parts.card :=
calc
↑(G.edgeDensity U V) ^ 2 - ε ^ 5 / 25 + ε ^ 4 / ↑3 ≤ ↑(G.edgeDensity U V) ^ 2 - ε ^ 5 / ↑25 +
(star hP G ε hU V).card * (star hP G ε hV U).card / ↑16 ^ P.parts.card *
(↑9 / ↑16) * ε ^ 2 := by |
apply add_le_add_left
have Ul : 4 / 5 * ε ≤ (star hP G ε hU V).card / _ :=
eps_le_card_star_div hPα hPε hε₁ hU hV hUVne hUV
have Vl : 4 / 5 * ε ≤ (star hP G ε hV U).card / _ :=
eps_le_card_star_div hPα hPε hε₁ hV hU hUVne.symm fun h => hUV h.symm
rw [show (16 : ℝ) = ↑4 ^ 2 by norm_num, pow_right_comm, sq ((4 : ℝ) ^ _), ←
_root_.div_mul_div_comm, mul_assoc]
have : 0 < ε := by sz_positivity
have UVl := mul_le_mul Ul Vl (by positivity) ?_
swap
· -- This seems faster than `exact div_nonneg (by positivity) (by positivity)` and *much*
-- (tens of seconds) faster than `positivity` on its own.
apply div_nonneg <;> positivity
refine le_trans ?_ (mul_le_mul_of_nonneg_right UVl ?_)
· norm_num
nlinarith
· norm_num
positivity
_ ≤ (∑ ab ∈ (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
(G.edgeDensity ab.1 ab.2 : ℝ) ^ 2) / ↑16 ^ P.parts.card := by
have t : (star hP G ε hU V).product (star hP G ε hV U) ⊆
(chunk hP G ε hU).parts.product (chunk hP G ε hV).parts :=
product_subset_product star_subset_chunk star_subset_chunk
have hε : 0 ≤ ε := by sz_positivity
have sp : ∀ (a b : Finset (Finset α)), a.product b = a ×ˢ b := fun a b => rfl
have := add_div_le_sum_sq_div_card t (fun x => (G.edgeDensity x.1 x.2 : ℝ))
((G.edgeDensity U V : ℝ) ^ 2 - ε ^ 5 / ↑25) (show 0 ≤ 3 / 4 * ε by linarith) ?_ ?_
· simp_rw [sp, card_product, card_chunk (m_pos hPα).ne', ← mul_pow, cast_pow, mul_pow,
div_pow, ← mul_assoc] at this
norm_num at this
exact this
· simp_rw [sp, card_product, card_chunk (m_pos hPα).ne', ← mul_pow]
norm_num
exact edgeDensity_star_not_uniform hPα hPε hε₁ hUVne hUV
· rw [sp, card_product]
apply (edgeDensity_chunk_aux hPα hPε hU hV).trans
· rw [card_chunk (m_pos hPα).ne', card_chunk (m_pos hPα).ne', ← mul_pow]
· norm_num
rfl
|
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section PseudoMetricSpace
variable [PseudoMetricSpace α] {s : Set α}
theorem subsingleton_of_einfsep_eq_top (hs : s.einfsep = ∞) : s.Subsingleton := by
rw [einfsep_top] at hs
exact fun _ hx _ hy => of_not_not fun hxy => edist_ne_top _ _ (hs _ hx _ hy hxy)
#align set.subsingleton_of_einfsep_eq_top Set.subsingleton_of_einfsep_eq_top
theorem einfsep_eq_top_iff : s.einfsep = ∞ ↔ s.Subsingleton :=
⟨subsingleton_of_einfsep_eq_top, Subsingleton.einfsep⟩
#align set.einfsep_eq_top_iff Set.einfsep_eq_top_iff
| Mathlib/Topology/MetricSpace/Infsep.lean | 257 | 260 | theorem Nontrivial.einfsep_ne_top (hs : s.Nontrivial) : s.einfsep ≠ ∞ := by |
contrapose! hs
rw [not_nontrivial_iff]
exact subsingleton_of_einfsep_eq_top hs
|
import Mathlib.Topology.FiberBundle.Trivialization
import Mathlib.Topology.Order.LeftRightNhds
#align_import topology.fiber_bundle.basic from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
variable {ι B F X : Type*} [TopologicalSpace X]
open TopologicalSpace Filter Set Bundle Topology
variable (F E)
| Mathlib/Topology/FiberBundle/Basic.lean | 318 | 381 | theorem FiberBundle.exists_trivialization_Icc_subset [ConditionallyCompleteLinearOrder B]
[OrderTopology B] [FiberBundle F E] (a b : B) :
∃ e : Trivialization F (π F E), Icc a b ⊆ e.baseSet := by |
obtain ⟨ea, hea⟩ : ∃ ea : Trivialization F (π F E), a ∈ ea.baseSet :=
⟨trivializationAt F E a, mem_baseSet_trivializationAt F E a⟩
-- If `a < b`, then `[a, b] = ∅`, and the statement is trivial
cases' lt_or_le b a with hab hab
· exact ⟨ea, by simp [*]⟩
/- Let `s` be the set of points `x ∈ [a, b]` such that `E` is trivializable over `[a, x]`.
We need to show that `b ∈ s`. Let `c = Sup s`. We will show that `c ∈ s` and `c = b`. -/
set s : Set B := { x ∈ Icc a b | ∃ e : Trivialization F (π F E), Icc a x ⊆ e.baseSet }
have ha : a ∈ s := ⟨left_mem_Icc.2 hab, ea, by simp [hea]⟩
have sne : s.Nonempty := ⟨a, ha⟩
have hsb : b ∈ upperBounds s := fun x hx => hx.1.2
have sbd : BddAbove s := ⟨b, hsb⟩
set c := sSup s
have hsc : IsLUB s c := isLUB_csSup sne sbd
have hc : c ∈ Icc a b := ⟨hsc.1 ha, hsc.2 hsb⟩
obtain ⟨-, ec : Trivialization F (π F E), hec : Icc a c ⊆ ec.baseSet⟩ : c ∈ s := by
rcases hc.1.eq_or_lt with heq | hlt
· rwa [← heq]
refine ⟨hc, ?_⟩
/- In order to show that `c ∈ s`, consider a trivialization `ec` of `proj` over a neighborhood
of `c`. Its base set includes `(c', c]` for some `c' ∈ [a, c)`. -/
obtain ⟨ec, hc⟩ : ∃ ec : Trivialization F (π F E), c ∈ ec.baseSet :=
⟨trivializationAt F E c, mem_baseSet_trivializationAt F E c⟩
obtain ⟨c', hc', hc'e⟩ : ∃ c' ∈ Ico a c, Ioc c' c ⊆ ec.baseSet :=
(mem_nhdsWithin_Iic_iff_exists_mem_Ico_Ioc_subset hlt).1
(mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds ec.open_baseSet hc)
/- Since `c' < c = Sup s`, there exists `d ∈ s ∩ (c', c]`. Let `ead` be a trivialization of
`proj` over `[a, d]`. Then we can glue `ead` and `ec` into a trivialization over `[a, c]`. -/
obtain ⟨d, ⟨hdab, ead, had⟩, hd⟩ : ∃ d ∈ s, d ∈ Ioc c' c := hsc.exists_between hc'.2
refine ⟨ead.piecewiseLe ec d (had ⟨hdab.1, le_rfl⟩) (hc'e hd), subset_ite.2 ?_⟩
exact ⟨fun x hx => had ⟨hx.1.1, hx.2⟩, fun x hx => hc'e ⟨hd.1.trans (not_le.1 hx.2), hx.1.2⟩⟩
/- So, `c ∈ s`. Let `ec` be a trivialization of `proj` over `[a, c]`. If `c = b`, then we are
done. Otherwise we show that `proj` can be trivialized over a larger interval `[a, d]`,
`d ∈ (c, b]`, hence `c` is not an upper bound of `s`. -/
rcases hc.2.eq_or_lt with heq | hlt
· exact ⟨ec, heq ▸ hec⟩
rsuffices ⟨d, hdcb, hd⟩ : ∃ d ∈ Ioc c b, ∃ e : Trivialization F (π F E), Icc a d ⊆ e.baseSet
· exact ((hsc.1 ⟨⟨hc.1.trans hdcb.1.le, hdcb.2⟩, hd⟩).not_lt hdcb.1).elim
/- Since the base set of `ec` is open, it includes `[c, d)` (hence, `[a, d)`) for some
`d ∈ (c, b]`. -/
obtain ⟨d, hdcb, hd⟩ : ∃ d ∈ Ioc c b, Ico c d ⊆ ec.baseSet :=
(mem_nhdsWithin_Ici_iff_exists_mem_Ioc_Ico_subset hlt).1
(mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds ec.open_baseSet (hec ⟨hc.1, le_rfl⟩))
have had : Ico a d ⊆ ec.baseSet := Ico_subset_Icc_union_Ico.trans (union_subset hec hd)
by_cases he : Disjoint (Iio d) (Ioi c)
· /- If `(c, d) = ∅`, then let `ed` be a trivialization of `proj` over a neighborhood of `d`.
Then the disjoint union of `ec` restricted to `(-∞, d)` and `ed` restricted to `(c, ∞)` is
a trivialization over `[a, d]`. -/
obtain ⟨ed, hed⟩ : ∃ ed : Trivialization F (π F E), d ∈ ed.baseSet :=
⟨trivializationAt F E d, mem_baseSet_trivializationAt F E d⟩
refine ⟨d, hdcb,
(ec.restrOpen (Iio d) isOpen_Iio).disjointUnion (ed.restrOpen (Ioi c) isOpen_Ioi)
(he.mono inter_subset_right inter_subset_right), fun x hx => ?_⟩
rcases hx.2.eq_or_lt with (rfl | hxd)
exacts [Or.inr ⟨hed, hdcb.1⟩, Or.inl ⟨had ⟨hx.1, hxd⟩, hxd⟩]
· /- If `(c, d)` is nonempty, then take `d' ∈ (c, d)`. Since the base set of `ec` includes
`[a, d)`, it includes `[a, d'] ⊆ [a, d)` as well. -/
rw [disjoint_left] at he
push_neg at he
rcases he with ⟨d', hdd' : d' < d, hd'c⟩
exact ⟨d', ⟨hd'c, hdd'.le.trans hdcb.2⟩, ec, (Icc_subset_Ico_right hdd').trans had⟩
|
import Mathlib.Order.Monotone.Odd
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
#align_import analysis.special_functions.trigonometric.deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
namespace Complex
theorem hasStrictDerivAt_sin (x : ℂ) : HasStrictDerivAt sin (cos x) x := by
simp only [cos, div_eq_mul_inv]
convert ((((hasStrictDerivAt_id x).neg.mul_const I).cexp.sub
((hasStrictDerivAt_id x).mul_const I).cexp).mul_const I).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
rw [sub_mul, mul_assoc, mul_assoc, I_mul_I, neg_one_mul, neg_neg, mul_one, one_mul, mul_assoc,
I_mul_I, mul_neg_one, sub_neg_eq_add, add_comm]
#align complex.has_strict_deriv_at_sin Complex.hasStrictDerivAt_sin
theorem hasDerivAt_sin (x : ℂ) : HasDerivAt sin (cos x) x :=
(hasStrictDerivAt_sin x).hasDerivAt
#align complex.has_deriv_at_sin Complex.hasDerivAt_sin
theorem contDiff_sin {n} : ContDiff ℂ n sin :=
(((contDiff_neg.mul contDiff_const).cexp.sub (contDiff_id.mul contDiff_const).cexp).mul
contDiff_const).div_const _
#align complex.cont_diff_sin Complex.contDiff_sin
theorem differentiable_sin : Differentiable ℂ sin := fun x => (hasDerivAt_sin x).differentiableAt
#align complex.differentiable_sin Complex.differentiable_sin
theorem differentiableAt_sin {x : ℂ} : DifferentiableAt ℂ sin x :=
differentiable_sin x
#align complex.differentiable_at_sin Complex.differentiableAt_sin
@[simp]
theorem deriv_sin : deriv sin = cos :=
funext fun x => (hasDerivAt_sin x).deriv
#align complex.deriv_sin Complex.deriv_sin
theorem hasStrictDerivAt_cos (x : ℂ) : HasStrictDerivAt cos (-sin x) x := by
simp only [sin, div_eq_mul_inv, neg_mul_eq_neg_mul]
convert (((hasStrictDerivAt_id x).mul_const I).cexp.add
((hasStrictDerivAt_id x).neg.mul_const I).cexp).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
ring
#align complex.has_strict_deriv_at_cos Complex.hasStrictDerivAt_cos
theorem hasDerivAt_cos (x : ℂ) : HasDerivAt cos (-sin x) x :=
(hasStrictDerivAt_cos x).hasDerivAt
#align complex.has_deriv_at_cos Complex.hasDerivAt_cos
theorem contDiff_cos {n} : ContDiff ℂ n cos :=
((contDiff_id.mul contDiff_const).cexp.add (contDiff_neg.mul contDiff_const).cexp).div_const _
#align complex.cont_diff_cos Complex.contDiff_cos
theorem differentiable_cos : Differentiable ℂ cos := fun x => (hasDerivAt_cos x).differentiableAt
#align complex.differentiable_cos Complex.differentiable_cos
theorem differentiableAt_cos {x : ℂ} : DifferentiableAt ℂ cos x :=
differentiable_cos x
#align complex.differentiable_at_cos Complex.differentiableAt_cos
theorem deriv_cos {x : ℂ} : deriv cos x = -sin x :=
(hasDerivAt_cos x).deriv
#align complex.deriv_cos Complex.deriv_cos
@[simp]
theorem deriv_cos' : deriv cos = fun x => -sin x :=
funext fun _ => deriv_cos
#align complex.deriv_cos' Complex.deriv_cos'
theorem hasStrictDerivAt_sinh (x : ℂ) : HasStrictDerivAt sinh (cosh x) x := by
simp only [cosh, div_eq_mul_inv]
convert ((hasStrictDerivAt_exp x).sub (hasStrictDerivAt_id x).neg.cexp).mul_const (2 : ℂ)⁻¹
using 1
rw [id, mul_neg_one, sub_eq_add_neg, neg_neg]
#align complex.has_strict_deriv_at_sinh Complex.hasStrictDerivAt_sinh
theorem hasDerivAt_sinh (x : ℂ) : HasDerivAt sinh (cosh x) x :=
(hasStrictDerivAt_sinh x).hasDerivAt
#align complex.has_deriv_at_sinh Complex.hasDerivAt_sinh
theorem contDiff_sinh {n} : ContDiff ℂ n sinh :=
(contDiff_exp.sub contDiff_neg.cexp).div_const _
#align complex.cont_diff_sinh Complex.contDiff_sinh
theorem differentiable_sinh : Differentiable ℂ sinh := fun x => (hasDerivAt_sinh x).differentiableAt
#align complex.differentiable_sinh Complex.differentiable_sinh
theorem differentiableAt_sinh {x : ℂ} : DifferentiableAt ℂ sinh x :=
differentiable_sinh x
#align complex.differentiable_at_sinh Complex.differentiableAt_sinh
@[simp]
theorem deriv_sinh : deriv sinh = cosh :=
funext fun x => (hasDerivAt_sinh x).deriv
#align complex.deriv_sinh Complex.deriv_sinh
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Deriv.lean | 134 | 138 | theorem hasStrictDerivAt_cosh (x : ℂ) : HasStrictDerivAt cosh (sinh x) x := by |
simp only [sinh, div_eq_mul_inv]
convert ((hasStrictDerivAt_exp x).add (hasStrictDerivAt_id x).neg.cexp).mul_const (2 : ℂ)⁻¹
using 1
rw [id, mul_neg_one, sub_eq_add_neg]
|
import Mathlib.Order.Filter.Cofinite
import Mathlib.Order.Hom.CompleteLattice
#align_import order.liminf_limsup from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780"
set_option autoImplicit true
open Filter Set Function
variable {α β γ ι ι' : Type*}
namespace Filter
theorem isCobounded_le_of_bot [Preorder α] [OrderBot α] {f : Filter α} : f.IsCobounded (· ≤ ·) :=
⟨⊥, fun _ _ => bot_le⟩
#align filter.is_cobounded_le_of_bot Filter.isCobounded_le_of_bot
theorem isCobounded_ge_of_top [Preorder α] [OrderTop α] {f : Filter α} : f.IsCobounded (· ≥ ·) :=
⟨⊤, fun _ _ => le_top⟩
#align filter.is_cobounded_ge_of_top Filter.isCobounded_ge_of_top
theorem isBounded_le_of_top [Preorder α] [OrderTop α] {f : Filter α} : f.IsBounded (· ≤ ·) :=
⟨⊤, eventually_of_forall fun _ => le_top⟩
#align filter.is_bounded_le_of_top Filter.isBounded_le_of_top
theorem isBounded_ge_of_bot [Preorder α] [OrderBot α] {f : Filter α} : f.IsBounded (· ≥ ·) :=
⟨⊥, eventually_of_forall fun _ => bot_le⟩
#align filter.is_bounded_ge_of_bot Filter.isBounded_ge_of_bot
@[simp]
theorem _root_.OrderIso.isBoundedUnder_le_comp [Preorder α] [Preorder β] (e : α ≃o β) {l : Filter γ}
{u : γ → α} : (IsBoundedUnder (· ≤ ·) l fun x => e (u x)) ↔ IsBoundedUnder (· ≤ ·) l u :=
(Function.Surjective.exists e.surjective).trans <|
exists_congr fun a => by simp only [eventually_map, e.le_iff_le]
#align order_iso.is_bounded_under_le_comp OrderIso.isBoundedUnder_le_comp
@[simp]
theorem _root_.OrderIso.isBoundedUnder_ge_comp [Preorder α] [Preorder β] (e : α ≃o β) {l : Filter γ}
{u : γ → α} : (IsBoundedUnder (· ≥ ·) l fun x => e (u x)) ↔ IsBoundedUnder (· ≥ ·) l u :=
OrderIso.isBoundedUnder_le_comp e.dual
#align order_iso.is_bounded_under_ge_comp OrderIso.isBoundedUnder_ge_comp
@[to_additive (attr := simp)]
theorem isBoundedUnder_le_inv [OrderedCommGroup α] {l : Filter β} {u : β → α} :
(IsBoundedUnder (· ≤ ·) l fun x => (u x)⁻¹) ↔ IsBoundedUnder (· ≥ ·) l u :=
(OrderIso.inv α).isBoundedUnder_ge_comp
#align filter.is_bounded_under_le_inv Filter.isBoundedUnder_le_inv
#align filter.is_bounded_under_le_neg Filter.isBoundedUnder_le_neg
@[to_additive (attr := simp)]
theorem isBoundedUnder_ge_inv [OrderedCommGroup α] {l : Filter β} {u : β → α} :
(IsBoundedUnder (· ≥ ·) l fun x => (u x)⁻¹) ↔ IsBoundedUnder (· ≤ ·) l u :=
(OrderIso.inv α).isBoundedUnder_le_comp
#align filter.is_bounded_under_ge_inv Filter.isBoundedUnder_ge_inv
#align filter.is_bounded_under_ge_neg Filter.isBoundedUnder_ge_neg
theorem IsBoundedUnder.sup [SemilatticeSup α] {f : Filter β} {u v : β → α} :
f.IsBoundedUnder (· ≤ ·) u →
f.IsBoundedUnder (· ≤ ·) v → f.IsBoundedUnder (· ≤ ·) fun a => u a ⊔ v a
| ⟨bu, (hu : ∀ᶠ x in f, u x ≤ bu)⟩, ⟨bv, (hv : ∀ᶠ x in f, v x ≤ bv)⟩ =>
⟨bu ⊔ bv, show ∀ᶠ x in f, u x ⊔ v x ≤ bu ⊔ bv
by filter_upwards [hu, hv] with _ using sup_le_sup⟩
#align filter.is_bounded_under.sup Filter.IsBoundedUnder.sup
@[simp]
theorem isBoundedUnder_le_sup [SemilatticeSup α] {f : Filter β} {u v : β → α} :
(f.IsBoundedUnder (· ≤ ·) fun a => u a ⊔ v a) ↔
f.IsBoundedUnder (· ≤ ·) u ∧ f.IsBoundedUnder (· ≤ ·) v :=
⟨fun h =>
⟨h.mono_le <| eventually_of_forall fun _ => le_sup_left,
h.mono_le <| eventually_of_forall fun _ => le_sup_right⟩,
fun h => h.1.sup h.2⟩
#align filter.is_bounded_under_le_sup Filter.isBoundedUnder_le_sup
theorem IsBoundedUnder.inf [SemilatticeInf α] {f : Filter β} {u v : β → α} :
f.IsBoundedUnder (· ≥ ·) u →
f.IsBoundedUnder (· ≥ ·) v → f.IsBoundedUnder (· ≥ ·) fun a => u a ⊓ v a :=
IsBoundedUnder.sup (α := αᵒᵈ)
#align filter.is_bounded_under.inf Filter.IsBoundedUnder.inf
@[simp]
theorem isBoundedUnder_ge_inf [SemilatticeInf α] {f : Filter β} {u v : β → α} :
(f.IsBoundedUnder (· ≥ ·) fun a => u a ⊓ v a) ↔
f.IsBoundedUnder (· ≥ ·) u ∧ f.IsBoundedUnder (· ≥ ·) v :=
isBoundedUnder_le_sup (α := αᵒᵈ)
#align filter.is_bounded_under_ge_inf Filter.isBoundedUnder_ge_inf
theorem isBoundedUnder_le_abs [LinearOrderedAddCommGroup α] {f : Filter β} {u : β → α} :
(f.IsBoundedUnder (· ≤ ·) fun a => |u a|) ↔
f.IsBoundedUnder (· ≤ ·) u ∧ f.IsBoundedUnder (· ≥ ·) u :=
isBoundedUnder_le_sup.trans <| and_congr Iff.rfl isBoundedUnder_le_neg
#align filter.is_bounded_under_le_abs Filter.isBoundedUnder_le_abs
macro "isBoundedDefault" : tactic =>
`(tactic| first
| apply isCobounded_le_of_bot
| apply isCobounded_ge_of_top
| apply isBounded_le_of_top
| apply isBounded_ge_of_bot)
-- Porting note: The above is a lean 4 reconstruction of (note that applyc is not available (yet?)):
-- unsafe def is_bounded_default : tactic Unit :=
-- tactic.applyc `` is_cobounded_le_of_bot <|>
-- tactic.applyc `` is_cobounded_ge_of_top <|>
-- tactic.applyc `` is_bounded_le_of_top <|> tactic.applyc `` is_bounded_ge_of_bot
-- #align filter.is_bounded_default filter.IsBounded_default
section CompleteLattice
variable [CompleteLattice α]
@[simp]
theorem limsSup_bot : limsSup (⊥ : Filter α) = ⊥ :=
bot_unique <| sInf_le <| by simp
set_option linter.uppercaseLean3 false in
#align filter.Limsup_bot Filter.limsSup_bot
@[simp] theorem limsup_bot (f : β → α) : limsup f ⊥ = ⊥ := by simp [limsup]
@[simp]
theorem limsInf_bot : limsInf (⊥ : Filter α) = ⊤ :=
top_unique <| le_sSup <| by simp
set_option linter.uppercaseLean3 false in
#align filter.Liminf_bot Filter.limsInf_bot
@[simp] theorem liminf_bot (f : β → α) : liminf f ⊥ = ⊤ := by simp [liminf]
@[simp]
theorem limsSup_top : limsSup (⊤ : Filter α) = ⊤ :=
top_unique <| le_sInf <| by simp [eq_univ_iff_forall]; exact fun b hb => top_unique <| hb _
set_option linter.uppercaseLean3 false in
#align filter.Limsup_top Filter.limsSup_top
@[simp]
theorem limsInf_top : limsInf (⊤ : Filter α) = ⊥ :=
bot_unique <| sSup_le <| by simp [eq_univ_iff_forall]; exact fun b hb => bot_unique <| hb _
set_option linter.uppercaseLean3 false in
#align filter.Liminf_top Filter.limsInf_top
@[simp]
theorem blimsup_false {f : Filter β} {u : β → α} : (blimsup u f fun _ => False) = ⊥ := by
simp [blimsup_eq]
#align filter.blimsup_false Filter.blimsup_false
@[simp]
theorem bliminf_false {f : Filter β} {u : β → α} : (bliminf u f fun _ => False) = ⊤ := by
simp [bliminf_eq]
#align filter.bliminf_false Filter.bliminf_false
@[simp]
theorem limsup_const_bot {f : Filter β} : limsup (fun _ : β => (⊥ : α)) f = (⊥ : α) := by
rw [limsup_eq, eq_bot_iff]
exact sInf_le (eventually_of_forall fun _ => le_rfl)
#align filter.limsup_const_bot Filter.limsup_const_bot
@[simp]
theorem liminf_const_top {f : Filter β} : liminf (fun _ : β => (⊤ : α)) f = (⊤ : α) :=
limsup_const_bot (α := αᵒᵈ)
#align filter.liminf_const_top Filter.liminf_const_top
theorem HasBasis.limsSup_eq_iInf_sSup {ι} {p : ι → Prop} {s} {f : Filter α} (h : f.HasBasis p s) :
limsSup f = ⨅ (i) (_ : p i), sSup (s i) :=
le_antisymm (le_iInf₂ fun i hi => sInf_le <| h.eventually_iff.2 ⟨i, hi, fun _ => le_sSup⟩)
(le_sInf fun _ ha =>
let ⟨_, hi, ha⟩ := h.eventually_iff.1 ha
iInf₂_le_of_le _ hi <| sSup_le ha)
set_option linter.uppercaseLean3 false in
#align filter.has_basis.Limsup_eq_infi_Sup Filter.HasBasis.limsSup_eq_iInf_sSup
theorem HasBasis.limsInf_eq_iSup_sInf {p : ι → Prop} {s : ι → Set α} {f : Filter α}
(h : f.HasBasis p s) : limsInf f = ⨆ (i) (_ : p i), sInf (s i) :=
HasBasis.limsSup_eq_iInf_sSup (α := αᵒᵈ) h
set_option linter.uppercaseLean3 false in
#align filter.has_basis.Liminf_eq_supr_Inf Filter.HasBasis.limsInf_eq_iSup_sInf
theorem limsSup_eq_iInf_sSup {f : Filter α} : limsSup f = ⨅ s ∈ f, sSup s :=
f.basis_sets.limsSup_eq_iInf_sSup
set_option linter.uppercaseLean3 false in
#align filter.Limsup_eq_infi_Sup Filter.limsSup_eq_iInf_sSup
theorem limsInf_eq_iSup_sInf {f : Filter α} : limsInf f = ⨆ s ∈ f, sInf s :=
limsSup_eq_iInf_sSup (α := αᵒᵈ)
set_option linter.uppercaseLean3 false in
#align filter.Liminf_eq_supr_Inf Filter.limsInf_eq_iSup_sInf
theorem limsup_le_iSup {f : Filter β} {u : β → α} : limsup u f ≤ ⨆ n, u n :=
limsup_le_of_le (by isBoundedDefault) (eventually_of_forall (le_iSup u))
#align filter.limsup_le_supr Filter.limsup_le_iSup
theorem iInf_le_liminf {f : Filter β} {u : β → α} : ⨅ n, u n ≤ liminf u f :=
le_liminf_of_le (by isBoundedDefault) (eventually_of_forall (iInf_le u))
#align filter.infi_le_liminf Filter.iInf_le_liminf
theorem limsup_eq_iInf_iSup {f : Filter β} {u : β → α} : limsup u f = ⨅ s ∈ f, ⨆ a ∈ s, u a :=
(f.basis_sets.map u).limsSup_eq_iInf_sSup.trans <| by simp only [sSup_image, id]
#align filter.limsup_eq_infi_supr Filter.limsup_eq_iInf_iSup
theorem limsup_eq_iInf_iSup_of_nat {u : ℕ → α} : limsup u atTop = ⨅ n : ℕ, ⨆ i ≥ n, u i :=
(atTop_basis.map u).limsSup_eq_iInf_sSup.trans <| by simp only [sSup_image, iInf_const]; rfl
#align filter.limsup_eq_infi_supr_of_nat Filter.limsup_eq_iInf_iSup_of_nat
theorem limsup_eq_iInf_iSup_of_nat' {u : ℕ → α} : limsup u atTop = ⨅ n : ℕ, ⨆ i : ℕ, u (i + n) := by
simp only [limsup_eq_iInf_iSup_of_nat, iSup_ge_eq_iSup_nat_add]
#align filter.limsup_eq_infi_supr_of_nat' Filter.limsup_eq_iInf_iSup_of_nat'
theorem HasBasis.limsup_eq_iInf_iSup {p : ι → Prop} {s : ι → Set β} {f : Filter β} {u : β → α}
(h : f.HasBasis p s) : limsup u f = ⨅ (i) (_ : p i), ⨆ a ∈ s i, u a :=
(h.map u).limsSup_eq_iInf_sSup.trans <| by simp only [sSup_image, id]
#align filter.has_basis.limsup_eq_infi_supr Filter.HasBasis.limsup_eq_iInf_iSup
theorem blimsup_congr' {f : Filter β} {p q : β → Prop} {u : β → α}
(h : ∀ᶠ x in f, u x ≠ ⊥ → (p x ↔ q x)) : blimsup u f p = blimsup u f q := by
simp only [blimsup_eq]
congr with a
refine eventually_congr (h.mono fun b hb => ?_)
rcases eq_or_ne (u b) ⊥ with hu | hu; · simp [hu]
rw [hb hu]
#align filter.blimsup_congr' Filter.blimsup_congr'
theorem bliminf_congr' {f : Filter β} {p q : β → Prop} {u : β → α}
(h : ∀ᶠ x in f, u x ≠ ⊤ → (p x ↔ q x)) : bliminf u f p = bliminf u f q :=
blimsup_congr' (α := αᵒᵈ) h
#align filter.bliminf_congr' Filter.bliminf_congr'
lemma HasBasis.blimsup_eq_iInf_iSup {p : ι → Prop} {s : ι → Set β} {f : Filter β} {u : β → α}
(hf : f.HasBasis p s) {q : β → Prop} :
blimsup u f q = ⨅ (i) (_ : p i), ⨆ a ∈ s i, ⨆ (_ : q a), u a := by
simp only [blimsup_eq_limsup, (hf.inf_principal _).limsup_eq_iInf_iSup, mem_inter_iff, iSup_and,
mem_setOf_eq]
theorem blimsup_eq_iInf_biSup {f : Filter β} {p : β → Prop} {u : β → α} :
blimsup u f p = ⨅ s ∈ f, ⨆ (b) (_ : p b ∧ b ∈ s), u b := by
simp only [f.basis_sets.blimsup_eq_iInf_iSup, iSup_and', id, and_comm]
#align filter.blimsup_eq_infi_bsupr Filter.blimsup_eq_iInf_biSup
theorem blimsup_eq_iInf_biSup_of_nat {p : ℕ → Prop} {u : ℕ → α} :
blimsup u atTop p = ⨅ i, ⨆ (j) (_ : p j ∧ i ≤ j), u j := by
simp only [atTop_basis.blimsup_eq_iInf_iSup, @and_comm (p _), iSup_and, mem_Ici, iInf_true]
#align filter.blimsup_eq_infi_bsupr_of_nat Filter.blimsup_eq_iInf_biSup_of_nat
theorem liminf_eq_iSup_iInf {f : Filter β} {u : β → α} : liminf u f = ⨆ s ∈ f, ⨅ a ∈ s, u a :=
limsup_eq_iInf_iSup (α := αᵒᵈ)
#align filter.liminf_eq_supr_infi Filter.liminf_eq_iSup_iInf
theorem liminf_eq_iSup_iInf_of_nat {u : ℕ → α} : liminf u atTop = ⨆ n : ℕ, ⨅ i ≥ n, u i :=
@limsup_eq_iInf_iSup_of_nat αᵒᵈ _ u
#align filter.liminf_eq_supr_infi_of_nat Filter.liminf_eq_iSup_iInf_of_nat
theorem liminf_eq_iSup_iInf_of_nat' {u : ℕ → α} : liminf u atTop = ⨆ n : ℕ, ⨅ i : ℕ, u (i + n) :=
@limsup_eq_iInf_iSup_of_nat' αᵒᵈ _ _
#align filter.liminf_eq_supr_infi_of_nat' Filter.liminf_eq_iSup_iInf_of_nat'
theorem HasBasis.liminf_eq_iSup_iInf {p : ι → Prop} {s : ι → Set β} {f : Filter β} {u : β → α}
(h : f.HasBasis p s) : liminf u f = ⨆ (i) (_ : p i), ⨅ a ∈ s i, u a :=
HasBasis.limsup_eq_iInf_iSup (α := αᵒᵈ) h
#align filter.has_basis.liminf_eq_supr_infi Filter.HasBasis.liminf_eq_iSup_iInf
theorem bliminf_eq_iSup_biInf {f : Filter β} {p : β → Prop} {u : β → α} :
bliminf u f p = ⨆ s ∈ f, ⨅ (b) (_ : p b ∧ b ∈ s), u b :=
@blimsup_eq_iInf_biSup αᵒᵈ β _ f p u
#align filter.bliminf_eq_supr_binfi Filter.bliminf_eq_iSup_biInf
theorem bliminf_eq_iSup_biInf_of_nat {p : ℕ → Prop} {u : ℕ → α} :
bliminf u atTop p = ⨆ i, ⨅ (j) (_ : p j ∧ i ≤ j), u j :=
@blimsup_eq_iInf_biSup_of_nat αᵒᵈ _ p u
#align filter.bliminf_eq_supr_binfi_of_nat Filter.bliminf_eq_iSup_biInf_of_nat
theorem limsup_eq_sInf_sSup {ι R : Type*} (F : Filter ι) [CompleteLattice R] (a : ι → R) :
limsup a F = sInf ((fun I => sSup (a '' I)) '' F.sets) := by
apply le_antisymm
· rw [limsup_eq]
refine sInf_le_sInf fun x hx => ?_
rcases (mem_image _ F.sets x).mp hx with ⟨I, ⟨I_mem_F, hI⟩⟩
filter_upwards [I_mem_F] with i hi
exact hI ▸ le_sSup (mem_image_of_mem _ hi)
· refine le_sInf fun b hb => sInf_le_of_le (mem_image_of_mem _ hb) <| sSup_le ?_
rintro _ ⟨_, h, rfl⟩
exact h
set_option linter.uppercaseLean3 false in
#align filter.limsup_eq_Inf_Sup Filter.limsup_eq_sInf_sSup
theorem liminf_eq_sSup_sInf {ι R : Type*} (F : Filter ι) [CompleteLattice R] (a : ι → R) :
liminf a F = sSup ((fun I => sInf (a '' I)) '' F.sets) :=
@Filter.limsup_eq_sInf_sSup ι (OrderDual R) _ _ a
set_option linter.uppercaseLean3 false in
#align filter.liminf_eq_Sup_Inf Filter.liminf_eq_sSup_sInf
theorem liminf_le_of_frequently_le' {α β} [CompleteLattice β] {f : Filter α} {u : α → β} {x : β}
(h : ∃ᶠ a in f, u a ≤ x) : liminf u f ≤ x := by
rw [liminf_eq]
refine sSup_le fun b hb => ?_
have hbx : ∃ᶠ _ in f, b ≤ x := by
revert h
rw [← not_imp_not, not_frequently, not_frequently]
exact fun h => hb.mp (h.mono fun a hbx hba hax => hbx (hba.trans hax))
exact hbx.exists.choose_spec
#align filter.liminf_le_of_frequently_le' Filter.liminf_le_of_frequently_le'
theorem le_limsup_of_frequently_le' {α β} [CompleteLattice β] {f : Filter α} {u : α → β} {x : β}
(h : ∃ᶠ a in f, x ≤ u a) : x ≤ limsup u f :=
liminf_le_of_frequently_le' (β := βᵒᵈ) h
#align filter.le_limsup_of_frequently_le' Filter.le_limsup_of_frequently_le'
@[simp]
theorem CompleteLatticeHom.apply_limsup_iterate (f : CompleteLatticeHom α α) (a : α) :
f (limsup (fun n => f^[n] a) atTop) = limsup (fun n => f^[n] a) atTop := by
rw [limsup_eq_iInf_iSup_of_nat', map_iInf]
simp_rw [_root_.map_iSup, ← Function.comp_apply (f := f), ← Function.iterate_succ' f,
← Nat.add_succ]
conv_rhs => rw [iInf_split _ (0 < ·)]
simp only [not_lt, Nat.le_zero, iInf_iInf_eq_left, add_zero, iInf_nat_gt_zero_eq, left_eq_inf]
refine (iInf_le (fun i => ⨆ j, f^[j + (i + 1)] a) 0).trans ?_
simp only [zero_add, Function.comp_apply, iSup_le_iff]
exact fun i => le_iSup (fun i => f^[i] a) (i + 1)
#align filter.complete_lattice_hom.apply_limsup_iterate Filter.CompleteLatticeHom.apply_limsup_iterate
theorem CompleteLatticeHom.apply_liminf_iterate (f : CompleteLatticeHom α α) (a : α) :
f (liminf (fun n => f^[n] a) atTop) = liminf (fun n => f^[n] a) atTop :=
apply_limsup_iterate (CompleteLatticeHom.dual f) _
#align filter.complete_lattice_hom.apply_liminf_iterate Filter.CompleteLatticeHom.apply_liminf_iterate
variable {f g : Filter β} {p q : β → Prop} {u v : β → α}
theorem blimsup_mono (h : ∀ x, p x → q x) : blimsup u f p ≤ blimsup u f q :=
sInf_le_sInf fun a ha => ha.mono <| by tauto
#align filter.blimsup_mono Filter.blimsup_mono
theorem bliminf_antitone (h : ∀ x, p x → q x) : bliminf u f q ≤ bliminf u f p :=
sSup_le_sSup fun a ha => ha.mono <| by tauto
#align filter.bliminf_antitone Filter.bliminf_antitone
theorem mono_blimsup' (h : ∀ᶠ x in f, p x → u x ≤ v x) : blimsup u f p ≤ blimsup v f p :=
sInf_le_sInf fun _ ha => (ha.and h).mono fun _ hx hx' => (hx.2 hx').trans (hx.1 hx')
#align filter.mono_blimsup' Filter.mono_blimsup'
theorem mono_blimsup (h : ∀ x, p x → u x ≤ v x) : blimsup u f p ≤ blimsup v f p :=
mono_blimsup' <| eventually_of_forall h
#align filter.mono_blimsup Filter.mono_blimsup
theorem mono_bliminf' (h : ∀ᶠ x in f, p x → u x ≤ v x) : bliminf u f p ≤ bliminf v f p :=
sSup_le_sSup fun _ ha => (ha.and h).mono fun _ hx hx' => (hx.1 hx').trans (hx.2 hx')
#align filter.mono_bliminf' Filter.mono_bliminf'
theorem mono_bliminf (h : ∀ x, p x → u x ≤ v x) : bliminf u f p ≤ bliminf v f p :=
mono_bliminf' <| eventually_of_forall h
#align filter.mono_bliminf Filter.mono_bliminf
theorem bliminf_antitone_filter (h : f ≤ g) : bliminf u g p ≤ bliminf u f p :=
sSup_le_sSup fun _ ha => ha.filter_mono h
#align filter.bliminf_antitone_filter Filter.bliminf_antitone_filter
theorem blimsup_monotone_filter (h : f ≤ g) : blimsup u f p ≤ blimsup u g p :=
sInf_le_sInf fun _ ha => ha.filter_mono h
#align filter.blimsup_monotone_filter Filter.blimsup_monotone_filter
-- @[simp] -- Porting note: simp_nf linter, lhs simplifies, added _aux versions below
theorem blimsup_and_le_inf : (blimsup u f fun x => p x ∧ q x) ≤ blimsup u f p ⊓ blimsup u f q :=
le_inf (blimsup_mono <| by tauto) (blimsup_mono <| by tauto)
#align filter.blimsup_and_le_inf Filter.blimsup_and_le_inf
@[simp]
theorem bliminf_sup_le_inf_aux_left :
(blimsup u f fun x => p x ∧ q x) ≤ blimsup u f p :=
blimsup_and_le_inf.trans inf_le_left
@[simp]
theorem bliminf_sup_le_inf_aux_right :
(blimsup u f fun x => p x ∧ q x) ≤ blimsup u f q :=
blimsup_and_le_inf.trans inf_le_right
-- @[simp] -- Porting note: simp_nf linter, lhs simplifies, added _aux simp version below
theorem bliminf_sup_le_and : bliminf u f p ⊔ bliminf u f q ≤ bliminf u f fun x => p x ∧ q x :=
blimsup_and_le_inf (α := αᵒᵈ)
#align filter.bliminf_sup_le_and Filter.bliminf_sup_le_and
@[simp]
theorem bliminf_sup_le_and_aux_left : bliminf u f p ≤ bliminf u f fun x => p x ∧ q x :=
le_sup_left.trans bliminf_sup_le_and
@[simp]
theorem bliminf_sup_le_and_aux_right : bliminf u f q ≤ bliminf u f fun x => p x ∧ q x :=
le_sup_right.trans bliminf_sup_le_and
-- @[simp] -- Porting note: simp_nf linter, lhs simplifies, added _aux simp versions below
theorem blimsup_sup_le_or : blimsup u f p ⊔ blimsup u f q ≤ blimsup u f fun x => p x ∨ q x :=
sup_le (blimsup_mono <| by tauto) (blimsup_mono <| by tauto)
#align filter.blimsup_sup_le_or Filter.blimsup_sup_le_or
@[simp]
theorem bliminf_sup_le_or_aux_left : blimsup u f p ≤ blimsup u f fun x => p x ∨ q x :=
le_sup_left.trans blimsup_sup_le_or
@[simp]
theorem bliminf_sup_le_or_aux_right : blimsup u f q ≤ blimsup u f fun x => p x ∨ q x :=
le_sup_right.trans blimsup_sup_le_or
--@[simp] -- Porting note: simp_nf linter, lhs simplifies, added _aux simp versions below
theorem bliminf_or_le_inf : (bliminf u f fun x => p x ∨ q x) ≤ bliminf u f p ⊓ bliminf u f q :=
blimsup_sup_le_or (α := αᵒᵈ)
#align filter.bliminf_or_le_inf Filter.bliminf_or_le_inf
@[simp]
theorem bliminf_or_le_inf_aux_left : (bliminf u f fun x => p x ∨ q x) ≤ bliminf u f p :=
bliminf_or_le_inf.trans inf_le_left
@[simp]
theorem bliminf_or_le_inf_aux_right : (bliminf u f fun x => p x ∨ q x) ≤ bliminf u f q :=
bliminf_or_le_inf.trans inf_le_right
theorem OrderIso.apply_blimsup [CompleteLattice γ] (e : α ≃o γ) :
DFunLike.coe e (blimsup u f p) = blimsup ((DFunLike.coe e) ∘ u) f p := by
simp only [blimsup_eq, map_sInf, Function.comp_apply]
congr
ext c
obtain ⟨a, rfl⟩ := e.surjective c
simp
#align filter.order_iso.apply_blimsup Filter.OrderIso.apply_blimsup
theorem OrderIso.apply_bliminf [CompleteLattice γ] (e : α ≃o γ) :
e (bliminf u f p) = bliminf (e ∘ u) f p :=
OrderIso.apply_blimsup (α := αᵒᵈ) (γ := γᵒᵈ) e.dual
#align filter.order_iso.apply_bliminf Filter.OrderIso.apply_bliminf
| Mathlib/Order/LiminfLimsup.lean | 1,078 | 1,082 | theorem SupHom.apply_blimsup_le [CompleteLattice γ] (g : sSupHom α γ) :
g (blimsup u f p) ≤ blimsup (g ∘ u) f p := by |
simp only [blimsup_eq_iInf_biSup, Function.comp]
refine ((OrderHomClass.mono g).map_iInf₂_le _).trans ?_
simp only [_root_.map_iSup, le_refl]
|
import Mathlib.SetTheory.Ordinal.Basic
import Mathlib.Data.Nat.SuccPred
#align_import set_theory.ordinal.arithmetic from "leanprover-community/mathlib"@"31b269b60935483943542d547a6dd83a66b37dc7"
assert_not_exists Field
assert_not_exists Module
noncomputable section
open Function Cardinal Set Equiv Order
open scoped Classical
open Cardinal Ordinal
universe u v w
namespace Ordinal
variable {α : Type*} {β : Type*} {γ : Type*} {r : α → α → Prop} {s : β → β → Prop}
{t : γ → γ → Prop}
@[simp]
theorem lift_add (a b : Ordinal.{v}) : lift.{u} (a + b) = lift.{u} a + lift.{u} b :=
Quotient.inductionOn₂ a b fun ⟨_α, _r, _⟩ ⟨_β, _s, _⟩ =>
Quotient.sound
⟨(RelIso.preimage Equiv.ulift _).trans
(RelIso.sumLexCongr (RelIso.preimage Equiv.ulift _) (RelIso.preimage Equiv.ulift _)).symm⟩
#align ordinal.lift_add Ordinal.lift_add
@[simp]
theorem lift_succ (a : Ordinal.{v}) : lift.{u} (succ a) = succ (lift.{u} a) := by
rw [← add_one_eq_succ, lift_add, lift_one]
rfl
#align ordinal.lift_succ Ordinal.lift_succ
instance add_contravariantClass_le : ContravariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· ≤ ·) :=
⟨fun a b c =>
inductionOn a fun α r hr =>
inductionOn b fun β₁ s₁ hs₁ =>
inductionOn c fun β₂ s₂ hs₂ ⟨f⟩ =>
⟨have fl : ∀ a, f (Sum.inl a) = Sum.inl a := fun a => by
simpa only [InitialSeg.trans_apply, InitialSeg.leAdd_apply] using
@InitialSeg.eq _ _ _ _ _
((InitialSeg.leAdd r s₁).trans f) (InitialSeg.leAdd r s₂) a
have : ∀ b, { b' // f (Sum.inr b) = Sum.inr b' } := by
intro b; cases e : f (Sum.inr b)
· rw [← fl] at e
have := f.inj' e
contradiction
· exact ⟨_, rfl⟩
let g (b) := (this b).1
have fr : ∀ b, f (Sum.inr b) = Sum.inr (g b) := fun b => (this b).2
⟨⟨⟨g, fun x y h => by
injection f.inj' (by rw [fr, fr, h] : f (Sum.inr x) = f (Sum.inr y))⟩,
@fun a b => by
-- Porting note:
-- `relEmbedding.coe_fn_to_embedding` & `initial_seg.coe_fn_to_rel_embedding`
-- → `InitialSeg.coe_coe_fn`
simpa only [Sum.lex_inr_inr, fr, InitialSeg.coe_coe_fn, Embedding.coeFn_mk] using
@RelEmbedding.map_rel_iff _ _ _ _ f.toRelEmbedding (Sum.inr a) (Sum.inr b)⟩,
fun a b H => by
rcases f.init (by rw [fr] <;> exact Sum.lex_inr_inr.2 H) with ⟨a' | a', h⟩
· rw [fl] at h
cases h
· rw [fr] at h
exact ⟨a', Sum.inr.inj h⟩⟩⟩⟩
#align ordinal.add_contravariant_class_le Ordinal.add_contravariantClass_le
theorem add_left_cancel (a) {b c : Ordinal} : a + b = a + c ↔ b = c := by
simp only [le_antisymm_iff, add_le_add_iff_left]
#align ordinal.add_left_cancel Ordinal.add_left_cancel
private theorem add_lt_add_iff_left' (a) {b c : Ordinal} : a + b < a + c ↔ b < c := by
rw [← not_le, ← not_le, add_le_add_iff_left]
instance add_covariantClass_lt : CovariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· < ·) :=
⟨fun a _b _c => (add_lt_add_iff_left' a).2⟩
#align ordinal.add_covariant_class_lt Ordinal.add_covariantClass_lt
instance add_contravariantClass_lt : ContravariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· < ·) :=
⟨fun a _b _c => (add_lt_add_iff_left' a).1⟩
#align ordinal.add_contravariant_class_lt Ordinal.add_contravariantClass_lt
instance add_swap_contravariantClass_lt :
ContravariantClass Ordinal.{u} Ordinal.{u} (swap (· + ·)) (· < ·) :=
⟨fun _a _b _c => lt_imp_lt_of_le_imp_le fun h => add_le_add_right h _⟩
#align ordinal.add_swap_contravariant_class_lt Ordinal.add_swap_contravariantClass_lt
theorem add_le_add_iff_right {a b : Ordinal} : ∀ n : ℕ, a + n ≤ b + n ↔ a ≤ b
| 0 => by simp
| n + 1 => by
simp only [natCast_succ, add_succ, add_succ, succ_le_succ_iff, add_le_add_iff_right]
#align ordinal.add_le_add_iff_right Ordinal.add_le_add_iff_right
theorem add_right_cancel {a b : Ordinal} (n : ℕ) : a + n = b + n ↔ a = b := by
simp only [le_antisymm_iff, add_le_add_iff_right]
#align ordinal.add_right_cancel Ordinal.add_right_cancel
theorem add_eq_zero_iff {a b : Ordinal} : a + b = 0 ↔ a = 0 ∧ b = 0 :=
inductionOn a fun α r _ =>
inductionOn b fun β s _ => by
simp_rw [← type_sum_lex, type_eq_zero_iff_isEmpty]
exact isEmpty_sum
#align ordinal.add_eq_zero_iff Ordinal.add_eq_zero_iff
theorem left_eq_zero_of_add_eq_zero {a b : Ordinal} (h : a + b = 0) : a = 0 :=
(add_eq_zero_iff.1 h).1
#align ordinal.left_eq_zero_of_add_eq_zero Ordinal.left_eq_zero_of_add_eq_zero
theorem right_eq_zero_of_add_eq_zero {a b : Ordinal} (h : a + b = 0) : b = 0 :=
(add_eq_zero_iff.1 h).2
#align ordinal.right_eq_zero_of_add_eq_zero Ordinal.right_eq_zero_of_add_eq_zero
def pred (o : Ordinal) : Ordinal :=
if h : ∃ a, o = succ a then Classical.choose h else o
#align ordinal.pred Ordinal.pred
@[simp]
theorem pred_succ (o) : pred (succ o) = o := by
have h : ∃ a, succ o = succ a := ⟨_, rfl⟩;
simpa only [pred, dif_pos h] using (succ_injective <| Classical.choose_spec h).symm
#align ordinal.pred_succ Ordinal.pred_succ
theorem pred_le_self (o) : pred o ≤ o :=
if h : ∃ a, o = succ a then by
let ⟨a, e⟩ := h
rw [e, pred_succ]; exact le_succ a
else by rw [pred, dif_neg h]
#align ordinal.pred_le_self Ordinal.pred_le_self
theorem pred_eq_iff_not_succ {o} : pred o = o ↔ ¬∃ a, o = succ a :=
⟨fun e ⟨a, e'⟩ => by rw [e', pred_succ] at e; exact (lt_succ a).ne e, fun h => dif_neg h⟩
#align ordinal.pred_eq_iff_not_succ Ordinal.pred_eq_iff_not_succ
theorem pred_eq_iff_not_succ' {o} : pred o = o ↔ ∀ a, o ≠ succ a := by
simpa using pred_eq_iff_not_succ
#align ordinal.pred_eq_iff_not_succ' Ordinal.pred_eq_iff_not_succ'
theorem pred_lt_iff_is_succ {o} : pred o < o ↔ ∃ a, o = succ a :=
Iff.trans (by simp only [le_antisymm_iff, pred_le_self, true_and_iff, not_le])
(iff_not_comm.1 pred_eq_iff_not_succ).symm
#align ordinal.pred_lt_iff_is_succ Ordinal.pred_lt_iff_is_succ
@[simp]
theorem pred_zero : pred 0 = 0 :=
pred_eq_iff_not_succ'.2 fun a => (succ_ne_zero a).symm
#align ordinal.pred_zero Ordinal.pred_zero
theorem succ_pred_iff_is_succ {o} : succ (pred o) = o ↔ ∃ a, o = succ a :=
⟨fun e => ⟨_, e.symm⟩, fun ⟨a, e⟩ => by simp only [e, pred_succ]⟩
#align ordinal.succ_pred_iff_is_succ Ordinal.succ_pred_iff_is_succ
theorem succ_lt_of_not_succ {o b : Ordinal} (h : ¬∃ a, o = succ a) : succ b < o ↔ b < o :=
⟨(lt_succ b).trans, fun l => lt_of_le_of_ne (succ_le_of_lt l) fun e => h ⟨_, e.symm⟩⟩
#align ordinal.succ_lt_of_not_succ Ordinal.succ_lt_of_not_succ
theorem lt_pred {a b} : a < pred b ↔ succ a < b :=
if h : ∃ a, b = succ a then by
let ⟨c, e⟩ := h
rw [e, pred_succ, succ_lt_succ_iff]
else by simp only [pred, dif_neg h, succ_lt_of_not_succ h]
#align ordinal.lt_pred Ordinal.lt_pred
theorem pred_le {a b} : pred a ≤ b ↔ a ≤ succ b :=
le_iff_le_iff_lt_iff_lt.2 lt_pred
#align ordinal.pred_le Ordinal.pred_le
@[simp]
theorem lift_is_succ {o : Ordinal.{v}} : (∃ a, lift.{u} o = succ a) ↔ ∃ a, o = succ a :=
⟨fun ⟨a, h⟩ =>
let ⟨b, e⟩ := lift_down <| show a ≤ lift.{u} o from le_of_lt <| h.symm ▸ lt_succ a
⟨b, lift_inj.1 <| by rw [h, ← e, lift_succ]⟩,
fun ⟨a, h⟩ => ⟨lift.{u} a, by simp only [h, lift_succ]⟩⟩
#align ordinal.lift_is_succ Ordinal.lift_is_succ
@[simp]
theorem lift_pred (o : Ordinal.{v}) : lift.{u} (pred o) = pred (lift.{u} o) :=
if h : ∃ a, o = succ a then by cases' h with a e; simp only [e, pred_succ, lift_succ]
else by rw [pred_eq_iff_not_succ.2 h, pred_eq_iff_not_succ.2 (mt lift_is_succ.1 h)]
#align ordinal.lift_pred Ordinal.lift_pred
def IsLimit (o : Ordinal) : Prop :=
o ≠ 0 ∧ ∀ a < o, succ a < o
#align ordinal.is_limit Ordinal.IsLimit
theorem IsLimit.isSuccLimit {o} (h : IsLimit o) : IsSuccLimit o := isSuccLimit_iff_succ_lt.mpr h.2
theorem IsLimit.succ_lt {o a : Ordinal} (h : IsLimit o) : a < o → succ a < o :=
h.2 a
#align ordinal.is_limit.succ_lt Ordinal.IsLimit.succ_lt
theorem isSuccLimit_zero : IsSuccLimit (0 : Ordinal) := isSuccLimit_bot
theorem not_zero_isLimit : ¬IsLimit 0
| ⟨h, _⟩ => h rfl
#align ordinal.not_zero_is_limit Ordinal.not_zero_isLimit
theorem not_succ_isLimit (o) : ¬IsLimit (succ o)
| ⟨_, h⟩ => lt_irrefl _ (h _ (lt_succ o))
#align ordinal.not_succ_is_limit Ordinal.not_succ_isLimit
theorem not_succ_of_isLimit {o} (h : IsLimit o) : ¬∃ a, o = succ a
| ⟨a, e⟩ => not_succ_isLimit a (e ▸ h)
#align ordinal.not_succ_of_is_limit Ordinal.not_succ_of_isLimit
theorem succ_lt_of_isLimit {o a : Ordinal} (h : IsLimit o) : succ a < o ↔ a < o :=
⟨(lt_succ a).trans, h.2 _⟩
#align ordinal.succ_lt_of_is_limit Ordinal.succ_lt_of_isLimit
theorem le_succ_of_isLimit {o} (h : IsLimit o) {a} : o ≤ succ a ↔ o ≤ a :=
le_iff_le_iff_lt_iff_lt.2 <| succ_lt_of_isLimit h
#align ordinal.le_succ_of_is_limit Ordinal.le_succ_of_isLimit
theorem limit_le {o} (h : IsLimit o) {a} : o ≤ a ↔ ∀ x < o, x ≤ a :=
⟨fun h _x l => l.le.trans h, fun H =>
(le_succ_of_isLimit h).1 <| le_of_not_lt fun hn => not_lt_of_le (H _ hn) (lt_succ a)⟩
#align ordinal.limit_le Ordinal.limit_le
theorem lt_limit {o} (h : IsLimit o) {a} : a < o ↔ ∃ x < o, a < x := by
-- Porting note: `bex_def` is required.
simpa only [not_forall₂, not_le, bex_def] using not_congr (@limit_le _ h a)
#align ordinal.lt_limit Ordinal.lt_limit
@[simp]
theorem lift_isLimit (o) : IsLimit (lift o) ↔ IsLimit o :=
and_congr (not_congr <| by simpa only [lift_zero] using @lift_inj o 0)
⟨fun H a h => lift_lt.1 <| by simpa only [lift_succ] using H _ (lift_lt.2 h), fun H a h => by
obtain ⟨a', rfl⟩ := lift_down h.le
rw [← lift_succ, lift_lt]
exact H a' (lift_lt.1 h)⟩
#align ordinal.lift_is_limit Ordinal.lift_isLimit
theorem IsLimit.pos {o : Ordinal} (h : IsLimit o) : 0 < o :=
lt_of_le_of_ne (Ordinal.zero_le _) h.1.symm
#align ordinal.is_limit.pos Ordinal.IsLimit.pos
theorem IsLimit.one_lt {o : Ordinal} (h : IsLimit o) : 1 < o := by
simpa only [succ_zero] using h.2 _ h.pos
#align ordinal.is_limit.one_lt Ordinal.IsLimit.one_lt
theorem IsLimit.nat_lt {o : Ordinal} (h : IsLimit o) : ∀ n : ℕ, (n : Ordinal) < o
| 0 => h.pos
| n + 1 => h.2 _ (IsLimit.nat_lt h n)
#align ordinal.is_limit.nat_lt Ordinal.IsLimit.nat_lt
theorem zero_or_succ_or_limit (o : Ordinal) : o = 0 ∨ (∃ a, o = succ a) ∨ IsLimit o :=
if o0 : o = 0 then Or.inl o0
else
if h : ∃ a, o = succ a then Or.inr (Or.inl h)
else Or.inr <| Or.inr ⟨o0, fun _a => (succ_lt_of_not_succ h).2⟩
#align ordinal.zero_or_succ_or_limit Ordinal.zero_or_succ_or_limit
@[elab_as_elim]
def limitRecOn {C : Ordinal → Sort*} (o : Ordinal) (H₁ : C 0) (H₂ : ∀ o, C o → C (succ o))
(H₃ : ∀ o, IsLimit o → (∀ o' < o, C o') → C o) : C o :=
SuccOrder.limitRecOn o (fun o _ ↦ H₂ o) fun o hl ↦
if h : o = 0 then fun _ ↦ h ▸ H₁ else H₃ o ⟨h, fun _ ↦ hl.succ_lt⟩
#align ordinal.limit_rec_on Ordinal.limitRecOn
@[simp]
theorem limitRecOn_zero {C} (H₁ H₂ H₃) : @limitRecOn C 0 H₁ H₂ H₃ = H₁ := by
rw [limitRecOn, SuccOrder.limitRecOn_limit _ _ isSuccLimit_zero, dif_pos rfl]
#align ordinal.limit_rec_on_zero Ordinal.limitRecOn_zero
@[simp]
| Mathlib/SetTheory/Ordinal/Arithmetic.lean | 327 | 329 | theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
@limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by |
simp_rw [limitRecOn, SuccOrder.limitRecOn_succ _ _ (not_isMax _)]
|
import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic
import Mathlib.CategoryTheory.Monoidal.Functorial
import Mathlib.CategoryTheory.Monoidal.Types.Basic
import Mathlib.LinearAlgebra.DirectSum.Finsupp
import Mathlib.CategoryTheory.Linear.LinearFunctor
#align_import algebra.category.Module.adjunctions from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4"
set_option linter.uppercaseLean3 false -- `Module`
noncomputable section
open CategoryTheory
namespace ModuleCat
universe u
open scoped Classical
variable (R : Type u)
section
variable [Ring R]
@[simps]
def free : Type u ⥤ ModuleCat R where
obj X := ModuleCat.of R (X →₀ R)
map {X Y} f := Finsupp.lmapDomain _ _ f
map_id := by intros; exact Finsupp.lmapDomain_id _ _
map_comp := by intros; exact Finsupp.lmapDomain_comp _ _ _ _
#align Module.free ModuleCat.free
def adj : free R ⊣ forget (ModuleCat.{u} R) :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun X M => (Finsupp.lift M R X).toEquiv.symm
homEquiv_naturality_left_symm := fun {_ _} M f g =>
Finsupp.lhom_ext' fun x =>
LinearMap.ext_ring
(Finsupp.sum_mapDomain_index_addMonoidHom fun y => (smulAddHom R M).flip (g y)).symm }
#align Module.adj ModuleCat.adj
instance : (forget (ModuleCat.{u} R)).IsRightAdjoint :=
(adj R).isRightAdjoint
end
namespace Free
open MonoidalCategory
variable [CommRing R]
attribute [local ext] TensorProduct.ext
def ε : 𝟙_ (ModuleCat.{u} R) ⟶ (free R).obj (𝟙_ (Type u)) :=
Finsupp.lsingle PUnit.unit
#align Module.free.ε ModuleCat.Free.ε
-- This lemma has always been bad, but lean4#2644 made `simp` start noticing
@[simp, nolint simpNF]
theorem ε_apply (r : R) : ε R r = Finsupp.single PUnit.unit r :=
rfl
#align Module.free.ε_apply ModuleCat.Free.ε_apply
def μ (α β : Type u) : (free R).obj α ⊗ (free R).obj β ≅ (free R).obj (α ⊗ β) :=
(finsuppTensorFinsupp' R α β).toModuleIso
#align Module.free.μ ModuleCat.Free.μ
theorem μ_natural {X Y X' Y' : Type u} (f : X ⟶ Y) (g : X' ⟶ Y') :
((free R).map f ⊗ (free R).map g) ≫ (μ R Y Y').hom = (μ R X X').hom ≫ (free R).map (f ⊗ g) := by
-- Porting note (#11041): broken ext
apply TensorProduct.ext
apply Finsupp.lhom_ext'
intro x
apply LinearMap.ext_ring
apply Finsupp.lhom_ext'
intro x'
apply LinearMap.ext_ring
apply Finsupp.ext
intro ⟨y, y'⟩
-- Porting note (#10934): used to be dsimp [μ]
change (finsuppTensorFinsupp' R Y Y')
(Finsupp.mapDomain f (Finsupp.single x 1) ⊗ₜ[R] Finsupp.mapDomain g (Finsupp.single x' 1)) _
= (Finsupp.mapDomain (f ⊗ g) (finsuppTensorFinsupp' R X X'
(Finsupp.single x 1 ⊗ₜ[R] Finsupp.single x' 1))) _
-- extra `rfl` after leanprover/lean4#2466
simp_rw [Finsupp.mapDomain_single, finsuppTensorFinsupp'_single_tmul_single, mul_one,
Finsupp.mapDomain_single, CategoryTheory.tensor_apply]; rfl
#align Module.free.μ_natural ModuleCat.Free.μ_natural
theorem left_unitality (X : Type u) :
(λ_ ((free R).obj X)).hom =
(ε R ⊗ 𝟙 ((free R).obj X)) ≫ (μ R (𝟙_ (Type u)) X).hom ≫ map (free R).obj (λ_ X).hom := by
-- Porting note (#11041): broken ext
apply TensorProduct.ext
apply LinearMap.ext_ring
apply Finsupp.lhom_ext'
intro x
apply LinearMap.ext_ring
apply Finsupp.ext
intro x'
-- Porting note (#10934): used to be dsimp [ε, μ]
let q : X →₀ R := ((λ_ (of R (X →₀ R))).hom) (1 ⊗ₜ[R] Finsupp.single x 1)
change q x' = Finsupp.mapDomain (λ_ X).hom (finsuppTensorFinsupp' R (𝟙_ (Type u)) X
(Finsupp.single PUnit.unit 1 ⊗ₜ[R] Finsupp.single x 1)) x'
simp_rw [q, finsuppTensorFinsupp'_single_tmul_single,
ModuleCat.MonoidalCategory.leftUnitor_hom_apply, mul_one,
Finsupp.mapDomain_single, CategoryTheory.leftUnitor_hom_apply, one_smul]
#align Module.free.left_unitality ModuleCat.Free.left_unitality
theorem right_unitality (X : Type u) :
(ρ_ ((free R).obj X)).hom =
(𝟙 ((free R).obj X) ⊗ ε R) ≫ (μ R X (𝟙_ (Type u))).hom ≫ map (free R).obj (ρ_ X).hom := by
-- Porting note (#11041): broken ext
apply TensorProduct.ext
apply Finsupp.lhom_ext'
intro x
apply LinearMap.ext_ring
apply LinearMap.ext_ring
apply Finsupp.ext
intro x'
-- Porting note (#10934): used to be dsimp [ε, μ]
let q : X →₀ R := ((ρ_ (of R (X →₀ R))).hom) (Finsupp.single x 1 ⊗ₜ[R] 1)
change q x' = Finsupp.mapDomain (ρ_ X).hom (finsuppTensorFinsupp' R X (𝟙_ (Type u))
(Finsupp.single x 1 ⊗ₜ[R] Finsupp.single PUnit.unit 1)) x'
simp_rw [q, finsuppTensorFinsupp'_single_tmul_single,
ModuleCat.MonoidalCategory.rightUnitor_hom_apply, mul_one,
Finsupp.mapDomain_single, CategoryTheory.rightUnitor_hom_apply, one_smul]
#align Module.free.right_unitality ModuleCat.Free.right_unitality
| Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean | 152 | 179 | theorem associativity (X Y Z : Type u) :
((μ R X Y).hom ⊗ 𝟙 ((free R).obj Z)) ≫ (μ R (X ⊗ Y) Z).hom ≫ map (free R).obj (α_ X Y Z).hom =
(α_ ((free R).obj X) ((free R).obj Y) ((free R).obj Z)).hom ≫
(𝟙 ((free R).obj X) ⊗ (μ R Y Z).hom) ≫ (μ R X (Y ⊗ Z)).hom := by |
-- Porting note (#11041): broken ext
apply TensorProduct.ext
apply TensorProduct.ext
apply Finsupp.lhom_ext'
intro x
apply LinearMap.ext_ring
apply Finsupp.lhom_ext'
intro y
apply LinearMap.ext_ring
apply Finsupp.lhom_ext'
intro z
apply LinearMap.ext_ring
apply Finsupp.ext
intro a
-- Porting note (#10934): used to be dsimp [μ]
change Finsupp.mapDomain (α_ X Y Z).hom (finsuppTensorFinsupp' R (X ⊗ Y) Z
(finsuppTensorFinsupp' R X Y
(Finsupp.single x 1 ⊗ₜ[R] Finsupp.single y 1) ⊗ₜ[R] Finsupp.single z 1)) a =
finsuppTensorFinsupp' R X (Y ⊗ Z)
(Finsupp.single x 1 ⊗ₜ[R]
finsuppTensorFinsupp' R Y Z (Finsupp.single y 1 ⊗ₜ[R] Finsupp.single z 1)) a
-- extra `rfl` after leanprover/lean4#2466
simp_rw [finsuppTensorFinsupp'_single_tmul_single, Finsupp.mapDomain_single, mul_one,
CategoryTheory.associator_hom_apply]; rfl
|
import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension
import Mathlib.Geometry.Manifold.ContMDiff.Atlas
import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace
#align_import geometry.manifold.bump_function from "leanprover-community/mathlib"@"b018406ad2f2a73223a3a9e198ccae61e6f05318"
universe uE uF uH uM
variable {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
{H : Type uH} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) {M : Type uM} [TopologicalSpace M]
[ChartedSpace H M] [SmoothManifoldWithCorners I M]
open Function Filter FiniteDimensional Set Metric
open scoped Topology Manifold Classical Filter
noncomputable section
structure SmoothBumpFunction (c : M) extends ContDiffBump (extChartAt I c c) where
closedBall_subset : closedBall (extChartAt I c c) rOut ∩ range I ⊆ (extChartAt I c).target
#align smooth_bump_function SmoothBumpFunction
namespace SmoothBumpFunction
variable {c : M} (f : SmoothBumpFunction I c) {x : M} {I}
@[coe] def toFun : M → ℝ :=
indicator (chartAt H c).source (f.toContDiffBump ∘ extChartAt I c)
#align smooth_bump_function.to_fun SmoothBumpFunction.toFun
instance : CoeFun (SmoothBumpFunction I c) fun _ => M → ℝ :=
⟨toFun⟩
theorem coe_def : ⇑f = indicator (chartAt H c).source (f.toContDiffBump ∘ extChartAt I c) :=
rfl
#align smooth_bump_function.coe_def SmoothBumpFunction.coe_def
theorem rOut_pos : 0 < f.rOut :=
f.toContDiffBump.rOut_pos
set_option linter.uppercaseLean3 false in
#align smooth_bump_function.R_pos SmoothBumpFunction.rOut_pos
theorem ball_subset : ball (extChartAt I c c) f.rOut ∩ range I ⊆ (extChartAt I c).target :=
Subset.trans (inter_subset_inter_left _ ball_subset_closedBall) f.closedBall_subset
#align smooth_bump_function.ball_subset SmoothBumpFunction.ball_subset
theorem ball_inter_range_eq_ball_inter_target :
ball (extChartAt I c c) f.rOut ∩ range I =
ball (extChartAt I c c) f.rOut ∩ (extChartAt I c).target :=
(subset_inter inter_subset_left f.ball_subset).antisymm <| inter_subset_inter_right _ <|
extChartAt_target_subset_range _ _
theorem eqOn_source : EqOn f (f.toContDiffBump ∘ extChartAt I c) (chartAt H c).source :=
eqOn_indicator
#align smooth_bump_function.eq_on_source SmoothBumpFunction.eqOn_source
theorem eventuallyEq_of_mem_source (hx : x ∈ (chartAt H c).source) :
f =ᶠ[𝓝 x] f.toContDiffBump ∘ extChartAt I c :=
f.eqOn_source.eventuallyEq_of_mem <| (chartAt H c).open_source.mem_nhds hx
#align smooth_bump_function.eventually_eq_of_mem_source SmoothBumpFunction.eventuallyEq_of_mem_source
theorem one_of_dist_le (hs : x ∈ (chartAt H c).source)
(hd : dist (extChartAt I c x) (extChartAt I c c) ≤ f.rIn) : f x = 1 := by
simp only [f.eqOn_source hs, (· ∘ ·), f.one_of_mem_closedBall hd]
#align smooth_bump_function.one_of_dist_le SmoothBumpFunction.one_of_dist_le
theorem support_eq_inter_preimage :
support f = (chartAt H c).source ∩ extChartAt I c ⁻¹' ball (extChartAt I c c) f.rOut := by
rw [coe_def, support_indicator, support_comp_eq_preimage, ← extChartAt_source I,
← (extChartAt I c).symm_image_target_inter_eq', ← (extChartAt I c).symm_image_target_inter_eq',
f.support_eq]
#align smooth_bump_function.support_eq_inter_preimage SmoothBumpFunction.support_eq_inter_preimage
theorem isOpen_support : IsOpen (support f) := by
rw [support_eq_inter_preimage]
exact isOpen_extChartAt_preimage I c isOpen_ball
#align smooth_bump_function.is_open_support SmoothBumpFunction.isOpen_support
theorem support_eq_symm_image :
support f = (extChartAt I c).symm '' (ball (extChartAt I c c) f.rOut ∩ range I) := by
rw [f.support_eq_inter_preimage, ← extChartAt_source I,
← (extChartAt I c).symm_image_target_inter_eq', inter_comm,
ball_inter_range_eq_ball_inter_target]
#align smooth_bump_function.support_eq_symm_image SmoothBumpFunction.support_eq_symm_image
theorem support_subset_source : support f ⊆ (chartAt H c).source := by
rw [f.support_eq_inter_preimage, ← extChartAt_source I]; exact inter_subset_left
#align smooth_bump_function.support_subset_source SmoothBumpFunction.support_subset_source
theorem image_eq_inter_preimage_of_subset_support {s : Set M} (hs : s ⊆ support f) :
extChartAt I c '' s =
closedBall (extChartAt I c c) f.rOut ∩ range I ∩ (extChartAt I c).symm ⁻¹' s := by
rw [support_eq_inter_preimage, subset_inter_iff, ← extChartAt_source I, ← image_subset_iff] at hs
cases' hs with hse hsf
apply Subset.antisymm
· refine subset_inter (subset_inter (hsf.trans ball_subset_closedBall) ?_) ?_
· rintro _ ⟨x, -, rfl⟩; exact mem_range_self _
· rw [(extChartAt I c).image_eq_target_inter_inv_preimage hse]
exact inter_subset_right
· refine Subset.trans (inter_subset_inter_left _ f.closedBall_subset) ?_
rw [(extChartAt I c).image_eq_target_inter_inv_preimage hse]
#align smooth_bump_function.image_eq_inter_preimage_of_subset_support SmoothBumpFunction.image_eq_inter_preimage_of_subset_support
theorem mem_Icc : f x ∈ Icc (0 : ℝ) 1 := by
have : f x = 0 ∨ f x = _ := indicator_eq_zero_or_self _ _ _
cases' this with h h <;> rw [h]
exacts [left_mem_Icc.2 zero_le_one, ⟨f.nonneg, f.le_one⟩]
#align smooth_bump_function.mem_Icc SmoothBumpFunction.mem_Icc
theorem nonneg : 0 ≤ f x :=
f.mem_Icc.1
#align smooth_bump_function.nonneg SmoothBumpFunction.nonneg
theorem le_one : f x ≤ 1 :=
f.mem_Icc.2
#align smooth_bump_function.le_one SmoothBumpFunction.le_one
theorem eventuallyEq_one_of_dist_lt (hs : x ∈ (chartAt H c).source)
(hd : dist (extChartAt I c x) (extChartAt I c c) < f.rIn) : f =ᶠ[𝓝 x] 1 := by
filter_upwards [IsOpen.mem_nhds (isOpen_extChartAt_preimage I c isOpen_ball) ⟨hs, hd⟩]
rintro z ⟨hzs, hzd⟩
exact f.one_of_dist_le hzs <| le_of_lt hzd
#align smooth_bump_function.eventually_eq_one_of_dist_lt SmoothBumpFunction.eventuallyEq_one_of_dist_lt
theorem eventuallyEq_one : f =ᶠ[𝓝 c] 1 :=
f.eventuallyEq_one_of_dist_lt (mem_chart_source _ _) <| by rw [dist_self]; exact f.rIn_pos
#align smooth_bump_function.eventually_eq_one SmoothBumpFunction.eventuallyEq_one
@[simp]
theorem eq_one : f c = 1 :=
f.eventuallyEq_one.eq_of_nhds
#align smooth_bump_function.eq_one SmoothBumpFunction.eq_one
theorem support_mem_nhds : support f ∈ 𝓝 c :=
f.eventuallyEq_one.mono fun x hx => by rw [hx]; exact one_ne_zero
#align smooth_bump_function.support_mem_nhds SmoothBumpFunction.support_mem_nhds
theorem tsupport_mem_nhds : tsupport f ∈ 𝓝 c :=
mem_of_superset f.support_mem_nhds subset_closure
#align smooth_bump_function.tsupport_mem_nhds SmoothBumpFunction.tsupport_mem_nhds
theorem c_mem_support : c ∈ support f :=
mem_of_mem_nhds f.support_mem_nhds
#align smooth_bump_function.c_mem_support SmoothBumpFunction.c_mem_support
theorem nonempty_support : (support f).Nonempty :=
⟨c, f.c_mem_support⟩
#align smooth_bump_function.nonempty_support SmoothBumpFunction.nonempty_support
theorem isCompact_symm_image_closedBall :
IsCompact ((extChartAt I c).symm '' (closedBall (extChartAt I c c) f.rOut ∩ range I)) :=
((isCompact_closedBall _ _).inter_right I.isClosed_range).image_of_continuousOn <|
(continuousOn_extChartAt_symm _ _).mono f.closedBall_subset
#align smooth_bump_function.is_compact_symm_image_closed_ball SmoothBumpFunction.isCompact_symm_image_closedBall
theorem nhdsWithin_range_basis :
(𝓝[range I] extChartAt I c c).HasBasis (fun _ : SmoothBumpFunction I c => True) fun f =>
closedBall (extChartAt I c c) f.rOut ∩ range I := by
refine ((nhdsWithin_hasBasis nhds_basis_closedBall _).restrict_subset
(extChartAt_target_mem_nhdsWithin _ _)).to_hasBasis' ?_ ?_
· rintro R ⟨hR0, hsub⟩
exact ⟨⟨⟨R / 2, R, half_pos hR0, half_lt_self hR0⟩, hsub⟩, trivial, Subset.rfl⟩
· exact fun f _ => inter_mem (mem_nhdsWithin_of_mem_nhds <| closedBall_mem_nhds _ f.rOut_pos)
self_mem_nhdsWithin
#align smooth_bump_function.nhds_within_range_basis SmoothBumpFunction.nhdsWithin_range_basis
theorem isClosed_image_of_isClosed {s : Set M} (hsc : IsClosed s) (hs : s ⊆ support f) :
IsClosed (extChartAt I c '' s) := by
rw [f.image_eq_inter_preimage_of_subset_support hs]
refine ContinuousOn.preimage_isClosed_of_isClosed
((continuousOn_extChartAt_symm _ _).mono f.closedBall_subset) ?_ hsc
exact IsClosed.inter isClosed_ball I.isClosed_range
#align smooth_bump_function.is_closed_image_of_is_closed SmoothBumpFunction.isClosed_image_of_isClosed
theorem exists_r_pos_lt_subset_ball {s : Set M} (hsc : IsClosed s) (hs : s ⊆ support f) :
∃ r ∈ Ioo 0 f.rOut,
s ⊆ (chartAt H c).source ∩ extChartAt I c ⁻¹' ball (extChartAt I c c) r := by
set e := extChartAt I c
have : IsClosed (e '' s) := f.isClosed_image_of_isClosed hsc hs
rw [support_eq_inter_preimage, subset_inter_iff, ← image_subset_iff] at hs
rcases exists_pos_lt_subset_ball f.rOut_pos this hs.2 with ⟨r, hrR, hr⟩
exact ⟨r, hrR, subset_inter hs.1 (image_subset_iff.1 hr)⟩
#align smooth_bump_function.exists_r_pos_lt_subset_ball SmoothBumpFunction.exists_r_pos_lt_subset_ball
@[simps rOut rIn]
def updateRIn (r : ℝ) (hr : r ∈ Ioo 0 f.rOut) : SmoothBumpFunction I c :=
⟨⟨r, f.rOut, hr.1, hr.2⟩, f.closedBall_subset⟩
#align smooth_bump_function.update_r SmoothBumpFunction.updateRIn
set_option linter.uppercaseLean3 false in
#align smooth_bump_function.update_r_R SmoothBumpFunction.updateRIn_rOut
#align smooth_bump_function.update_r_r SmoothBumpFunction.updateRIn_rIn
@[simp]
theorem support_updateRIn {r : ℝ} (hr : r ∈ Ioo 0 f.rOut) :
support (f.updateRIn r hr) = support f := by
simp only [support_eq_inter_preimage, updateRIn_rOut]
#align smooth_bump_function.support_update_r SmoothBumpFunction.support_updateRIn
-- Porting note: was an `Inhabited` instance
instance : Nonempty (SmoothBumpFunction I c) := nhdsWithin_range_basis.nonempty
variable [T2Space M]
theorem isClosed_symm_image_closedBall :
IsClosed ((extChartAt I c).symm '' (closedBall (extChartAt I c c) f.rOut ∩ range I)) :=
f.isCompact_symm_image_closedBall.isClosed
#align smooth_bump_function.is_closed_symm_image_closed_ball SmoothBumpFunction.isClosed_symm_image_closedBall
theorem tsupport_subset_symm_image_closedBall :
tsupport f ⊆ (extChartAt I c).symm '' (closedBall (extChartAt I c c) f.rOut ∩ range I) := by
rw [tsupport, support_eq_symm_image]
exact closure_minimal (image_subset _ <| inter_subset_inter_left _ ball_subset_closedBall)
f.isClosed_symm_image_closedBall
#align smooth_bump_function.tsupport_subset_symm_image_closed_ball SmoothBumpFunction.tsupport_subset_symm_image_closedBall
theorem tsupport_subset_extChartAt_source : tsupport f ⊆ (extChartAt I c).source :=
calc
tsupport f ⊆ (extChartAt I c).symm '' (closedBall (extChartAt I c c) f.rOut ∩ range I) :=
f.tsupport_subset_symm_image_closedBall
_ ⊆ (extChartAt I c).symm '' (extChartAt I c).target := image_subset _ f.closedBall_subset
_ = (extChartAt I c).source := (extChartAt I c).symm_image_target_eq_source
#align smooth_bump_function.tsupport_subset_ext_chart_at_source SmoothBumpFunction.tsupport_subset_extChartAt_source
theorem tsupport_subset_chartAt_source : tsupport f ⊆ (chartAt H c).source := by
simpa only [extChartAt_source] using f.tsupport_subset_extChartAt_source
#align smooth_bump_function.tsupport_subset_chart_at_source SmoothBumpFunction.tsupport_subset_chartAt_source
protected theorem hasCompactSupport : HasCompactSupport f :=
f.isCompact_symm_image_closedBall.of_isClosed_subset isClosed_closure
f.tsupport_subset_symm_image_closedBall
#align smooth_bump_function.has_compact_support SmoothBumpFunction.hasCompactSupport
variable (I c)
| Mathlib/Geometry/Manifold/BumpFunction.lean | 290 | 298 | theorem nhds_basis_tsupport :
(𝓝 c).HasBasis (fun _ : SmoothBumpFunction I c => True) fun f => tsupport f := by |
have :
(𝓝 c).HasBasis (fun _ : SmoothBumpFunction I c => True) fun f =>
(extChartAt I c).symm '' (closedBall (extChartAt I c c) f.rOut ∩ range I) := by
rw [← map_extChartAt_symm_nhdsWithin_range I c]
exact nhdsWithin_range_basis.map _
exact this.to_hasBasis' (fun f _ => ⟨f, trivial, f.tsupport_subset_symm_image_closedBall⟩)
fun f _ => f.tsupport_mem_nhds
|
import Aesop
import Mathlib.Algebra.Group.Defs
import Mathlib.Data.Nat.Defs
import Mathlib.Data.Int.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Cases
import Mathlib.Tactic.SimpRw
import Mathlib.Tactic.SplitIfs
#align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
variable {α β G M : Type*}
section Semigroup
variable [Semigroup α]
@[to_additive]
instance Semigroup.to_isAssociative : Std.Associative (α := α) (· * ·) := ⟨mul_assoc⟩
#align semigroup.to_is_associative Semigroup.to_isAssociative
#align add_semigroup.to_is_associative AddSemigroup.to_isAssociative
@[to_additive (attr := simp) "Composing two additions on the left by `y` then `x`
is equal to an addition on the left by `x + y`."]
| Mathlib/Algebra/Group/Basic.lean | 117 | 119 | theorem comp_mul_left (x y : α) : (x * ·) ∘ (y * ·) = (x * y * ·) := by |
ext z
simp [mul_assoc]
|
import Mathlib.Data.Set.Function
import Mathlib.Logic.Equiv.Defs
import Mathlib.Tactic.Core
import Mathlib.Tactic.Attr.Core
#align_import logic.equiv.local_equiv from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
open Lean Meta Elab Tactic
def mfld_cfg : Simps.Config where
attrs := [`mfld_simps]
fullyApplied := false
#align mfld_cfg mfld_cfg
open Function Set
variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
structure PartialEquiv (α : Type*) (β : Type*) where
toFun : α → β
invFun : β → α
source : Set α
target : Set β
map_source' : ∀ ⦃x⦄, x ∈ source → toFun x ∈ target
map_target' : ∀ ⦃x⦄, x ∈ target → invFun x ∈ source
left_inv' : ∀ ⦃x⦄, x ∈ source → invFun (toFun x) = x
right_inv' : ∀ ⦃x⦄, x ∈ target → toFun (invFun x) = x
#align local_equiv PartialEquiv
attribute [coe] PartialEquiv.toFun
namespace PartialEquiv
variable (e : PartialEquiv α β) (e' : PartialEquiv β γ)
instance [Inhabited α] [Inhabited β] : Inhabited (PartialEquiv α β) :=
⟨⟨const α default, const β default, ∅, ∅, mapsTo_empty _ _, mapsTo_empty _ _, eqOn_empty _ _,
eqOn_empty _ _⟩⟩
@[symm]
protected def symm : PartialEquiv β α where
toFun := e.invFun
invFun := e.toFun
source := e.target
target := e.source
map_source' := e.map_target'
map_target' := e.map_source'
left_inv' := e.right_inv'
right_inv' := e.left_inv'
#align local_equiv.symm PartialEquiv.symm
instance : CoeFun (PartialEquiv α β) fun _ => α → β :=
⟨PartialEquiv.toFun⟩
def Simps.symm_apply (e : PartialEquiv α β) : β → α :=
e.symm
#align local_equiv.simps.symm_apply PartialEquiv.Simps.symm_apply
initialize_simps_projections PartialEquiv (toFun → apply, invFun → symm_apply)
-- Porting note: this can be proven with `dsimp only`
-- @[simp, mfld_simps]
-- theorem coe_mk (f : α → β) (g s t ml mr il ir) :
-- (PartialEquiv.mk f g s t ml mr il ir : α → β) = f := by dsimp only
-- #align local_equiv.coe_mk PartialEquiv.coe_mk
#noalign local_equiv.coe_mk
@[simp, mfld_simps]
theorem coe_symm_mk (f : α → β) (g s t ml mr il ir) :
((PartialEquiv.mk f g s t ml mr il ir).symm : β → α) = g :=
rfl
#align local_equiv.coe_symm_mk PartialEquiv.coe_symm_mk
-- Porting note: this is now a syntactic tautology
-- @[simp, mfld_simps]
-- theorem toFun_as_coe : e.toFun = e := rfl
-- #align local_equiv.to_fun_as_coe PartialEquiv.toFun_as_coe
#noalign local_equiv.to_fun_as_coe
@[simp, mfld_simps]
theorem invFun_as_coe : e.invFun = e.symm :=
rfl
#align local_equiv.inv_fun_as_coe PartialEquiv.invFun_as_coe
@[simp, mfld_simps]
theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target :=
e.map_source' h
#align local_equiv.map_source PartialEquiv.map_source
lemma map_source'' : e '' e.source ⊆ e.target :=
fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx)
@[simp, mfld_simps]
theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source :=
e.map_target' h
#align local_equiv.map_target PartialEquiv.map_target
@[simp, mfld_simps]
theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x :=
e.left_inv' h
#align local_equiv.left_inv PartialEquiv.left_inv
@[simp, mfld_simps]
theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x :=
e.right_inv' h
#align local_equiv.right_inv PartialEquiv.right_inv
theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) :
x = e.symm y ↔ e x = y :=
⟨fun h => by rw [← e.right_inv hy, h], fun h => by rw [← e.left_inv hx, h]⟩
#align local_equiv.eq_symm_apply PartialEquiv.eq_symm_apply
protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source
#align local_equiv.maps_to PartialEquiv.mapsTo
theorem symm_mapsTo : MapsTo e.symm e.target e.source :=
e.symm.mapsTo
#align local_equiv.symm_maps_to PartialEquiv.symm_mapsTo
protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv
#align local_equiv.left_inv_on PartialEquiv.leftInvOn
protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv
#align local_equiv.right_inv_on PartialEquiv.rightInvOn
protected theorem invOn : InvOn e.symm e e.source e.target :=
⟨e.leftInvOn, e.rightInvOn⟩
#align local_equiv.inv_on PartialEquiv.invOn
protected theorem injOn : InjOn e e.source :=
e.leftInvOn.injOn
#align local_equiv.inj_on PartialEquiv.injOn
protected theorem bijOn : BijOn e e.source e.target :=
e.invOn.bijOn e.mapsTo e.symm_mapsTo
#align local_equiv.bij_on PartialEquiv.bijOn
protected theorem surjOn : SurjOn e e.source e.target :=
e.bijOn.surjOn
#align local_equiv.surj_on PartialEquiv.surjOn
@[simps (config := .asFn)]
def _root_.Equiv.toPartialEquivOfImageEq (e : α ≃ β) (s : Set α) (t : Set β) (h : e '' s = t) :
PartialEquiv α β where
toFun := e
invFun := e.symm
source := s
target := t
map_source' x hx := h ▸ mem_image_of_mem _ hx
map_target' x hx := by
subst t
rcases hx with ⟨x, hx, rfl⟩
rwa [e.symm_apply_apply]
left_inv' x _ := e.symm_apply_apply x
right_inv' x _ := e.apply_symm_apply x
@[simps! (config := mfld_cfg)]
def _root_.Equiv.toPartialEquiv (e : α ≃ β) : PartialEquiv α β :=
e.toPartialEquivOfImageEq univ univ <| by rw [image_univ, e.surjective.range_eq]
#align equiv.to_local_equiv Equiv.toPartialEquiv
#align equiv.to_local_equiv_symm_apply Equiv.toPartialEquiv_symm_apply
#align equiv.to_local_equiv_target Equiv.toPartialEquiv_target
#align equiv.to_local_equiv_apply Equiv.toPartialEquiv_apply
#align equiv.to_local_equiv_source Equiv.toPartialEquiv_source
instance inhabitedOfEmpty [IsEmpty α] [IsEmpty β] : Inhabited (PartialEquiv α β) :=
⟨((Equiv.equivEmpty α).trans (Equiv.equivEmpty β).symm).toPartialEquiv⟩
#align local_equiv.inhabited_of_empty PartialEquiv.inhabitedOfEmpty
@[simps (config := .asFn)]
def copy (e : PartialEquiv α β) (f : α → β) (hf : ⇑e = f) (g : β → α) (hg : ⇑e.symm = g) (s : Set α)
(hs : e.source = s) (t : Set β) (ht : e.target = t) :
PartialEquiv α β where
toFun := f
invFun := g
source := s
target := t
map_source' _ := ht ▸ hs ▸ hf ▸ e.map_source
map_target' _ := hs ▸ ht ▸ hg ▸ e.map_target
left_inv' _ := hs ▸ hf ▸ hg ▸ e.left_inv
right_inv' _ := ht ▸ hf ▸ hg ▸ e.right_inv
#align local_equiv.copy PartialEquiv.copy
#align local_equiv.copy_source PartialEquiv.copy_source
#align local_equiv.copy_apply PartialEquiv.copy_apply
#align local_equiv.copy_symm_apply PartialEquiv.copy_symm_apply
#align local_equiv.copy_target PartialEquiv.copy_target
theorem copy_eq (e : PartialEquiv α β) (f : α → β) (hf : ⇑e = f) (g : β → α) (hg : ⇑e.symm = g)
(s : Set α) (hs : e.source = s) (t : Set β) (ht : e.target = t) :
e.copy f hf g hg s hs t ht = e := by
substs f g s t
cases e
rfl
#align local_equiv.copy_eq PartialEquiv.copy_eq
protected def toEquiv : e.source ≃ e.target where
toFun x := ⟨e x, e.map_source x.mem⟩
invFun y := ⟨e.symm y, e.map_target y.mem⟩
left_inv := fun ⟨_, hx⟩ => Subtype.eq <| e.left_inv hx
right_inv := fun ⟨_, hy⟩ => Subtype.eq <| e.right_inv hy
#align local_equiv.to_equiv PartialEquiv.toEquiv
@[simp, mfld_simps]
theorem symm_source : e.symm.source = e.target :=
rfl
#align local_equiv.symm_source PartialEquiv.symm_source
@[simp, mfld_simps]
theorem symm_target : e.symm.target = e.source :=
rfl
#align local_equiv.symm_target PartialEquiv.symm_target
@[simp, mfld_simps]
theorem symm_symm : e.symm.symm = e := by
cases e
rfl
#align local_equiv.symm_symm PartialEquiv.symm_symm
theorem symm_bijective :
Function.Bijective (PartialEquiv.symm : PartialEquiv α β → PartialEquiv β α) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
theorem image_source_eq_target : e '' e.source = e.target :=
e.bijOn.image_eq
#align local_equiv.image_source_eq_target PartialEquiv.image_source_eq_target
theorem forall_mem_target {p : β → Prop} : (∀ y ∈ e.target, p y) ↔ ∀ x ∈ e.source, p (e x) := by
rw [← image_source_eq_target, forall_mem_image]
#align local_equiv.forall_mem_target PartialEquiv.forall_mem_target
theorem exists_mem_target {p : β → Prop} : (∃ y ∈ e.target, p y) ↔ ∃ x ∈ e.source, p (e x) := by
rw [← image_source_eq_target, exists_mem_image]
#align local_equiv.exists_mem_target PartialEquiv.exists_mem_target
def IsImage (s : Set α) (t : Set β) : Prop :=
∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s)
#align local_equiv.is_image PartialEquiv.IsImage
theorem isImage_source_target : e.IsImage e.source e.target := fun x hx => by simp [hx]
#align local_equiv.is_image_source_target PartialEquiv.isImage_source_target
theorem isImage_source_target_of_disjoint (e' : PartialEquiv α β) (hs : Disjoint e.source e'.source)
(ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target :=
IsImage.of_image_eq <| by rw [hs.inter_eq, ht.inter_eq, image_empty]
#align local_equiv.is_image_source_target_of_disjoint PartialEquiv.isImage_source_target_of_disjoint
theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := by
rw [inter_comm, e.leftInvOn.image_inter', image_source_eq_target, inter_comm]
#align local_equiv.image_source_inter_eq' PartialEquiv.image_source_inter_eq'
theorem image_source_inter_eq (s : Set α) :
e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := by
rw [inter_comm, e.leftInvOn.image_inter, image_source_eq_target, inter_comm]
#align local_equiv.image_source_inter_eq PartialEquiv.image_source_inter_eq
theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) :
e '' s = e.target ∩ e.symm ⁻¹' s := by
rw [← e.image_source_inter_eq', inter_eq_self_of_subset_right h]
#align local_equiv.image_eq_target_inter_inv_preimage PartialEquiv.image_eq_target_inter_inv_preimage
theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) :
e.symm '' s = e.source ∩ e ⁻¹' s :=
e.symm.image_eq_target_inter_inv_preimage h
#align local_equiv.symm_image_eq_source_inter_preimage PartialEquiv.symm_image_eq_source_inter_preimage
theorem symm_image_target_inter_eq (s : Set β) :
e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) :=
e.symm.image_source_inter_eq _
#align local_equiv.symm_image_target_inter_eq PartialEquiv.symm_image_target_inter_eq
theorem symm_image_target_inter_eq' (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' s :=
e.symm.image_source_inter_eq' _
#align local_equiv.symm_image_target_inter_eq' PartialEquiv.symm_image_target_inter_eq'
theorem source_inter_preimage_inv_preimage (s : Set α) :
e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s :=
Set.ext fun x => and_congr_right_iff.2 fun hx =>
by simp only [mem_preimage, e.left_inv hx]
#align local_equiv.source_inter_preimage_inv_preimage PartialEquiv.source_inter_preimage_inv_preimage
theorem source_inter_preimage_target_inter (s : Set β) :
e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s :=
ext fun _ => ⟨fun hx => ⟨hx.1, hx.2.2⟩, fun hx => ⟨hx.1, e.map_source hx.1, hx.2⟩⟩
#align local_equiv.source_inter_preimage_target_inter PartialEquiv.source_inter_preimage_target_inter
theorem target_inter_inv_preimage_preimage (s : Set β) :
e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s :=
e.symm.source_inter_preimage_inv_preimage _
#align local_equiv.target_inter_inv_preimage_preimage PartialEquiv.target_inter_inv_preimage_preimage
theorem symm_image_image_of_subset_source {s : Set α} (h : s ⊆ e.source) : e.symm '' (e '' s) = s :=
(e.leftInvOn.mono h).image_image
#align local_equiv.symm_image_image_of_subset_source PartialEquiv.symm_image_image_of_subset_source
theorem image_symm_image_of_subset_target {s : Set β} (h : s ⊆ e.target) : e '' (e.symm '' s) = s :=
e.symm.symm_image_image_of_subset_source h
#align local_equiv.image_symm_image_of_subset_target PartialEquiv.image_symm_image_of_subset_target
theorem source_subset_preimage_target : e.source ⊆ e ⁻¹' e.target :=
e.mapsTo
#align local_equiv.source_subset_preimage_target PartialEquiv.source_subset_preimage_target
theorem symm_image_target_eq_source : e.symm '' e.target = e.source :=
e.symm.image_source_eq_target
#align local_equiv.symm_image_target_eq_source PartialEquiv.symm_image_target_eq_source
theorem target_subset_preimage_source : e.target ⊆ e.symm ⁻¹' e.source :=
e.symm_mapsTo
#align local_equiv.target_subset_preimage_source PartialEquiv.target_subset_preimage_source
@[ext]
protected theorem ext {e e' : PartialEquiv α β} (h : ∀ x, e x = e' x)
(hsymm : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := by
have A : (e : α → β) = e' := by
ext x
exact h x
have B : (e.symm : β → α) = e'.symm := by
ext x
exact hsymm x
have I : e '' e.source = e.target := e.image_source_eq_target
have I' : e' '' e'.source = e'.target := e'.image_source_eq_target
rw [A, hs, I'] at I
cases e; cases e'
simp_all
#align local_equiv.ext PartialEquiv.ext
protected def restr (s : Set α) : PartialEquiv α β :=
(@IsImage.of_symm_preimage_eq α β e s (e.symm ⁻¹' s) rfl).restr
#align local_equiv.restr PartialEquiv.restr
@[simp, mfld_simps]
theorem restr_coe (s : Set α) : (e.restr s : α → β) = e :=
rfl
#align local_equiv.restr_coe PartialEquiv.restr_coe
@[simp, mfld_simps]
theorem restr_coe_symm (s : Set α) : ((e.restr s).symm : β → α) = e.symm :=
rfl
#align local_equiv.restr_coe_symm PartialEquiv.restr_coe_symm
@[simp, mfld_simps]
theorem restr_source (s : Set α) : (e.restr s).source = e.source ∩ s :=
rfl
#align local_equiv.restr_source PartialEquiv.restr_source
@[simp, mfld_simps]
theorem restr_target (s : Set α) : (e.restr s).target = e.target ∩ e.symm ⁻¹' s :=
rfl
#align local_equiv.restr_target PartialEquiv.restr_target
theorem restr_eq_of_source_subset {e : PartialEquiv α β} {s : Set α} (h : e.source ⊆ s) :
e.restr s = e :=
PartialEquiv.ext (fun _ => rfl) (fun _ => rfl) (by simp [inter_eq_self_of_subset_left h])
#align local_equiv.restr_eq_of_source_subset PartialEquiv.restr_eq_of_source_subset
@[simp, mfld_simps]
theorem restr_univ {e : PartialEquiv α β} : e.restr univ = e :=
restr_eq_of_source_subset (subset_univ _)
#align local_equiv.restr_univ PartialEquiv.restr_univ
protected def refl (α : Type*) : PartialEquiv α α :=
(Equiv.refl α).toPartialEquiv
#align local_equiv.refl PartialEquiv.refl
@[simp, mfld_simps]
theorem refl_source : (PartialEquiv.refl α).source = univ :=
rfl
#align local_equiv.refl_source PartialEquiv.refl_source
@[simp, mfld_simps]
theorem refl_target : (PartialEquiv.refl α).target = univ :=
rfl
#align local_equiv.refl_target PartialEquiv.refl_target
@[simp, mfld_simps]
theorem refl_coe : (PartialEquiv.refl α : α → α) = id :=
rfl
#align local_equiv.refl_coe PartialEquiv.refl_coe
@[simp, mfld_simps]
theorem refl_symm : (PartialEquiv.refl α).symm = PartialEquiv.refl α :=
rfl
#align local_equiv.refl_symm PartialEquiv.refl_symm
-- Porting note: removed `simp` because `simp` can prove this
@[mfld_simps]
theorem refl_restr_source (s : Set α) : ((PartialEquiv.refl α).restr s).source = s := by simp
#align local_equiv.refl_restr_source PartialEquiv.refl_restr_source
-- Porting note: removed `simp` because `simp` can prove this
@[mfld_simps]
| Mathlib/Logic/Equiv/PartialEquiv.lean | 639 | 641 | theorem refl_restr_target (s : Set α) : ((PartialEquiv.refl α).restr s).target = s := by |
change univ ∩ id ⁻¹' s = s
simp
|
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Defs
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
variable {α : Type*}
open Opposite
namespace Set
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by
ext
constructor
· apply unop_injective
· apply op_injective
#align set.singleton_op Set.singleton_op
@[simp]
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_unop Set.singleton_unop
@[simp 1100]
theorem singleton_op_unop (x : α) : ({op x} : Set αᵒᵖ).unop = {x} := by
ext
constructor
· apply op_injective
· apply unop_injective
#align set.singleton_op_unop Set.singleton_op_unop
@[simp 1100]
| Mathlib/Data/Set/Opposite.lean | 100 | 104 | theorem singleton_unop_op (x : αᵒᵖ) : ({unop x} : Set α).op = {x} := by |
ext
constructor
· apply unop_injective
· apply op_injective
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6