A Fibrational Framework for Substructural and Modal Logics€¦ · 4 Intuitionistic substructural...

Post on 25-Sep-2020

3 views 0 download

Transcript of A Fibrational Framework for Substructural and Modal Logics€¦ · 4 Intuitionistic substructural...

A Fibrational Framework for Substructural and Modal Logics

Dan Licata Wesleyan University

Michael ShulmanUniversity of San Diego

1

Mitchell RileyWesleyan University

2

Substructural Logic

Γ,x:A ⊢ BΓ ⊢ B

Γ,x:A,y:B ⊢ CΓ,y:B,x:A ⊢ B

Γ,x:A,y:A ⊢ BΓ,x:A ⊢ B

Weakening

Exchange

Contraction

Modal Logic

Γ ⊢ ☐A

∅ ⊢ A

♢A ⊢ ♢C

A ⊢ ♢C

Modal Logic

Γ ⊢ ☐A

∅ ⊢ A

♢A ⊢ ♢C

A ⊢ ♢C

(♢A) × B vs. ♢(A × B)

4

Intuitionistic substructural and modal logics/type systems

Linear/affine: use once (state, sessions)Relevant: strictness annotationsOrdered: linguisticsBunched: separation logic Comonads: staging, metavariables, coeffectsMonads: effectsInteractions between products and modalities

5

Homotopy type theory

highercategory theory homotopy theory

dependent type theory

6

Cohesive HoTT

♭∫ #⊣ ⊣

Dependent type theory with modalities ∫A, ♭A, #A

[Shulman,Schreiber]

6

Cohesive HoTT

♭∫ #⊣ ⊣

Dependent type theory with modalities ∫A, ♭A, #A

[Shulman,Schreiber]

♭A ⊢ B A ⊢ # B

6

Cohesive HoTT

♭∫ #⊣ ⊣

Dependent type theory with modalities ∫A, ♭A, #A

[Shulman,Schreiber]

monad ♢

♭A ⊢ B A ⊢ # B

6

Cohesive HoTT

♭∫ #⊣ ⊣

Dependent type theory with modalities ∫A, ♭A, #A

[Shulman,Schreiber]

monad ♢

comonad ☐

♭A ⊢ B A ⊢ # B

6

Cohesive HoTT

♭∫ #⊣ ⊣

Dependent type theory with modalities ∫A, ♭A, #A

[Shulman,Schreiber]

monad ♢

comonad ☐

monad

♭A ⊢ B A ⊢ # B

6

Cohesive HoTT

♭∫ #⊣ ⊣

Dependent type theory with modalities ∫A, ♭A, #A

[Shulman,Schreiber]

monad ♢

comonad ☐

monad(idempotent)♭♭ A ≅ ♭ A

♭A ⊢ B A ⊢ # B

7

𝕊-Cohesion

♮ ♮⊣

comonad monad

[Finster,L.,Morehouse,Riley]

7

𝕊-Cohesion

♮ ♮⊣

comonad monad

A ⊢♮A ⊢ A

[Finster,L.,Morehouse,Riley]

7

𝕊-Cohesion

♮ ♮⊣

comonad monad

A ⊢♮A ⊢ A

[Finster,L.,Morehouse,Riley]

♮(A ⋀ B) ≅ ♮A ×♮B

8

Differential Cohesion[Schreiber; Gross,L.,New,Paykin,Riley,Shulman,Wellen]

♭∫ #⊣ ⊣

8

Differential Cohesion[Schreiber; Gross,L.,New,Paykin,Riley,Shulman,Wellen]

♭∫ #⊣ ⊣

𝖩R &⊣ ⊣

8

Differential Cohesion[Schreiber; Gross,L.,New,Paykin,Riley,Shulman,Wellen]

♭∫ #⊣ ⊣

𝖩R &⊣ ⊣

HoTT/UF Saturday!

9

What are the common patterns in substructural and modal logics?

S4 ☐

Γ ; Δ ⊢☐A Γ; Δ,☐A ⊢ C

Γ,A ; Δ,☐A ⊢ CΓ ; ⋅ ⊢ A

Γ,A; Δ ⊢ CΓ,A; Δ,A ⊢ C

Γ; Δ ⊢ C

S4 ☐

Γ ; Δ ⊢☐A Γ; Δ,☐A ⊢ C

Γ,A ; Δ,☐A ⊢ CΓ ; ⋅ ⊢ A

Γ,A; Δ ⊢ CΓ,A; Δ,A ⊢ C

morally ☐Γ× Δ → CΓ; Δ ⊢ C

S4 ☐

Γ ; Δ ⊢☐A Γ; Δ,☐A ⊢ C

Γ,A ; Δ,☐A ⊢ CΓ ; ⋅ ⊢ A

Γ,A; Δ ⊢ CΓ,A; Δ,A ⊢ C

context is all boxed formulae (up to weakening)

morally ☐Γ× Δ → CΓ; Δ ⊢ C

S4 ☐

Γ ; Δ ⊢☐A Γ; Δ,☐A ⊢ C

Γ,A ; Δ,☐A ⊢ CΓ ; ⋅ ⊢ A

Γ,A; Δ ⊢ CΓ,A; Δ,A ⊢ C

context is all boxed formulae (up to weakening)

morally ☐Γ× Δ → CΓ; Δ ⊢ C

because ☐A → A

Γ ; ⋅ ⊢ ! A Γ; Δ,!A ⊢ C

Γ,A ; Δ ⊢ CΓ ; ⋅ ⊢ A

Γ,A; Δ ⊢ CΓ,A; Δ,A ⊢ C

Linear Logic !

context is all !’ed formulae (no weakening)

cartesian/structural

linear

Linear Logic ⊗

Γ,Δ ⊢ A ⊗ BΓ ⊢ A Δ ⊢ B

Γ,A⊗B ⊢ CΓ,A,B ⊢ C

Linear Logic ⊗

Γ,Δ ⊢ A ⊗ BΓ ⊢ A Δ ⊢ B

Γ,A⊗B ⊢ CΓ,A,B ⊢ C

context “is” a ⊗

Linear Logic ⊗

Γ,Δ ⊢ A ⊗ BΓ ⊢ A Δ ⊢ B

Γ,A⊗B ⊢ CΓ,A,B ⊢ C

context “is” a ⊗

Γ0 ⊢ A ⊗ BΓ ⊢ A Δ ⊢ BΓ0 ≡ Γ, Δ

context is a ⊗, up to some structural rules

Types inherit properties

A,B ⊢ B ⊗ AA ⊢ AB ⊢ BA,B ≡ B,A

A⊗B ⊢ B ⊗ A

14

Types inherit properties

⋅ ; ! A ⊗ ! B ⊢ ! (A ⊗ B)⋅; ! A, ! B ⊢ ! (A ⊗ B)

A ; ! B ⊢ ! (A ⊗ B)A,B ; ⋅ ⊢ ! (A ⊗ B)A,B; ⋅ ⊢ A ⊗ B

15

Pattern for ☐ ! ⊗

Operation on contexts, with explicit or admissible structural properties

Type constructor that “internalizes” the context operation, inherits the structural properties

16

This paper

Products and left-adjoints (⊗,F) all one connectiveNegatives and right adjoints (⊸,U) anotherCut elimination for all instances at onceEquational theory: differ by structural rulesCategorical semantics

A framework that abstracts the common aspects of many intuitionistic

substructural and modal logics

17

ExamplesNon-assoc, ordered, linear, affine, relevant, cartesian, bunched products and implicationsN-linear variables [Reed,Abel,McBride]Monoidal, lax, non- left adjointsNon-strong, strong, ☐-strong monadsCohesion

17

ExamplesNon-assoc, ordered, linear, affine, relevant, cartesian, bunched products and implicationsN-linear variables [Reed,Abel,McBride]Monoidal, lax, non- left adjointsNon-strong, strong, ☐-strong monadsCohesion

Logical adequacy: sequent is provable iff its encoding is

18

Closely Related Work

18

Closely Related WorkDisplay logic, Lambek calculus, resource semantics

18

Closely Related WorkDisplay logic, Lambek calculus, resource semanticsAdjoint linear logic [Benton&Wadler,95]

18

Closely Related WorkDisplay logic, Lambek calculus, resource semanticsAdjoint linear logic [Benton&Wadler,95]

cartesian

linear

F U⊣

18

Closely Related WorkDisplay logic, Lambek calculus, resource semanticsAdjoint linear logic [Benton&Wadler,95]

cartesian

linear

F U⊣A ::= F C | A ⊗ B | …C ::= U A | C × D | …

18

Closely Related WorkDisplay logic, Lambek calculus, resource semanticsAdjoint linear logic [Benton&Wadler,95]

cartesian

linear

F U⊣

!A := FU A

A ::= F C | A ⊗ B | …C ::= U A | C × D | …

18

Closely Related WorkDisplay logic, Lambek calculus, resource semanticsAdjoint linear logic [Benton&Wadler,95]

λ-calculus for Resource Separation [Atkey,2004] Adjoint logic [Reed,2009]

cartesian

linear

F U⊣

!A := FU A

A ::= F C | A ⊗ B | …C ::= U A | C × D | …

19

Technique

Γ ⊢α A

ψ ⊢ α : p

Sequent

Context descriptor

A substructural/modal typing judgement is an ordinary structural judgement, annotated with a term that

describes the tree structure of the context

20

Sequent Calculus

21

Mode Theory

x1:p1, … , xn:pn ⊢ α : q

α ⇒ β

p,q,… Modes

Context Descriptors

Structural Properties

21

Mode Theory

Types p,q are “modes” of types/contexts

x1:p1, … , xn:pn ⊢ α : q

α ⇒ β

p,q,… Modes

Context Descriptors

Structural Properties

21

Mode Theory

Types p,q are “modes” of types/contexts

Terms α are descriptions of the context

x1:p1, … , xn:pn ⊢ α : q

α ⇒ β

p,q,… Modes

Context Descriptors

Structural Properties

21

Mode Theory

Types p,q are “modes” of types/contexts

Terms α are descriptions of the context

“Transformations” α ⇒ β are structural properties

x1:p1, … , xn:pn ⊢ α : q

α ⇒ β

p,q,… Modes

Context Descriptors

Structural Properties

21

Mode Theory

Types p,q are “modes” of types/contexts

Terms α are descriptions of the context

“Transformations” α ⇒ β are structural properties

x1:p1, … , xn:pn ⊢ α : q

α ⇒ β

p,q,… Modes

Context Descriptors

Structural Properties

cartesian/structural

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

Non-associative logic: no equations/transformations

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

Non-associative logic: no equations/transformationsOrdered logic: (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

Non-associative logic: no equations/transformationsOrdered logic: (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)Linear logic: a ⊗ b = b ⊗ a

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

Non-associative logic: no equations/transformationsOrdered logic: (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)Linear logic: a ⊗ b = b ⊗ aRelevant logic: a ⟹ a ⊗ a

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

Non-associative logic: no equations/transformationsOrdered logic: (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)Linear logic: a ⊗ b = b ⊗ aRelevant logic: a ⟹ a ⊗ aAffine logic: a ⟹ 1

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

Non-associative logic: no equations/transformationsOrdered logic: (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)Linear logic: a ⊗ b = b ⊗ aRelevant logic: a ⟹ a ⊗ aAffine logic: a ⟹ 1BI: two function symbols ✻ and ⋀: (a ✻ b) ⋀ (c ✻ d)

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

Non-associative logic: no equations/transformationsOrdered logic: (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)Linear logic: a ⊗ b = b ⊗ aRelevant logic: a ⟹ a ⊗ aAffine logic: a ⟹ 1BI: two function symbols ✻ and ⋀: (a ✻ b) ⋀ (c ✻ d)Modalities: unary function symbols: r(a) ⊗ r(b) ⊗ c ⊗ d

22

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X

cartesian

Non-associative logic: no equations/transformationsOrdered logic: (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)Linear logic: a ⊗ b = b ⊗ aRelevant logic: a ⟹ a ⊗ aAffine logic: a ⟹ 1BI: two function symbols ✻ and ⋀: (a ✻ b) ⋀ (c ✻ d)Modalities: unary function symbols: r(a) ⊗ r(b) ⊗ c ⊗ d

23

Weakening over weakening

23

Weakening over weakening

Γ,x:A ⊢α BΓ ⊢α B

23

Weakening over weakening

Γ,x:A ⊢α BΓ ⊢α B

a:A,b:B,c:C,d:D ⊢(a ⊗ b) ⊗ (c ⊗ d) X a:A,b:B,c:C,d:D,e:E ⊢(a ⊗ b) ⊗ (c ⊗ d) X

24

Structural Rules (Admiss)

Γ,x:A ⊢α BΓ ⊢α B

24

Structural Rules (Admiss)

Γ,x:A ⊢α BΓ ⊢α B

Γ,x:A,y:B ⊢α CΓ,y:B,x:A ⊢α B

24

Structural Rules (Admiss)

Γ ⊢α A Γ,x:A ⊢β BΓ ⊢β[α/x] B

Γ,x:A ⊢α BΓ ⊢α B

Γ,x:A,y:B ⊢α CΓ,y:B,x:A ⊢α B

24

Structural Rules (Admiss)

Γ ⊢α A Γ,x:A ⊢β BΓ ⊢β[α/x] B

Γ,x:A ⊢α BΓ ⊢α B

Γ,x:A ⊢x A

Γ,x:A,y:B ⊢α CΓ,y:B,x:A ⊢α B

24

Structural Rules (Admiss)

Γ ⊢α A Γ,x:A ⊢β BΓ ⊢β[α/x] B

Γ,x:A ⊢α BΓ ⊢α B

Γ,x:A ⊢x A

Γ,x:A,y:B ⊢α CΓ,y:B,x:A ⊢α B

Γ ⊢β A

25

Hypothesis

Γ ⊢β Pβ ⇒ x x : P ∊ Γ

25

Hypothesis

Γ ⊢β Pβ ⇒ x x : P ∊ Γ

up to whatever structural properties you’ve asserted, the context is just x (typically x⊗y ⇒ x)

26

F types

Fα (x1:A1,…,xn:An)

26

F types the “product” of A1 … Anstructured according to α

Fα (x1:A1,…,xn:An)

26

F types the “product” of A1 … Anstructured according to α

Fα (x1:A1,…,xn:An)

A ⊗ B := F(x ⊗ y) (x:A, y:B)e.g.

26

F types the “product” of A1 … Anstructured according to α

Fα (x1:A1,…,xn:An)

A ⊗ B := F(x ⊗ y) (x:A, y:B)e.g.

♭A := F(r x) (x:A)

27

F Left

Γ,A⊗B,Δ ⊢ CΓ,A,B,Δ ⊢ C

Γ[A∗B] ⊢ CΓ[A,B] ⊢ C

Γ; Δ,!A ⊢ C

Γ,A ; Δ ⊢ C

Γ; Δ,☐A ⊢ CΓ,A ; Δ,☐A ⊢ C

28

F Left

Γ, x:Fα(Δ) ⊢β B Γ,Δ ⊢β[α/x] B

28

F Left

Γ, x:Fα(Δ) ⊢β B Γ,Δ ⊢β[α/x] B

remember where in the tree Δ variables occur

29

F Right

Γ0 ⊢ A ⊗ BΓ ⊢ A Δ ⊢ BΓ0 ≡ Γ, Δ

Γ0 ⊢ !A

Γ ; ⋅ ⊢ AΓ0 ≡ (Γ; ⋅)

30

F Right

Γ ⊢β Fα Δ β ⇒ α[γ] Γ ⊢γ Δ

31

Exchange

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

y⊗z ⇒ (z’⊗y’)[?]

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

y⊗z ⇒ (z’⊗y’)[z/z’,y/y’]

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

y⊗z ⇒ z⊗y

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

y:A ⊢y A

y⊗z ⇒ z⊗y

x:A⊗B ⊢x B⊗A

31

Exchange

x : F(y⊗z)(y:A,z:B) ⊢x F(z’⊗y’)(z’:B,y’:A)y:A,z:B ⊢y⊗z F(z’⊗y’)(z’:B,y’:A)

y:A ⊢y Az:B ⊢z By⊗z ⇒ z⊗y

x:A⊗B ⊢x B⊗A

32

Right Adjoints

Γ ⊢ A ⊸ BΓ,A ⊢ B

Γ ⊢c U AΓ;⋅⊢l A

Γ[A⊸B,Δ] ⊢ CΔ ⊢ A Γ[B] ⊢ C

Γ,U A;Δ ⊢l B

Γ;Δ,A ⊢l B

33

Right Adjoints

Uc.α(Δ|A) typeq

A typepΔ ctxφφ,c:q ⊢ α : p

A ⊸ B := Uc.(c ⊗ y)(y:A|B)

33

Right Adjoints

Uc.α(Δ|A) typeq

A typepΔ ctxφφ,c:q ⊢ α : p

A ⊸ B := Uc.(c ⊗ y)(y:A|B)

A \ B := Uc.(y ⊗ c)(y:A|B)A / B := Uc.(c ⊗ y)(y:A|B)

34

Right Adjoints

Uc.α(Δ|A) typeq

A typepΔ ctxφφ,c:q ⊢ α : p

Γ ⊢β Uc.α(Δ|A)Γ,Δ ⊢α[β/c] A

35

Right Adjoints

x:X ⊢x Uc ⊗ a(a:A|Y)A ⊸ Y

35

Right Adjoints

x:X ⊢x Uc ⊗ a(a:A|Y)

x:X,a:A ⊢x⊗a Y

A ⊸ Y

35

Right Adjoints

x:X ⊢x Uc ⊗ a(a:A|Y)

x:X,a:A ⊢x⊗a Y

z:Fx⊗a(x:X,a:A) ⊢z Y

A ⊸ Y

35

Right Adjoints

x:X ⊢x Uc ⊗ a(a:A|Y)

x:X,a:A ⊢x⊗a Y

z:Fx⊗a(x:X,a:A) ⊢z Y

A ⊸ Y

X ⊗ A

36

ExamplesNon-assoc, ordered, linear, affine, relevant, cartesian, bunched products and implicationsN-linear variables [Reed,Abel,McBride]Monoidal, lax, non- left adjointsNon-strong, strong, ☐-strong monadsSpatial type theory

Logical adequacy: sequent is provable iff its encoding is

37

Bifibrations

locally discrete fibration (action of structural rules)Fα Δ makes this into an opfibration Uα(Δ|A) makes this into a fibration

Sound/Complete: Syntax forms a bifibration and can be interpreted in any

D

M

derivations

modes

cartesian 2- multicategories 𝜋

38

Equational Theoryβη for F and Uequations governing action of 2-cells: when do two terms differ by placement of structural properties?

A,B ⊢ B × AA ⊢ AB ⊢ BA,B ≡ B,A

A,B ⊢ B × AA,B ⊢ AA,B ⊢ BA,B ≡ A,B,A,B

39

This paper

Products and left-adjoints (⊗,F) all one connectiveNegatives and right adjoints (⊸,U) anotherCut elimination for all instances at onceEquational theory: differ by structural rulesCategorical semantics

A framework that abstracts the common aspects of many intuitionistic

substructural and modal logics