lean4-htt/library/init/util.lean
Leonardo de Moura cce88c6190 refactor(frontends/lean): interactive tactic support
After this commit, new interactice tactic classes can be added without
writing C++ code (see example: tests/lean/run/my_tac_class.lean).

The tactic_evaluator was simplified, and all the complexity has been
moved to tactic_notation, and lean code.

We can now inspect the intermediate states produced by the rewrite
tactic.

The function (@scope_trace _ line col thunk) can be used to position trace
messages produced by thunk. If line/col are not provided (i.e., we
just write (scope_trace thunk)), then line/col are filled with the
position of this term by the elaborator.

We can visualize the intermediate tactic states inside nested blocks
such as (try { ... })

The new infrastructure can be used to implement custom tactic_state
pretty printers.
2017-01-21 22:38:47 -08:00

25 lines
934 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.data.string.basic
universe variables u
/- This function has a native implementation that tracks time. -/
def timeit {α : Type u} (s : string) (f : unit → α) : α :=
f ()
/- This function has a native implementation that displays the given string in the regular output stream. -/
def trace {α : Type u} (s : string) (f : unit → α) : α :=
f ()
/- This function has a native implementation that shows the VM call stack. -/
def trace_call_stack {α : Type u} (f : unit → α) : α :=
f ()
/- This function has a native implementation that displays in the given position all trace messages used in f.
The arguments line and col are filled by the elaborator. -/
def scope_trace {α : Type u} {line col: nat} (f : unit → α) : α :=
f ()