File: Mathlib/Tactic/NormNum/Result.lean

full_name: Mathlib.Meta.NormNum.instAddMonoidWithOneNat
code: /-- A shortcut (non)instance for `AddMonoidWithOne ℕ` to shrink generated proofs. -/
def instAddMonoidWithOneNat : AddMonoidWithOne ℕ 
goal: AddMonoidWithOne ℕ

full_name: Mathlib.Meta.NormNum.instAddMonoidWithOne
code: /-- A shortcut (non)instance for `AddMonoidWithOne α` from `Ring α` to shrink generated proofs. -/
def instAddMonoidWithOne {α : Type u} [Ring α] : AddMonoidWithOne α 
goal: AddMonoidWithOne α

full_name: Mathlib.Meta.NormNum.inferAddMonoidWithOne
code: /-- Helper function to synthesize a typed `AddMonoidWithOne α` expression. -/
def inferAddMonoidWithOne (α : Q(Type u)) : MetaM Q(AddMonoidWithOne $α) 
goal: Lean.MetaM Q(AddMonoidWithOne «$α»)

full_name: Mathlib.Meta.NormNum.inferSemiring
code: /-- Helper function to synthesize a typed `Semiring α` expression. -/
def inferSemiring (α : Q(Type u)) : MetaM Q(Semiring $α) 
goal: Lean.MetaM Q(Semiring «$α»)

full_name: Mathlib.Meta.NormNum.inferRing
code: /-- Helper function to synthesize a typed `Ring α` expression. -/
def inferRing (α : Q(Type u)) : MetaM Q(Ring $α) 
goal: Lean.MetaM Q(Ring «$α»)

full_name: Mathlib.Meta.NormNum.mkRawIntLit
code: /--
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 mkRawIntLit (n : ℤ) : Q(ℤ) 
goal: Q(ℤ)

full_name: Mathlib.Meta.NormNum.mkRawRatLit
code: /--
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 mkRawRatLit (q : ℚ) : Q(ℚ) 
goal: Q(ℚ)

full_name: Mathlib.Meta.NormNum.rawIntLitNatAbs
code: /-- 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 rawIntLitNatAbs (n : Q(ℤ)) : (m : Q(ℕ)) × Q(Int.natAbs $n = $m) 
goal: (m : Q(ℕ)) × Q(«$n».natAbs = «$m»)

full_name: Mathlib.Meta.NormNum.mkOfNat
code: /--
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.
-/
def mkOfNat (α : Q(Type u)) (_sα : Q(AddMonoidWithOne $α)) (lit : Q(ℕ)) :
    MetaM ((a' : Q($α)) × Q($lit = $a')) 
goal: Lean.MetaM ((a' : Q(«$α»)) × Q(↑«$lit» = «$a'»))

full_name: Mathlib.Meta.NormNum.IsNat.out
code: /-- Assert that an element of a semiring is equal to the coercion of some natural number. -/
structure IsNat {α : Type u} [AddMonoidWithOne α] (a : α) (n : ℕ) : Prop where
  /-- The element is equal to the coercion of the natural number. -/
  out : a = n
goal: a = ↑n

full_name: Mathlib.Meta.NormNum.IsNat
code: /-- Assert that an element of a semiring is equal to the coercion of some natural number. -/
structure IsNat {α : Type u} [AddMonoidWithOne α] (a : α) (n : ℕ) : Prop where
  /-- The element is equal to the coercion of the natural number. -/
  out : a = n
goal: Prop

full_name: Mathlib.Meta.NormNum.IsNat.raw_refl
code: theorem IsNat.raw_refl (n : ℕ) : IsNat n n 
goal: Mathlib.Meta.NormNum.IsNat n n

full_name: Nat.rawCast
code: /--
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 `α`.
-/
@[simp] def _root_.Nat.rawCast {α : Type u} [AddMonoidWithOne α] (n : ℕ) : α 
goal: α

full_name: Mathlib.Meta.NormNum.IsNat.to_eq
code: theorem IsNat.to_eq {α : Type u} [AddMonoidWithOne α] {n} : {a a' : α} → IsNat a n → n = a' → a = a'
  
goal: Mathlib.Meta.NormNum.IsNat a n → ↑n = a' → a = a'

full_name: Mathlib.Meta.NormNum.IsNat.to_raw_eq
code: theorem IsNat.to_raw_eq {a : α} {n : ℕ} [AddMonoidWithOne α] : IsNat (a : α) n → a = n.rawCast
  
goal: Mathlib.Meta.NormNum.IsNat a n → a = n.rawCast

full_name: Mathlib.Meta.NormNum.IsNat.of_raw
code: theorem IsNat.of_raw (α) [AddMonoidWithOne α] (n : ℕ) : IsNat (n.rawCast : α) n 
goal: Mathlib.Meta.NormNum.IsNat n.rawCast n

full_name: Mathlib.Meta.NormNum.isNat.natElim
code: @[elab_as_elim]
theorem isNat.natElim {p : ℕ → Prop} : {n : ℕ} → {n' : ℕ} → IsNat n n' → p n' → p n
  
goal: Mathlib.Meta.NormNum.IsNat n n' → p n' → p n

full_name: Mathlib.Meta.NormNum.IsInt
code: /-- Assert that an element of a ring is equal to the coercion of some integer. -/
structure IsInt [Ring α] (a : α) (n : ℤ) : Prop where
  /-- The element is equal to the coercion of the integer. -/
  out : a = n
goal: Prop

full_name: Mathlib.Meta.NormNum.IsInt.out
code: /-- Assert that an element of a ring is equal to the coercion of some integer. -/
structure IsInt [Ring α] (a : α) (n : ℤ) : Prop where
  /-- The element is equal to the coercion of the integer. -/
  out : a = n
goal: a = ↑n

full_name: Int.rawCast
code: /--
A "raw int cast" is an expression of the form:

* `(Nat.rawCast lit : α)` where `lit` is a raw natural number literal
* `(Int.rawCast (Int.negOfNat lit) : α)` where `lit` is 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 `α`.
-/
@[simp] def _root_.Int.rawCast [Ring α] (n : ℤ) : α 
goal: α

full_name: Mathlib.Meta.NormNum.IsInt.to_isNat
code: theorem IsInt.to_isNat {α} [Ring α] : ∀ {a : α} {n}, IsInt a (.ofNat n) → IsNat a n
  
goal: Mathlib.Meta.NormNum.IsInt a (Int.ofNat n) → Mathlib.Meta.NormNum.IsNat a n

full_name: Mathlib.Meta.NormNum.IsNat.to_isInt
code: theorem IsNat.to_isInt {α} [Ring α] : ∀ {a : α} {n}, IsNat a n → IsInt a (.ofNat n)
  
goal: Mathlib.Meta.NormNum.IsNat a n → Mathlib.Meta.NormNum.IsInt a (Int.ofNat n)

full_name: Mathlib.Meta.NormNum.IsInt.to_raw_eq
code: theorem IsInt.to_raw_eq {a : α} {n : ℤ} [Ring α] : IsInt (a : α) n → a = n.rawCast
  
goal: Mathlib.Meta.NormNum.IsInt a n → a = n.rawCast

full_name: Mathlib.Meta.NormNum.IsInt.of_raw
code: theorem IsInt.of_raw (α) [Ring α] (n : ℤ) : IsInt (n.rawCast : α) n 
goal: Mathlib.Meta.NormNum.IsInt n.rawCast n

full_name: Mathlib.Meta.NormNum.IsInt.neg_to_eq
code: theorem IsInt.neg_to_eq {α} [Ring α] {n} :
    {a a' : α} → IsInt a (.negOfNat n) → n = a' → a = -a'
  
goal: Mathlib.Meta.NormNum.IsInt a (Int.negOfNat n) → ↑n = a' → a = -a'

full_name: Mathlib.Meta.NormNum.IsInt.nonneg_to_eq
code: theorem IsInt.nonneg_to_eq {α} [Ring α] {n}
    {a a' : α} (h : IsInt a (.ofNat n)) (e : n = a') : a = a' 
goal: a = a'

full_name: Mathlib.Meta.NormNum.IsRat.mk
code: /--
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.
-/
inductive IsRat [Ring α] (a : α) (num : ℤ) (denom : ℕ) : Prop
  | mk (inv : Invertible (denom : α)) (eq : a = num * ⅟(denom : α))
goal: Mathlib.Meta.NormNum.IsRat a num denom

full_name: Mathlib.Meta.NormNum.IsRat
code: /--
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.
-/
inductive IsRat [Ring α] (a : α) (num : ℤ) (denom : ℕ) : Prop
  | mk (inv : Invertible (denom : α)) (eq : a = num * ⅟(denom : α))
goal: Prop

full_name: Rat.rawCast
code: /--
A "raw rat cast" is an expression of the form:

* `(Nat.rawCast lit : α)` where `lit` is a raw natural number literal
* `(Int.rawCast (Int.negOfNat lit) : α)` where `lit` is a nonzero raw natural number literal
* `(Rat.rawCast n d : α)` where `n` is a raw int literal, `d` is a raw nat literal, and `d` is not
  `1` or `0`.

(where a raw int literal is of the form `Int.ofNat lit` or `Int.negOfNat nzlit` where `lit` is a raw
nat literal)

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 `α`.
-/
@[simp]
def _root_.Rat.rawCast [DivisionRing α] (n : ℤ) (d : ℕ) : α 
goal: α

full_name: Mathlib.Meta.NormNum.IsRat.to_isNat
code: theorem IsRat.to_isNat {α} [Ring α] : ∀ {a : α} {n}, IsRat a (.ofNat n) (nat_lit 1) → IsNat a n
  
goal: Mathlib.Meta.NormNum.IsRat a (Int.ofNat n) 1 → Mathlib.Meta.NormNum.IsNat a n

full_name: Mathlib.Meta.NormNum.IsNat.to_isRat
code: theorem IsNat.to_isRat {α} [Ring α] : ∀ {a : α} {n}, IsNat a n → IsRat a (.ofNat n) (nat_lit 1)
  
goal: Mathlib.Meta.NormNum.IsNat a n → Mathlib.Meta.NormNum.IsRat a (Int.ofNat n) 1

full_name: Mathlib.Meta.NormNum.IsRat.to_isInt
code: theorem IsRat.to_isInt {α} [Ring α] : ∀ {a : α} {n}, IsRat a n (nat_lit 1) → IsInt a n
  
goal: Mathlib.Meta.NormNum.IsRat a n 1 → Mathlib.Meta.NormNum.IsInt a n

full_name: Mathlib.Meta.NormNum.IsInt.to_isRat
code: theorem IsInt.to_isRat {α} [Ring α] : ∀ {a : α} {n}, IsInt a n → IsRat a n (nat_lit 1)
  
goal: Mathlib.Meta.NormNum.IsInt a n → Mathlib.Meta.NormNum.IsRat a n 1

full_name: Mathlib.Meta.NormNum.IsRat.to_raw_eq
code: theorem IsRat.to_raw_eq {n : ℤ} {d : ℕ} [DivisionRing α] :
    ∀ {a}, IsRat (a : α) n d → a = Rat.rawCast n d
  
goal: Mathlib.Meta.NormNum.IsRat a n d → a = Rat.rawCast n d

full_name: Mathlib.Meta.NormNum.IsRat.neg_to_eq
code: theorem IsRat.neg_to_eq {α} [DivisionRing α] {n d} :
    {a n' d' : α} → IsRat a (.negOfNat n) d → n = n' → d = d' → a = -(n' / d')
  
goal: Mathlib.Meta.NormNum.IsRat a (Int.negOfNat n) d → ↑n = n' → ↑d = d' → a = -(n' / d')

full_name: Mathlib.Meta.NormNum.IsRat.nonneg_to_eq
code: theorem IsRat.nonneg_to_eq {α} [DivisionRing α] {n d} :
    {a n' d' : α} → IsRat a (.ofNat n) d → n = n' → d = d' → a = n' / d'
  
goal: Mathlib.Meta.NormNum.IsRat a (Int.ofNat n) d → ↑n = n' → ↑d = d' → a = n' / d'

full_name: Mathlib.Meta.NormNum.IsRat.of_raw
code: theorem IsRat.of_raw (α) [DivisionRing α] (n : ℤ) (d : ℕ)
    (h : (d : α) ≠ 0) : IsRat (Rat.rawCast n d : α) n d 
goal: Mathlib.Meta.NormNum.IsRat (Rat.rawCast n d) n d

full_name: Mathlib.Meta.NormNum.IsRat.den_nz
code: theorem IsRat.den_nz {α} [DivisionRing α] {a n d} : IsRat (a : α) n d → (d : α) ≠ 0
  
goal: Mathlib.Meta.NormNum.IsRat a n d → ↑d ≠ 0

full_name: Mathlib.Meta.NormNum.Result'.isBool
code: /-- The result of `norm_num` running on an expression `x` of type `α`.
Untyped version of `Result`. -/
inductive Result' where
  /-- Untyped version of `Result.isBool`. -/
  | isBool (val : Bool) (proof : Expr)
  /-- Untyped version of `Result.isNat`. -/
  | isNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isNegNat`. -/
  | isNegNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isRat`. -/
  | isRat (inst : Expr) (q : Rat) (n d proof : Expr)
  deriving Inhabited
goal: Mathlib.Meta.NormNum.Result'

full_name: Mathlib.Meta.NormNum.Result'.isNat
code: /-- The result of `norm_num` running on an expression `x` of type `α`.
Untyped version of `Result`. -/
inductive Result' where
  /-- Untyped version of `Result.isBool`. -/
  | isBool (val : Bool) (proof : Expr)
  /-- Untyped version of `Result.isNat`. -/
  | isNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isNegNat`. -/
  | isNegNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isRat`. -/
  | isRat (inst : Expr) (q : Rat) (n d proof : Expr)
  deriving Inhabited
goal: Mathlib.Meta.NormNum.Result'

full_name: Mathlib.Meta.NormNum.Result'.isNegNat
code: /-- The result of `norm_num` running on an expression `x` of type `α`.
Untyped version of `Result`. -/
inductive Result' where
  /-- Untyped version of `Result.isBool`. -/
  | isBool (val : Bool) (proof : Expr)
  /-- Untyped version of `Result.isNat`. -/
  | isNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isNegNat`. -/
  | isNegNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isRat`. -/
  | isRat (inst : Expr) (q : Rat) (n d proof : Expr)
  deriving Inhabited
goal: Mathlib.Meta.NormNum.Result'

full_name: Mathlib.Meta.NormNum.Result'.isRat
code: /-- The result of `norm_num` running on an expression `x` of type `α`.
Untyped version of `Result`. -/
inductive Result' where
  /-- Untyped version of `Result.isBool`. -/
  | isBool (val : Bool) (proof : Expr)
  /-- Untyped version of `Result.isNat`. -/
  | isNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isNegNat`. -/
  | isNegNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isRat`. -/
  | isRat (inst : Expr) (q : Rat) (n d proof : Expr)
  deriving Inhabited
goal: Mathlib.Meta.NormNum.Result'

full_name: Mathlib.Meta.NormNum.instInhabitedResult'
code: /-- The result of `norm_num` running on an expression `x` of type `α`.
Untyped version of `Result`. -/
inductive Result' where
  /-- Untyped version of `Result.isBool`. -/
  | isBool (val : Bool) (proof : Expr)
  /-- Untyped version of `Result.isNat`. -/
  | isNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isNegNat`. -/
  | isNegNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isRat`. -/
  | isRat (inst : Expr) (q : Rat) (n d proof : Expr)
  deriving Inhabited
goal: Inhabited Mathlib.Meta.NormNum.Result'

full_name: Mathlib.Meta.NormNum.Result'
code: /-- The result of `norm_num` running on an expression `x` of type `α`.
Untyped version of `Result`. -/
inductive Result' where
  /-- Untyped version of `Result.isBool`. -/
  | isBool (val : Bool) (proof : Expr)
  /-- Untyped version of `Result.isNat`. -/
  | isNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isNegNat`. -/
  | isNegNat (inst lit proof : Expr)
  /-- Untyped version of `Result.isRat`. -/
  | isRat (inst : Expr) (q : Rat) (n d proof : Expr)
  deriving Inhabited
goal: Type

full_name: Mathlib.Meta.NormNum.Result
code: /-- The result of `norm_num` running on an expression `x` of type `α`. -/
@[nolint unusedArguments] def Result {α : Q(Type u)} (x : Q($α)) 
goal: Type

full_name: Mathlib.Meta.NormNum.instInhabitedResult
code: instance {α : Q(Type u)} {x : Q($α)} : Inhabited (Result x) 
goal: Inhabited (Mathlib.Meta.NormNum.Result x)

full_name: Mathlib.Meta.NormNum.Result.isTrue
code: /-- The result is `proof : x`, where `x` is a (true) proposition. -/
@[match_pattern, inline] def Result.isTrue {x : Q(Prop)} :
    ∀ (proof : Q($x)), @Result _ (q(Prop) : Q(Type)) x 
goal: Mathlib.Meta.NormNum.Result x

full_name: Mathlib.Meta.NormNum.Result.isFalse
code: /-- The result is `proof : ¬x`, where `x` is a (false) proposition. -/
@[match_pattern, inline] def Result.isFalse {x : Q(Prop)} :
    ∀ (proof : Q(¬$x)), @Result _ (q(Prop) : Q(Type)) x 
goal: Mathlib.Meta.NormNum.Result x

full_name: Mathlib.Meta.NormNum.Result.isNat
code: /-- The result is `lit : ℕ` (a raw nat literal) and `proof : isNat x lit`. -/
@[match_pattern, inline] def Result.isNat {α : Q(Type u)} {x : Q($α)} :
    ∀ (inst : Q(AddMonoidWithOne $α) := by assumption) (lit : Q(ℕ)) (proof : Q(IsNat $x $lit)),
      Result x 
goal: Mathlib.Meta.NormNum.Result x

full_name: Mathlib.Meta.NormNum.Result.isNegNat
code: /-- The result is `-lit` where `lit` is a raw nat literal
and `proof : isInt x (.negOfNat lit)`. -/
@[match_pattern, inline] def Result.isNegNat {α : Q(Type u)} {x : Q($α)} :
    ∀ (inst : Q(Ring $α) := by assumption) (lit : Q(ℕ)) (proof : Q(IsInt $x (.negOfNat $lit))),
      Result x 
goal: Mathlib.Meta.NormNum.Result x

full_name: Mathlib.Meta.NormNum.Result.isRat
code: /-- The result is `proof : isRat x n d`, where `n` is either `.ofNat lit` or `.negOfNat lit`
with `lit` a raw nat literal and `d` is a raw nat literal (not 0 or 1),
and `q` is the value of `n / d`. -/
@[match_pattern, inline] def Result.isRat {α : Q(Type u)} {x : Q($α)} :
    ∀ (inst : Q(DivisionRing $α) := by assumption) (q : Rat) (n : Q(ℤ)) (d : Q(ℕ))
      (proof : Q(IsRat $x $n $d)), Result x 
goal: Mathlib.Meta.NormNum.Result x

full_name: Mathlib.Meta.NormNum.Result.isInt
code: /-- The result is `z : ℤ` and `proof : isNat x z`. -/
-- Note the independent arguments `z : Q(ℤ)` and `n : ℤ`.
-- We ensure these are "the same" when calling.
def Result.isInt {α : Q(Type u)} {x : Q($α)} (inst : Q(Ring $α) := by assumption)
    (z : Q(ℤ)) (n : ℤ) (proof : Q(IsInt $x $z)) : Result x 
goal: Mathlib.Meta.NormNum.Result x

full_name: Mathlib.Meta.NormNum.Result.isRat'
code: /-- The result depends on whether `q : ℚ` happens to be an integer, in which case the result is
`.isInt ..` whereas otherwise it's `.isRat ..`. -/
def Result.isRat' {α : Q(Type u)} {x : Q($α)} (inst : Q(DivisionRing $α) := by assumption)
    (q : Rat) (n : Q(ℤ)) (d : Q(ℕ)) (proof : Q(IsRat $x $n $d)) : Result x 
goal: Mathlib.Meta.NormNum.Result x

full_name: Mathlib.Meta.NormNum.instToMessageDataResult
code: instance {α : Q(Type u)} {x : Q($α)} : ToMessageData (Result x) 
goal: Lean.ToMessageData (Mathlib.Meta.NormNum.Result x)

full_name: Mathlib.Meta.NormNum.Result.toRat
code: /-- Returns the rational number that is the result of `norm_num` evaluation. -/
def Result.toRat {α : Q(Type u)} {e : Q($α)} : Result e → Option Rat
  
goal: Mathlib.Meta.NormNum.Result e → Option ℚ

full_name: Mathlib.Meta.NormNum.Result.toRatNZ
code: /-- 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 Result.toRatNZ {α : Q(Type u)} {e : Q($α)} : Result e → Option (Rat × Option Expr)
  
goal: Mathlib.Meta.NormNum.Result e → Option (ℚ × Option Lean.Expr)

full_name: Mathlib.Meta.NormNum.Result.toInt
code: /--
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 Result.toInt {α : Q(Type u)} {e : Q($α)} (_i : Q(Ring $α) := by with_reducible assumption) :
    Result e → Option (ℤ × (lit : Q(ℤ)) × Q(IsInt $e $lit))
  
goal: Mathlib.Meta.NormNum.Result e → Option (ℤ × (lit : Q(ℤ)) × Q(Mathlib.Meta.NormNum.IsInt «$e» «$lit»))

full_name: Mathlib.Meta.NormNum.Result.toRat'
code: /--
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 Result.toRat' {α : Q(Type u)} {e : Q($α)}
    (_i : Q(DivisionRing $α) := by with_reducible assumption) :
    Result e → Option (ℚ × (n : Q(ℤ)) × (d : Q(ℕ)) × Q(IsRat $e $n $d))
  
goal: Mathlib.Meta.NormNum.Result e → Option (ℚ × (n : Q(ℤ)) × (d : Q(ℕ)) × Q(Mathlib.Meta.NormNum.IsRat «$e» «$n» «$d»))

full_name: Mathlib.Meta.NormNum.Result.toRawEq
code: /--
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 Result.toRawEq {α : Q(Type u)} {e : Q($α)} : Result e → (e' : Q($α)) × Q($e = $e')
  
goal: Mathlib.Meta.NormNum.Result e → (e' : Q(«$α»)) × Q(«$e» = «$e'»)

full_name: Mathlib.Meta.NormNum.Result.toRawIntEq
code: /--
`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 Result.toRawIntEq {α : Q(Type u)} {e : Q($α)} : Result e →
    Option (ℤ × (e' : Q($α)) × Q($e = $e'))
  
goal: Mathlib.Meta.NormNum.Result e → Option (ℤ × (e' : Q(«$α»)) × Q(«$e» = «$e'»))

full_name: Mathlib.Meta.NormNum.Result.ofRawNat
code: /-- Constructs a `Result` out of a raw nat cast. Assumes `e` is a raw nat cast expression. -/
def Result.ofRawNat {α : Q(Type u)} (e : Q($α)) : Result e 
goal: Mathlib.Meta.NormNum.Result e

full_name: Mathlib.Meta.NormNum.Result.ofRawInt
code: /-- Constructs a `Result` out of a raw int cast.
Assumes `e` is a raw int cast expression denoting `n`. -/
def Result.ofRawInt {α : Q(Type u)} (n : ℤ) (e : Q($α)) : Result e 
goal: Mathlib.Meta.NormNum.Result e

full_name: Mathlib.Meta.NormNum.Result.ofRawRat
code: /-- Constructs a `Result` out of a raw rat cast.
Assumes `e` is a raw rat cast expression denoting `n`. -/
def Result.ofRawRat {α : Q(Type u)} (q : ℚ) (e : Q($α)) (hyp : Option Expr := none) : Result e 
goal: Mathlib.Meta.NormNum.Result e

full_name: Mathlib.Meta.NormNum.Result.toSimpResult
code: /-- Convert a `Result` to a `Simp.Result`. -/
def Result.toSimpResult {α : Q(Type u)} {e : Q($α)} : Result e → MetaM Simp.Result
  
goal: Mathlib.Meta.NormNum.Result e → Lean.MetaM Lean.Meta.Simp.Result

full_name: Mathlib.Meta.NormNum.BoolResult
code: /-- 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)`. -/
abbrev BoolResult (p : Q(Prop)) (b : Bool) : Type 
goal: Type

full_name: Mathlib.Meta.NormNum.Result.ofBoolResult
code: /-- Obtain a `Result` from a `BoolResult`. -/
def Result.ofBoolResult {p : Q(Prop)} {b : Bool} (prf : BoolResult p b) : Result q(Prop) 
goal: Mathlib.Meta.NormNum.Result q(Prop)

full_name: Mathlib.Meta.NormNum.Result.eqTrans
code: /-- If `a = b` and we can evaluate `b`, then we can evaluate `a`. -/
def Result.eqTrans {α : Q(Type u)} {a b : Q($α)} (eq : Q($a = $b)) : Result b → Result a
  
goal: Mathlib.Meta.NormNum.Result b → Mathlib.Meta.NormNum.Result a