Top Banner
The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@ifi.uio.no Department of informatics University of Oslo, Norway
54

The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

May 27, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML) and

Functional Programming

Daniel S. [email protected]

Department of informaticsUniversity of Oslo, Norway

Page 2: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Motivation ML Demo

Page 3: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950 dynamically typedScheme 1970

Racket 1995

ML 1973 statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 4: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950 dynamically typedScheme 1970

Racket 1995

ML 1973 statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 5: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950

dynamically typedScheme 1970

Racket 1995

ML 1973

statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 6: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950 dynamically typed

Scheme 1970

Racket 1995

ML 1973 statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 7: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950 dynamically typedScheme 1970

Racket 1995

ML 1973 statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 8: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950 dynamically typedScheme 1970

Racket 1995

ML 1973 statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 9: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950 dynamically typedScheme 1970

Racket 1995

ML 1973 statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 10: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Which programming languages are functional?

Lambda calculus 1930 (a model of computation)

Lisp 1950 dynamically typedScheme 1970

Racket 1995

ML 1973 statically typed

Standard ML or SMLCaml 1985

OCaml 1996

Haskell 1990

Erlang 1986, Scala 2004, Clojure 2007 (multi-paradigm)

Page 11: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

I in the eye of the beholder

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 12: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

I in the eye of the beholder

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 13: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

I in the eye of the beholder

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 14: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...

MapReduce

Debatable

I in the eye of the beholder

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 15: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

I in the eye of the beholder

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 16: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

I in the eye of the beholder

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 17: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

easier to reason about and to prove properties of

I in the eye of the beholder

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 18: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

easier to reason about and to prove properties of

I in the eye of the beholder

more compact, simpler code

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 19: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

◦ easier to reason about and to prove properties of

I in the eye of the beholder

more compact, simpler code

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 20: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Why another programming paradigm?

A different way of thinking

Non-functional PLs borrowing functional constructs

JavaScript, Python, Lua, PHP, C++11, C# ...MapReduce

Debatable

◦ easier to reason about and to prove properties of

I in the eye of the beholder

◦ more compact, simpler code

I problems can be easier to express given certain idiomsmatch the language to the problem

Page 21: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

[100]a

CurryingClosures

[100]a

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

[100]a

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

[100]a

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 22: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

[100]a

CurryingClosures

[100]a

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

[100]a

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

[100]a

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 23: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

[100]a

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

[100]a

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

[100]a

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 24: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

[100]a

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

[100]a

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 25: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

pattern matching

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

[100]a

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 26: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

pattern matching

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

recursion

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 27: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

pattern matching

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

recursion

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 28: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

pattern matching

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

recursion

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 29: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

pattern matching

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

recursion

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 30: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

pattern matching

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

recursion

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 31: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

What is functional programming?

It is programming with:

first-class and higher-order functions

CurryingClosures

purity

Statements versus Expressions and DeclarationsSide effects versus Effect freeImmutabilityReferential transparency

pattern matching

constructors and pattern matchingdata structures

Nat, Lists, Trees, etc

recursion

tail recursiontermination and total functionscontinuations and continuation passing style (CPS)

Page 32: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,

it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 33: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 34: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 35: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 36: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 37: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 38: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 39: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

The Meta Language (ML)

ML is a functional programming language with imperative features,it was part of project to create an interactive theorem prover.

Logic for Computable Functions (LCF)

Project headed by Robin Milner in 1972.

notation for programs

notation for proofs (eg. proof that quicksort returns a sorted array)

write programs that search for proofs

have a program that checks a proof

Page 40: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 41: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 42: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 43: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 44: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 45: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 46: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 47: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, or

diverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 48: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, or

raise an exception First language with type-safe exceptions

Page 49: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics

Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception

First language with type-safe exceptions

Page 50: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking

Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception

First language with type-safe exceptions

Page 51: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception

First language with type-safe exceptions

Page 52: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

tactic : formula → proof

Composition of tactics Higher-order functions

Take tactics as input and return a more complex tactic

Proof checking Expressive and sound type system

theorem abstract data type

theorems derivable only via inference rules given by theorem

calling tactic on a formula can either:

terminate and return a proof, ordiverge, which means run forever, orraise an exception First language with type-safe exceptions

Page 53: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Read-Evaluate-Print Loop (REPL)

In ML, expressions are type-checked after R and before E

Page 54: The Meta Language (ML) and Functional Programming · The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@i .uio.no Department of informatics University of Oslo,

Read-Evaluate-Print Loop (REPL)

In ML, expressions are type-checked after R and before E