From Shape Analysis to to Termination Analysis in in Lin inear Tim ime Roman Manevich Ben-Gurion University of the Negev Noam Rinetzky Tel Aviv University Boris Dogadov Tel Aviv University
UPGRADE YOUR SHAPE ANALYSIS 2
UPGRADE YOUR SHAPE ANALYSIS START PROVING TOTAL CORRECTNESS TODAY 2
UPGRADE YOUR SHAPE ANALYSIS START PROVING TOTAL CORRECTNESS TODAY FOR JUST 5% OF THE RUNNING TIME 2
Research problem • Automatically verify termination of heap-manipulating programs • Dynamic memory allocation • Destructive updates • Applications • Systems codes, e.g., Windows device drivers containing linked data structures: lists, trees, etc. • Object-oriented programs utilizing containers: sets, maps, and graphs 3
Scalability “dimensions” Shape complexity (complexity of heap invariants) PL features overlaid hierarchical numeric data containers concurrency recursive recursion Code size 4
Classic approach Heap-manipulating Program Instrumented Shape Analyzer Safety property Integer Program Always terminates Termination [Berdine et al. CAV 2006] [Berdine et al. POPL 2007] Analyzer [Magill et al. POPL 2010] May not terminate 5
Classic approach Shape analysis-specific Heap-manipulating Program Instrumented Shape Analyzer Safety property Integer Program Always terminates Termination [Berdine et al. CAV 2006] [Berdine et al. POPL 2007] Analyzer [Magill et al. POPL 2010] May not terminate 5
Classic approach Shape analysis-specific Heap-manipulating Program Termination undecidable Instrumented Shape Analyzer Safety property Integer Program Always terminates Termination [Berdine et al. CAV 2006] [Berdine et al. POPL 2007] Analyzer [Magill et al. POPL 2010] May not terminate 5
Classic approach Shape analysis-specific Heavyweight Heap-manipulating Program Termination undecidable Instrumented Shape Analyzer Safety property Integer Program Always terminates Termination [Berdine et al. CAV 2006] [Berdine et al. POPL 2007] Analyzer [Magill et al. POPL 2010] May not terminate 5
Classic approach Shape analysis-specific Heavyweight Heap-manipulating Program Termination undecidable Instrumented Shape Analyzer Safety property TRS Integer Program Always terminates Termination [AProVE Giesl et al. [Berdine et al. CAV 2006] CAV 2012, RTA 2011, [Berdine et al. POPL 2007] Analyzer IJCAR 2014] [Magill et al. POPL 2010] May not terminate 5
Classic approach Shape analysis-specific Heavyweight Heap-manipulating Program Termination undecidable Instrumented Shape Analyzer Safety property TRS Integer Program Logic Program Always terminates Termination [AProVE Giesl et al. [Berdine et al. CAV 2006] [Albert et al. FMOOBDS 2008] CAV 2012, RTA 2011, [Berdine et al. POPL 2007] Analyzer [Spoto et al. TOPLAS 2010] IJCAR 2014] [Magill et al. POPL 2010] May not terminate 5
Classic approach Naughty idea: Once shape Shape analysis-specific analysis does the heavy lifting termination is easy Heavyweight Heap-manipulating Program Termination undecidable Instrumented Shape Analyzer Safety property TRS Integer Program Logic Program Always terminates Termination [AProVE Giesl et al. [Berdine et al. CAV 2006] [Albert et al. FMOOBDS 2008] CAV 2012, RTA 2011, [Berdine et al. POPL 2007] Analyzer [Spoto et al. TOPLAS 2010] IJCAR 2014] [Magill et al. POPL 2010] May not terminate 5
Our solution Abstract transition relation Heap-manipulating Program Partition-based Shape Analyzer Safety property Evolution relation Always terminates Termination Analyzer May not terminate 6
Our solution Most shape analyses (Sep. Logic, TVLA, Boolean heaps, TRS) Abstract transition relation Heap-manipulating Program Partition-based Shape Analyzer Safety property Evolution relation Always terminates Termination Analyzer May not terminate 6
Our solution Most shape analyses (Sep. Logic, TVLA, Boolean heaps, TRS) Abstract transition relation Heap-manipulating Program Partition-based Shape Analyzer Safety property Evolution relation Always terminates Termination Analyzer May not terminate Easy to implement Induced by shape analysis 6
Our solution Most shape analyses Termination checked (Sep. Logic, TVLA, Boolean heaps, TRS) in linear time Abstract transition relation Heap-manipulating Program Partition-based Shape Analyzer Safety property Evolution relation Always terminates Termination Analyzer May not terminate Easy to implement Induced by shape analysis 6
Main results 7
Main results 1. Termination analysis parametrized by partition-based shape analysis • Enables handling wide range of shape invariants (both inductive data structures and unstructured graphs) 7
Main results 1. Termination analysis parametrized by partition-based shape analysis Shape • Enables handling wide range of shape invariants complexity (both inductive data structures and unstructured graphs) 7
Main results 1. Termination analysis parametrized by partition-based shape analysis Shape • Enables handling wide range of shape invariants complexity (both inductive data structures and unstructured graphs) • Novel ranking function based on evolution relation 7
Main results 1. Termination analysis parametrized by partition-based shape analysis Shape • Enables handling wide range of shape invariants complexity (both inductive data structures and unstructured graphs) • Novel ranking function based on evolution relation 3. Featherweight analysis • Linear time modulo shape analysis • Modular 7
Main results 1. Termination analysis parametrized by partition-based shape analysis Shape • Enables handling wide range of shape invariants complexity (both inductive data structures and unstructured graphs) • Novel ranking function based on evolution relation 3. Featherweight analysis Code size • Linear time modulo shape analysis • Modular 7
Main results 1. Termination analysis parametrized by partition-based shape analysis Shape • Enables handling wide range of shape invariants complexity (both inductive data structures and unstructured graphs) • Novel ranking function based on evolution relation 3. Featherweight analysis Code size • Linear time modulo shape analysis • Modular 4. Handles recursion very precisely • Limited support for concurrency 7
Main results 1. Termination analysis parametrized by partition-based shape analysis Shape • Enables handling wide range of shape invariants complexity (both inductive data structures and unstructured graphs) • Novel ranking function based on evolution relation 3. Featherweight analysis Code size • Linear time modulo shape analysis • Modular 4. Handles recursion very precisely PL features • Limited support for concurrency 7
Main results 1. Termination analysis parametrized by partition-based shape analysis Shape • Enables handling wide range of shape invariants complexity (both inductive data structures and unstructured graphs) • Novel ranking function based on evolution relation 3. Featherweight analysis Code size • Linear time modulo shape analysis • Modular 4. Handles recursion very precisely PL features • Limited support for concurrency 5. Precise enough on a variety of benchmarks 7
Agenda • Our recipe for proving termination • Apply recipe for shape analysis • Handling nested loops and recursion • Experiments and conclusion 8
Reminder: general recipe for proving termination To show that a transition system ( , ) does not contain infinite paths: 9
Reminder: general recipe for proving termination To show that a transition system ( , ) does not contain infinite paths: 1. Find well-founded ordering : (all descending chains finite) 9
Reminder: general recipe for proving termination To show that a transition system ( , ) does not contain infinite paths: 1. Find well-founded ordering : (all descending chains finite) 2. Show that every infinite path must contain an infinite -descending chain * * * * 1 i k j 9
Our recipe To show that a transition system ( , ) does not contain infinite paths: 10
Our recipe To show that a transition system ( , ) does not contain infinite paths: 1. Find well-founded ordering : that is monotone: ’ ’ 10
Our recipe To show that a transition system ( , ) does not contain infinite paths: 1. Find well-founded ordering : that is monotone: ’ ’ 2. Compute a ( finite ) abstract transition system ( , ) 10
Our recipe To show that a transition system ( , ) does not contain infinite paths: 1. Find well-founded ordering : that is monotone: ’ ’ 2. Compute a ( finite ) abstract transition system ( , ) 3. Find all decreasing transitions := {} for each ’ do if ’ then := ( , ’ ) fi od // linear time 10
Recommend
More recommend