I kept a few core methods (e.g., exact_core and apply_core). Reason:
if we use default parameters
meta constant exact (e : expr) (md := semireducible) : tactic unit
then, we will not be able to write
to_expr p >>= exact
The workaround is
do t <- to_expr p, exact t
or
to_expr p >>= (fun x, exact x)
One alternative is to change how we handle default parameters, and
eta-expand applications that involve default parameters.
We may also have an attribute [eta_expand]. Then
attribute [eta_expand] foo
instructs the elaborator to automatically eta-expand foo-applications.
The attribute would give users more control, and avoid potential
performance problems. Without the attribute, then for every function
application the elaborator has to check the type and decide whether it
must be eta-expanded or not.
@gebner @kha What do you think?
24 lines
898 B
Text
24 lines
898 B
Text
/-
|
|
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.relation_tactics init.meta.occurrences
|
|
|
|
namespace tactic
|
|
/- (rewrite_core m approx use_instances occs symm H) -/
|
|
meta constant rewrite_core : transparency → bool → bool → occurrences → bool → expr → tactic unit
|
|
meta constant rewrite_at_core : transparency → bool → bool → occurrences → bool → expr → expr → tactic unit
|
|
|
|
meta def rewrite (th_name : name) : tactic unit :=
|
|
do th ← mk_const th_name,
|
|
rewrite_core reducible tt tt occurrences.all ff th,
|
|
try (reflexivity reducible)
|
|
|
|
meta def rewrite_at (th_name : name) (H_name : name) : tactic unit :=
|
|
do th ← mk_const th_name,
|
|
H ← get_local H_name,
|
|
rewrite_at_core reducible tt tt occurrences.all ff th H
|
|
|
|
end tactic
|