l3lab/ntp-mathlib huggingface dataset:
/-- Auxiliary definition for `unopEquivalence`. -/
def unopUnitIso : 𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≅ unopFunctor V c ⋙ unopInverse V c :=
  NatIso.ofComponents
    (fun X =>
      (HomologicalComplex.Hom.isoOfComponents (fun i => Iso.refl _) fun i j _ => by
            simp only [Iso.refl_hom, Category.id_comp, unopSymm_d, op_d, Quiver.Hom.unop_op,
              Category.comp_id] :
          (Opposite.unop X).op.unopSymm ≅ unop X).op)
    (by
      

Proof state:
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.128766, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
⊢ ∀ {X Y : (HomologicalComplex Vᵒᵖ c)ᵒᵖ} (f : X ⟶ Y),
    (𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ).map f ≫
        ((fun X =>
              Iso.op
                (Hom.isoOfComponents fun i =>
                  Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
            Y).hom =
      ((fun X =>
              Iso.op
                (Hom.isoOfComponents fun i =>
                  Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
            X).hom ≫
        (unopFunctor V c ⋙ unopInverse V c).map f

Next tactic:
intro X Y f
/-- Auxiliary definition for `unopEquivalence`. -/
def unopUnitIso : 𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≅ unopFunctor V c ⋙ unopInverse V c :=
  NatIso.ofComponents
    (fun X =>
      (HomologicalComplex.Hom.isoOfComponents (fun i => Iso.refl _) fun i j _ => by
            simp only [Iso.refl_hom, Category.id_comp, unopSymm_d, op_d, Quiver.Hom.unop_op,
              Category.comp_id] :
          (Opposite.unop X).op.unopSymm ≅ unop X).op)
    (by
      intro X Y f
      

Proof state:
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.128766, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
X Y : (HomologicalComplex Vᵒᵖ c)ᵒᵖ
f : X ⟶ Y
⊢ (𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ).map f ≫
      ((fun X =>
            Iso.op
              (Hom.isoOfComponents fun i =>
                Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
          Y).hom =
    ((fun X =>
            Iso.op
              (Hom.isoOfComponents fun i =>
                Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
          X).hom ≫
      (unopFunctor V c ⋙ unopInverse V c).map f

Next tactic:
refine' Quiver.Hom.unop_inj _
/-- Auxiliary definition for `unopEquivalence`. -/
def unopUnitIso : 𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≅ unopFunctor V c ⋙ unopInverse V c :=
  NatIso.ofComponents
    (fun X =>
      (HomologicalComplex.Hom.isoOfComponents (fun i => Iso.refl _) fun i j _ => by
            simp only [Iso.refl_hom, Category.id_comp, unopSymm_d, op_d, Quiver.Hom.unop_op,
              Category.comp_id] :
          (Opposite.unop X).op.unopSymm ≅ unop X).op)
    (by
      intro X Y f
      refine' Quiver.Hom.unop_inj _
      

Proof state:
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.128766, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
X Y : (HomologicalComplex Vᵒᵖ c)ᵒᵖ
f : X ⟶ Y
⊢ ((𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ).map f ≫
        ((fun X =>
              Iso.op
                (Hom.isoOfComponents fun i =>
                  Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
            Y).hom).unop =
    (((fun X =>
              Iso.op
                (Hom.isoOfComponents fun i =>
                  Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
            X).hom ≫
        (unopFunctor V c ⋙ unopInverse V c).map f).unop

Next tactic:
ext x
/-- Auxiliary definition for `unopEquivalence`. -/
def unopUnitIso : 𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≅ unopFunctor V c ⋙ unopInverse V c :=
  NatIso.ofComponents
    (fun X =>
      (HomologicalComplex.Hom.isoOfComponents (fun i => Iso.refl _) fun i j _ => by
            simp only [Iso.refl_hom, Category.id_comp, unopSymm_d, op_d, Quiver.Hom.unop_op,
              Category.comp_id] :
          (Opposite.unop X).op.unopSymm ≅ unop X).op)
    (by
      intro X Y f
      refine' Quiver.Hom.unop_inj _
      ext x
      

Proof state:
case h
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.128766, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
X Y : (HomologicalComplex Vᵒᵖ c)ᵒᵖ
f : X ⟶ Y
x : ι
⊢ Hom.f
      ((𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ).map f ≫
          ((fun X =>
                Iso.op
                  (Hom.isoOfComponents fun i =>
                    Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
              Y).hom).unop
      x =
    Hom.f
      (((fun X =>
                Iso.op
                  (Hom.isoOfComponents fun i =>
                    Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) i)))
              X).hom ≫
          (unopFunctor V c ⋙ unopInverse V c).map f).unop
      x

Next tactic:
simp only [Quiver.Hom.unop_op, Functor.id_map, Iso.op_hom, Functor.comp_map, unop_comp,
        comp_f, Hom.isoOfComponents_hom_f]
/-- Auxiliary definition for `unopEquivalence`. -/
def unopUnitIso : 𝟭 (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≅ unopFunctor V c ⋙ unopInverse V c :=
  NatIso.ofComponents
    (fun X =>
      (HomologicalComplex.Hom.isoOfComponents (fun i => Iso.refl _) fun i j _ => by
            simp only [Iso.refl_hom, Category.id_comp, unopSymm_d, op_d, Quiver.Hom.unop_op,
              Category.comp_id] :
          (Opposite.unop X).op.unopSymm ≅ unop X).op)
    (by
      intro X Y f
      refine' Quiver.Hom.unop_inj _
      ext x
      simp only [Quiver.Hom.unop_op, Functor.id_map, Iso.op_hom, Functor.comp_map, unop_comp,
        comp_f, Hom.isoOfComponents_hom_f]
      

Proof state:
case h
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.128766, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
X Y : (HomologicalComplex Vᵒᵖ c)ᵒᵖ
f : X ⟶ Y
x : ι
⊢ (Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op Y.unop)) x)).hom ≫
      Hom.f f.unop x =
    Hom.f ((unopInverse V c).map ((unopFunctor V c).map f)).unop x ≫
      (Iso.refl (HomologicalComplex.X (HomologicalComplex.unopSymm (HomologicalComplex.op X.unop)) x)).hom

Next tactic:
erw [Category.id_comp, Category.comp_id (f.unop.f x)]
/-- Given a category of complexes with objects in `Vᵒᵖ`, there is a natural equivalence between its
opposite category and a category of complexes with objects in `V`. -/
@[simps]
def unopEquivalence : (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≌ HomologicalComplex V c.symm where
  functor := unopFunctor V c
  inverse := unopInverse V c
  unitIso := unopUnitIso V c
  counitIso := unopCounitIso V c
  functor_unitIso_comp X := by
    

Proof state:
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.148250, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
X : (HomologicalComplex Vᵒᵖ c)ᵒᵖ
⊢ (unopFunctor V c).map ((unopUnitIso V c).hom.app X) ≫ (unopCounitIso V c).hom.app ((unopFunctor V c).obj X) =
    𝟙 ((unopFunctor V c).obj X)

Next tactic:
ext
/-- Given a category of complexes with objects in `Vᵒᵖ`, there is a natural equivalence between its
opposite category and a category of complexes with objects in `V`. -/
@[simps]
def unopEquivalence : (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≌ HomologicalComplex V c.symm where
  functor := unopFunctor V c
  inverse := unopInverse V c
  unitIso := unopUnitIso V c
  counitIso := unopCounitIso V c
  functor_unitIso_comp X := by
    ext
    

Proof state:
case h
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.148250, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
X : (HomologicalComplex Vᵒᵖ c)ᵒᵖ
i✝ : ι
⊢ Hom.f ((unopFunctor V c).map ((unopUnitIso V c).hom.app X) ≫ (unopCounitIso V c).hom.app ((unopFunctor V c).obj X))
      i✝ =
    Hom.f (𝟙 ((unopFunctor V c).obj X)) i✝

Next tactic:
simp only [opUnitIso, opCounitIso, NatIso.ofComponents_hom_app, Iso.op_hom, comp_f,
      opFunctor_map_f, Quiver.Hom.unop_op, Hom.isoOfComponents_hom_f]
/-- Given a category of complexes with objects in `Vᵒᵖ`, there is a natural equivalence between its
opposite category and a category of complexes with objects in `V`. -/
@[simps]
def unopEquivalence : (HomologicalComplex Vᵒᵖ c)ᵒᵖ ≌ HomologicalComplex V c.symm where
  functor := unopFunctor V c
  inverse := unopInverse V c
  unitIso := unopUnitIso V c
  counitIso := unopCounitIso V c
  functor_unitIso_comp X := by
    ext
    simp only [opUnitIso, opCounitIso, NatIso.ofComponents_hom_app, Iso.op_hom, comp_f,
      opFunctor_map_f, Quiver.Hom.unop_op, Hom.isoOfComponents_hom_f]
    

Proof state:
case h
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.148250, u_2} V
c : ComplexShape ι
inst✝ : Preadditive V
X : (HomologicalComplex Vᵒᵖ c)ᵒᵖ
i✝ : ι
⊢ Hom.f ((unopFunctor V c).map ((unopUnitIso V c).hom.app X)) i✝ ≫
      Hom.f ((unopCounitIso V c).hom.app ((unopFunctor V c).obj X)) i✝ =
    Hom.f (𝟙 ((unopFunctor V c).obj X)) i✝

Next tactic:
exact Category.comp_id _
/-- Auxiliary tautological definition for `homologyOp`. -/
def homology'OpDef : C.op.homology' i ≅
    _root_.homology' (C.dFrom i).op (C.dTo i).op (by 

Proof state:
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.157635, u_2} V
c : ComplexShape ι
inst✝ : Abelian V
C : HomologicalComplex V c
i : ι
⊢ (dFrom C i).op ≫ (dTo C i).op = 0

Next tactic:
rw [← op_comp, C.dTo_comp_dFrom i, op_zero]
/-- Auxiliary tautological definition for `homologyUnop`. -/
def homology'UnopDef (C : HomologicalComplex Vᵒᵖ c) :
    C.unop.homology' i ≅
      _root_.homology' (C.dFrom i).unop (C.dTo i).unop
        (by 

Proof state:
ι : Type u_1
V : Type u_2
inst✝¹ : Category.{?u.162814, u_2} V
c : ComplexShape ι
inst✝ : Abelian V
C✝ : HomologicalComplex V c
i : ι
C : HomologicalComplex Vᵒᵖ c
⊢ (dFrom C i).unop ≫ (dTo C i).unop = 0

Next tactic:
rw [← unop_comp, C.dTo_comp_dFrom i, unop_zero]
private lemma ite_pos [LT α] (ha : 0 < a) (hb : 0 < b) : 0 < ite p a b := by
  

Proof state:
α : Type u_1
inst✝² : Zero α
p : Prop
inst✝¹ : Decidable p
a b : α
inst✝ : LT α
ha : 0 < a
hb : 0 < b
⊢ 0 < if p then a else b

Next tactic:
by_cases p
private lemma ite_pos [LT α] (ha : 0 < a) (hb : 0 < b) : 0 < ite p a b := by
  by_cases p <;> 

Proof state:
case pos
α : Type u_1
inst✝² : Zero α
p : Prop
inst✝¹ : Decidable p
a b : α
inst✝ : LT α
ha : 0 < a
hb : 0 < b
h✝ : p
⊢ 0 < if p then a else b

Next tactic:
simp [*]
private lemma ite_pos [LT α] (ha : 0 < a) (hb : 0 < b) : 0 < ite p a b := by
  by_cases p <;> 

Proof state:
case neg
α : Type u_1
inst✝² : Zero α
p : Prop
inst✝¹ : Decidable p
a b : α
inst✝ : LT α
ha : 0 < a
hb : 0 < b
h✝ : ¬p
⊢ 0 < if p then a else b

Next tactic:
simp [*]
private lemma ite_nonneg [LE α] (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ ite p a b := by
  

Proof state:
α : Type u_1
inst✝² : Zero α
p : Prop
inst✝¹ : Decidable p
a b : α
inst✝ : LE α
ha : 0 ≤ a
hb : 0 ≤ b
⊢ 0 ≤ if p then a else b

Next tactic:
by_cases p
private lemma ite_nonneg [LE α] (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ ite p a b := by
  by_cases p <;> 

Proof state:
case pos
α : Type u_1
inst✝² : Zero α
p : Prop
inst✝¹ : Decidable p
a b : α
inst✝ : LE α
ha : 0 ≤ a
hb : 0 ≤ b
h✝ : p
⊢ 0 ≤ if p then a else b

Next tactic:
simp [*]
private lemma ite_nonneg [LE α] (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ ite p a b := by
  by_cases p <;> 

Proof state:
case neg
α : Type u_1
inst✝² : Zero α
p : Prop
inst✝¹ : Decidable p
a b : α
inst✝ : LE α
ha : 0 ≤ a
hb : 0 ≤ b
h✝ : ¬p
⊢ 0 ≤ if p then a else b

Next tactic:
simp [*]
private lemma ite_ne_zero (ha : a ≠ 0) (hb : b ≠ 0) : ite p a b ≠ 0 := by 

Proof state:
α : Type u_1
inst✝¹ : Zero α
p : Prop
inst✝ : Decidable p
a b : α
ha : a ≠ 0
hb : b ≠ 0
⊢ (if p then a else b) ≠ 0

Next tactic:
by_cases p
private lemma ite_ne_zero (ha : a ≠ 0) (hb : b ≠ 0) : ite p a b ≠ 0 := by by_cases p <;> 

Proof state:
case pos
α : Type u_1
inst✝¹ : Zero α
p : Prop
inst✝ : Decidable p
a b : α
ha : a ≠ 0
hb : b ≠ 0
h✝ : p
⊢ (if p then a else b) ≠ 0

Next tactic:
simp [*]
private lemma ite_ne_zero (ha : a ≠ 0) (hb : b ≠ 0) : ite p a b ≠ 0 := by by_cases p <;> 

Proof state:
case neg
α : Type u_1
inst✝¹ : Zero α
p : Prop
inst✝ : Decidable p
a b : α
ha : a ≠ 0
hb : b ≠ 0
h✝ : ¬p
⊢ (if p then a else b) ≠ 0

Next tactic:
simp [*]
private lemma min_ne (ha : a ≠ c) (hb : b ≠ c) : min a b ≠ c := by
  

Proof state:
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
⊢ min a b ≠ c

Next tactic:
rw [min_def]
private lemma min_ne (ha : a ≠ c) (hb : b ≠ c) : min a b ≠ c := by
  rw [min_def]; 

Proof state:
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
⊢ (if a ≤ b then a else b) ≠ c

Next tactic:
split_ifs
private lemma min_ne (ha : a ≠ c) (hb : b ≠ c) : min a b ≠ c := by
  rw [min_def]; split_ifs <;> 

Proof state:
case pos
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
h✝ : a ≤ b
⊢ a ≠ c

Next tactic:
assumption
private lemma min_ne (ha : a ≠ c) (hb : b ≠ c) : min a b ≠ c := by
  rw [min_def]; split_ifs <;> 

Proof state:
case neg
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
h✝ : ¬a ≤ b
⊢ b ≠ c

Next tactic:
assumption
private lemma max_ne (ha : a ≠ c) (hb : b ≠ c) : max a b ≠ c := by
  

Proof state:
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
⊢ max a b ≠ c

Next tactic:
rw [max_def]
private lemma max_ne (ha : a ≠ c) (hb : b ≠ c) : max a b ≠ c := by
  rw [max_def]; 

Proof state:
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
⊢ (if a ≤ b then b else a) ≠ c

Next tactic:
split_ifs
private lemma max_ne (ha : a ≠ c) (hb : b ≠ c) : max a b ≠ c := by
  rw [max_def]; split_ifs <;> 

Proof state:
case pos
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
h✝ : a ≤ b
⊢ b ≠ c

Next tactic:
assumption
private lemma max_ne (ha : a ≠ c) (hb : b ≠ c) : max a b ≠ c := by
  rw [max_def]; split_ifs <;> 

Proof state:
case neg
R : Type u_1
inst✝ : LinearOrder R
a b c : R
ha : a ≠ c
hb : b ≠ c
h✝ : ¬a ≤ b
⊢ a ≠ c

Next tactic:
assumption
private lemma int_div_self_pos {a : ℤ} (ha : 0 < a) : 0 < a / a := by
  

Proof state:
a : ℤ
ha : 0 < a
⊢ 0 < a / a

Next tactic:
rw [Int.ediv_self ha.ne']
private lemma int_div_self_pos {a : ℤ} (ha : 0 < a) : 0 < a / a := by
  rw [Int.ediv_self ha.ne']; 

Proof state:
a : ℤ
ha : 0 < a
⊢ 0 < 1

Next tactic:
exact zero_lt_one
set_option linter.deprecated false in
/-- The `positivity` extension which identifies expressions of the form `a ^ (b : ℕ)`,
such that `positivity` successfully recognises both `a` and `b`. -/
@[positivity (_ : α) ^ (_ : ℕ), Pow.pow _ (_ : ℕ)]
def evalPow : PositivityExt where eval {u α} zα pα e := do
  let .app (.app _ (a : Q($α))) (b : Q(ℕ)) ← withReducible (whnf e) | throwError "not ^"
  let result ← catchNone do
    let .true := b.isAppOfArity ``OfNat.ofNat 3 | throwError "not a ^ n where n is a literal"
    let some n := (b.getRevArg! 1).natLit? | throwError "not a ^ n where n is a literal"
    guard (n % 2 = 0)
    have m : Q(ℕ) := mkRawNatLit (n / 2)
    haveI' : $b =Q bit0 $m := ⟨⟩
    let _a ← synthInstanceQ q(LinearOrderedRing $α)
    haveI' : $e =Q $a ^ $b := ⟨⟩
    assumeInstancesCommute
    pure (by 

Proof state:
u : Level
α : Q(Type u)
zα : Q(Zero «$α»)
pα : Q(PartialOrder «$α»)
e : Q(«$α»)
fn✝ : Expr
a : Q(«$α»)
b : Q(ℕ)
n : ℕ
x✝ : PUnit.{1}
m : Q(ℕ)
this✝ : «$b» =Q bit0 «$m»
_a : Q(LinearOrderedRing «$α»)
this : «$e» =Q «$a» ^ «$b»
zα_eq✝ : «$zα» =Q MonoidWithZero.toZero
pα_eq✝ : «$pα» =Q StrictOrderedRing.toPartialOrder
⊢ Strictness zα pα e

Next tactic:
exact .nonnegative q(pow_bit0_nonneg $a $m)
set_option linter.deprecated false in
/-- The `positivity` extension which identifies expressions of the form `a ^ (b : ℕ)`,
such that `positivity` successfully recognises both `a` and `b`. -/
@[positivity (_ : α) ^ (_ : ℕ), Pow.pow _ (_ : ℕ)]
def evalPow : PositivityExt where eval {u α} zα pα e := do
  let .app (.app _ (a : Q($α))) (b : Q(ℕ)) ← withReducible (whnf e) | throwError "not ^"
  let result ← catchNone do
    let .true := b.isAppOfArity ``OfNat.ofNat 3 | throwError "not a ^ n where n is a literal"
    let some n := (b.getRevArg! 1).natLit? | throwError "not a ^ n where n is a literal"
    guard (n % 2 = 0)
    have m : Q(ℕ) := mkRawNatLit (n / 2)
    haveI' : $b =Q bit0 $m := ⟨⟩
    let _a ← synthInstanceQ q(LinearOrderedRing $α)
    haveI' : $e =Q $a ^ $b := ⟨⟩
    assumeInstancesCommute
    pure (by exact .nonnegative q(pow_bit0_nonneg $a $m))
  orElse result do
    let ra ← core zα pα a
    let ofNonneg (pa : Q(0 ≤ $a)) (_oα : Q(OrderedSemiring $α)) : MetaM (Strictness zα pα e) := do
      haveI' : $e =Q $a ^ $b := ⟨⟩
      assumeInstancesCommute
      pure (by 

Proof state:
u : Level
α : Q(Type u)
zα : Q(Zero «$α»)
pα : Q(PartialOrder «$α»)
e : Q(«$α»)
fn✝ : Expr
a : Q(«$α»)
b : Q(ℕ)
result : Strictness zα pα e
ra : Strictness zα pα a
pa : Q(0 ≤ «$a»)
_oα : Q(OrderedSemiring «$α»)
this : «$e» =Q «$a» ^ «$b»
zα_eq✝ : «$zα» =Q MonoidWithZero.toZero
pα_eq✝ : «$pα» =Q OrderedSemiring.toPartialOrder
⊢ Strictness zα pα e

Next tactic:
exact .nonnegative (q(pow_nonneg $pa $b))
set_option linter.deprecated false in
/-- The `positivity` extension which identifies expressions of the form `a ^ (b : ℕ)`,
such that `positivity` successfully recognises both `a` and `b`. -/
@[positivity (_ : α) ^ (_ : ℕ), Pow.pow _ (_ : ℕ)]
def evalPow : PositivityExt where eval {u α} zα pα e := do
  let .app (.app _ (a : Q($α))) (b : Q(ℕ)) ← withReducible (whnf e) | throwError "not ^"
  let result ← catchNone do
    let .true := b.isAppOfArity ``OfNat.ofNat 3 | throwError "not a ^ n where n is a literal"
    let some n := (b.getRevArg! 1).natLit? | throwError "not a ^ n where n is a literal"
    guard (n % 2 = 0)
    have m : Q(ℕ) := mkRawNatLit (n / 2)
    haveI' : $b =Q bit0 $m := ⟨⟩
    let _a ← synthInstanceQ q(LinearOrderedRing $α)
    haveI' : $e =Q $a ^ $b := ⟨⟩
    assumeInstancesCommute
    pure (by exact .nonnegative q(pow_bit0_nonneg $a $m))
  orElse result do
    let ra ← core zα pα a
    let ofNonneg (pa : Q(0 ≤ $a)) (_oα : Q(OrderedSemiring $α)) : MetaM (Strictness zα pα e) := do
      haveI' : $e =Q $a ^ $b := ⟨⟩
      assumeInstancesCommute
      pure (by exact .nonnegative (q(pow_nonneg $pa $b)))
    let ofNonzero (pa : Q($a ≠ 0)) (_oα : Q(OrderedSemiring $α)) : MetaM (Strictness zα pα e) := do
      haveI' : $e =Q $a ^ $b := ⟨⟩
      assumeInstancesCommute
      let _a ← synthInstanceQ q(NoZeroDivisors $α)
      pure (.nonzero (by 

Proof state:
u : Level
α : Q(Type u)
zα : Q(Zero «$α»)
pα : Q(PartialOrder «$α»)
e : Q(«$α»)
fn✝ : Expr
a : Q(«$α»)
b : Q(ℕ)
result : Strictness zα pα e
ra : Strictness zα pα a
ofNonneg : Q(0 ≤ «$a») → Q(OrderedSemiring «$α») → MetaM (Strictness zα pα e) :=
  fun pa _oα =>
    let_fun zα_eq := (_ : «$zα» =Q MonoidWithZero.toZero);
    let_fun pα_eq := (_ : «$pα» =Q OrderedSemiring.toPartialOrder);
    pure (Strictness.nonnegative q((_ : 0 ≤ «$a» ^ «$b»)))
pa : Q(«$a» ≠ 0)
_oα : Q(OrderedSemiring «$α»)
this : «$e» =Q «$a» ^ «$b»
zα_eq✝ : «$zα» =Q MonoidWithZero.toZero
pα_eq✝ : «$pα» =Q OrderedSemiring.toPartialOrder
_a : Q(NoZeroDivisors «$α»)
⊢ Q(«$e» ≠ 0)

Next tactic:
exact q(pow_ne_zero $b $pa)
set_option linter.deprecated false in
/-- The `positivity` extension which identifies expressions of the form `a ^ (b : ℕ)`,
such that `positivity` successfully recognises both `a` and `b`. -/
@[positivity (_ : α) ^ (_ : ℕ), Pow.pow _ (_ : ℕ)]
def evalPow : PositivityExt where eval {u α} zα pα e := do
  let .app (.app _ (a : Q($α))) (b : Q(ℕ)) ← withReducible (whnf e) | throwError "not ^"
  let result ← catchNone do
    let .true := b.isAppOfArity ``OfNat.ofNat 3 | throwError "not a ^ n where n is a literal"
    let some n := (b.getRevArg! 1).natLit? | throwError "not a ^ n where n is a literal"
    guard (n % 2 = 0)
    have m : Q(ℕ) := mkRawNatLit (n / 2)
    haveI' : $b =Q bit0 $m := ⟨⟩
    let _a ← synthInstanceQ q(LinearOrderedRing $α)
    haveI' : $e =Q $a ^ $b := ⟨⟩
    assumeInstancesCommute
    pure (by exact .nonnegative q(pow_bit0_nonneg $a $m))
  orElse result do
    let ra ← core zα pα a
    let ofNonneg (pa : Q(0 ≤ $a)) (_oα : Q(OrderedSemiring $α)) : MetaM (Strictness zα pα e) := do
      haveI' : $e =Q $a ^ $b := ⟨⟩
      assumeInstancesCommute
      pure (by exact .nonnegative (q(pow_nonneg $pa $b)))
    let ofNonzero (pa : Q($a ≠ 0)) (_oα : Q(OrderedSemiring $α)) : MetaM (Strictness zα pα e) := do
      haveI' : $e =Q $a ^ $b := ⟨⟩
      assumeInstancesCommute
      let _a ← synthInstanceQ q(NoZeroDivisors $α)
      pure (.nonzero (by exact q(pow_ne_zero $b $pa)))
    match ra with
    | .positive pa =>
      try
        let _a ← synthInstanceQ (q(StrictOrderedSemiring $α) : Q(Type u))
        haveI' : $e =Q $a ^ $b := ⟨⟩
        assumeInstancesCommute
        pure (by 

Proof state:
u : Level
α : Q(Type u)
zα : Q(Zero «$α»)
pα : Q(PartialOrder «$α»)
e : Q(«$α»)
fn✝ : Expr
a : Q(«$α»)
b : Q(ℕ)
result : Strictness zα pα e
ra : Strictness zα pα a
ofNonneg : Q(0 ≤ «$a») → Q(OrderedSemiring «$α») → MetaM (Strictness zα pα e) :=
  fun pa _oα =>
    let_fun zα_eq := (_ : «$zα» =Q MonoidWithZero.toZero);
    let_fun pα_eq := (_ : «$pα» =Q OrderedSemiring.toPartialOrder);
    pure (Strictness.nonnegative q((_ : 0 ≤ «$a» ^ «$b»)))
ofNonzero : Q(«$a» ≠ 0) → Q(OrderedSemiring «$α») → MetaM (Strictness zα pα e) :=
  fun pa _oα =>
    let_fun zα_eq := (_ : «$zα» =Q MonoidWithZero.toZero);
    let_fun pα_eq := (_ : «$pα» =Q OrderedSemiring.toPartialOrder);
    do
    let _a ← synthInstanceQ q(NoZeroDivisors «$α»)
    pure (Strictness.nonzero q((_ : «$a» ^ «$b» ≠ 0)))
pa : Q(0 < «$a»)
_a : Q(StrictOrderedSemiring «$α»)
this : «$e» =Q «$a» ^ «$b»
zα_eq✝ : «$zα» =Q MonoidWithZero.toZero
pα_eq✝ : «$pα» =Q StrictOrderedSemiring.toPartialOrder
⊢ Strictness zα pα e

Next tactic:
exact .positive (q(pow_pos $pa $b))
/-- The `positivity` extension which identifies expressions of the form `a ^ (b : ℤ)`,
such that `positivity` successfully recognises both `a` and `b`. -/
@[positivity (_ : α) ^ (_ : ℤ), Pow.pow _ (_ : ℤ)]
def evalZpow : PositivityExt where eval {u α} zα pα e := do
  let .app (.app _ (a : Q($α))) (b : Q(ℤ)) ← withReducible (whnf e) | throwError "not ^"
  let result ← catchNone do
    let _a ← synthInstanceQ q(LinearOrderedField $α)
    assumeInstancesCommute
    match ← whnfR b with
    | .app (.app (.app (.const `OfNat.ofNat _) _) (.lit (Literal.natVal n))) _ =>
      guard (n % 2 = 0)
      have m : Q(ℕ) := mkRawNatLit (n / 2)
      haveI' : $b =Q $m + $m := ⟨⟩ -- b = bit0 m
      haveI' : $e =Q $a ^ $b := ⟨⟩
      pure (by 

Proof state:
u : Level
α : Q(Type u)
zα : Q(Zero «$α»)
pα : Q(PartialOrder «$α»)
e : Q(«$α»)
fn✝ : Expr
a : Q(«$α»)
b : Q(ℤ)
_a : Q(LinearOrderedField «$α»)
zα_eq✝ : «$zα» =Q CommMonoidWithZero.toZero
pα_eq✝ : «$pα» =Q StrictOrderedRing.toPartialOrder
us✝ : List Level
arg✝¹ : Expr
n : ℕ
arg✝ : Expr
x✝ : PUnit.{1}
m : Q(ℕ)
this✝ : «$b» =Q ↑«$m» + ↑«$m»
this : «$e» =Q «$a» ^ «$b»
⊢ Strictness zα pα e

Next tactic:
exact .nonnegative q(zpow_bit0_nonneg $a $m)