diff options
| author | Jason Gross | 2019-09-16 19:19:07 -0400 |
|---|---|---|
| committer | Jason Gross | 2019-11-26 14:14:04 -0500 |
| commit | b09444fdaee1cf608dd40465d5e400fbd46ef6ad (patch) | |
| tree | 96918b6f363dcbad148d8b5cb4623eacddd3c75e /theories/Program | |
| parent | 49d21a292c3a57e8ec01888745957716834f1e36 (diff) | |
Make rapply handle all numbers of underscores
Also add a tactic notation so that it takes in uconstrs by default.
Also add some basic tests for `rapply`.
Also document rapply in the manual
Diffstat (limited to 'theories/Program')
| -rw-r--r-- | theories/Program/Tactics.v | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/theories/Program/Tactics.v b/theories/Program/Tactics.v index 51c7fe81b9..06fc2f73b2 100644 --- a/theories/Program/Tactics.v +++ b/theories/Program/Tactics.v @@ -173,22 +173,13 @@ Ltac on_application f tac T := (** A variant of [apply] using [refine], doing as much conversion as necessary. *) Ltac rapply p := - refine (p _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _ _) || - refine (p _ _ _ _ _ _) || - refine (p _ _ _ _ _) || - refine (p _ _ _ _) || - refine (p _ _ _) || - refine (p _ _) || - refine (p _) || - refine p. + (** before we try to add more underscores, first ensure that adding such underscores is valid *) + (assert_succeeds (idtac; let __ := open_constr:(p _) in idtac); + rapply uconstr:(p _)) + || refine p. + +(** The tactic [rapply] is a tactic notation so that it takes in uconstrs by default *) +Tactic Notation "rapply" uconstr(p) := rapply p. (** Tactical [on_call f tac] applies [tac] on any application of [f] in the hypothesis or goal. *) |
