meeting -*- Outline -*- * higher-order logic (chapter 3) HOL is: - an extension of the simply typed lambda calculus with logical connectives ------------------------------------------ ASCII NOTATION We write: ``(\ x . t)'' for (\lambda x . t) ``|-'' for turnstile (latex's \vdash) ``\in'' for set membership ------------------------------------------ ** types and terms (3.1) ------------------------------------------ SYNTAX OF HOL def: A Nat-indexed set of type operators, AT = , where each Op_n is a set of symbols, is a *type structure*. The arity of Op_n is n. The constants of AT are C = Op_0. S ::= "types over AT" C "atomic types" | S1 -> S2 "function types" | Op(S1, ..., Sn) "app of type oper" t ::= "terms" | v "variable refs" | c "constants" | t1 . t2 "applications" | (\ v : S . t1) "abstractions" | t:S "typings" ------------------------------------------ Q: Is it really reasonable to assume that constants are distinguished from variables? ------------------------------------------ TYPING RULES def: Let AT be given. Then a relation between constant symbols and types SG = {c:S | S a type}, is a *signature*. def: A *type environment*, TE, is a from from variables to types. Typing Rules, for a given signature SG TE |- v : S (tvar) * if (v:S) \in TE TE |- c : S (tcon) * if (c:S) \in SG and c \not\in dom(TE) TE |- t1: S1 -> S2, TE |- t2: S1 _________________________________ (tapp) TE |- t1 . t2 : S2 TE,(v:S) |- t2: S2 _______________________________ (tlam) TE |- (\ v: S1 . t2) : S1 -> S2 TE |- t: S __________________ (texplicit) TE |- (t : S) : S ------------------------------------------ Q: Do we care about terms that don't have types? no, we only care about well-typed terms Q: Do terms have unique types in this setup? No, they don't, we should also require that to deal with overloading Can ensure that by writing in typings as needed *** precedence and association as usual *** substitution and replacement Q: What's the notation for substitution? t[v1, ..., vn := t1, ..., tn] *** standard types and constants Q: What types are built-in? Bool Q: What constants are built-in? == : S -> S -> Bool for all types S *** examples Q: Can you give a typing derivation (\ x: Int . x == 641)?