Adventures in Impredicative Semantics Programming and Proving in - - PowerPoint PPT Presentation

adventures in impredicative semantics
SMART_READER_LITE
LIVE PREVIEW

Adventures in Impredicative Semantics Programming and Proving in - - PowerPoint PPT Presentation

Adventures in Impredicative Semantics Programming and Proving in Cedille Aaron Stump Computer Science The University of Iowa 1 / 23 ? Motivation and background for Cedille 2 / 23 A little history 3 / 23 System F (Girard, Reynolds, early


slide-1
SLIDE 1

Adventures in Impredicative Semantics

Programming and Proving in Cedille Aaron Stump

Computer Science The University of Iowa

1 / 23

slide-2
SLIDE 2

?

Motivation and background for Cedille

2 / 23

slide-3
SLIDE 3

A little history

3 / 23

slide-4
SLIDE 4

System F (Girard, Reynolds, early 1970s)

1969 Mercury Cyclone Spoiler II

slide-5
SLIDE 5

System F (Girard, Reynolds, early 1970s)

1969 Mercury Cyclone Spoiler II

▷ ∀ X ∶ ⋆. T ▷ Raw power (impredicativity!) ▷ A little crude (no Curry-Howard)

4 / 23

slide-6
SLIDE 6

Calculus of Constructions (Coquand, Huet 1988)

1988 Chevrolet Camaro

slide-7
SLIDE 7

Calculus of Constructions (Coquand, Huet 1988)

1988 Chevrolet Camaro

▷ Add dependent types: Π x ∶ T. T ′ ▷ Imported from Automath/Martin-L¨

  • f type theory

▷ Curry-Howard! ▷ No induction. [Geuvers 2001]

5 / 23

slide-8
SLIDE 8

Calculus of Inductive Constructions (Werner 1994)

1992 Hoffman-Markley Streamliner

slide-9
SLIDE 9

Calculus of Inductive Constructions (Werner 1994)

1992 Hoffman-Markley Streamliner

▷ Add primitive inductive types ▷ Finally ready for constructive mathematics! ▷ Basis for Coq

6 / 23

slide-10
SLIDE 10

But Coq ≠ CIC

▷ Coinductive types ▷ Universe hierarchy (Extended CC, Luo 1990) ▷ Proof-irrelevant universe Prop ▷ And we might want more:

▸ definitional proof irrelevance ▸ inductive-inductive types ▸ inductive-recursive types

Similarly, Agda ≠ MLTT.

7 / 23

slide-11
SLIDE 11

Issues and limitations, Coq and Agda

▷ No formal semantics/correctness proof

▸ Despite a lot of interest: TT in TT

▷ (Hence!) bugs and surprises

▷ incompatibilities with various axioms ▷ actual contradictions! ▷ type soundness broken in Coq

▷ Commitment to a set of datatypes

▷ theory of datatypes not finished... ▷ e.g., higher-order abstract syntax prohibited

8 / 23

slide-12
SLIDE 12

Have we created a monster?

Schaufelradbagger 258

9 / 23

slide-13
SLIDE 13

If I could turn back time...

Good-bye to: ▷ primitive datatypes ▷ (also universe hierarchy, my bias) Hello to ▷ lambda-encodings of data

10 / 23

slide-14
SLIDE 14

If I could turn back time...

Good-bye to: ▷ primitive datatypes ▷ (also universe hierarchy, my bias) Hello to ▷ lambda-encodings of data

10 / 23

slide-15
SLIDE 15

Wanted : a new type theory

where ▷ inductive datatypes are derived (lambda-encoded) ▷ impredicativity is central ▷ core theory is small and verifiable Tooling goals: ▷ see all typing/inference information ▷ predictable inference ▷ elaborate to core with independent checker

11 / 23

slide-16
SLIDE 16

Cedille

CC

∀ x ∶ T. T ′ implicit products (Miquel) ι x ∶ T. T ′ dependent intersections (Kopylov) { t ≃ t′} untyped equality ▷ Small theory, formal syntax and semantics ▷ Core checker implemented in < 1000loc Haskell ▷ Logically sound ▷ Turing complete(!) ▷ Supports inductive lambda-encodings

12 / 23

slide-17
SLIDE 17

Back the truck up

13 / 23

slide-18
SLIDE 18

Back the truck up Did you say lambda encodings?

13 / 23

slide-19
SLIDE 19

Not your forebear’s lambda encodings

▷ Usual rap: inefficient accessors ▷ Corrected by Parigot 1988 for typed encoding ▷ Perfect untyped encoding B¨

  • hm et al. 1994

▸ linear space ▸ constant-time accessors ▸ intrinsic support for iteration

▷ Cedille: perfect inductive (typed) encodings

14 / 23

slide-20
SLIDE 20

How are inductive datatypes defined?

▷ Several variations (CPP ’18, ITP ’18), one theme: The type of d expresses an induction principle for d ▷ For Nat: n ∶ ∀ P ∶ Nat → ⋆. (∀ x ∶ Nat. P x → P (S x)) → P Z → P n ▷ Essentially due to Leivant 1983 ▷ With D. Firsov, generic derivations for classes of F ∶ ⋆ → ⋆

15 / 23

slide-21
SLIDE 21

What do we get from this?

slide-22
SLIDE 22

What do we get from this? Freedom

slide-23
SLIDE 23

What do we get from this? Freedom

▷ No pre-set datatype class ▷ Explore semantics of advanced datatypes ▷ Power of impredicativity ▷ So far: Functorial, Monotone, IR, II

16 / 23

slide-24
SLIDE 24

So which car are we?

17 / 23

slide-25
SLIDE 25

So which car are we?

slide-26
SLIDE 26

So which car are we?

High-altitude type-theory exploration

17 / 23

slide-27
SLIDE 27

Terrestrially: Cedille 1.1

▷ Datatype notations convenient! ▷ Cedille 1.1 adds them ▷ With elaboration to Cedille Core ▷ Histomorphic recursion

▸ subsumes nested patterns ▸ can iteratively match on pattern variable x, ▸ and then make a recursive call ▸ division (iteratively take predecessor) 18 / 23

slide-28
SLIDE 28

Architecture of Cedille

Emacs mode Backend

.ced files .cdle files Cedillecore Ok Error

19 / 23

slide-29
SLIDE 29

20 / 23

slide-30
SLIDE 30

21 / 23

slide-31
SLIDE 31

22 / 23

slide-32
SLIDE 32

23 / 23