intlinarith
ilNegLe
Section titled “ilNegLe”def ilNegLe (x : Nat) (y : Nat) (h : or (Nat.blt y x) (Nat.beq x y) = true) : Nat.ble y x = trueRewrites the order test between two negative integers into leNat y x.
ilNegLeBack
Section titled “ilNegLeBack”def ilNegLeBack (x : Nat) (y : Nat) (h : Nat.ble y x = true) : or (Nat.blt y x) (Nat.beq x y) = trueConverts leNat y x back into the order test between two negative integers.
ilLtToLe
Section titled “ilLtToLe”def ilLtToLe (a : Nat) (b : Nat) (h : Nat.blt a b = true) : Nat.ble (succ a) b = trueA strict Nat comparison a < b gives succ a <= b.
ilLeToLt
Section titled “ilLeToLt”def ilLeToLt (a : Nat) (b : Nat) (h : Nat.ble (succ a) b = true) : Nat.blt a b = truesucc a <= b gives the strict Nat comparison a < b.
ilLtSuccToLe
Section titled “ilLtSuccToLe”def ilLtSuccToLe (y : Nat) (x : Nat) (h : Nat.blt y (succ x) = true) : Nat.ble y x = truey < succ x on Nat gives y <= x.
ilLeToLtSucc
Section titled “ilLeToLtSucc”def ilLeToLtSucc (y : Nat) (x : Nat) (h : Nat.ble y x = true) : Nat.blt y (succ x) = truey <= x on Nat gives y < succ x.
ilOrTrueR
Section titled “ilOrTrueR”def ilOrTrueR (b : Bool) : or b true = trueA boolean disjunction with true on the right is true.
ilLeZero
Section titled “ilLeZero”def ilLeZero (y : Nat) : Nat.ble zero y = trueZero is at most every natural number.
ilNegPos
Section titled “ilNegPos”theorem ilNegPos (p : Int) (y : Int) : Int.add (Int.neg p) (Int.add p y) = yRing identity: -p + (p + y) = y.
ilNegNeg
Section titled “ilNegNeg”theorem ilNegNeg (p : Int) (k : Int) : Int.add (Int.neg (Int.add p k)) k = Int.neg pRing identity: -(p + k) + k = -p.
ilNegPosW
Section titled “ilNegPosW”def ilNegPosW (x : Nat) (y : Nat) : Int.add (negsucc x) (pos (add (succ x) y)) = pos yAdding pos (succ x + y) to negsucc x gives pos y.
ilNegNegW
Section titled “ilNegNegW”def ilNegNegW (y : Nat) (k : Nat) : Int.add (negsucc (add y k)) (pos k) = negsucc yAdding pos k to negsucc (y + k) gives negsucc y.
def ileW (a : Int) (b : Int) : Int.ble a b = true -> (k : Nat) × (Int.add a (pos k) = b)Turns a <= b on Int into a witness k with a + k = b.
ileRefl
Section titled “ileRefl”def ileRefl (a : Int) : Int.ble a a = trueThe Int order is reflexive.
ileSucR
Section titled “ileSucR”def ileSucR (a : Int) (c : Int) : Int.ble a c = true -> Int.ble a (Int.succ c) = trueIf a <= c then a <= c + 1 on Int.
ileSubst
Section titled “ileSubst”def ileSubst (a : Int) (b : Int) (c : Int) (p : b = c) (h : Int.ble a b = true) : Int.ble a c = trueTransports a <= b along an equality b = c.
ileAdd
Section titled “ileAdd”def ileAdd (a : Int) (k : Nat) : Int.ble a (Int.add a (pos k)) = trueEvery integer is at most itself plus a natural number.
def ileOf (a : Int) (b : Int) (k : Nat) (p : Int.add a (pos k) = b) : Int.ble a b = trueA witness a + k = b gives a <= b on Int.
ileOfEq
Section titled “ileOfEq”def ileOfEq (a : Int) (b : Int) (p : a = b) : (k : Nat) × (Int.add a (pos k) = b)An equality a = b gives the witness 0 for a <= b.
ileOfEqSym
Section titled “ileOfEqSym”def ileOfEqSym (a : Int) (b : Int) (p : a = b) : (k : Nat) × (Int.add b (pos k) = a)An equality a = b gives the witness 0 for b <= a.
iltToLe
Section titled “iltToLe”def iltToLe (a : Int) (b : Int) : Int.blt a b = true -> Int.ble (Int.succ a) b = trueA strict Int inequality a < b gives a + 1 <= b.
iltOfLe
Section titled “iltOfLe”def iltOfLe (a : Int) (b : Int) : Int.ble (Int.succ a) b = true -> Int.blt a b = truea + 1 <= b on Int gives the strict inequality a < b.
ILinHyp
Section titled “ILinHyp”data ILinHypA hypothesis for the Int linarith certificate: two expressions with a witness that the first plus k equals the second, and its coefficient.
ilHolds
Section titled “ilHolds”def ilHolds (ρ : List Int) (l : List ILinHyp) : TypeThe proposition that every hypothesis in the list holds under the environment.
def ilSum (l : List ILinHyp) : IntExprThe expression for the weighted sum of hypothesis gaps, the sum of c * (b - a).
def ilK (l : List ILinHyp) : NatThe natural number summing c * k over the hypotheses, the value of their weighted gap sum.
ilDiff
Section titled “ilDiff”theorem ilDiff (a : Int) (k : Int) : Int.add (Int.add a k) (Int.neg a) = kRing identity: (a + k) - a = k.
ilDiffAt
Section titled “ilDiffAt”def ilDiffAt (a : Int) (b : Int) (k : Nat) (h : Int.add a (pos k) = b) : Int.add b (Int.neg a) = pos kA witness a + k = b gives b - a = k.
ilSumEval
Section titled “ilSumEval”def ilSumEval (ρ : List Int) (l : List ILinHyp) (pf : ilHolds ρ l) : intEval ρ (ilSum l) = pos (ilK l)Under holding hypotheses, the weighted gap sum evaluates to the nonnegative integer ilK.
ilPosOfMul
Section titled “ilPosOfMul”def ilPosOfMul (L : Nat) (x : Int) (K : Nat) : Int.mul (pos (succ L)) x = pos K -> (k : Nat) × (x = pos k)If a positive multiple of x is a nonnegative integer, x is nonnegative.
ilAddSub
Section titled “ilAddSub”theorem ilAddSub (a : Int) (b : Int) : Int.add a (Int.add b (Int.neg a)) = bRing identity: a + (b - a) = b.
intLinMul
Section titled “intLinMul”def intLinMul (ρ : List Int) (l : List ILinHyp) (pf : ilHolds ρ l) (a : IntExpr) (b : IntExpr) (L : Nat) (c : Nat) (cert : intCheckL (imul (inum (succ L)) (iadd b (ineg a))) (iadd (ilSum l) (inum c)) = intCheckR (imul (inum (succ L)) (iadd b (ineg a))) (iadd (ilSum l) (inum c))) : Int.mul (pos (succ L)) (Int.add (intEval ρ b) (Int.neg (intEval ρ a))) = pos (add (ilK l) c)Checked by the certificate, M times (b - a) equals the weighted hypothesis sum plus a constant, a nonnegative integer.
intLinW
Section titled “intLinW”def intLinW (ρ : List Int) (l : List ILinHyp) (pf : ilHolds ρ l) (a : IntExpr) (b : IntExpr) (L : Nat) (c : Nat) (cert : intCheckL (imul (inum (succ L)) (iadd b (ineg a))) (iadd (ilSum l) (inum c)) = intCheckR (imul (inum (succ L)) (iadd b (ineg a))) (iadd (ilSum l) (inum c))) : (k : Nat) × (Int.add (intEval ρ b) (Int.neg (intEval ρ a)) = pos k)Under a valid certificate, b - a is a nonnegative integer.
ilLeOfDiff
Section titled “ilLeOfDiff”def ilLeOfDiff (x : Int) (y : Int) (w : (k : Nat) × (Int.add y (Int.neg x) = pos k)) : Int.ble x y = trueA nonnegative difference y - x gives x <= y on Int.
intLinLe
Section titled “intLinLe”def intLinLe (ρ : List Int) (l : List ILinHyp) (pf : ilHolds ρ l) (a : IntExpr) (b : IntExpr) (L : Nat) (c : Nat) (cert : intCheckL (imul (inum (succ L)) (iadd b (ineg a))) (iadd (ilSum l) (inum c)) = intCheckR (imul (inum (succ L)) (iadd b (ineg a))) (iadd (ilSum l) (inum c))) : Int.ble (intEval ρ a) (intEval ρ b) = trueSoundness of the Int linarith checker for a <= goal: a valid Farkas certificate over the hypotheses proves a <= b.
intLinLt
Section titled “intLinLt”def intLinLt (ρ : List Int) (l : List ILinHyp) (pf : ilHolds ρ l) (a : IntExpr) (b : IntExpr) (L : Nat) (c : Nat) (cert : intCheckL (imul (inum (succ L)) (iadd b (ineg (iadd (inum (succ zero)) a)))) (iadd (ilSum l) (inum c)) = intCheckR (imul (inum (succ L)) (iadd b (ineg (iadd (inum (succ zero)) a)))) (iadd (ilSum l) (inum c))) : Int.blt (intEval ρ a) (intEval ρ b) = trueSoundness of the Int linarith checker for a strict goal: a certificate for a + 1 <= b proves a < b.
intLinTestTrans
Section titled “intLinTestTrans”def intLinTestTrans (x : Int) (y : Int) (z : Int) (h1 : Int.ble x y = true) (h2 : Int.ble y z = true) : Int.ble x z = trueExample use of intLinLe: from x <= y and y <= z conclude x <= z.
ilCancel
Section titled “ilCancel”theorem ilCancel (a : Int) (p : Int) : p = Int.add (Int.add a p) (Int.neg a)Ring identity: p = (a + p) - a.
ilNatAddZero
Section titled “ilNatAddZero”def ilNatAddZero (k1 : Nat) (k2 : Nat) : add k1 k2 = zero -> k1 = zeroIf a sum of two natural numbers is zero, the first is zero.
ilAntisymW
Section titled “ilAntisymW”def ilAntisymW (a : Int) (b : Int) (k1 : Nat) (k2 : Nat) (p1 : Int.add a (pos k1) = b) (p2 : Int.add b (pos k2) = a) : a = bAntisymmetry of the Int order from explicit witnesses a + k1 = b and b + k2 = a.
ilUseLe
Section titled “ilUseLe”def ilUseLe (a : Int) (b : Int) (C : Type) (w : (k : Nat) × (Int.add a (pos k) = b)) (f : (k : Nat) -> Int.add a (pos k) = b -> C) : CEliminates an Int order witness into an arbitrary type by passing its components to a continuation.
ileAntisym
Section titled “ileAntisym”def ileAntisym (a : Int) (b : Int) (h1 : Int.ble a b = true) (h2 : Int.ble b a = true) : a = bThe Int order is antisymmetric: a <= b and b <= a imply a = b.
intLinFalse
Section titled “intLinFalse”def intLinFalse (ρ : List Int) (l : List ILinHyp) (pf : ilHolds ρ l) (c : Nat) (cert : intCheckL (iadd (ilSum l) (inum (succ c))) (inum zero) = intCheckR (iadd (ilSum l) (inum (succ c))) (inum zero)) : EmptySoundness of the Int linarith contradiction checker: hypotheses whose weighted sum plus a positive constant is identically zero are inconsistent.
intLinAbsurd
Section titled “intLinAbsurd”def intLinAbsurd (A : Type) (ρ : List Int) (l : List ILinHyp) (pf : ilHolds ρ l) (c : Nat) (cert : intCheckL (iadd (ilSum l) (inum (succ c))) (inum zero) = intCheckR (iadd (ilSum l) (inum (succ c))) (inum zero)) : AProves any goal from inconsistent hypotheses certified by intLinFalse.