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
- Std.Tactic.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
- Std.Tactic.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 : Std.Tactic.Omega.LowerBound
A lower bound.
- upperBound : Std.Tactic.Omega.UpperBound
An upper bound.
Instances For
Equations
Equations
- Std.Tactic.Omega.instReprConstraint = { reprPrec := Std.Tactic.Omega.reprConstraint✝ }
Equations
- One or more equations did not get rendered due to their size.
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
- Std.Tactic.Omega.Constraint.sat c t = decide (Std.Tactic.Omega.LowerBound.sat c.lowerBound t = true ∧ Std.Tactic.Omega.UpperBound.sat c.upperBound t = true)
Instances For
Apply a function to both the lower bound and upper bound.
Equations
- Std.Tactic.Omega.Constraint.map c f = { lowerBound := Option.map f c.lowerBound, upperBound := Option.map f c.upperBound }
Instances For
Translate a constraint.
Equations
- Std.Tactic.Omega.Constraint.translate c t = Std.Tactic.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
- Std.Tactic.Omega.Constraint.flip c = { lowerBound := c.upperBound, upperBound := c.lowerBound }
Instances For
Negate a constraint. [x, y]
becomes [-y, -x]
.
Equations
- Std.Tactic.Omega.Constraint.neg c = Std.Tactic.Omega.Constraint.map (Std.Tactic.Omega.Constraint.flip c) fun (x : Int) => -x
Instances For
The trivial constraint, satisfied everywhere.
Equations
- Std.Tactic.Omega.Constraint.trivial = { lowerBound := none, upperBound := none }
Instances For
The impossible constraint, unsatisfiable.
Equations
- Std.Tactic.Omega.Constraint.impossible = { lowerBound := some 1, upperBound := some 0 }
Instances For
An exact constraint.
Equations
- Std.Tactic.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
Instances For
The conjunction of two constraints.
Equations
- Std.Tactic.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
- Std.Tactic.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.