Freefinement Stephan van Staden, Cristiano Calcagno, Bertrand Meyer Chair of Software Engineering.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 12.
Techniques for Proving the Completeness of a Proof System Hongseok Yang Seoul National University Cristiano Calcagno Imperial College.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Verifying Executable Object-Oriented Specifications with Separation Logic Stephan van Staden, Cristiano Calcagno, Bertrand Meyer.
1 1 Regression Verification for Multi-Threaded Programs Sagar Chaki, SEI-Pittsburgh Arie Gurfinkel, SEI-Pittsburgh Ofer Strichman, Technion-Haifa Originally.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Formal Semantics of Programming Languages 虞慧群 Topic 5: Axiomatic Semantics.
Chair of Software Engineering The alias calculus Bertrand Meyer ITMO Software Engineering Seminar June 2011.
Non-monotonic Properties for Proving Correctness in a Framework of Compositional Logic Koji Hasebe Mitsuhiro Okada (Dept. of Philosophy, Keio University)
Logic.
Chair of Software Engineering Software Verification Stephan van Staden Lecture 10: Model Checking.
Program Analysis and Verification
VIDE als voortzetting van Cocktail SET Seminar 11 september 2008 Dr. ir. Michael Franssen.
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer (Nadia Polikarpova) Verification tools.
VIDE Integrated Environment for Development and Verification of Programs.
1 Regression-Verification Benny Godlin Ofer Strichman Technion.
Katz Formal Specifications Larch 1 Algebraic Specification and Larch Formal Specifications of Complex Systems Shmuel Katz The Technion.
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Formal methods Basic concepts. Introduction  Just as models, formal methods is a complement to other specification methods.  Standard is model-based.
Reasoning about Multiple Related Abstractions with MultiStar Stephan van Staden, Cristiano Calcagno Chair of Software Engineering.
1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
The ACL2 Proof Assistant Formal Methods Jeremy Johnson.
Binary Decision Diagrams (BDDs)
Intro. to Logic CS402 Fall Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.
Advanced Topics in SE Spring Process Algebra Hossein Hojjat Formal Methods Lab University of Tehran.
Axiomatic Methods for Software Verification Hongseok Yang.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
CS 363 Comparative Programming Languages Semantics.
0 What logic is or should be Propositions Boolean operations The language of classical propositional logic Interpretation and truth Validity (tautologicity)
Semantic web course – Computer Engineering Department – Sharif Univ. of Technology – Fall Description Logics: Logic foundation of Semantic Web Semantic.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Correctness Proofs and Counter-model Generation with Authentication-Protocol Logic Koji Hasebe Mitsuhiro Okada Department of Philosophy, Keio University.
Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L06-1 September 26, 2006http:// Type Inference September.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
1 Formal Semantics. 2 Why formalize? ML is tricky, particularly in corner cases generalizable type variables? polymorphic references? exceptions? Some.
CS6133 Software Specification and Verification
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
From Hoare Logic to Matching Logic Reachability Grigore Rosu and Andrei Stefanescu University of Illinois, USA.
Automated tactics for separation logic VeriML Reconstruct Z3 Proof Safe incremental type checker Certifying code transformation Proof carrying hardware.
Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Course 2D1453, Some material from B. Pierce: TAPL + some from.
ece 627 intelligent web: ontology and beyond
CMSC 330: Organization of Programming Languages Lambda Calculus and Types.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 9, 2003.
COMP 412, FALL Type Systems II C OMP 412 Rice University Houston, Texas Fall 2000 Copyright 2000, Robert Cartwright, all rights reserved. Students.
CS7120 (Prasad)L13-1-Lambda-Opt1 Typed Lambda Calculus Adapted from Lectures by Profs Aiken and Necula of Univ. of California at Berkeley.
Course: Software Engineering – Design I IntroductionSlide Number 1 What is a specification Description of a (computer) system, which:  is precise;  defines.
Program Analysis and Verification
CS5205Semantics1 CS5205: Foundation in Programming Languages Semantics Static Semantics Dynamic Semantics Operational Semantics Big-step Small-Step Denotational.
CSE-321 Programming Languages Abstract Machine E POSTECH May 1, 2006 박성우.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
From Classical Proof Theory to P vs. NP
Formal Methods in Software Engineering 1
Lesson 4 Typed Arithmetic Typed Lambda Calculus
Lecture 5 Floyd-Hoare Style Verification
Proofs of Correctness: An Introduction to Axiomatic Verification
Program correctness Axiomatic semantics
Program correctness Model-checking CTL
Presentation transcript:

Freefinement Stephan van Staden, Cristiano Calcagno, Bertrand Meyer Chair of Software Engineering

Verification systems Formal systems with judgements t Sat S Prove whether an inductively defined term t, such as a program, satisfies a specification S Examples include type systems: Γ ⊦ e : τ program logics: {x=3} x := x+2 {x=5} 2

Refinement calculi Formal systems with judgements u ⊑ u’ u ::= t | S |... Used for top-down development (correctness-by- construction) Examples (Back/Morgan refinement calculus): x := x+1; x := x+1 ⊑ x := x+2 x:[x=3,x=5] ⊑ x := x+2 3

Freefinement is an algorithm 4 Input: Verification System Step 1Step 2 Output 1: Extended Verif. System Output 2: Refinement calculus λ 2 proves Γ ⊦ f : τ iff R proves [ Γ ; τ ] ⊑ f For example, Γ ⊦ λ x. λ y. (x y) : ( σ→τ ) → ( σ→τ ) [ Γ ; ( σ→τ ) → ( σ→τ )] ⊑ λ x. λ y. (x y)

In a nutshell Given a verification system V 1 of a particular form, freefinement automatically: 1.adds specification terms to get a sound and conservative extension V 2, and 2.constructs a sound refinement calculus R from V 2 V 2 and R are in harmony: V 2 ⊦ u Sat S ⇔ R ⊦ S ⊑ u V 2 ⊦ u Sat S and R ⊦ u ⊑ u’ ⇒ V 2 ⊦ u’ Sat S Can mix top-down (correctness-by-construction) and bottom-up verification Proof translation is possible 5

Example: Hoare logic 6 HV1V1 Preprocess

7 V2V2 R

Key aspects in more detail... 8

Inputs and requirements 1.A set of constructors for a term language t ::= C(t 1,..., t n ) 2.A set of specifications 3.A binary relation between terms and specs ⊧ V1 _ Sat _. It captures the meaning of satisfaction 4.A formal system V 1 for proving judgements t Sat S. Two forms of inference rules are allowed: Each rule must be sound w.r.t. the meaning of satisfaction 9

Extended term language u ::= C(u 1,..., u n ) | S | ⨆ (u 1,..., u n ) Semantics: each extended term u denotes a set of primitive terms ⟦ u ⟧ Let X denote a set of primitive terms, and Y a set of specifications Specs(X) ≙ { S | ∀ t ∊ X. ⊧ V1 t Sat S } Terms(Y) ≙ { t | ∀ S ∊ Y. ⊧ V1 t Sat S } Galois connection: X ⊆ Terms(Y) ⇔ Y ⊆ Specs(X) ⟦ C(u 1,..., u n ) ⟧ ≙ Terms(Specs(C( ⟦ u 1 ⟧,..., ⟦ u n ⟧ ))) ⟦ S ⟧ ≙ Terms({S}) ⟦ ⨆ (u 1,..., u n ) ⟧ ≙ ⋂ i ∊ 1..n ⟦ u i ⟧ 10

Extended satisfaction and V 2 ⊧ V2 u Sat S ≙ ∀ t ∊ ⟦ u ⟧. ⊧ V1 t Sat S V 2 changes t’s into u’s and adds two rules: V 2 is a sound and conservative extension of V 1 : V 2 is sound V 2 can derive everything that V 1 can derive V 2 uses a richer semantics: ⊧ V2 t Sat S ⇒ ⊧ V1 t Sat S 11

Refinement ⊧ u ⊑ u’ ≙ ⟦ u ⟧ ⊇ ⟦ u’ ⟧ Every term u is a placeholder for a set of primitive terms ⟦ u ⟧, and refinement reduces the possibilities Lemma: ⊧ u ⊑ u’ ⇔ ( ∀ S. ⊧ V2 u Sat S ⇒ ⊧ V2 u’ Sat S) 12

Rest of the process Freefinement constructs a refinement calculus from V 2 in a series of small steps The refinement calculus produced at each step is sound and harmonic All rules in the final calculus are axioms, except for monotonicity and transitivity Can extend the final calculus further. For a new rule, check soundness and preservation of harmony 13

Conclusions Freefinement can automatically construct a sound refinement calculus from a verification system Correctness-by-construction for free! Harmony: can freely mix top-down and bottom-up development styles, and even translate between them General: applies to simply-typed lambda calculus, System F, Hoare logic, separation logic,... 14

Example refinement development 15 [ Γ ; ( σ→τ ) → ( σ→τ )] ⊑ “ABS” λ x. [ Γ, x : σ→τ ; σ→τ ] ⊑ “MONO with ABS” λ x. λ y. [ Γ, x : σ→τ, y : σ ; τ ] ⊑ “MONO with APP” λ x. λ y. [ Γ, x : σ→τ, y : σ ; σ→τ ] [ Γ, x : σ→τ, y : σ ; σ ] ⊑ “MONO with VAR” λ x. λ y. x [ Γ, x : σ→τ, y : σ ; σ ] ⊑ “MONO with VAR” λ x. λ y. x y

Rules freefinement cannot handle Lambda calculus: Γ ⊦ e : τ Γ ⊦ e’ : τ provided alpha-convert(e, e’). Hoare logic: {P}c{Q} {P}c\X{Q’} provided X is auxiliary for c. 16