~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to contrib/extraction/CHANGES

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
7.4 -> 8.0
 
2
 
 
3
No revolution this time. Mostly "behind-the-scene" clean-up and bug-fixes, 
 
4
but also a few steps toward a more user-friendly extraction:
 
5
 
 
6
* syntax of extraction: 
 
7
- The old   (Recursive) Extraction Module M.
 
8
  is now    (Recursive) Extraction Library M.
 
9
  The old name was misleading since this command only works with M being a 
 
10
  library M.v, and not a module produced by interactive command Module M. 
 
11
- The other commands 
 
12
    Extraction foo.
 
13
    Recursive Extraction foo bar.
 
14
    Extraction "myfile.ml" foo bar. 
 
15
  now accept that foo can be a module name instead of just a constant name. 
 
16
 
 
17
* Support of type scheme axioms (i.e. axiom whose type is an arity 
 
18
  (x1:X1)...(xn:Xn)s with s a sort). For example: 
 
19
 
 
20
   Axiom myprod : Set -> Set -> Set.
 
21
   Extract Constant myprod "'a" "'b" => "'a * 'b". 
 
22
   Recursive Extraction myprod. 
 
23
   -------> type ('a,'b) myprod = 'a * 'b               
 
24
 
 
25
* More flexible support of axioms. When an axiom isn't realized via Extract 
 
26
  Constant before extraction, a warning is produced (instead of an error), 
 
27
  and the extracted code must be completed later by hand. To find what
 
28
  needs to be completed, search for the following string: AXIOM TO BE REALIZED
 
29
 
 
30
* Cosmetics: When extraction produces a file, it tells it. 
 
31
 
 
32
* (Experimental) It is allowed to extract under a opened interactive module
 
33
  (but still outside sections). Feature to be used with caution. 
 
34
 
 
35
* A problem has been identified concerning .v files used as normal interactive 
 
36
  modules, like in 
 
37
    
 
38
    <file A.v>
 
39
    Definition foo :=O.
 
40
    <End file A.v>
 
41
 
 
42
    <at toplevel>
 
43
    Require A.
 
44
    Module M:=A
 
45
    Extraction M.
 
46
 
 
47
  I might try to support that in the future. In the meanwhile, the
 
48
  current behaviour of extraction is to forbid this.
 
49
 
 
50
* bug fixes: 
 
51
- many concerning Records. 
 
52
- a Stack Overflow with mutual inductive (PR#320)
 
53
- some optimizations have been removed since they were not type-safe:
 
54
  For example if e has type:  type 'x a = A
 
55
  Then:       match e with A -> A     -----X---->    e
 
56
  To be investigated further.
 
57
 
 
58
 
 
59
7.3 -> 7.4
 
60
 
 
61
* The two main new features: 
 
62
  - Automatic generation of Obj.magic when the extracted code 
 
63
  in Ocaml is not directly typable.
 
64
  - An experimental extraction of Coq's new modules to Ocaml modules. 
 
65
 
 
66
* Concerning those Obj.magic: 
 
67
  - The extraction now computes the expected type of any terms. Then 
 
68
  it compares it with the actual type of the produced code. And when 
 
69
  a mismatch is found, a Obj.magic is inserted. 
 
70
  
 
71
  - As a rule, any extracted development that was compiling out of the box 
 
72
  should not contain any Obj.magic. At the other hand, generation of 
 
73
  Obj.magic is not optimized yet: there might be several of them at a place 
 
74
  were one would have been enough. 
 
75
  
 
76
  - Examples of code needing those Obj.magic: 
 
77
     * contrib/extraction/test_extraction.v in the Coq source
 
78
     * in the users' contributions: 
 
79
        Lannion
 
80
        Lyon/CIRCUITS
 
81
        Rocq/HIGMAN
 
82
 
 
83
  - As a side-effect of this Obj.magic feature, we now print the types 
 
84
  of the extracted terms, both in .ml files as commented documentation 
 
85
  and in interfaces .mli files
 
86
 
 
87
  - This feature hasn't been ported yet to Haskell. We are aware of 
 
88
  some unsafe casting functions like "unsafeCoerce" on some Haskell implems.
 
89
  So it will eventually be done.
 
90
 
 
91
* Concerning the extraction of Coq's new modules: 
 
92
  - Taking in account the new Coq's modules system has implied a *huge*
 
93
  rewrite of most of the extraction code.
 
94
 
 
95
  - The extraction core (translation from Coq to an abstract mini-ML) 
 
96
  is now complete and fairly stable, and supports modules, modules type 
 
97
  and functors and all that stuff.
 
98
 
 
99
  - The ocaml pretty-print part, especially the renaming issue, is 
 
100
  clearly weaker, and certainly still contains bugs. 
 
101
 
 
102
  - Nothing done for translating these Coq Modules to Haskell.
 
103
 
 
104
  - A temporary drawback of this module extraction implementation is that 
 
105
  efficiency (especially extraction speed) has been somehow neglected.
 
106
  To improve ...
 
107
 
 
108
  - As an interesting side-effect, definitions are now printed according to 
 
109
  the user's original order. No more of this "dependency-correct but weird"
 
110
  order. In particular realized axioms via Extract Constant are now at their 
 
111
  right place, and not at the beginning. 
 
112
 
 
113
* Other news: 
 
114
  
 
115
  - Records are now printed using the Ocaml record syntax
 
116
 
 
117
  - Syntax output toward Scheme. Quite funny, but quite experimental and 
 
118
  not documented. I recommend using the bigloo compiler since it contains 
 
119
  natively some pattern matching.
 
120
 
 
121
  - the dummy constant "__" have changed. see README
 
122
 
 
123
  - a few bug-fixes (#191 and others)
 
124
 
 
125
7.2 -> 7.3
 
126
 
 
127
* Improved documentation in the Reference Manual.
 
128
 
 
129
* Theoretical bad news: 
 
130
- a naughty example (see the end of test_extraction.v)
 
131
forced me to stop eliminating lambdas and arguments corresponding to 
 
132
so-called "arity" in the general case. 
 
133
 
 
134
- The dummy constant used in extraction ( let prop = () in ocaml ) 
 
135
may in some cases be applied to arguments. This problem is dealt by 
 
136
generating sufficient abstraction before the (). 
 
137
 
 
138
 
 
139
* Theoretical good news: 
 
140
- there is now a mechanism that remove useless prop/arity lambdas at the 
 
141
top of function declarations. If your function had signature 
 
142
nat -> prop -> nat in the previous extraction, it will now be nat -> nat. 
 
143
So the extractions of common terms should look very much like the old 
 
144
V6.2 one, except in some particular cases (functions as parameters, partial 
 
145
applications, etc). In particular the bad news above have nearly no 
 
146
impact...
 
147
 
 
148
 
 
149
* By the way there is no more "let prop = ()" in ocaml. Those () are
 
150
directly inlined. And in Haskell the dummy constant is now __ (two
 
151
underscore) and is defined by 
 
152
__ = Prelude.error "Logical or arity value used"
 
153
This dummy constant should never be evaluated when computing an
 
154
informative value, thanks to the lazy strategy. Hence the error message. 
 
155
 
 
156
 
 
157
* Syntax changes, see Documentation for details: 
 
158
 
 
159
Extraction Language Ocaml.
 
160
Extraction Language Haskell. 
 
161
Extraction Language Toplevel.
 
162
 
 
163
That fixes the target language of extraction. Default is Ocaml, even in the 
 
164
coq toplevel: you can now do copy-paste from the coq toplevel without 
 
165
renaming problems. Toplevel language is the ocaml pseudo-language used 
 
166
previously used inside the coq toplevel: coq names are printed with the coq 
 
167
way, i.e. with no renaming. 
 
168
 
 
169
So there is no more particular commands for Haskell, like 
 
170
Haskell Extraction "file" id. Just set your favourite language and go... 
 
171
 
 
172
 
 
173
* Haskell extraction has been tested at last (and corrected...). 
 
174
See specificities in Documentation. 
 
175
 
 
176
 
 
177
* Extraction of CoInductive in Ocaml language is now correct: it uses the 
 
178
Lazy.force and lazy features of Ocaml. 
 
179
 
 
180
 
 
181
* Modular extraction in Ocaml is now far more readable: 
 
182
instead of qualifying everywhere (A.foo), there are now some "open" at the 
 
183
beginning of files. Possible clashes are dealt with. 
 
184
 
 
185
 
 
186
* By default, any recursive function associated with an inductive type 
 
187
(foo_rec and foo_rect when foo is inductive type) will now be inlined 
 
188
in extracted code. 
 
189
 
 
190
 
 
191
* A few constants are explicitely declared to be inlined in extracted code. 
 
192
For the moment there are: 
 
193
        Wf.Acc_rec
 
194
        Wf.Acc_rect
 
195
        Wf.well_founded_induction
 
196
        Wf.well_founded_induction_type
 
197
Those constants does not match the auto-inlining criterion based on strictness.
 
198
Of course, you can still overide this behaviour via some Extraction NoInline. 
 
199
 
 
200
* There is now a web page showing the extraction of all standard theories: 
 
201
http://www.lri.fr/~letouzey/extraction
 
202
 
 
203
 
 
204
7.1 -> 7.2 :
 
205
 
 
206
* Syntax changes, see Documentation for more details: 
 
207
 
 
208
Set/Unset Extraction Optimize. 
 
209
 
 
210
Default is Set. This control all optimizations made on the ML terms 
 
211
(mostly reduction of dummy beta/iota redexes, but also simplications on 
 
212
Cases, etc). Put this option to Unset if you what a ML term as close as 
 
213
possible to the Coq term.
 
214
 
 
215
Set/Unset Extraction AutoInline. 
 
216
 
 
217
Default in Set, so by default, the extraction mechanism feels free to 
 
218
inline the bodies of some defined constants, according to some heuristics 
 
219
like size of bodies, useness of some arguments, etc. Those heuristics are 
 
220
not always perfect, you may want to disable this feature, do it by Unset. 
 
221
 
 
222
Extraction Inline toto foo. 
 
223
Extraction NoInline titi faa bor. 
 
224
 
 
225
In addition to the automatic inline feature, you can now tell precisely to 
 
226
inline some more constants by the Extraction Inline command. Conversely, 
 
227
you can forbid the inlining of some specific constants by automatic inlining. 
 
228
Those two commands enable a precise control of what is inlined and what is not. 
 
229
 
 
230
Print Extraction Inline. 
 
231
 
 
232
Sum up the current state of the table recording the custom inlings 
 
233
(Extraction (No)Inline). 
 
234
 
 
235
Reset Extraction Inline. 
 
236
 
 
237
Put the table recording the custom inlings back to empty. 
 
238
 
 
239
As a consequence, there is no more need for options inside the commands of 
 
240
extraction: 
 
241
 
 
242
Extraction foo. 
 
243
Recursive Extraction foo bar. 
 
244
Extraction "file" foo bar. 
 
245
Extraction Module Mymodule. 
 
246
Recursive Extraction Module Mymodule. 
 
247
 
 
248
New: The last syntax extracts the module Mymodule and all the modules 
 
249
it depends on. 
 
250
 
 
251
You can also try the Haskell versions (not tested yet): 
 
252
 
 
253
Haskell Extraction foo.
 
254
Haskell Recursive Extraction foo bar.
 
255
Haskell Extraction "file" foo bar.
 
256
Haskell Extraction Module Mymodule.
 
257
Haskell Recursive Extraction Module Mymodule.
 
258
 
 
259
And there's still the realization syntax: 
 
260
 
 
261
Extract Constant coq_bla => "caml_bla".
 
262
Extract Inlined Constant coq_bla => "caml_bla".
 
263
Extract Inductive myinductive => mycamlind [my_caml_constr1 ... ].
 
264
 
 
265
Note that now, the Extract Inlined Constant command is sugar for an Extract 
 
266
Constant followed by a Extraction Inline. So be careful with 
 
267
Reset Extraction Inline. 
 
268
 
 
269
 
 
270
 
 
271
* Lot of works around optimization of produced code. Should make code more 
 
272
readable. 
 
273
 
 
274
- fixpoint definitions : there should be no more stupid printings like 
 
275
 
 
276
let foo x = 
 
277
  let rec f x = 
 
278
    .... (f y) ....
 
279
  in f x
 
280
 
 
281
but rather 
 
282
 
 
283
let rec foo x = 
 
284
  .... (foo y) .... 
 
285
 
 
286
- generalized iota (in particular iota and permutation cases/cases):
 
287
 
 
288
A generalized iota redex is a "Cases e of ...." where e is ok. 
 
289
And the recursive predicate "ok" is given by:  
 
290
e is ok if e is a Constructor or a Cases where all branches are ok.
 
291
In the case of generalized iota redex, it might be good idea to reduce it, 
 
292
so we do it. 
 
293
Example: 
 
294
 
 
295
match (match t with 
 
296
         O -> Left
 
297
       | S n -> match n with 
 
298
                  O -> Right 
 
299
                | S m -> Left) with 
 
300
 Left -> blabla 
 
301
| Right -> bloblo
 
302
 
 
303
After simplification, that gives: 
 
304
 
 
305
match t with 
 
306
  O -> blabla
 
307
| S n -> match n with 
 
308
          O -> bloblo
 
309
        | S n -> blabla
 
310
 
 
311
As shown on the example, code duplication can occur. In practice 
 
312
it seems not to happen frequently. 
 
313
 
 
314
- "constant" case:
 
315
In V7.1 we used to simplify cases where all branches are the same. 
 
316
In V7.2 we can simplify in addition terms like 
 
317
        cases e of 
 
318
          C1 x y -> f (C x y)
 
319
        | C2 z -> f (C2 z) 
 
320
If x y z don't occur in f, we can produce (f e). 
 
321
 
 
322
- permutation cases/fun: 
 
323
extracted code has frequenty functions in branches of cases: 
 
324
 
 
325
let foo x = match x with 
 
326
   O -> fun _ -> .... 
 
327
 | S y -> fun _ -> .... 
 
328
 
 
329
the optimization consist in lifting the common "fun _ ->", and that gives
 
330
 
 
331
let foo x _ = match x with 
 
332
   O -> .....
 
333
 | S y -> ....
 
334
 
 
335
 
 
336
* Some bug corrections (many thanks in particular to Michel Levy). 
 
337
 
 
338
* Testing in coq contributions: 
 
339
If you are interested in extraction, you can look at the extraction tests 
 
340
I'have put in the following coq contributions 
 
341
 
 
342
Bordeaux/Additions                      computation of fibonacci(2000)
 
343
Bordeaux/EXCEPTIONS                     multiplication using exception.
 
344
Bordeaux/SearchTrees                    list -> binary tree. maximum.
 
345
Dyade/BDDS                              boolean tautology checker.
 
346
Lyon/CIRCUITS                           multiplication via a modelization of a circuit.
 
347
Lyon/FIRING-SQUAD                       print the states of the firing squad.
 
348
Marseille/CIRCUITS                      compares integers via a modelization of a circuit. 
 
349
Nancy/FOUnify                           unification of two first-order terms.
 
350
Rocq/ARITH/Chinese                      computation of the chinese remainder.  
 
351
Rocq/COC                                small coc typechecker. (test by B. Barras, not by me)
 
352
Rocq/HIGMAN                             run the proof on one example. 
 
353
Rocq/GRAPHS                             linear constraints checker in Z. 
 
354
Sophia-Antipolis/Stalmarck              boolean tautology checker.
 
355
Suresnes/BDD                            boolean tautology checker.
 
356
 
 
357
Just do "make" in those contributions, the extraction test is integrated. 
 
358
More tests will follow on more contributions.
 
359
 
 
360
 
 
361
 
 
362
7.0 -> 7.1 : mostly bug corrections. No theoretical problems dealed with.
 
363
 
 
364
* The semantics of Extract Constant changed: If you provide a extraction 
 
365
for p by Extract Constant p => "0", your generated ML file will begin by 
 
366
a let p = 0. The old semantics, which was to replace p everywhere by the
 
367
provided terms, is still available via the Extract Inlined Constant p => 
 
368
"0" syntax.
 
369
 
 
370
 
 
371
* There are more optimizations applied to the generated code: 
 
372
- identity cases: match e with P x y -> P x y | Q z -> Q z | ...
 
373
is simplified into e. Especially interesting with the sumbool terms: 
 
374
there will be no more match ... with Left -> Left | Right -> Right
 
375
 
 
376
- constant cases: match e with P x y -> c | Q z -> c | ...
 
377
is simplified into c as soon as x, y, z do not occur in c.
 
378
So no more match ... with Left -> Left | Right -> Left.
 
379
  
 
380
 
 
381
* the extraction at Toplevel (Extraction foo and Recursive Extraction foo),
 
382
which was only a development tool at the beginning, is now closer to 
 
383
the real extraction to a file. In particular optimizations are done, 
 
384
and constants like recursors ( ..._rec ) are expanded. 
 
385
 
 
386
 
 
387
* the singleton optimization is now protected against circular type.
 
388
( Remind : this optimization is the one that simplify 
 
389
type 'a sig = Exists of 'a  into type 'a sig = 'a and 
 
390
match e with (Exists c) -> d into let c = e in d ) 
 
391
 
 
392
 
 
393
* Fixed one bug concerning casted code
 
394
 
 
395
 
 
396
* The inductives generated should now have always correct type-var list 
 
397
('a,'b,'c...)
 
398
 
 
399
 
 
400
* Code cleanup until three days before release. Messing-up code 
 
401
in the last three days before release.
 
402
 
 
403
 
 
404
 
 
405
 
 
406
 
 
407
 
 
408
 
 
409
6.x -> 7.0 : Everything changed. See README