File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Mathlib/Tactic/Positivity Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import Mathlib.Data.NNRat.Defs
1010import Mathlib.Algebra.Order.Ring.Int
1111import Mathlib.Data.Nat.Factorial.Basic
1212import Mathlib.Data.Rat.Order
13+ import Mathlib.Data.PNat.Defs
1314import Mathlib.Tactic.Positivity.Core
1415import Qq
1516
@@ -404,6 +405,15 @@ def evalNatSucc : PositivityExt where eval {u α} _zα _pα e := do
404405 pure (.positive q(Nat.succ_pos $a))
405406 | _, _, _ => throwError "not Nat.succ"
406407
408+ /-- Extension for `PNat.val`. -/
409+ @[positivity PNat.val _]
410+ def evalPNatVal : PositivityExt where eval {u α} _zα _pα e := do
411+ match u, α, e with
412+ | 0 , ~q(ℕ), ~q(PNat.val $a) =>
413+ assertInstancesCommute
414+ pure (.positive q(PNat.pos $a))
415+ | _, _, _ => throwError "not PNat.val"
416+
407417/-- Extension for `Nat.factorial`. -/
408418@[positivity Nat.factorial _]
409419def evalFactorial : PositivityExt where eval {u α} _ _ e := do
Original file line number Diff line number Diff line change 227227 [" Mathlib.Algebra.GroupPower.Order" ,
228228 " Mathlib.Algebra.Order.Group.PosPart" ,
229229 " Mathlib.Data.Int.CharZero" ,
230- " Mathlib.Data.Nat.Factorial.Basic" ],
230+ " Mathlib.Data.Nat.Factorial.Basic" ,
231+ " Mathlib.Data.PNat.Defs" ],
231232 "Mathlib.Tactic.NormNum.Ineq" :
232233 [" Mathlib.Algebra.Order.Field.Defs" , " Mathlib.Algebra.Order.Monoid.WithTop" ],
233234 "Mathlib.Tactic.NormNum.BigOperators" : [" Mathlib.Data.List.FinRange" ],
Original file line number Diff line number Diff line change @@ -282,6 +282,7 @@ example : 0 ≤ max (-3 : ℤ) 5 := by positivity
282282-- [OrderedSMul α β] {a : α} (ha : 0 < a) {b : β} (hb : 0 < b) : 0 ≤ a • b := by positivity
283283
284284example (n : ℕ) : 0 < n.succ := by positivity
285+ example (n : ℕ+) : 0 < (↑n : ℕ) := by positivity
285286example (n : ℕ) : 0 < n ! := by positivity
286287example (n k : ℕ) : 0 < (n+1 ).ascFactorial k := by positivity
287288
You can’t perform that action at this time.
0 commit comments