### changeset 536:d65e9c1c9041

Touch-ups in 8.4
author Adam Chlipala Wed, 05 Aug 2015 18:07:57 -0400 dac7a2705b00 148f3ab2b5d6 Makefile latex/cpdt.tex src/Equality.v src/InductiveTypes.v src/StackMachine.v 5 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Aug 05 14:57:14 2015 -0400
+++ b/Makefile	Wed Aug 05 18:07:57 2015 -0400
@@ -28,8 +28,10 @@

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 @@

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/

--- a/latex/cpdt.tex	Wed Aug 05 14:57:14 2015 -0400
+++ b/latex/cpdt.tex	Wed Aug 05 18:07:57 2015 -0400
@@ -27,7 +27,7 @@
\mbox{}\vfill
\begin{center}

This work is licensed under a
--- a/src/Equality.v	Wed Aug 05 14:57:14 2015 -0400
+++ b/src/Equality.v	Wed Aug 05 18:07:57 2015 -0400
@@ -833,7 +833,7 @@
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 @@

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}%[[
--- a/src/InductiveTypes.v	Wed Aug 05 14:57:14 2015 -0400
+++ b/src/InductiveTypes.v	Wed Aug 05 18:07:57 2015 -0400
@@ -1116,7 +1116,7 @@
(** 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.
--- a/src/StackMachine.v	Wed Aug 05 14:57:14 2015 -0400
+++ b/src/StackMachine.v	Wed Aug 05 18:07:57 2015 -0400
@@ -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.