A Resource-based Logic for Termination and Non-Termination Proofs Ton Chanh Le Cristian Gherghina Aquinas Hobor Wei-Ngan Chin National University of Singapore.

Slides:



Advertisements
Similar presentations
Hoare-style program verification K. Rustan M. Leino Guest lecturer Rob DeLines CSE 503, Software Engineering University of Washington 26 Apr 2004.
Advertisements

Logical Abstract Interpretation Sumit Gulwani Microsoft Research, Redmond.
Chapter 4: Control Structures I (Selection)
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Program verification: flowchart programs Book: chapter 7.
Program verification: flowchart programs Book: chapter 7.
Automated Verification with HIP and SLEEK Asankhaya Sharma.
Technology from seed Automatic Equivalence Checking of UF+IA Programs Nuno Lopes and José Monteiro.
Automated Verification with HIP and SLEEK Asankhaya Sharma.
PZ03D Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03D - Program verification Programming Language Design.
Copyright , Doron Peled and Cesare Tinelli. These notes are based on a set of lecture notes originally developed by Doron Peled at the University.
HIP/SLEEK11 HIP/SLEEK :Automatic Verification and Specification Inference System Wei-Ngan Chin & Asankhaya Sharma Dept of Computer Science National University.
Reasoning About Code; Hoare Logic, continued
11111 Functional Program Verification CS 4311 A. M. Stavely, Toward Zero Defect Programming, Addison-Wesley, Y. Cheon and M. Vela, A Tutorial on.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
© M. Winter COSC 4P41 – Functional Programming Testing vs Proving Testing –uses a set of “typical” examples, –symbolic testing, –may find errors,
Axiomatic Verification I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 17.
Partial correctness © Marcelo d’Amorim 2010.
CSE115/ENGR160 Discrete Mathematics 04/12/11 Ming-Hsuan Yang UC Merced 1.
Synergy: A New Algorithm for Property Checking
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Software Quality: Testing and Verification II. 2 1.A failure is an unacceptable behaviour exhibited by a system — The frequency of failures measures software.
Software Verification Bertrand Meyer Chair of Software Engineering Lecture 2: Axiomatic semantics.
Describing Syntax and Semantics
Cristian Gherghina Joint work with: Wei-Ngan Chin, Razvan Voicu, Quang Loc Le Florin Craciun, Shengchao Qin TexPoint fonts used in EMF. Read the TexPoint.
Pre/Post Condition Logic 03/06/2013. Agenda Hoare’s Logic Overview Application to Pre/Post Conditions.
Automatic Verification of Pointer Programs using Grammar-based Shape Analysis Hongseok Yang Seoul National University (Joint Work with Oukseh Lee and Kwangkeun.
Aquinas Hobor and Cristian Gherghina (National University of Singapore) TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
Chapter 3 (Part 3): Mathematical Reasoning, Induction & Recursion  Recursive Algorithms (3.5)  Program Correctness (3.6)
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 4 (Part 3): Mathematical Reasoning, Induction.
Program Analysis with Dynamic Change of Precision Dirk Beyer Tom Henzinger Grégory Théoduloz Presented by: Pashootan Vaezipoor Directed Reading ASE 2008.
CSI 3125, Axiomatic Semantics, page 1 Axiomatic semantics The assignment statement Statement composition The "if-then-else" statement The "while" statement.
Axiomatic Methods for Software Verification Hongseok Yang.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
CS 363 Comparative Programming Languages Semantics.
Program Correctness. 2 Program Verification An object is a finite state machine: –Its attribute values are its state. –Its methods optionally: Transition.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Joseph E. Hollingsworth
Cristian Gherghina 1, Cristina David 1, Shengchao Qin 2, Wei-Ngan Chin 1 1 National University of Singapore 2 University of Teesside Structured Specifications.
Recursive Algorithms &
Program Analysis and Verification Spring 2014 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Chapter 3 Part II Describing Syntax and Semantics.
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen.
Proving Non-Termination Gupta, Henzinger, Majumdar, Rybalchenko, Ru-Gang Xu presentation by erkan.
13 Aug 2013 Program Verification. Proofs about Programs Why make you study logic? Why make you do proofs? Because we want to prove properties of programs.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
VPERM: Variable Permissions for Concurrency Verification Duy-Khanh Le, Wei-Ngan Chin, Yong-Meng Teo ICFEM, Kyoto, Japan, Nov 2012.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Spring 2017 Program Analysis and Verification
Chapter 4 (Part 3): Mathematical Reasoning, Induction & Recursion
Proving Loops Testing debugging and verification
Mathematical Structures for Computer Science Chapter 1
Relatively Complete Refinement Type System for Verification of Higher-Order Non-deterministic Programs Hiroshi Unno (University of Tsukuba) Yuki Satake.
Lecture 5 Floyd-Hoare Style Verification
Axiomatic semantics Points to discuss: The assignment statement
Programming Languages and Compilers (CS 421)
Programming Languages 2nd edition Tucker and Noonan
Axiomatic Verification I
Predicate Transformers
Formal Methods in software development
Axiomatic Verification I
X y y = x2 - 3x Solutions of y = x2 - 3x y x –1 5 –2 –3 6 y = x2-3x.
Predicate Transforms II
BLAST: A Software Verification Tool for C programs
Programming Languages 2nd edition Tucker and Noonan
COP4020 Programming Languages
Data Structures & Programming
Presentation transcript:

A Resource-based Logic for Termination and Non-Termination Proofs Ton Chanh Le Cristian Gherghina Aquinas Hobor Wei-Ngan Chin National University of Singapore 1ICFEM 2014

A Resource-based Logic for Termination and Non-Termination Proofs ICFEM 20142

Hoare Logic for Partial Correctness Proving Partial Correctness ICFEM 20143

Hoare Logic for Total Correctness Proving Termination ICFEM 20144

Hoare Logic for Total Correctness Proving Non-Termination ICFEM 20145

(Non-)Termination Specification “So-called partial correctness is inadequate: if a program is intended to terminate, that fact must be part of its specification.” – Cliff Jones Non-termination specification is also important for More comprehensive specifications to understand program better A clearer distinction between expected non-termination and failure of termination proofs ICFEM 20146

Research Questions requires x ≥ 0  y < 0 variance x ensures true; requires x ≥ 0  y ≥ 0 ensures false; ICFEM Is the separation between termination and non- termination specifications good? while (x ≥ 0) { x = x + y; }

Research Questions requires x ≥ 0  y < 0 variance x ensures true; requires x ≥ 0  y ≥ 0 ensures false; ICFEM How can the termination and non-termination specifications be unified? while (x ≥ 0) { x = x + y; }

A Unified Specification Logic A unified logical foundation for both termination and non-termination reasoning Integration of termination and non-termination specifications into expressive logics for functional correctness and safety verification ICFEM 20149

Temporal Predicates Term M : termination Loop : definite non-termination MayLoop : possible non-termination ICFEM

Example while (x ≥ 0) { x = x + y; } requires (x ≥ 0  y < 0  Term[x])  (x ≥ 0  y ≥ 0  Loop) ensures (x ≥ 0  y ≥ 0  false); ICFEM

Example while (x ≥ 0) { x = x + y; } case { x requires Term ensures true; x ≥ 0 -> case { y ≥ 0 -> requires Loop ensures false; y requires Term[x] ensures true; } ICFEM

A Resource-based Logic for Termination and Non-Termination Proofs ICFEM

Foundation for Specification Logic Solution: Consider non-termination and termination as resources. Our proposal: A new logic for consumable resources which captures the concept of resource capacity; tracking both minimum and maximum of resource usage ICFEM

Resource Assertions ICFEM

Temporal Entailment ICFEM

Flow-Insensitive Temporal Entailment ICFEM

HipTNT: A Termination Verification System ICFEM

HipTNT+: A Termination Inference System void loop (int x, int y) { if (x < 0) return; else loop(x + y, y); } ICFEM

HipTNT+: A Termination Inference System void loop (int x, int y) { if (x < 0) return; else loop(x + y, y - 1); } ICFEM

HipTNT+: A Termination Inference System int Ack(int m, int n) { if (m == 0) return n + 1; else if (n == 0) return Ack(m-1, 1); else return Ack(m-1, Ack(m, n-1)); } ICFEM

HipTNT+: A Termination Inference System int Ack(int m, int n) case { m requires Loop ensures false; m = 0 -> requires Term ensures res = n + 1; m > 0  n requires Loop ensures false; m > 0  n ≥ 0 -> requires Term[m, n] ensures res ≥ n + 1; } ICFEM

Conclusions “Termination and Non-Termination as Resources” provides a unified framework to combine both partial correctness and (non-)termination verification The termination inference can benefit from mechanisms developed for safety verification, such as shape inference ICFEM