Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use tactic notations to parameterize tactics #70

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion theories/ListUtil.v
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Section list_util.
break_exists_name l2.
subst.
specialize (IHxs (l1 ++ l2)).
conclude_using ltac:(eauto using NoDup_remove_1).
conclude_using (eauto using NoDup_remove_1).
forward IHxs.
intros x' Hx'.
assert (In x' (l1 ++ a :: l2)) by eauto with datatypes.
Expand Down
14 changes: 7 additions & 7 deletions theories/StructTactics.v
Original file line number Diff line number Diff line change
Expand Up @@ -147,27 +147,27 @@ Ltac break_and_goal :=
| [ |- _ /\ _ ] => split
end.

(** [solve_by_inverison' tac] succeeds if it can solve your goal by
(** [solve_by_inversion' tac] succeeds if it can solve your goal by
inverting a hypothesis and then running [tac]. *)
Ltac solve_by_inversion' tac :=
Tactic Notation "solve_by_inversion'" tactic(tac) :=
match goal with
| [H : _ |- _] => solve [inv H; tac]
end.

(** [solve_by_inverison] succeeds if it can solve your goal by
(** [solve_by_inversion] succeeds if it can solve your goal by
inverting a hypothesis and then running [auto]. *)
Ltac solve_by_inversion := solve_by_inversion' auto.
Tactic Notation "solve_by_inversion" := solve_by_inversion' auto.

(** TODO: document this. *)
Ltac apply_fun f H:=
Ltac apply_fun f H :=
match type of H with
| ?X = ?Y => assert (f X = f Y)
end.

(** [conclude H tac] assumes [H] is of the form [A -> B] and
specializes it into [B] if it successfully proves [A] using
[tac]. *)
Ltac conclude H tac :=
Tactic Notation "conclude" hyp(H) tactic3(tac) :=
(let H' := fresh in
match type of H with
| ?P -> _ => assert P as H' by (tac)
Expand Down Expand Up @@ -335,7 +335,7 @@ Ltac copy_eapply lem H :=

(** [conclude_using tac] specializes a hypothesis if it can prove its
premise using [tac]. *)
Ltac conclude_using tac :=
Tactic Notation "conclude_using" tactic3(tac) :=
match goal with
| [ H : ?P -> _ |- _ ] => conclude H tac
end.
Expand Down