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
- Lean.Omega.LowerBound.sat b 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
- Lean.Omega.UpperBound.sat b 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.
A constraint is satisfied at t is both the lower bound and upper bound are satisfied.
Equations
- Lean.Omega.Constraint.sat c t = decide (Lean.Omega.LowerBound.sat c.lowerBound t = true ∧ Lean.Omega.UpperBound.sat c.upperBound t = true)
Instances For
Apply a function to both the lower bound and upper bound.
Equations
- Lean.Omega.Constraint.map c f = { lowerBound := Option.map f c.lowerBound, upperBound := Option.map f c.upperBound }
Instances For
Translate a constraint.
Equations
- Lean.Omega.Constraint.translate c t = Lean.Omega.Constraint.map c fun (x : Int) => x + t
Instances For
Flip a constraint.
This operation is not useful by itself, but is used to implement neg and scale.
Equations
- Lean.Omega.Constraint.flip c = { lowerBound := c.upperBound, upperBound := c.lowerBound }
Instances For
Negate a constraint. [x, y] becomes [-y, -x].
Equations
- Lean.Omega.Constraint.neg c = Lean.Omega.Constraint.map (Lean.Omega.Constraint.flip c) fun (x : Int) => -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 = 0this is either impossible, if the original constraint was impossible, or the= 0exact constraint. - If
kis positive this takes[x, y]to[k * x, k * y] - If
kis 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
Instances For
The conjunction of two constraints.
Equations
- Lean.Omega.Constraint.combine x 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
- Lean.Omega.Constraint.div c 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
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
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 ≤ Lean.Omega.Coeffs.leading x then none else some (Lean.Omega.Constraint.neg s, Lean.Omega.Coeffs.smul x (-1))
Instances For
Multiply by -1 if the leading coefficient is negative, otherwise do nothing.
Equations
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 = Option.getD (Lean.Omega.tidy? p) 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 = Lean.Omega.Coeffs.set (Lean.Omega.Coeffs.bmod x m) i ↑m