Proof assistant: Difference between revisions
imported>Boris Tsirelson (→Availability: more) |
imported>Boris Tsirelson (→Availability: Everything is included) |
||
Line 118: | Line 118: | ||
===Availability=== | ===Availability=== | ||
''Isabelle'' is available to download (see the [[Proof assistant/External Links|external links page]]), free of charge or registration. For users of Linux or MacOSX the installation is quite easy; users of Windows need ''Cygwin'', a Unix/Linux-like environment for Windows. | ''Isabelle'' is available to download (see the [[Proof assistant/External Links|external links page]]), free of charge or registration. For users of Linux or MacOSX the installation is quite easy; users of Windows need ''Cygwin'', a Unix/Linux-like environment for Windows. Everything is included in the bundle: ''Isabelle, Isar, Proof General, HOL'' and more, as well as documentation and libraries of theory files. | ||
For especially interested, the source code is also available; it contains mostly programs in the functional programming language ''ML.'' | For especially interested, the source code is also available; it contains mostly programs in the functional programming language ''ML.'' |
Revision as of 03:41, 13 August 2010
For a mathematical theory, correctness means formalizability. "In practice, the mathematician ... is content to bring the exposition to a point where his experience and mathematical flair tell him that translation into formal language would be no more than an exercise of patience (though doubtless a very tedious one)."[1] Reliability of these experience and flair appears to be high but not perfect. Formalization is especially desirable in complicated cases, but feasible only in very simple cases, unless computers help. (Similarly, without computers a programmer is able to debug only very simple programs.)
A proof assistant is a computer program used interactively for developing human-readable reliable mathematical documents in a formal language. (It is not the same as a non-interactive, fully automated theorem prover.)
Isabelle/Isar
Nowadays (about 2010) the most successful project of this class combines
- Isabelle, a generic system for implementing logical formalisms;
- Isar (Intelligible SemiAutomated Reasoning), a versatile language environment for structured formal proofs;
- Proof General, a configurable user interface (front-end) for proof assistants;
- HOL (Higher-Order Logic).
Example session
First impressions
An existing file, verified before, is used as the source text in this example. Thus, the session is not really interactive. However, this fact is not known to Isabelle. The proof assistant treats the session as interactive, and the text as new.
We start Proof General (Fig. 1) and enter the source text (Fig. 2).
On this stage Proof General does not send the text to Isabelle; we still can edit the text. Proof General helps us by automatic colorization according to the syntax of the Isar language.
We start a new theory "CauchysMeanTheorem". (The well-know Cauchy's Mean Theorem says that the geometric mean is less than, or equal to, the arithmetic mean, for every finite collection of positive numbers. However, this theorem will appear much later, near the end of the source text.) The existing theory "Complex_Main" is a prerequisite. (It contains main facts about real and complex numbers; only real numbers are relevant, but some useful formulas about appear in "Complex_Main".)
Clicking the red button "" we send the first portion of the text to Isabelle. After two more such clicks Isabelle reads the line "imports Complex_Main" and finds in the library the "Complex_Main" theory (since it is a prerequisite to the new "CauchysMeanTheorem"), but also "Real", since it appears to be a prerequisite to "Complex_Main", and so on, recursively, until all prerequisites are found and processed (in a logical order). Then, after 9 more clicks we come to the screen shown on Fig. 3. The definitions (and everything before them) are already processed by Isabelle; accordingly, they turn into blue, and become read-only. The formulation of the first lemma is being processed by Isabelle; accordingly, it turns into orange. A fraction of a second later we get Fig. 4. The formulation of the lemma is read by Isabelle; a dialog about its proof starts on the bottom window.
A robot as a student
The first lemma "listsum_empty" (of the new "CauchysMeanTheorem" theory) is ridiculously trivial; it claims that the sum of the empty collection of numbers is equal to zero! Here is an explanation of this disturbing situation.
A human student would not start to learn Cauchy's mean theorem
being unfamiliar with such notions as the sum and the product of n numbers. However, a robot (like Isabelle) is not a human. A robot never was in a kindergarten or elementary school. We cannot say to Isabelle: "Look, here is a sum of three numbers: 15+5+10=30; note that also 5+10+15=30 etc. Likewise, any finite collection of numbers has its sum." Children proceed from the particular to the general, but proof assistants proceed from the general to the particular.
For now, Isabelle is not well-educated. Its mathematical knowledge is rather fragmentary. Some volunteers contribute some theories to the library of Isabelle; this is not a well-organized process rich of resources. Each contributor has to find out, which of the relevant facts are already known to Isabelle and which are not.
Definitions of the sum and the product of a list of numbers are given to Isabelle just before the first lemma (see "listsum" and "listprod" on Fig. 3 or 4) in terms of
- addition and multiplication for two numbers (already known), and
- "foldr", the right fold operation defined in the "List" theory (one of the prerequisites).
Informally, the right fold applies to a binary operation (say, "+"), a list (say, "[x,y,z]") and an initial value (say, "a"), giving "x+(y+(z+a))"; more formally,
foldr op+ [x,y,z] a = x+(y+(z+a)).
(For the summation case one may write just "x+y+z+a", but in general an operation need not be associative.) The "listsum" definition stipulates the addition operation and the initial value 0; the "listprod" definition stipulates the multiplication operation and the initial value 1. The sum of a list is denoted by Isabelle as follows:
A human student, given by such a formal definition of sum (only sketched here) would not be too astonished by the trivial exercise "prove that the sum of the empty list is equal to 0"; this is our "listsum_empty" lemma. After the formulation, the source text contains a hint to the proof,
unfolding listsum_def by simp
which means informally: "Isabelle, use the definition of the sum of a list, do evident simplifications, and hopefully you'll find a proof of the lemma." And indeed, Isabelle is cute enough in order take the hint. After a fraction of a second it reports that the lemma is successfully proved.
Now we continue the example session.
Hard work
After more than 30 rather boring, mostly trivial lemmas, whose proofs vary in length from one line to about 50 lines, we arrive to a more interesting lemma (Fig. 5) and start proving it (Fig. 6).
We make a claim of the form "from A have B..."; Isabelle responds by "using this: A, goal: B" (Fig. 7) and waits. We add a hint "...by C"; Isabelle takes the hint, finds a proof and responds by "have B" (Fig. 8).
We continue; the work becomes hard (Fig. 9). After a lot of effort we get close to the happy end (Fig. 10), and finally the theorem is proved (Fig. 11).
Options
Many options are available for Proof General (Fig. 12) and Isabelle. In particular, many kinds of additional information may be requested from Isabelle at any moment of the session (Fig. 13).
Higher-order logic versus theory of sets
Reliability
Availability
Isabelle is available to download (see the external links page), free of charge or registration. For users of Linux or MacOSX the installation is quite easy; users of Windows need Cygwin, a Unix/Linux-like environment for Windows. Everything is included in the bundle: Isabelle, Isar, Proof General, HOL and more, as well as documentation and libraries of theory files.
For especially interested, the source code is also available; it contains mostly programs in the functional programming language ML.
Isabelle for Linux, version 2009-2, is distributed as a file "Isabelle2009-2_bundle_x86-linux.tar.gz", 247 MB long. Unpacking it one gets several folders (bin, contrib, doc, etc, heaps, lib, src), 724 MB in the total. The file "bin/isabelle" is a bash script to be called by the command "isabelle emacs" in order to start Proof General. (No compilation or installation needed.)
The "src/HOL" folder contains 90 theory files (such as "Complex_Main", "Deriv" and "Complete_Lattice") and 48 folders (such as "Algebra", "Hahn_Banach", "Matrix" and "Probability"), about 900 theory files in the total.
The "doc" folder contains documentation:
- Learning and using Isabelle
- "tutorial": Tutorial on Isabelle/HOL
- "main": What's in Main
- "isar-overview": Tutorial on Isar
- "locales": Tutorial on Locales
- "classes": Tutorial on Type Classes
- "functions": Tutorial on Function Definitions
- "codegen": Tutorial on Code Generation
- "nitpick": User's Guide to Nitpick
- "sledgehammer": User's Guide to Sledgehammer
- "sugar": LaTeX Sugar for Isabelle documents
- Reference Manuals
- "isar-ref": The Isabelle/Isar Reference Manual
- "implementation":The Isabelle/Isar Implementation Manual
- "system": The Isabelle System Manual
Other systems
- Mizar
- Hol88, Hol98, Hol4, Hol Light
- Lego, Coq
- Lambda-CLAM
- Matita
- Otter
- Prover9
- Mace2
- Jape, Ssreflect, PhoX, pvs
- ACL2, Twelf
Notes
- ↑ Bourbaki 1968, page 8.
References
Bourbaki, Nicolas (1968), Elements of mathematics: Theory of sets, Hermann (original), Addison-Wesley (translation).