Skip to content

Commit 0c1435b

Browse files
committed
Constructible set API
1 parent 48823fb commit 0c1435b

File tree

8 files changed

+417
-95
lines changed

8 files changed

+417
-95
lines changed

LeanCamCombi.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@ import LeanCamCombi.Mathlib.Data.Finset.PosDiffs
4242
import LeanCamCombi.Mathlib.Data.List.DropRight
4343
import LeanCamCombi.Mathlib.Data.Multiset.Basic
4444
import LeanCamCombi.Mathlib.Data.Prod.Lex
45+
import LeanCamCombi.Mathlib.Data.Set.Image
4546
import LeanCamCombi.Mathlib.Data.Set.Pointwise.Finite
4647
import LeanCamCombi.Mathlib.Data.Set.Pointwise.SMul
4748
import LeanCamCombi.Mathlib.GroupTheory.OrderOfElement
4849
import LeanCamCombi.Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
4950
import LeanCamCombi.Mathlib.Order.Interval.Finset.Defs
5051
import LeanCamCombi.Mathlib.Order.Partition.Finpartition
52+
import LeanCamCombi.Mathlib.Order.SupClosed
5153
import LeanCamCombi.Mathlib.Probability.ProbabilityMassFunction.Constructions
5254
import LeanCamCombi.Mathlib.RingTheory.Ideal.Span
55+
import LeanCamCombi.Mathlib.Topology.Defs.Induced
56+
import LeanCamCombi.Mathlib.Topology.Spectral.Hom
5357
import LeanCamCombi.MetricBetween
5458
import LeanCamCombi.MinkowskiCaratheodory
5559
import LeanCamCombi.OrderShatter

LeanCamCombi/GrowthInGroups/BooleanSubalgebra.lean

Lines changed: 82 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yaël Dillies
55
-/
66
import Mathlib.Order.Sublattice
7+
import LeanCamCombi.Mathlib.Order.SupClosed
78

89
/-!
910
# Boolean subalgebras
@@ -13,16 +14,19 @@ This file defines boolean subalgebras.
1314

1415
open Function Set
1516

16-
variable {ι : Sort*} {α β γ : Type*} [BooleanAlgebra α] [BooleanAlgebra β] [BooleanAlgebra γ]
17+
variable {ι : Sort*} {α β γ : Type*}
1718

1819
variable (α) in
19-
/-- A boolean subalgebra of a boolean algebra is a set containing the suprema, infima of any of its elements. -/
20-
structure BooleanSubalgebra extends Sublattice α where
20+
/-- A boolean subalgebra of a boolean algebra is a set containing the bottom and top elements, and
21+
closed under suprema, infima and complements. -/
22+
structure BooleanSubalgebra [BooleanAlgebra α] extends Sublattice α where
2123
compl_mem' {a} : a ∈ carrier → aᶜ ∈ carrier
2224
bot_mem' : ⊥ ∈ carrier
2325

2426
namespace BooleanSubalgebra
25-
variable {L M : BooleanSubalgebra α} {f : BoundedLatticeHom α β} {s t : Set α} {a b : α}
27+
section BooleanAlgebra
28+
variable [BooleanAlgebra α] [BooleanAlgebra β] [BooleanAlgebra γ] {L M : BooleanSubalgebra α}
29+
{f : BoundedLatticeHom α β} {s t : Set α} {a b : α}
2630

2731
initialize_simps_projections BooleanSubalgebra (carrier → coe)
2832

@@ -39,21 +43,23 @@ lemma compl_mem (ha : a ∈ L) : aᶜ ∈ L := L.compl_mem' ha
3943
@[simp] lemma compl_mem_iff : aᶜ ∈ L ↔ a ∈ L := ⟨fun ha ↦ by simpa using compl_mem ha, compl_mem⟩
4044
@[simp] lemma bot_mem : ⊥ ∈ L := L.bot_mem'
4145
@[simp] lemma top_mem : ⊤ ∈ L := by simpa using compl_mem L.bot_mem
46+
lemma sup_mem (ha : a ∈ L) (hb : b ∈ L) : a ⊔ b ∈ L := L.supClosed ha hb
47+
lemma inf_mem (ha : a ∈ L) (hb : b ∈ L) : a ⊓ b ∈ L := L.infClosed ha hb
4248
lemma sdiff_mem (ha : a ∈ L) (hb : b ∈ L) : a \ b ∈ L := by
4349
simpa [sdiff_eq] using L.infClosed ha (compl_mem hb)
4450
lemma himp_mem (ha : a ∈ L) (hb : b ∈ L) : a ⇨ b ∈ L := by
4551
simpa [himp_eq] using L.supClosed hb (compl_mem ha)
4652

47-
@[simp] lemma mem_carrier : a ∈ L.carrier ↔ a ∈ L := Iff.rfl
53+
@[simp] lemma mem_carrier : a ∈ L.carrier ↔ a ∈ L := .rfl
4854
@[simp] lemma mem_mk {L : Sublattice α} (h_compl h_bot) : a ∈ mk L h_compl h_bot ↔ a ∈ L := .rfl
4955
@[simp] lemma coe_mk (L : Sublattice α) (h_compl h_bot) : (mk L h_compl h_bot : Set α) = L := rfl
5056
@[simp] lemma mk_le_mk {L M : Sublattice α} (hL_compl hL_bot hM_compl hM_bot) :
5157
mk L hL_compl hL_bot ≤ mk M hM_compl hM_bot ↔ L ≤ M := .rfl
5258
@[simp] lemma mk_lt_mk{L M : Sublattice α} (hL_compl hL_bot hM_compl hM_bot) :
5359
mk L hL_compl hL_bot < mk M hM_compl hM_bot ↔ L < M := .rfl
5460

55-
/-- Copy of a boolean subalgebra with a new `carrier` equal to the old one. Useful to fix definitional
56-
equalities. -/
61+
/-- Copy of a boolean subalgebra with a new `carrier` equal to the old one. Useful to fix
62+
definitional equalities. -/
5763
protected def copy (L : BooleanSubalgebra α) (s : Set α) (hs : s = L) : BooleanSubalgebra α where
5864
toSublattice := L.toSublattice.copy s <| by subst hs; rfl
5965
compl_mem' := by subst hs; exact L.compl_mem'
@@ -140,7 +146,7 @@ lemma inclusion_apply (h : L ≤ M) (a : L) : inclusion h a = Set.inclusion h a
140146

141147
lemma inclusion_injective (h : L ≤ M) : Injective <| inclusion h := Set.inclusion_injective h
142148

143-
@[simp] lemma inclusion_rfl (L : BooleanSubalgebra α) : inclusion le_rfl = BoundedLatticeHom.id L := rfl
149+
@[simp] lemma inclusion_rfl (L : BooleanSubalgebra α) : inclusion le_rfl = .id L := rfl
144150
@[simp] lemma subtype_comp_inclusion (h : L ≤ M) : M.subtype.comp (inclusion h) = L.subtype := rfl
145151

146152
/-- The maximum boolean subalgebra of a lattice. -/
@@ -230,17 +236,17 @@ def comap (f : BoundedLatticeHom α β) (L : BooleanSubalgebra β) : BooleanSuba
230236
supClosed' := L.supClosed.preimage _
231237
infClosed' := L.infClosed.preimage _
232238

233-
@[simp, norm_cast] lemma coe_comap (L : BooleanSubalgebra β) (f : BoundedLatticeHom α β) : L.comap f = f ⁻¹' L :=
234-
rfl
239+
@[simp, norm_cast]
240+
lemma coe_comap (L : BooleanSubalgebra β) (f : BoundedLatticeHom α β) : L.comap f = f ⁻¹' L := rfl
235241

236-
@[simp] lemma mem_comap {L : BooleanSubalgebra β} : a ∈ L.comap f ↔ f a ∈ L := Iff.rfl
242+
@[simp] lemma mem_comap {L : BooleanSubalgebra β} : a ∈ L.comap f ↔ f a ∈ L := .rfl
237243

238244
lemma comap_mono : Monotone (comap f) := fun _ _ ↦ preimage_mono
239245

240246
@[simp] lemma comap_id (L : BooleanSubalgebra α) : L.comap (BoundedLatticeHom.id _) = L := rfl
241247

242-
@[simp] lemma comap_comap (L : BooleanSubalgebra γ) (g : BoundedLatticeHom β γ) (f : BoundedLatticeHom α β) :
243-
(L.comap g).comap f = L.comap (g.comp f) := rfl
248+
@[simp] lemma comap_comap (L : BooleanSubalgebra γ) (g : BoundedLatticeHom β γ)
249+
(f : BoundedLatticeHom α β) : (L.comap g).comap f = L.comap (g.comp f) := rfl
244250

245251
/-- The image of a boolean subalgebra along a monoid homomorphism is a boolean subalgebra. -/
246252
def map (f : BoundedLatticeHom α β) (L : BooleanSubalgebra α) : BooleanSubalgebra β where
@@ -250,11 +256,16 @@ def map (f : BoundedLatticeHom α β) (L : BooleanSubalgebra α) : BooleanSubalg
250256
supClosed' := L.supClosed.image f
251257
infClosed' := L.infClosed.image f
252258

253-
@[simp] lemma coe_map (f : BoundedLatticeHom α β) (L : BooleanSubalgebra α) : (L.map f : Set β) = f '' L := rfl
254-
@[simp] lemma mem_map {b : β} : b ∈ L.map f ↔ ∃ a ∈ L, f a = b := Iff.rfl
259+
@[simp] lemma coe_map (f : BoundedLatticeHom α β) (L : BooleanSubalgebra α) :
260+
(L.map f : Set β) = f '' L := rfl
261+
262+
@[simp] lemma mem_map {b : β} : b ∈ L.map f ↔ ∃ a ∈ L, f a = b := .rfl
263+
264+
lemma mem_map_of_mem (f : BoundedLatticeHom α β) {a : α} : a ∈ L → f a ∈ L.map f :=
265+
mem_image_of_mem f
255266

256-
lemma mem_map_of_mem (f : BoundedLatticeHom α β) {a : α} : a ∈ L → f a ∈ L.map f := mem_image_of_mem f
257-
lemma apply_coe_mem_map (f : BoundedLatticeHom α β) (a : L) : f a ∈ L.map f := mem_map_of_mem f a.prop
267+
lemma apply_coe_mem_map (f : BoundedLatticeHom α β) (a : L) : f a ∈ L.map f :=
268+
mem_map_of_mem f a.prop
258269

259270
lemma map_mono : Monotone (map f) := fun _ _ ↦ image_subset _
260271

@@ -278,19 +289,20 @@ lemma map_symm_eq_iff_eq_map {M : BooleanSubalgebra β} {e : β ≃o α} :
278289
L.map ↑e.symm = M ↔ L = M.map ↑e := by
279290
simp_rw [← coe_inj]; exact (Equiv.eq_image_iff_symm_image_eq _ _ _).symm
280291

281-
lemma map_le_iff_le_comap {f : BoundedLatticeHom α β} {M : BooleanSubalgebra β} : L.map f ≤ M ↔ L ≤ M.comap f :=
282-
image_subset_iff
292+
lemma map_le_iff_le_comap {f : BoundedLatticeHom α β} {M : BooleanSubalgebra β} :
293+
L.map f ≤ M ↔ L ≤ M.comap f := image_subset_iff
283294

284295
lemma gc_map_comap (f : BoundedLatticeHom α β) : GaloisConnection (map f) (comap f) :=
285296
fun _ _ ↦ map_le_iff_le_comap
286297

287-
@[simp] lemma map_bot (f : BoundedLatticeHom α β) : (⊥ : BooleanSubalgebra α).map f = ⊥ := (gc_map_comap f).l_bot
298+
@[simp] lemma map_bot (f : BoundedLatticeHom α β) : (⊥ : BooleanSubalgebra α).map f = ⊥ :=
299+
(gc_map_comap f).l_bot
288300

289-
lemma map_sup (f : BoundedLatticeHom α β) (L M : BooleanSubalgebra α) : (L ⊔ M).map f = L.map f ⊔ M.map f :=
290-
(gc_map_comap f).l_sup
301+
lemma map_sup (f : BoundedLatticeHom α β) (L M : BooleanSubalgebra α) :
302+
(L ⊔ M).map f = L.map f ⊔ M.map f := (gc_map_comap f).l_sup
291303

292-
lemma map_iSup (f : BoundedLatticeHom α β) (L : ι → BooleanSubalgebra α) : (⨆ i, L i).map f = ⨆ i, (L i).map f :=
293-
(gc_map_comap f).l_iSup
304+
lemma map_iSup (f : BoundedLatticeHom α β) (L : ι → BooleanSubalgebra α) :
305+
(⨆ i, L i).map f = ⨆ i, (L i).map f := (gc_map_comap f).l_iSup
294306

295307
@[simp] lemma comap_top (f : BoundedLatticeHom α β) : (⊤ : BooleanSubalgebra β).comap f = ⊤ :=
296308
(gc_map_comap f).u_top
@@ -318,4 +330,50 @@ lemma map_inf (L M : BooleanSubalgebra α) (f : BoundedLatticeHom α β) (hf : I
318330
lemma map_top (f : BoundedLatticeHom α β) (h : Surjective f) : BooleanSubalgebra.map f ⊤ = ⊤ :=
319331
SetLike.coe_injective <| by simp [h.range_eq]
320332

333+
/-- The minimum boolean algebra containing a given set. -/
334+
def closure (s : Set α) : BooleanSubalgebra α := sInf {L | s ⊆ L}
335+
336+
variable {s : Set α}
337+
338+
lemma mem_closure {x : α} : x ∈ closure s ↔ ∀ ⦃L : BooleanSubalgebra α⦄, s ⊆ L → x ∈ L := mem_sInf
339+
340+
@[aesop safe 20 apply (rule_sets := [SetLike])]
341+
lemma subset_closure : s ⊆ closure s := fun _ hx ↦ mem_closure.2 fun _ hK ↦ hK hx
342+
343+
@[simp] lemma closure_le : closure s ≤ L ↔ s ⊆ L := ⟨subset_closure.trans, fun h ↦ sInf_le h⟩
344+
345+
/-- An induction principle for closure membership. If `p` holds for `⊥` and all elements of `s`, and
346+
is preserved under suprema and complement, then `p` holds for all elements of the closure of `s`. -/
347+
@[elab_as_elim]
348+
lemma closure_bot_sup_induction {p : ∀ g ∈ closure s, Prop} (mem : ∀ x hx, p x (subset_closure hx))
349+
(bot : p ⊥ bot_mem)
350+
(sup : ∀ x hx y hy, p x hx → p y hy → p (x ⊔ y) (supClosed _ hx hy))
351+
(compl : ∀ x hx, p x hx → p xᶜ (compl_mem hx)) {x} (hx : x ∈ closure s) : p x hx :=
352+
have inf ⦃x hx y hy⦄ (hx' : p x hx) (hy' : p y hy) : p (x ⊓ y) (infClosed _ hx hy) := by
353+
simpa using compl _ _ <| sup _ _ _ _ (compl _ _ hx') (compl _ _ hy')
354+
let L : BooleanSubalgebra α :=
355+
{ carrier := { x | ∃ hx, p x hx }
356+
supClosed' := fun _a ⟨_, ha⟩ _b ⟨_, hb⟩ ↦ ⟨_, sup _ _ _ _ ha hb⟩
357+
infClosed' := fun _a ⟨_, ha⟩ _b ⟨_, hb⟩ ↦ ⟨_, inf ha hb⟩
358+
bot_mem' := ⟨_, bot⟩
359+
compl_mem' := fun ⟨_, hb⟩ ↦ ⟨_, compl _ _ hb⟩ }
360+
closure_le (L := L).mpr (fun y hy ↦ ⟨subset_closure hy, mem y hy⟩) hx |>.elim fun _ ↦ id
361+
362+
end BooleanAlgebra
363+
364+
section CompleteBooleanAlgebra
365+
variable [CompleteBooleanAlgebra α] {L : BooleanSubalgebra α} {f : ι → α} {s : Set α}
366+
367+
lemma iSup_mem [Finite ι] (hf : ∀ i, f i ∈ L) : ⨆ i, f i ∈ L := L.supClosed.iSup_mem bot_mem hf
368+
lemma iInf_mem [Finite ι] (hf : ∀ i, f i ∈ L) : ⨅ i, f i ∈ L := L.infClosed.iInf_mem top_mem hf
369+
lemma sSup_mem (hs : s.Finite) (hsL : s ⊆ L) : sSup s ∈ L := L.supClosed.sSup_mem hs bot_mem hsL
370+
lemma sInf_mem (hs : s.Finite) (hsL : s ⊆ L) : sInf s ∈ L := L.infClosed.sInf_mem hs top_mem hsL
371+
372+
lemma biSup_mem {ι : Type*} {t : Set ι} {f : ι → α} (ht : t.Finite) (hf : ∀ i ∈ t, f i ∈ L) :
373+
⨆ i ∈ t, f i ∈ L := L.supClosed.biSup_mem ht bot_mem hf
374+
375+
lemma biInf_mem {ι : Type*} {t : Set ι} {f : ι → α} (ht : t.Finite) (hf : ∀ i ∈ t, f i ∈ L) :
376+
⨅ i ∈ t, f i ∈ L := L.infClosed.biInf_mem ht top_mem hf
377+
378+
end CompleteBooleanAlgebra
321379
end BooleanSubalgebra

LeanCamCombi/GrowthInGroups/Chevalley.lean

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ lemma RingHom.FinitePresentation.polynomial_induction
436436

437437
lemma PrimeSpectrum.isRetroCompact_iff {U : Set (PrimeSpectrum R)} (hU : IsOpen U) :
438438
IsRetroCompact U ↔ IsCompact U := by
439-
refine isRetroCompact_iff_isCompact_of_isTopologicalBasis _ isTopologicalBasis_basic_opens ?_ hU
440-
intro i j
439+
refine isTopologicalBasis_basic_opens.isRetroCompact_iff_isCompact (fun i j ↦ ?_) hU
441440
rw [← TopologicalSpace.Opens.coe_inf, ← basicOpen_mul]
442441
exact isCompact_basicOpen _
443442

@@ -514,11 +513,11 @@ lemma isConstructible_comap_C_zeroLocus_sdiff_zeroLocus {R} [CommRing R]
514513
(isOpenMap_comap_C _ (basicOpen f).2)
515514
· intro R _ c I H₁ H₂ f
516515
replace H₁ := (H₁ (mapRingHom (algebraMap _ _) f)).image_of_isOpenEmbedding
517-
_ (localization_away_isOpenEmbedding (Localization.Away c) c)
516+
(localization_away_isOpenEmbedding (Localization.Away c) c)
518517
(by rw [localization_away_comap_range _ c]
519518
exact (isRetroCompact_iff (basicOpen c).2).mpr (isCompact_basicOpen c))
520519
replace H₂ := (H₂ (mapRingHom (Ideal.Quotient.mk _) f)).image_of_isClosedEmbedding
521-
_ (isClosedEmbedding_comap_of_surjective _ _ Ideal.Quotient.mk_surjective)
520+
(isClosedEmbedding_comap_of_surjective _ _ Ideal.Quotient.mk_surjective)
522521
(by rw [range_comap_of_surjective _ _ Ideal.Quotient.mk_surjective]
523522
simp only [Ideal.mk_ker, zeroLocus_span, ← basicOpen_eq_zeroLocus_compl]
524523
exact (isRetroCompact_iff (basicOpen c).2).mpr (isCompact_basicOpen c))
@@ -530,16 +529,20 @@ lemma isConstructible_comap_C_zeroLocus_sdiff_zeroLocus {R} [CommRing R]
530529
lemma isConstructible_image_comap_C {R} [CommRing R] (s : Set (PrimeSpectrum R[X]))
531530
(hs : IsConstructible s) :
532531
IsConstructible (comap C '' s) := by
533-
apply hs.induction_of_isTopologicalBasis _ isTopologicalBasis_basic_opens
534-
· intros i s hs
532+
induction s, hs using
533+
IsConstructible.induction_of_isTopologicalBasis _ isTopologicalBasis_basic_opens with
534+
| compact_inter i j =>
535+
rw [← TopologicalSpace.Opens.coe_inf, ← basicOpen_mul]
536+
exact isCompact_basicOpen _
537+
| union s hs t ht hs' ht' =>
538+
rw [Set.image_union]
539+
exact hs'.union ht'
540+
| sdiff i s hs =>
535541
simp only [basicOpen_eq_zeroLocus_compl, ← Set.compl_iInter₂,
536542
compl_sdiff_compl, ← zeroLocus_iUnion₂, Set.biUnion_of_singleton]
537543
rw [← zeroLocus_span]
538544
apply isConstructible_comap_C_zeroLocus_sdiff_zeroLocus
539545
exact ⟨hs.toFinset, by simp⟩
540-
· intros s t hs ht
541-
rw [Set.image_union]
542-
exact hs.union ht
543546

544547
lemma isConstructible_image_comap {R S} [CommRing R] [CommRing S] (f : R →+* S)
545548
(hf : RingHom.FinitePresentation f)
@@ -550,7 +553,7 @@ lemma isConstructible_image_comap {R S} [CommRing R] [CommRing S] (f : R →+* S
550553
(Q := fun _ _ _ _ f ↦ ∀ s, IsConstructible s → IsConstructible (comap f '' s))
551554
· exact fun _ ↦ isConstructible_image_comap_C
552555
· intro R _ S _ f hf hf' s hs
553-
refine hs.image_of_isClosedEmbedding _ (isClosedEmbedding_comap_of_surjective _ _ hf) ?_
556+
refine hs.image_of_isClosedEmbedding (isClosedEmbedding_comap_of_surjective _ _ hf) ?_
554557
rw [range_comap_of_surjective _ _ hf, isRetroCompact_iff (isClosed_zeroLocus _).isOpen_compl]
555558
obtain ⟨t, ht⟩ := hf'
556559
rw [← ht, ← t.toSet.iUnion_of_singleton_coe, zeroLocus_span, zeroLocus_iUnion, Set.compl_iInter]

0 commit comments

Comments
 (0)