l3lab/ntp-mathlib huggingface dataset:
theorem prod_assoc_image {α β γ} {s : Set α} {t : Set β} {u : Set γ} :
    Equiv.prodAssoc α β γ '' (s ×ˢ t) ×ˢ u = s ×ˢ t ×ˢ u := by
  

Proof state:
α✝ : Sort u
β✝ : Sort v
γ✝ : Sort w
α : Type u_1
β : Type u_2
γ : Type u_3
s : Set α
t : Set β
u : Set γ
⊢ ⇑(prodAssoc α β γ) '' (s ×ˢ t) ×ˢ u = s ×ˢ t ×ˢ u

Next tactic:
simpa only [Equiv.image_eq_preimage] using prod_assoc_symm_preimage
theorem prod_assoc_symm_image {α β γ} {s : Set α} {t : Set β} {u : Set γ} :
    (Equiv.prodAssoc α β γ).symm '' s ×ˢ t ×ˢ u = (s ×ˢ t) ×ˢ u := by
  

Proof state:
α✝ : Sort u
β✝ : Sort v
γ✝ : Sort w
α : Type u_1
β : Type u_2
γ : Type u_3
s : Set α
t : Set β
u : Set γ
⊢ ⇑(prodAssoc α β γ).symm '' s ×ˢ t ×ˢ u = (s ×ˢ t) ×ˢ u

Next tactic:
simpa only [Equiv.image_eq_preimage] using prod_assoc_preimage
/-- A set `s` in `α × β` is equivalent to the sigma-type `Σ x, {y | (x, y) ∈ s}`. -/
def setProdEquivSigma {α β : Type*} (s : Set (α × β)) :
    s ≃ Σx : α, { y : β | (x, y) ∈ s } where
  toFun x := ⟨x.1.1, x.1.2, by 

Proof state:
α✝ : Sort u
β✝ : Sort v
γ : Sort w
α : Type u_1
β : Type u_2
s : Set (α × β)
x : ↑s
⊢ (↑x).2 ∈ {y | ((↑x).1, y) ∈ s}

Next tactic:
simp
/-- A set is equivalent to its image under an equivalence.
-/
@[simps]
def image {α β : Type*} (e : α ≃ β) (s : Set α) :
    s ≃ e '' s where
  toFun x := ⟨e x.1, by 

Proof state:
α✝ : Sort u
β✝ : Sort v
γ : Sort w
α : Type u_1
β : Type u_2
e : α ≃ β
s : Set α
x : ↑s
⊢ e ↑x ∈ ⇑e '' s

Next tactic:
simp
/-- A set is equivalent to its image under an equivalence.
-/
@[simps]
def image {α β : Type*} (e : α ≃ β) (s : Set α) :
    s ≃ e '' s where
  toFun x := ⟨e x.1, by simp⟩
  invFun y :=
    ⟨e.symm y.1, by
      

Proof state:
α✝ : Sort u
β✝ : Sort v
γ : Sort w
α : Type u_1
β : Type u_2
e : α ≃ β
s : Set α
y : ↑(⇑e '' s)
⊢ e.symm ↑y ∈ s

Next tactic:
rcases y with ⟨-, ⟨a, ⟨m, rfl⟩⟩⟩
/-- A set is equivalent to its image under an equivalence.
-/
@[simps]
def image {α β : Type*} (e : α ≃ β) (s : Set α) :
    s ≃ e '' s where
  toFun x := ⟨e x.1, by simp⟩
  invFun y :=
    ⟨e.symm y.1, by
      rcases y with ⟨-, ⟨a, ⟨m, rfl⟩⟩⟩
      

Proof state:
case mk.intro.intro
α✝ : Sort u
β✝ : Sort v
γ : Sort w
α : Type u_1
β : Type u_2
e : α ≃ β
s : Set α
a : α
m : a ∈ s
⊢ e.symm ↑{ val := e a, property := (_ : ∃ a_1 ∈ s, e a_1 = e a) } ∈ s

Next tactic:
simpa using m
/-- A set is equivalent to its image under an equivalence.
-/
@[simps]
def image {α β : Type*} (e : α ≃ β) (s : Set α) :
    s ≃ e '' s where
  toFun x := ⟨e x.1, by simp⟩
  invFun y :=
    ⟨e.symm y.1, by
      rcases y with ⟨-, ⟨a, ⟨m, rfl⟩⟩⟩
      simpa using m⟩
  left_inv x := by 

Proof state:
α✝ : Sort u
β✝ : Sort v
γ : Sort w
α : Type u_1
β : Type u_2
e : α ≃ β
s : Set α
x : ↑s
⊢ (fun y => { val := e.symm ↑y, property := (_ : e.symm ↑y ∈ s) })
      ((fun x => { val := e ↑x, property := (_ : e ↑x ∈ ⇑e '' s) }) x) =
    x

Next tactic:
simp
/-- A set is equivalent to its image under an equivalence.
-/
@[simps]
def image {α β : Type*} (e : α ≃ β) (s : Set α) :
    s ≃ e '' s where
  toFun x := ⟨e x.1, by simp⟩
  invFun y :=
    ⟨e.symm y.1, by
      rcases y with ⟨-, ⟨a, ⟨m, rfl⟩⟩⟩
      simpa using m⟩
  left_inv x := by simp
  right_inv y := by 

Proof state:
α✝ : Sort u
β✝ : Sort v
γ : Sort w
α : Type u_1
β : Type u_2
e : α ≃ β
s : Set α
y : ↑(⇑e '' s)
⊢ (fun x => { val := e ↑x, property := (_ : e ↑x ∈ ⇑e '' s) })
      ((fun y => { val := e.symm ↑y, property := (_ : e.symm ↑y ∈ s) }) y) =
    y

Next tactic:
simp
/-- If sets `s` and `t` are separated by a decidable predicate, then `s ∪ t` is equivalent to
`s ⊕ t`. -/
protected def union' {α} {s t : Set α} (p : α → Prop) [DecidablePred p] (hs : ∀ x ∈ s, p x)
    (ht : ∀ x ∈ t, ¬p x) : (s ∪ t : Set α) ≃ s ⊕ t where
  toFun x :=
    if hp : p x then Sum.inl ⟨_, x.2.resolve_right fun xt => ht _ xt hp⟩
    else Sum.inr ⟨_, x.2.resolve_left fun xs => hp (hs _ xs)⟩
  invFun o :=
    match o with
    | Sum.inl x => ⟨x, Or.inl x.2⟩
    | Sum.inr x => ⟨x, Or.inr x.2⟩
  left_inv := fun ⟨x, h'⟩ => by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.13254
s t : Set α
p : α → Prop
inst✝ : DecidablePred p
hs : ∀ x ∈ s, p x
ht : ∀ x ∈ t, ¬p x
x✝ : ↑(s ∪ t)
x : α
h' : x ∈ s ∪ t
⊢ (fun o =>
        match o with
        | Sum.inl x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) }
        | Sum.inr x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) })
      ((fun x =>
          if hp : p ↑x then Sum.inl { val := ↑x, property := (_ : ↑x ∈ s) }
          else Sum.inr { val := ↑x, property := (_ : ↑x ∈ t) })
        { val := x, property := h' }) =
    { val := x, property := h' }

Next tactic:
by_cases h : p x
/-- If sets `s` and `t` are separated by a decidable predicate, then `s ∪ t` is equivalent to
`s ⊕ t`. -/
protected def union' {α} {s t : Set α} (p : α → Prop) [DecidablePred p] (hs : ∀ x ∈ s, p x)
    (ht : ∀ x ∈ t, ¬p x) : (s ∪ t : Set α) ≃ s ⊕ t where
  toFun x :=
    if hp : p x then Sum.inl ⟨_, x.2.resolve_right fun xt => ht _ xt hp⟩
    else Sum.inr ⟨_, x.2.resolve_left fun xs => hp (hs _ xs)⟩
  invFun o :=
    match o with
    | Sum.inl x => ⟨x, Or.inl x.2⟩
    | Sum.inr x => ⟨x, Or.inr x.2⟩
  left_inv := fun ⟨x, h'⟩ => by by_cases h : p x <;> 

Proof state:
case pos
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.13254
s t : Set α
p : α → Prop
inst✝ : DecidablePred p
hs : ∀ x ∈ s, p x
ht : ∀ x ∈ t, ¬p x
x✝ : ↑(s ∪ t)
x : α
h' : x ∈ s ∪ t
h : p x
⊢ (fun o =>
        match o with
        | Sum.inl x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) }
        | Sum.inr x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) })
      ((fun x =>
          if hp : p ↑x then Sum.inl { val := ↑x, property := (_ : ↑x ∈ s) }
          else Sum.inr { val := ↑x, property := (_ : ↑x ∈ t) })
        { val := x, property := h' }) =
    { val := x, property := h' }

Next tactic:
simp [h]
/-- If sets `s` and `t` are separated by a decidable predicate, then `s ∪ t` is equivalent to
`s ⊕ t`. -/
protected def union' {α} {s t : Set α} (p : α → Prop) [DecidablePred p] (hs : ∀ x ∈ s, p x)
    (ht : ∀ x ∈ t, ¬p x) : (s ∪ t : Set α) ≃ s ⊕ t where
  toFun x :=
    if hp : p x then Sum.inl ⟨_, x.2.resolve_right fun xt => ht _ xt hp⟩
    else Sum.inr ⟨_, x.2.resolve_left fun xs => hp (hs _ xs)⟩
  invFun o :=
    match o with
    | Sum.inl x => ⟨x, Or.inl x.2⟩
    | Sum.inr x => ⟨x, Or.inr x.2⟩
  left_inv := fun ⟨x, h'⟩ => by by_cases h : p x <;> 

Proof state:
case neg
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.13254
s t : Set α
p : α → Prop
inst✝ : DecidablePred p
hs : ∀ x ∈ s, p x
ht : ∀ x ∈ t, ¬p x
x✝ : ↑(s ∪ t)
x : α
h' : x ∈ s ∪ t
h : ¬p x
⊢ (fun o =>
        match o with
        | Sum.inl x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) }
        | Sum.inr x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) })
      ((fun x =>
          if hp : p ↑x then Sum.inl { val := ↑x, property := (_ : ↑x ∈ s) }
          else Sum.inr { val := ↑x, property := (_ : ↑x ∈ t) })
        { val := x, property := h' }) =
    { val := x, property := h' }

Next tactic:
simp [h]
/-- If sets `s` and `t` are separated by a decidable predicate, then `s ∪ t` is equivalent to
`s ⊕ t`. -/
protected def union' {α} {s t : Set α} (p : α → Prop) [DecidablePred p] (hs : ∀ x ∈ s, p x)
    (ht : ∀ x ∈ t, ¬p x) : (s ∪ t : Set α) ≃ s ⊕ t where
  toFun x :=
    if hp : p x then Sum.inl ⟨_, x.2.resolve_right fun xt => ht _ xt hp⟩
    else Sum.inr ⟨_, x.2.resolve_left fun xs => hp (hs _ xs)⟩
  invFun o :=
    match o with
    | Sum.inl x => ⟨x, Or.inl x.2⟩
    | Sum.inr x => ⟨x, Or.inr x.2⟩
  left_inv := fun ⟨x, h'⟩ => by by_cases h : p x <;> simp [h]
  right_inv o := by
    

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.13254
s t : Set α
p : α → Prop
inst✝ : DecidablePred p
hs : ∀ x ∈ s, p x
ht : ∀ x ∈ t, ¬p x
o : ↑s ⊕ ↑t
⊢ (fun x =>
        if hp : p ↑x then Sum.inl { val := ↑x, property := (_ : ↑x ∈ s) }
        else Sum.inr { val := ↑x, property := (_ : ↑x ∈ t) })
      ((fun o =>
          match o with
          | Sum.inl x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) }
          | Sum.inr x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) })
        o) =
    o

Next tactic:
rcases o with (⟨x, h⟩ | ⟨x, h⟩) <;> [simp [hs _ h]; simp [ht _ h]]
/-- If sets `s` and `t` are separated by a decidable predicate, then `s ∪ t` is equivalent to
`s ⊕ t`. -/
protected def union' {α} {s t : Set α} (p : α → Prop) [DecidablePred p] (hs : ∀ x ∈ s, p x)
    (ht : ∀ x ∈ t, ¬p x) : (s ∪ t : Set α) ≃ s ⊕ t where
  toFun x :=
    if hp : p x then Sum.inl ⟨_, x.2.resolve_right fun xt => ht _ xt hp⟩
    else Sum.inr ⟨_, x.2.resolve_left fun xs => hp (hs _ xs)⟩
  invFun o :=
    match o with
    | Sum.inl x => ⟨x, Or.inl x.2⟩
    | Sum.inr x => ⟨x, Or.inr x.2⟩
  left_inv := fun ⟨x, h'⟩ => by by_cases h : p x <;> simp [h]
  right_inv o := by
    

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.13254
s t : Set α
p : α → Prop
inst✝ : DecidablePred p
hs : ∀ x ∈ s, p x
ht : ∀ x ∈ t, ¬p x
o : ↑s ⊕ ↑t
⊢ (fun x =>
        if hp : p ↑x then Sum.inl { val := ↑x, property := (_ : ↑x ∈ s) }
        else Sum.inr { val := ↑x, property := (_ : ↑x ∈ t) })
      ((fun o =>
          match o with
          | Sum.inl x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) }
          | Sum.inr x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) })
        o) =
    o

Next tactic:
rcases o with (⟨x, h⟩ | ⟨x, h⟩)
/-- If sets `s` and `t` are separated by a decidable predicate, then `s ∪ t` is equivalent to
`s ⊕ t`. -/
protected def union' {α} {s t : Set α} (p : α → Prop) [DecidablePred p] (hs : ∀ x ∈ s, p x)
    (ht : ∀ x ∈ t, ¬p x) : (s ∪ t : Set α) ≃ s ⊕ t where
  toFun x :=
    if hp : p x then Sum.inl ⟨_, x.2.resolve_right fun xt => ht _ xt hp⟩
    else Sum.inr ⟨_, x.2.resolve_left fun xs => hp (hs _ xs)⟩
  invFun o :=
    match o with
    | Sum.inl x => ⟨x, Or.inl x.2⟩
    | Sum.inr x => ⟨x, Or.inr x.2⟩
  left_inv := fun ⟨x, h'⟩ => by by_cases h : p x <;> simp [h]
  right_inv o := by
    rcases o with (⟨x, h⟩ | ⟨x, h⟩) <;> [

Proof state:
case inl.mk
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.13254
s t : Set α
p : α → Prop
inst✝ : DecidablePred p
hs : ∀ x ∈ s, p x
ht : ∀ x ∈ t, ¬p x
x : α
h : x ∈ s
⊢ (fun x =>
        if hp : p ↑x then Sum.inl { val := ↑x, property := (_ : ↑x ∈ s) }
        else Sum.inr { val := ↑x, property := (_ : ↑x ∈ t) })
      ((fun o =>
          match o with
          | Sum.inl x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) }
          | Sum.inr x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) })
        (Sum.inl { val := x, property := h })) =
    Sum.inl { val := x, property := h }

Next tactic:
simp [hs _ h]
/-- If sets `s` and `t` are separated by a decidable predicate, then `s ∪ t` is equivalent to
`s ⊕ t`. -/
protected def union' {α} {s t : Set α} (p : α → Prop) [DecidablePred p] (hs : ∀ x ∈ s, p x)
    (ht : ∀ x ∈ t, ¬p x) : (s ∪ t : Set α) ≃ s ⊕ t where
  toFun x :=
    if hp : p x then Sum.inl ⟨_, x.2.resolve_right fun xt => ht _ xt hp⟩
    else Sum.inr ⟨_, x.2.resolve_left fun xs => hp (hs _ xs)⟩
  invFun o :=
    match o with
    | Sum.inl x => ⟨x, Or.inl x.2⟩
    | Sum.inr x => ⟨x, Or.inr x.2⟩
  left_inv := fun ⟨x, h'⟩ => by by_cases h : p x <;> simp [h]
  right_inv o := by
    rcases o with (⟨x, h⟩ | ⟨x, h⟩) <;> [simp [hs _ h]; 

Proof state:
case inr.mk
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.13254
s t : Set α
p : α → Prop
inst✝ : DecidablePred p
hs : ∀ x ∈ s, p x
ht : ∀ x ∈ t, ¬p x
x : α
h : x ∈ t
⊢ (fun x =>
        if hp : p ↑x then Sum.inl { val := ↑x, property := (_ : ↑x ∈ s) }
        else Sum.inr { val := ↑x, property := (_ : ↑x ∈ t) })
      ((fun o =>
          match o with
          | Sum.inl x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) }
          | Sum.inr x => { val := ↑x, property := (_ : ↑x ∈ s ∨ ↑x ∈ t) })
        (Sum.inr { val := x, property := h })) =
    Sum.inr { val := x, property := h }

Next tactic:
simp [ht _ h]
/-- A singleton set is equivalent to a `PUnit` type. -/
protected def singleton {α} (a : α) : ({a} : Set α) ≃ PUnit.{u} :=
  ⟨fun _ => PUnit.unit, fun _ => ⟨a, mem_singleton _⟩, fun ⟨x, h⟩ => by
    

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.19785
a : α
x✝ : ↑{a}
x : α
h : x ∈ {a}
⊢ (fun x => { val := a, property := (_ : a ∈ {a}) }) ((fun x => PUnit.unit) { val := x, property := h }) =
    { val := x, property := h }

Next tactic:
simp? at h says simp only [mem_singleton_iff] at h
/-- A singleton set is equivalent to a `PUnit` type. -/
protected def singleton {α} (a : α) : ({a} : Set α) ≃ PUnit.{u} :=
  ⟨fun _ => PUnit.unit, fun _ => ⟨a, mem_singleton _⟩, fun ⟨x, h⟩ => by
    simp? at h says 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.19785
a : α
x✝ : ↑{a}
x : α
h : x ∈ {a}
⊢ (fun x => { val := a, property := (_ : a ∈ {a}) }) ((fun x => PUnit.unit) { val := x, property := h }) =
    { val := x, property := h }

Next tactic:
simp only [mem_singleton_iff] at h
/-- A singleton set is equivalent to a `PUnit` type. -/
protected def singleton {α} (a : α) : ({a} : Set α) ≃ PUnit.{u} :=
  ⟨fun _ => PUnit.unit, fun _ => ⟨a, mem_singleton _⟩, fun ⟨x, h⟩ => by
    simp? at h says simp only [mem_singleton_iff] at h
    

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.19785
a : α
x✝ : ↑{a}
x : α
h✝ : x ∈ {a}
h : x = a
⊢ (fun x => { val := a, property := (_ : a ∈ {a}) }) ((fun x => PUnit.unit) { val := x, property := h✝ }) =
    { val := x, property := h✝ }

Next tactic:
subst x
/-- A singleton set is equivalent to a `PUnit` type. -/
protected def singleton {α} (a : α) : ({a} : Set α) ≃ PUnit.{u} :=
  ⟨fun _ => PUnit.unit, fun _ => ⟨a, mem_singleton _⟩, fun ⟨x, h⟩ => by
    simp? at h says simp only [mem_singleton_iff] at h
    subst x
    

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.19785
a : α
x✝ : ↑{a}
h : a = a
⊢ (fun x => { val := a, property := (_ : a ∈ {a}) }) ((fun x => PUnit.unit) { val := a, property := (_ : a = a) }) =
    { val := a, property := (_ : a = a) }

Next tactic:
rfl
/-- If `a ∉ s`, then `insert a s` is equivalent to `s ⊕ PUnit`. -/
protected def insert {α} {s : Set.{u} α} [DecidablePred (· ∈ s)] {a : α} (H : a ∉ s) :
    (insert a s : Set α) ≃ Sum s PUnit.{u + 1} :=
  calc
    (insert a s : Set α) ≃ ↥(s ∪ {a}) := Equiv.Set.ofEq (by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
a : α
H : a ∉ s
⊢ insert a s = s ∪ {a}

Next tactic:
simp
/-- If `a ∉ s`, then `insert a s` is equivalent to `s ⊕ PUnit`. -/
protected def insert {α} {s : Set.{u} α} [DecidablePred (· ∈ s)] {a : α} (H : a ∉ s) :
    (insert a s : Set α) ≃ Sum s PUnit.{u + 1} :=
  calc
    (insert a s : Set α) ≃ ↥(s ∪ {a}) := Equiv.Set.ofEq (by simp)
    _ ≃ Sum s ({a} : Set α) := Equiv.Set.union fun x ⟨hx, _⟩ => by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
a : α
H : a ∉ s
x : α
x✝ : x ∈ s ∩ {a}
hx : x ∈ s
right✝ : x ∈ {a}
⊢ x ∈ ∅

Next tactic:
simp_all
/-- If `s : Set α` is a set with decidable membership, then `s ⊕ sᶜ` is equivalent to `α`. -/
protected def sumCompl {α} (s : Set α) [DecidablePred (· ∈ s)] : Sum s (sᶜ : Set α) ≃ α :=
  calc
    Sum s (sᶜ : Set α) ≃ ↥(s ∪ sᶜ) := (Equiv.Set.union (by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.24052
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
⊢ s ∩ sᶜ ⊆ ∅

Next tactic:
simp [Set.ext_iff]
/-- If `s : Set α` is a set with decidable membership, then `s ⊕ sᶜ` is equivalent to `α`. -/
protected def sumCompl {α} (s : Set α) [DecidablePred (· ∈ s)] : Sum s (sᶜ : Set α) ≃ α :=
  calc
    Sum s (sᶜ : Set α) ≃ ↥(s ∪ sᶜ) := (Equiv.Set.union (by simp [Set.ext_iff])).symm
    _ ≃ @univ α := Equiv.Set.ofEq (by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.24052
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
⊢ s ∪ sᶜ = univ

Next tactic:
simp
theorem sumCompl_symm_apply_of_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∈ s) : (Equiv.Set.sumCompl s).symm x = Sum.inl ⟨x, hx⟩ := by
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∈ s
⊢ (Set.sumCompl s).symm x = Sum.inl { val := x, property := hx }

Next tactic:
have : ((⟨x, Or.inl hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ s := hx
theorem sumCompl_symm_apply_of_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∈ s) : (Equiv.Set.sumCompl s).symm x = Sum.inl ⟨x, hx⟩ := by
  have : ((⟨x, Or.inl hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ s := hx
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∈ s
this : ↑{ val := x, property := (_ : x ∈ s ∨ x ∈ sᶜ) } ∈ s
⊢ (Set.sumCompl s).symm x = Sum.inl { val := x, property := hx }

Next tactic:
rw [Equiv.Set.sumCompl]
theorem sumCompl_symm_apply_of_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∈ s) : (Equiv.Set.sumCompl s).symm x = Sum.inl ⟨x, hx⟩ := by
  have : ((⟨x, Or.inl hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ s := hx
  rw [Equiv.Set.sumCompl]
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∈ s
this : ↑{ val := x, property := (_ : x ∈ s ∨ x ∈ sᶜ) } ∈ s
⊢ (Trans.trans (Trans.trans (Set.union (_ : s ∩ sᶜ ⊆ ∅)).symm (Set.ofEq (_ : s ∪ sᶜ = univ))) (Set.univ α)).symm x =
    Sum.inl { val := x, property := hx }

Next tactic:
simpa using Set.union_apply_left (by simp) this
theorem sumCompl_symm_apply_of_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∈ s) : (Equiv.Set.sumCompl s).symm x = Sum.inl ⟨x, hx⟩ := by
  have : ((⟨x, Or.inl hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ s := hx
  rw [Equiv.Set.sumCompl]
  simpa using Set.union_apply_left (by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∈ s
this : ↑{ val := x, property := (_ : x ∈ s ∨ x ∈ sᶜ) } ∈ s
⊢ s ∩ sᶜ ⊆ ∅

Next tactic:
simp
theorem sumCompl_symm_apply_of_not_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∉ s) : (Equiv.Set.sumCompl s).symm x = Sum.inr ⟨x, hx⟩ := by
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∉ s
⊢ (Set.sumCompl s).symm x = Sum.inr { val := x, property := hx }

Next tactic:
have : ((⟨x, Or.inr hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ sᶜ := hx
theorem sumCompl_symm_apply_of_not_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∉ s) : (Equiv.Set.sumCompl s).symm x = Sum.inr ⟨x, hx⟩ := by
  have : ((⟨x, Or.inr hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ sᶜ := hx
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∉ s
this : ↑{ val := x, property := (_ : x ∈ s ∨ x ∈ sᶜ) } ∈ sᶜ
⊢ (Set.sumCompl s).symm x = Sum.inr { val := x, property := hx }

Next tactic:
rw [Equiv.Set.sumCompl]
theorem sumCompl_symm_apply_of_not_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∉ s) : (Equiv.Set.sumCompl s).symm x = Sum.inr ⟨x, hx⟩ := by
  have : ((⟨x, Or.inr hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ sᶜ := hx
  rw [Equiv.Set.sumCompl]
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∉ s
this : ↑{ val := x, property := (_ : x ∈ s ∨ x ∈ sᶜ) } ∈ sᶜ
⊢ (Trans.trans (Trans.trans (Set.union (_ : s ∩ sᶜ ⊆ ∅)).symm (Set.ofEq (_ : s ∪ sᶜ = univ))) (Set.univ α)).symm x =
    Sum.inr { val := x, property := hx }

Next tactic:
simpa using Set.union_apply_right (by simp) this
theorem sumCompl_symm_apply_of_not_mem {α : Type u} {s : Set α} [DecidablePred (· ∈ s)] {x : α}
    (hx : x ∉ s) : (Equiv.Set.sumCompl s).symm x = Sum.inr ⟨x, hx⟩ := by
  have : ((⟨x, Or.inr hx⟩ : (s ∪ sᶜ : Set α)) : α) ∈ sᶜ := hx
  rw [Equiv.Set.sumCompl]
  simpa using Set.union_apply_right (by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∉ s
this : ↑{ val := x, property := (_ : x ∈ s ∨ x ∈ sᶜ) } ∈ sᶜ
⊢ s ∩ sᶜ ⊆ ∅

Next tactic:
simp
@[simp]
theorem sumCompl_symm_apply {α : Type*} {s : Set α} [DecidablePred (· ∈ s)] {x : s} :
    (Equiv.Set.sumCompl s).symm x = Sum.inl x := by
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u_1
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : ↑s
⊢ (Set.sumCompl s).symm ↑x = Sum.inl x

Next tactic:
cases' x with x hx
@[simp]
theorem sumCompl_symm_apply {α : Type*} {s : Set α} [DecidablePred (· ∈ s)] {x : s} :
    (Equiv.Set.sumCompl s).symm x = Sum.inl x := by
  cases' x with x hx; 

Proof state:
case mk
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u_1
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∈ s
⊢ (Set.sumCompl s).symm ↑{ val := x, property := hx } = Sum.inl { val := x, property := hx }

Next tactic:
exact Set.sumCompl_symm_apply_of_mem hx
@[simp]
theorem sumCompl_symm_apply_compl {α : Type*} {s : Set α} [DecidablePred (· ∈ s)]
    {x : (sᶜ : Set α)} : (Equiv.Set.sumCompl s).symm x = Sum.inr x := by
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u_1
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : ↑sᶜ
⊢ (Set.sumCompl s).symm ↑x = Sum.inr x

Next tactic:
cases' x with x hx
@[simp]
theorem sumCompl_symm_apply_compl {α : Type*} {s : Set α} [DecidablePred (· ∈ s)]
    {x : (sᶜ : Set α)} : (Equiv.Set.sumCompl s).symm x = Sum.inr x := by
  cases' x with x hx; 

Proof state:
case mk
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u_1
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
x : α
hx : x ∈ sᶜ
⊢ (Set.sumCompl s).symm ↑{ val := x, property := hx } = Sum.inr { val := x, property := hx }

Next tactic:
exact Set.sumCompl_symm_apply_of_not_mem hx
/-- `sumDiffSubset s t` is the natural equivalence between
`s ⊕ (t \ s)` and `t`, where `s` and `t` are two sets. -/
protected def sumDiffSubset {α} {s t : Set α} (h : s ⊆ t) [DecidablePred (· ∈ s)] :
    Sum s (t \ s : Set α) ≃ t :=
  calc
    Sum s (t \ s : Set α) ≃ (s ∪ t \ s : Set α) :=
      (Equiv.Set.union (by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.31630
s t : Set α
h : s ⊆ t
inst✝ : DecidablePred fun x => x ∈ s
⊢ s ∩ (t \ s) ⊆ ∅

Next tactic:
simp [inter_diff_self]
/-- `sumDiffSubset s t` is the natural equivalence between
`s ⊕ (t \ s)` and `t`, where `s` and `t` are two sets. -/
protected def sumDiffSubset {α} {s t : Set α} (h : s ⊆ t) [DecidablePred (· ∈ s)] :
    Sum s (t \ s : Set α) ≃ t :=
  calc
    Sum s (t \ s : Set α) ≃ (s ∪ t \ s : Set α) :=
      (Equiv.Set.union (by simp [inter_diff_self])).symm
    _ ≃ t := Equiv.Set.ofEq (by 

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type ?u.31630
s t : Set α
h : s ⊆ t
inst✝ : DecidablePred fun x => x ∈ s
⊢ s ∪ t \ s = t

Next tactic:
simp [union_diff_self, union_eq_self_of_subset_left h]
theorem sumDiffSubset_symm_apply_of_mem {α} {s t : Set α} (h : s ⊆ t) [DecidablePred (· ∈ s)]
    {x : t} (hx : x.1 ∈ s) : (Equiv.Set.sumDiffSubset h).symm x = Sum.inl ⟨x, hx⟩ := by
  

Proof state:
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u_1
s t : Set α
h : s ⊆ t
inst✝ : DecidablePred fun x => x ∈ s
x : ↑t
hx : ↑x ∈ s
⊢ (Set.sumDiffSubset h).symm x = Sum.inl { val := ↑x, property := hx }

Next tactic:
apply (Equiv.Set.sumDiffSubset h).injective
theorem sumDiffSubset_symm_apply_of_mem {α} {s t : Set α} (h : s ⊆ t) [DecidablePred (· ∈ s)]
    {x : t} (hx : x.1 ∈ s) : (Equiv.Set.sumDiffSubset h).symm x = Sum.inl ⟨x, hx⟩ := by
  apply (Equiv.Set.sumDiffSubset h).injective
  

Proof state:
case a
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u_1
s t : Set α
h : s ⊆ t
inst✝ : DecidablePred fun x => x ∈ s
x : ↑t
hx : ↑x ∈ s
⊢ (Set.sumDiffSubset h) ((Set.sumDiffSubset h).symm x) = (Set.sumDiffSubset h) (Sum.inl { val := ↑x, property := hx })

Next tactic:
simp only [apply_symm_apply, sumDiffSubset_apply_inl]
theorem sumDiffSubset_symm_apply_of_mem {α} {s t : Set α} (h : s ⊆ t) [DecidablePred (· ∈ s)]
    {x : t} (hx : x.1 ∈ s) : (Equiv.Set.sumDiffSubset h).symm x = Sum.inl ⟨x, hx⟩ := by
  apply (Equiv.Set.sumDiffSubset h).injective
  simp only [apply_symm_apply, sumDiffSubset_apply_inl]
  

Proof state:
case a
α✝ : Sort u
β : Sort v
γ : Sort w
α : Type u_1
s t : Set α
h : s ⊆ t
inst✝ : DecidablePred fun x => x ∈ s
x : ↑t
hx : ↑x ∈ s
⊢ x = inclusion h { val := ↑x, property := hx }

Next tactic:
exact Subtype.eq rfl