Extension of Separation Logic for Stack Reasoning Jiang Xinyu.

Slides:



Advertisements
Similar presentations
Soundness of Higher-order Frame Rules (How did category theory help me?) Hongseok Yang Seoul National University Joint work with Lars Birkedal and Noah.
Advertisements

Introduction to Proofs
AE1APS Algorithmic Problem Solving John Drake
Techniques for proving programs with pointers A. Tikhomirov.
The Pumping Lemma for CFL’s
Review of Probability. Definitions (1) Quiz 1.Let’s say I have a random variable X for a coin, with event space {H, T}. If the probability P(X=H) is.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
6 6.1 © 2012 Pearson Education, Inc. Orthogonality and Least Squares INNER PRODUCT, LENGTH, AND ORTHOGONALITY.
CS 454 Theory of Computation Sonoma State University, Fall 2011 Instructor: B. (Ravi) Ravikumar Office: 116 I Darwin Hall Original slides by Vahid and.
On the Relationship Between Concurrent Separation Logic and Assume-Guarantee Reasoning Xinyu Feng Yale University Joint work with Rodrigo Ferreira and.
After today Week 9 –Tu: Pat Rondon –Th: Ravi/Nathan Week 10 –Tu: Nathan/Ravi –Th: Class canceled Finals week –Th: Zach, John.
Describing Syntax and Semantics
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Introduction Using the Pythagorean Theorem to solve problems provides a familiar example of a relationship between variables that involve radicals (or.
Pointers Applications
Propositional Calculus Math Foundations of Computer Science.
CENG 311 Machine Representation/Numbers
Discrete Mathematics and Its Applications
Towers of Hanoi. Introduction This problem is discussed in many maths texts, And in computer science an AI as an illustration of recursion and problem.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
Table of Contents Solving Linear Systems of Equations - Dependent Systems The goal in solving a linear system of equations is to find the values of the.
© Andrew IrelandDependable Systems Group Cooperative Reasoning for Automatic Software Verification Andrew Ireland School of Mathematical & Computer Sciences.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
A Certifying Compiler and Pointer Logic Zhaopeng Li Software Security Lab. Department of Computer Science and Technology, University of Science and Technology.
Review of Definitions.
 Solve and algebraic equation and provide a justification for each step.  Identify which property of equality or congruence is being used.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
8.4 Mathematical Induction
5.2: Solving Systems of Equations using Substitution
Data Structures and Algorithm Analysis Introduction Lecturer: Ligang Dong, egan Tel: , Office: SIEE Building.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Solving Systems of Equations: The Elimination Method Solving Systems of Equations: The Elimination Method Solving Systems of Equations: The Elimination.
Bell Work: Simplify: √500,000,000. Answer: 10,000√5.
Do Now (3x + y) – (2x + y) 4(2x + 3y) – (8x – y)
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
We will now study some special kinds of non-standard quantifiers. Definition 4. Let  (x),  (x) be two fixed formulae of a language L n such that x is.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
Chapter 11 Sequences and Series
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
1 Lecture 5 PVS commands. 2 Last week Logical formalisms, first-order logic (syntax, semantics). Introduction to PVS. Language of PVS. Proving sequents.
Prove Your Proof! UNIT 2. Do Now Solve the following one variable equations: ◦4m – 8 = -12 ◦X – 3.5 = 8.7 ◦4x – 7 = 8x + 3 ◦(x+8)/5 = -6 ◦2(x – 5) – 20.
Computer Systems Laboratory Stanford University Clark W. Barrett David L. Dill Aaron Stump A Framework for Cooperating Decision Procedures.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Mostly-Automated Verification of Low-Level Programs in Computational Separation Logic Adam Chlipala Harvard University PLDI 2011.
Warm UP: Solve the following systems of equations:
Context-Free Grammars: an overview
Solving Systems of Linear Equations by Addition
Matching Logic An Alternative to Hoare/Floyd Logic
Solving Systems of Linear Equations by Addition
3-2: Solving Systems of Equations using Substitution
Propositional Calculus: Boolean Algebra and Simplification
Solving Systems Using Elimination
3-2: Solving Systems of Equations using Substitution
MODULE 4 EQUATIONS AND INEQUALITIES.
Solving Systems of Equations using Substitution
CHAPTER 2 Context-Free Languages
3-2: Solving Systems of Equations using Substitution
2 Understanding Variables and Solving Equations.
Solving Radical Equations
Compound Inequalities:
3-2: Solving Systems of Equations using Substitution
3-2: Solving Systems of Equations using Substitution
3-2: Solving Systems of Equations using Substitution
3-2: Solving Systems of Equations using Substitution
3-2: Solving Systems of Equations using Substitution
Presentation transcript:

Extension of Separation Logic for Stack Reasoning Jiang Xinyu

Motivation  Stacks are special  Continuous  Ordered  Stack reasoning is important  Proof about stacks is usually more than proof about heaps  Mainly for function calls and local variables

Problems of Our Previous Proof  Excessive use of arithmetic of natural numbers  Unnecessary shape matching  Over-used symmetry law of “*”  Repeated proof about the stack’s unused space  Too much care taken to the address of each local variable

Arithmetic  For the formula  We know that  These equations can be automatically proved, but must be proved separately

Shape Matching  This is a common pattern of proof  For stack, the proof is unnecessary  This kind of goals comes from the permutation of *-conjuncted logic assertions

Symmetry Law  If we know  And we want to know  We should do proof like

Unused Stack Space  Another common pattern  We should prove these sub goals

Too much labels  See this  Or worse?

Solution?  Some of them can be alleviated  Arithmetic proof can be reduced by using hex numbers  Some can be eliminated by changing a machine model  Abstract over the unused space  Or treat the stack as a different data structure  Works for higher-level code, but kernel code requires that stacks behave like normal memory

Solution…  Should not assume a higher-level machine model  Also  Should not prohibit reasoning about code that operates on stacks like on heaps  Should work well with heap reasoning(separation logic)

Solution!  Extending separation logic  For any piece of heap, if it’s like a stack, and we say it’s a stack, then it’s a stack!  For any stack, if we want to say that it’s a heap, no problem!

Where Does all Those Problem Come From?  Separation logic is general, but a little too general  Memory may have holes, so its every slice should have a label  Merging of memories are irrelevant to the order  We introduce a more restrictive, but terser “sublanguage”

Adjacency Conjunction  We first define adjacent heaps  And the adjacent union of heaps  The adjacent conjunction is defined like the separation conjunction

Properties Shared with Separation Conjunction  Association  Monotonicity  Introduce and elimination of Emp and True  But no symmetry property!

A New Property  For any Memory M, if  Then  So either l1 or l2 is abundant

Reducing Labels  Another basic assertion: has  We can prove that

Is It Really a Solution?  Let’s review our problems  Excessive use of arithmetic of natural numbers  Unnecessary shape matching  Over-used symmetry law  Repeated proof about the stack’s unused space  Too much care taken to the address of each local variable

Arithmetic  The original  Becomes  Doing arithmetic when really necessary

Shape Matching  This is now trivial to prove  Adjacent conjunction does not allow permutation, so the order must be the same

Symmetry Law  We haven’t any!  Then how to prove the following goal?  We move labels

Unused Space  Not totally solved  But at least we have a lemma to do this  The definition of free is also simplified

Too much labels  Only one label  And you can insert the label if it’s valid

It Is a Solution…  For Lower-level machine code verification  Where the stack are taken as a part of the heap  And all heap operations are valid on stacks  Which works well with separation logic  It is just an extension  No original definitions or rules are changed  Separation conjunction and adjacency conjunction can be freely mixed

Tactics for the Extension  Finding labels  Moving labels  Splitting and merging unused stack space

Expected Tactics  find_label: a special example  And more general

Expected Tactics  label_move_left, label_move_right

Expected Tactics  Stack Splitting and Merging

Related Work  Stack Typing  Has similar adjacent conjunction  For TAL  Specification language differs  No efforts to hide labels