Skip to content

Commit 20495d0

Browse files
staroperatorKomyyy
andcommitted
apply suggestion
Co-authored-by: Komyyy <pol_tta@outlook.jp>
1 parent 21f0223 commit 20495d0

1 file changed

Lines changed: 39 additions & 50 deletions

File tree

Mathlib/Data/Set/Finite/Lattice.lean

Lines changed: 39 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public import Mathlib.Data.Set.Finite.Powerset
99
public import Mathlib.Data.Set.Finite.Range
1010
public import Mathlib.Data.Set.Lattice.Image
1111

12+
import Mathlib.Data.Fintype.Option
13+
1214
/-!
1315
# Finiteness of unions and intersections
1416
@@ -368,57 +370,44 @@ theorem iUnion_univ_pi_of_monotone {ι ι' : Type*} [LinearOrder ι'] [Nonempty
368370
⋃ j : ι', pi univ (fun i => s i j) = pi univ fun i => ⋃ j, s i j :=
369371
iUnion_pi_of_monotone finite_univ fun i _ => hs i
370372

371-
theorem Finite.biInf_iSup_eq {ι} {κ : ι → Sort*} [Nonempty (∀ a, κ a)] [Order.Frame α] {s : Set ι}
372-
(hs : s.Finite) {f : ∀ a, κ a → α} :
373-
⨅ a ∈ s, ⨆ b, f a b = ⨆ g : ∀ a, κ a, ⨅ a ∈ s, f a (g a) := by
374-
classical
375-
induction s, hs using Finite.induction_on with
376-
| empty => simp [iSup_const]
377-
| @insert a s ha _ ih =>
378-
simp_rw [iInf_insert, ih, iSup_inf_eq, inf_iSup_eq]
379-
refine le_antisymm (iSup_le fun b => iSup_le fun g => ?_) (iSup_le fun g => ?_)
380-
· refine le_iSup_of_le (Function.update g a b) (inf_le_inf ?_ (iInf₂_mono fun a' ha' => ?_))
381-
· simp
382-
· rw [update_of_ne]
383-
rintro rfl
384-
exact ha ha'
385-
· exact le_iSup_of_le (g a) (le_iSup_of_le g le_rfl)
386-
387-
theorem Finite.biSup_iInf_eq {ι} {κ : ι → Sort*} [Nonempty (∀ a, κ a)] [Order.Coframe α] {s : Set ι}
388-
(hs : s.Finite) {f : ∀ a, κ a → α} :
389-
⨆ a ∈ s, ⨅ b, f a b = ⨅ g : ∀ a, κ a, ⨆ a ∈ s, f a (g a) := by
373+
theorem _root_.iInf_iSup_eq_of_finite {ι : Sort v} {κ : ι → Sort w} [Order.Frame α] [Finite ι]
374+
{f : Π a, κ a → α} : ⨅ a, ⨆ b, f a b = ⨆ g : (Π a, κ a), ⨅ a, f a (g a) := by
375+
suffices ∀ {ι : Type v} {κ : ι → Type w} [Finite ι] (f : Π a, κ a → α),
376+
⨅ a, ⨆ b, f a b = ⨆ g : (Π a, κ a), ⨅ a, f a (g a) by
377+
simpa [← Equiv.plift.symm.iInf_comp, ← Equiv.plift.symm.iSup_comp,
378+
← (Equiv.plift.piCongr fun a => @Equiv.plift (κ a.down)).symm.iSup_comp] using
379+
this (κ := fun a => PLift (κ a.down)) fun (a : PLift ι) b => f a.down b.down
380+
intro ι κ _ f
381+
induction ι using Finite.induction_empty_option with
382+
| of_equiv e h => simp [← e.iInf_comp, ← e.piCongrLeft κ |>.iSup_comp, h]
383+
| h_empty => simp [iInf_of_empty, iSup_const]
384+
| h_option h =>
385+
simp only [iInf_option, h, ← (Equiv.piOptionEquivProd (β := κ)).symm.iSup_comp,
386+
Equiv.piOptionEquivProd_symm_apply, iSup_prod, ← inf_iSup_eq, ← iSup_inf_eq]
387+
388+
theorem _root_.iSup_iInf_eq_of_finite {ι : Sort v} {κ : ι → Sort w} [Order.Coframe α] [Finite ι]
389+
{f : ∀ a, κ a → α} : ⨆ a, ⨅ b, f a b = ⨅ g : ∀ a, κ a, ⨆ a, f a (g a) :=
390+
iInf_iSup_eq_of_finite (α := αᵒᵈ)
391+
392+
theorem Finite.biInf_iSup_eq {ι : Type v} {κ : ι → Sort w} [Nonempty (Π a, κ a)] [Order.Frame α]
393+
{s : Set ι} (hs : s.Finite) {f : Π a, κ a → α} :
394+
⨅ a ∈ s, ⨆ b, f a b = ⨆ g : (Π a, κ a), ⨅ a ∈ s, f a (g a) := by
390395
classical
391-
induction s, hs using Finite.induction_on with
392-
| empty => simp [iInf_const]
393-
| @insert a s ha _ ih =>
394-
simp_rw [iSup_insert, ih, iInf_sup_eq, sup_iInf_eq]
395-
refine le_antisymm (le_iInf fun g => ?_) (le_iInf fun b => le_iInf fun g => ?_)
396-
· exact iInf_le_of_le (g a) (iInf_le_of_le g le_rfl)
397-
· refine iInf_le_of_le (Function.update g a b) (sup_le_sup ?_ (iSup₂_mono fun a' ha' => ?_))
398-
· simp
399-
· rw [update_of_ne]
400-
rintro rfl
401-
exact ha ha'
402-
403-
theorem _root_.iInf_iSup_eq_of_finite {κ : ι → Sort*} [Order.Frame α] [Finite ι]
404-
{f : ∀ a, κ a → α} : ⨅ a, ⨆ b, f a b = ⨆ g : ∀ a, κ a, ⨅ a, f a (g a) := by
405-
by_cases h : ∀ a, Nonempty (κ a)
406-
· simpa [← Equiv.plift.symm.iInf_comp, ← (Equiv.plift.piCongrLeft' _).symm.iSup_comp]
407-
using Finite.biInf_iSup_eq (f := (f <| PLift.down ·)) finite_univ
408-
· simp only [not_forall, not_nonempty_iff] at h
409-
haveI : IsEmpty (∀ a, κ a) := by simpa
410-
rcases h with ⟨a, h⟩
411-
grw [iSup_of_empty, eq_bot_iff, iInf_le _ a, iSup_of_empty]
412-
413-
theorem _root_.iSup_iInf_eq_of_finite {κ : ι → Sort*} [Order.Coframe α] [Finite ι]
414-
{f : ∀ a, κ a → α} : ⨆ a, ⨅ b, f a b = ⨅ g : ∀ a, κ a, ⨆ a, f a (g a) := by
415-
by_cases h : ∀ a, Nonempty (κ a)
416-
· simpa [← Equiv.plift.symm.iSup_comp, ← (Equiv.plift.piCongrLeft' _).symm.iInf_comp]
417-
using Finite.biSup_iInf_eq (f := (f <| PLift.down ·)) finite_univ
418-
· simp only [not_forall, not_nonempty_iff] at h
419-
haveI : IsEmpty (∀ a, κ a) := by simpa
420-
rcases h with ⟨a, h⟩
421-
grw [iInf_of_empty, eq_top_iff, ← le_iSup _ a, iInf_of_empty]
396+
suffices h : ∀ {κ : ι → Type w} [Nonempty (Π a, κ a)] (f : Π a, κ a → α),
397+
⨅ a ∈ s, ⨆ b, f a b = ⨆ g : (Π a, κ a), ⨅ a ∈ s, f a (g a) by
398+
haveI : Nonempty (Π a, PLift (κ a)) := (Equiv.piCongrRight fun _ => Equiv.plift).nonempty
399+
simpa [← Equiv.plift.symm.iSup_comp, ← (Equiv.piCongrRight fun _ => Equiv.plift).symm.iSup_comp]
400+
using h (κ := fun a => PLift (κ a)) fun a b => f a b.down
401+
intro κ _ f
402+
haveI := hs.to_subtype
403+
haveI : Nonempty (Π a : { a // a ∉ s }, κ ↑a) := ‹Nonempty (Π a, κ a)›.map fun f a ↦ f a
404+
simp [← iInf_subtype'', iInf_iSup_eq_of_finite (ι := s),
405+
← Equiv.piEquivPiSubtypeProd (· ∈ s) _ |>.symm.iSup_comp, iSup_prod, iSup_const]
406+
407+
theorem Finite.biSup_iInf_eq {ι : Type v} {κ : ι → Sort w} [Nonempty (∀ a, κ a)] [Order.Coframe α]
408+
{s : Set ι} (hs : s.Finite) {f : ∀ a, κ a → α} :
409+
⨆ a ∈ s, ⨅ b, f a b = ⨅ g : ∀ a, κ a, ⨆ a ∈ s, f a (g a) :=
410+
hs.biInf_iSup_eq (α := αᵒᵈ)
422411

423412
section
424413

0 commit comments

Comments
 (0)