Internal Parametricity for Cubical Type Theory Evan Cavallo Robert - - PowerPoint PPT Presentation

internal parametricity for cubical type theory
SMART_READER_LITE
LIVE PREVIEW

Internal Parametricity for Cubical Type Theory Evan Cavallo Robert - - PowerPoint PPT Presentation

Internal Parametricity for Cubical Type Theory Evan Cavallo Robert Harper Carnegie Mellon University CSL 2020 JAN 16 0 Mar n-Lf type theory Mar n-Lf 82: judgments explained by as speci fi ca ons on untyped programs ( A ,


slide-1
SLIDE 1

CSL 2020 · JAN 16

Internal Parametricity for Cubical Type Theory

Evan Cavallo Robert Harper

Carnegie Mellon University

slide-2
SLIDE 2

CSL 2020 · JAN 16 1

Marn-Löf type theory

Marn-Löf ’82: judgments explained by as specificaons on untyped programs (A, B, M, N) follow work of Angiuli, Favonia, & Harper ’18 on computaonal cubical type theory e.g. “M ∈ nat” is “M computes a natural number”

slide-3
SLIDE 3

CSL 2020 · JAN 16 2

Cubical type theories

coercion operaon ensures everything respects paths univalence: type paths are equivalences

slide-4
SLIDE 4

CSL 2020 · JAN 16 3

intervals might be given by:

De Morgan cubes

Cohen, Coquand, Huber, & Mörtberg 2015

Cartesian cubes

Angiuli, Favonia, & Harper 2018 Angiuli, Brunerie, Coquand, Favonia, Licata, & Harper 2018

structural

Substructural cubes

Bezem, Coquand, & Huber 2013&2017

no contracon (diagonals)

Cubical type theories

slide-5
SLIDE 5

CSL 2020 · JAN 16 4

Cartesian cubical type theory

slide-6
SLIDE 6

CSL 2020 · JAN 16 4

Cartesian cubical type theory

slide-7
SLIDE 7

CSL 2020 · JAN 16 5

Higher inducve types

combine inducve definions and quoents

slide-8
SLIDE 8

CSL 2020 · JAN 16 6

Higher inducve types

define higher-dimensional objects (synthec homotopy theory)

slide-9
SLIDE 9

CSL 2020 · JAN 16 7

Higher inducve types

when combined, require >1-d reasoning e.g., smash product (HoTT Book §6.8)

slide-10
SLIDE 10

CSL 2020 · JAN 16 7

Higher inducve types

when combined, require >1-d reasoning e.g., smash product (HoTT Book §6.8)

associave?

slide-11
SLIDE 11

CSL 2020 · JAN 16 7

Higher inducve types

when combined, require >1-d reasoning e.g., smash product (HoTT Book §6.8)

associave?

2-d

slide-12
SLIDE 12

CSL 2020 · JAN 16 7

Higher inducve types

when combined, require >1-d reasoning e.g., smash product (HoTT Book §6.8)

associave?

2-d

is the associator an isomorphism? 3-d

slide-13
SLIDE 13

CSL 2020 · JAN 16 7

Higher inducve types

when combined, require >1-d reasoning e.g., smash product (HoTT Book §6.8)

associave?

2-d

is the associator an isomorphism? 3-d

Mac Lane's pentagon? 4-d

slide-14
SLIDE 14

CSL 2020 · JAN 16 7

Higher inducve types

when combined, require >1-d reasoning e.g., smash product (HoTT Book §6.8)

associave?

2-d

is the associator an isomorphism? 3-d

Mac Lane's pentagon? 4-d

(van Doorn 2018, Brunerie 2018)

slide-15
SLIDE 15

CSL 2020 · JAN 16 7

Higher inducve types

when combined, require >1-d reasoning e.g., smash product (HoTT Book §6.8)

associave?

2-d

is the associator an isomorphism? 3-d

Mac Lane's pentagon? 4-d

(van Doorn 2018, Brunerie 2018)

can we avoid this complexity?

slide-16
SLIDE 16

CSL 2020 · JAN 16 8

Parametricity

“Parametric” funcons are uniform in type variables: Contrast with “ad-hoc” polymorphic funcons:

Restrict ourselves to write only parametric funcons Parametric funcons sasfy many properes “automacally”

slide-17
SLIDE 17

CSL 2020 · JAN 16 9

Reynolds’ abstracon theorem (’83)

Def: A family of (set-theorec) funcons is parametric when it acts on relaons. e.g., Abstracon theorem: the denotaon of any term in simply-typed λ-calculus (with ×, bool) is parametric. Key idea: λ-calculus has a relaonal interpretaon.

slide-18
SLIDE 18

CSL 2020 · JAN 16 10

Reynolds’ abstracon theorem (’83)

Def: A family of (set-theorec) funcons is parametric when it acts on relaons. e.g., “theorems for free” (Wadler ’89)

slide-19
SLIDE 19

CSL 2020 · JAN 16 11

Make relaonal interp. visible inside type theory

Internal parametricity (Bernardy & Moulin ’12)

slide-20
SLIDE 20

CSL 2020 · JAN 16 11

Make relaonal interp. visible inside type theory

Internal parametricity (Bernardy & Moulin ’12)

cubical type theory parametric type theory construcons act on isomorphisms construcons act on relaons equal over iso x.A related by rel x.A univalence: relavity:

slide-21
SLIDE 21

CSL 2020 · JAN 16 12

Parametric Cubical Type Theory

bridge dimensions path dimensions structural substructural

slide-22
SLIDE 22

CSL 2020 · JAN 16 12

Parametric Cubical Type Theory

bridge dimensions path dimensions structural substructural

Use parametricity to prove results about HITs Use good properes of cubical type theory to get beer results from / simplify internal parametricity Compare and contrast internal parametricity and cubical type theory

slide-23
SLIDE 23

CSL 2020 · JAN 16 13

Parametric Cubical Type Theory

slide-24
SLIDE 24

CSL 2020 · JAN 16 13

Parametric Cubical Type Theory

slide-25
SLIDE 25

CSL 2020 · JAN 16 13

Parametric Cubical Type Theory

slide-26
SLIDE 26

CSL 2020 · JAN 16 13

Parametric Cubical Type Theory

slide-27
SLIDE 27

CSL 2020 · JAN 16 13

Parametric Cubical Type Theory

slide-28
SLIDE 28

CSL 2020 · JAN 16 14

Internal parametricity: affine dimensions

slide-29
SLIDE 29

CSL 2020 · JAN 16 14

Internal parametricity: affine dimensions

slide-30
SLIDE 30

CSL 2020 · JAN 16 14

Internal parametricity: affine dimensions

slide-31
SLIDE 31

CSL 2020 · JAN 16 15

Internal parametricity: Bridge-types

slide-32
SLIDE 32

CSL 2020 · JAN 16 16

Internal parametricity: “relavity”

Forward: Backward:

▰ Parallels structural Glue/V

slide-33
SLIDE 33

CSL 2020 · JAN 16 17

Internal parametricity: funcon types

paths: funcon extensionality bridges: relaonal interpretaon (difference invisible for paths because of coercion)

slide-34
SLIDE 34

CSL 2020 · JAN 16 18

Internal parametricity: funcon types

Forward: Backward:

slide-35
SLIDE 35

CSL 2020 · JAN 16 18

Internal parametricity: funcon types

Forward: Backward:

slide-36
SLIDE 36

CSL 2020 · JAN 16 18

Internal parametricity: funcon types

Forward: Backward:

“case analysis for interval terms”

slide-37
SLIDE 37

CSL 2020 · JAN 16 19

Internal parametricity: funcon types

Stability of abstracon under substuon relies on absence of diagonals:

slide-38
SLIDE 38

CSL 2020 · JAN 16 19

Internal parametricity: funcon types

Stability of abstracon under substuon relies on absence of diagonals:

slide-39
SLIDE 39

CSL 2020 · JAN 16 19

Internal parametricity: funcon types

Stability of abstracon under substuon relies on absence of diagonals:

slide-40
SLIDE 40

CSL 2020 · JAN 16 19

Internal parametricity: funcon types

Stability of abstracon under substuon relies on absence of diagonals:

slide-41
SLIDE 41

CSL 2020 · JAN 16 20

Cubical equality for internal parametricity

Funcon extensionality & univalence

▰ ▰ ▰

slide-42
SLIDE 42

CSL 2020 · JAN 16 21

Internal parametricity for cubical equality

Movang example: smash product

In the paper: any map

is constant or the polymorphic identy. Implies any non-constant map

is an isomorphism. Key: scales to characterize maps

slide-43
SLIDE 43

CSL 2020 · JAN 16 22

Conclusions

Combine internal parametricity & cubical type theory

Parametricity is especially useful for cubical type theory because it contains inducve types with complex algebraic properes

As with ordinary type theory, using cubical equality smooths rough edges

▰ Push internal parametricity further

Bridge-discrete types for identy extension lemma

▰ Theories with interval variables

When are different kinds of intervals appropriate?