norm_num
Evaluating arithmetic expressions including *, +, -, ^, ≤
Transitivity conversion: given two conversions (which take an
expression e and returns (e', ⊢ e = e')), produces another
conversion that combines them with transitivity, treating failures
as reflexivity conversions.
Faster version of mk_app ``bit0 [e].
Faster version of mk_app ``bit1 [e].
- zero : norm_num.match_numeral_result
- one : norm_num.match_numeral_result
- bit0 : expr → norm_num.match_numeral_result
- bit1 : expr → norm_num.match_numeral_result
- other : norm_num.match_numeral_result
The result type of match_numeral, either 0, 1, or a top level
decomposition of bit0 e or bit1 e. The other case means it is not a numeral.
Unfold the top level constructor of the numeral expression.
Given a, b natural numerals, proves ⊢ a + 1 = b, assuming that this is provable.
(It may prove garbage instead of failing if a + 1 = b is false.)
Given a,b natural numerals, returns (r, ⊢ a + b = r).
Given a,b natural numerals, returns (r, ⊢ a * b = r).
Given a a positive natural numeral, returns ⊢ 0 < a.
Given a a rational numeral, returns ⊢ 0 < a.
Given a a rational numeral, returns ⊢ a ≠ 0.
Given a nonnegative rational and d a natural number, returns (b, ⊢ a * d = b).
(d should be a multiple of the denominator of a, so that b is a natural number.)
Given a,b,c nonnegative rational numerals, returns ⊢ a + b = c.
Given a,b,c rational numerals, returns ⊢ a + b = c.
Given a,b rational numerals, returns (c, ⊢ a + b = c).
Given a a nonnegative rational numeral, returns (b, c, ⊢ a * b = c)
where b and c are natural numerals. (b will be the denominator of a.)
Given a,b nonnegative rational numerals, returns (c, ⊢ a * b = c).
Given a,b rational numerals, returns (c, ⊢ a * b = c).
Given a a rational numeral, returns (b, ⊢ a⁻¹ = b).
Given a,b rational numerals, returns (c, ⊢ a / b = c).
Given a a rational numeral, returns (b, ⊢ -a = b).
Given a,b rational numerals, returns (c, ⊢ a - b = c).
This is needed because when a and b are numerals lean is more likely to unfold them
than unfold the instances in order to prove that add_group_has_sub = int.has_sub.
Given a : ℤ, b : ℤ integral numerals, returns (c, ⊢ a - b = c).
Evaluates the basic field operations +,neg,-,*,inv,/ on numerals.
Also handles nat subtraction. Does not do recursive simplification; that is,
1 + 1 + 1 will not simplify but 2 + 1 will. This is handled by the top level
simp call in norm_num.derive.
Given a a rational numeral and b : nat, returns (c, ⊢ a ^ b = c).
Evaluates expressions of the form a ^ b, monoid.pow a b or nat.pow a b.
Given a a rational numeral, returns ⊢ 0 ≤ a.
Given a a rational numeral, returns ⊢ 1 ≤ a.
Given a,b natural numerals, proves ⊢ a < b.
Given a,b nonnegative rational numerals, proves ⊢ a < b.
Given a,b rational numerals, proves ⊢ a < b.
Given a,b nonnegative rational numerals, proves ⊢ a ≤ b.
Given a,b rational numerals, proves ⊢ a ≤ b.
Given a,b rational numerals, proves ⊢ a ≠ b. This version
tries to prove ⊢ a < b or ⊢ b < a, and so is not appropriate for types without an order relation.
Given a' : α a natural numeral, returns (a : ℕ, ⊢ ↑a = a').
(Note that the returned value is on the left of the equality.)
Given a' : α a natural numeral, returns (a : ℤ, ⊢ ↑a = a').
(Note that the returned value is on the left of the equality.)
Given a' : α a natural numeral, returns (a : ℚ, ⊢ ↑a = a').
(Note that the returned value is on the left of the equality.)
Given a' : α a nonnegative rational numeral, returns (a : ℚ, ⊢ ↑a = a').
(Note that the returned value is on the left of the equality.)
Given a' : α an integer numeral, returns (a : ℤ, ⊢ ↑a = a').
(Note that the returned value is on the left of the equality.)
Given a' : α a rational numeral, returns (a : ℚ, ⊢ ↑a = a').
(Note that the returned value is on the left of the equality.)
Given a,b rational numerals, proves ⊢ a ≠ b. Currently it tries two methods:
- Prove
⊢ a < bor⊢ b < a, if the base type has an order - Embed
↑(a':ℚ) = aand↑(b':ℚ) = b, and then provea' ≠ b'. This requires that the base type bechar_zero, and also that it be adivision_ringso that the coercion fromℚis well defined.
We may also add coercions to ℤ and ℕ as well in order to support char_zero
rings and semirings.
Evaluates the expression nat.succ ... (nat.succ n) where n is a natural numeral.
(We could also just handle nat.succ n here and rely on simp to work bottom up, but we figure
that towers of successors coming from e.g. induction are a common case.)
Given a,b numerals in nat or int,
prove_div_mod ic a b ffreturns(c, ⊢ a / b = c)prove_div_mod ic a b ttreturns(c, ⊢ a % b = c)
Given a,a1 := bit1 a, n1 the value of a1, b and p : min_fac_helper a b,
returns (c, ⊢ min_fac a1 = c).
Given a a natural numeral, returns (b, ⊢ min_fac a = b).
Basic version of norm_num that does not call simp.
Normalize numerical expressions. Supports the operations
+ - * / ^ and % over numerical types such as
ℕ, ℤ, ℚ, ℝ, ℂ and some general algebraic types,
and can prove goals of the form A = B, A ≠ B, A < B and A ≤ B,
where A and B are numerical expressions.
It also has a relatively simple primality prover.
Normalizes a numerical expression and tries to close the goal with the result.
Basic version of norm_num that does not call simp.
Normalize numerical expressions. Supports the operations
+ - * / ^ and % over numerical types such as
ℕ, ℤ, ℚ, ℝ, ℂ and some general algebraic types,
and can prove goals of the form A = B, A ≠ B, A < B and A ≤ B,
where A and B are numerical expressions.
It also has a relatively simple primality prover.