Super advanced functional programming Or: dependently-typed - - PowerPoint PPT Presentation

super advanced functional programming
SMART_READER_LITE
LIVE PREVIEW

Super advanced functional programming Or: dependently-typed - - PowerPoint PPT Presentation

Super advanced functional programming Or: dependently-typed programming in Agda Dr. Dominic Mulligan Programming, Logic, and Semantics Group, University of Cambridge Part III, Advanced Functional Programming, March 2017 1 System F Very


slide-1
SLIDE 1

Super advanced functional programming

Or: dependently-typed programming in Agda

  • Dr. Dominic Mulligan

Programming, Logic, and Semantics Group, University of Cambridge

Part III, Advanced Functional Programming, March 2017

1

slide-2
SLIDE 2

System Fω

Very expressive type theory:

  • Used as a compiler intermediate language (e.g. GHC)
  • Can embed almost all useful (co)datatypes within it
  • Can express common programming abstractions with

higher-kinds

2

slide-3
SLIDE 3

System Fω

Very expressive type theory:

  • Used as a compiler intermediate language (e.g. GHC)
  • Can embed almost all useful (co)datatypes within it
  • Can express common programming abstractions with

higher-kinds But:

  • The monadic abstraction has associated laws
  • Must be checked by hand, on pen-and-paper

2

slide-4
SLIDE 4

Internalising reasoning about programs

How can we internalise this checking of laws?

3

slide-5
SLIDE 5

Internalising reasoning about programs

How can we internalise this checking of laws? Requires an embedded higher-order logic Requires types that depend on terms: ∀x : N. x + 0 = x is a type, and its inhabitants are proofs

3

slide-6
SLIDE 6

Internalising reasoning about programs

How can we internalise this checking of laws? Requires an embedded higher-order logic Requires types that depend on terms: ∀x : N. x + 0 = x is a type, and its inhabitants are proofs Moved from left plane to right plane of λ-cube

3

slide-7
SLIDE 7

What’s the advantage?

Agda can be seen as both a programming language and a proof checker

4

slide-8
SLIDE 8

What’s the advantage?

Agda can be seen as both a programming language and a proof checker Agda:

  • Allows us to encode very powerful invariants in types that

guarantee program correctness

  • Acts as a foundation for mathematics, based not on sets, but
  • n functions and types

4

slide-9
SLIDE 9

Rest of this lecture: an interactive introduction to Agda...

5