Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 5166765

Browse files
committed
chore(order/filter/pointwise): Better definitional unfolding (#13941)
Tweak pointwise operation definitions to make them easier to work with: * `1` is now `pure 1` instead of `principal 1`. This changes defeq. * Binary operations unfold to the set operation instead exposing a bare `set.image2` (`obtain ⟨t₁, t₂, h₁, h₂, h⟩ : s ∈ f * g` now gives `h : t₁ * t₂ ⊆ s` instead of `h : set.image2 (*) t₁ t₂ ⊆ s`. This does not change defeq.
1 parent cf65daf commit 5166765

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

src/order/filter/pointwise.lean

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ distribute over pointwise operations. For example,
1717
1818
## Main declarations
1919
20-
* `0` (`filter.has_zero`): Principal filter at `0 : α`.
21-
* `1` (`filter.has_one`): Principal filter at `1 : α`.
20+
* `0` (`filter.has_zero`): Pure filter at `0 : α`, or alternatively principal filter at `0 : set α`.
21+
* `1` (`filter.has_one`): Pure filter at `1 : α`, or alternatively principal filter at `1 : set α`.
2222
* `f + g` (`filter.has_add`): Addition, filter generated by all `s + t` where `s ∈ f` and `t ∈ g`.
2323
* `f * g` (`filter.has_mul`): Multiplication, filter generated by all `s * t` where `s ∈ f` and
2424
`t ∈ g`.
@@ -63,30 +63,27 @@ variables [has_one α] {f : filter α} {s : set α}
6363
/-- `1 : filter α` is defined as the filter of sets containing `1 : α` in locale `pointwise`. -/
6464
@[to_additive "`0 : filter α` is defined as the filter of sets containing `0 : α` in locale
6565
`pointwise`."]
66-
protected def has_one : has_one (filter α) := ⟨principal 1
66+
protected def has_one : has_one (filter α) := ⟨pure 1
6767

6868
localized "attribute [instance] filter.has_one filter.has_zero" in pointwise
6969

70-
@[simp, to_additive] lemma mem_one : s ∈ (1 : filter α) ↔ (1 : α) ∈ s := one_subset
71-
72-
@[to_additive] lemma one_mem_one : (1 : set α) ∈ (1 : filter α) := mem_principal_self _
73-
74-
@[simp, to_additive] lemma principal_one : 𝓟 1 = (1 : filter α) := rfl
75-
@[simp, to_additive] lemma le_one_iff : f ≤ 1 ↔ (1 : set α) ∈ f := le_principal_iff
76-
@[simp, to_additive] lemma pure_one : pure 1 = (1 : filter α) := (principal_singleton _).symm
77-
@[simp, to_additive] lemma eventually_one {p : α → Prop} : (∀ᶠ x in 1, p x) ↔ p 1 :=
78-
by rw [←pure_one, eventually_pure]
70+
@[simp, to_additive] lemma mem_one : s ∈ (1 : filter α) ↔ (1 : α) ∈ s := mem_pure
71+
@[to_additive] lemma one_mem_one : (1 : set α) ∈ (1 : filter α) := mem_pure.2 one_mem_one
72+
@[simp, to_additive] lemma pure_one : pure 1 = (1 : filter α) := rfl
73+
@[simp, to_additive] lemma principal_one : 𝓟 1 = (1 : filter α) := principal_singleton _
74+
@[to_additive] lemma one_ne_bot : (1 : filter α).ne_bot := filter.pure_ne_bot
75+
@[simp, to_additive] protected lemma map_one' (f : α → β) : (1 : filter α).map f = pure (f 1) := rfl
76+
@[simp, to_additive] lemma le_one_iff : f ≤ 1 ↔ (1 : set α) ∈ f := le_pure_iff
77+
@[simp, to_additive] lemma eventually_one {p : α → Prop} : (∀ᶠ x in 1, p x) ↔ p 1 := eventually_pure
7978
@[simp, to_additive] lemma tendsto_one {a : filter β} {f : β → α} :
8079
tendsto f a 1 ↔ ∀ᶠ x in a, f x = 1 :=
81-
by rw [←pure_one, tendsto_pure]
80+
tendsto_pure
8281

8382
variables [has_one β]
8483

8584
@[simp, to_additive]
8685
protected lemma map_one [one_hom_class F α β] (φ : F) : map φ 1 = 1 :=
87-
le_antisymm
88-
(le_principal_iff.2 $ mem_map_iff_exists_image.21, one_mem_one, λ x, by simp [map_one φ]⟩)
89-
(le_map $ λ s hs, mem_one.21, mem_one.1 hs, map_one φ⟩)
86+
by rw [filter.map_one', map_one, pure_one]
9087

9188
end one
9289

@@ -97,7 +94,10 @@ variables [has_mul α] [has_mul β] {f f₁ f₂ g g₁ g₂ h : filter α} {s t
9794

9895
/-- The filter `f * g` is generated by `{s * t | s ∈ f, t ∈ g}` in locale `pointwise`. -/
9996
@[to_additive "The filter `f + g` is generated by `{s + t | s ∈ f, t ∈ g}` in locale `pointwise`."]
100-
protected def has_mul : has_mul (filter α) := ⟨map₂ (*)⟩
97+
protected def has_mul : has_mul (filter α) :=
98+
/- This is defeq to `map₂ (*) f g`, but the hypothesis unfolds to `t₁ * t₂ ⊆ s` rather than all the
99+
way to `set.image2 (*) t₁ t₂ ⊆ s`. -/
100+
⟨λ f g, { sets := {s | ∃ t₁ t₂, t₁ ∈ f ∧ t₂ ∈ g ∧ t₁ * t₂ ⊆ s}, ..map₂ (*) f g }⟩
101101

102102
localized "attribute [instance] filter.has_mul filter.has_add" in pointwise
103103

@@ -246,7 +246,10 @@ variables [has_div α] {f f₁ f₂ g g₁ g₂ h : filter α} {s t : set α} {a
246246

247247
/-- The filter `f / g` is generated by `{s / t | s ∈ f, t ∈ g}` in locale `pointwise`. -/
248248
@[to_additive "The filter `f - g` is generated by `{s - t | s ∈ f, t ∈ g}` in locale `pointwise`."]
249-
protected def has_div : has_div (filter α) := ⟨map₂ (/)⟩
249+
protected def has_div : has_div (filter α) :=
250+
/- This is defeq to `map₂ (/) f g`, but the hypothesis unfolds to `t₁ / t₂ ⊆ s` rather than all the
251+
way to `set.image2 (/) t₁ t₂ ⊆ s`. -/
252+
⟨λ f g, { sets := {s | ∃ t₁ t₂, t₁ ∈ f ∧ t₂ ∈ g ∧ t₁ / t₂ ⊆ s}, ..map₂ (/) f g }⟩
250253

251254
localized "attribute [instance] filter.has_div filter.has_sub" in pointwise
252255

@@ -318,7 +321,10 @@ section smul
318321
variables [has_scalar α β] {f f₁ f₂ : filter α} {g g₁ g₂ h : filter β} {s : set α} {t : set β}
319322
{a : α} {b : β}
320323

321-
@[to_additive filter.has_vadd] instance : has_scalar (filter α) (filter β) := ⟨map₂ (•)⟩
324+
@[to_additive filter.has_vadd] instance : has_scalar (filter α) (filter β) :=
325+
/- This is defeq to `map₂ (•) f g`, but the hypothesis unfolds to `t₁ • t₂ ⊆ s` rather than all the
326+
way to `set.image2 (•) t₁ t₂ ⊆ s`. -/
327+
⟨λ f g, { sets := {s | ∃ t₁ t₂, t₁ ∈ f ∧ t₂ ∈ g ∧ t₁ • t₂ ⊆ s}, ..map₂ (•) f g }⟩
322328

323329
@[simp, to_additive] lemma map₂_smul : map₂ (•) f g = f • g := rfl
324330
@[to_additive] lemma mem_smul : t ∈ f • g ↔ ∃ t₁ t₂, t₁ ∈ f ∧ t₂ ∈ g ∧ t₁ • t₂ ⊆ t := iff.rfl
@@ -357,7 +363,10 @@ variables [has_vsub α β] {f f₁ f₂ g g₁ g₂ : filter β} {h : filter α}
357363
include α
358364

359365
/-- The filter `f -ᵥ g` is generated by `{s -ᵥ t | s ∈ f, t ∈ g}` in locale `pointwise`. -/
360-
protected def has_vsub : has_vsub (filter α) (filter β) := ⟨map₂ (-ᵥ)⟩
366+
protected def has_vsub : has_vsub (filter α) (filter β) :=
367+
/- This is defeq to `map₂ (-ᵥ) f g`, but the hypothesis unfolds to `t₁ -ᵥ t₂ ⊆ s` rather than all
368+
the way to `set.image2 (-ᵥ) t₁ t₂ ⊆ s`. -/
369+
⟨λ f g, { sets := {s | ∃ t₁ t₂, t₁ ∈ f ∧ t₂ ∈ g ∧ t₁ -ᵥ t₂ ⊆ s}, ..map₂ (-ᵥ) f g }⟩
361370

362371
localized "attribute [instance] filter.has_vsub" in pointwise
363372

0 commit comments

Comments
 (0)