Debian Codegraph @

src/Util/Tactics/RunTacticAsConstr.v

raw
1 Require Export Crypto.Util.FixCoqMistakes.
2
3 (** Runs a tactic during expression evaluation phase, returns the constr [I] *)
4 Ltac run_tactic tac :=
5 let dummy := match goal with _ => tac () end in
6 I.
7
8 (** Runs a tactic during expression evaluation phase, returning [true] on success and [false] on failure. *)
9 Ltac is_success_run_tactic tac :=
10 match goal with
11 | _ => let dummy := run_tactic tac in
12 true
13 | _ => false
14 end.
15
16 (** Runs a tactic during expression evaluation phase; on success,
17 returns [then_tac ()], otherwise returns [else_tac ()] *)
18 Ltac constr_tryif_then_else tac then_tac else_tac :=
19 let success := is_success_run_tactic tac in
20 lazymatch success with
21 | true => then_tac ()
22 | false => else_tac ()
23 end.