Documentation

Mathlib.Tactic.Qify

qify tactic #

The qify tactic is used to shift propositions from or to . This is often useful since has well-behaved division.

example (a b c x y z : ℕ) (h : ¬ x*y*z < 0) : c < a + 3*b := by
  qify
  qify at h
  /-
  h : ¬↑x * ↑y * ↑z < 0
  ⊢ ↑c < ↑a + 3 * ↑b
  -/
  sorry

qify rewrites the main goal by shifting propositions from or to . This is often useful since has well-behaved subtraction and division.

qify makes use of the @[zify_simps] and @[qify_simps] attributes to insert casts into propositions, and the push_cast tactic to simplify the -valued expressions.

qify is in some sense dual to the lift tactic. lift (q : ℚ) to ℤ will change the type of a rational number q (in the supertype) to (the subtype), given a proof that q.den = 1; propositions concerning q will still be over . qify changes propositions about or (the subtype) to propositions about (the supertype), without changing the type of any variable.

  • qify at l1 l2 ... rewrites at the given locations.
  • qify [h₁, ..., hₙ] uses the expressions h₁, ..., hₙ as extra lemmas for simplification. This is especially useful in the presence of nat subtraction or of division: passing arguments of type · ≤ · or · ∣ · will allow push_cast to do more work.

Examples:

example (a b c x y z : ℕ) (h : ¬ x*y*z < 0) : c < a + 3*b := by
  qify
  qify at h
  /-
  h : ¬↑x * ↑y * ↑z < 0
  ⊢ ↑c < ↑a + 3 * ↑b
  -/
  sorry

example (a b c : ℤ) (h : a / b = c) (hab : b ∣ a) (hb : b ≠ 0) : a = c * b := by
  -- Divisibility hypothesis allows pushing `· / ·`.
  qify [hab] at h hb ⊢
  exact (div_eq_iff hb).1 h
Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem Mathlib.Tactic.Qify.intCast_eq (a b : ) :
    a = b a = b
    theorem Mathlib.Tactic.Qify.intCast_le (a b : ) :
    a b a b
    theorem Mathlib.Tactic.Qify.intCast_lt (a b : ) :
    a < b a < b
    theorem Mathlib.Tactic.Qify.intCast_ne (a b : ) :
    a b a b