The areas / V34. The tactics of Mathlib
Mathlib.Tactic.NormNum.Result
96 declarations. Mathlib docs · Source
The Result type for norm_num
We set up predicates IsNat, IsInt, and IsRat,
stating that an element of a ring is equal to the "normal form" of a natural number, integer,
or rational number coerced into that ring.
We then define Result e, which contains a proof that a typed expression e : Q($α)
is equal to the coercion of an explicit natural number, integer, or rational number,
or is either true or false.
def Mathlib.Meta.NormNum.Result'.ctorIdx E1 #
Mathlib.Meta.NormNum.Result' → ℕ
theorem Mathlib.Meta.NormNum.Result'.isNNRat.inj E1 #
∀ {inst : Lean.Expr} {q : ℚ} {n d proof inst_1 : Lean.Expr} {q_1 : ℚ} {n_1 d_1 proof_1 : Lean.Expr},
Mathlib.Meta.NormNum.Result'.isNNRat inst q n d proof =
Mathlib.Meta.NormNum.Result'.isNNRat inst_1 q_1 n_1 d_1 proof_1 →
inst = inst_1 ∧ q = q_1 ∧ n = n_1 ∧ d = d_1 ∧ proof = proof_1
theorem Mathlib.Meta.NormNum.Result'.isNegNNRat.inj E1 #
∀ {inst : Lean.Expr} {q : ℚ} {n d proof inst_1 : Lean.Expr} {q_1 : ℚ} {n_1 d_1 proof_1 : Lean.Expr},
Mathlib.Meta.NormNum.Result'.isNegNNRat inst q n d proof =
Mathlib.Meta.NormNum.Result'.isNegNNRat inst_1 q_1 n_1 d_1 proof_1 →
inst = inst_1 ∧ q = q_1 ∧ n = n_1 ∧ d = d_1 ∧ proof = proof_1
abbrev Mathlib.Meta.NormNum.Result'.ctorElimType E1 #
{motive : Mathlib.Meta.NormNum.Result' → Sort u} → ℕ → Sort (max 1 u)
theorem Mathlib.Meta.NormNum.Result'.isBool.injEq E0 #
∀ (val : Bool) (proof : Lean.Expr) (val_1 : Bool) (proof_1 : Lean.Expr),
(Mathlib.Meta.NormNum.Result'.isBool val proof = Mathlib.Meta.NormNum.Result'.isBool val_1 proof_1) =
(val = val_1 ∧ proof = proof_1)
theorem Mathlib.Meta.NormNum.Result'.isNNRat.injEq E0 #
∀ (inst : Lean.Expr) (q : ℚ) (n d proof inst_1 : Lean.Expr) (q_1 : ℚ) (n_1 d_1 proof_1 : Lean.Expr),
(Mathlib.Meta.NormNum.Result'.isNNRat inst q n d proof =
Mathlib.Meta.NormNum.Result'.isNNRat inst_1 q_1 n_1 d_1 proof_1) =
(inst = inst_1 ∧ q = q_1 ∧ n = n_1 ∧ d = d_1 ∧ proof = proof_1)
def Mathlib.Meta.NormNum.instInhabitedResult'.default E1 #
Mathlib.Meta.NormNum.Result'
theorem Mathlib.Meta.NormNum.Result'.isNegNNRat.injEq E0 #
∀ (inst : Lean.Expr) (q : ℚ) (n d proof inst_1 : Lean.Expr) (q_1 : ℚ) (n_1 d_1 proof_1 : Lean.Expr),
(Mathlib.Meta.NormNum.Result'.isNegNNRat inst q n d proof =
Mathlib.Meta.NormNum.Result'.isNegNNRat inst_1 q_1 n_1 d_1 proof_1) =
(inst = inst_1 ∧ q = q_1 ∧ n = n_1 ∧ d = d_1 ∧ proof = proof_1)
theorem Mathlib.Meta.NormNum.Result'.isNegNat.injEq E0 #
∀ (inst lit proof inst_1 lit_1 proof_1 : Lean.Expr),
(Mathlib.Meta.NormNum.Result'.isNegNat inst lit proof = Mathlib.Meta.NormNum.Result'.isNegNat inst_1 lit_1 proof_1) =
(inst = inst_1 ∧ lit = lit_1 ∧ proof = proof_1)
theorem Mathlib.Meta.NormNum.Result'.isBool.inj E1 #
∀ {val : Bool} {proof : Lean.Expr} {val_1 : Bool} {proof_1 : Lean.Expr},
Mathlib.Meta.NormNum.Result'.isBool val proof = Mathlib.Meta.NormNum.Result'.isBool val_1 proof_1 →
val = val_1 ∧ proof = proof_1
theorem Mathlib.Meta.NormNum.Result'.isNat.injEq E0 #
∀ (inst lit proof inst_1 lit_1 proof_1 : Lean.Expr),
(Mathlib.Meta.NormNum.Result'.isNat inst lit proof = Mathlib.Meta.NormNum.Result'.isNat inst_1 lit_1 proof_1) =
(inst = inst_1 ∧ lit = lit_1 ∧ proof = proof_1)
theorem Mathlib.Meta.NormNum.Result'.isNegNat.inj E1 #
∀ {inst lit proof inst_1 lit_1 proof_1 : Lean.Expr},
Mathlib.Meta.NormNum.Result'.isNegNat inst lit proof = Mathlib.Meta.NormNum.Result'.isNegNat inst_1 lit_1 proof_1 →
inst = inst_1 ∧ lit = lit_1 ∧ proof = proof_1
theorem Mathlib.Meta.NormNum.Result'.isNat.inj E1 #
∀ {inst lit proof inst_1 lit_1 proof_1 : Lean.Expr},
Mathlib.Meta.NormNum.Result'.isNat inst lit proof = Mathlib.Meta.NormNum.Result'.isNat inst_1 lit_1 proof_1 →
inst = inst_1 ∧ lit = lit_1 ∧ proof = proof_1
def Mathlib.Meta.NormNum.instAddMonoidWithOne' E1 #
{α : Type u} → [Semiring α] → AddMonoidWithOne α
A shortcut (non)instance for AddMonoidWithOne α
from Semiring α to shrink generated proofs.
def Mathlib.Meta.NormNum.instAddMonoidWithOne E1 #
{α : Type u} → [Ring α] → AddMonoidWithOne α
A shortcut (non)instance for AddMonoidWithOne α from Ring α to shrink generated proofs.
theorem Mathlib.Meta.NormNum.instAtLeastTwo E1 #
∀ (n : ℕ), (n + 2).AtLeastTwo
A shortcut (non)instance for Nat.AtLeastTwo (n + 2) to shrink generated proofs.
def Mathlib.Meta.NormNum.inferAddMonoidWithOne E1 #
{u : Lean.Level} → (α : Q(Type u)) → Lean.MetaM Q(AddMonoidWithOne «$α»)
Helper function to synthesize a typed AddMonoidWithOne α expression.
def Mathlib.Meta.NormNum.inferSemiring E1 #
{u : Lean.Level} → (α : Q(Type u)) → Lean.MetaM Q(Semiring «$α»)
Helper function to synthesize a typed Semiring α expression.
def Mathlib.Meta.NormNum.inferRing E1 #
{u : Lean.Level} → (α : Q(Type u)) → Lean.MetaM Q(Ring «$α»)
Helper function to synthesize a typed Ring α expression.
def Mathlib.Meta.NormNum.mkRawIntLit E1 #
ℤ → Q(ℤ)
Represent an integer as a "raw" typed expression.
This uses .lit (.natVal n) internally to represent a natural number,
rather than the preferred OfNat.ofNat form.
We use this internally to avoid unnecessary typeclass searches.
This function is the inverse of Expr.intLit!.
def Mathlib.Meta.NormNum.mkRawRatLit E1 #
ℚ → Q(ℚ)
Represent an integer as a "raw" typed expression.
This .lit (.natVal n) internally to represent a natural number,
rather than the preferred OfNat.ofNat form.
We use this internally to avoid unnecessary typeclass searches.
def Mathlib.Meta.NormNum.rawIntLitNatAbs E1 #
(n : Q(ℤ)) → (m : Q(ℕ)) × Q(«$n».natAbs = «$m»)
Extract the raw natlit representing the absolute value of a raw integer literal
(of the type produced by Mathlib.Meta.NormNum.mkRawIntLit) along with an equality proof.
def Mathlib.Meta.NormNum.mkOfNat E1 #
{u : Lean.Level} →
(α : Q(Type u)) → (_sα : Q(AddMonoidWithOne «$α»)) → (lit : Q(ℕ)) → Lean.MetaM ((a' : Q(«$α»)) × Q(↑«$lit» = «$a'»))
Constructs an ofNat application a' with the canonical instance, together with a proof that
the instance is equal to the result of Nat.cast on the given AddMonoidWithOne instance.
This function is performance-critical, as many higher level tactics have to construct numerals. So rather than using typeclass search we hardcode the (relatively small) set of solutions to the typeclass problem.
structure Mathlib.Meta.NormNum.IsNat E1 #
{α : Type u} → [AddMonoidWithOne α] → α → ℕ → Prop
Assert that an element of a semiring is equal to the coercion of some natural number.
ctor Mathlib.Meta.NormNum.IsNat.mk E0 #
∀ {α : Type u} [inst : AddMonoidWithOne α] {a : α} {n : ℕ}, a = ↑n → Mathlib.Meta.NormNum.IsNat a n
theorem Mathlib.Meta.NormNum.IsNat.out E1 #
∀ {α : Type u} [inst : AddMonoidWithOne α] {a : α} {n : ℕ}, Mathlib.Meta.NormNum.IsNat a n → a = ↑n
The element is equal to the coercion of the natural number.
theorem Mathlib.Meta.NormNum.IsNat.raw_refl E1 #
∀ (n : ℕ), Mathlib.Meta.NormNum.IsNat n n
def Nat.rawCast E1 #
{α : Type u} → [AddMonoidWithOne α] → ℕ → α
A "raw nat cast" is an expression of the form (Nat.rawCast lit : α) where lit is a raw
natural number literal. These expressions are used by tactics like ring to decrease the number
of typeclass arguments required in each use of a number literal at type α.
theorem Mathlib.Meta.NormNum.IsNat.to_eq E0 #
∀ {α : Type u} [inst : AddMonoidWithOne α] {n : ℕ} {a a' : α}, Mathlib.Meta.NormNum.IsNat a n → ↑n = a' → a = a'
theorem Mathlib.Meta.NormNum.IsNat.to_raw_eq E0 #
∀ {α : Type u} {a : α} {n : ℕ} [inst : AddMonoidWithOne α], Mathlib.Meta.NormNum.IsNat a n → a = n.rawCast
theorem Mathlib.Meta.NormNum.IsNat.of_raw E1 #
∀ (α : Type u_1) [inst : AddMonoidWithOne α] (n : ℕ), Mathlib.Meta.NormNum.IsNat n.rawCast n
theorem Mathlib.Meta.NormNum.isNat.natElim E1 #
∀ {p : ℕ → Prop} {n n' : ℕ}, Mathlib.Meta.NormNum.IsNat n n' → p n' → p n
structure Mathlib.Meta.NormNum.IsInt E1 #
{α : Type u} → [Ring α] → α → ℤ → Prop
Assert that an element of a ring is equal to the coercion of some integer.
ctor Mathlib.Meta.NormNum.IsInt.mk E0 #
∀ {α : Type u} [inst : Ring α] {a : α} {n : ℤ}, a = ↑n → Mathlib.Meta.NormNum.IsInt a n
theorem Mathlib.Meta.NormNum.IsInt.out E1 #
∀ {α : Type u} [inst : Ring α] {a : α} {n : ℤ}, Mathlib.Meta.NormNum.IsInt a n → a = ↑n
The element is equal to the coercion of the integer.
def Int.rawCast E1 #
{α : Type u} → [Ring α] → ℤ → α
A "raw int cast" is an expression of the form:
(Nat.rawCast lit : α)wherelitis a raw natural number literal(Int.rawCast (Int.negOfNat lit) : α)wherelitis a nonzero raw natural number literal
(That is, we only actually use this function for negative integers.) This representation is used by
tactics like ring to decrease the number of typeclass arguments required in each use of a number
literal at type α.
theorem Mathlib.Meta.NormNum.IsInt.to_isNat E1 #
∀ {α : Type u_1} [inst : Ring α] {a : α} {n : ℕ},
Mathlib.Meta.NormNum.IsInt a (Int.ofNat n) → Mathlib.Meta.NormNum.IsNat a n
theorem Mathlib.Meta.NormNum.IsNat.to_isInt E1 #
∀ {α : Type u_1} [inst : Ring α] {a : α} {n : ℕ},
Mathlib.Meta.NormNum.IsNat a n → Mathlib.Meta.NormNum.IsInt a (Int.ofNat n)
theorem Mathlib.Meta.NormNum.IsInt.to_raw_eq E0 #
∀ {α : Type u} {a : α} {n : ℤ} [inst : Ring α], Mathlib.Meta.NormNum.IsInt a n → a = n.rawCast
theorem Mathlib.Meta.NormNum.IsInt.of_raw E1 #
∀ (α : Type u_1) [inst : Ring α] (n : ℤ), Mathlib.Meta.NormNum.IsInt n.rawCast n
theorem Mathlib.Meta.NormNum.IsInt.neg_to_eq E0 #
∀ {α : Type u_1} [inst : Ring α] {n : ℕ} {a a' : α}, Mathlib.Meta.NormNum.IsInt a (Int.negOfNat n) → ↑n = a' → a = -a'
theorem Mathlib.Meta.NormNum.IsInt.nonneg_to_eq E0 #
∀ {α : Type u_1} [inst : Ring α] {n : ℕ} {a a' : α}, Mathlib.Meta.NormNum.IsInt a (Int.ofNat n) → ↑n = a' → a = a'
inductive Mathlib.Meta.NormNum.IsRat E1 #
{α : Type u} → [Ring α] → α → ℤ → ℕ → Prop
Assert that an element of a ring is equal to num / denom
(and denom is invertible so that this makes sense).
We will usually also have num and denom coprime,
although this is not part of the definition.
ctor Mathlib.Meta.NormNum.IsRat.mk E0 #
∀ {α : Type u} [inst : Ring α] {a : α} {num : ℤ} {denom : ℕ} (inv : Invertible ↑denom),
a = ↑num * ⅟↑denom → Mathlib.Meta.NormNum.IsRat a num denom
inductive Mathlib.Meta.NormNum.IsNNRat E1 #
{α : Type u} → [Semiring α] → α → ℕ → ℕ → Prop
Assert that an element of a semiring is equal to num / denom
(and denom is invertible so that this makes sense).
We will usually also have num and denom coprime,
although this is not part of the definition.
ctor Mathlib.Meta.NormNum.IsNNRat.mk E0 #
∀ {α : Type u} [inst : Semiring α] {a : α} {num denom : ℕ} (inv : Invertible ↑denom),
a = ↑num * ⅟↑denom → Mathlib.Meta.NormNum.IsNNRat a num denom
def NNRat.rawCast E1 #
{α : Type u} → [DivisionSemiring α] → ℕ → ℕ → α
A "raw nnrat cast" is an expression of the form:
(Nat.rawCast lit : α)wherelitis a raw natural number literal(NNRat.rawCast n d : α)wherenis a raw nat literal,dis a raw nat literal, anddis not1or0.
This representation is used by tactics like ring to decrease the number of typeclass arguments
required in each use of a number literal at type α.
def Rat.rawCast E1 #
{α : Type u} → [DivisionRing α] → ℤ → ℕ → α
A "raw rat cast" is an expression of the form:
(Nat.rawCast lit : α)wherelitis a raw natural number literal(Int.rawCast (Int.negOfNat lit) : α)wherelitis a nonzero raw natural number literal(NNRat.rawCast n d : α)wherenis a raw nat literal,dis a raw nat literal, anddis not1or0.(Rat.rawCast (Int.negOfNat n) d : α)wherenis a raw nat literal,dis a raw nat literal,nis not0, anddis not1or0.
This representation is used by tactics like ring to decrease the number of typeclass arguments
required in each use of a number literal at type α.
theorem Mathlib.Meta.NormNum.IsNNRat.to_isNat E1 #
∀ {α : Type u_1} [inst : Semiring α] {a : α} {n : ℕ},
Mathlib.Meta.NormNum.IsNNRat a n 1 → Mathlib.Meta.NormNum.IsNat a n
theorem Mathlib.Meta.NormNum.IsRat.to_isNNRat E1 #
∀ {α : Type u_1} [inst : Ring α] {a : α} {n d : ℕ},
Mathlib.Meta.NormNum.IsRat a (Int.ofNat n) d → Mathlib.Meta.NormNum.IsNNRat a n d
theorem Mathlib.Meta.NormNum.IsNat.to_isNNRat E1 #
∀ {α : Type u_1} [inst : Semiring α] {a : α} {n : ℕ},
Mathlib.Meta.NormNum.IsNat a n → Mathlib.Meta.NormNum.IsNNRat a n 1
theorem Mathlib.Meta.NormNum.IsNNRat.to_isRat E1 #
∀ {α : Type u_1} [inst : Ring α] {a : α} {n d : ℕ},
Mathlib.Meta.NormNum.IsNNRat a n d → Mathlib.Meta.NormNum.IsRat a (Int.ofNat n) d
theorem Mathlib.Meta.NormNum.IsRat.to_isInt E1 #
∀ {α : Type u_1} [inst : Ring α] {a : α} {n : ℤ}, Mathlib.Meta.NormNum.IsRat a n 1 → Mathlib.Meta.NormNum.IsInt a n
theorem Mathlib.Meta.NormNum.IsInt.to_isRat E1 #
∀ {α : Type u_1} [inst : Ring α] {a : α} {n : ℤ}, Mathlib.Meta.NormNum.IsInt a n → Mathlib.Meta.NormNum.IsRat a n 1
theorem Mathlib.Meta.NormNum.IsNNRat.to_raw_eq E0 #
∀ {α : Type u} {n d : ℕ} [inst : DivisionSemiring α] {a : α}, Mathlib.Meta.NormNum.IsNNRat a n d → a = NNRat.rawCast n d
theorem Mathlib.Meta.NormNum.IsRat.to_raw_eq E0 #
∀ {α : Type u} {n : ℤ} {d : ℕ} [inst : DivisionRing α] {a : α}, Mathlib.Meta.NormNum.IsRat a n d → a = Rat.rawCast n d
theorem Mathlib.Meta.NormNum.IsRat.neg_to_eq E0 #
∀ {α : Type u_1} [inst : DivisionRing α] {n d : ℕ} {a n' d' : α},
Mathlib.Meta.NormNum.IsRat a (Int.negOfNat n) d → ↑n = n' → ↑d = d' → a = -(n' / d')
theorem Mathlib.Meta.NormNum.IsNNRat.to_eq E0 #
∀ {α : Type u_1} [inst : DivisionSemiring α] {n d : ℕ} {a n' d' : α},
Mathlib.Meta.NormNum.IsNNRat a n d → ↑n = n' → ↑d = d' → a = n' / d'
theorem Mathlib.Meta.NormNum.IsNNRat.of_raw E1 #
∀ (α : Type u_1) [inst : DivisionSemiring α] (n d : ℕ), ↑d ≠ 0 → Mathlib.Meta.NormNum.IsNNRat (NNRat.rawCast n d) n d
theorem Mathlib.Meta.NormNum.IsRat.of_raw E1 #
∀ (α : Type u_1) [inst : DivisionRing α] (n : ℤ) (d : ℕ), ↑d ≠ 0 → Mathlib.Meta.NormNum.IsRat (Rat.rawCast n d) n d
theorem Mathlib.Meta.NormNum.IsNNRat.den_nz E1 #
∀ {α : Type u_1} [inst : DivisionSemiring α] {a : α} {n d : ℕ}, Mathlib.Meta.NormNum.IsNNRat a n d → ↑d ≠ 0
theorem Mathlib.Meta.NormNum.IsRat.den_nz E1 #
∀ {α : Type u_1} [inst : DivisionRing α] {a : α} {n : ℤ} {d : ℕ}, Mathlib.Meta.NormNum.IsRat a n d → ↑d ≠ 0
inductive Mathlib.Meta.NormNum.Result' E1 #
Type
The result of norm_num running on an expression x of type α.
Untyped version of Result.
ctor Mathlib.Meta.NormNum.Result'.isBool E0 #
Bool → Lean.Expr → Mathlib.Meta.NormNum.Result'
Untyped version of Result.isBool.
ctor Mathlib.Meta.NormNum.Result'.isNat E0 #
Lean.Expr → Lean.Expr → Lean.Expr → Mathlib.Meta.NormNum.Result'
Untyped version of Result.isNat.
ctor Mathlib.Meta.NormNum.Result'.isNegNat E0 #
Lean.Expr → Lean.Expr → Lean.Expr → Mathlib.Meta.NormNum.Result'
Untyped version of Result.isNegNat.
ctor Mathlib.Meta.NormNum.Result'.isNNRat E0 #
Lean.Expr → ℚ → Lean.Expr → Lean.Expr → Lean.Expr → Mathlib.Meta.NormNum.Result'
Untyped version of Result.isNNRat.
ctor Mathlib.Meta.NormNum.Result'.isNegNNRat E0 #
Lean.Expr → ℚ → Lean.Expr → Lean.Expr → Lean.Expr → Mathlib.Meta.NormNum.Result'
Untyped version of Result.isNegNNRat.
instance Mathlib.Meta.NormNum.instInhabitedResult' E0 #
Inhabited Mathlib.Meta.NormNum.Result'
def Mathlib.Meta.NormNum.Result E1 #
{u : Lean.Level} → {α : Q(Type u)} → Q(«$α») → Type
The result of norm_num running on an expression x of type α.
instance Mathlib.Meta.NormNum.instInhabitedResult E0 #
{u : Lean.Level} → {α : Q(Type u)} → {x : Q(«$α»)} → Inhabited (Mathlib.Meta.NormNum.Result x)
def Mathlib.Meta.NormNum.Result.isTrue E1 #
{x : Q(Prop)} → Q(«$x») → Mathlib.Meta.NormNum.Result q(«$x»)
The result is proof : x, where x is a (true) proposition.
def Mathlib.Meta.NormNum.Result.isFalse E1 #
{x : Q(Prop)} → Q(¬«$x») → Mathlib.Meta.NormNum.Result q(«$x»)
The result is proof : ¬x, where x is a (false) proposition.
def Mathlib.Meta.NormNum.Result.isNat E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(AddMonoidWithOne «$α») Mathlib.Meta.NormNum.Result.isNat._auto_1) →
(lit : Q(ℕ)) → Q(Mathlib.Meta.NormNum.IsNat «$x» «$lit») → Mathlib.Meta.NormNum.Result x
The result is lit : ℕ (a raw nat literal) and proof : isNat x lit.
def Mathlib.Meta.NormNum.Result.isNegNat E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(Ring «$α») Mathlib.Meta.NormNum.Result.isNegNat._auto_1) →
(lit : Q(ℕ)) → Q(Mathlib.Meta.NormNum.IsInt «$x» (Int.negOfNat «$lit»)) → Mathlib.Meta.NormNum.Result x
The result is -lit where lit is a raw nat literal
and proof : isInt x (.negOfNat lit).
def Mathlib.Meta.NormNum.Result.isNNRat E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(DivisionSemiring «$α») Mathlib.Meta.NormNum.Result.isNNRat._auto_1) →
ℚ → (n d : Q(ℕ)) → Q(Mathlib.Meta.NormNum.IsNNRat «$x» «$n» «$d») → Mathlib.Meta.NormNum.Result x
The result is proof : IsNNRat x n d,
where n a raw nat literal, d is a raw nat literal (not 0 or 1),
n and d are coprime, and q is the value of n / d.
def Mathlib.Meta.NormNum.Result.isNegNNRat E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(DivisionRing «$α») Mathlib.Meta.NormNum.Result.isNegNNRat._auto_1) →
ℚ → (n d : Q(ℕ)) → Q(Mathlib.Meta.NormNum.IsRat «$x» (Int.negOfNat «$n») «$d») → Mathlib.Meta.NormNum.Result x
The result is proof : IsRat x n d,
where n is .negOfNat lit with lit a raw nat literal,
d is a raw nat literal (not 0 or 1),
n and d are coprime, and q is the value of n / d.
def Mathlib.Meta.NormNum.Result.isInt E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(Ring «$α») Mathlib.Meta.NormNum.Result.isInt._auto_1) →
(z : Q(ℤ)) → ℤ → Q(Mathlib.Meta.NormNum.IsInt «$x» «$z») → Mathlib.Meta.NormNum.Result x
The result is z : ℤ and proof : isNat x z.
def Mathlib.Meta.NormNum.Result.isNNRat' E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(DivisionSemiring «$α») Mathlib.Meta.NormNum.Result.isNNRat'._auto_1) →
ℚ → (n d : Q(ℕ)) → Q(Mathlib.Meta.NormNum.IsNNRat «$x» «$n» «$d») → Mathlib.Meta.NormNum.Result x
The result is q : NNRat and proof : isNNRat x q.
def Mathlib.Meta.NormNum.Result.isRat E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(DivisionRing «$α») Mathlib.Meta.NormNum.Result.isRat._auto_1) →
ℚ → (n : Q(ℤ)) → (d : Q(ℕ)) → Q(Mathlib.Meta.NormNum.IsRat «$x» «$n» «$d») → Mathlib.Meta.NormNum.Result x
The result is q : ℚ and proof : isRat x q.
instance Mathlib.Meta.NormNum.instToMessageDataResult E0 #
{u : Lean.Level} → {α : Q(Type u)} → {x : Q(«$α»)} → Lean.ToMessageData (Mathlib.Meta.NormNum.Result x)
def Mathlib.Meta.NormNum.Result.toRat E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Meta.NormNum.Result e → Option ℚ
Returns the rational number that is the result of norm_num evaluation.
def Mathlib.Meta.NormNum.Result.toRatNZ E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Meta.NormNum.Result e → Option (ℚ × Option Lean.Expr)
Returns the rational number that is the result of norm_num evaluation, along with a proof
that the denominator is nonzero in the isRat case.
def Mathlib.Meta.NormNum.Result.toInt E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{e : Q(«$α»)} →
(_i : autoParam Q(Ring «$α») Mathlib.Meta.NormNum.Result.toInt._auto_1) →
Mathlib.Meta.NormNum.Result e → Option (ℤ × (lit : Q(ℤ)) × Q(Mathlib.Meta.NormNum.IsInt «$e» «$lit»))
Extract from a Result the integer value (as both a term and an expression),
and the proof that the original expression is equal to this integer.
def Mathlib.Meta.NormNum.Result.toNNRat' E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{e : Q(«$α»)} →
(_i : autoParam Q(DivisionSemiring «$α») Mathlib.Meta.NormNum.Result.toNNRat'._auto_1) →
Mathlib.Meta.NormNum.Result e →
Option (ℚ × (n : Q(ℕ)) × (d : Q(ℕ)) × Q(Mathlib.Meta.NormNum.IsNNRat «$e» «$n» «$d»))
Extract from a Result the rational value (as both a term and an expression),
and the proof that the original expression is equal to this rational number.
def Mathlib.Meta.NormNum.Result.toRat' E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
{e : Q(«$α»)} →
(_i : autoParam Q(DivisionRing «$α») Mathlib.Meta.NormNum.Result.toRat'._auto_1) →
Mathlib.Meta.NormNum.Result e →
Option (ℚ × (n : Q(ℤ)) × (d : Q(ℕ)) × Q(Mathlib.Meta.NormNum.IsRat «$e» «$n» «$d»))
Extract from a Result the rational value (as both a term and an expression),
and the proof that the original expression is equal to this rational number.
def Mathlib.Meta.NormNum.Result.toRawEq E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Meta.NormNum.Result e → (e' : Q(«$α»)) × Q(«$e» = «$e'»)
Given a NormNum.Result e (which uses IsNat, IsInt, IsRat to express equality to a rational
numeral), converts it to an equality e = Nat.rawCast n, e = Int.rawCast n, or
e = Rat.rawCast n d to a raw cast expression, so it can be used for rewriting.
def Mathlib.Meta.NormNum.Result.toRawIntEq E1 #
{u : Lean.Level} →
{α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Meta.NormNum.Result e → Option (ℤ × (e' : Q(«$α»)) × Q(«$e» = «$e'»))
Result.toRawEq but providing an integer. Given a NormNum.Result e for something known to be an
integer (which uses IsNat or IsInt to express equality to an integer numeral), converts it to
an equality e = Nat.rawCast n or e = Int.rawCast n to a raw cast expression, so it can be used
for rewriting. Gives none if not an integer.
def Mathlib.Meta.NormNum.Result.ofRawNat E1 #
{u : Lean.Level} → {α : Q(Type u)} → (e : Q(«$α»)) → Mathlib.Meta.NormNum.Result e
Constructs a Result out of a raw nat cast. Assumes e is a raw nat cast expression.
def Mathlib.Meta.NormNum.Result.ofRawInt E1 #
{u : Lean.Level} → {α : Q(Type u)} → ℤ → (e : Q(«$α»)) → Mathlib.Meta.NormNum.Result e
Constructs a Result out of a raw int cast.
Assumes e is a raw int cast expression denoting n.
def Mathlib.Meta.NormNum.Result.ofRawNNRat E1 #
{u : Lean.Level} →
{α : Q(Type u)} → ℚ → (e : Q(«$α»)) → optParam (Option Lean.Expr) none → Mathlib.Meta.NormNum.Result e
Constructs a Result out of a raw rat cast.
Assumes e is a raw rat cast expression denoting n.
def Mathlib.Meta.NormNum.Result.ofRawRat E1 #
{u : Lean.Level} →
{α : Q(Type u)} → ℚ → (e : Q(«$α»)) → optParam (Option Lean.Expr) none → Mathlib.Meta.NormNum.Result e
Constructs a Result out of a raw rat cast.
Assumes e is a raw rat cast expression denoting n.
def Mathlib.Meta.NormNum.Result.toSimpResult E1 #
{u : Lean.Level} → {α : Q(Type u)} → {e : Q(«$α»)} → Mathlib.Meta.NormNum.Result e → Lean.MetaM Lean.Meta.Simp.Result
Convert a Result to a Simp.Result.
abbrev Mathlib.Meta.NormNum.BoolResult E1 #
Q(Prop) → Bool → Type
Given Mathlib.Meta.NormNum.Result.isBool p b, this is the type of p.
Note that BoolResult p b is definitionally equal to Expr, and if you write match b with ...,
then in the true branch BoolResult p true is reducibly equal to Q($p) and
in the false branch it is reducibly equal to Q(¬ $p).
def Mathlib.Meta.NormNum.Result.ofBoolResult E1 #
{p : Q(Prop)} → {b : Bool} → Mathlib.Meta.NormNum.BoolResult p b → Mathlib.Meta.NormNum.Result q(Prop)
Obtain a Result from a BoolResult.
def Mathlib.Meta.NormNum.Result.eqTrans E1 #
{u : Lean.Level} →
{α : Q(Type u)} → {a b : Q(«$α»)} → Q(«$a» = «$b») → Mathlib.Meta.NormNum.Result b → Mathlib.Meta.NormNum.Result a
If a = b and we can evaluate b, then we can evaluate a.