Commit 434eb027 authored by Adam Chlipala's avatar Adam Chlipala

Touch-ups in 8.4

parent da4a8431
......@@ -28,8 +28,10 @@ clean:: Makefile.coq
doc: latex/cpdt.pdf html
COQDOC = coqdoc -R . Cpdt
latex/%.v.tex: Makefile src/%.v src/%.glob
cd src ; coqdoc --interpolate --latex --body-only -s \
cd src ; $(COQDOC) --interpolate --latex --body-only -s \
$*.v -o ../latex/$*.v.tex
latex/cpdt.pdf: latex/cpdt.tex $(TEX) latex/cpdt.bib
......@@ -40,7 +42,7 @@ latex/%.pdf: latex/%.tex latex/cpdt.bib
html: Makefile $(VS) src/toc.html
mkdir -p html
cd src ; coqdoc --interpolate --no-externals $(VS_DOC) \
cd src ; $(COQDOC) --interpolate --no-externals $(VS_DOC) \
-d ../html
cp src/toc.html html/
......
......@@ -27,7 +27,7 @@ A print version of this book is available from the MIT Press. For more informat
\mbox{}\vfill
\begin{center}
Copyright Adam Chlipala 2008-2013.
Copyright Adam Chlipala 2008-2013, 2015.
This work is licensed under a
......
......@@ -833,7 +833,7 @@ eq_ind_r
P x -> forall y : A, y = x -> P y
]]
The corresponding lemma used for [JMeq] in the proof of [pair_cong] is defined internally by [rewrite as needed, but its type happens to be the following. *)
The corresponding lemma used for [JMeq] in the proof of [pair_cong] is defined internally by [rewrite] as needed, but its type happens to be the following. *)
(** %\vspace{-.15in}%[[
internal_JMeq_rew_r
......@@ -843,7 +843,7 @@ internal_JMeq_rew_r
The key difference is that, where the [eq] lemma is parameterized on a predicate of type [A -> Prop], the [JMeq] lemma is parameterized on a predicate of type more like [forall A : Type, A -> Prop]. To apply [eq_ind_r] with a proof of [x = y], it is only necessary to rearrange the goal into an application of a [fun] abstraction to [y]. In contrast, to apply the alternative principle, it is necessary to rearrange the goal to an application of a [fun] abstraction to both [y] and _its type_. In other words, the predicate must be _polymorphic_ in [y]'s type; any type must make sense, from a type-checking standpoint. There may be cases where the former rearrangement is easy to do in a type-correct way, but the second rearrangement done %\%naive%{}%ly leads to a type error.
When [rewrite] cannot figure out how to apply the alternative principle for [x == y] where [x] and [y] have the same type, the tactic can instead use an alternate theorem, which is easy to prove as a composition of [eq_ind_r] and [JMeq_eq]. *)
When [rewrite] cannot figure out how to apply the alternative principle for [x == y] where [x] and [y] have the same type, the tactic can instead use a different theorem, which is easy to prove as a composition of [eq_ind_r] and [JMeq_eq]. *)
Check JMeq_ind_r.
(** %\vspace{-.15in}%[[
......
......@@ -1116,7 +1116,7 @@ Theorem ntsize_ntsplice : forall tr1 tr2 : nat_tree, ntsize (ntsplice tr1 tr2)
(** We can go further in automating the proof by exploiting the hint mechanism.%\index{Vernacular commands!Hint Extern}% *)
Restart.
Hint Extern 1 (ntsize (match ?LS with Nil => _ | Cons _ _ => _ end) = _) =>
destruct LS; crush.
induction tr1 using nat_tree_ind'; crush.
......
......@@ -12,9 +12,9 @@
(** I will start off by jumping right in to a fully worked set of examples, building certified compilers from increasingly complicated source languages to stack machines. We will meet a few useful tactics and see how they can be used in manual proofs, and we will also see how easily these proofs can be automated instead. This chapter is not meant to give full explanations of the features that are employed. Rather, it is meant more as an advertisement of what is possible. Later chapters will introduce all of the concepts in bottom-up fashion. In other words, it is expected that most readers will not understand what exactly is going on here, but I hope this demo will whet your appetite for the remaining chapters!
As always, you can step through the source file <<StackMachine.v>> for this chapter interactively in Proof General. Alternatively, to get a feel for the whole lifecycle of creating a Coq development, you can enter the pieces of source code in this chapter in a new <<.v>> file in an Emacs buffer. If you do the latter, include these two lines at the start of the file. *)
As always, you can step through the source file <<StackMachine.v>> for this chapter interactively in Proof General. Alternatively, to get a feel for the whole lifecycle of creating a Coq development, you can enter the pieces of source code in this chapter in a new <<.v>> file in an Emacs buffer. If you do the latter, include these three lines at the start of the file. *)
Require Import Bool Arith List CpdtTactics.
Require Import Bool Arith List Cpdt.CpdtTactics.
Set Implicit Arguments.
Set Asymmetric Patterns.
......
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