Set Theory, Higher Order Logic Or Both?
Total Page:16
File Type:pdf, Size:1020Kb
Revised version of a pap er published in Theorem Proving in Higher Order Logics th International Conference TPHOLs Lecture Notes in Computer Science Joakim von Wright Jim Grundy and John Harrison Eds Turku Finland August pp Set Theory Higher Order Logic or Both Mike Gordon University of Cambridge Computer Lab oratory New Museums Site Pembroke Street Cambridge CB QG UK Abstract The ma jority of general purp ose mechanised pro of assistants supp ort versions of typed higher order logic even though set theory is the standard foundation for mathematics For many applications higher order logic works well and provides for sp ecication the b enets of typechecking that are wellknown in programming However there are areas where types get in the way or seem unmotivated Furthermore most p eople with a scientic or engineering background already know set theory but not higher order logic This pap er discusses some approaches to getting the b est of b oth worlds the expressiveness and standardness of set theory with the ecient treatment of functions provided by typed higher order logic Introduction Higher order logic is a successful and p opular formalism for computer assisted reasoning Pro of systems based on higher order logic include ALF Automath Co q EHDM HOL IMPS LAMBDA LEGO Nuprl PVS and Veritas Set theory is the standard foundation for mathematics and for formal no tations like Z VDM and TLA Several pro of assistants for set theory exist such as Mizar and Isab elleZF Anecdotal evidence suggests that for equivalent kinds of theorems pro of in higher order logic is usually easier and shorter than in set theory Isab elle users liken set theory to machine co de and type theory to a highlevel language Functions are a p ervasive concept in computer science and so taking them as primitive as is done by most forms of higher order logic is natural Higher order logic is typed Types are an accepted and eective metho d of structuring data and typechecking is a p owerful technique for nding errors Types can b e used to index terms and formulae for ecient retrieval General laws b ecome simpler when typed Unfortunately certain common mathematical constructions do not t into the type disciplines asso ciated with higher order logic For example the set f fg ffgg ffgffggg g is traditionally used as the denition of the nateral numbers and lists are dened as the union of the innite chain fhig X fhig X X fhig These sets are essentially untyped Furthermore the traditional axiomatic metho d used in mathematics needs to b e reformulated to t into type theory There is no standard formulation of higher order logic The various higher order logicstype theories dier widely b oth in the notation used and in their underlying philosophical conception of mathematical truth eg intuitionistic or constructive versus classical Automath is based on de Bruijns own very gen eral logic A which anticipated many more recent developments Co q and LEGO supp ort dierent versions of the Calculus of Constructions EHDM PVS and Veritas each supp ort dierent classical higher order logics with subtypes andor dep endent types HOL and LAMBDA supp ort similar p olymorphic ver sions of the simple theory of types IMPS supp orts monomorphic simple type theory with nondenoting terms and a theory interpretation mechanism ALF and Nuprl supp ort versions of Martin Lof type theory a constructive logic with a very elab orate type system There is much less variation among set theories The well known formulations are for practical purp oses pretty much equivalent They are all dened by ax ioms in predicate calculus The only variations are whether prop er classes are in the ob ject or meta language and how many large cardinals are p ostulated to ex ist The vast ma jority of mathematicians are happy with ZFC ZermeloFraenkel set theory with the Axiom of Choice It would b e wonderful if one could get the b est of b oth worlds the expres siveness and standardness of set theory with the ecient treatment of functions provided by typed higher order logic In Section an approach is outlined in which set theory is provided as a resource within higher order logic and in Sec tion a reverse approach is sketched in which higher order logic is built on top of set theory Both these approaches are explored in the context of the HOL 1 systems version of higher order logic but in the presentation I have tried to minimise the dep endence on the details of the HOL logic Some conclusions are discussed in Section Sets in Higher Order Logic Set theory can b e p ostulated inside higher order logic by declaring a type V and a constant V V b o ol where b o ol is the type of the two truthvalues and then asserting the normal axioms of set theory The resulting theory has a consistency strength stronger than ZF b ecause one can dene inside it a semantic function from a concrete type representing rst order formulae to V The HOL logic is just higher order predicate calculus with a type system due to Milner consisting of Churchs simple theory of types with type variables moved from the metalanguage into the ob ject language In Churchs system a term with type variables is actually a metanotation a termschema denoting a family of terms whereas in HOL it is a single p olymorphic term Other versions of mechanised simple type theory eg IMPS PVS use uninterpreted type constants instead of type variables and then p ermit these to b e instantiated via a theory interpretation mechanism 2 such that all the theorems of ZF can b e proved However a mo del for higher order logic plus V can b e constructed in ZF with one inaccessible cardinal Thus the strength of higher order logic augmented with ZFlike axioms for V is 3 somewhere b etween ZF and ZF plus one inaccessible cardinal An alternative approach to using some of the linguistic facilities of higher order logic whilst remaining essentially rst order has b een investigated by Francisco Corella His PhD thesis contains a very interesting discussion of the dierent roles type theory can have in the formalisation of set theory Dening set theory inside higher order logic is very smo oth For example the Axiom of Replacement is simply f s t y y t x x s y f x In traditional rstorder formulations of ZF the secondorder quantication of f is not p ermitted so a messy axiom scheme is needed Another example of a 4 useful second order quantication is the Axiom of Global Choice f s s f s s Standard denitional metho ds allow all the usual settheoretic notions to b e dened and their prop erties established Such notions include for example the empty set numbers Bo oleans union intersection nite sets p owersets ordered pairs pro ducts relations functions etc When set theory is axiomatised in higher order logic the Axiom of Separation interacts nicely with notation to allow fx X j P xg to b e represented by Sp ec X x P x for a suitably dened constant Sp ec More generally ff x x X j P x x g can b e represented by 1 n 1 n Sp ec X x x x x f x x P x x 1 n 1 n 1 n In HOL new types are dened by giving names to nonempty subsets of existing types Each element s of type V determines a subtype of V whose characteristic predicate is x x s ie the set of all members of set s A type of HOL is represented by s V i there is a onetoone function of type V onto the subtype of V determined by s It is straightforward to nd members of V corresp onding to the builtin types of HOL for example f fgg represents the type of Bo oleans and f fg ffgg ffgffggg g represents the natural numbers Standard settheoretic constructions can b e used to mimic type op erators If s s represent types and resp ectively then the Cartesian pro duct of s 1 2 1 2 1 and s which will b e denoted here by s s represents the type The set 2 1 2 1 2 of all total singlevalued relations b etween s and s denoted here by s s 1 2 1 2 In HOL jargon this is a deep embedding of ZF in higher order logic plus V These facts ab out consistency strength were provided by Ken Kunen private communication When type V is p ostulated in the HOL logic this is actually a theorem b ecause of Hilb erts op erator 5 represents the type Since there are lots of nonempty subsets of the 1 2 class of sets this provides a rich source of new types There are two ways this richness can b e exploited i to dene types that could b e dened without V in a slicker and more natural manner and ii to dene types that could not b e dened at all An example of a construction that can b e done in HOL without V but is neater with it is the denition of lists In the current HOL system lists of elements of type are represented as a subtype of the type num num 6 the idea b eing that a pair f n represents the list f f f n A more direct and natural approach uses hx hx hx Truei ii to represent 1 2 n the list x x the empty list hi can b e represented by an arbitary set 1 n However this is not welltyped since tuples with dierent lengths have dierent types Thus this approach cannot b e used to dene lists in higher order logic However the construction can easily b e p erformed inside V by dening using primitive recursion ListX fhig X fhig X X fhig The required prop erties of lists are easily derived such as the xedp oint prop erty X ListX fhig X ListX and structural induction P X P hi l ListX P l x X P hx l i l ListX P l If sV represents a type then Lists represents the type of nite lists of elements of type Thus a type of lists of