Commit a39a0883 authored by Adam Chlipala's avatar Adam Chlipala

Change some template annotations

parent 5ce22dc2
...@@ -576,6 +576,7 @@ subgoal 4 is: ...@@ -576,6 +576,7 @@ subgoal 4 is:
End autorewrite. End autorewrite.
(* begin thide *)
(** * Exercises *) (** * Exercises *)
(** printing * $\cdot$ *) (** printing * $\cdot$ *)
...@@ -645,3 +646,4 @@ Hint Extern 100 (_ = _) => ...@@ -645,3 +646,4 @@ Hint Extern 100 (_ = _) =>
I also proved a few hint lemmas tailored to particular theorems, but which do not give common algebraic simplification rules. You will probably want to use some, too, in cases where [eauto] does not find a proof within a reasonable amount of time. In total, beside the main theorems to be proved, my sample solution includes 6 lemmas, with a mix of the two kinds of lemmas. You may use more in your solution, but I suggest trying to minimize the number. I also proved a few hint lemmas tailored to particular theorems, but which do not give common algebraic simplification rules. You will probably want to use some, too, in cases where [eauto] does not find a proof within a reasonable amount of time. In total, beside the main theorems to be proved, my sample solution includes 6 lemmas, with a mix of the two kinds of lemmas. You may use more in your solution, but I suggest trying to minimize the number.
#</ol>#%\end{enumerate}% *) #</ol>#%\end{enumerate}% *)
(* end thide *)
...@@ -437,6 +437,7 @@ Abort. ...@@ -437,6 +437,7 @@ Abort.
(** One other gotcha shows up when we want to debug our Ltac functional programs. We might expect the following code to work, to give us a version of [length] that prints a debug trace of the arguments it is called with. *) (** One other gotcha shows up when we want to debug our Ltac functional programs. We might expect the following code to work, to give us a version of [length] that prints a debug trace of the arguments it is called with. *)
(* begin thide *)
(* begin hide *) (* begin hide *)
Reset length. Reset length.
(* end hide *) (* end hide *)
...@@ -481,9 +482,11 @@ Ltac length ls k := ...@@ -481,9 +482,11 @@ Ltac length ls k :=
| nil => k O | nil => k O
| _ :: ?ls' => length ls' ltac:(fun n => k (S n)) | _ :: ?ls' => length ls' ltac:(fun n => k (S n))
end. end.
(* end thide *)
(** The new [length] takes a new input: a %\emph{%#<i>#continuation#</i>#%}% [k], which is a function to be called to continue whatever proving process we were in the middle of when we called [length]. The argument passed to [k] may be thought of as the return value of [length]. *) (** The new [length] takes a new input: a %\emph{%#<i>#continuation#</i>#%}% [k], which is a function to be called to continue whatever proving process we were in the middle of when we called [length]. The argument passed to [k] may be thought of as the return value of [length]. *)
(* begin thide *)
Goal False. Goal False.
length (1 :: 2 :: 3 :: nil) ltac:(fun n => pose n). length (1 :: 2 :: 3 :: nil) ltac:(fun n => pose n).
(** [[ (** [[
...@@ -494,6 +497,7 @@ nil ...@@ -494,6 +497,7 @@ nil
]] ]]
*) *)
Abort. Abort.
(* end thide *)
(** We see exactly the trace of function arguments that we expected initially, and an examination of the proof state afterward would show that variable [n] has been added with value [3]. *) (** We see exactly the trace of function arguments that we expected initially, and an examination of the proof state afterward would show that variable [n] has been added with value [3]. *)
...@@ -998,6 +1002,7 @@ Theorem t9 : exists p : nat * nat, fst p = 3. ...@@ -998,6 +1002,7 @@ Theorem t9 : exists p : nat * nat, fst p = 3.
Qed. Qed.
(* begin thide *)
(** * Exercises *) (** * Exercises *)
(** %\begin{enumerate}%#<ol># (** %\begin{enumerate}%#<ol>#
...@@ -1165,3 +1170,4 @@ In the body of the case analysis, [lemma] will be bound to the first lemma, and ...@@ -1165,3 +1170,4 @@ In the body of the case analysis, [lemma] will be bound to the first lemma, and
There are different kinds of backtracking, corresponding to different sorts of decisions to be made. The examples considered above can be handled with backtracking that only reconsiders decisions about the order in which to apply rewriting lemmas. A full-credit solution need only handle that kind of backtracking, considering all rewriting sequences up to the length bound passed to your tactic. A good test of this level of applicability is to prove both [test1] and [test2] above. However, some theorems could only be proved using a smarter tactic that considers not only order of rewriting lemma uses, but also choice of arguments to the lemmas. That is, at some points in a proof, the same lemma may apply at multiple places within the goal formula, and some choices may lead to stuck proof states while others lead to success. For an extra challenge (without any impact on the grade for the problem), you might try beefing up your tactic to do backtracking on argument choice, too.#</li># There are different kinds of backtracking, corresponding to different sorts of decisions to be made. The examples considered above can be handled with backtracking that only reconsiders decisions about the order in which to apply rewriting lemmas. A full-credit solution need only handle that kind of backtracking, considering all rewriting sequences up to the length bound passed to your tactic. A good test of this level of applicability is to prove both [test1] and [test2] above. However, some theorems could only be proved using a smarter tactic that considers not only order of rewriting lemma uses, but also choice of arguments to the lemmas. That is, at some points in a proof, the same lemma may apply at multiple places within the goal formula, and some choices may lead to stuck proof states while others lead to success. For an extra challenge (without any impact on the grade for the problem), you might try beefing up your tactic to do backtracking on argument choice, too.#</li>#
#</ol>#%\end{enumerate}% *) #</ol>#%\end{enumerate}% *)
(* end thide *)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment