/-- Equivalences between `Option α` and `β` that send `none` to `x` are equivalent to
equivalences between `α` and `{y : β // y ≠ x}`. -/
def optionSubtype [DecidableEq β] (x : β) :
    { e : Option α ≃ β // e none = x } ≃ (α ≃ { y : β // y ≠ x }) where
  toFun e :=
    { toFun := fun a =>
        ⟨(e : Option α ≃ β) a, ((EquivLike.injective _).ne_iff' e.property).2 (some_ne_none _)⟩,
      invFun := fun b =>
        get _
          (ne_none_iff_isSome.1
            (((EquivLike.injective _).ne_iff'
              ((apply_eq_iff_eq_symm_apply _).1 e.property).symm).2 b.property)),
      left_inv := fun a => by
        rw [← some_inj, some_get]
        exact symm_apply_apply (e : Option α ≃ β) a,
      right_inv := fun b => by
        ext
        simp }
  invFun e :=
    ⟨{  toFun := fun a => casesOn' a x (Subtype.val ∘ e),
        invFun := fun b => if h : b = x then none else e.symm ⟨b, h⟩,
        left_inv := fun a => by
          cases a with
          | none => simp
          | some a =>
            simp only [casesOn'_some, Function.comp_apply, Subtype.coe_eta,
              symm_apply_apply, dite_eq_ite]
            exact if_neg (e a).property,
        right_inv := fun b => by
          by_cases h : b = x <;> simp [h] },
      rfl⟩
  left_inv e := by
    ext a
    cases a
    · simpa using e.property.symm
    -- Porting note: this cases had been by `simpa`,
    -- but `simp` here is mysteriously slow, even after squeezing.
    -- `rfl` closes the goal quickly, so we use that.
    · rfl
  right_inv e := by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
x : β
e : α ≃ { y // y ≠ x }
⊢ (fun e =>
        { toFun := fun a => { val := ↑e (some a), property := (_ : ↑e (some a) ≠ x) },
          invFun := fun b => Option.get ((↑e).symm ↑b) (_ : isSome ((↑e).symm ↑b) = true),
          left_inv :=
            (_ :
              ∀ (a : α),
                (fun b => Option.get ((↑e).symm ↑b) (_ : isSome ((↑e).symm ↑b) = true))
                    ((fun a => { val := ↑e (some a), property := (_ : ↑e (some a) ≠ x) }) a) =
                  a),
          right_inv :=
            (_ :
              ∀ (b : { y // y ≠ x }),
                (fun a => { val := ↑e (some a), property := (_ : ↑e (some a) ≠ x) })
                    ((fun b => Option.get ((↑e).symm ↑b) (_ : isSome ((↑e).symm ↑b) = true)) b) =
                  b) })
      ((fun e =>
          {
            val :=
              { toFun := fun a => casesOn' a x (Subtype.val ∘ ⇑e),
                invFun := fun b => if h : b = x then none else some (e.symm { val := b, property := h }),
                left_inv :=
                  (_ :
                    ∀ (a : Option α),
                      (fun b => if h : b = x then none else some (e.symm { val := b, property := h }))
                          ((fun a => casesOn' a x (Subtype.val ∘ ⇑e)) a) =
                        a),
                right_inv :=
                  (_ :
                    ∀ (b : β),
                      (fun a => casesOn' a x (Subtype.val ∘ ⇑e))
                          ((fun b => if h : b = x then none else some (e.symm { val := b, property := h })) b) =
                        b) },
            property :=
              (_ :
                { toFun := fun a => casesOn' a x (Subtype.val ∘ ⇑e),
                      invFun := fun b => if h : b = x then none else some (e.symm { val := b, property := h }),
                      left_inv :=
                        (_ :
                          ∀ (a : Option α),
                            (fun b => if h : b = x then none else some (e.symm { val := b, property := h }))
                                ((fun a => casesOn' a x (Subtype.val ∘ ⇑e)) a) =
                              a),
                      right_inv :=
                        (_ :
                          ∀ (b : β),
                            (fun a => casesOn' a x (Subtype.val ∘ ⇑e))
                                ((fun b => if h : b = x then none else some (e.symm { val := b, property := h })) b) =
                              b) }
                    none =
                  { toFun := fun a => casesOn' a x (Subtype.val ∘ ⇑e),
                      invFun := fun b => if h : b = x then none else some (e.symm { val := b, property := h }),
                      left_inv :=
                        (_ :
                          ∀ (a : Option α),
                            (fun b => if h : b = x then none else some (e.symm { val := b, property := h }))
                                ((fun a => casesOn' a x (Subtype.val ∘ ⇑e)) a) =
                              a),
                      right_inv :=
                        (_ :
                          ∀ (b : β),
                            (fun a => casesOn' a x (Subtype.val ∘ ⇑e))
                                ((fun b => if h : b = x then none else some (e.symm { val := b, property := h })) b) =
                              b) }
                    none) })
        e) =
    e

Next tactic:
ext a