expand : tactic -> proof
If a tactic solves the current goal (returns an empty subgoal list), then its justification is used to prove a corresponding theorem. This theorem is incorporated into the justification of the parent goal and printed. If the subgoal was the last subgoal of the level, the level is removed and the parent goal is proved using its (new) justification. This process is repeated until a level with unproven subgoals is reached. The next goal on the goal stack then becomes the current goal. This goal is printed. If all the subgoals are proved, the resulting proof state consists of the theorem proved by the justifications.
The tactic applied is a validating version of the tactic given. It ensures that the justification of the tactic does provide a proof of the goal from the subgoals generated by the tactic. It will cause failure if this is not so. The tactical VALID performs this validation.
For a description of the subgoal package, see set_goal.
- expand CONJ_TAC; - expand CONJ_TAC; OK.. NO_PROOFS! Uncaught exception: ! NO_PROOFS - g `(HD[1;2;3] = 1) /\ (TL[1;2;3] = [2;3])`; > val it = Proof manager status: 1 proof. 1. Incomplete: Initial goal: (HD [1; 2; 3] = 1) /\ (TL [1; 2; 3] = [2; 3]) : proofs - expand CONJ_TAC; OK.. 2 subgoals: > val it = TL [1; 2; 3] = [2; 3] HD [1; 2; 3] = 1 : proof - expand (REWRITE_TAC[listTheory.HD]); OK.. Goal proved. |- HD [1; 2; 3] = 1 Remaining subgoals: > val it = TL [1; 2; 3] = [2; 3] : proof - expand (REWRITE_TAC[listTheory.TL]); OK.. Goal proved. |- TL [1; 2; 3] = [2; 3] > val it = Initial goal proved. |- (HD [1; 2; 3] = 1) /\ (TL [1; 2; 3] = [2; 3]) : proof
- g `1=2`; > val it = Proof manager status: 2 proofs. 2. Completed: |- (HD [1; 2; 3] = 1) /\ (TL [1; 2; 3] = [2; 3]) 1. Incomplete: Initial goal: 1 = 2 : proofs - expand (REWRITE_TAC[ASSUME (Term `1=2`)]); OK.. Exception raised at Tactical.VALID: Invalid tactic ! Uncaught exception: ! HOL_ERR
Note that an invalid tactic may "succeed". Thus, where tac1 is invalid, and tac2 is valid (and both succeed), FIRST [tac1, tac2] is invalid. For example, where theorem uth is [p] |- q and uth' is [p'] |- q
1 subgoal: val it = q ------------------------------------ p : proof > e (FIRST (map ACCEPT_TAC [uth', uth])) ; OK.. Exception raised at Tactical.VALID: Invalid tactic [...] > e (FIRST (map (VALID o ACCEPT_TAC) [uth', uth])) ; OK.. Goal proved. [p] |- q