Skip to content

Commit

Permalink
chore(logic/equiv/set): golf definition (#14284)
Browse files Browse the repository at this point in the history
I've no idea which name is better; for now, let's at least not implement the same function twice.
  • Loading branch information
eric-wieser committed May 22, 2022
1 parent 60897e3 commit dcb3cb1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/logic/equiv/set.lean
Expand Up @@ -217,13 +217,12 @@ protected def singleton {α} (a : α) : ({a} : set α) ≃ punit.{u} :=
λ ⟨x, h⟩, by { simp at h, subst x },
λ ⟨⟩, rfl⟩

/-- Equal sets are equivalent. -/
/-- Equal sets are equivalent.
TODO: this is the same as `equiv.set_congr`! -/
@[simps apply symm_apply]
protected def of_eq {α : Type u} {s t : set α} (h : s = t) : s ≃ t :=
{ to_fun := λ x, ⟨x, h ▸ x.2⟩,
inv_fun := λ x, ⟨x, h.symm ▸ x.2⟩,
left_inv := λ _, subtype.eq rfl,
right_inv := λ _, subtype.eq rfl }
equiv.set_congr h

/-- If `a ∉ s`, then `insert a s` is equivalent to `s ⊕ punit`. -/
protected def insert {α} {s : set.{u} α} [decidable_pred (∈ s)] {a : α} (H : a ∉ s) :
Expand Down

0 comments on commit dcb3cb1

Please sign in to comment.