@@ -89,12 +89,9 @@ def atoms : OmegaM (Array Expr) := do
8989/-- Return the `Expr` representing the list of atoms. -/
9090def atomsList : OmegaM Expr := do mkListLit (.const ``Int []) (← atoms).toList
9191
92- initialize Lean.registerTraceClass `linearComboPrf
93-
9492/-- Return the `Expr` representing the list of atoms as a `Coeffs`. -/
9593def atomsCoeffs : OmegaM Expr := do
96- withTraceNode `linearComboPrf (fun _ => return "atomsCoeffs" ) do
97- return .app (.const ``Coeffs.ofList []) (← atomsList)
94+ return .app (.const ``Coeffs.ofList []) (← atomsList)
9895
9996/-- Run an `OmegaM` computation, restoring the state afterwards depending on the result. -/
10097def commitWhen (t : OmegaM (α × Bool)) : OmegaM α := do
@@ -175,7 +172,7 @@ def analyzeAtom (e : Expr) : OmegaM (List Expr) := do
175172 match e.getAppFnArgs with
176173 | (``Nat.cast, #[.const ``Int [], _, e']) =>
177174 -- Casts of natural numbers are non-negative.
178- let mut r := [( Expr.app (.const ``Int.ofNat_nonneg []) e') ]
175+ let mut r := [Expr.app (.const ``Int.ofNat_nonneg []) e']
179176 match (← cfg).splitNatSub, e'.getAppFnArgs with
180177 | true , (``HSub.hSub, #[_, _, _, _, a, b]) =>
181178 -- `((a - b : Nat) : Int)` gives a dichotomy
@@ -197,8 +194,8 @@ def analyzeAtom (e : Expr) : OmegaM (List Expr) := do
197194 let ne_zero := mkApp3 (.const ``Ne [1 ]) (.const ``Int []) k (toExpr (0 : Int))
198195 let pos := mkApp4 (.const ``LT.lt [0 ]) (.const ``Int []) (.const ``Int.instLTInt [])
199196 (toExpr (0 : Int)) k
200- pure [( mkApp3 (.const ``Int.mul_ediv_self_le []) x k (← mkDecideProof ne_zero) ),
201- ( mkApp3 (.const ``Int.lt_mul_ediv_self_add []) x k (← mkDecideProof pos) )]
197+ pure [mkApp3 (.const ``Int.mul_ediv_self_le []) x k (← mkDecideProof ne_zero),
198+ mkApp3 (.const ``Int.lt_mul_ediv_self_add []) x k (← mkDecideProof pos)]
202199 | (``HMod.hMod, #[_, _, _, _, x, k]) =>
203200 match k.getAppFnArgs with
204201 | (``HPow.hPow, #[_, _, _, _, b, exp]) => match natCast? b with
@@ -208,9 +205,9 @@ def analyzeAtom (e : Expr) : OmegaM (List Expr) := do
208205 let b_pos := mkApp4 (.const ``LT.lt [0 ]) (.const ``Int []) (.const ``Int.instLTInt [])
209206 (toExpr (0 : Int)) b
210207 let pow_pos := mkApp3 (.const ``Lean.Omega.Int.pos_pow_of_pos []) b exp (← mkDecideProof b_pos)
211- pure [( mkApp3 (.const ``Int.emod_nonneg []) x k
212- (mkApp3 (.const ``Int.ne_of_gt []) k (toExpr (0 : Int)) pow_pos)) ,
213- ( mkApp3 (.const ``Int.emod_lt_of_pos []) x k pow_pos) ]
208+ pure [mkApp3 (.const ``Int.emod_nonneg []) x k
209+ (mkApp3 (.const ``Int.ne_of_gt []) k (toExpr (0 : Int)) pow_pos),
210+ mkApp3 (.const ``Int.emod_lt_of_pos []) x k pow_pos]
214211 | (``Nat.cast, #[.const ``Int [], _, k']) =>
215212 match k'.getAppFnArgs with
216213 | (``HPow.hPow, #[_, _, _, _, b, exp]) => match natCast? b with
@@ -221,20 +218,20 @@ def analyzeAtom (e : Expr) : OmegaM (List Expr) := do
221218 (toExpr (0 : Nat)) b
222219 let pow_pos := mkApp3 (.const ``Nat.pos_pow_of_pos []) b exp (← mkDecideProof b_pos)
223220 let cast_pos := mkApp2 (.const ``Int.ofNat_pos_of_pos []) k' pow_pos
224- pure [( mkApp3 (.const ``Int.emod_nonneg []) x k
225- (mkApp3 (.const ``Int.ne_of_gt []) k (toExpr (0 : Int)) cast_pos)) ,
226- ( mkApp3 (.const ``Int.emod_lt_of_pos []) x k cast_pos) ]
221+ pure [mkApp3 (.const ``Int.emod_nonneg []) x k
222+ (mkApp3 (.const ``Int.ne_of_gt []) k (toExpr (0 : Int)) cast_pos),
223+ mkApp3 (.const ``Int.emod_lt_of_pos []) x k cast_pos]
227224 | _ => match x.getAppFnArgs with
228225 | (``Nat.cast, #[.const ``Int [], _, x']) =>
229226 -- Since we push coercions inside `%`, we need to record here that
230227 -- `(x : Int) % (y : Int)` is non-negative.
231- pure [( mkApp2 (.const ``Int.emod_ofNat_nonneg []) x' k) ]
228+ pure [mkApp2 (.const ``Int.emod_ofNat_nonneg []) x' k]
232229 | _ => pure ∅
233230 | _ => pure ∅
234231 | (``Min.min, #[_, _, x, y]) =>
235- pure [( mkApp2 (.const ``Int.min_le_left []) x y), ( mkApp2 (.const ``Int.min_le_right []) x y) ]
232+ pure [mkApp2 (.const ``Int.min_le_left []) x y, mkApp2 (.const ``Int.min_le_right []) x y]
236233 | (``Max.max, #[_, _, x, y]) =>
237- pure [( mkApp2 (.const ``Int.le_max_left []) x y), ( mkApp2 (.const ``Int.le_max_right []) x y) ]
234+ pure [mkApp2 (.const ``Int.le_max_left []) x y, mkApp2 (.const ``Int.le_max_right []) x y]
238235 | (``ite, #[α, i, dec, t, e]) =>
239236 if α == (.const ``Int []) then
240237 pure [mkApp5 (.const ``ite_disjunction [0 ]) α i dec t e]
@@ -258,7 +255,7 @@ def lookup (e : Expr) : OmegaM (Nat × Option (List Expr)) := do
258255 match c.atoms[e]? with
259256 | some i => return (i, none)
260257 | none =>
261- trace[omega] "New atom: { e} with hash { Hashable.hash e } "
258+ trace[omega] "New atom: { e} "
262259 let facts ← analyzeAtom e
263260 if ← isTracingEnabledFor `omega then
264261 unless facts.isEmpty do
0 commit comments