@@ -19,6 +19,14 @@ deriving instance Hashable for Poly
1919deriving instance Hashable for Grind.Linarith.Expr
2020
2121mutual
22+ /-- An equality constraint and its justification/proof. -/
23+ structure EqCnstr where
24+ p : Poly
25+ h : EqCnstrProof
26+
27+ inductive EqCnstrProof where
28+ | rfl -- TODO
29+
2230/-- An inequality constraint and its justification/proof. -/
2331structure IneqCnstr where
2432 p : Poly
5866instance : Inhabited DiseqCnstr where
5967 default := { p := .nil, h := .core default default .zero .zero }
6068
69+ abbrev VarSet := RBTree Var compare
70+
6171/--
6272State for each algebraic structure by this module.
6373Each type must at least implement the instance `IntModule`.
@@ -142,6 +152,24 @@ structure Struct where
142152 -/
143153 diseqSplits : PHashMap Poly FVarId := {}
144154 /--
155+ Mapping from variable to equation constraint used to eliminate it. `solved` variables should not occur in
156+ `diseqs`, `lowers`, or `uppers`.
157+ -/
158+ elimEqs : PArray (Option EqCnstr) := {}
159+ /--
160+ Elimination stack. For every variable in `elimStack`. If `x` in `elimStack`, then `elimEqs[x]` is not `none`.
161+ -/
162+ elimStack : List Var := []
163+ /--
164+ Mapping from variable to occurrences.
165+ For example, an entry `x ↦ {y, z}` means that `x` may occur in `lowers`, or `uppers`, or `diseqs` of
166+ variables `y` and `z`.
167+ If `x` occurs in `diseqs[y]`, `lowers[y]`, or `uppers[y]`, then `y` is in `occurs[x]`,
168+ but the reverse is not true.
169+ If `x` is in `elimStack`, then `occurs[x]` is the empty set.
170+ -/
171+ occurs : PArray VarSet := {}
172+ /--
145173 Linear constraints that are not supported.
146174 We use this information for diagnostics.
147175 TODO: store constraints instead.
0 commit comments