Quote instances for Int and Rat #
Lean core provides Quote Nat, which turns a natural number into a numeral.
This file provides the analogous instances for Int and Rat,
so that tactics can turn a computed number into syntax, e.g. for a "Try this" suggestion.
Like Quote Nat, these instances produce numerals without a type ascription:
quote (-7 / 2 : ℚ) is the syntax -7 / 2, not (-7 / 2 : ℚ).
The resulting term is therefore elaborated at the expected type (for example ℝ),
and denotes the original number in any field of characteristic zero. In other types it may
not: in ℤ, / is integer division, so -7 / 2 denotes -4,
and in ℕ a negative numeral does not elaborate at all.
Quote an integer as a numeral, e.g. -7.
Equations
- One or more equations did not get rendered due to their size.
Quote a rational number as a numeral or a quotient of numerals, e.g. -7 / 2.
Equations
- One or more equations did not get rendered due to their size.