propositional dynamic logic for higher-order functional...

67
Propositional Dynamic Logic for Higher-Order Functional Programs Yuki Satake (University of Tsukuba) Hiroshi Unno (University of Tsukuba) CAV'18, Oxford, United Kingdom 1

Upload: others

Post on 18-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Propositional Dynamic Logic for Higher-Order Functional Programs

Yuki Satake (University of Tsukuba)Hiroshi Unno (University of Tsukuba)

CAV'18, Oxford, United Kingdom 1

Page 2: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 2

• Support in Programming Languages:• OCaml, Haskell, Rust• Jave(+1.8), Scala, Ruby, Python

Contribute significantly to modularity

• A higher-order function takes a function as its argument and/or returns a function as its return value

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)

Page 3: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 3

• Support in Programming Languages:• OCaml, Haskell, Rust• Jave(+1.8), Scala, Ruby, Python

Contribute significantly to modularity

• A higher-order function takes a function as its argument and/or returns a function as its return value

takes a function as its argument

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)

Page 4: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 4

• Support in Programming Languages:• OCaml, Haskell, Rust• Jave(+1.8), Scala, Ruby, Python

Contribute significantly to modularity

returns a function as its result

• A higher-order function takes a function as its argument and/or returns a function as its return value

takes a function as its argument

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)

Page 5: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 5

• Support in Programming Languages:• OCaml, Haskell, Rust• Jave(+1.8), Scala, Ruby, Python

Contribute significantly to modularity

returns a function as its result

• A higher-order function takes a function as its argument and/or returns a function as its return value

takes a function as its argument

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)

Page 6: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Higher-Order Program

CAV'18, Oxford, United Kingdom 6

𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢

𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0

Page 7: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Non-deterministic integer

Example: Higher-Order Program

CAV'18, Oxford, United Kingdom 6

𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢

𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0

Page 8: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭

Non-deterministic integer

Example: Higher-Order Program

CAV'18, Oxford, United Kingdom 6

𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢

𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0

Page 9: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭

Non-deterministic integer

Example: Higher-Order Program

CAV'18, Oxford, United Kingdom 6

𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢

𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0

→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎

Page 10: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭

Non-deterministic integer

Example: Higher-Order Program

CAV'18, Oxford, United Kingdom 6

𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢

𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0

→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)

Page 11: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭

Non-deterministic integer

Example: Higher-Order Program

CAV'18, Oxford, United Kingdom 6

𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢

𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0

→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 12: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Temporal Verification of Higher-Order Programs

• Specification languages used in existing verification methods• (𝝎𝝎-)regular word languages (that subsume LTL) [Disney+ ’11; Hofmann+ ’14; Murase+ ’16]• Modal 𝝁𝝁-calculus (that subsumes CTL) [Fujima+ ’13; Lester+ ’11; Suzuki+ ’17]• (Extended) dependent refinement types

• Temporal properties [Koskinen+ ’14; Nanjo+ ’18]• Temporal and branching properties [Unno+ ’18]

CAV'18, Oxford, United Kingdom 7

Page 13: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Temporal Verification of Higher-Order Programs

• Specification languages used in existing verification methods• (𝝎𝝎-)regular word languages (that subsume LTL) [Disney+ ’11; Hofmann+ ’14; Murase+ ’16]• Modal 𝝁𝝁-calculus (that subsumes CTL) [Fujima+ ’13; Lester+ ’11; Suzuki+ ’17]• (Extended) dependent refinement types

• Temporal properties [Koskinen+ ’14; Nanjo+ ’18]• Temporal and branching properties [Unno+ ’18]

CAV'18, Oxford, United Kingdom 7

they cannot sufficiently express temporal specifications that involve higher-order functions

Page 14: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 8

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 15: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 8

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 16: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 9

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 17: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 10

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 18: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 11

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 19: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 12

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 20: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 13

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 21: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Previous languages cannot refer tothe control flow of higher-order programs involving a function that

is passed to or returned by a higher-order function

Example: Property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

CAV'18, Oxford, United Kingdom 14

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 22: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Our Contributions

• Higher-Order Trace (HOT) that captures the control flow of higher-order programs

• Higher-Order Trace Propositional Dynamic Logic (HOT-PDL):• Propositional Dynamic Logic (PDL) over HOTs for specifying temporal

properties of higher-order programs• Decidability of HOT-PDL model checking of higher-order

programs via a reduction to higher-order model checking(See the paper for details)

• Applications (See the paper for details)• Modeling and extending dependent refinement types• Modeling and extending stack-based access control properties

CAV'18, Oxford, United Kingdom 15

Page 23: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Our Contributions

• Higher-Order Trace (HOT) that captures the control flow of higher-order programs

• Higher-Order Trace Propositional Dynamic Logic (HOT-PDL):• Propositional Dynamic Logic (PDL) over HOTs for specifying temporal

properties of higher-order programs• Decidability of HOT-PDL model checking of higher-order

programs via a reduction to higher-order model checking (See the paper for details)

• Applications (See the paper for details)• Modeling and extending dependent refinement types• Modeling and extending stack-based access control properties

CAV'18, Oxford, United Kingdom 16

Page 24: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Trace (HOT)

• A sequence of call and return events equipped with two kinds of pointers:

• Call and return events• call(𝑓𝑓,𝑥𝑥): a call event of the function 𝑓𝑓 with the argument 𝑥𝑥.• ret(𝑓𝑓, 𝑥𝑥): a return event of the function 𝑓𝑓 with the return value 𝑥𝑥.

• Two kinds of pointers labeled with:• CR : capture the correspondence between call and return events• CC, RC: capture higher-order control flow involving a function

that is passed to or returned by a higher-order function

CAV'18, Oxford, United Kingdom 17

Inspired by the notion of justification pointers from the game semantics of PCF

Page 25: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Trace (HOT)

• A sequence of call and return events equipped with two kinds of pointers:

• Call and return events• call(𝑓𝑓,𝑥𝑥): a call event of the function 𝑓𝑓 with the argument 𝑥𝑥.• ret(𝑓𝑓, 𝑥𝑥): a return event of the function 𝑓𝑓 with the return value 𝑥𝑥.

• Two kinds of pointers labeled with:• CR : capture the correspondence between call and return events• CC, RC: capture higher-order control flow involving a function

that is passed to or returned by a higher-order function

CAV'18, Oxford, United Kingdom 17

Inspired by the notion of justification pointers from the game semantics of PCF

Page 26: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Trace (HOT)

• A sequence of call and return events equipped with two kinds of pointers:

• Call and return events• call(𝑓𝑓,𝑥𝑥): a call event of the function 𝑓𝑓 with the argument 𝑥𝑥.• ret(𝑓𝑓, 𝑥𝑥): a return event of the function 𝑓𝑓 with the return value 𝑥𝑥.

• Two kinds of pointers labeled with:• CR : capture the correspondence between call and return events• CC, RC: capture higher-order control flow involving a function

that is passed to or returned by a higher-order function

CAV'18, Oxford, United Kingdom 17

Inspired by the notion of justification pointers from the game semantics of PCF

Page 27: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Trace (HOT)

• A sequence of call and return events equipped with two kinds of pointers:

• Call and return events• call(𝑓𝑓,𝑥𝑥): a call event of the function 𝑓𝑓 with the argument 𝑥𝑥.• ret(𝑓𝑓, 𝑥𝑥): a return event of the function 𝑓𝑓 with the return value 𝑥𝑥.

• Two kinds of pointers labeled with:• CR : capture the correspondence between call and return events• CC, RC: capture higher-order control flow involving a function

that is passed to or returned by a higher-order function

CAV'18, Oxford, United Kingdom 17

Inspired by the notion of justification pointers from the game semantics of PCF

Page 28: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Trace (HOT)

• A sequence of call and return events equipped with two kinds of pointers:

• Call and return events• call(𝑓𝑓,𝑥𝑥): a call event of the function 𝑓𝑓 with the argument 𝑥𝑥.• ret(𝑓𝑓, 𝑥𝑥): a return event of the function 𝑓𝑓 with the return value 𝑥𝑥.

• Two kinds of pointers labeled with:• CR : capture the correspondence between call and return events• CC, RC: capture higher-order control flow involving a function

that is passed to or returned by a higher-order function

CAV'18, Oxford, United Kingdom 17

Inspired by the notion of justification pointers from the game semantics of PCF

Page 29: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Trace (HOT)

• A sequence of call and return events equipped with two kinds of pointers:

• Call and return events• call(𝑓𝑓,𝑥𝑥): a call event of the function 𝑓𝑓 with the argument 𝑥𝑥.• ret(𝑓𝑓, 𝑥𝑥): a return event of the function 𝑓𝑓 with the return value 𝑥𝑥.

• Two kinds of pointers labeled with:• CR : capture the correspondence between call and return events• CC, RC: capture higher-order control flow involving a function

that is passed to or returned by a higher-order function

CAV'18, Oxford, United Kingdom 17

Inspired by the notion of justification pointers from the game semantics of PCF

Page 30: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 18

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 31: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 19

𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 32: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 19

𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

The function passed to a higher-order

function

Page 33: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 20

call twice,● 𝐫𝐫𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 34: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 20

call twice,● 𝐫𝐫𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

The function returned by a

higher-order function

Page 35: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 21

call twice,● ret twice,● 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 ●,𝟎𝟎

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 36: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 22

call twice,● ret twice,● call ●, 0 call ●, 0call inc, 0 ret inc, 1 ret ●, 1 call ●, 1call inc, 1 ret inc, 2 ret ●, 2 ret(●, 2)

𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐

Page 37: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: HOT that models the reduction sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 23

call twice,●ret twice,●

call ●, 0call ●, 0call inc, 0ret inc, 1ret ●, 1call ●, 1call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Page 38: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: HOT that models the reduction sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 24

Correspondence between call and return events

CR

CR

call twice,●ret twice,●

call ●, 0call ●, 0call inc, 0ret inc, 1ret ●, 1call ●, 1call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Page 39: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example: HOT that models the reduction sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎

CAV'18, Oxford, United Kingdom 25

Correspondence between call and return events

CR

CR

CC

CC

RCHigher-order control

flowCC : call of the

function passed to a higher-order

functionRC : call of the

function returned by a higher-order

function

call twice,●ret twice,●

call ●, 0call ●, 0call inc, 0ret inc, 1ret ●, 1call ●, 1call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Page 40: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Our Contributions

• Higher-Order Trace (HOT) that captures the control flow of higher-order programs

• Higher-Order Trace Propositional Dynamic Logic (HOT-PDL):• Propositional Dynamic Logic (PDL) over HOTs for specifying temporal

properties of higher-order programs• Decidability of HOT-PDL model checking of higher-order

programs via a reduction to higher-order model checking (See the paper for details)

• Applications (See the paper for details)• Modeling and extending dependent refinement types• Modeling and extending stack-based access control properties

CAV'18, Oxford, United Kingdom 26

Page 41: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Propositional Dynamic Logic (HOT-PDL)

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

CAV'18, Oxford, United Kingdom 27

Page 42: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Propositional Dynamic Logic (HOT-PDL)

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

CAV'18, Oxford, United Kingdom 27

Any of top-level functions 𝑓𝑓, bounded integers 𝒏𝒏 ∈ ℤ𝒃𝒃, or anonymous functions ●

Page 43: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 28

A call event of a function 𝒓𝒓𝟏𝟏 with an argument 𝒓𝒓𝟐𝟐

Page 44: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 29

A return event of a function 𝒓𝒓𝟏𝟏 with a return value 𝒓𝒓𝟐𝟐

Page 45: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 30

Box: 𝜙𝜙 holds at every node reached by the path represented by 𝜋𝜋

Page 46: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 31

Diamond: there exists a node that can be reached by 𝜋𝜋 and 𝜙𝜙 holds

Page 47: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 32

alternation Kleene starConcatenation

Page 48: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 33

tests if 𝜙𝜙 holds at the current node

Page 49: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 34

move to the next event in the sequence

Page 50: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 35

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Page 51: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 36

traverse an edge labeled with CR

Page 52: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

• To traverse the pointers, HOT-PDL extends PDL with new path expressions (→𝒓𝒓𝒓𝒓𝒓𝒓,→𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄)

• Each node of a HOT is assigned a truth value indicating whether the given formula is satisfied

• Syntax:• (Formulas)

𝝓𝝓 ∷= 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 𝐫𝐫𝐭𝐭𝐭𝐭 𝒓𝒓𝟏𝟏, 𝒓𝒓𝟐𝟐 … 𝝅𝝅 𝝓𝝓 𝝅𝝅 𝝓𝝓• (Path expression)

𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?

Higher-Order Propositional Dynamic Logic (HOT-PDL)

CAV'18, Oxford, United Kingdom 37

traverse an edge labeled with CC or RC

Page 53: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example : The property that cannot be expressed by the previous specification languages

CAV'18, Oxford, United Kingdom 38

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

Page 54: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example : The property that cannot be expressed by the previous specification languages

CAV'18, Oxford, United Kingdom 38

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙ℤ𝒃𝒃 : bounded

integers

Page 55: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Example : The property that cannot be expressed by the previous specification languages

CAV'18, Oxford, United Kingdom 38

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙ℤ𝒃𝒃 : bounded

integers →∗ 𝝓𝝓 = 𝐆𝐆𝝓𝝓(in LTL)

Page 56: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

CAV'18, Oxford, United Kingdom 39

Globally, for all bounded integer x,

Example : The property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

Page 57: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 40

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

If the function twice is called

Example : The property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

Page 58: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 41

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

and the function returned by twice is called with an argument x,

Example : The property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

Page 59: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 42

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

then the function argument passed to twice is eventually called with the argument x

Example : The property that cannot be expressed by the previous specification languages

If the function returned by a partial application of twice to some function is called with some integer n, then the function argument passed to twice is eventually called with n

Page 60: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 43

CR

CR

CC

CC

RCcall twice,●ret twice,●

call ●, 0call ●, 0

call inc, 0ret inc, 1ret ●, 1call ●, 1

call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Example : The property that cannot be expressed by the previous specification languages

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

The formula holds at the node labeled with the event call twice,●

Page 61: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 44

CR

CR

CC

CC

RCcall twice,●ret twice,●

call ●, 0call ●, 0

call inc, 0ret inc, 1ret ●, 1call ●, 1

call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Example : The property that cannot be expressed by the previous specification languages

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

The formula holds at the node labeled with the event call twice,●

Page 62: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 45

CR

CR

CC

CC

RCcall twice,●ret twice,●

call ●, 0call ●, 0

call inc, 0ret inc, 1ret ●, 1call ●, 1

call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Example : The property that cannot be expressed by the previous specification languages

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

The formula holds at the node labeled with the event call twice,●

Page 63: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 46

CR

CC

CC

RCcall twice,●ret twice,●

call ●, 0call ●, 0

call inc, 0ret inc, 1ret ●, 1call ●, 1

call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Example : The property that cannot be expressed by the previous specification languages

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

CR

The formula holds at the node labeled with the event call twice,●

Page 64: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 47

CR

CC

CC

RCcall twice,●ret twice,●

call ●, 0call ●, 0

call inc, 0ret inc, 1ret ●, 1call ●, 1

call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Example : The property that cannot be expressed by the previous specification languages

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

𝒙𝒙 = 𝟎𝟎CR

The formula holds at the node labeled with the event call twice,●

Page 65: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 48

CR

CR

CC

CC

RCcall twice,●ret twice,●

call ●, 0call ●, 0

call inc, 0ret inc, 1ret ●, 1call ●, 1

call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Example : The property that cannot be expressed by the previous specification languages

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

𝒙𝒙 = 𝟎𝟎

The formula holds at the node labeled with the event call twice,●

Page 66: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

CAV'18, Oxford, United Kingdom 49

CR

CR

CC

CC

RCcall twice,●ret twice,●

call ●, 0call ●, 0

call inc, 0ret inc, 1ret ●, 1call ●, 1

call inc, 1ret inc, 2ret ●, 2ret(●, 2)

Example : The property that cannot be expressed by the previous specification languages

→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙

𝒙𝒙 = 𝟎𝟎

𝒙𝒙 = 𝟎𝟎

The formula holds at the node labeled with the event call twice,●

Page 67: Propositional Dynamic Logic for Higher-Order Functional ...logic.cs.tsukuba.ac.jp/~satake/slides/cav2018slides.pdf · Propositional Dynamic Logic for Higher-Order Functional Programs

Conclusion

• HOT captures the control flow of higher-order programs• HOT-PDL is an extension of PDL defined over HOTs

• Enables a precise specification of temporal trace properties for higher-order programs

• Provides a foundation for specification in various application domains • stack-based access control properties• dependent refinement types

• HOT-PDL model checking of higher-order programs is shown decidable via a reduction to higher-order model checking

• Future work: extend HOTs with new kinds of events and pointers for capturing call-by-name and/or effectfulcomputations by incorporating more ideas from game semantics

CAV'18, Oxford, United Kingdom 50