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
.
Instances For
A upper bound at y
is satisfied at t
if t ≤ y
.
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 : LowerBound
A lower bound.
- upperBound : 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.
A constraint is satisfied at t
is both the lower bound and upper bound are satisfied.
Instances For
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
Flip a constraint.
This operation is not useful by itself, but is used to implement neg
and scale
.
Equations
- c.flip = { lowerBound := c.upperBound, upperBound := c.lowerBound }
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
- { lowerBound := some x_1, upperBound := some y }.isImpossible = decide (y < x_1)
- x✝.isImpossible = false
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
- x.combine y = { lowerBound := max x.lowerBound y.lowerBound, upperBound := min x.upperBound y.upperBound }
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.
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
Instances For
Multiply by -1
if the leading coefficient is negative, otherwise do nothing.
Equations
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
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