propositional dynamic logic for higher-order functional...
TRANSCRIPT
Propositional Dynamic Logic for Higher-Order Functional Programs
Yuki Satake (University of Tsukuba)Hiroshi Unno (University of Tsukuba)
CAV'18, Oxford, United Kingdom 1
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 ∶ 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭 → 𝐭𝐭𝐢𝐢𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙)
Example: Higher-Order Program
CAV'18, Oxford, United Kingdom 6
𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢
𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0
Non-deterministic integer
Example: Higher-Order Program
CAV'18, Oxford, United Kingdom 6
𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢
𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0
Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭
Non-deterministic integer
Example: Higher-Order Program
CAV'18, Oxford, United Kingdom 6
𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢
𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0
Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭
Non-deterministic integer
Example: Higher-Order Program
CAV'18, Oxford, United Kingdom 6
𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢
𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0
→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎
Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭
Non-deterministic integer
Example: Higher-Order Program
CAV'18, Oxford, United Kingdom 6
𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢
𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0
→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)
Higher-Order function 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭
Non-deterministic integer
Example: Higher-Order Program
CAV'18, Oxford, United Kingdom 6
𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝒇𝒇 𝒙𝒙 = 𝒇𝒇 (𝒇𝒇 𝒙𝒙) 𝐭𝐭𝐢𝐢
𝐥𝐥𝐭𝐭𝐭𝐭 𝒓𝒓 = ∗ 𝐭𝐭𝐢𝐢𝐥𝐥𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒙𝒙 = 𝒙𝒙 + 𝟏𝟏 𝐭𝐭𝐢𝐢
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝒓𝒓
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎Higher Order Program Reduction Sequence for r=0
→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
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
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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
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
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
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
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
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
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
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
Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎
CAV'18, Oxford, United Kingdom 18
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎
CAV'18, Oxford, United Kingdom 19
𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎
CAV'18, Oxford, United Kingdom 19
𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
The function passed to a higher-order
function
Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎
CAV'18, Oxford, United Kingdom 20
call twice,● 𝐫𝐫𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎
CAV'18, Oxford, United Kingdom 20
call twice,● 𝐫𝐫𝐭𝐭𝐭𝐭 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,●
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
The function returned by a
higher-order function
Example: Event sequence of 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎
CAV'18, Oxford, United Kingdom 21
call twice,● ret twice,● 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 ●,𝟎𝟎
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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)
𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭 𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎→ (𝛌𝛌𝛌𝛌. 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝛌𝛌)) 𝟎𝟎→ 𝐭𝐭𝐢𝐢𝐭𝐭 (𝐭𝐭𝐢𝐢𝐭𝐭 𝟎𝟎)→∗ 𝐭𝐭𝐢𝐢𝐭𝐭 𝟏𝟏 →∗ 𝟐𝟐
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)
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)
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)
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
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
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 ●
• 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 𝒓𝒓𝟐𝟐
• 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 𝒓𝒓𝟐𝟐
• 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 𝜋𝜋
• 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
• 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
• 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
• 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
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)
𝝅𝝅 ∷=→ →𝒓𝒓𝒓𝒓𝒓𝒓 →𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 | 𝝅𝝅𝟏𝟏 ⋅ 𝝅𝝅𝟐𝟐 𝝅𝝅𝟏𝟏 + 𝝅𝝅𝟐𝟐| 𝝅𝝅∗ 𝜙𝜙 ?
• 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
• 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
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
→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙
⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙
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
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)
→∗ �𝒙𝒙 ∈ ℤ𝒃𝒃𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭𝐭,� ∧ →𝐫𝐫𝐭𝐭𝐭𝐭⋅→𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙
⇒ →𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 𝐭𝐭𝐜𝐜𝐥𝐥𝐥𝐥 �,𝒙𝒙
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
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
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
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
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,●
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,●
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,●
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,●
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,●
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,●
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,●
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