The tactic language is a special-purpose programming language for constructing proofs, indicated using the keyword by.
additive_combination
additive_combination attempts to simplify the target by creating a additive combination
of a list of equalities and subtracting it from the target.
The tactic will create a additive
combination by adding the equalities together from left to right, so the order
of the input hypotheses does matter. If the normalize field of the
configuration is set to false, then the tactic will simply set the user up to
prove their target using the additive combination instead of normalizing the subtraction.
Note: The left and right sides of all the equalities should have the same
type, and the coefficients should also have this type. There must be
instances of Mul and AddGroup for this type.
- The input
einadditive_combination eis a additive combination of proofs of equalities, given as a sum/difference of coefficients multiplied by expressions. The coefficients may be arbitrary expressions. The expressions can be arbitrary proof terms proving equalities. Most commonly they are hypothesis namesh1, h2, .... additive_combination (norm := tac) eruns the "normalization tactic"tacon the subgoal(s) after constructing the additive combination.- The default normalization tactic is
abel, which closes the goal or fails. - To avoid normalization entirely, use
skipas the normalization tactic.
- The default normalization tactic is
additive_combination (exp := n) ewill take the goal to thenth power before subtracting the combinatione. In other words, if the goal ist1 = t2,additive_combination (exp := n) ewill change the goal to(t1 - t2)^n = 0before proceeding as above. This feature is not supported foradditive_combination2.
Example Usage:
example (x y : ℤ) (h1 : x*y + 2*x = 1) (h2 : x = y) : x*y = -2*y + 1 := by
additive_combination 1*h1 - 2*h2
example (x y : ℤ) (h1 : x*y + 2*x = 1) (h2 : x = y) : x*y = -2*y + 1 := by
additive_combination h1 - 2*h2
example (x y : ℤ) (h1 : x*y + 2*x = 1) (h2 : x = y) : x*y = -2*y + 1 := by
additive_combination (norm := ring_nf) -2*h2
/- Goal: x * y + x * 2 - 1 = 0 -/
example (x y z : ℝ) (ha : x + 2*y - z = 4) (hb : 2*x + y + z = -2)
(hc : x + 2*y + z = 2) :
-3*x - 3*y - 4*z = 2 := by
additive_combination ha - hb - 2*hc
example (x y : ℚ) (h1 : x + y = 3) (h2 : 3*x = 7) :
x*x*y + y*x*y + 6*x = 3*x*y + 14 := by
additive_combination x*y*h1 + 2*h2
example (x y : ℤ) (h1 : x = -3) (h2 : y = 10) : 2*x = -6 := by
additive_combination (norm := skip) 2*h1
simp
axiom qc : ℚ
axiom hqc : qc = 2*qc
example (a b : ℚ) (h : ∀ p q : ℚ, p = q) : 3*a + qc = 3*b + 2*qc := by
additive_combination 3 * h a b + hqc
- Tags:
- Defined in module:
- PrimeNumberTheoremAnd.Tactic.AdditiveCombination