lean4-htt/old_library/init/meta/defeq_simp_tactic.lean
2016-09-21 11:43:28 -07:00

27 lines
806 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/-
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