Sometimes, when I’m writing apply-style proofs, I have wanted a way to modify a proof method foo
to
Try
foo
on the first goal. If it solves the goal, good; if it does not solve it, revert to the original state and fail.
This came up in the following code:
qed (subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail)+
After some change further up, the call to simp
would not fully solve a goal any more, and then this would loop. If I could have specified something like
qed (solve_goal(subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail))+
or (alternative suggested synatx)
qed ((subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail)!)+
or (maybe even nicer syntax)
qed ((subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail)[1!])+
it would have stopped at the first goal that was not solvable by this script.