120
HoTTEST 2019 0 Internal Parametricity and Cubical Type Theory Evan Cavallo & Robert Harper Carnegie Mellon University

Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 0

Internal Parametricity

and Cubical Type Theory

Evan Cavallo

& Robert Harper

Carnegie Mellon University

Page 2: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 1

Internal Parametricity

Bernardy & Moulin.

A Computa�onal Interpreta�on of Parametricity. 2012.

Type Theory in Color. 2013.

Bernardy, Coquand, & Moulin.

A Presheaf Model of Parametric Type Theory. 2015.

Nuyts, Vezzosi, & Devriese.

Parametric Quan�fiers for Dependent Type Theory. 2017.

C & Harper. [arXiv:1901.00489]

Parametric Cubical Type Theory. 2019.

Page 3: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 1

Internal Parametricity

Bernardy & Moulin.

A Computa�onal Interpreta�on of Parametricity. 2012.

Type Theory in Color. 2013.

Bernardy, Coquand, & Moulin.

A Presheaf Model of Parametric Type Theory. 2015.

Nuyts, Vezzosi, & Devriese.

Parametric Quan�fiers for Dependent Type Theory. 2017.

C & Harper. [arXiv:1901.00489]

Parametric Cubical Type Theory. 2019.

Page 4: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 2

THIS TALK:

What is internal parametricity,

and how does it relate to

higher-dimensional type theory?

Page 5: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 3

Parametric polymorphism, intui�vely

Parametric func�ons are “uniform” in type variables:

Page 6: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 3

Parametric polymorphism, intui�vely

Parametric func�ons are “uniform” in type variables:

Compare with “ad-hoc” polymorphism:

Page 7: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 4

Reynolds’ abstrac�on theorem (1983)

DEF: A family of (set-theore�c) func�ons is

parametric when it preserves all rela�ons.

Page 8: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 4

Reynolds’ abstrac�on theorem (1983)

DEF: A family of (set-theore�c) func�ons is

parametric when it preserves all rela�ons. e.g.,

Page 9: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 4

Reynolds’ abstrac�on theorem (1983)

DEF: A family of (set-theore�c) func�ons is

parametric when it preserves all rela�ons. e.g.,

Abstrac�on theorem: the denota�on of any term in

simply-typed λ-calculus (with ×, bool) is parametric.

Page 10: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 5

Reynolds’ abstrac�on theorem (1983)

Page 11: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 5

Reynolds’ abstrac�on theorem (1983)

Page 12: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 6

Reynolds’ abstrac�on theorem (1983)

Page 13: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 6

Reynolds’ abstrac�on theorem (1983)

Page 14: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 6

Reynolds’ abstrac�on theorem (1983)

Page 15: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 7

Reynolds’ abstrac�on theorem (1983)

Key idea: λ-calculus has a rela�onal interpreta�on.

Page 16: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 7

Reynolds’ abstrac�on theorem (1983)

Key idea: λ-calculus has a rela�onal interpreta�on.

Page 17: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 7

Reynolds’ abstrac�on theorem (1983)

Key idea: λ-calculus has a rela�onal interpreta�on.

Page 18: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 7

Reynolds’ abstrac�on theorem (1983)

Key idea: λ-calculus has a rela�onal interpreta�on.

Page 19: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 7

Reynolds’ abstrac�on theorem (1983)

Key idea: λ-calculus has a rela�onal interpreta�on.

Abstrac�on theorem extends interpreta�on to terms

Page 20: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 8

Internal Parametricity (Bernardy et al)

Can we internalize the rela�onal interpreta�on in

dependent type theory?

Page 21: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 8

Internal Parametricity (Bernardy et al)

Can we internalize the rela�onal interpreta�on in

dependent type theory?

i.e., can we give an opera�onal account of

parametricity?

Page 22: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 8

Internal Parametricity (Bernardy et al)

Can we internalize the rela�onal interpreta�on in

dependent type theory?

i.e., can we give an opera�onal account of

parametricity?

Page 23: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 8

Internal Parametricity (Bernardy et al)

Can we internalize the rela�onal interpreta�on in

dependent type theory?

i.e., can we give an opera�onal account of

parametricity?

Page 24: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 8

Internal Parametricity (Bernardy et al)

Can we internalize the rela�onal interpreta�on in

dependent type theory?

i.e., can we give an opera�onal account of

parametricity?

Page 25: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 9

An interlude: cubical type theory

Page 26: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 9

An interlude: cubical type theory

category of dimension contexts could be:

faces, degeneracies, and permuta�ons [BCH]

+ diagonals [AFH, ABCFHL]

+ connec�ons [CCHM]

Page 27: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 9

An interlude: cubical type theory

category of dimension contexts could be:

faces, degeneracies, and permuta�ons [BCH]

+ diagonals [AFH, ABCFHL]

+ connec�ons [CCHM]

respect for equality ensured by Kan opera�ons

Page 28: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 9

An interlude: cubical type theory

category of dimension contexts could be:

faces, degeneracies, and permuta�ons [BCH]

+ diagonals [AFH, ABCFHL]

+ connec�ons [CCHM]

respect for equality ensured by Kan opera�ons

univalence via G / Glue / V types

Page 29: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 10

Interlude: cubical type theory

Page 30: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 10

Interlude: cubical type theory

Page 31: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 10

Interlude: cubical type theory

Page 32: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 10

Interlude: cubical type theory

Page 33: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 10

Interlude: cubical type theory

Can we do the same for rela�ons?

Page 34: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 11

Internal Parametricity (Bernardy et al)

Context of bridge variables (colors)

Page 35: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 11

Internal Parametricity (Bernardy et al)

Context of bridge variables (colors)

Faces, degeneracies, and permuta�ons [BCH]

Page 36: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 11

Internal Parametricity (Bernardy et al)

Context of bridge variables (colors)

Faces, degeneracies, and permuta�ons [BCH]

Faces:

Page 37: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 11

Internal Parametricity (Bernardy et al)

Context of bridge variables (colors)

Faces, degeneracies, and permuta�ons [BCH]

Faces:

Degeneracies:

Page 38: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 11

Internal Parametricity (Bernardy et al)

Context of bridge variables (colors)

Faces, degeneracies, and permuta�ons [BCH]

Faces:

Degeneracies:

Permuta�ons:

Page 39: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 12

Bridge types

Page 40: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 12

Bridge types

Page 41: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 12

Bridge types

Page 42: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 12

Bridge types

etc.

Page 43: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 13

Bridges in func�on types

Page 44: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 13

Bridges in func�on types

In cartesian cubical type theories:

Page 45: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 13

Bridges in func�on types

In cartesian cubical type theories:

In BCH, this violates freshness requirements!

Page 46: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 13

Bridges in func�on types

In cartesian cubical type theories:

In BCH, this violates freshness requirements!

Rela�onal interpreta�on of func�on types:

Page 47: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 13

Bridges in func�on types

In cartesian cubical type theories:

In BCH, this violates freshness requirements!

Rela�onal interpreta�on of func�on types:

equivalent in the presence of J

Page 48: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 14

Bridges in func�on types

Page 49: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 14

Bridges in func�on types

Forward:

Page 50: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 14

Bridges in func�on types

Forward:

Backward:

Page 51: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 14

Bridges in func�on types

Forward:

Backward:Backward:

Page 52: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 14

Bridges in func�on types

Forward:

Backward:Backward:

Page 53: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 14

Bridges in func�on types

Forward:

Backward:Backward:

“case analysis for dimension terms”

Page 54: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 15

Bridges in func�on types

Stability of capture under subs�tu�on relies on

absence of diagonals:

Page 55: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 15

Bridges in func�on types

Stability of capture under subs�tu�on relies on

absence of diagonals:

Page 56: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 15

Bridges in func�on types

Stability of capture under subs�tu�on relies on

absence of diagonals:

Page 57: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 15

Bridges in func�on types

Stability of capture under subs�tu�on relies on

absence of diagonals:

Page 58: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 15

Bridges in func�on types

Stability of capture under subs�tu�on relies on

absence of diagonals:

Page 59: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 15

Bridges in func�on types

Stability of capture under subs�tu�on relies on

absence of diagonals:

Page 60: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 16

Bridges in the universe (“rela�vity”)

Want:

Page 61: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 16

Bridges in the universe (“rela�vity”)

Want:

Forward:

Page 62: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 16

Bridges in the universe (“rela�vity”)

Want:

Forward:

Backward:

Page 63: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 16

Bridges in the universe (“rela�vity”)

Want:

Forward:

Backward:

BCH G-types for rela�ons

Page 64: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

Page 65: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

cartesian (Glue/V)

Page 66: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

cartesian (Glue/V)

Page 67: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

cartesian (Glue/V)

Page 68: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

cartesian (Glue/V)

Page 69: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

cartesian (Glue/V) substructural (Gel)

Page 70: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

cartesian (Glue/V) substructural (Gel)

Page 71: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 17

Bridges in the universe (“rela�vity”)

cartesian (Glue/V) substructural (Gel)

Page 72: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 18

Want:

Bridges in the universe (“rela�vity”)

Page 73: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 18

Want:

Bridges in the universe (“rela�vity”)

Bernardy, Coquand, & Moulin: add equali�es

Page 74: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 18

Want:

Bridges in the universe (“rela�vity”)

Bernardy, Coquand, & Moulin: add equali�es

Validated by interpreta�on in refined presheaves

Page 75: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 18

Want:

Bridges in the universe (“rela�vity”)

Bernardy, Coquand, & Moulin: add equali�es

Validated by interpreta�on in refined presheaves

Alterna�ve: use univalence?

Page 76: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 19

Parametric cubical type theory (C & Harper)

Page 77: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 19

Parametric cubical type theory (C & Harper)

Structural variables for paths,

substructural variables for bridges

Page 78: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 19

Parametric cubical type theory (C & Harper)

Structural variables for paths,

substructural variables for bridges

Extend Kan opera�ons to make Bridge types Kan

Page 79: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 19

Parametric cubical type theory (C & Harper)

Structural variables for paths,

substructural variables for bridges

Extend Kan opera�ons to make Bridge types Kan

w/ computa�onal seman�cs

Page 80: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 20

Parametric cubical type theory (C & Harper)

Page 81: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 20

Parametric cubical type theory (C & Harper)

Page 82: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 20

Parametric cubical type theory (C & Harper)

Page 83: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 20

Parametric cubical type theory (C & Harper)

Page 84: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 20

Parametric cubical type theory (C & Harper)

(and the other inverse condi�on)

Page 85: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 21

Examples: Church booleans

What can we say about ?

Page 86: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 21

Examples: Church booleans

What can we say about ?

Given define a rela�on.

Page 87: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 21

Examples: Church booleans

What can we say about ?

Given define a rela�on.

Apply at the Gel type for in a fresh .

Page 88: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 21

Examples: Church booleans

What can we say about ?

Given define a rela�on.

Apply at the Gel type for in a fresh .

Page 89: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 21

Examples: Church booleans

What can we say about ?

Given define a rela�on.

Apply at the Gel type for in a fresh .

Extract a witness.

Page 90: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 22

Examples: actual booleans

What are the bridges in ?

Page 91: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 22

Examples: actual booleans

What are the bridges in ?

Define the Gel type corresponding to paths in .

Page 92: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 22

Examples: actual booleans

What are the bridges in ?

Define the Gel type corresponding to paths in .

Map from to by case analysis

Page 93: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 22

Examples: actual booleans

What are the bridges in ?

Define the Gel type corresponding to paths in .

Map from to by case analysisMap from to by case analysis

Page 94: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 22

Examples: actual booleans

What are the bridges in ?

Define the Gel type corresponding to paths in .

Map from to by case analysisMap from to by case analysis

Page 95: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 22

Examples: actual booleans

What are the bridges in ?

Define the Gel type corresponding to paths in .

Map from to by case analysisMap from to by case analysis

Prove this is an equivalence! (iterated parametricity)

Page 96: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 23

Examples: bridge-discrete types

We always have a map from (homogeneous) paths to

bridges

Page 97: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 23

Examples: bridge-discrete types

We always have a map from (homogeneous) paths to

bridges

is bridge-discrete when this is an equivalence

Page 98: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 23

Examples: bridge-discrete types

We always have a map from (homogeneous) paths to

bridges

is bridge-discrete when this is an equivalence

Plays the role of the iden�ty extension lemma

Page 99: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 23

Examples: bridge-discrete types

We always have a map from (homogeneous) paths to

bridges

is bridge-discrete when this is an equivalence

Plays the role of the iden�ty extension lemma

e.g., any func�on from to a bridge-discrete type is

constant

Page 100: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 23

Examples: bridge-discrete types

We always have a map from (homogeneous) paths to

bridges

is bridge-discrete when this is an equivalence

Plays the role of the iden�ty extension lemma

e.g., any func�on from to a bridge-discrete type is

constant

The sub-universe of bridge-discrete types is closed

under all type formers except , including

Page 101: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 23

Examples: bridge-discrete types

We always have a map from (homogeneous) paths to

bridges

is bridge-discrete when this is an equivalence

Plays the role of the iden�ty extension lemma

e.g., any func�on from to a bridge-discrete type is

constant

The sub-universe of bridge-discrete types is closed

under all type formers except , including

THM: is rela�vis�c

Page 102: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 24

Examples: excluded middle

Page 103: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 24

Examples: excluded middle

Consider the weak excluded middle:

Page 104: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 24

Examples: excluded middle

Consider the weak excluded middle:

Page 105: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 24

Examples: excluded middle

Consider the weak excluded middle:

Any func�on must be constant,

because is bridge-discrete.

Page 106: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 24

Examples: excluded middle

Consider the weak excluded middle:

Any func�on must be constant,

because is bridge-discrete.

Thus, .

Page 107: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 24

Examples: excluded middle

Consider the weak excluded middle:

Any func�on must be constant,

because is bridge-discrete.

Thus, .

Corollary: , where

Page 108: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 24

Examples: excluded middle

Consider the weak excluded middle:

Any func�on must be constant,

because is bridge-discrete.

Thus, .

Corollary: , where

(see also: Booij, Escardó, Lumsdaine, & Shulman,

Parametricity, automorphisms of the universe, and excluded middle)

Page 109: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 25

Examples: suspension

Page 110: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 25

Examples: suspension

What are the terms ?

Page 111: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 25

Examples: suspension

What are the terms ?

Completely determined by .

Page 112: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 25

Examples: suspension

What are the terms ?

Completely determined by .

Key Lemma:

Page 113: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 25

Examples: suspension

What are the terms ?

Completely determined by .

Key Lemma:

(case of graph lemma in ordinary parametricity)

Page 114: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 26

Future work

Page 115: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 26

Future work

Connec�on to ordinary cubical type theory

Page 116: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 26

Future work

Connec�on to ordinary cubical type theory

Seman�c: for in cubical type theory

without func�on types, a proof with bridges

gives an element in cubical sets, +??

-

Page 117: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 26

Future work

Connec�on to ordinary cubical type theory

Seman�c: for in cubical type theory

without func�on types, a proof with bridges

gives an element in cubical sets, +??

-

- Syntac�c?

Page 118: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 26

Future work

Connec�on to ordinary cubical type theory

Seman�c: for in cubical type theory

without func�on types, a proof with bridges

gives an element in cubical sets, +??

-

- Syntac�c?

Proving algebraic proper�es of HITs

Page 119: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 26

Future work

Connec�on to ordinary cubical type theory

Seman�c: for in cubical type theory

without func�on types, a proof with bridges

gives an element in cubical sets, +??

-

- Syntac�c?

Proving algebraic proper�es of HITs

?

e.g., what are the terms of type

Page 120: Internal Parametricity and Cubical Type Theory€¦ · HoTTEST 2019 23 Examples: bridge-discrete types We always have a map from (homogeneous) paths to bridges is bridge-discrete

HoTTEST 2019 26

Future work

Connec�on to ordinary cubical type theory

Seman�c: for in cubical type theory

without func�on types, a proof with bridges

gives an element in cubical sets, +??

-

- Syntac�c?

Proving algebraic proper�es of HITs

?

e.g., what are the terms of type

conjecture: must be constant or iden�ty

Use to prove pentagon, hexagon, etc