10177
|
1 |
General questions
|
|
2 |
=================
|
|
3 |
|
|
4 |
Here is an initial list:
|
|
5 |
clarify, clarsimp, hyp_subst_tac, rename_tac, rotate_tac, split
|
|
6 |
single step tactics: (e/d/f)rule, insert
|
|
7 |
with instantiation: (e/d/f)rule_tac, insert_tac
|
|
8 |
|
|
9 |
Hide global names like Node.
|
|
10 |
Why is comp needed in addition to op O?
|
|
11 |
Explain in syntax section!
|
|
12 |
|
|
13 |
Implementation
|
|
14 |
==============
|
|
15 |
|
|
16 |
swap in classical.ML has ugly name Pa in it. Rename.
|
|
17 |
|
|
18 |
Induction rules for int: int_le/ge_induct?
|
|
19 |
Needed for ifak example. But is that example worth it?
|
|
20 |
|
|
21 |
Add map_cong?? (upto 10% slower)
|
|
22 |
But we should install UN_cong and INT_cong too.
|
|
23 |
|
|
24 |
recdef: funny behaviour with map (see email to Konrad.Slind, Recdef/Nested1)
|
|
25 |
|
|
26 |
defs with = and pattern matching
|
|
27 |
|
|
28 |
use arith_tac in recdef to solve termination conditions?
|
|
29 |
-> new example in Recdef/termination
|
|
30 |
|
|
31 |
a tactic for replacing a specific occurrence:
|
|
32 |
apply(substitute [2] thm)
|
|
33 |
|
10186
|
34 |
it would be nice if @term could deal with ?-vars.
|
|
35 |
then a number of (unchecked!) @texts could be converted to @terms.
|
|
36 |
|
10189
|
37 |
it would be nice if one could get id to the enclosing quotes in the [source] option.
|
|
38 |
|
10236
|
39 |
arithmetic: allow mixed nat/int formulae
|
|
40 |
-> simplify proof of part1 in Inductive/AB.thy
|
10186
|
41 |
|
10177
|
42 |
Minor fixes in the tutorial
|
|
43 |
===========================
|
|
44 |
|
|
45 |
replace simp only split by split_tac.
|
|
46 |
|
|
47 |
get rid of use_thy?
|
|
48 |
|
|
49 |
Explain typographic conventions?
|
|
50 |
|
|
51 |
an example of induction: !y. A --> B --> C ??
|
|
52 |
|
|
53 |
Appendix: Lexical: long ids.
|
|
54 |
|
|
55 |
Warning: infixes automatically become reserved words!
|
|
56 |
|
|
57 |
Forward ref from blast proof of Puzzle (AdvancedInd) to Isar proof?
|
|
58 |
|
|
59 |
mention split_split in advanced pair section.
|
|
60 |
|
|
61 |
recdef with nested recursion: either an example or at least a pointer to the
|
|
62 |
literature. In Recdef/termination.thy, at the end.
|
|
63 |
%FIXME, with one exception: nested recursion.
|
|
64 |
|
10186
|
65 |
Syntax section: syntax annotations nor just for consts but also for constdefs and datatype.
|
|
66 |
|
|
67 |
Prove EU exercise in CTL.
|
10177
|
68 |
|
|
69 |
|
|
70 |
Minor additions to the tutorial, unclear where
|
|
71 |
==============================================
|
|
72 |
|
10186
|
73 |
Tacticals: , ? +
|
10177
|
74 |
|
10186
|
75 |
"typedecl" is used in CTL/Base, but where is it introduced?
|
|
76 |
In More Types chapter? Rephrase the CTL bit accordingly.
|
10177
|
77 |
|
|
78 |
print_simpset (-> print_simps?)
|
|
79 |
(Another subsection Useful theorems, methods, and commands?)
|
|
80 |
|
|
81 |
Mention that simp etc (big step tactics) insist on change?
|
|
82 |
|
10237
|
83 |
Rules: Introduce "by" (as a kind of shorthand for apply+done, except that it
|
|
84 |
does more.)
|
10177
|
85 |
|
|
86 |
A list of further useful commands (rules? tricks?)
|
|
87 |
prefer, defer
|
|
88 |
|
|
89 |
An overview of the automatic methods: simp, auto, fast, blast, force,
|
|
90 |
clarify, clarsimp (intro, elim?)
|
|
91 |
|
10237
|
92 |
Advanced Ind expects rule_format incl (no_asm) (which it currently explains!)
|
|
93 |
Where explained?
|
|
94 |
Inductive also needs rule_format!
|
|
95 |
|
|
96 |
Where is "simplified" explained? Needed by Inductive/AB.thy
|
10177
|
97 |
|
|
98 |
demonstrate x : set xs in Sets. Or Tricks chapter?
|
|
99 |
|
|
100 |
Appendix with HOL keywords. Say something about other keywords.
|
|
101 |
|
|
102 |
|
|
103 |
Possible exercises
|
|
104 |
==================
|
|
105 |
|
|
106 |
Exercises
|
|
107 |
%\begin{exercise}
|
|
108 |
%Extend expressions by conditional expressions.
|
|
109 |
braucht wfrec!
|
|
110 |
%\end{exercise}
|
|
111 |
|
|
112 |
Nested inductive datatypes: another example/exercise:
|
|
113 |
size(t) <= size(subst s t)?
|
|
114 |
|
|
115 |
insertion sort: primrec, later recdef
|
|
116 |
|
|
117 |
OTree:
|
|
118 |
first version only for non-empty trees:
|
|
119 |
Tip 'a | Node tree tree
|
|
120 |
Then real version?
|
|
121 |
First primrec, then recdef?
|
|
122 |
|
|
123 |
Ind. sets: define ABC inductively and prove
|
|
124 |
ABC = {rep A n @ rep B n @ rep C n. True}
|
|
125 |
|
|
126 |
Possible examples/case studies
|
|
127 |
==============================
|
|
128 |
|
|
129 |
Trie: Define functional version
|
|
130 |
datatype ('a,'b)trie = Trie ('b option) ('a => ('a,'b)trie option)
|
|
131 |
lookup t [] = value t
|
|
132 |
lookup t (a#as) = case tries t a of None => None | Some s => lookup s as
|
|
133 |
Maybe as an exercise?
|
|
134 |
|
|
135 |
Trie: function for partial matches (prefixes). Needs sets for spec/proof.
|
|
136 |
|
|
137 |
Sets via ordered list of intervals. (Isa/Interval(2))
|
|
138 |
|
|
139 |
Sets: PDL and CTL
|
|
140 |
|
|
141 |
Ind. defs: Grammar (for same number of as and bs),
|
|
142 |
propositional logic (soundness and completeness?),
|
|
143 |
predicate logic (soundness?),
|
|
144 |
CTL proof.
|
|
145 |
|
|
146 |
Tautology checker. Based on Ifexpr or prop.logic?
|
|
147 |
Include forward reference in relevant section.
|
|
148 |
|
|
149 |
Sorting with comp-parameter and with type class (<)
|
|
150 |
|
|
151 |
New book by Bird?
|
|
152 |
|
|
153 |
Steps Towards Mechanizing Program Transformations Using PVS by N. Shankar,
|
|
154 |
Science of Computer Programming, 26(1-3):33-57, 1996.
|
|
155 |
You can get it from http://www.csl.sri.com/scp95.html
|
|
156 |
|
|
157 |
J Moore article Towards a ...
|
|
158 |
Mergesort, JVM
|
|
159 |
|
|
160 |
|
|
161 |
Additional topics
|
|
162 |
=================
|
|
163 |
|
|
164 |
Beef up recdef (see below).
|
|
165 |
Nested recursion? Mutual recursion?
|
|
166 |
|
|
167 |
Nested inductive datatypes: better recursion and induction
|
|
168 |
(see below)
|
|
169 |
|
|
170 |
Extensionality: applications in
|
|
171 |
- boolean expressions: valif o bool2if = value
|
|
172 |
- Advanced datatypes exercise subst (f o g) = subst f o subst g
|
|
173 |
|
|
174 |
A look at the library?
|
|
175 |
Functions. Relations. Lfp/Gfp. Map.
|
|
176 |
If WF is discussed, make a link to it from AdvancedInd.
|
|
177 |
|
|
178 |
Prototyping?
|
|
179 |
|
|
180 |
|
|
181 |
Isabelle
|
|
182 |
========
|
|
183 |
|
|
184 |
Get rid of function name in recdef header
|
|
185 |
|
|
186 |
More predefined functions for datatypes: map?
|
|
187 |
|
|
188 |
1 and 2 on nat?
|
|
189 |
|
|
190 |
|
|
191 |
==============================================================
|
|
192 |
Nested inductive datatypes: better recursion and induction
|
|
193 |
|
|
194 |
Show how to derive simpler primrec functions using eg map. Text:
|
|
195 |
|
|
196 |
Returning to the definition of \texttt{subst}, we have to admit that it does
|
|
197 |
not really need the auxiliary \texttt{substs} function. The \texttt{App}-case
|
|
198 |
can directly be expressed as
|
|
199 |
\begin{ttbox}
|
|
200 |
\input{Datatype/appmap}\end{ttbox}
|
|
201 |
Although Isabelle insists on the more verbose version, we can easily {\em
|
|
202 |
prove} that the \texttt{map}-equation holds: simply by induction on
|
|
203 |
\texttt{ts} followed by \texttt{Auto_tac}.
|
|
204 |
lemma "subst s (App f ts) = App f (map (subst s) ts)";
|
|
205 |
by(induct_tac ts, auto);
|
|
206 |
|
|
207 |
Now explain how to remove old eqns from simpset by naming them.
|
|
208 |
But: the new eqn only helps if the induction schema is also modified
|
|
209 |
accordingly:
|
|
210 |
|
|
211 |
val prems =
|
|
212 |
Goal "[| !!v. P(Var v); !!f ts. (!!t. t : set ts ==> P t) ==> P(App f ts) |] \
|
|
213 |
\ ==> P t & (!t: set ts. P t)";
|
|
214 |
by(induct_tac "t ts" 1);
|
|
215 |
brs prems 1;
|
|
216 |
brs prems 1;
|
|
217 |
by(Blast_tac 1);
|
|
218 |
by(Simp_tac 1);
|
|
219 |
by(Asm_simp_tac 1);
|
|
220 |
|
|
221 |
Now the following exercise has an easy proof:
|
|
222 |
|
|
223 |
\begin{exercise}
|
|
224 |
Define a function \texttt{rev_term} of type \texttt{term -> term} that
|
|
225 |
recursively reverses the order of arguments of all function symbols in a
|
|
226 |
term. Prove that \texttt{rev_term(rev_term t) = t}.
|
|
227 |
\end{exercise}
|
|
228 |
|
|
229 |
==============================================================
|
|
230 |
Recdef:
|
|
231 |
|
|
232 |
nested recursion
|
|
233 |
more example proofs:
|
|
234 |
if-normalization with measure function,
|
|
235 |
nested if-normalization,
|
|
236 |
quicksort
|
|
237 |
Trie?
|
|
238 |
a case study?
|
|
239 |
|
|
240 |
A separate subsection on recdef beyond measure, eg <*lex*> and psubset.
|
|
241 |
Example: some finite fixpoint computation? MC, Grammar?
|
|
242 |
How to modify wf-prover?
|
|
243 |
|
|
244 |
----------
|
|
245 |
|
|
246 |
Partial rekursive functions / Nontermination
|
|
247 |
|
|
248 |
What appears to be the problem:
|
|
249 |
axiom f n = f n + 1
|
|
250 |
lemma False
|
|
251 |
apply(cut_facts_tac axiom, simp).
|
|
252 |
|
|
253 |
1. Guarded recursion
|
|
254 |
|
|
255 |
Scheme:
|
|
256 |
f x = if $x \in dom(f)$ then ... else arbitrary
|
|
257 |
|
|
258 |
Example: sum/fact: int -> int (for no good reason because we have nat)
|
|
259 |
|
|
260 |
Exercise: ?! f. !i. f i = if i=0 then 1 else i*f(i-1)
|
|
261 |
(What about sum? Is there one, a unique one?)
|
|
262 |
|
|
263 |
[Alternative: include argument that is counted down
|
|
264 |
f x n = if n=0 then None else ...
|
|
265 |
Refer to Boyer and Moore]
|
|
266 |
|
|
267 |
More complex: same_fst
|
|
268 |
|
|
269 |
chase(f,x) = if wf{(f x,x) . f x ~= x}
|
|
270 |
then if f x = x then x else chase(f,f x)
|
|
271 |
else arb
|
|
272 |
|
|
273 |
Prove wf ==> f(chase(f,x)) = chase(f,x)
|
|
274 |
|
|
275 |
2. While / Tail recursion
|
|
276 |
|
|
277 |
chase f x = fst(while (%(x,fx). x=fx) (%(x,fx). (fx,f fx)) (x,f x))
|
|
278 |
|
|
279 |
==> unfold eqn for chase? Prove fixpoint property?
|
|
280 |
|
|
281 |
Better(?) sum i = fst(while (%(s,i). i=0) (%(s,i). (s+i,i-1)) (0,i))
|
|
282 |
Prove 0 <= i ==> sum i = i*(i+1) via while-rule
|
|
283 |
|
|
284 |
Mention prototyping?
|
|
285 |
==============================================================
|