l3lab/ntp-mathlib huggingface dataset:
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
    x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
x : Option α
f : α → Option β
b : β
⊢ Option.bind x f = some b ↔ ∃ a, x = some a ∧ f a = some b

Next tactic:
cases x
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
    x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b :=
  by cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
f : α → Option β
b : β
⊢ Option.bind none f = some b ↔ ∃ a, none = some a ∧ f a = some b

Next tactic:
simp
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} :
    x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b :=
  by cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
f : α → Option β
b : β
val✝ : α
⊢ Option.bind (some val✝) f = some b ↔ ∃ a, some val✝ = some a ∧ f a = some b

Next tactic:
simp
theorem bind_eq_none' {o : Option α} {f : α → Option β} :
    o.bind f = none ↔ ∀ b a, a ∈ o → b ∉ f a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
o : Option α
f : α → Option β
⊢ Option.bind o f = none ↔ ∀ (b : β) (a : α), a ∈ o → ¬b ∈ f a

Next tactic:
simp only [eq_none_iff_forall_not_mem, mem_def, bind_eq_some, not_exists, not_and]
/-- `Option.map` as a function between functions is injective. -/
theorem map_injective' : Function.Injective (@Option.map α β) := fun f g h ↦
  funext fun x ↦ some_injective _ <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
f g : α → β
h : Option.map f = Option.map g
x : α
⊢ some (f x) = some (g x)

Next tactic:
simp only [← map_some', h]
theorem map_comm {f₁ : α → β} {f₂ : α → γ} {g₁ : β → δ} {g₂ : γ → δ} (h : g₁ ∘ f₁ = g₂ ∘ f₂)
    (a : α) :
    (Option.map f₁ a).map g₁ = (Option.map f₂ a).map g₂ := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
f₁ : α → β
f₂ : α → γ
g₁ : β → δ
g₂ : γ → δ
h : g₁ ∘ f₁ = g₂ ∘ f₂
a : α
⊢ Option.map g₁ (Option.map f₁ (some a)) = Option.map g₂ (Option.map f₂ (some a))

Next tactic:
rw [map_map, h, ← map_map]
theorem pbind_eq_bind (f : α → Option β) (x : Option α) : (x.pbind fun a _ ↦ f a) = x.bind f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x✝ : Option α
f : α → Option β
x : Option α
⊢ (pbind x fun a x => f a) = Option.bind x f

Next tactic:
cases x
theorem pbind_eq_bind (f : α → Option β) (x : Option α) : (x.pbind fun a _ ↦ f a) = x.bind f := by
  cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : α → Option β
⊢ (pbind none fun a x => f a) = Option.bind none f

Next tactic:
simp only [pbind, none_bind', some_bind']
theorem pbind_eq_bind (f : α → Option β) (x : Option α) : (x.pbind fun a _ ↦ f a) = x.bind f := by
  cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : α → Option β
val✝ : α
⊢ (pbind (some val✝) fun a x => f a) = Option.bind (some val✝) f

Next tactic:
simp only [pbind, none_bind', some_bind']
theorem map_bind {α β γ} (f : β → γ) (x : Option α) (g : α → Option β) :
    Option.map f (x >>= g) = x >>= fun a ↦ Option.map f (g a) := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ✝ : Type u_3
δ : Type u_4
p : α✝ → Prop
f✝ : (a : α✝) → p a → β✝
x✝ : Option α✝
α β γ : Type u_5
f : β → γ
x : Option α
g : α → Option β
⊢ Option.map f (x >>= g) = do
    let a ← x
    Option.map f (g a)

Next tactic:
simp only [← map_eq_map, ← bind_pure_comp, LawfulMonad.bind_assoc]
theorem map_bind' (f : β → γ) (x : Option α) (g : α → Option β) :
    Option.map f (x.bind g) = x.bind fun a ↦ Option.map f (g a) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x✝ : Option α
f : β → γ
x : Option α
g : α → Option β
⊢ Option.map f (Option.bind x g) = Option.bind x fun a => Option.map f (g a)

Next tactic:
cases x
theorem map_bind' (f : β → γ) (x : Option α) (g : α → Option β) :
    Option.map f (x.bind g) = x.bind fun a ↦ Option.map f (g a) := by cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : β → γ
g : α → Option β
⊢ Option.map f (Option.bind none g) = Option.bind none fun a => Option.map f (g a)

Next tactic:
simp
theorem map_bind' (f : β → γ) (x : Option α) (g : α → Option β) :
    Option.map f (x.bind g) = x.bind fun a ↦ Option.map f (g a) := by cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : β → γ
g : α → Option β
val✝ : α
⊢ Option.map f (Option.bind (some val✝) g) = Option.bind (some val✝) fun a => Option.map f (g a)

Next tactic:
simp
theorem map_pbind (f : β → γ) (x : Option α) (g : ∀ a, a ∈ x → Option β) :
    Option.map f (x.pbind g) = x.pbind fun a H ↦ Option.map f (g a H) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x✝ : Option α
f : β → γ
x : Option α
g : (a : α) → a ∈ x → Option β
⊢ Option.map f (pbind x g) = pbind x fun a H => Option.map f (g a H)

Next tactic:
cases x
theorem map_pbind (f : β → γ) (x : Option α) (g : ∀ a, a ∈ x → Option β) :
    Option.map f (x.pbind g) = x.pbind fun a H ↦ Option.map f (g a H) := by
  cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : β → γ
g : (a : α) → a ∈ none → Option β
⊢ Option.map f (pbind none g) = pbind none fun a H => Option.map f (g a H)

Next tactic:
simp only [pbind, map_none']
theorem map_pbind (f : β → γ) (x : Option α) (g : ∀ a, a ∈ x → Option β) :
    Option.map f (x.pbind g) = x.pbind fun a H ↦ Option.map f (g a H) := by
  cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : β → γ
val✝ : α
g : (a : α) → a ∈ some val✝ → Option β
⊢ Option.map f (pbind (some val✝) g) = pbind (some val✝) fun a H => Option.map f (g a H)

Next tactic:
simp only [pbind, map_none']
theorem pbind_map (f : α → β) (x : Option α) (g : ∀ b : β, b ∈ x.map f → Option γ) :
    pbind (Option.map f x) g = x.pbind fun a h ↦ g (f a) (mem_map_of_mem _ h) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x✝ : Option α
f : α → β
x : Option α
g : (b : β) → b ∈ Option.map f x → Option γ
⊢ pbind (Option.map f x) g = pbind x fun a h => g (f a) (_ : f a ∈ Option.map f x)

Next tactic:
cases x
theorem pbind_map (f : α → β) (x : Option α) (g : ∀ b : β, b ∈ x.map f → Option γ) :
    pbind (Option.map f x) g = x.pbind fun a h ↦ g (f a) (mem_map_of_mem _ h) := by cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : α → β
g : (b : β) → b ∈ Option.map f none → Option γ
⊢ pbind (Option.map f none) g = pbind none fun a h => g (f a) (_ : f a ∈ Option.map f none)

Next tactic:
rfl
theorem pbind_map (f : α → β) (x : Option α) (g : ∀ b : β, b ∈ x.map f → Option γ) :
    pbind (Option.map f x) g = x.pbind fun a h ↦ g (f a) (mem_map_of_mem _ h) := by cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : α → β
val✝ : α
g : (b : β) → b ∈ Option.map f (some val✝) → Option γ
⊢ pbind (Option.map f (some val✝)) g = pbind (some val✝) fun a h => g (f a) (_ : f a ∈ Option.map f (some val✝))

Next tactic:
rfl
theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
x : Option α
a : α
h : ∀ (a : α), a ∈ x → p a
ha : a ∈ x
⊢ f a (_ : p a) ∈ pmap f x h

Next tactic:
rw [mem_def] at ha ⊢
theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
  rw [mem_def] at ha ⊢
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
x : Option α
a : α
h : ∀ (a : α), a ∈ x → p a
ha✝ : a ∈ x
ha : x = some a
⊢ pmap f x h = some (f a (_ : p a))

Next tactic:
subst ha
theorem mem_pmem {a : α} (h : ∀ a ∈ x, p a) (ha : a ∈ x) : f a (h a ha) ∈ pmap f x h := by
  rw [mem_def] at ha ⊢
  subst ha
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
a : α
h : ∀ (a_1 : α), a_1 ∈ some a → p a_1
ha : a ∈ some a
⊢ pmap f (some a) h = some (f a (_ : p a))

Next tactic:
rfl
theorem pmap_map (g : γ → α) (x : Option γ) (H) :
    pmap f (x.map g) H = pmap (fun a h ↦ f (g a) h) x fun a h ↦ H _ (mem_map_of_mem _ h) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
x✝ : Option α
g : γ → α
x : Option γ
H : ∀ (a : α), a ∈ Option.map g x → p a
⊢ pmap f (Option.map g x) H = pmap (fun a h => f (g a) h) x (_ : ∀ (a : γ), a ∈ x → p (g a))

Next tactic:
cases x
theorem pmap_map (g : γ → α) (x : Option γ) (H) :
    pmap f (x.map g) H = pmap (fun a h ↦ f (g a) h) x fun a h ↦ H _ (mem_map_of_mem _ h) := by
  cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
x : Option α
g : γ → α
H : ∀ (a : α), a ∈ Option.map g none → p a
⊢ pmap f (Option.map g none) H = pmap (fun a h => f (g a) h) none (_ : ∀ (a : γ), a ∈ none → p (g a))

Next tactic:
simp only [map_none', map_some', pmap]
theorem pmap_map (g : γ → α) (x : Option γ) (H) :
    pmap f (x.map g) H = pmap (fun a h ↦ f (g a) h) x fun a h ↦ H _ (mem_map_of_mem _ h) := by
  cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
x : Option α
g : γ → α
val✝ : γ
H : ∀ (a : α), a ∈ Option.map g (some val✝) → p a
⊢ pmap f (Option.map g (some val✝)) H = pmap (fun a h => f (g a) h) (some val✝) (_ : ∀ (a : γ), a ∈ some val✝ → p (g a))

Next tactic:
simp only [map_none', map_some', pmap]
theorem map_pmap (g : β → γ) (f : ∀ a, p a → β) (x H) :
    Option.map g (pmap f x H) = pmap (fun a h ↦ g (f a h)) x H :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x✝ : Option α
g : β → γ
f : (a : α) → p a → β
x : Option α
H : ∀ (a : α), a ∈ x → p a
⊢ Option.map g (pmap f x H) = pmap (fun a h => g (f a h)) x H

Next tactic:
cases x
theorem map_pmap (g : β → γ) (f : ∀ a, p a → β) (x H) :
    Option.map g (pmap f x H) = pmap (fun a h ↦ g (f a h)) x H :=
  by cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
g : β → γ
f : (a : α) → p a → β
H : ∀ (a : α), a ∈ none → p a
⊢ Option.map g (pmap f none H) = pmap (fun a h => g (f a h)) none H

Next tactic:
simp only [map_none', map_some', pmap]
theorem map_pmap (g : β → γ) (f : ∀ a, p a → β) (x H) :
    Option.map g (pmap f x H) = pmap (fun a h ↦ g (f a h)) x H :=
  by cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
g : β → γ
f : (a : α) → p a → β
val✝ : α
H : ∀ (a : α), a ∈ some val✝ → p a
⊢ Option.map g (pmap f (some val✝) H) = pmap (fun a h => g (f a h)) (some val✝) H

Next tactic:
simp only [map_none', map_some', pmap]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (x H) :
    @pmap _ _ p (fun a _ ↦ f a) x H = Option.map f x := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p✝ : α → Prop
f✝ : (a : α) → p✝ a → β
x✝ : Option α
p : α → Prop
f : α → β
x : Option α
H : ∀ (a : α), a ∈ x → p a
⊢ pmap (fun a x => f a) x H = Option.map f x

Next tactic:
cases x
theorem pmap_eq_map (p : α → Prop) (f : α → β) (x H) :
    @pmap _ _ p (fun a _ ↦ f a) x H = Option.map f x := by
  cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p✝ : α → Prop
f✝ : (a : α) → p✝ a → β
x : Option α
p : α → Prop
f : α → β
H : ∀ (a : α), a ∈ none → p a
⊢ pmap (fun a x => f a) none H = Option.map f none

Next tactic:
simp only [map_none', map_some', pmap]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (x H) :
    @pmap _ _ p (fun a _ ↦ f a) x H = Option.map f x := by
  cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p✝ : α → Prop
f✝ : (a : α) → p✝ a → β
x : Option α
p : α → Prop
f : α → β
val✝ : α
H : ∀ (a : α), a ∈ some val✝ → p a
⊢ pmap (fun a x => f a) (some val✝) H = Option.map f (some val✝)

Next tactic:
simp only [map_none', map_some', pmap]
theorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)
    (H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :
    pmap f (x >>= g) H = x >>= fun a ↦ pmap f (g a) fun b h ↦ H _ (H' a _ h) := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ✝ : Type u_3
δ : Type u_4
p✝ : α✝ → Prop
f✝ : (a : α✝) → p✝ a → β✝
x✝ : Option α✝
α β γ : Type u_5
x : Option α
g : α → Option β
p : β → Prop
f : (b : β) → p b → γ
H : ∀ (a : β), a ∈ x >>= g → p a
H' : ∀ (a : α) (b : β), b ∈ g a → b ∈ x >>= g
⊢ pmap f (x >>= g) H = do
    let a ← x
    pmap f (g a) (_ : ∀ (b : β), b ∈ g a → p b)

Next tactic:
cases x
theorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)
    (H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :
    pmap f (x >>= g) H = x >>= fun a ↦ pmap f (g a) fun b h ↦ H _ (H' a _ h) := by
  cases x <;> 

Proof state:
case none
α✝ : Type u_1
β✝ : Type u_2
γ✝ : Type u_3
δ : Type u_4
p✝ : α✝ → Prop
f✝ : (a : α✝) → p✝ a → β✝
x : Option α✝
α β γ : Type u_5
g : α → Option β
p : β → Prop
f : (b : β) → p b → γ
H : ∀ (a : β), a ∈ none >>= g → p a
H' : ∀ (a : α) (b : β), b ∈ g a → b ∈ none >>= g
⊢ pmap f (none >>= g) H = do
    let a ← none
    pmap f (g a) (_ : ∀ (b : β), b ∈ g a → p b)

Next tactic:
simp only [pmap, bind_eq_bind, none_bind, some_bind]
theorem pmap_bind {α β γ} {x : Option α} {g : α → Option β} {p : β → Prop} {f : ∀ b, p b → γ} (H)
    (H' : ∀ (a : α), ∀ b ∈ g a, b ∈ x >>= g) :
    pmap f (x >>= g) H = x >>= fun a ↦ pmap f (g a) fun b h ↦ H _ (H' a _ h) := by
  cases x <;> 

Proof state:
case some
α✝ : Type u_1
β✝ : Type u_2
γ✝ : Type u_3
δ : Type u_4
p✝ : α✝ → Prop
f✝ : (a : α✝) → p✝ a → β✝
x : Option α✝
α β γ : Type u_5
g : α → Option β
p : β → Prop
f : (b : β) → p b → γ
val✝ : α
H : ∀ (a : β), a ∈ some val✝ >>= g → p a
H' : ∀ (a : α) (b : β), b ∈ g a → b ∈ some val✝ >>= g
⊢ pmap f (some val✝ >>= g) H = do
    let a ← some val✝
    pmap f (g a) (_ : ∀ (b : β), b ∈ g a → p b)

Next tactic:
simp only [pmap, bind_eq_bind, none_bind, some_bind]
theorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :
    pmap f x H >>= g = x.pbind fun a h ↦ g (f a (H _ h)) := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ✝ : Type u_3
δ : Type u_4
p✝ : α✝ → Prop
f✝ : (a : α✝) → p✝ a → β✝
x✝ : Option α✝
α : Type u_5
β γ : Type u_6
p : α → Prop
f : (a : α) → p a → β
x : Option α
g : β → Option γ
H : ∀ (a : α), a ∈ x → p a
⊢ pmap f x H >>= g = pbind x fun a h => g (f a (_ : p a))

Next tactic:
cases x
theorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :
    pmap f x H >>= g = x.pbind fun a h ↦ g (f a (H _ h)) := by
  cases x <;> 

Proof state:
case none
α✝ : Type u_1
β✝ : Type u_2
γ✝ : Type u_3
δ : Type u_4
p✝ : α✝ → Prop
f✝ : (a : α✝) → p✝ a → β✝
x : Option α✝
α : Type u_5
β γ : Type u_6
p : α → Prop
f : (a : α) → p a → β
g : β → Option γ
H : ∀ (a : α), a ∈ none → p a
⊢ pmap f none H >>= g = pbind none fun a h => g (f a (_ : p a))

Next tactic:
simp only [pmap, bind_eq_bind, none_bind, some_bind, pbind]
theorem bind_pmap {α β γ} {p : α → Prop} (f : ∀ a, p a → β) (x : Option α) (g : β → Option γ) (H) :
    pmap f x H >>= g = x.pbind fun a h ↦ g (f a (H _ h)) := by
  cases x <;> 

Proof state:
case some
α✝ : Type u_1
β✝ : Type u_2
γ✝ : Type u_3
δ : Type u_4
p✝ : α✝ → Prop
f✝ : (a : α✝) → p✝ a → β✝
x : Option α✝
α : Type u_5
β γ : Type u_6
p : α → Prop
f : (a : α) → p a → β
g : β → Option γ
val✝ : α
H : ∀ (a : α), a ∈ some val✝ → p a
⊢ pmap f (some val✝) H >>= g = pbind (some val✝) fun a h => g (f a (_ : p a))

Next tactic:
simp only [pmap, bind_eq_bind, none_bind, some_bind, pbind]
theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}
    (h' : ∀ a (H : a ∈ x), f a H = none → x = none) : x.pbind f = none ↔ x = none := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : (a : α) → a ∈ x → Option β
h' : ∀ (a : α) (H : a ∈ x), f a H = none → x = none
⊢ pbind x f = none ↔ x = none

Next tactic:
cases x
theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}
    (h' : ∀ a (H : a ∈ x), f a H = none → x = none) : x.pbind f = none ↔ x = none := by
  cases x
  · 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
f : (a : α) → a ∈ none → Option β
h' : ∀ (a : α) (H : a ∈ none), f a H = none → none = none
⊢ pbind none f = none ↔ none = none

Next tactic:
simp
theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}
    (h' : ∀ a (H : a ∈ x), f a H = none → x = none) : x.pbind f = none ↔ x = none := by
  cases x
  · simp
  · 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
val✝ : α
f : (a : α) → a ∈ some val✝ → Option β
h' : ∀ (a : α) (H : a ∈ some val✝), f a H = none → some val✝ = none
⊢ pbind (some val✝) f = none ↔ some val✝ = none

Next tactic:
simp only [pbind, iff_false]
theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}
    (h' : ∀ a (H : a ∈ x), f a H = none → x = none) : x.pbind f = none ↔ x = none := by
  cases x
  · simp
  · simp only [pbind, iff_false]
    

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
val✝ : α
f : (a : α) → a ∈ some val✝ → Option β
h' : ∀ (a : α) (H : a ∈ some val✝), f a H = none → some val✝ = none
⊢ ¬f val✝ (_ : some val✝ = some val✝) = none

Next tactic:
intro h
theorem pbind_eq_none {f : ∀ a : α, a ∈ x → Option β}
    (h' : ∀ a (H : a ∈ x), f a H = none → x = none) : x.pbind f = none ↔ x = none := by
  cases x
  · simp
  · simp only [pbind, iff_false]
    intro h
    

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
val✝ : α
f : (a : α) → a ∈ some val✝ → Option β
h' : ∀ (a : α) (H : a ∈ some val✝), f a H = none → some val✝ = none
h : f val✝ (_ : some val✝ = some val✝) = none
⊢ False

Next tactic:
cases h' _ rfl h
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
x : Option α
f : (a : α) → a ∈ x → Option β
y : β
⊢ pbind x f = some y ↔ ∃ z H, f z H = some y

Next tactic:
rcases x with (_|x)
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
f : (a : α) → a ∈ none → Option β
⊢ pbind none f = some y ↔ ∃ z H, f z H = some y

Next tactic:
simp only [pbind, false_iff, not_exists]
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · simp only [pbind, false_iff, not_exists]
    

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
f : (a : α) → a ∈ none → Option β
⊢ ∀ (x : α) (x_1 : x ∈ none), ¬f x x_1 = some y

Next tactic:
intro z h
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · simp only [pbind, false_iff, not_exists]
    intro z h
    

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
f : (a : α) → a ∈ none → Option β
z : α
h : z ∈ none
⊢ ¬f z h = some y

Next tactic:
simp at h
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · simp only [pbind, false_iff, not_exists]
    intro z h
    simp at h
  · 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
x : α
f : (a : α) → a ∈ some x → Option β
⊢ pbind (some x) f = some y ↔ ∃ z H, f z H = some y

Next tactic:
simp only [pbind]
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · simp only [pbind, false_iff, not_exists]
    intro z h
    simp at h
  · simp only [pbind]
    

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
x : α
f : (a : α) → a ∈ some x → Option β
⊢ f x (_ : some x = some x) = some y ↔ ∃ z H, f z H = some y

Next tactic:
refine ⟨λ h => ⟨x, rfl, h⟩, ?_⟩
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · simp only [pbind, false_iff, not_exists]
    intro z h
    simp at h
  · simp only [pbind]
    refine ⟨λ h => ⟨x, rfl, h⟩, ?_⟩
    

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
x : α
f : (a : α) → a ∈ some x → Option β
⊢ (∃ z H, f z H = some y) → f x (_ : some x = some x) = some y

Next tactic:
rintro ⟨z, H, hz⟩
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · simp only [pbind, false_iff, not_exists]
    intro z h
    simp at h
  · simp only [pbind]
    refine ⟨λ h => ⟨x, rfl, h⟩, ?_⟩
    rintro ⟨z, H, hz⟩
    

Proof state:
case some.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
x : α
f : (a : α) → a ∈ some x → Option β
z : α
H : z ∈ some x
hz : f z H = some y
⊢ f x (_ : some x = some x) = some y

Next tactic:
simp only [mem_def, Option.some_inj] at H
theorem pbind_eq_some {f : ∀ a : α, a ∈ x → Option β} {y : β} :
    x.pbind f = some y ↔ ∃ (z : α) (H : z ∈ x), f z H = some y := by
  rcases x with (_|x)
  · simp only [pbind, false_iff, not_exists]
    intro z h
    simp at h
  · simp only [pbind]
    refine ⟨λ h => ⟨x, rfl, h⟩, ?_⟩
    rintro ⟨z, H, hz⟩
    simp only [mem_def, Option.some_inj] at H
    

Proof state:
case some.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f✝ : (a : α) → p a → β
y : β
x : α
f : (a : α) → a ∈ some x → Option β
z : α
H✝ : z ∈ some x
hz : f z H✝ = some y
H : x = z
⊢ f x (_ : some x = some x) = some y

Next tactic:
simpa [H] using hz
theorem pmap_eq_none_iff {h} : pmap f x h = none ↔ x = none := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
x : Option α
h : ∀ (a : α), a ∈ x → p a
⊢ pmap f x h = none ↔ x = none

Next tactic:
cases x
theorem pmap_eq_none_iff {h} : pmap f x h = none ↔ x = none := by cases x <;> 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
h : ∀ (a : α), a ∈ none → p a
⊢ pmap f none h = none ↔ none = none

Next tactic:
simp
theorem pmap_eq_none_iff {h} : pmap f x h = none ↔ x = none := by cases x <;> 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
val✝ : α
h : ∀ (a : α), a ∈ some val✝ → p a
⊢ pmap f (some val✝) h = none ↔ some val✝ = none

Next tactic:
simp
theorem pmap_eq_some_iff {hf} {y : β} :
    pmap f x hf = some y ↔ ∃ (a : α) (H : x = some a), f a (hf a H) = y := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
p : α → Prop
f : (a : α) → p a → β
x : Option α
hf : ∀ (a : α), a ∈ x → p a
y : β
⊢ pmap f x hf = some y ↔ ∃ a H, f a (_ : p a) = y

Next tactic:
rcases x with (_|x)