Skip to content

Commit

Permalink
feat(library/tactic/simplify): load options on simplifier entry (#456)
Browse files Browse the repository at this point in the history
This allows the creation of a `simp?` tactic that locally enables
the `simplify.trace.rewrite` option.
  • Loading branch information
rwbarton committed Aug 28, 2020
1 parent 67783e6 commit 4271312
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/library/tactic/simplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,7 @@ meta constant simplify
vm_obj tactic_simplify(vm_obj const & slss, vm_obj const & u, vm_obj const & e, vm_obj const & c, vm_obj const & rel,
vm_obj const & prove, vm_obj const & _s) {
tactic_state s0 = tactic::to_state(_s);
scope_trace_env env(s0.get_options());
auto s = freeze_local_instances(s0);
bool was_frozen = is_eqp(s, s0);
try {
Expand Down
15 changes: 15 additions & 0 deletions tests/lean/simp_trace.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Options (particularly trace options) are refreshed
-- upon entry to the simplifier.

example {p : Prop} (h : p) : p :=
begin
have h₁ : true = true := rfl,
have h₂ : true = true := rfl,
have h₃ : true = true := rfl,
simp at h₁,
tactic.set_bool_option `trace.simplify.rewrite tt,
simp at h₂,
tactic.set_bool_option `pp.all tt,
simp at h₃,
exact h
end
2 changes: 2 additions & 0 deletions tests/lean/simp_trace.lean.expected.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0. [simplify.rewrite] [eq_self_iff_true]: true = true ==> true
0. [simplify.rewrite] [eq_self_iff_true]: @eq.{1} Prop true true ==> true

0 comments on commit 4271312

Please sign in to comment.