nipkow@10281
|
1 |
Implementation
|
nipkow@10281
|
2 |
==============
|
nipkow@10177
|
3 |
|
nipkow@10177
|
4 |
Hide global names like Node.
|
nipkow@10177
|
5 |
Why is comp needed in addition to op O?
|
nipkow@10177
|
6 |
Explain in syntax section!
|
nipkow@10177
|
7 |
|
nipkow@10281
|
8 |
defs with = and pattern matching
|
nipkow@10177
|
9 |
|
nipkow@10281
|
10 |
replace "simp only split" by "split_tac".
|
nipkow@10177
|
11 |
|
nipkow@10281
|
12 |
arithmetic: allow mixed nat/int formulae
|
nipkow@10281
|
13 |
-> simplify proof of part1 in Inductive/AB.thy
|
nipkow@10177
|
14 |
|
nipkow@10177
|
15 |
Add map_cong?? (upto 10% slower)
|
nipkow@10177
|
16 |
|
nipkow@10281
|
17 |
Recdef: Get rid of function name in header.
|
nipkow@10281
|
18 |
Support mutual recursion (Konrad?)
|
nipkow@10177
|
19 |
|
nipkow@10177
|
20 |
use arith_tac in recdef to solve termination conditions?
|
nipkow@10177
|
21 |
-> new example in Recdef/termination
|
nipkow@10177
|
22 |
|
nipkow@10177
|
23 |
a tactic for replacing a specific occurrence:
|
nipkow@10177
|
24 |
apply(substitute [2] thm)
|
nipkow@10177
|
25 |
|
nipkow@10186
|
26 |
it would be nice if @term could deal with ?-vars.
|
nipkow@10186
|
27 |
then a number of (unchecked!) @texts could be converted to @terms.
|
nipkow@10186
|
28 |
|
nipkow@10189
|
29 |
it would be nice if one could get id to the enclosing quotes in the [source] option.
|
nipkow@10189
|
30 |
|
nipkow@10281
|
31 |
More predefined functions for datatypes: map?
|
nipkow@10281
|
32 |
|
nipkow@10281
|
33 |
Induction rules for int: int_le/ge_induct?
|
nipkow@10281
|
34 |
Needed for ifak example. But is that example worth it?
|
nipkow@10281
|
35 |
|
nipkow@10186
|
36 |
|
nipkow@10177
|
37 |
Minor fixes in the tutorial
|
nipkow@10177
|
38 |
===========================
|
nipkow@10177
|
39 |
|
nipkow@10281
|
40 |
explanation of absence of contrapos_pn in Rules?
|
nipkow@10177
|
41 |
|
nipkow@10281
|
42 |
get rid of use_thy in tutorial?
|
nipkow@10177
|
43 |
|
nipkow@10177
|
44 |
Explain typographic conventions?
|
nipkow@10177
|
45 |
|
nipkow@10177
|
46 |
an example of induction: !y. A --> B --> C ??
|
nipkow@10177
|
47 |
|
nipkow@10177
|
48 |
Appendix: Lexical: long ids.
|
nipkow@10177
|
49 |
|
nipkow@10177
|
50 |
Warning: infixes automatically become reserved words!
|
nipkow@10177
|
51 |
|
nipkow@10177
|
52 |
Forward ref from blast proof of Puzzle (AdvancedInd) to Isar proof?
|
nipkow@10177
|
53 |
|
nipkow@10177
|
54 |
mention split_split in advanced pair section.
|
nipkow@10177
|
55 |
|
nipkow@10177
|
56 |
recdef with nested recursion: either an example or at least a pointer to the
|
nipkow@10177
|
57 |
literature. In Recdef/termination.thy, at the end.
|
nipkow@10177
|
58 |
%FIXME, with one exception: nested recursion.
|
nipkow@10177
|
59 |
|
nipkow@10186
|
60 |
Syntax section: syntax annotations nor just for consts but also for constdefs and datatype.
|
nipkow@10186
|
61 |
|
nipkow@10283
|
62 |
Appendix with list functions.
|
nipkow@10283
|
63 |
|
nipkow@10177
|
64 |
|
nipkow@10177
|
65 |
Minor additions to the tutorial, unclear where
|
nipkow@10177
|
66 |
==============================================
|
nipkow@10177
|
67 |
|
nipkow@10186
|
68 |
Tacticals: , ? +
|
nipkow@10177
|
69 |
|
nipkow@10177
|
70 |
Mention that simp etc (big step tactics) insist on change?
|
nipkow@10177
|
71 |
|
nipkow@10237
|
72 |
Rules: Introduce "by" (as a kind of shorthand for apply+done, except that it
|
nipkow@10237
|
73 |
does more.)
|
nipkow@10177
|
74 |
|
nipkow@10177
|
75 |
A list of further useful commands (rules? tricks?)
|
nipkow@10281
|
76 |
prefer, defer, print_simpset (-> print_simps?)
|
nipkow@10177
|
77 |
|
nipkow@10177
|
78 |
An overview of the automatic methods: simp, auto, fast, blast, force,
|
nipkow@10177
|
79 |
clarify, clarsimp (intro, elim?)
|
nipkow@10177
|
80 |
|
nipkow@10237
|
81 |
Advanced Ind expects rule_format incl (no_asm) (which it currently explains!)
|
nipkow@10242
|
82 |
Where explained? Should go into a separate section as Inductive needs it as
|
nipkow@10242
|
83 |
well.
|
nipkow@10237
|
84 |
|
nipkow@10237
|
85 |
Where is "simplified" explained? Needed by Inductive/AB.thy
|
nipkow@10177
|
86 |
|
nipkow@10177
|
87 |
demonstrate x : set xs in Sets. Or Tricks chapter?
|
nipkow@10177
|
88 |
|
nipkow@10177
|
89 |
Appendix with HOL keywords. Say something about other keywords.
|
nipkow@10177
|
90 |
|
nipkow@10177
|
91 |
|
nipkow@10177
|
92 |
Possible exercises
|
nipkow@10177
|
93 |
==================
|
nipkow@10177
|
94 |
|
nipkow@10177
|
95 |
Exercises
|
nipkow@10177
|
96 |
%\begin{exercise}
|
nipkow@10177
|
97 |
%Extend expressions by conditional expressions.
|
nipkow@10177
|
98 |
braucht wfrec!
|
nipkow@10177
|
99 |
%\end{exercise}
|
nipkow@10177
|
100 |
|
nipkow@10177
|
101 |
Nested inductive datatypes: another example/exercise:
|
nipkow@10177
|
102 |
size(t) <= size(subst s t)?
|
nipkow@10177
|
103 |
|
nipkow@10177
|
104 |
insertion sort: primrec, later recdef
|
nipkow@10177
|
105 |
|
nipkow@10177
|
106 |
OTree:
|
nipkow@10177
|
107 |
first version only for non-empty trees:
|
nipkow@10177
|
108 |
Tip 'a | Node tree tree
|
nipkow@10177
|
109 |
Then real version?
|
nipkow@10177
|
110 |
First primrec, then recdef?
|
nipkow@10177
|
111 |
|
nipkow@10177
|
112 |
Ind. sets: define ABC inductively and prove
|
nipkow@10177
|
113 |
ABC = {rep A n @ rep B n @ rep C n. True}
|
nipkow@10177
|
114 |
|
nipkow@10177
|
115 |
Possible examples/case studies
|
nipkow@10177
|
116 |
==============================
|
nipkow@10177
|
117 |
|
nipkow@10177
|
118 |
Trie: Define functional version
|
nipkow@10177
|
119 |
datatype ('a,'b)trie = Trie ('b option) ('a => ('a,'b)trie option)
|
nipkow@10177
|
120 |
lookup t [] = value t
|
nipkow@10177
|
121 |
lookup t (a#as) = case tries t a of None => None | Some s => lookup s as
|
nipkow@10177
|
122 |
Maybe as an exercise?
|
nipkow@10177
|
123 |
|
nipkow@10177
|
124 |
Trie: function for partial matches (prefixes). Needs sets for spec/proof.
|
nipkow@10177
|
125 |
|
nipkow@10177
|
126 |
Sets via ordered list of intervals. (Isa/Interval(2))
|
nipkow@10177
|
127 |
|
nipkow@10177
|
128 |
propositional logic (soundness and completeness?),
|
nipkow@10177
|
129 |
predicate logic (soundness?),
|
nipkow@10177
|
130 |
|
nipkow@10177
|
131 |
Tautology checker. Based on Ifexpr or prop.logic?
|
nipkow@10177
|
132 |
Include forward reference in relevant section.
|
nipkow@10177
|
133 |
|
nipkow@10177
|
134 |
Sorting with comp-parameter and with type class (<)
|
nipkow@10177
|
135 |
|
nipkow@10177
|
136 |
New book by Bird?
|
nipkow@10177
|
137 |
|
nipkow@10177
|
138 |
Steps Towards Mechanizing Program Transformations Using PVS by N. Shankar,
|
nipkow@10177
|
139 |
Science of Computer Programming, 26(1-3):33-57, 1996.
|
nipkow@10177
|
140 |
You can get it from http://www.csl.sri.com/scp95.html
|
nipkow@10177
|
141 |
|
nipkow@10177
|
142 |
J Moore article Towards a ...
|
nipkow@10177
|
143 |
Mergesort, JVM
|
nipkow@10177
|
144 |
|
nipkow@10177
|
145 |
|
nipkow@10177
|
146 |
Additional topics
|
nipkow@10177
|
147 |
=================
|
nipkow@10177
|
148 |
|
nipkow@10281
|
149 |
Recdef with nested recursion?
|
nipkow@10177
|
150 |
|
nipkow@10177
|
151 |
Extensionality: applications in
|
nipkow@10177
|
152 |
- boolean expressions: valif o bool2if = value
|
nipkow@10177
|
153 |
- Advanced datatypes exercise subst (f o g) = subst f o subst g
|
nipkow@10177
|
154 |
|
nipkow@10177
|
155 |
A look at the library?
|
nipkow@10281
|
156 |
Map.
|
nipkow@10177
|
157 |
If WF is discussed, make a link to it from AdvancedInd.
|
nipkow@10177
|
158 |
|
nipkow@10177
|
159 |
Prototyping?
|
nipkow@10177
|
160 |
|
nipkow@10177
|
161 |
==============================================================
|
nipkow@10177
|
162 |
Recdef:
|
nipkow@10177
|
163 |
|
nipkow@10177
|
164 |
nested recursion
|
nipkow@10177
|
165 |
more example proofs:
|
nipkow@10177
|
166 |
if-normalization with measure function,
|
nipkow@10177
|
167 |
nested if-normalization,
|
nipkow@10177
|
168 |
quicksort
|
nipkow@10177
|
169 |
Trie?
|
nipkow@10177
|
170 |
a case study?
|
nipkow@10177
|
171 |
|
nipkow@10177
|
172 |
----------
|
nipkow@10177
|
173 |
|
nipkow@10177
|
174 |
Partial rekursive functions / Nontermination
|
nipkow@10177
|
175 |
|
nipkow@10177
|
176 |
What appears to be the problem:
|
nipkow@10177
|
177 |
axiom f n = f n + 1
|
nipkow@10177
|
178 |
lemma False
|
nipkow@10177
|
179 |
apply(cut_facts_tac axiom, simp).
|
nipkow@10177
|
180 |
|
nipkow@10177
|
181 |
1. Guarded recursion
|
nipkow@10177
|
182 |
|
nipkow@10177
|
183 |
Scheme:
|
nipkow@10177
|
184 |
f x = if $x \in dom(f)$ then ... else arbitrary
|
nipkow@10177
|
185 |
|
nipkow@10177
|
186 |
Example: sum/fact: int -> int (for no good reason because we have nat)
|
nipkow@10177
|
187 |
|
nipkow@10177
|
188 |
Exercise: ?! f. !i. f i = if i=0 then 1 else i*f(i-1)
|
nipkow@10177
|
189 |
(What about sum? Is there one, a unique one?)
|
nipkow@10177
|
190 |
|
nipkow@10177
|
191 |
[Alternative: include argument that is counted down
|
nipkow@10177
|
192 |
f x n = if n=0 then None else ...
|
nipkow@10177
|
193 |
Refer to Boyer and Moore]
|
nipkow@10177
|
194 |
|
nipkow@10177
|
195 |
More complex: same_fst
|
nipkow@10177
|
196 |
|
nipkow@10177
|
197 |
chase(f,x) = if wf{(f x,x) . f x ~= x}
|
nipkow@10177
|
198 |
then if f x = x then x else chase(f,f x)
|
nipkow@10177
|
199 |
else arb
|
nipkow@10177
|
200 |
|
nipkow@10177
|
201 |
Prove wf ==> f(chase(f,x)) = chase(f,x)
|
nipkow@10177
|
202 |
|
nipkow@10177
|
203 |
2. While / Tail recursion
|
nipkow@10177
|
204 |
|
nipkow@10177
|
205 |
chase f x = fst(while (%(x,fx). x=fx) (%(x,fx). (fx,f fx)) (x,f x))
|
nipkow@10177
|
206 |
|
nipkow@10177
|
207 |
==> unfold eqn for chase? Prove fixpoint property?
|
nipkow@10177
|
208 |
|
nipkow@10177
|
209 |
Better(?) sum i = fst(while (%(s,i). i=0) (%(s,i). (s+i,i-1)) (0,i))
|
nipkow@10177
|
210 |
Prove 0 <= i ==> sum i = i*(i+1) via while-rule
|
nipkow@10177
|
211 |
|
nipkow@10177
|
212 |
Mention prototyping?
|
nipkow@10177
|
213 |
==============================================================
|