A short overview of Type Theory
Yves Bertot June 2015
1 / 35
A short overview of Type Theory Yves Bertot June 2015 1 / 35 - - PowerPoint PPT Presentation
A short overview of Type Theory Yves Bertot June 2015 1 / 35 -calculus A small-scale model of programming languages, Extremely simple Three constructs function descriptions, function calls, variables Only one input to
1 / 35
◮ Three constructs ◮ function descriptions, function calls, variables ◮ Only one input to functions ◮ Only one outputto functions
◮ Higher order: programs are values ◮ No control on memory usage ◮ several possible evaluation strategies 2 / 35
◮ Several argument functions are a particular case
3 / 35
4 / 35
5 / 35
6 / 35
7 / 35
8 / 35
◮ provide documentation on programs,
9 / 35
10 / 35
11 / 35
12 / 35
13 / 35
◮ Curry-Howard isomorphism, types-as-propositions,
14 / 35
15 / 35
16 / 35
17 / 35
◮ Type inference ◮ Polymorphism ◮ General recursion
◮ Universal quantification ◮ Proofs by induction ◮ Guaranteeing computation termination 18 / 35
19 / 35
◮ 0 : nat (represents 0) ◮ S : nat → nat (represents successor), ◮ rec nat
◮ rec nat v f O = v ◮ rec nat v f (S n) = f n (rec nat v f n)
◮ rec nat : t → (nat → t → t) → nat → t, for any type t,
20 / 35
◮ subtraction is also a comparison test, minus x y = 0 si x ≤ y,
21 / 35
◮ leaf : bin, ◮ node : nat → bin → bin → bin, 22 / 35
◮ rec bin has three arguments (2+1), rec bin f1 f2 x, is
◮ f1 is a value of type t, ◮ f2 has (3+2) arguments, ◮ 3 is the number of arguments of node, ◮ 2 is the number of arguments of node in type bin, ◮ extra arguments are values for recursive calls
23 / 35
24 / 35
◮ f 0 has type A 0, ◮ f 1 has type A 1, ◮ f 2 has typeA 2, ◮ and so on,
25 / 35
26 / 35
27 / 35
28 / 35
◮ even0 :
◮ even2 :
29 / 35
30 / 35
◮ Need a type family P : nat → Type, ◮ The value for 0 must be in P 0, ◮ The value for S n must be in P (S n), ◮ The value of any recursive call on n must be in P n,
31 / 35
◮ hleaf :
◮ hnode :
32 / 35
◮ even0:
◮ even2:
33 / 35
34 / 35
◮ Defining only simply typed functions ◮ One uses universal quantifiactions only in logical formula ◮ The only type families one considers are inductive predicates ◮ Tactics take care of constructing the most complex terms
35 / 35