Can the Computer Really Help Us to Prove Theorems?
Total Page:16
File Type:pdf, Size:1020Kb
Can the computer really help us to prove theorems? Herman Geuvers1 Radboud University Nijmegen and Eindhoven University of Technology The Netherlands ICT.Open 2011 Veldhoven, November 2011 1Thanks to Freek Wiedijk & Foundations group, RU Nijmegen Can the computer really help us to prove theorems? Can the computer really help us to prove theorems? Yes it can Can the computer really help us to prove theorems? Yes it can But it’s hard ... ◮ How does it work? ◮ Some state of the art ◮ What needs to be done Overview ◮ What are Proof Assistants? ◮ How can a computer program guarantee correctness? ◮ Challenges What are Proof Assistants – History John McCarthy (1927 – 2011) 1961, Computer Programs for Checking Mathematical Proofs What are Proof Assistants – History John McCarthy (1927 – 2011) 1961, Computer Programs for Checking Mathematical Proofs Proof-checking by computer may be as important as proof generation. It is part of the definition of formal system that proofs be machine checkable. For example, instead of trying out computer programs on test cases until they are debugged, one should prove that they have the desired properties. What are Proof Assistants – History Around 1970 five new systems / projects / ideas ◮ Automath De Bruijn (Eindhoven) ◮ Nqthm Boyer, Moore (Austin, Texas) ◮ LCF Milner (Stanford; Edinburgh) What are Proof Assistants – History Around 1970 five new systems / projects / ideas ◮ Automath De Bruijn (Eindhoven) ◮ Nqthm Boyer, Moore (Austin, Texas) ◮ LCF Milner (Stanford; Edinburgh) ◮ Mizar Trybulec (Bia lystok, Poland) ◮ Evidence Algorithm Glushkov (Kiev, Oekrain) What are Proof Assistants – History Around 1970 five new systems / projects / ideas ◮ Automath De Bruijn (Eindhoven) now: Coq ◮ Nqthm Boyer, Moore (Austin, Texas) now: ACL2, PVS ◮ LCF Milner (Stanford; Edinburgh) now: HOL, Isabelle ◮ Mizar Trybulec (Bia lystok, Poland) ◮ Evidence Algorithm Glushkov (Kiev, Oekrain) HOL Light LCF tradition (Milner): LCF → HOL → HOL Light Stanford, US → Cambridge, UK → Portland, US Based on: higher order logic John Harrison proves correctness of floating point hardware at Intel formalises mathematics in his spare time very simple and elegant system easy to extend (add your own tactics) not user friendly Isabelle ’successor’ of HOL Based on: higher order logic cooperation between two universities: Cambridge, UK focus: computer security M¨unchen, Duitsland focus: mathematics and programming languages balanced system nice proof language powerful automation Coq Based on: type theory INRIA en Microsoft Institut National de Recherche en Informatique et en Automatique system with the most impressive formalisation so far system used most at Nijmegen integrated programming language ≈ Haskell mathematically expressive the built in logic is intu¨ıtionistic Mizar Andrzej Trybulec Bia lystok, Polen also: Nagano, Japan Based on: set theory most mathematical of all proof assistants largest library of formalised mathematics 2,1 miljon lines of code user friendly sometimes hard to follow What Proof Assistants are not Doing mathematics on a computer • Computing • Proving What Proof Assistants are not Doing mathematics on a computer • Computing: numbers numerical mathematics, visualisation, simulation • Computing: formulas computer algebra • Proving What Proof Assistants are not Doing mathematics on a computer • Computing: numbers numerical mathematics, visualisation, simulation • Computing: formulas computer algebra • Proving: by the computer • Proving: by a human, with the aid of a computer What Proof Assistants are not Doing mathematics on a computer • Computing: numbers numerical mathematics, visualisation, simulation • Computing: formulas computer algebra • Proving: by the computer automatic theorem proving • Proving: by a human, with the aid of a computer proof assistant Why Proof Assistants Doing mathematics on a computer • Numerical Mathematics and Computer Algebra: No proofs • Automated Theorem Provers: No interesting mathematics • Proof Assistants: proofs and interesting mathematics Why Proof Assistants Doing mathematics on a computer • Numerical Mathematics and Computer Algebra: No proofs • Automated Theorem Provers: No interesting mathematics • Proof Assistants: proofs and interesting mathematics the price to pay: user has to do a lot Why Proof Assistants Doing mathematics on a computer • Numerical Mathematics and Computer Algebra: No proofs • Automated Theorem Provers: No interesting mathematics • Proof Assistants: proofs and interesting mathematics the price to pay: user has to do a lot proof assistant = interactive theorem prover interplay between human and computer Proof Assistants: what are they used for ◮ Verify mathematical theorems ◮ Build up a formal mathematical library ◮ Verify software and hardware design Proof Assistants: what are they used for ◮ Verify mathematical theorems Some mathematical proofs just become too large and complex: proof of a Kepler’s conjecture ◮ Build up a formal mathematical library ◮ Verify software and hardware design Proof Assistants: what are they used for ◮ Verify mathematical theorems Some mathematical proofs just become too large and complex: proof of a Kepler’s conjecture ◮ Build up a formal mathematical library Mizar Mathematical Library ◮ Verify software and hardware design Proof Assistants: what are they used for ◮ Verify mathematical theorems Some mathematical proofs just become too large and complex: proof of a Kepler’s conjecture ◮ Build up a formal mathematical library Mizar Mathematical Library ◮ Verify software and hardware design Compcert: verified C compiler Proof Assistants for software verification Holy Grail ‘Things like even software verification, this has been the Holy Grail of computer science for many decades but now in some very key areas, for example, driver verification we’re building tools that can do actual proof about the software and how it works in order to guarantee the reliability.’ Proof Assistants for software verification Holy Grail ‘Things like even software verification, this has been the Holy Grail of computer science for many decades but now in some very key areas, for example, driver verification we’re building tools that can do actual proof about the software and how it works in order to guarantee the reliability.’ Bill Gates, 18 april 2002 How a Proof Assistant works The different phases in a mathematical proof 1. find a proof Everything goes: experiment, guess, simplify, . Will not be preserved in the future, but crucial for students to learn the subject. How a Proof Assistant works The different phases in a mathematical proof 1. find a proof Everything goes: experiment, guess, simplify, . Will not be preserved in the future, but crucial for students to learn the subject. 2. write down a proof Contains explanation why the stated theorem holds and why the proof is the way it is, but also small proof steps that together provide a verification of the theorem. 3. present and communicate a proof Explain to others, present in a talk. Improve a proof, simplify it, change it, generalize it. How a Proof Assistant works The different phases in a mathematical proof 1. find a proof Everything goes: experiment, guess, simplify, . Will not be preserved in the future, but crucial for students to learn the subject. 2. write down a proof Contains explanation why the stated theorem holds and why the proof is the way it is, but also small proof steps that together provide a verification of the theorem. 3. present and communicate a proof Explain to others, present in a talk. Improve a proof, simplify it, change it, generalize it. Proof assistant plays a role in (2) and a bit in (3); in the future possibly in (1) Different styles of formalised proofs ◮ procedural ◮ declarative Different styles of formalised proofs ◮ procedural tell what to do ◮ declarative tell where to go Different styles of formalised proofs ◮ procedural tell what to do Go out of the train, to the right, down the stairs, to the right, out of the exit, to the right, cross the pedestrian crossing, take the Limbo trail, ... ◮ declarative tell where to go Different styles of formalised proofs ◮ procedural tell what to do Go out of the train, to the right, down the stairs, to the right, out of the exit, to the right, cross the pedestrian crossing, take the Limbo trail, ... ◮ declarative tell where to go Go to the platform, go down to the tunnel, to the north exit of the station, go to the KvK building, then go to the “Zwarte Doos”, . Different styles of formalised proofs procedural (tactics) Theorem double div2 : forall (n:nat), div2 (double n) = n. simple induction n; auto with arith. intros n0 H. rewrite double_S; pattern n0 at 2; rewrite <- H; simpl; auto. Qed. Different styles of formalised proofs declarative Theorem double div2 : forall (n:nat), div2 (double n) = n. proof. assume n:nat. per induction on n. suppose it is 0. thus thesis. suppose it is (S m) and IH:thesis for m. have (div2 (double (S m))= div2 (S (S (double m)))). ~= (S (div2 (double m))). thus ~= (S m) by IH. end induction. end proof. Why would we believe a proof assistant? ...a proof assistant is just another program ... Why would we believe a proof assistant? ...a proof assistant is just another program ... To attain the utmost level of reliability: ◮ Description of the rules and the logic of the system. Why would we believe a proof assistant? ...a proof assistant is just another program ... To attain the utmost level of reliability: ◮ Description of the rules and the logic of the system. ◮ A small “kernel”. All proofs can be reduced to a small number of basic proof steps. high level steps are defined in terms of the small ones. Why would we believe a proof assistant? ...a proof assistant is just another program ... To attain the utmost level of reliability: ◮ Description of the rules and the logic of the system. ◮ A small “kernel”. All proofs can be reduced to a small number of basic proof steps. high level steps are defined in terms of the small ones. LCF approach [Milner]: Have an abstract data type of theorems thm, where the only constants of this data type are the axioms and the only functions to this data type are the inference rules of the logic. Why would we believe a proof assistant? ...a proof assistant is just another program ..