norm_num
basic plugins #
This file adds norm_num
plugins for
- constructors and constants
Nat.cast
,Int.cast
, andmkRat
+
,-
,*
, and/
Nat.succ
,Nat.sub
,Nat.mod
, andNat.div
.
See other files in this directory for many more plugins.
Constructors and constants #
theorem
Mathlib.Meta.NormNum.isNat_ofNat
(α : Type u)
[AddMonoidWithOne α]
{a : α}
{n : ℕ}
(h : ↑n = a)
:
IsNat a n
The norm_num
extension which identifies an expression OfNat.ofNat n
, returning n
.
Instances For
theorem
Mathlib.Meta.NormNum.isNat_natAbs_neg
{n : ℤ}
{a : ℕ}
:
IsInt n (Int.negOfNat a) → IsNat n.natAbs a
The norm_num
extension which identifies the expression Int.natAbs n
such that
norm_num
successfully recognizes n
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Casts #
Arithmetic #
def
Mathlib.Meta.NormNum.invertibleOfMul
{α : Type u_1}
[Semiring α]
(k : ℕ)
(b a : α)
[Invertible a]
:
a = ↑k * b → Invertible b
If b
divides a
and a
is invertible, then b
is invertible.
Equations
- Mathlib.Meta.NormNum.invertibleOfMul k b (↑k * b) ⋯ = { invOf := c * ↑k, invOf_mul_self := ⋯, mul_invOf_self := ⋯ }
Instances For
def
Mathlib.Meta.NormNum.invertibleOfMul'
{α : Type u_1}
[Semiring α]
{a k b : ℕ}
[Invertible ↑a]
(h : a = k * b)
:
Invertible ↑b
If b
divides a
and a
is invertible, then b
is invertible.
Equations
Instances For
Consider an Option
as an object in the MetaM
monad, by throwing an error on none
.
Equations
Instances For
def
Mathlib.Meta.NormNum.evalAdd.core
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α» → «$α»))
(a b : Q(«$α»))
(ra : Result a)
(rb : Result b)
:
Main part of evalAdd
.
Instances For
def
Mathlib.Meta.NormNum.evalAdd.core.intArm
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α» → «$α»))
(a b : Q(«$α»))
(ra : Result a)
(rb : Result b)
(rα : Q(Ring «$α»))
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Mathlib.Meta.NormNum.evalAdd.core.ratArm
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α» → «$α»))
(a b : Q(«$α»))
(ra : Result a)
(rb : Result b)
(dα : Q(DivisionRing «$α»))
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Mathlib.Meta.NormNum.evalNeg.core
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α»))
(a : Q(«$α»))
(ra : Result a)
(rα : Q(Ring «$α»))
:
Main part of evalNeg
.
Equations
- One or more equations did not get rendered due to their size.
- Mathlib.Meta.NormNum.evalNeg.core e f a (Mathlib.Meta.NormNum.Result'.isBool val proof) rα = failure
Instances For
def
Mathlib.Meta.NormNum.evalSub.core
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α» → «$α»))
(a b : Q(«$α»))
(rα : Q(Ring «$α»))
(ra : Result a)
(rb : Result b)
:
Main part of evalAdd
.
Instances For
def
Mathlib.Meta.NormNum.evalMul.core
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α» → «$α»))
(a b : Q(«$α»))
(sα : Q(Semiring «$α»))
(ra : Result a)
(rb : Result b)
:
Main part of evalMul
.
Instances For
def
Mathlib.Meta.NormNum.evalMul.core.intArm
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α» → «$α»))
(a b : Q(«$α»))
(sα : Q(Semiring «$α»))
(ra : Result a)
(rb : Result b)
(rα : Q(Ring «$α»))
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Mathlib.Meta.NormNum.evalMul.core.ratArm
{u : Lean.Level}
{α : Q(Type u)}
(e : Q(«$α»))
(f : Q(«$α» → «$α» → «$α»))
(a b : Q(«$α»))
(sα : Q(Semiring «$α»))
(ra : Result a)
(rb : Result b)
(dα : Q(DivisionRing «$α»))
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Mathlib.Meta.NormNum.inferDivisionRing
{u : Lean.Level}
(α : Q(Type u))
:
Lean.MetaM Q(DivisionRing «$α»)
Helper function to synthesize a typed DivisionRing α
expression.
Equations
- Mathlib.Meta.NormNum.inferDivisionRing α = do let __do_lift ← Qq.synthInstanceQ q(DivisionRing «$α») <|> Lean.throwError (Lean.toMessageData "not a division ring") pure __do_lift