The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V34. The tactics of Mathlib

Mathlib.Tactic.NormNum.GCD

26 declarations. Mathlib docs · Source

norm_num extensions for GCD-adjacent functions

This module defines some norm_num extensions for functions such as Nat.gcd, Nat.lcm, Int.gcd, and Int.lcm.

Note that Nat.coprime is reducible and defined in terms of Nat.gcd, so the Nat.gcd extension also indirectly provides a Nat.coprime extension.

theorem Mathlib.Meta.NormNum.int_gcd_helper' E1 #

∀ {d : ℕ} {x y : ℤ} (a b : ℤ), ↑d ∣ x → ↑d ∣ y → x * a + y * b = ↑d → x.gcd y = d

theorem Mathlib.Meta.NormNum.nat_gcd_helper_dvd_left E1 #

∀ (x y : ℕ), y % x = 0 → x.gcd y = x

theorem Mathlib.Meta.NormNum.nat_gcd_helper_dvd_right E1 #

∀ (x y : ℕ), x % y = 0 → x.gcd y = y

theorem Mathlib.Meta.NormNum.nat_gcd_helper_2 E1 #

∀ (d x y a b : ℕ), x % d = 0 → y % d = 0 → x * a = y * b + d → x.gcd y = d

theorem Mathlib.Meta.NormNum.nat_gcd_helper_1 E1 #

∀ (d x y a b : ℕ), x % d = 0 → y % d = 0 → y * b = x * a + d → x.gcd y = d

theorem Mathlib.Meta.NormNum.nat_gcd_helper_1' E1 #

∀ (x y a b : ℕ), y * b = x * a + 1 → x.gcd y = 1

theorem Mathlib.Meta.NormNum.nat_gcd_helper_2' E1 #

∀ (x y a b : ℕ), x * a = y * b + 1 → x.gcd y = 1

theorem Mathlib.Meta.NormNum.nat_lcm_helper E1 #

∀ (x y d m : ℕ), x.gcd y = d → d.beq 0 = false → x * y = d * m → x.lcm y = m

theorem Mathlib.Meta.NormNum.int_gcd_helper E1 #

∀ {x y : ℤ} {x' y' d : ℕ}, x.natAbs = x' → y.natAbs = y' → x'.gcd y' = d → x.gcd y = d

theorem Mathlib.Meta.NormNum.int_lcm_helper E1 #

∀ {x y : ℤ} {x' y' d : ℕ}, x.natAbs = x' → y.natAbs = y' → x'.lcm y' = d → x.lcm y = d

theorem Mathlib.Meta.NormNum.isNat_gcd E1 #

∀ {x y nx ny z : ℕ},
  Mathlib.Meta.NormNum.IsNat x nx →
    Mathlib.Meta.NormNum.IsNat y ny → nx.gcd ny = z → Mathlib.Meta.NormNum.IsNat (x.gcd y) z

theorem Mathlib.Meta.NormNum.isNat_lcm E1 #

∀ {x y nx ny z : ℕ},
  Mathlib.Meta.NormNum.IsNat x nx →
    Mathlib.Meta.NormNum.IsNat y ny → nx.lcm ny = z → Mathlib.Meta.NormNum.IsNat (x.lcm y) z

theorem Mathlib.Meta.NormNum.isInt_gcd E1 #

∀ {x y nx ny : ℤ} {z : ℕ},
  Mathlib.Meta.NormNum.IsInt x nx →
    Mathlib.Meta.NormNum.IsInt y ny → nx.gcd ny = z → Mathlib.Meta.NormNum.IsNat (x.gcd y) z

theorem Mathlib.Meta.NormNum.isInt_lcm E1 #

∀ {x y nx ny : ℤ} {z : ℕ},
  Mathlib.Meta.NormNum.IsInt x nx →
    Mathlib.Meta.NormNum.IsInt y ny → nx.lcm ny = z → Mathlib.Meta.NormNum.IsNat (x.lcm y) z

def Mathlib.Meta.NormNum.proveNatGCD E1 #

(ex ey : Q(ℕ)) → (ed : Q(ℕ)) × Q(«$ex».gcd «$ey» = «$ed»)

Given natural number literals ex and ey, return their GCD as a natural number literal and an equality proof. Panics if ex or ey aren't natural number literals.

def Mathlib.Meta.NormNum.evalNatGCD E1 #

Mathlib.Meta.NormNum.NormNumExt

Evaluate the Nat.gcd function.

def Mathlib.Meta.NormNum.proveNatLCM E1 #

(ex ey : Q(ℕ)) → (ed : Q(ℕ)) × Q(«$ex».lcm «$ey» = «$ed»)

Given natural number literals ex and ey, return their LCM as a natural number literal and an equality proof. Panics if ex or ey aren't natural number literals.

def Mathlib.Meta.NormNum.evalNatLCM E1 #

Mathlib.Meta.NormNum.NormNumExt

Evaluates the Nat.lcm function.

def Mathlib.Meta.NormNum.proveIntGCD E1 #

(ex ey : Q(ℤ)) → (ed : Q(ℕ)) × Q(«$ex».gcd «$ey» = «$ed»)

Given two integers, return their GCD and an equality proof. Panics if ex or ey aren't integer literals.

def Mathlib.Meta.NormNum.evalIntGCD E1 #

Mathlib.Meta.NormNum.NormNumExt

Evaluates the Int.gcd function.

def Mathlib.Meta.NormNum.proveIntLCM E1 #

(ex ey : Q(ℤ)) → (ed : Q(ℕ)) × Q(«$ex».lcm «$ey» = «$ed»)

Given two integers, return their LCM and an equality proof. Panics if ex or ey aren't integer literals.

def Mathlib.Meta.NormNum.evalIntLCM E1 #

Mathlib.Meta.NormNum.NormNumExt

Evaluates the Int.lcm function.

theorem Mathlib.Meta.NormNum.isInt_ratNum E1 #

∀ {q : ℚ} {n : ℤ} {n' d : ℕ},
  Mathlib.Meta.NormNum.IsRat q n d → n.natAbs = n' → n'.gcd d = 1 → Mathlib.Meta.NormNum.IsInt q.num n

theorem Mathlib.Meta.NormNum.isNat_ratDen E1 #

∀ {q : ℚ} {n : ℤ} {n' d : ℕ},
  Mathlib.Meta.NormNum.IsRat q n d → n.natAbs = n' → n'.gcd d = 1 → Mathlib.Meta.NormNum.IsNat q.den d

def Mathlib.Meta.NormNum.evalRatNum E1 #

Mathlib.Meta.NormNum.NormNumExt

Evaluates the Rat.num function.

def Mathlib.Meta.NormNum.evalRatDen E1 #

Mathlib.Meta.NormNum.NormNumExt

Evaluates the Rat.den function.