### coq

#### How to use auto with repeat in custom tactics?

In my coq development I am learning how to create new tactics tailored to my problem domain, a la Prof. Adam Chlipala. On that page he describes how to create powerful tactics by wrapping repeat around a match that responds to various interesting conditions. The repeat then iterates, allowing for far-reaching inference. The use of repeat has a caveat (emphasis mine): The repeat that we use here is called a tactical, or tactic combinator. The behavior of repeat t is to loop through running t, running t on all generated subgoals, running t on their generated subgoals, and so on. When t fails at any point in this search tree, that particular subgoal is left to be handled by later tactics. Thus, it is important never to use repeat with a tactic that always succeeds. Now, I already have a powerful tactic in use, auto. It similarly strings together chains of steps, this time found from hint databases. From auto's page: auto either solves completely the goal or else leaves it intact. auto and trivial never fail. Boo! I have already invested some effort in curating auto's hint databases, but it seems I am forbidden from employing them in tactics using repeat (that is, interesting tactics.) Is there some variation of auto that can fail, or otherwise be used correctly in loops? For example, perhaps this variant fails when it "leaves [the goal] intact". EDIT: Incorporating auto into loops isn't the "right" way to do it anyway (see this), but the actual question of a failing version of auto is still perhaps interesting.

As mentioned by #AntonTrunov you can always use the progress tactical to make the tactic fail if the goal has not been changed. In the case of auto since it is supposed to solve the goal or leave it unchanged, you can also wrap it in solve [ auto ] which will have the same effect because it will fail if auto does not solve the goal completely (here is the doc for solve).

### Related Links

What does the simpl tactic do in COQ

Induction on predicates with product type arguments

Construct Sets in Coq

Is this relationship between forall and exists provable in Coq/intuitionistic logic?

Proof automation in Coq how to factorize a proof

How to use matched case and variable equivalence in coq

Proof with false hypothesis in Isabelle/HOL Isar

Is there a convention for the order of applying ssreflect tactic/taticals?

How to systematically normalize inequalities to < (lt) and <= (le) in Coq?

Inductive subset of an inductive set in Coq

How to find the source file for an identifier in Coq

Coq “Unknown interpretation for notation” error

How to switch the current goal in Coq?

Reasoning about lists in Coq

what does the curly braces {} do in ssreflect rewrite

How to define unspecified constants in Coq