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 delayed proof that a constraint is satisfied at the atoms.
Instances For
Our internal representation of an argument "justifying" that a constraint holds on some coefficients. We'll use this to construct the proof term once a contradiction is found.
- assumption: (s : Lean.Omega.Constraint) → (x : Lean.Omega.Coeffs) → Nat → Lean.Elab.Tactic.Omega.Justification s x
Problem.assumptions[i]
generates a proof thats.sat' coeffs atoms
- tidy: {s : Lean.Omega.Constraint} →
{c : Lean.Omega.Coeffs} →
Lean.Elab.Tactic.Omega.Justification s c →
Lean.Elab.Tactic.Omega.Justification (Lean.Omega.tidyConstraint s c) (Lean.Omega.tidyCoeffs s c)
The result of
tidy
on anotherJustification
. - combine: {s t : Lean.Omega.Constraint} →
{c : Lean.Omega.Coeffs} →
Lean.Elab.Tactic.Omega.Justification s c →
Lean.Elab.Tactic.Omega.Justification t c → Lean.Elab.Tactic.Omega.Justification (s.combine t) c
The result of
combine
on twoJustifications
. - combo: {s t : Lean.Omega.Constraint} →
{x y : Lean.Omega.Coeffs} →
(a : Int) →
Lean.Elab.Tactic.Omega.Justification s x →
(b : Int) →
Lean.Elab.Tactic.Omega.Justification t y →
Lean.Elab.Tactic.Omega.Justification (Lean.Omega.Constraint.combo a s b t) (Lean.Omega.Coeffs.combo a x b y)
A linear
combo
of twoJustifications
. - bmod: (m : Nat) →
(r : Int) →
(i : Nat) →
{x : Lean.Omega.Coeffs} →
Lean.Elab.Tactic.Omega.Justification (Lean.Omega.Constraint.exact r) x →
Lean.Elab.Tactic.Omega.Justification (Lean.Omega.Constraint.exact (r.bmod m)) (Lean.Omega.bmod_coeffs m i x)
The justification for the constraint constructed using "balanced mod" while eliminating an equality.
Instances For
Wrapping for Justification.tidy
when tidy?
is nonempty.
Equations
- j.tidy? = match Lean.Omega.tidy? (s, c) with | some val => some ⟨Lean.Omega.tidyConstraint s c, ⟨Lean.Omega.tidyCoeffs s c, j.tidy⟩⟩ | none => none
Instances For
Print a Justification
as an indented tree structure.
Equations
Instances For
Equations
- Lean.Elab.Tactic.Omega.Justification.instToString = { toString := Lean.Elab.Tactic.Omega.Justification.toString }
Construct the proof term associated to a tidy
step.
Equations
- Lean.Elab.Tactic.Omega.Justification.tidyProof s x v prf = Lean.mkApp4 (Lean.Expr.const `Lean.Omega.tidy_sat []) (Lean.toExpr s) (Lean.toExpr x) v prf
Instances For
Construct the proof term associated to a combine
step.
Equations
- Lean.Elab.Tactic.Omega.Justification.combineProof s t x v ps pt = Lean.mkApp6 (Lean.Expr.const `Lean.Omega.Constraint.combine_sat' []) (Lean.toExpr s) (Lean.toExpr t) (Lean.toExpr x) v ps pt
Instances For
Construct the proof term associated to a combo
step.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct the proof term associated to a bmod
step.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Constructs a proof that s.sat' c v = true
Equations
- One or more equations did not get rendered due to their size.
- Lean.Elab.Tactic.Omega.Justification.proof v assumptions (Lean.Elab.Tactic.Omega.Justification.assumption s c i) = assumptions[i]!
Instances For
A Justification
bundled together with its parameters.
- coeffs : Lean.Omega.Coeffs
The coefficients of a constraint.
- constraint : Lean.Omega.Constraint
The constraint.
- justification : Lean.Elab.Tactic.Omega.Justification self.constraint self.coeffs
The justification of a derived fact.
Instances For
Equations
- Lean.Elab.Tactic.Omega.Fact.instToString = { toString := fun (f : Lean.Elab.Tactic.Omega.Fact) => toString f.justification }
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A omega
problem.
This is a hybrid structure:
it contains both Expr
objects giving proofs of the "ground" assumptions
(or rather continuations which will produce the proofs when needed)
and internal representations of the linear constraints that we manipulate in the algorithm.
While the algorithm is running we do not synthesize any new Expr
proofs: proof extraction happens
only once we've found a contradiction.
- assumptions : Array Lean.Elab.Tactic.Omega.Proof
The ground assumptions that the algorithm starts from.
- numVars : Nat
The number of variables in the problem.
- constraints : Std.HashMap Lean.Omega.Coeffs Lean.Elab.Tactic.Omega.Fact
The current constraints, indexed by their coefficients.
- equalities : Std.HashSet Lean.Omega.Coeffs
The coefficients for which
constraints
contains an exact constraint (i.e. an equality). Equations that have already been used to eliminate variables, along with the variable which was removed, and its coefficient (either
1
or-1
). The earlier elements are more recent, so if these are being reapplied it is essential to useList.foldr
.- possible : Bool
Whether the problem is possible.
- proveFalse? : Option Lean.Elab.Tactic.Omega.Proof
If the problem is impossible, then
proveFalse?
will contain a proof ofFalse
. Invariant between
possible
andproveFalse?
.If we have found a contradiction,
explanation?
will contain a human readable account of the deriviation.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Takes a proof that s.sat' x v
for some s
such that s.isImpossible
,
and constructs a proof of False
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Insert a constraint into the problem, without checking if there is already a constraint for these coefficients.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a constraint into the problem, combining it with any existing constraints for the same coefficients.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Walk through the equalities, finding either the first equality with minimal coefficient ±1
,
or otherwise the equality with minimal (r.minNatAbs, r.maxNatAbs)
(ordered lexicographically).
Returns the coefficients of the equality, along with the value of minNatAbs
.
Although we don't need to run a termination proof here, it's nevertheless important that we use this ordering so the algorithm terminates in practice!
Equations
- One or more equations did not get rendered due to their size.
Instances For
If we have already solved some equalities, apply those to some new Fact
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Solve an "easy" equality, i.e. one with a coefficient that is ±1
.
After solving, the variable will have been eliminated from all constraints.
Equations
- One or more equations did not get rendered due to their size.
Instances For
We deal with a hard equality by introducing a new easy equality.
After solving the easy equality,
the minimum lexicographic value of (c.minNatAbs, c.maxNatAbs)
will have been reduced.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Solve an equality, by deciding whether it is easy (has a ±1
coefficient) or hard,
and delegating to the appropriate function.
Equations
Instances For
Recursively solve all equalities.
Constructing the proof term for addInequality
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Constructing the proof term for addEquality
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Helper function for adding an inequality of the form const + Coeffs.dot coeffs atoms ≥ 0
to a Problem
.
(This is only used while initializing a Problem
. During elimination we use addConstraint
.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Helper function for adding an equality of the form const + Coeffs.dot coeffs atoms = 0
to a Problem
.
(This is only used while initializing a Problem
. During elimination we use addConstraint
.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Folding addInequality
over a list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Folding addEquality
over a list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Representation of the data required to run Fourier-Motzkin elimination on a variable.
- var : Nat
Which variable is being eliminated.
- irrelevant : List Lean.Elab.Tactic.Omega.Fact
The "irrelevant" facts which do not involve the target variable.
- lowerBounds : List (Lean.Elab.Tactic.Omega.Fact × Int)
The facts which give a lower bound on the target variable, and the coefficient of the target variable in each.
- upperBounds : List (Lean.Elab.Tactic.Omega.Fact × Int)
The facts which give an upper bound on the target variable, and the coefficient of the target variable in each.
- lowerExact : Bool
Whether the elimination would be exact, because all of the lower bound coefficients are
±1
. - upperExact : Bool
Whether the elimination would be exact, because all of the upper bound coefficients are
±1
.
Instances For
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.
Is a Fourier-Motzkin elimination empty (i.e. there are no relevant constraints).
Instances For
The number of new constraints that would be introduced by Fourier-Motzkin elimination.
Instances For
Is the Fourier-Motzkin elimination known to be exact?
Instances For
Prepare the Fourier-Motzkin elimination data for each variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decides which variable to run Fourier-Motzkin elimination on, and returns the associated data.
We prefer eliminations which introduce no new inequalities, or otherwise exact eliminations, and break ties by the number of new inequalities introduced.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run Fourier-Motzkin elimination on one variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run the omega
algorithm (for now without dark and grey shadows!) on a problem.
As for runOmega
, but assuming the first round of solving equalities has already happened.