A Constraint
consists of an optional lower and upper bound (inclusive),
constraining a value to a set of the form ∅
, {x}
, [x, y]
, [x, ∞)
, (-∞, y]
, or (-∞, ∞)
.
An optional lower bound on a integer.
Equations
Instances For
An optional upper bound on a integer.
Equations
Instances For
A lower bound at x
is satisfied at t
if x ≤ t
.
Equations
- b.sat t = Option.all (fun (x : Int) => decide (x ≤ t)) b
Instances For
A upper bound at y
is satisfied at t
if t ≤ y
.
Equations
- b.sat t = Option.all (fun (y : Int) => decide (t ≤ y)) b
Instances For
A Constraint
consists of an optional lower and upper bound (inclusive),
constraining a value to a set of the form ∅
, {x}
, [x, y]
, [x, ∞)
, (-∞, y]
, or (-∞, ∞)
.
- lowerBound : Lean.Omega.LowerBound
A lower bound.
- upperBound : Lean.Omega.UpperBound
An upper bound.
Instances For
Equations
Equations
- Lean.Omega.instReprConstraint = { reprPrec := Lean.Omega.reprConstraint✝ }
Equations
- One or more equations did not get rendered due to their size.
Apply a function to both the lower bound and upper bound.
Equations
- c.map f = { lowerBound := Option.map f c.lowerBound, upperBound := Option.map f c.upperBound }
Instances For
Translate a constraint.
Instances For
Negate a constraint. [x, y]
becomes [-y, -x]
.
Instances For
The trivial constraint, satisfied everywhere.
Equations
- Lean.Omega.Constraint.trivial = { lowerBound := none, upperBound := none }
Instances For
The impossible constraint, unsatisfiable.
Equations
- Lean.Omega.Constraint.impossible = { lowerBound := some 1, upperBound := some 0 }
Instances For
An exact constraint.
Equations
- Lean.Omega.Constraint.exact r = { lowerBound := some r, upperBound := some r }
Instances For
Check if a constraint is unsatisfiable.
Equations
Instances For
Check if a constraint requires an exact value.
Equations
Instances For
Scale a constraint by multiplying by an integer.
- If
k = 0
this is either impossible, if the original constraint was impossible, or the= 0
exact constraint. - If
k
is positive this takes[x, y]
to[k * x, k * y]
- If
k
is negative this takes[x, y]
to[k * y, k * x]
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The sum of two constraints. [a, b] + [c, d] = [a + c, b + d]
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A linear combination of two constraints.
Equations
- Lean.Omega.Constraint.combo a x b y = (Lean.Omega.Constraint.scale a x).add (Lean.Omega.Constraint.scale b y)
Instances For
The conjunction of two constraints.
Equations
Instances For
Dividing a constraint by a natural number, and tightened to integer bounds. Thus the lower bound is rounded up, and the upper bound is rounded down.
Equations
- c.div k = { lowerBound := Option.map (fun (x : Int) => -(-x / ↑k)) c.lowerBound, upperBound := Option.map (fun (y : Int) => y / ↑k) c.upperBound }
Instances For
It is convenient below to say that a constraint is satisfied at the dot product of two vectors,
so we make an abbreviation sat'
for this.
Equations
- c.sat' x y = c.sat (x.dot y)
Instances For
Normalize a constraint, by dividing through by the GCD.
Return none
if there is nothing to do, to avoid adding unnecessary steps to the proof term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Normalize a constraint, by dividing through by the GCD.
Equations
- Lean.Omega.normalize p = (Lean.Omega.normalize? p).getD p
Instances For
Shorthand for the first component of normalize
.
Equations
- Lean.Omega.normalizeConstraint s x = (Lean.Omega.normalize (s, x)).fst
Instances For
Shorthand for the second component of normalize
.
Equations
- Lean.Omega.normalizeCoeffs s x = (Lean.Omega.normalize (s, x)).snd
Instances For
Multiply by -1
if the leading coefficient is negative, otherwise return none
.
Equations
- Lean.Omega.positivize? x = match x with | (s, x) => if 0 ≤ x.leading then none else some (s.neg, x.smul (-1))
Instances For
Multiply by -1
if the leading coefficient is negative, otherwise do nothing.
Equations
- Lean.Omega.positivize p = (Lean.Omega.positivize? p).getD p
Instances For
Shorthand for the first component of positivize
.
Equations
- Lean.Omega.positivizeConstraint s x = (Lean.Omega.positivize (s, x)).fst
Instances For
Shorthand for the second component of positivize
.
Equations
- Lean.Omega.positivizeCoeffs s x = (Lean.Omega.positivize (s, x)).snd
Instances For
positivize
and normalize
, returning none
if neither does anything.
Equations
- One or more equations did not get rendered due to their size.
Instances For
positivize
and normalize
Equations
- Lean.Omega.tidy p = (Lean.Omega.tidy? p).getD p
Instances For
Shorthand for the first component of tidy
.
Equations
- Lean.Omega.tidyConstraint s x = (Lean.Omega.tidy (s, x)).fst
Instances For
Shorthand for the second component of tidy
.
Equations
- Lean.Omega.tidyCoeffs s x = (Lean.Omega.tidy (s, x)).snd
Instances For
The value of the new variable introduced when solving a hard equality.
Equations
- Lean.Omega.bmod_div_term m a b = Lean.Omega.Coeffs.bmod_dot_sub_dot_bmod m a b / ↑m
Instances For
The coefficients of the new equation generated when solving a hard equality.
Equations
- Lean.Omega.bmod_coeffs m i x = (x.bmod m).set i ↑m