Skip to content

Commit

Permalink
feat(tactic/basic): add tactic.get_goal
Browse files Browse the repository at this point in the history
  • Loading branch information
khoek committed Apr 2, 2019
1 parent 13034ba commit 413ec66
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tactic/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,15 @@ meta def mk_mvar_list : ℕ → tactic (list expr)
| 0 := pure []
| (succ n) := (::) <$> mk_mvar <*> mk_mvar_list n

/-- Returns the only goal, or fails if there isn't just one goal. -/
meta def get_goal : tactic expr :=
do gs ← get_goals,
match gs with
| [a] := return a
| [] := fail "there are no goals"
| _ := fail "there are too many goals"
end

/--`iterate_at_most_on_all_goals n t`: repeat the given tactic at most `n` times on all goals,
or until it fails. Always succeeds. -/
meta def iterate_at_most_on_all_goals : nat → tactic unit → tactic unit
Expand Down

0 comments on commit 413ec66

Please sign in to comment.