refactor(library/init/meta): move defeq simplifier related tactics to separate file
This commit is contained in:
parent
d70bf2f04e
commit
ada260309e
3 changed files with 28 additions and 20 deletions
|
|
@ -11,4 +11,4 @@ import init.meta.injection_tactic init.meta.relation_tactics init.meta.fun_info
|
|||
import init.meta.congr_lemma init.meta.match_tactic init.meta.ac_tactics
|
||||
import init.meta.backward init.meta.rewrite_tactic init.meta.unfold_tactic
|
||||
import init.meta.mk_dec_eq_instance init.meta.mk_inhabited_instance
|
||||
import init.meta.simp_tactic
|
||||
import init.meta.simp_tactic init.meta.defeq_simp_tactic
|
||||
|
|
|
|||
27
library/init/meta/defeq_simp_tactic.lean
Normal file
27
library/init/meta/defeq_simp_tactic.lean
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/-
|
||||
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
Authors: Leonardo de Moura
|
||||
-/
|
||||
prelude
|
||||
import init.meta.tactic
|
||||
|
||||
namespace tactic
|
||||
/- Simplify the given expression using [defeq] lemmas.
|
||||
The resulting expression is definitionally equal to the input. -/
|
||||
meta_constant defeq_simp_core : transparency → expr → tactic expr
|
||||
|
||||
meta_definition defeq_simp : expr → tactic expr :=
|
||||
defeq_simp_core reducible
|
||||
|
||||
meta_definition dsimp : tactic unit :=
|
||||
target >>= defeq_simp >>= change
|
||||
|
||||
meta_definition dsimp_at (H : expr) : tactic unit :=
|
||||
do num_reverted : ℕ ← revert H,
|
||||
(expr.pi n bi d b : expr) ← target | failed,
|
||||
H_simp : expr ← defeq_simp d,
|
||||
change $ expr.pi n bi H_simp b,
|
||||
intron num_reverted
|
||||
|
||||
end tactic
|
||||
|
|
@ -163,9 +163,6 @@ meta_constant to_expr : qexpr → tactic expr
|
|||
meta_constant is_class : expr → tactic bool
|
||||
/- Try to create an instance of the given type class. -/
|
||||
meta_constant mk_instance : expr → tactic expr
|
||||
/- Simplify the given expression using [defeq] lemmas.
|
||||
The resulting expression is definitionally equal to the input. -/
|
||||
meta_constant defeq_simp_core : transparency → expr → tactic expr
|
||||
/- Change the target of the main goal.
|
||||
The input expression must be definitionally equal to the current target. -/
|
||||
meta_constant change : expr → tactic unit
|
||||
|
|
@ -316,22 +313,6 @@ do gs ← get_goals,
|
|||
| _ := skip
|
||||
end
|
||||
|
||||
-- TODO(Leo): remove unifier.conservative after we finish new elaborator
|
||||
set_option unifier.conservative true
|
||||
|
||||
meta_definition defeq_simp : expr → tactic expr :=
|
||||
defeq_simp_core reducible
|
||||
|
||||
meta_definition dsimp : tactic unit :=
|
||||
target >>= defeq_simp >>= change
|
||||
|
||||
meta_definition dsimp_at (H : expr) : tactic unit :=
|
||||
do num_reverted : ℕ ← revert H,
|
||||
(expr.pi n bi d b : expr) ← target | failed,
|
||||
H_simp : expr ← defeq_simp d,
|
||||
change $ expr.pi n bi H_simp b,
|
||||
intron num_reverted
|
||||
|
||||
/- Return the number of goals that need to be solved -/
|
||||
meta_definition num_goals : tactic nat :=
|
||||
do gs ← get_goals,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue