l3lab/ntp-mathlib huggingface dataset:
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      

Proof state:
case h_add_weak.refine'_1
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
this :
  f✝
      (coeff a
        ((let_fun this := (monomial a) b;
          this) +
          f)) ∈
    s
⊢ f✝ b ∈ s

Next tactic:
rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
    

Proof state:
case h_add_weak.refine'_2
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
i : σ →₀ ℕ
⊢ f✝ (coeff i f) ∈ s

Next tactic:
have := hs i
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
    have := hs i
    

Proof state:
case h_add_weak.refine'_2
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
i : σ →₀ ℕ
this :
  f✝
      (coeff i
        ((let_fun this := (monomial a) b;
          this) +
          f)) ∈
    s
⊢ f✝ (coeff i f) ∈ s

Next tactic:
rw [coeff_add, coeff_monomial] at this
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
    have := hs i
    rw [coeff_add, coeff_monomial] at this
    

Proof state:
case h_add_weak.refine'_2
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
i : σ →₀ ℕ
this : f✝ ((if a = i then b else 0) + coeff i f) ∈ s
⊢ f✝ (coeff i f) ∈ s

Next tactic:
split_ifs at this with h
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
    have := hs i
    rw [coeff_add, coeff_monomial] at this
    split_ifs at this with h
    · 

Proof state:
case pos
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
i : σ →₀ ℕ
h : a = i
this : f✝ (b + coeff i f) ∈ s
⊢ f✝ (coeff i f) ∈ s

Next tactic:
subst h
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
    have := hs i
    rw [coeff_add, coeff_monomial] at this
    split_ifs at this with h
    · subst h
      

Proof state:
case pos
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
this : f✝ (b + coeff a f) ∈ s
⊢ f✝ (coeff a f) ∈ s

Next tactic:
rw [MvPolynomial.not_mem_support_iff.1 ha, map_zero]
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
    have := hs i
    rw [coeff_add, coeff_monomial] at this
    split_ifs at this with h
    · subst h
      rw [MvPolynomial.not_mem_support_iff.1 ha, map_zero]
      

Proof state:
case pos
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
this : f✝ (b + coeff a f) ∈ s
⊢ 0 ∈ s

Next tactic:
exact zero_mem _
theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
    (hs : ∀ i ∈ p.support, f (p.coeff i) ∈ s) {v : σ → S} (hv : ∀ i, v i ∈ s) :
    MvPolynomial.eval₂ f v p ∈ s := by
  classical
    replace hs : ∀ i, f (p.coeff i) ∈ s
    · intro i
      by_cases hi : i ∈ p.support
      · exact hs i hi
      · rw [MvPolynomial.not_mem_support_iff.1 hi, f.map_zero]
        exact zero_mem s
    induction' p using MvPolynomial.induction_on''' with a a b f ha _ ih
    · simpa using hs 0
    rw [eval₂_add, eval₂_monomial]
    refine' add_mem (mul_mem _ <| prod_mem fun i _ => pow_mem (hv _) _) (ih fun i => _)
    · have := hs a -- Porting note: was `simpa only [...]`
      rwa [coeff_add, MvPolynomial.not_mem_support_iff.1 ha, add_zero, coeff_monomial,
        if_pos rfl] at this
    have := hs i
    rw [coeff_add, coeff_monomial] at this
    split_ifs at this with h
    · subst h
      rw [MvPolynomial.not_mem_support_iff.1 ha, map_zero]
      exact zero_mem _
    · 

Proof state:
case neg
R : Type u
S₁ : Type v
S₂ : Type w
S₃ : Type x
σ : Type u_1
a✝¹ a' a₁ a₂ : R
e : ℕ
n m : σ
s✝ : σ →₀ ℕ
inst✝⁴ : CommSemiring R
inst✝³ : CommSemiring S₁
p q : MvPolynomial σ R
S : Type u_2
subS : Type u_3
inst✝² : CommSemiring S
inst✝¹ : SetLike subS S
inst✝ : SubsemiringClass subS S
f✝ : R →+* S
s : subS
v : σ → S
hv : ∀ (i : σ), v i ∈ s
a : σ →₀ ℕ
b : R
f : (σ →₀ ℕ) →₀ R
ha : a ∉ f.support
a✝ : b ≠ 0
ih : (∀ (i : σ →₀ ℕ), f✝ (coeff i f) ∈ s) → eval₂ f✝ v f ∈ s
hs :
  ∀ (i : σ →₀ ℕ),
    f✝
        (coeff i
          ((let_fun this := (monomial a) b;
            this) +
            f)) ∈
      s
i : σ →₀ ℕ
h : ¬a = i
this : f✝ (0 + coeff i f) ∈ s
⊢ f✝ (coeff i f) ∈ s

Next tactic:
rwa [zero_add] at this
@[simp] lemma toOption_isSome (o : Part α) [Decidable o.Dom] : o.toOption.isSome ↔ o.Dom := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
⊢ Option.isSome (toOption o) = true ↔ o.Dom

Next tactic:
by_cases h : o.Dom
@[simp] lemma toOption_isSome (o : Part α) [Decidable o.Dom] : o.toOption.isSome ↔ o.Dom := by
  by_cases h : o.Dom <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
h : o.Dom
⊢ Option.isSome (toOption o) = true ↔ o.Dom

Next tactic:
simp [h, toOption]
@[simp] lemma toOption_isSome (o : Part α) [Decidable o.Dom] : o.toOption.isSome ↔ o.Dom := by
  by_cases h : o.Dom <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
h : ¬o.Dom
⊢ Option.isSome (toOption o) = true ↔ o.Dom

Next tactic:
simp [h, toOption]
@[simp] lemma toOption_isNone (o : Part α) [Decidable o.Dom] : o.toOption.isNone ↔ ¬o.Dom := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
⊢ Option.isNone (toOption o) = true ↔ ¬o.Dom

Next tactic:
by_cases h : o.Dom
@[simp] lemma toOption_isNone (o : Part α) [Decidable o.Dom] : o.toOption.isNone ↔ ¬o.Dom := by
  by_cases h : o.Dom <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
h : o.Dom
⊢ Option.isNone (toOption o) = true ↔ ¬o.Dom

Next tactic:
simp [h, toOption]
@[simp] lemma toOption_isNone (o : Part α) [Decidable o.Dom] : o.toOption.isNone ↔ ¬o.Dom := by
  by_cases h : o.Dom <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
h : ¬o.Dom
⊢ Option.isNone (toOption o) = true ↔ ¬o.Dom

Next tactic:
simp [h, toOption]
/-- `Part` extensionality -/
theorem ext' : ∀ {o p : Part α} (_ : o.Dom ↔ p.Dom) (_ : ∀ h₁ h₂, o.get h₁ = p.get h₂), o = p
  | ⟨od, o⟩, ⟨pd, p⟩, H1, H2 => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
od : Prop
o : od → α
pd : Prop
p : pd → α
H1 : { Dom := od, get := o }.Dom ↔ { Dom := pd, get := p }.Dom
H2 :
  ∀ (h₁ : { Dom := od, get := o }.Dom) (h₂ : { Dom := pd, get := p }.Dom),
    get { Dom := od, get := o } h₁ = get { Dom := pd, get := p } h₂
⊢ { Dom := od, get := o } = { Dom := pd, get := p }

Next tactic:
have t : od = pd := propext H1
/-- `Part` extensionality -/
theorem ext' : ∀ {o p : Part α} (_ : o.Dom ↔ p.Dom) (_ : ∀ h₁ h₂, o.get h₁ = p.get h₂), o = p
  | ⟨od, o⟩, ⟨pd, p⟩, H1, H2 => by
    have t : od = pd := propext H1
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
od : Prop
o : od → α
pd : Prop
p : pd → α
H1 : { Dom := od, get := o }.Dom ↔ { Dom := pd, get := p }.Dom
H2 :
  ∀ (h₁ : { Dom := od, get := o }.Dom) (h₂ : { Dom := pd, get := p }.Dom),
    get { Dom := od, get := o } h₁ = get { Dom := pd, get := p } h₂
t : od = pd
⊢ { Dom := od, get := o } = { Dom := pd, get := p }

Next tactic:
cases t
/-- `Part` extensionality -/
theorem ext' : ∀ {o p : Part α} (_ : o.Dom ↔ p.Dom) (_ : ∀ h₁ h₂, o.get h₁ = p.get h₂), o = p
  | ⟨od, o⟩, ⟨pd, p⟩, H1, H2 => by
    have t : od = pd := propext H1
    cases t; 

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
od : Prop
o p : od → α
H1 : { Dom := od, get := o }.Dom ↔ { Dom := od, get := p }.Dom
H2 :
  ∀ (h₁ : { Dom := od, get := o }.Dom) (h₂ : { Dom := od, get := p }.Dom),
    get { Dom := od, get := o } h₁ = get { Dom := od, get := p } h₂
⊢ { Dom := od, get := o } = { Dom := od, get := p }

Next tactic:
rw [show o = p from funext fun p => H2 p p]
theorem eq_none_iff {o : Part α} : o = none ↔ ∀ a, a ∉ o :=
  ⟨fun e => e.symm ▸ not_mem_none, fun h => ext (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
h : ∀ (a : α), a ∉ o
⊢ ∀ (a : α), a ∈ o ↔ a ∈ none

Next tactic:
simpa
@[simp]
theorem some_ne_none (x : α) : some x ≠ none := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
x : α
⊢ some x ≠ none

Next tactic:
intro h
@[simp]
theorem some_ne_none (x : α) : some x ≠ none := by
  intro h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
x : α
h : some x = none
⊢ False

Next tactic:
exact true_ne_false (congr_arg Dom h)
theorem ne_none_iff {o : Part α} : o ≠ none ↔ ∃ x, o = some x := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
⊢ o ≠ none ↔ ∃ x, o = some x

Next tactic:
constructor
theorem ne_none_iff {o : Part α} : o ≠ none ↔ ∃ x, o = some x := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
⊢ o ≠ none → ∃ x, o = some x

Next tactic:
rw [Ne, eq_none_iff', not_not]
theorem ne_none_iff {o : Part α} : o ≠ none ↔ ∃ x, o = some x := by
  constructor
  · rw [Ne, eq_none_iff', not_not]
    

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
⊢ o.Dom → ∃ x, o = some x

Next tactic:
exact fun h => ⟨o.get h, eq_some_iff.2 (get_mem h)⟩
theorem ne_none_iff {o : Part α} : o ≠ none ↔ ∃ x, o = some x := by
  constructor
  · rw [Ne, eq_none_iff', not_not]
    exact fun h => ⟨o.get h, eq_some_iff.2 (get_mem h)⟩
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
⊢ (∃ x, o = some x) → o ≠ none

Next tactic:
rintro ⟨x, rfl⟩
theorem ne_none_iff {o : Part α} : o ≠ none ↔ ∃ x, o = some x := by
  constructor
  · rw [Ne, eq_none_iff', not_not]
    exact fun h => ⟨o.get h, eq_some_iff.2 (get_mem h)⟩
  · rintro ⟨x, rfl⟩
    

Proof state:
case mpr.intro
α : Type u_1
β : Type u_2
γ : Type u_3
x : α
⊢ some x ≠ none

Next tactic:
apply some_ne_none
theorem get_eq_iff_eq_some {a : Part α} {ha : a.Dom} {b : α} : a.get ha = b ↔ a = some b :=
  ⟨fun h => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a : Part α
ha : a.Dom
b : α
h : get a ha = b
⊢ a = some b

Next tactic:
simp [h.symm]
theorem get_eq_iff_eq_some {a : Part α} {ha : a.Dom} {b : α} : a.get ha = b ↔ a = some b :=
  ⟨fun h => by simp [h.symm], fun h => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a : Part α
ha : a.Dom
b : α
h : a = some b
⊢ get a ha = b

Next tactic:
simp [h]
theorem get_eq_get_of_eq (a : Part α) (ha : a.Dom) {b : Part α} (h : a = b) :
    a.get ha = b.get (h ▸ ha) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a : Part α
ha : a.Dom
b : Part α
h : a = b
⊢ get a ha = get b (_ : b.Dom)

Next tactic:
congr
theorem mem_toOption {o : Part α} [Decidable o.Dom] {a : α} : a ∈ toOption o ↔ a ∈ o := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
a : α
⊢ a ∈ toOption o ↔ a ∈ o

Next tactic:
unfold toOption
theorem mem_toOption {o : Part α} [Decidable o.Dom] {a : α} : a ∈ toOption o ↔ a ∈ o := by
  unfold toOption
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
a : α
⊢ (a ∈ if h : o.Dom then Option.some (get o h) else Option.none) ↔ a ∈ o

Next tactic:
by_cases h : o.Dom
theorem mem_toOption {o : Part α} [Decidable o.Dom] {a : α} : a ∈ toOption o ↔ a ∈ o := by
  unfold toOption
  by_cases h : o.Dom <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
a : α
h : o.Dom
⊢ (a ∈ if h : o.Dom then Option.some (get o h) else Option.none) ↔ a ∈ o

Next tactic:
simp [h]
theorem mem_toOption {o : Part α} [Decidable o.Dom] {a : α} : a ∈ toOption o ↔ a ∈ o := by
  unfold toOption
  by_cases h : o.Dom <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
a : α
h : ¬o.Dom
⊢ (a ∈ if h : o.Dom then Option.some (get o h) else Option.none) ↔ a ∈ o

Next tactic:
simp [h]
theorem mem_toOption {o : Part α} [Decidable o.Dom] {a : α} : a ∈ toOption o ↔ a ∈ o := by
  unfold toOption
  by_cases h : o.Dom <;> simp [h]
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
a : α
h : o.Dom
⊢ get o (_ : o.Dom) = a ↔ a ∈ o

Next tactic:
exact ⟨fun h => ⟨_, h⟩, fun ⟨_, h⟩ => h⟩
theorem mem_toOption {o : Part α} [Decidable o.Dom] {a : α} : a ∈ toOption o ↔ a ∈ o := by
  unfold toOption
  by_cases h : o.Dom <;> simp [h]
  · exact ⟨fun h => ⟨_, h⟩, fun ⟨_, h⟩ => h⟩
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
a : α
h : ¬o.Dom
⊢ a ∉ o

Next tactic:
exact mt Exists.fst h
@[simp]
theorem toOption_eq_some_iff {o : Part α} [Decidable o.Dom] {a : α} :
    toOption o = Option.some a ↔ a ∈ o :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
o : Part α
inst✝ : Decidable o.Dom
a : α
⊢ toOption o = Option.some a ↔ a ∈ o

Next tactic:
rw [← Option.mem_def, mem_toOption]
theorem elim_toOption {α β : Type*} (a : Part α) [Decidable a.Dom] (b : β) (f : α → β) :
    a.toOption.elim b f = if h : a.Dom then f (a.get h) else b := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
α : Type u_4
β : Type u_5
a : Part α
inst✝ : Decidable a.Dom
b : β
f : α → β
⊢ Option.elim (toOption a) b f = if h : a.Dom then f (get a h) else b

Next tactic:
split_ifs with h
theorem elim_toOption {α β : Type*} (a : Part α) [Decidable a.Dom] (b : β) (f : α → β) :
    a.toOption.elim b f = if h : a.Dom then f (a.get h) else b := by
  split_ifs with h
  · 

Proof state:
case pos
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
α : Type u_4
β : Type u_5
a : Part α
inst✝ : Decidable a.Dom
b : β
f : α → β
h : a.Dom
⊢ Option.elim (toOption a) b f = f (get a h)

Next tactic:
rw [h.toOption]
theorem elim_toOption {α β : Type*} (a : Part α) [Decidable a.Dom] (b : β) (f : α → β) :
    a.toOption.elim b f = if h : a.Dom then f (a.get h) else b := by
  split_ifs with h
  · rw [h.toOption]
    

Proof state:
case pos
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
α : Type u_4
β : Type u_5
a : Part α
inst✝ : Decidable a.Dom
b : β
f : α → β
h : a.Dom
⊢ Option.elim (Option.some (get a h)) b f = f (get a h)

Next tactic:
rfl
theorem elim_toOption {α β : Type*} (a : Part α) [Decidable a.Dom] (b : β) (f : α → β) :
    a.toOption.elim b f = if h : a.Dom then f (a.get h) else b := by
  split_ifs with h
  · rw [h.toOption]
    rfl
  · 

Proof state:
case neg
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
α : Type u_4
β : Type u_5
a : Part α
inst✝ : Decidable a.Dom
b : β
f : α → β
h : ¬a.Dom
⊢ Option.elim (toOption a) b f = b

Next tactic:
rw [Part.toOption_eq_none_iff.2 h]
theorem elim_toOption {α β : Type*} (a : Part α) [Decidable a.Dom] (b : β) (f : α → β) :
    a.toOption.elim b f = if h : a.Dom then f (a.get h) else b := by
  split_ifs with h
  · rw [h.toOption]
    rfl
  · rw [Part.toOption_eq_none_iff.2 h]
    

Proof state:
case neg
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
α : Type u_4
β : Type u_5
a : Part α
inst✝ : Decidable a.Dom
b : β
f : α → β
h : ¬a.Dom
⊢ Option.elim Option.none b f = b

Next tactic:
rfl
@[simp]
theorem ofOption_dom {α} : ∀ o : Option α, (ofOption o).Dom ↔ o.isSome
  | Option.none => by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
⊢ (↑Option.none).Dom ↔ Option.isSome Option.none = true

Next tactic:
simp [ofOption, none]
@[simp]
theorem ofOption_dom {α} : ∀ o : Option α, (ofOption o).Dom ↔ o.isSome
  | Option.none => by simp [ofOption, none]
  | Option.some a => by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
a : α
⊢ (↑(Option.some a)).Dom ↔ Option.isSome (Option.some a) = true

Next tactic:
simp [ofOption]