Skip to content

Commit

Permalink
chore(tactic/omega): add trace.omega option to show internal represen…
Browse files Browse the repository at this point in the history
…tation (#2377)

This is helpful when debugging issues such as #2376 and #1484.
  • Loading branch information
gebner committed Apr 10, 2020
1 parent bf8f25a commit 5169595
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tactic/omega/int/main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ do xf ← to_exprform x,
/-- Return expr of proof of current LIA goal -/
meta def prove : tactic expr :=
do (p,m) ← target >>= to_preform,
trace_if_enabled `omega p,
prove_univ_close m p

/-- Succeed iff argument is the expr of ℤ -/
Expand Down
4 changes: 4 additions & 0 deletions src/tactic/omega/main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ do is_int ← determine_domain opt,

add_hint_tactic "omega"

declare_trace omega

/--
`omega` attempts to discharge goals in the quantifier-free fragment of linear integer and natural number arithmetic using the Omega test. In other words, the core procedure of `omega` works with goals of the form
```lean
Expand All @@ -119,6 +121,8 @@ by {revert h2 i, omega manual int}
`omega` handles `nat` subtraction by repeatedly rewriting goals of the form `P[t-s]` into `P[x] ∧ (t = s + x ∨ (t ≤ s ∧ x = 0))`, where `x` is fresh. This means that each (distinct) occurrence of subtraction will cause the goal size to double during DNF transformation.
`omega` implements the real shadow step of the Omega test, but not the dark and gray shadows. Therefore, it should (in principle) succeed whenever the negation of the goal has no real solution, but it may fail if a real solution exists, even if there is no integer/natural number solution.
You can enable `set_option trace.omega true` to see how `omega` interprets your goal.
-/
add_tactic_doc
{ name := "omega",
Expand Down
1 change: 1 addition & 0 deletions src/tactic/omega/nat/main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ do xf ← to_exprform x,
/-- Return expr of proof of current LNA goal -/
meta def prove : tactic expr :=
do (p,m) ← target >>= to_preform,
trace_if_enabled `omega p,
prove_univ_close m p

/-- Succeed iff argument is expr of ℕ -/
Expand Down

0 comments on commit 5169595

Please sign in to comment.