Skip to content

Commit

Permalink
fix: generalize index types of iSup to Sort (#12114)
Browse files Browse the repository at this point in the history
This breaks a few `simp` proofs which were expecting these lemmas to apply to the data binders but not the prop binders.
  • Loading branch information
eric-wieser committed Apr 23, 2024
1 parent de6ffbc commit 16e2255
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Lie/Submodule.lean
Expand Up @@ -547,7 +547,7 @@ theorem independent_iff_coe_toSubmodule {ι : Type*} {N : ι → LieSubmodule R
CompleteLattice.Independent N ↔ CompleteLattice.Independent fun i ↦ (N i : Submodule R M) := by
simp [CompleteLattice.independent_def, disjoint_iff_coe_toSubmodule]

theorem iSup_eq_top_iff_coe_toSubmodule {ι : Type*} {N : ι → LieSubmodule R L M} :
theorem iSup_eq_top_iff_coe_toSubmodule {ι : Sort*} {N : ι → LieSubmodule R L M} :
⨆ i, N i = ⊤ ↔ ⨆ i, (N i : Submodule R M) = ⊤ := by
rw [← iSup_coe_toSubmodule, ← top_coeSubmodule (L := L), coe_toSubmodule_eq_iff]

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Module/Torsion.lean
Expand Up @@ -112,7 +112,7 @@ theorem CompleteLattice.Independent.linear_independent' {ι R M : Type*} {v : ι
(h_ne_zero : ∀ i, Ideal.torsionOf R M (v i) = ⊥) : LinearIndependent R v := by
refine' linearIndependent_iff_not_smul_mem_span.mpr fun i r hi => _
replace hv := CompleteLattice.independent_def.mp hv i
simp only [iSup_subtype', ← Submodule.span_range_eq_iSup, disjoint_iff] at hv
simp only [iSup_subtype', ← Submodule.span_range_eq_iSup (ι := Subtype _), disjoint_iff] at hv
have : r • v i ∈ ⊥ := by
rw [← hv, Submodule.mem_inf]
refine' ⟨Submodule.mem_span_singleton.mpr ⟨r, rfl⟩, _⟩
Expand Down
3 changes: 2 additions & 1 deletion Mathlib/Analysis/LocallyConvex/Barrelled.lean
Expand Up @@ -90,7 +90,8 @@ theorem Seminorm.continuous_of_lowerSemicontinuous {𝕜 E : Type*} [AddGroup E]
(hp : LowerSemicontinuous p) : Continuous p :=
BarrelledSpace.continuous_of_lowerSemicontinuous p hp

theorem Seminorm.continuous_iSup {ι 𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
theorem Seminorm.continuous_iSup
{ι : Sort*} {𝕜 E : Type*} [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
[TopologicalSpace E] [BarrelledSpace 𝕜 E] (p : ι → Seminorm 𝕜 E)
(hp : ∀ i, Continuous (p i)) (bdd : BddAbove (range p)) :
Continuous (⨆ i, p i) := by
Expand Down
12 changes: 6 additions & 6 deletions Mathlib/Analysis/Seminorm.lean
Expand Up @@ -591,7 +591,7 @@ protected theorem bddAbove_iff {s : Set <| Seminorm 𝕜 E} :
le_ciSup ⟨q x, forall_mem_range.mpr fun i : s => hq (mem_image_of_mem _ i.2) x⟩ ⟨p, hp⟩⟩⟩
#align seminorm.bdd_above_iff Seminorm.bddAbove_iff

protected theorem bddAbove_range_iff {p : ι → Seminorm 𝕜 E} :
protected theorem bddAbove_range_iff {ι : Sort*} {p : ι → Seminorm 𝕜 E} :
BddAbove (range p) ↔ ∀ x, BddAbove (range fun i ↦ p i x) := by
rw [Seminorm.bddAbove_iff, ← range_comp, bddAbove_range_pi]; rfl

Expand All @@ -600,7 +600,7 @@ protected theorem coe_sSup_eq {s : Set <| Seminorm 𝕜 E} (hs : BddAbove s) :
Seminorm.coe_sSup_eq' (Seminorm.bddAbove_iff.mp hs)
#align seminorm.coe_Sup_eq Seminorm.coe_sSup_eq

protected theorem coe_iSup_eq {ι : Type*} {p : ι → Seminorm 𝕜 E} (hp : BddAbove (range p)) :
protected theorem coe_iSup_eq {ι : Sort*} {p : ι → Seminorm 𝕜 E} (hp : BddAbove (range p)) :
↑(⨆ i, p i) = ⨆ i, ((p i : Seminorm 𝕜 E) : E → ℝ) := by
rw [← sSup_range, Seminorm.coe_sSup_eq hp]
exact iSup_range' (fun p : Seminorm 𝕜 E => (p : E → ℝ)) p
Expand All @@ -610,7 +610,7 @@ protected theorem sSup_apply {s : Set (Seminorm 𝕜 E)} (hp : BddAbove s) {x :
(sSup s) x = ⨆ p : s, (p : E → ℝ) x := by
rw [Seminorm.coe_sSup_eq hp, iSup_apply]

protected theorem iSup_apply {ι : Type*} {p : ι → Seminorm 𝕜 E}
protected theorem iSup_apply {ι : Sort*} {p : ι → Seminorm 𝕜 E}
(hp : BddAbove (range p)) {x : E} : (⨆ i, p i) x = ⨆ i, p i x := by
rw [Seminorm.coe_iSup_eq hp, iSup_apply]

Expand Down Expand Up @@ -972,8 +972,8 @@ section NormedField
variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] (p : Seminorm 𝕜 E) {A B : Set E} {a : 𝕜}
{r : ℝ} {x : E}

theorem closedBall_iSup {p : ι → Seminorm 𝕜 E} (hp : BddAbove (range p)) (e : E) {r : ℝ}
(hr : 0 < r) : closedBall (⨆ i, p i) e r = ⋂ i, closedBall (p i) e r := by
theorem closedBall_iSup {ι : Sort*} {p : ι → Seminorm 𝕜 E} (hp : BddAbove (range p)) (e : E)
{r : ℝ} (hr : 0 < r) : closedBall (⨆ i, p i) e r = ⋂ i, closedBall (p i) e r := by
cases isEmpty_or_nonempty ι
· rw [iSup_of_empty', iInter_of_empty, Seminorm.sSup_empty]
exact closedBall_bot _ hr
Expand Down Expand Up @@ -1373,7 +1373,7 @@ variable [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
/-- Let `p i` be a family of seminorms on `E`. Let `s` be an absorbent set in `𝕜`.
If all seminorms are uniformly bounded at every point of `s`,
then they are bounded in the space of seminorms. -/
lemma bddAbove_of_absorbent {p : ι → Seminorm 𝕜 E} {s : Set E} (hs : Absorbent 𝕜 s)
lemma bddAbove_of_absorbent {ι : Sort*} {p : ι → Seminorm 𝕜 E} {s : Set E} (hs : Absorbent 𝕜 s)
(h : ∀ x ∈ s, BddAbove (range (p · x))) : BddAbove (range p) := by
rw [Seminorm.bddAbove_range_iff]
intro x
Expand Down
1 change: 1 addition & 0 deletions Mathlib/FieldTheory/Adjoin.lean
Expand Up @@ -1219,6 +1219,7 @@ theorem _root_.minpoly.degree_le (x : L) [FiniteDimensional K L] :
degree_le_of_natDegree_le (minpoly.natDegree_le x)
#align minpoly.degree_le minpoly.degree_le

-- TODO: generalize to `Sort`
/-- A compositum of algebraic extensions is algebraic -/
theorem isAlgebraic_iSup {ι : Type*} {t : ι → IntermediateField K L}
(h : ∀ i, Algebra.IsAlgebraic K (t i)) :
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/FieldTheory/PurelyInseparable.lean
Expand Up @@ -647,7 +647,7 @@ instance isPurelyInseparable_sup (L1 L2 : IntermediateField F E)
exact sup_le h1 h2

/-- A compositum of purely inseparable extensions is purely inseparable. -/
instance isPurelyInseparable_iSup {ι : Type*} {t : ι → IntermediateField F E}
instance isPurelyInseparable_iSup {ι : Sort*} {t : ι → IntermediateField F E}
[h : ∀ i, IsPurelyInseparable F (t i)] :
IsPurelyInseparable F (⨆ i, t i : IntermediateField F E) := by
simp_rw [← le_perfectClosure_iff] at h ⊢
Expand Down
7 changes: 4 additions & 3 deletions Mathlib/LinearAlgebra/Dual.lean
Expand Up @@ -1012,12 +1012,12 @@ theorem dualCoannihilator_sup_eq (U V : Submodule R (Module.Dual R M)) :
(dualAnnihilator_gc R M).u_inf
#align submodule.dual_coannihilator_sup_eq Submodule.dualCoannihilator_sup_eq

theorem dualAnnihilator_iSup_eq {ι : Type*} (U : ι → Submodule R M) :
theorem dualAnnihilator_iSup_eq {ι : Sort*} (U : ι → Submodule R M) :
(⨆ i : ι, U i).dualAnnihilator = ⨅ i : ι, (U i).dualAnnihilator :=
(dualAnnihilator_gc R M).l_iSup
#align submodule.dual_annihilator_supr_eq Submodule.dualAnnihilator_iSup_eq

theorem dualCoannihilator_iSup_eq {ι : Type*} (U : ι → Submodule R (Module.Dual R M)) :
theorem dualCoannihilator_iSup_eq {ι : Sort*} (U : ι → Submodule R (Module.Dual R M)) :
(⨆ i : ι, U i).dualCoannihilator = ⨅ i : ι, (U i).dualCoannihilator :=
(dualAnnihilator_gc R M).u_iInf
#align submodule.dual_coannihilator_supr_eq Submodule.dualCoannihilator_iSup_eq
Expand All @@ -1030,7 +1030,7 @@ theorem sup_dualAnnihilator_le_inf (U V : Submodule R M) :
#align submodule.sup_dual_annihilator_le_inf Submodule.sup_dualAnnihilator_le_inf

/-- See also `Subspace.dualAnnihilator_iInf_eq` for vector subspaces when `ι` is finite. -/
theorem iSup_dualAnnihilator_le_iInf {ι : Type*} (U : ι → Submodule R M) :
theorem iSup_dualAnnihilator_le_iInf {ι : Sort*} (U : ι → Submodule R M) :
⨆ i : ι, (U i).dualAnnihilator ≤ (⨅ i : ι, U i).dualAnnihilator := by
rw [le_dualAnnihilator_iff_le_dualCoannihilator, dualCoannihilator_iSup_eq]
apply iInf_mono
Expand Down Expand Up @@ -1571,6 +1571,7 @@ theorem dualAnnihilator_inf_eq (W W' : Subspace K V₁) :
-- for `Module.Dual R (Π (i : ι), V ⧸ W i) ≃ₗ[K] Π (i : ι), Module.Dual R (V ⧸ W i)`, which is not
-- true for infinite `ι`. One would need to add additional hypothesis on `W` (for example, it might
-- be true when the family is inf-closed).
-- TODO: generalize to `Sort`
theorem dualAnnihilator_iInf_eq {ι : Type*} [Finite ι] (W : ι → Subspace K V₁) :
(⨅ i : ι, W i).dualAnnihilator = ⨆ i : ι, (W i).dualAnnihilator := by
revert ι
Expand Down
6 changes: 4 additions & 2 deletions Mathlib/LinearAlgebra/LinearIndependent.lean
Expand Up @@ -973,12 +973,14 @@ theorem LinearIndependent.independent_span_singleton (hv : LinearIndependent R v
refine' CompleteLattice.independent_def.mp fun i => _
rw [disjoint_iff_inf_le]
intro m hm
simp only [mem_inf, mem_span_singleton, iSup_subtype', ← span_range_eq_iSup] at hm
simp only [mem_inf, mem_span_singleton, iSup_subtype'] at hm
rw [← span_range_eq_iSup] at hm
obtain ⟨⟨r, rfl⟩, hm⟩ := hm
suffices r = 0 by simp [this]
apply linearIndependent_iff_not_smul_mem_span.mp hv i
-- Porting note: The original proof was using `convert hm`.
suffices v '' (univ \ {i}) = range fun j : { j // j ≠ i } => v j by rwa [this]
suffices v '' (univ \ {i}) = range fun j : { j // j ≠ i } => v j by
rwa [this]
ext
simp
#align linear_independent.independent_span_singleton LinearIndependent.independent_span_singleton
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/LinearAlgebra/Span.lean
Expand Up @@ -335,7 +335,7 @@ theorem span_eq_iSup_of_singleton_spans (s : Set M) : span R s = ⨆ x ∈ s, R
simp only [← span_iUnion, Set.biUnion_of_singleton s]
#align submodule.span_eq_supr_of_singleton_spans Submodule.span_eq_iSup_of_singleton_spans

theorem span_range_eq_iSup {ι : Type*} {v : ι → M} : span R (range v) = ⨆ i, R ∙ v i := by
theorem span_range_eq_iSup {ι : Sort*} {v : ι → M} : span R (range v) = ⨆ i, R ∙ v i := by
rw [span_eq_iSup_of_singleton_spans, iSup_range]
#align submodule.span_range_eq_supr Submodule.span_range_eq_iSup

Expand Down Expand Up @@ -1097,7 +1097,7 @@ theorem ext_on {s : Set M} {f g : F} (hv : span R s = ⊤) (h : Set.EqOn f g s)

/-- If the range of `v : ι → M` generates the whole module and linear maps `f`, `g` are equal at
each `v i`, then they are equal. -/
theorem ext_on_range {ι : Type*} {v : ι → M} {f g : F} (hv : span R (Set.range v) = ⊤)
theorem ext_on_range {ι : Sort*} {v : ι → M} {f g : F} (hv : span R (Set.range v) = ⊤)
(h : ∀ i, f (v i) = g (v i)) : f = g :=
ext_on hv (Set.forall_mem_range.2 h)
#align linear_map.ext_on_range LinearMap.ext_on_range
Expand Down
11 changes: 8 additions & 3 deletions Mathlib/Order/Filter/Basic.lean
Expand Up @@ -1064,10 +1064,15 @@ theorem iInf_principal_finset {ι : Type w} (s : Finset ι) (f : ι → Set α)
· rw [Finset.iInf_insert, Finset.set_biInter_insert, hs, inf_principal]
#align filter.infi_principal_finset Filter.iInf_principal_finset

theorem iInf_principal {ι : Sort w} [Finite ι] (f : ι → Set α) : ⨅ i, 𝓟 (f i) = 𝓟 (⋂ i, f i) := by
cases nonempty_fintype (PLift ι)
rw [← iInf_plift_down, ← iInter_plift_down]
simpa using iInf_principal_finset Finset.univ (f <| PLift.down ·)

/-- A special case of `iInf_principal` that is safe to mark `simp`. -/
@[simp]
theorem iInf_principal {ι : Type w} [Finite ι] (f : ι → Set α) : ⨅ i, 𝓟 (f i) = 𝓟 (⋂ i, f i) := by
cases nonempty_fintype ι
simpa using iInf_principal_finset Finset.univ f
theorem iInf_principal' {ι : Type w} [Finite ι] (f : ι → Set α) : ⨅ i, 𝓟 (f i) = 𝓟 (⋂ i, f i) :=
iInf_principal _
#align filter.infi_principal Filter.iInf_principal

theorem iInf_principal_finite {ι : Type w} {s : Set ι} (hs : s.Finite) (f : ι → Set α) :
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/RingTheory/Finiteness.lean
Expand Up @@ -193,10 +193,10 @@ theorem fg_biSup {ι : Type*} (s : Finset ι) (N : ι → Submodule R M) (h :
(⨆ i ∈ s, N i).FG := by simpa only [Finset.sup_eq_iSup] using fg_finset_sup s N h
#align submodule.fg_bsupr Submodule.fg_biSup

theorem fg_iSup {ι : Type*} [Finite ι] (N : ι → Submodule R M) (h : ∀ i, (N i).FG) :
theorem fg_iSup {ι : Sort*} [Finite ι] (N : ι → Submodule R M) (h : ∀ i, (N i).FG) :
(iSup N).FG := by
cases nonempty_fintype ι
simpa using fg_biSup Finset.univ N fun i _ => h i
cases nonempty_fintype (PLift ι)
simpa [iSup_plift_down] using fg_biSup Finset.univ (N ∘ PLift.down) fun i _ => h i.down
#align submodule.fg_supr Submodule.fg_iSup

variable {P : Type*} [AddCommMonoid P] [Module R P]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Topology/Order.lean
Expand Up @@ -894,7 +894,7 @@ theorem nhds_true : 𝓝 True = pure True :=

@[simp]
theorem nhds_false : 𝓝 False = ⊤ :=
TopologicalSpace.nhds_generateFrom.trans <| by simp [@and_comm (_ ∈ _)]
TopologicalSpace.nhds_generateFrom.trans <| by simp [@and_comm (_ ∈ _), iInter_and]
#align nhds_false nhds_false

theorem tendsto_nhds_true {l : Filter α} {p : α → Prop} :
Expand Down

0 comments on commit 16e2255

Please sign in to comment.