A topos-theoretic approach to systems and behavior David I. Spivak - - PowerPoint PPT Presentation

a topos theoretic approach to systems and behavior
SMART_READER_LITE
LIVE PREVIEW

A topos-theoretic approach to systems and behavior David I. Spivak - - PowerPoint PPT Presentation

A topos-theoretic approach to systems and behavior David I. Spivak and Patrick Schultz Mathematics Department Massachusetts Institute of Technology Category Theory Conference 2018/07/09 0 / 22 Introduction Outline 1 Introduction The


slide-1
SLIDE 1

A topos-theoretic approach to systems and behavior

David I. Spivak∗ and Patrick Schultz

Mathematics Department Massachusetts Institute of Technology

Category Theory Conference 2018/07/09

0 / 22

slide-2
SLIDE 2

Introduction

Outline

1 Introduction

The National Airspace System Summary: motivation and plan

2 The topos B of behavior types 3 Temporal type theory 4 Application to the NAS 5 Conclusion

0 / 22

slide-3
SLIDE 3

Introduction The National Airspace System

An example system

The National Airspace System (NAS) Safe separation problem: Planes need to remain at a safe distance. Can’t generally communicate directly. Use radars, pilots, ground control, radios, and TCAS.1

1Traffic Collision Avoidance System.

1 / 22

slide-4
SLIDE 4

Introduction The National Airspace System

An example system

The National Airspace System (NAS) Safe separation problem: Planes need to remain at a safe distance. Can’t generally communicate directly. Use radars, pilots, ground control, radios, and TCAS.1 Systems of systems: A great variety of interconnected systems. Work in concert to enforce global property: safe separation.

1Traffic Collision Avoidance System.

1 / 22

slide-5
SLIDE 5

Introduction The National Airspace System

Systems of interacting systems in the NAS

plane 1 plane 2 radar satellite National Airspace System 1-TCAS 2-TCAS 2-altitude 1-altitude radar signal 2 / 22

slide-6
SLIDE 6

Introduction The National Airspace System

Systems of interacting systems in the NAS

plane 1 plane 2 radar satellite National Airspace System 1-TCAS 2-TCAS 2-altitude 1-altitude radar signal

  • nboard

TCAS pilot jets&wings plane 1 their TCAS command radar signal

  • ur TCAS command

yoke & throttle altitude 2 / 22

slide-7
SLIDE 7

Introduction The National Airspace System

Behavior contracts as predicates

plane 1 plane 2 radar satellite National Airspace System 1-TCAS 2-TCAS 2-altitude 1-altitude radar signal

We assign to each... ... wire: a sheaf. ... box: a predicate—a behavior contract—on the product of its wires. Prove that if each box’s predicate is satisfied, safe separation is achieved.

3 / 22

slide-8
SLIDE 8

Introduction The National Airspace System

Behavior contracts as predicates

plane 1 plane 2 radar satellite National Airspace System 1-TCAS 2-TCAS 2-altitude 1-altitude radar signal

We assign to each... ... wire: a sheaf. ... box: a predicate—a behavior contract—on the product of its wires. Prove that if each box’s predicate is satisfied, safe separation is achieved. We’ll discuss such a situation using topos theory.

3 / 22

slide-9
SLIDE 9

Introduction Summary: motivation and plan

NAS use-case as guide

What’s the topos for the National Airspace System? This question was a major guide for our work. Need to combine many common frameworks into a “big tent”. Differential equations, continuous dynamical systems. Labeled transition systems, discrete dynamical systems. Delays, non-instantaneous rules. Determinism, non-determinism.

4 / 22

slide-10
SLIDE 10

Introduction Summary: motivation and plan

NAS use-case as guide

What’s the topos for the National Airspace System? This question was a major guide for our work. Need to combine many common frameworks into a “big tent”. Differential equations, continuous dynamical systems. Labeled transition systems, discrete dynamical systems. Delays, non-instantaneous rules. Determinism, non-determinism. Need a logic so engineers can prove safety of combined systems.

4 / 22

slide-11
SLIDE 11

Introduction Summary: motivation and plan

NAS use-case as guide

What’s the topos for the National Airspace System? This question was a major guide for our work. Need to combine many common frameworks into a “big tent”. Differential equations, continuous dynamical systems. Labeled transition systems, discrete dynamical systems. Delays, non-instantaneous rules. Determinism, non-determinism. Need a logic so engineers can prove safety of combined systems. Relationship to toposes: Toposes have an associated internal language and logic. Can use formal methods (proof assistants) to prove properties of NAS.

4 / 22

slide-12
SLIDE 12

Introduction Summary: motivation and plan

Plan of the talk

  • 1. Define a topos B of behavior types.
  • 2. Discuss temporal type theory, which is sound in B.
  • 3. Return to a NAS use-case.

5 / 22

slide-13
SLIDE 13

The topos B of behavior types

Outline

1 Introduction 2 The topos B of behavior types

Choosing a topos An intervallic time-line, IR B the topos of behavior types

3 Temporal type theory 4 Application to the NAS 5 Conclusion

5 / 22

slide-14
SLIDE 14

The topos B of behavior types Choosing a topos

What is behavior?

We want to model various types of behavior. What is a behavior type? A behavior type is like “airplane behavior” or “pilot behavior” Both are collections of possibilities, indexed by time intervals. I want to conceptualize them as sheaves on time intervals.

6 / 22

slide-15
SLIDE 15

The topos B of behavior types Choosing a topos

What is behavior?

We want to model various types of behavior. What is a behavior type? A behavior type is like “airplane behavior” or “pilot behavior” Both are collections of possibilities, indexed by time intervals. I want to conceptualize them as sheaves on time intervals. So what should we mean by time?

6 / 22

slide-16
SLIDE 16

The topos B of behavior types Choosing a topos

First guess: R as timeline

R as timeline: Does it serve as a good site for behaviors?

7 / 22

slide-17
SLIDE 17

The topos B of behavior types Choosing a topos

First guess: R as timeline

R as timeline: Does it serve as a good site for behaviors?

What would a behavior type B ∈ Shv(R) be? On objects: For each open interval (a, b) ⊆ R, a set B(a, b). “The set of B-behaviors that can occur on (a, b).”

7 / 22

slide-18
SLIDE 18

The topos B of behavior types Choosing a topos

First guess: R as timeline

R as timeline: Does it serve as a good site for behaviors?

What would a behavior type B ∈ Shv(R) be? On objects: For each open interval (a, b) ⊆ R, a set B(a, b). “The set of B-behaviors that can occur on (a, b).” On morphisms: For each a ≤ a′ < b′ ≤ b, a function B(a, b) → B(a′, b′). Restriction: “watch a clip of the movie”.

7 / 22

slide-19
SLIDE 19

The topos B of behavior types Choosing a topos

First guess: R as timeline

R as timeline: Does it serve as a good site for behaviors?

What would a behavior type B ∈ Shv(R) be? On objects: For each open interval (a, b) ⊆ R, a set B(a, b). “The set of B-behaviors that can occur on (a, b).” On morphisms: For each a ≤ a′ < b′ ≤ b, a function B(a, b) → B(a′, b′). Restriction: “watch a clip of the movie”. Gluing conditions: “Continuity”: B(a, b) lima<a′<b′<b B(a′, b′).

7 / 22

slide-20
SLIDE 20

The topos B of behavior types Choosing a topos

First guess: R as timeline

R as timeline: Does it serve as a good site for behaviors?

What would a behavior type B ∈ Shv(R) be? On objects: For each open interval (a, b) ⊆ R, a set B(a, b). “The set of B-behaviors that can occur on (a, b).” On morphisms: For each a ≤ a′ < b′ ≤ b, a function B(a, b) → B(a′, b′). Restriction: “watch a clip of the movie”. Gluing conditions: “Continuity”: B(a, b) lima<a′<b′<b B(a′, b′). “Composition”: B(a, b) B(a, b′) ×B(a′,b′) B(a′, b). |

| |

|

a a′ b′ b 7 / 22

slide-21
SLIDE 21

The topos B of behavior types Choosing a topos

Why R is not preferable as the site

Two reasons not to use Shv(R) as our topos.

  • 1. Often want to consider non-composable behaviors!

“Roughly monotonic”: ∀(t1, t2). t1 + 5 ≤ t2 ⇒ f (t1) ≤ f (t2). “Don’t move much”: ∀(t1, t2). −5 < f (t1) − f (t2) < 5. Neither of these satisfy “composition gluing”.

8 / 22

slide-22
SLIDE 22

The topos B of behavior types Choosing a topos

Why R is not preferable as the site

Two reasons not to use Shv(R) as our topos.

  • 1. Often want to consider non-composable behaviors!

“Roughly monotonic”: ∀(t1, t2). t1 + 5 ≤ t2 ⇒ f (t1) ≤ f (t2). “Don’t move much”: ∀(t1, t2). −5 < f (t1) − f (t2) < 5. Neither of these satisfy “composition gluing”.

  • 2. Want to compare behavior across different time windows.

Example: a delay is “the same behavior at different times.” Shv(R) sees no relationship between B(0, 3) and B(2, 5).

8 / 22

slide-23
SLIDE 23

The topos B of behavior types Choosing a topos

Why R is not preferable as the site

Two reasons not to use Shv(R) as our topos.

  • 1. Often want to consider non-composable behaviors!

“Roughly monotonic”: ∀(t1, t2). t1 + 5 ≤ t2 ⇒ f (t1) ≤ f (t2). “Don’t move much”: ∀(t1, t2). −5 < f (t1) − f (t2) < 5. Neither of these satisfy “composition gluing”.

  • 2. Want to compare behavior across different time windows.

Example: a delay is “the same behavior at different times.” Shv(R) sees no relationship between B(0, 3) and B(2, 5). We want “Translation invariance.”

8 / 22

slide-24
SLIDE 24

The topos B of behavior types Choosing a topos

Why R is not preferable as the site

Two reasons not to use Shv(R) as our topos.

  • 1. Often want to consider non-composable behaviors!

“Roughly monotonic”: ∀(t1, t2). t1 + 5 ≤ t2 ⇒ f (t1) ≤ f (t2). “Don’t move much”: ∀(t1, t2). −5 < f (t1) − f (t2) < 5. Neither of these satisfy “composition gluing”.

  • 2. Want to compare behavior across different time windows.

Example: a delay is “the same behavior at different times.” Shv(R) sees no relationship between B(0, 3) and B(2, 5). We want “Translation invariance.” Solution: Replace R with an intervallic timeline, and... ... quotient by translation action.

8 / 22

slide-25
SLIDE 25

The topos B of behavior types An intervallic time-line, I R

An intervallic time-line, IR

For our timeline we use IR “the interval domain”.

9 / 22

slide-26
SLIDE 26

The topos B of behavior types An intervallic time-line, I R

An intervallic time-line, IR

For our timeline we use IR “the interval domain”. Definition IR tw(R, ≤)op. Points: {[a, b] | a ≤ b ∈ R}. [a, b] ⊑ [a′, b′] iff a ≤ a′ ≤ b′ ≤ b. [a, b] is less precise than [a′, b′].

R ⊆ IR embeds as the maximal points, [r, r].

9 / 22

slide-27
SLIDE 27

The topos B of behavior types An intervallic time-line, I R

An intervallic time-line, IR

For our timeline we use IR “the interval domain”. Definition IR tw(R, ≤)op. Points: {[a, b] | a ≤ b ∈ R}. [a, b] ⊑ [a′, b′] iff a ≤ a′ ≤ b′ ≤ b. [a, b] is less precise than [a′, b′].

R ⊆ IR embeds as the maximal points, [r, r]. IR is a Scott domain:

Its poset of points determines a topology... ...for which ⊑ is specialization order on points. Basis: open intervals (a, b), denoting {[a′, b′] | a < a′ ≤ b′ < b}.

9 / 22

slide-28
SLIDE 28

The topos B of behavior types An intervallic time-line, I R

An intervallic time-line, IR

For our timeline we use IR “the interval domain”. Definition IR tw(R, ≤)op. Points: {[a, b] | a ≤ b ∈ R}. [a, b] ⊑ [a′, b′] iff a ≤ a′ ≤ b′ ≤ b. [a, b] is less precise than [a′, b′].

R ⊆ IR embeds as the maximal points, [r, r]. IR is a Scott domain:

Its poset of points determines a topology... ...for which ⊑ is specialization order on points. Basis: open intervals (a, b), denoting {[a′, b′] | a < a′ ≤ b′ < b}. This space, IR is our timeline, and its points are intervals.

9 / 22

slide-29
SLIDE 29

The topos B of behavior types An intervallic time-line, I R

Shv(IR): behaviors in the context of time

Each X ∈ Shv(IR) is a behavior type occurring in the context of time.

IR is our (intervallic) time-line.

X(a, b) is the set of X-behaviors over the interval (a, b). We can restrict behaviors to subintervals a ≤ a′ ≤ b′ ≤ b. And behaviors satisfy “continuity gluing,” X(a, b) lim

a<a′<b′<b X(a′, b′).

10 / 22

slide-30
SLIDE 30

The topos B of behavior types An intervallic time-line, I R

Shv(IR): behaviors in the context of time

Each X ∈ Shv(IR) is a behavior type occurring in the context of time.

IR is our (intervallic) time-line.

X(a, b) is the set of X-behaviors over the interval (a, b). We can restrict behaviors to subintervals a ≤ a′ ≤ b′ ≤ b. And behaviors satisfy “continuity gluing,” X(a, b) lim

a<a′<b′<b X(a′, b′).

Next up: keep durations, drop the fixed timeline.

10 / 22

slide-31
SLIDE 31

The topos B of behavior types B the topos of behavior types

Translation-invariant quotient topos B

We want translation-invariance, to compare behaviors over different times.

11 / 22

slide-32
SLIDE 32

The topos B of behavior types B the topos of behavior types

Translation-invariant quotient topos B

We want translation-invariance, to compare behaviors over different times. Translation action R

− → Aut(IR), r ⊲ (a, b) ≔ (a + r, b + r)

11 / 22

slide-33
SLIDE 33

The topos B of behavior types B the topos of behavior types

Translation-invariant quotient topos B

We want translation-invariance, to compare behaviors over different times. Translation action R

− → Aut(IR), r ⊲ (a, b) ≔ (a + r, b + r) This induces a left-exact comonad T on Shv(IR). (Left-exact comonads are what define quotient toposes.) For X ∈ Shv(IR), define TX ∈ Shv(IR) by (TX)(a, b) ≔

  • r∈R

X(a + r, b + r).

11 / 22

slide-34
SLIDE 34

The topos B of behavior types B the topos of behavior types

Translation-invariant quotient topos B

We want translation-invariance, to compare behaviors over different times. Translation action R

− → Aut(IR), r ⊲ (a, b) ≔ (a + r, b + r) This induces a left-exact comonad T on Shv(IR). (Left-exact comonads are what define quotient toposes.) For X ∈ Shv(IR), define TX ∈ Shv(IR) by (TX)(a, b) ≔

  • r∈R

X(a + r, b + r). T-coalgebras are translation-equivariant sheaves. Define topos B ≔ T-coAlg of “behavior types”. In fact B is an ´ etendue, meaning...

11 / 22

slide-35
SLIDE 35

The topos B of behavior types B the topos of behavior types

Translation-invariant quotient topos B

We want translation-invariance, to compare behaviors over different times. Translation action R

− → Aut(IR), r ⊲ (a, b) ≔ (a + r, b + r) This induces a left-exact comonad T on Shv(IR). (Left-exact comonads are what define quotient toposes.) For X ∈ Shv(IR), define TX ∈ Shv(IR) by (TX)(a, b) ≔

  • r∈R

X(a + r, b + r). T-coalgebras are translation-equivariant sheaves. Define topos B ≔ T-coAlg of “behavior types”. In fact B is an ´ etendue, meaning... There is an inhabited object, which we call Time ∈ B, And an equivalence Shv(IR) B/Time. Makes precise “Shv(IR) is behavior types in the context of time.”

11 / 22

slide-36
SLIDE 36

The topos B of behavior types B the topos of behavior types

Example behavior types X ∈ B

We contend that any sort of behavior can be modeled as an object X ∈ B.

12 / 22

slide-37
SLIDE 37

The topos B of behavior types B the topos of behavior types

Example behavior types X ∈ B

We contend that any sort of behavior can be modeled as an object X ∈ B. Trajectories through a vector field, Delays (+ delay differential equations), Stochastic walk through a graph: “labeled transition system”.

  • a

c b d e f i g h

12 / 22

slide-38
SLIDE 38

The topos B of behavior types B the topos of behavior types

Example behavior types X ∈ B

We contend that any sort of behavior can be modeled as an object X ∈ B. Trajectories through a vector field, Delays (+ delay differential equations), Stochastic walk through a graph: “labeled transition system”.

  • a

c b d e f i g h

Next up: want logic to define other interesting behaviors. “Whenever I touch blue, I’ll spend 1 full sec. on blue within 5 sec’s.”

12 / 22

slide-39
SLIDE 39

The topos B of behavior types B the topos of behavior types

Preview of higher-order temporal logic for behavior

In any topos, logical expressions are amazingly convenient. “Whenever I touch blue, I’ll spend 1 full sec. on blue within 5 sec’s.”

∀(t : Time). @t

[0,0]B(x) ⇒ ∃(r : R). 0 ≤ r ≤ 5 ∧ @t [r,r+1]B(x).

13 / 22

slide-40
SLIDE 40

The topos B of behavior types B the topos of behavior types

Preview of higher-order temporal logic for behavior

In any topos, logical expressions are amazingly convenient. “Whenever I touch blue, I’ll spend 1 full sec. on blue within 5 sec’s.”

∀(t : Time). @t

[0,0]B(x) ⇒ ∃(r : R). 0 ≤ r ≤ 5 ∧ @t [r,r+1]B(x).

Kripke-Joyal semantics Logical expressions like the above can be interpreted in the topos B. E.g. the above defines a map P : X → Ω, given B : X → Ω. This in turn gives a subtype {X | P} of “P-satisfying behavior”.

13 / 22

slide-41
SLIDE 41

The topos B of behavior types B the topos of behavior types

Preview of higher-order temporal logic for behavior

In any topos, logical expressions are amazingly convenient. “Whenever I touch blue, I’ll spend 1 full sec. on blue within 5 sec’s.”

∀(t : Time). @t

[0,0]B(x) ⇒ ∃(r : R). 0 ≤ r ≤ 5 ∧ @t [r,r+1]B(x).

Kripke-Joyal semantics Logical expressions like the above can be interpreted in the topos B. E.g. the above defines a map P : X → Ω, given B : X → Ω. This in turn gives a subtype {X | P} of “P-satisfying behavior”. How is internal logic is convenient? compact notation, precise semantics, quite expressive, readable in natural language, e.g. English.

13 / 22

slide-42
SLIDE 42

The topos B of behavior types B the topos of behavior types

Preview of higher-order temporal logic for behavior

In any topos, logical expressions are amazingly convenient. “Whenever I touch blue, I’ll spend 1 full sec. on blue within 5 sec’s.”

∀(t : Time). @t

[0,0]B(x) ⇒ ∃(r : R). 0 ≤ r ≤ 5 ∧ @t [r,r+1]B(x).

Kripke-Joyal semantics Logical expressions like the above can be interpreted in the topos B. E.g. the above defines a map P : X → Ω, given B : X → Ω. This in turn gives a subtype {X | P} of “P-satisfying behavior”. How is internal logic is convenient? compact notation, precise semantics, quite expressive, readable in natural language, e.g. English. Next: use logic to define real “numbers”.

13 / 22

slide-43
SLIDE 43

Temporal type theory

Outline

1 Introduction 2 The topos B of behavior types 3 Temporal type theory

Dedekind numeric objects A finitely-presented language with semantics in B Local reals and derivatives

4 Application to the NAS 5 Conclusion

13 / 22

slide-44
SLIDE 44

Temporal type theory Dedekind numeric objects

Dedekind numeric objects

In any sheaf topos, use logic to define various Dedekind numeric objects.

14 / 22

slide-45
SLIDE 45

Temporal type theory Dedekind numeric objects

Dedekind numeric objects

In any sheaf topos, use logic to define various Dedekind numeric objects. Start with Q; it’s semantically the constant sheaf Q. Think of a function L : Q → Ω as the “Q-lower bounds” for a real. We can define the type ¯

R of lower reals internally:

¯

R ≔ {L : Q → Ω | ∃q. Lq ∧ ∀q. Lq ⇔ ∃q′. q < q′ ∧ Lq′}.

14 / 22

slide-46
SLIDE 46

Temporal type theory Dedekind numeric objects

Dedekind numeric objects

In any sheaf topos, use logic to define various Dedekind numeric objects. Start with Q; it’s semantically the constant sheaf Q. Think of a function L : Q → Ω as the “Q-lower bounds” for a real. We can define the type ¯

R of lower reals internally:

¯

R ≔ {L : Q → Ω | ∃q. Lq ∧ ∀q. Lq ⇔ ∃q′. q < q′ ∧ Lq′}.

The semantics are nice on localic toposes. If X is a top. sp.,

¯

R(U) {lower semi-continuous functions U → R ∪ {∞}}.

14 / 22

slide-47
SLIDE 47

Temporal type theory Dedekind numeric objects

Dedekind numeric objects

In any sheaf topos, use logic to define various Dedekind numeric objects. Start with Q; it’s semantically the constant sheaf Q. Think of a function L : Q → Ω as the “Q-lower bounds” for a real. We can define the type ¯

R of lower reals internally:

¯

R ≔ {L : Q → Ω | ∃q. Lq ∧ ∀q. Lq ⇔ ∃q′. q < q′ ∧ Lq′}.

The semantics are nice on localic toposes. If X is a top. sp.,

¯

R(U) {lower semi-continuous functions U → R ∪ {∞}}.

Dually, define ¯

R, with ¯ R(U) {upper semi-continuous . . . }

¯ ¯

R ≔ ¯ R × ¯ R: extended intervals. R ≔ {(L, R) : ¯

¯

R | ∀q. ¬(Lq ∧ Rq) ∧ ∀(q < q′). Lq ∨ Rq′}.

14 / 22

slide-48
SLIDE 48

Temporal type theory Dedekind numeric objects

Dedekind numeric objects

In any sheaf topos, use logic to define various Dedekind numeric objects. Start with Q; it’s semantically the constant sheaf Q. Think of a function L : Q → Ω as the “Q-lower bounds” for a real. We can define the type ¯

R of lower reals internally:

¯

R ≔ {L : Q → Ω | ∃q. Lq ∧ ∀q. Lq ⇔ ∃q′. q < q′ ∧ Lq′}.

The semantics are nice on localic toposes. If X is a top. sp.,

¯

R(U) {lower semi-continuous functions U → R ∪ {∞}}.

Dually, define ¯

R, with ¯ R(U) {upper semi-continuous . . . }

¯ ¯

R ≔ ¯ R × ¯ R: extended intervals. R ≔ {(L, R) : ¯

¯

R | ∀q. ¬(Lq ∧ Rq) ∧ ∀(q < q′). Lq ∨ Rq′}.

We refer to ¯

R, ¯ R, ¯

¯

R, R, etc. as Dedekind numeric objects.

14 / 22

slide-49
SLIDE 49

Temporal type theory A finitely-presented language with semantics in B

Temporal type theory

TTT is a finitely presented sub-language of B’s internal language: One atomic predicate symbol, unit speed: ¯ ¯

R → Ω.

15 / 22

slide-50
SLIDE 50

Temporal type theory A finitely-presented language with semantics in B

Temporal type theory

TTT is a finitely presented sub-language of B’s internal language: One atomic predicate symbol, unit speed: ¯ ¯

R → Ω.

From here, define Time ≔ { t : ¯ ¯

R | unit speed(t) }.

Note that we can treat times t : Time as real intervals.

15 / 22

slide-51
SLIDE 51

Temporal type theory A finitely-presented language with semantics in B

Temporal type theory

TTT is a finitely presented sub-language of B’s internal language: One atomic predicate symbol, unit speed: ¯ ¯

R → Ω.

From here, define Time ≔ { t : ¯ ¯

R | unit speed(t) }.

Note that we can treat times t : Time as real intervals. TTT axiomatics: find finitely many axioms with which to “do real work”. Ten axioms, e.g. that Time is an R-torsor:

∀(t : Time)(r : R). t + r ∈ Time, ∀(t1, t2 : Time). ∃!(r : R). t1 + r t2.

15 / 22

slide-52
SLIDE 52

Temporal type theory A finitely-presented language with semantics in B

Temporal type theory

TTT is a finitely presented sub-language of B’s internal language: One atomic predicate symbol, unit speed: ¯ ¯

R → Ω.

From here, define Time ≔ { t : ¯ ¯

R | unit speed(t) }.

Note that we can treat times t : Time as real intervals. TTT axiomatics: find finitely many axioms with which to “do real work”. Ten axioms, e.g. that Time is an R-torsor:

∀(t : Time)(r : R). t + r ∈ Time, ∀(t1, t2 : Time). ∃!(r : R). t1 + r t2.

All are sound in B We already had Time ∈ B externally in the ´ entendue B. Check that with that interpretation, the ten axioms hold.

15 / 22

slide-53
SLIDE 53

Temporal type theory A finitely-presented language with semantics in B

Modalities, @ and π

There are a number of useful modalities (Lawvere-Tierney topologies). Modalities are internal monads j : Ω → Ω on the subobject classifier. That is, P ⇒ jP, jjP ⇒ jP, j(P ∧ Q) ⇔ (jP ∧ jQ). One-to-one correspondence {modalities} {subtoposes}.

16 / 22

slide-54
SLIDE 54

Temporal type theory A finitely-presented language with semantics in B

Modalities, @ and π

There are a number of useful modalities (Lawvere-Tierney topologies). Modalities are internal monads j : Ω → Ω on the subobject classifier. That is, P ⇒ jP, jjP ⇒ jP, j(P ∧ Q) ⇔ (jP ∧ jQ). One-to-one correspondence {modalities} {subtoposes}. Example 1,2: in the context of t : Time, have modalities ↓t

[a,b], @t [a,b].

↓t

[a,b]P ≔ P ∨ (a < t ∨ t < b).

@t

[a,b]P ≔ (P ⇒ (a < t ∨ t < b)) ⇒ (a < t ∨ t < b).

These are hard to read, but correspond to useful subtoposes: @t

[a,b] corresponds to single point subtopos {[a, b]} ⊆ IR.

↓t

[a,b] corresponds to its closure ↓ [a, b] ⊆ IR.

16 / 22

slide-55
SLIDE 55

Temporal type theory A finitely-presented language with semantics in B

Modalities, @ and π

There are a number of useful modalities (Lawvere-Tierney topologies). Modalities are internal monads j : Ω → Ω on the subobject classifier. That is, P ⇒ jP, jjP ⇒ jP, j(P ∧ Q) ⇔ (jP ∧ jQ). One-to-one correspondence {modalities} {subtoposes}. Example 1,2: in the context of t : Time, have modalities ↓t

[a,b], @t [a,b].

↓t

[a,b]P ≔ P ∨ (a < t ∨ t < b).

@t

[a,b]P ≔ (P ⇒ (a < t ∨ t < b)) ⇒ (a < t ∨ t < b).

These are hard to read, but correspond to useful subtoposes: @t

[a,b] corresponds to single point subtopos {[a, b]} ⊆ IR.

↓t

[a,b] corresponds to its closure ↓ [a, b] ⊆ IR.

Example 3: We have “pointwise” modality π. πP ≔ ∀(t : Time). @t

[0,0]P.

Corresponds to the dense subtopos R ⊆ IR.

16 / 22

slide-56
SLIDE 56

Temporal type theory A finitely-presented language with semantics in B

Modalities, @ and π

There are a number of useful modalities (Lawvere-Tierney topologies). Modalities are internal monads j : Ω → Ω on the subobject classifier. That is, P ⇒ jP, jjP ⇒ jP, j(P ∧ Q) ⇔ (jP ∧ jQ). One-to-one correspondence {modalities} {subtoposes}. Example 1,2: in the context of t : Time, have modalities ↓t

[a,b], @t [a,b].

↓t

[a,b]P ≔ P ∨ (a < t ∨ t < b).

@t

[a,b]P ≔ (P ⇒ (a < t ∨ t < b)) ⇒ (a < t ∨ t < b).

These are hard to read, but correspond to useful subtoposes: @t

[a,b] corresponds to single point subtopos {[a, b]} ⊆ IR.

↓t

[a,b] corresponds to its closure ↓ [a, b] ⊆ IR.

Example 3: We have “pointwise” modality π. πP ≔ ∀(t : Time). @t

[0,0]P.

Corresponds to the dense subtopos R ⊆ IR. We can use these modalities to define local Dedekind numeric types.

16 / 22

slide-57
SLIDE 57

Temporal type theory Local reals and derivatives

Local Dedekind numeric types

For any modality j, we can define ¯

Rj, ¯ Rj, ¯

¯

Rj, Rj, etc.

17 / 22

slide-58
SLIDE 58

Temporal type theory Local reals and derivatives

Local Dedekind numeric types

For any modality j, we can define ¯

Rj, ¯ Rj, ¯

¯

Rj, Rj, etc.

¯

Rj ≔ {L: Q → Ωj | j∃q. Lq ∧ ∀q. Lq ⇔ j∃q′. q < q′ ∧ Lq′}

When j id this is lower semicontinuous fns on IR. When j π, it’s lower semicontinuous fns on R ⊆ IR. When j @t

[a,b], it’s lower semicontinuous fns on a point.

17 / 22

slide-59
SLIDE 59

Temporal type theory Local reals and derivatives

Local Dedekind numeric types

For any modality j, we can define ¯

Rj, ¯ Rj, ¯

¯

Rj, Rj, etc.

¯

Rj ≔ {L: Q → Ωj | j∃q. Lq ∧ ∀q. Lq ⇔ j∃q′. q < q′ ∧ Lq′}

When j id this is lower semicontinuous fns on IR. When j π, it’s lower semicontinuous fns on R ⊆ IR. When j @t

[a,b], it’s lower semicontinuous fns on a point.

Now we are equipped to define derivatives.

17 / 22

slide-60
SLIDE 60

Temporal type theory Local reals and derivatives

Derivatives of continuous reals

We can define derivatives internally. Semantics of x : R π is: a continuous function on R. Evaluation of x at a point r : R is given by @[r,r]x ∈ R@[r,r] We denote this x@(r).

18 / 22

slide-61
SLIDE 61

Temporal type theory Local reals and derivatives

Derivatives of continuous reals

We can define derivatives internally. Semantics of x : R π is: a continuous function on R. Evaluation of x at a point r : R is given by @[r,r]x ∈ R@[r,r] We denote this x@(r). We define the derivative more gen’ly for any interval function x : ¯ ¯

R π.

Result is another interval function x : ¯ ¯

R π, defined by:

q1 < x < q2 iff for all r1 < r2 : R, q1 ≪ x@(r2) − x@(r1) r2 − r1 ≪ q2.

18 / 22

slide-62
SLIDE 62

Temporal type theory Local reals and derivatives

Derivatives of continuous reals

We can define derivatives internally. Semantics of x : R π is: a continuous function on R. Evaluation of x at a point r : R is given by @[r,r]x ∈ R@[r,r] We denote this x@(r). We define the derivative more gen’ly for any interval function x : ¯ ¯

R π.

Result is another interval function x : ¯ ¯

R π, defined by:

q1 < x < q2 iff for all r1 < r2 : R, q1 ≪ x@(r2) − x@(r1) r2 − r1 ≪ q2. Theorem: x internally is linear in x and satisfies Leibniz rule.

18 / 22

slide-63
SLIDE 63

Temporal type theory Local reals and derivatives

Derivatives of continuous reals

We can define derivatives internally. Semantics of x : R π is: a continuous function on R. Evaluation of x at a point r : R is given by @[r,r]x ∈ R@[r,r] We denote this x@(r). We define the derivative more gen’ly for any interval function x : ¯ ¯

R π.

Result is another interval function x : ¯ ¯

R π, defined by:

q1 < x < q2 iff for all r1 < r2 : R, q1 ≪ x@(r2) − x@(r1) r2 − r1 ≪ q2. Theorem: x internally is linear in x and satisfies Leibniz rule. Theorem: x externally has semantics of derivative of x.

18 / 22

slide-64
SLIDE 64

Temporal type theory Local reals and derivatives

Differential equations

As a logical expression, derivatives work like anything else. Consider a differential equation, like f ( x, x, a, b) 0. is just a formula in the logic.

19 / 22

slide-65
SLIDE 65

Temporal type theory Local reals and derivatives

Differential equations

As a logical expression, derivatives work like anything else. Consider a differential equation, like f ( x, x, a, b) 0. is just a formula in the logic. We also define “labeled transition systems” internally... ...given two constant sheaves and two maps E ⇒ V . Can more generally define any “hybrid system”.

19 / 22

slide-66
SLIDE 66

Application to the NAS

Outline

1 Introduction 2 The topos B of behavior types 3 Temporal type theory 4 Application to the NAS

The internal language in action Combining local contracts for safety guarantee

5 Conclusion

19 / 22

slide-67
SLIDE 67

Application to the NAS The internal language in action

Setup of safety problem

Variables to be used, and their types: t : Time. T , P : Cmnd. a : R π. safe, margin, del, rate : Q. What these mean: t : Time. time-line (a clock). a : R π. altitude (continuously changing). T : Cmnd. TCAS command (occurs at discrete instants). P : Cmnd. pilot’s command (occurs at discrete instants). safe : Q. safe altitude (constant). margin : Q. margin-of-error (constant). del : Q. pilot delay (constant). rate : Q. maximal ascent rate (constant).

20 / 22

slide-68
SLIDE 68

Application to the NAS Combining local contracts for safety guarantee

Behavior contracts

t : Time. time-line (a clock). a : R π. altitude (continuously changing). T : Cmnd. TCAS command (occurs at discrete instants). P : Cmnd. pilot’s command (occurs at discrete instants). safe : Q . safe altitude (constant). margin : Q . margin-of-error (constant). del : Q . pilot delay (constant). rate : Q . maximal ascent rate (constant).

Axioms from disparate models of behavior: θ1 ≔ (margin > 0) ∧ (a ≥ 0).

21 / 22

slide-69
SLIDE 69

Application to the NAS Combining local contracts for safety guarantee

Behavior contracts

t : Time. time-line (a clock). a : R π. altitude (continuously changing). T : Cmnd. TCAS command (occurs at discrete instants). P : Cmnd. pilot’s command (occurs at discrete instants). safe : Q . safe altitude (constant). margin : Q . margin-of-error (constant). del : Q . pilot delay (constant). rate : Q . maximal ascent rate (constant).

Axioms from disparate models of behavior: θ1 ≔ (margin > 0) ∧ (a ≥ 0). θ2 ≔ (a > safe + margin ⇒ T level). θ′

2 ≔ (a < safe + margin ⇒ T climb).

21 / 22

slide-70
SLIDE 70

Application to the NAS Combining local contracts for safety guarantee

Behavior contracts

t : Time. time-line (a clock). a : R π. altitude (continuously changing). T : Cmnd. TCAS command (occurs at discrete instants). P : Cmnd. pilot’s command (occurs at discrete instants). safe : Q . safe altitude (constant). margin : Q . margin-of-error (constant). del : Q . pilot delay (constant). rate : Q . maximal ascent rate (constant).

Axioms from disparate models of behavior: θ1 ≔ (margin > 0) ∧ (a ≥ 0). θ2 ≔ (a > safe + margin ⇒ T level). θ′

2 ≔ (a < safe + margin ⇒ T climb).

θ3 ≔ (P level ⇒ a 0) ∧ (P climb ⇒ a rate).

21 / 22

slide-71
SLIDE 71

Application to the NAS Combining local contracts for safety guarantee

Behavior contracts

t : Time. time-line (a clock). a : R π. altitude (continuously changing). T : Cmnd. TCAS command (occurs at discrete instants). P : Cmnd. pilot’s command (occurs at discrete instants). safe : Q . safe altitude (constant). margin : Q . margin-of-error (constant). del : Q . pilot delay (constant). rate : Q . maximal ascent rate (constant).

Axioms from disparate models of behavior: θ1 ≔ (margin > 0) ∧ (a ≥ 0). θ2 ≔ (a > safe + margin ⇒ T level). θ′

2 ≔ (a < safe + margin ⇒ T climb).

θ3 ≔ (P level ⇒ a 0) ∧ (P climb ⇒ a rate). θ4 ≔ is delayed(del, T , P). This is an abbreviation for a longer logical condition.

21 / 22

slide-72
SLIDE 72

Application to the NAS Combining local contracts for safety guarantee

Behavior contracts

t : Time. time-line (a clock). a : R π. altitude (continuously changing). T : Cmnd. TCAS command (occurs at discrete instants). P : Cmnd. pilot’s command (occurs at discrete instants). safe : Q . safe altitude (constant). margin : Q . margin-of-error (constant). del : Q . pilot delay (constant). rate : Q . maximal ascent rate (constant).

Axioms from disparate models of behavior: θ1 ≔ (margin > 0) ∧ (a ≥ 0). θ2 ≔ (a > safe + margin ⇒ T level). θ′

2 ≔ (a < safe + margin ⇒ T climb).

θ3 ≔ (P level ⇒ a 0) ∧ (P climb ⇒ a rate). θ4 ≔ is delayed(del, T , P). This is an abbreviation for a longer logical condition. Can prove safe separation

∀(t : Time). ↓t

0(t > del + safe

rate ⇒ a ≥ safe).

21 / 22

slide-73
SLIDE 73

Conclusion

Outline

1 Introduction 2 The topos B of behavior types 3 Temporal type theory 4 Application to the NAS 5 Conclusion

Further reading

21 / 22

slide-74
SLIDE 74

Conclusion Further reading

If you’re interested in reading more

Two related books: Temporal Type Theory (Springer Berkha¨ user) Freely available: https://arxiv.org/abs/1710.10258 Technical parts, some friendly parts

22 / 22

slide-75
SLIDE 75

Conclusion Further reading

If you’re interested in reading more

Two related books: Temporal Type Theory (Springer Berkha¨ user) Freely available: https://arxiv.org/abs/1710.10258 Technical parts, some friendly parts Seven Sketches in Compositionality (Cambridge University Press?) Joint with Brendan Fong Freely available: https://arxiv.org/abs/1803.05316 Chapter 7 is about this material Totally friendly!

22 / 22

slide-76
SLIDE 76

Conclusion Further reading

If you’re interested in reading more

Two related books: Temporal Type Theory (Springer Berkha¨ user) Freely available: https://arxiv.org/abs/1710.10258 Technical parts, some friendly parts Seven Sketches in Compositionality (Cambridge University Press?) Joint with Brendan Fong Freely available: https://arxiv.org/abs/1803.05316 Chapter 7 is about this material Totally friendly! Questions and comments are welcome. Thanks!

22 / 22