type theory
Download
Skip this Video
Download Presentation
TYPE THEORY *

Loading in 2 Seconds...

play fullscreen
1 / 46

TYPE THEORY * - PowerPoint PPT Presentation


  • 76 Views
  • Uploaded on

TYPE THEORY *. Zoltán Csörnyei Eötvös University Department of General Computer Science Budapest, Hungary [email protected] * Supported by OTKA T037742. Preliminaries I. LOGIC • Aristotle (384 BC – 322 BC). Aristotle.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' TYPE THEORY *' - cadee


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
type theory

TYPE THEORY *

Zoltán Csörnyei

Eötvös University

Department of General Computer Science

Budapest, Hungary

[email protected]

* Supported by OTKA T037742

preliminaries i
Preliminaries I.

LOGIC

• Aristotle (384 BC – 322 BC)

aristotle
Aristotle

Aristotle proposed the now famous Aristotelian syllogistic, form of argument consisting of two premises and a conclusion. His example is:

(i)Every Greek is a person.

(ii) Every person is mortal.

(iii) Every Greek is mortal.

w of ockham
W. of Ockham

Ockham\'s Razor:

  • Frustra fit per plura, quod fieri potest per pauciora.It is vain to do with more what can be done with less.orEssentia non sunt multiplicanda praeter necessitatem.Entities should not be multiplied unnecessarily.
w of ockham1
W. of Ockham
  • He considered a three valued logic where propositions can take one of three truth values. This became important for mathematics in the 20th Century but it is remarkable that it was first studied by Ockham 600 years earlier.
g frege
G. Frege
  • one of the founders of modern symbolic logic

He was the first to fully develop the main thesis of logicism, that mathematics is reducible to logic.

( The Russell paradox gave contradiction in Frege\'s system of axioms. )

d hilbert
D. Hilbert
  • Axioms

1. |- A  A

2. |- A  (B  A)

3. |- (A  (BC))  ((A B)  A  C))

4. |- A  B |- A

---------------------

|- B

g gentzen
G. Gentzen
  • He introduced the notion of

\'logical consequence\'

B1, B2, …, B n |- A

  • Natural deduction
  • Sequent calculus
  • Derivation tree
l e j brouwer
L.E.J. Brouwer
  • The foundations of intuitionism.
  • Judgements about statements are based on the existence of a proof or construction of that statements.
  • There are two irrational numbers x and y, such that xy is rational.
preliminaries ii
Preliminaries II.
  • The untyped combinatory logics

Schönfinkel, 1924

  • The untyped lambda calculus

Church, 1934

  • Turing machines

Turing, 1936

combinatory logic i
Combinatory logic I.
  • expr ::= var

| K | S

| ( expr expr )

  • reductions

K x y  x

S x y z  x z ( y z )

  • normal form
combinatory logic ii
Combinatory logic II.
  • True K

false  K I I  S K K

  • if E F G  E F G

and E F  E F false

or E F  E true F

not E  E false true

combinatory logic iii
Combinatory logic III.
  • natural numbers

n  ( S B )n ( K I ) B E F G  E (F G)

  • succ  S B C E F G  E G F

zero  C (CI ( true false))true

  • add E F  S’ B’ E F S’CEFG  C(EG)(FG)

mul E F  B’ E F B’CEFG  CE(FG)

exp E F  F E

combinatory logic iv
Combinatory logic IV.
  • Definable functions:

partial recursive numerical function

(Kleene, 1936.)

lambda calculus i
Lambda calculus I.
  • expr ::= var

| λ var . expr

| ( expr expr )

  • reductions

(λ x . E1) E2β E1 [ x := E2 ]

λ x . Eλ y . E [ x := y]

λ x . E x E

lambda calculus ii
Lambda calculus II.
  • true λ xy.x

false  λ xy.y

  • if  λ xyz.xyz

and λ xy.xy false

or λ xy.x true y

not λ x.x false true

lambda calculus iii
Lambda calculus III.
  • natural numbers

n  λ fx . f n(x)

  • succ λ nfx . f ( nfx )

zero  λ x . x ( true false ) true

  • add λ xypq . xp ( ypq )

mul  λ xyp . x ( yp )

exp  λ xy . yx

lambda calculus iv
Lambda calculus IV.
  • Definable functions:

partial recursive numerical function

(undefinedunsolvable)

solvable: F, (λ x.E) F = I

(Kleene, 1936., Wadsworth, 1971.)

turing machine
Turing machine
  • Turing Theorem (1936.)

combinatory logics 

lambda calculus 

Turing machine

formal type system
Formal Type System
  • Formal Type System: ( S, J, R )

S syntax, J judgements, R rules

  • Type environment Γ
  • Rule

Γ |- I1 … Γ |- In

---------------------------

Γ |- I

type system f 1
Type System F1
  • type ::= basic_type

| type  type

  • expr ::= var

| λvar : type . expr

| ( expr expr )

„type checking”

(Pascal, C++, …)

rules f 1
Rules ( F1 )

Γ , x:A , Γ’ |- wf

  • ------------------------- [Val x]

Γ , x:A , Γ’ |- x:A

Γ , x:A |- E : B

  • ----------------------------- [Val Fun]

Γ |- λ:A . E : A  B

Γ |- E : A  B Γ |- F : A

  • ------------------------------------- [Val Appl]

Γ |- E F : B

theorems f 1
Theorems ( F1 )
  • Type preservation

If E : A and E ->> F then F : A .

  • Type unumbigouos

If Γ|- E : A andΓ|- E : B then A  B .

  • Finite reductions

thereisno infinite reduction sequence.

the power f 1
The power ( F1 )
  • (Schwichtenberg, 1976.)

The lambda definable functions are

exactly the extended polinomials.

  • constant functions, projections, signum

function, addition, multiplication.

type system f 1 curry
(Type System F1 / Curry)
  • type ::= type_var

| type  type

  • expr ::= var

| λvar . expr

| ( expr expr )

„type inference”

(ML, Haskell, …)

type system f 2
Type System F2
  • Id-Nat λx : Nat . x

Id-Bool λx : Bool . x

Id-Int λx : Int. x

  • Id-λx :  . x

Id  . λx :  . x polimorphic function

  • Id :  .  type ofpolimorphic function
type system f 2 ii
Type System F2 II.
  • type ::= type_var

| type  type

| type_var. type

  • expr ::= var

| var : type . expr

| ( expr expr )

|  type_var. expr

| ( expr ) [ type ]

type system f 2 iii
Type System F2 III.
  • Id [ Nat ]  (. x :  . x)[ Nat ] β

x : Nat . x : NatNat

  • Type of Id [ Nat ] ?

 .  

  • type of type-expression kind
type system f 3
Type System F3
  • *  type of types of expressions
  • kind ::= *

| (*  kind )

  • type ::= type_var

| type  type

| type_var: kind . type

| type_var: kind . type

| ( type type )

type system f 4 f 5
Type System F4,F5,...
  • F4 kind ::= *

| (*  kind )

| ( kind  *)

  • F5 kind ::= *

| (*  kind )

| ( kind  *)

| ((*  * ) kind )

type system f
Type System F
  • F =  Fi
  • kind ::= *

| ( kind  kind )

extension of type system f i
Extension of Type System, F I.
  • F (F-omega-sub)

subtyping

  • Top
  • type  Top
  • type_var type . expr
extension of type system f ii
Extension of Type System, F II.
  • Subtyping

Γ |- E : A Γ |- A  B

  • -------------------------------- [Subsumption]

Γ |- E : B

Γ |- A  BΓ |- C  D

  • ------------------------------------- [Sub Arrow]

Γ |- B  C  A  D

extension of type system f iii
Extension of Type System, F III.
  • Existential type
  • .A

pack, unpack (open)

  • Recursive type
  • .A

fold, unfold

the power of f
The power of F
  • class of functions definiable in F

is much larger than the primitive recursive

functions.

  • Ackermann’s function is definiable.
isomorphism curry feys 1956
Isomorphism (Curry, Feys 1956.)
  • Isomorphism between

combinators Hilbert’s axioms

1. x.x |- A  A

2. xy.x |- A  (B  A)

3. xyz.xz(yz) |- (A(BC))((AB)(AC))

4. function |- A  B |- A

application --------------------

|- B

the curry howard isomorphism howard 1959
The Curry-Howard isomorphism(Howard, 1959.)
  • isomorphism between

lambda calculus intuitive prop.logic

term variable assumption

term proof

type formula

type constructor connective

reduction normalization

… …

ad