@@ -6,7 +6,7 @@ Authors: Leonardo de Moura
66import Mathlib.Data.Set.Lattice
77import Mathlib.Init.Set
88import Mathlib.Control.Basic
9- import Mathlib.Lean.Expr.ExtraRecognizers
9+ import Mathlib.Data.Set.Notation
1010
1111#align_import data.set.functor from "leanprover-community/mathlib" @"207cfac9fcd06138865b5d04f7091e46d9320432"
1212
@@ -18,7 +18,7 @@ This file defines the functor structure of `Set`.
1818
1919universe u
2020
21- open Function
21+ open Function Set.Notation
2222
2323namespace Set
2424
@@ -106,32 +106,11 @@ theorem image_coe_eq_restrict_image {δ : Type*} {f : α → δ} : f '' γ = β.
106106end with_instance
107107
108108/-! ### Coercion applying functoriality for `Subtype.val`
109-
110109The `Monad` instance gives a coercion using the internal function `Lean.Internal.coeM`.
111- In practice this is only used for applying the `Set` functor to `Subtype.val`.
112- We define this coercion here. -/
113-
114- /-- Coercion using `(Subtype.val '' ·)` -/
115- instance : CoeHead (Set s) (Set α) := ⟨fun t => (Subtype.val '' t)⟩
116-
117- namespace Notation
118-
119- open Lean PrettyPrinter Delaborator SubExpr in
120- /--
121- If the `Set.Notation` namespace is open, sets of a subtype coerced to the ambient type are
122- represented with `↑`.
123- -/
124- @[scoped delab app.Set.image]
125- def delab_set_image_subtype : Delab := whenPPOption getPPCoercions do
126- let #[α, _, f, _] := (← getExpr).getAppArgs | failure
127- guard <| f.isAppOfArity ``Subtype.val 2
128- let some _ := α.coeTypeSet? | failure
129- let e ← withAppArg delab
130- `(↑$e)
131-
132- end Notation
110+ In practice this is only used for applying the `Set` functor to `Subtype.val`,
111+ as was defined in `Data.Set.Notation`. -/
133112
134- /-- The coercion from `Set.monad` as an instance is equal to the coercion defined above . -/
113+ /-- The coercion from `Set.monad` as an instance is equal to the coercion in `Data.Set.Notation` . -/
135114theorem coe_eq_image_val (t : Set s) :
136115 @Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) := by
137116 change ⋃ (x ∈ t), {x.1 } = _
0 commit comments