Skip to content

Commit

Permalink
chore(order/filter/basic): golf a proof (#9874)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Oct 22, 2021
1 parent b812fb9 commit bee8d4a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/algebra/big_operators/finprod.lean
Expand Up @@ -690,7 +690,7 @@ of the products of `f a` over `a ∈ t i`. -/
∏ᶠ a ∈ ⋃ x ∈ I, t x, f a = ∏ᶠ i ∈ I, ∏ᶠ j ∈ t i, f j :=
begin
haveI := hI.fintype,
rw [← Union_subtype, finprod_mem_Union, ← finprod_set_coe_eq_finprod_mem],
rw [bUnion_eq_Union, finprod_mem_Union, ← finprod_set_coe_eq_finprod_mem],
exacts [λ x y hxy, h x x.2 y y.2 (subtype.coe_injective.ne hxy), λ b, ht b b.2]
end

Expand Down
16 changes: 14 additions & 2 deletions src/data/set/lattice.lean
Expand Up @@ -552,6 +552,14 @@ theorem bInter_eq_Inter (s : set α) (t : Π x ∈ s, set β) :
(⋂ x ∈ s, t x ‹_›) = (⋂ x : s, t x x.2) :=
infi_subtype'

theorem Union_subtype (p : α → Prop) (s : {x // p x} → set β) :
(⋃ x : {x // p x}, s x) = ⋃ x (hx : p x), s ⟨x, hx⟩ :=
supr_subtype

theorem Inter_subtype (p : α → Prop) (s : {x // p x} → set β) :
(⋂ x : {x // p x}, s x) = ⋂ x (hx : p x), s ⟨x, hx⟩ :=
infi_subtype

theorem bInter_empty (u : α → set β) : (⋂ x ∈ (∅ : set α), u x) = univ :=
infi_emptyset

Expand Down Expand Up @@ -615,9 +623,13 @@ theorem bUnion_union (s t : set α) (u : α → set β) :
(⋃ x ∈ s ∪ t, u x) = (⋃ x ∈ s, u x) ∪ (⋃ x ∈ t, u x) :=
supr_union

@[simp] lemma Union_subtype {α β : Type*} (s : set α) (f : α → set β) :
@[simp] lemma Union_coe_set {α β : Type*} (s : set α) (f : α → set β) :
(⋃ (i : s), f i) = ⋃ (i ∈ s), f i :=
(set.bUnion_eq_Union s $ λ x _, f x).symm
Union_subtype _ _

@[simp] lemma Inter_coe_set {α β : Type*} (s : set α) (f : α → set β) :
(⋂ (i : s), f i) = ⋂ (i ∈ s), f i :=
Inter_subtype _ _

-- TODO(Jeremy): once again, simp doesn't do it alone.

Expand Down
2 changes: 1 addition & 1 deletion src/measure_theory/measure/measure_space_def.lean
Expand Up @@ -242,7 +242,7 @@ lemma measure_Union_null_iff [encodable ι] {s : ι → set α} :

lemma measure_bUnion_null_iff {s : set ι} (hs : countable s) {t : ι → set α} :
μ (⋃ i ∈ s, t i) = 0 ↔ ∀ i ∈ s, μ (t i) = 0 :=
by { haveI := hs.to_encodable, rw [← Union_subtype, measure_Union_null_iff, set_coe.forall], refl }
by { haveI := hs.to_encodable, rw [bUnion_eq_Union, measure_Union_null_iff, set_coe.forall], refl }

theorem measure_union_le (s₁ s₂ : set α) : μ (s₁ ∪ s₂) ≤ μ s₁ + μ s₂ :=
μ.to_outer_measure.union _ _
Expand Down
35 changes: 10 additions & 25 deletions src/order/filter/basic.lean
Expand Up @@ -720,32 +720,17 @@ lemma binfi_sup_left (p : ι → Prop) (f : ι → filter α) (g : filter α) :
(⨅ i (h : p i), (g ⊔ f i)) = g ⊔ (⨅ i (h : p i), f i) :=
by rw [infi_subtype', infi_sup_left, infi_subtype']

lemma mem_infi_finset {s : finset α} {f : α → filter β} :
∀ t, t ∈ (⨅ a ∈ s, f a) ↔ (∃ p : α → set β, (∀ a ∈ s, p a ∈ f a) ∧ t = ⋂ a ∈ s, p a) :=
show ∀ t, t ∈ (⨅ a ∈ s, f a) ↔ (∃ p : α → set β, (∀ a ∈ s, p a ∈ f a) ∧ t = ⨅ a ∈ s, p a),
lemma mem_infi_finset {s : finset α} {f : α → filter β} {t : set β} :
t ∈ (⨅ a ∈ s, f a) ↔ (∃ p : α → set β, (∀ a ∈ s, p a ∈ f a) ∧ t = ⋂ a ∈ s, p a) :=
begin
simp only [(finset.inf_eq_infi _ _).symm],
refine finset.induction_on s _ _,
{ simp only [finset.not_mem_empty, false_implies_iff, finset.inf_empty, top_le_iff,
imp_true_iff, mem_top, true_and, exists_const],
intros; refl },
{ intros a s has ih t,
simp only [ih, finset.forall_mem_insert, finset.inf_insert, mem_inf_iff, exists_prop,
iff_iff_implies_and_implies, exists_imp_distrib, and_imp, and_assoc] {contextual := tt},
split,
{ rintro t₁ ht₁ t₂ p hp ht₂ rfl,
use function.update p a t₁,
have : ∀ a' ∈ s, function.update p a t₁ a' = p a',
from λ a' ha',
have a' ≠ a, from λ h, has $ h ▸ ha',
function.update_noteq this _ _,
have eq : s.inf (λj, function.update p a t₁ j) = s.inf (λj, p j) :=
finset.inf_congr rfl this,
simp only [this, ht₁, hp, function.update_same, true_and, imp_true_iff, eq]
{contextual := tt},
refl },
rintro p hpa hp rfl,
exact ⟨p a, hpa, s.inf p, ⟨p, hp, rfl⟩, rfl⟩ }
simp only [← finset.set_bInter_coe, bInter_eq_Inter, infi_subtype'],
refine ⟨λ h, _, _⟩,
{ rcases (mem_infi_of_fintype _).1 h with ⟨p, hp, rfl⟩,
refine ⟨λ a, if h : a ∈ s then p ⟨a, h⟩ else univ, λ a ha, by simpa [ha] using hp ⟨a, ha⟩, _⟩,
refine Inter_congr id function.surjective_id _,
rintro ⟨a, ha⟩, simp [ha] },
{ rintro ⟨p, hpf, rfl⟩,
exact Inter_mem.2 (λ a, mem_infi_of_mem a (hpf a a.2)) }
end

/-- If `f : ι → filter α` is directed, `ι` is not empty, and `∀ i, f i ≠ ⊥`, then `infi f ≠ ⊥`.
Expand Down
2 changes: 1 addition & 1 deletion src/topology/metric_space/hausdorff_dimension.lean
Expand Up @@ -179,7 +179,7 @@ end
dimH (⋃ i ∈ s, t i) = ⨆ i ∈ s, dimH (t i) :=
begin
haveI := hs.to_encodable,
rw [← Union_subtype, dimH_Union, ← supr_subtype'']
rw [bUnion_eq_Union, dimH_Union, ← supr_subtype'']
end

@[simp] lemma dimH_sUnion {S : set (set X)} (hS : countable S) : dimH (⋃₀ S) = ⨆ s ∈ S, dimH s :=
Expand Down
2 changes: 1 addition & 1 deletion src/topology/paracompact.lean
Expand Up @@ -113,7 +113,7 @@ begin
have := hT, simp only [subset_def, mem_Union] at this,
choose i hiT hi using λ x, this x (mem_univ x),
refine ⟨(T : set ι), λ t, s t, λ t, ho _, _, locally_finite_of_fintype _, λ t, ⟨t, subset.rfl⟩⟩,
rwa [Union_subtype, finset.set_bUnion_coe, ← univ_subset_iff],
rwa [Union_coe_set, finset.set_bUnion_coe, ← univ_subset_iff],
end

/-- Let `X` be a locally compact sigma compact Hausdorff topological space, let `s` be a closed set
Expand Down

0 comments on commit bee8d4a

Please sign in to comment.