COMBINING PARTIAL EVALUATION AND SYMBOLIC EXECUTION

Size: px
Start display at page:

Download "COMBINING PARTIAL EVALUATION AND SYMBOLIC EXECUTION"

Transcription

1 COMBINING PARTIAL EVALUATION AND SYMBOLIC EXECUTION Reiner Hähnle & Richard Bubel Chalmers University Symposium 09 Speyer

2 CONTROL CIRCUIT y = 80; threshold = 100; if (y > threshold) { decrease = true; } else { decrease = false; } while ( y-threshold > eps) { y = y-1 : y+1; }

3 CONTROL-FLOW GRAPH y = 80 threshold=100 y>threshold? decrease = true; decrease = false; y-threshold > eps? y = 80; threshold = 100; if (y > threshold) { decrease = true; } else { decrease = false; } while ( y-threshold > eps) { y = y-1 : y+1; }

4 PARTIAL EVALUATION decrease = true; y = 80 threshold=100 y>threshold 80>100 false?? decrease = false; Evaluator y 80 threshold 100 decrease false Static information propagated along CFG constant propagation constant expression evaluation y-threshold y-100 > eps > eps?? decrease false? Evaluator y - threshold 100 decrease false dead-code elimination other: type coercion, safe dereferencing etc.

5 PARTIAL EVALUATION A Bit More Realistic y = 80 threshold=100 y>threshold? threshold=100 y>100? decrease = true; decrease = false; decrease = true; decrease = false; y-threshold > eps? y-100 > eps?

6 SYMBOLIC EXECUTION threshold=100 y>threshold? decrease = true; decrease = false; y-threshold > eps?

7 SYMBOLIC EXECUTION threshold=100 y>threshold? threshold=100 decrease = true; decrease = false; y>threshold? y-threshold > eps? decrease = true; decrease=false; y-threshold > eps? y-threshold > eps? y-threshold > eps? y-threshold > eps? y-threshold > eps? y-threshold > eps?

8 OPTIMIZING SYMBOLIC EXECUTION Symbolic Execution unfolds control-flow graph into tree unfeasible paths must be closed by first-order proof search interleave partial evaluation and symbolic execution

9 INTERLEAVING threshold=100 y>threshold? decrease = true; decrease = false; threshold=100 y>threshold y>100?? y-threshold > eps? decrease=true; decrease=false; y-threshold y-100 > eps > eps?? y-threshold y-100 > eps > eps?? true decrease false? y-threshold y-100 > eps > eps?? decrease true? y-threshold y-100 > eps > eps?? y-threshold y-100 > eps > eps?? y-threshold y-100 > eps > eps?? decrease true? decrease false? decrease false?

10 INTERLEAVING threshold=100 threshold=100 y>threshold? decrease = true; decrease = false; decrease=true; y>100? decrease=false; y-threshold > eps? y-100 > eps? y-100 > eps? true false y-100 > eps? y-100 > eps? true false

11 PROGRAM LOGIC Programming Language Simple OO-Programming Language single inheritance dereferencing null, division by zero etc. cause nontermination dynamic method binding no nested expressions

12 PROGRAM LOGIC Syntax Dynamic Logic with Updates: (as usual) Specialisation operator : P rgel Upd F or P rgel where P rgel = Statement Expression p (U, ϕ) denotes a program equivalent to if is executed in a state s satisfying ϕ p p and coinciding on U Examples: x =(y) (y := 3, true)+3; (x = o.a + 3) (o.a := 10,o!= null)

13 PROGRAM LOGIC Notions Signature Σ: Program variables and attributes are modelled as non-rigid constants and unary function symbols First-order structure(d, I): Domain D: sorted universe (interpretes sorts) Interpretation I: interpretes rigid function and predicate symbols States s S: interpretes program variables and attributes

14 PROGRAM LOGIC Signature Extension Partial Evaluation may extend the signature (temporary variables, anonymous updates ) p Σ Σ (U, ϕ) where (D, I) (D, I) and s s and β β Σ Σ Σ Σ Σ Σ

15 PROGRAM LOGIC Soundness Condition on the Specialisation Operator p Σ Σ (U, ϕ) For all formulas ψ over Σ, for all (D, I),s, β : Σ Σ Σ (D, I),s, β = Σ Σ Σ ( ) p (U, ϕ) ψ {U}(ϕ p ψ)

16 PROGRAM LOGIC Partial Evaluation Rules Rewrite Action Correctness Requirement Dead-Code Elimination if(b){p}else{q} (U, ϕ) p (U, ϕ) U(ϕ b. = true) Safe Field Access Partial Evaluator Propagation o.a (U, (U, ϕ) (p; q) (U, ϕ) p (U, ϕ); q (U, ϕ ) U(ϕ!(o. = null)) respmodstrong(p, mod) U := UV mod (D, I) = {U}{V mod }ϕ (D, I) = {U} p ϕ

17 PROGRAM LOGIC Partial Evaluator Introduction Rules Γ U!(o. = null), Γ U{o.a := t} q (o.a := t,!o. = null) φ, Γ U o.a = t; q φ, and several others

18 PROGRAM LOGIC Type Inference Rules res = o.m(a 1,..., a n ) (ϕ, U) o = o (ϕ, U) U(ϕ o!. = null & C :: instance(o)) res ).m(a 1 (ϕ, U),..., a n (ϕ, U))

19 PROGRAM LOGIC Type Inference Rules A a =...; boolean eq = a.equals(c); A a is an instance of C B C Evaluator...

20 DEMO

21 FUTURE WORK Simplification of specifications Partial evaluation of contracts and loop invariants Applicable to JavaCardDL / JML / OCL Investigate applicability to application engineering

22 FUTURE WORK Application Engineering Model Driven Architecture Platform Independent Model Platform Definition Model Partial Evaluation Program p (U, ϕ) Application Engineering Productline Artefacts Feature Configuration Platform Specific Model p (U, ϕ) Application

23 CONCLUSION (for the moment) y = 80; threshold = 100; if (y > threshold) { decrease = true; } else { decrease = false; } while (y-threshold > eps) { β y = y-1 : y+1; } partial eval. as replaced computation generalisation of proof search linear in β-reduction by computation number of locs in Hoare/VCG

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering Reasoning about Programs with Dynamic Logic - Part I Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard

More information

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering Reasoning about Programs with Dynamic Logic - Part II Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard

More information

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering Reasoning about Programs - Selected Features Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel,

More information

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering Reasoning about Programs with Dynamic Logic - Part II Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard

More information

From OCL to Propositional and First-order Logic: Part I

From OCL to Propositional and First-order Logic: Part I 22c181: Formal Methods in Software Engineering The University of Iowa Spring 2008 From OCL to Propositional and First-order Logic: Part I Copyright 2007-8 Reiner Hähnle and Cesare Tinelli. Notes originally

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods Reasoning about Programs with Dynamic Logic Wolfgang Ahrendt & Richard Bubel & Wojciech Mostowski 5 October 2011 SEFM: Java DL /GU 111005 1 / 45 Dynamic Logic

More information

Typed First-order Logic

Typed First-order Logic 22c181: Formal Methods in Software Engineering The University of Iowa Spring 2008 Typed First-order Logic Copyright 2007-8 Reiner Hähnle and Cesare Tinelli. Notes originally developed by Reiner Hähnle

More information

Verifying Java Programs with KeY

Verifying Java Programs with KeY Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at Wolfgang

More information

Verifying Java Programs Verifying Java Programs with KeY

Verifying Java Programs Verifying Java Programs with KeY Verifying Java Programs Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at

More information

Verifying Java Programs Verifying Java Programs with KeY

Verifying Java Programs Verifying Java Programs with KeY Verifying Java Programs Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at

More information

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 Natural Semantics Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 1 Natural deduction is an instance of first-order logic; that is, it is the formal

More information

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

Reasoning About Loops Using Vampire

Reasoning About Loops Using Vampire EPiC Series in Computing Volume 38, 2016, Pages 52 62 Proceedings of the 1st and 2nd Vampire Workshops Reasoning About Loops Using Vampire Laura Kovács and Simon Robillard Chalmers University of Technology,

More information

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer

More information

3.7 Denotational Semantics

3.7 Denotational Semantics 3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These

More information

Functional Programming. Pure Functional Programming

Functional Programming. Pure Functional Programming Functional Programming Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends only on the values of its sub-expressions (if any).

More information

Introduction to JavaCard Dynamic Logic

Introduction to JavaCard Dynamic Logic Introduction to JavaCard Dynamic Logic Prof. P. H. Schmitt, Christian Engel, Benjamin Weiß December 10, 2008 Introduction to JavaCard Dynamic Logic December 10, 2008 1 / 13 Some Java Features Assignments,

More information

A First-Order Logic with First-Class Types

A First-Order Logic with First-Class Types A First-Order Logic with First-Class Types joint work with Peter H. Schmitt and Mattias Ulbrich Institute for Theoretical Computer Science The 8th KeY Symposium, Speyer, 2009 Java Card DL modal logic based

More information

Formal Systems II: Applications

Formal Systems II: Applications Formal Systems II: Applications Functional Verification of Java Programs: Java Dynamic Logic Bernhard Beckert Mattias Ulbrich SS 2017 KIT INSTITUT FÜR THEORETISCHE INFORMATIK KIT University of the State

More information

1 Introduction. 3 Syntax

1 Introduction. 3 Syntax CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER 2012 2013 MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS Time allowed TWO hours Candidates may complete the front

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4020 July 5, 2007 14.00-15.30 This exam (8 pages) consists of 60 True/False

More information

Program Transformation Based on Symbolic Execution and Deduction (Technical Report)

Program Transformation Based on Symbolic Execution and Deduction (Technical Report) Program Transformation Based on Symbolic Execution and Deduction (Technical Report) Ran Ji and Reiner Hähnle and Richard Bubel Department of Computer Science Technische Universität Darmstadt, Germany {ran,haehnle,bubel}@cs.tu-darmstadt.de

More information

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. Semantics The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. The semantics of a programming language assigns a precise

More information

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus: Boolean Algebra and Simplification CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Topics Motivation: Simplifying Conditional Expressions

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 19 Tuesday, April 3, 2018 1 Introduction to axiomatic semantics The idea in axiomatic semantics is to give specifications

More information

Where is ML type inference headed?

Where is ML type inference headed? 1 Constraint solving meets local shape inference September 2005 2 Types are good A type is a concise description of the behavior of a program fragment. Typechecking provides safety or security guarantees.

More information

Induction Variable Identification (cont)

Induction Variable Identification (cont) Loop Invariant Code Motion Last Time Uses of SSA: reaching constants, dead-code elimination, induction variable identification Today Finish up induction variable identification Loop invariant code motion

More information

Dynamic Frames in Java Dynamic Logic

Dynamic Frames in Java Dynamic Logic Dynamic Frames in Java Dynamic Logic Peter H Schmitt, Mattias Ulbrich, and Benjamin Weiß Karlsruhe Institute of Technology Institute for Theoretical Computer Science D-76128 Karlsruhe, Germany {pschmitt,mulbrich,bweiss}@iraukade

More information

Towards a GUI for Program Verification with KeY. Master of Science Thesis in the Programme Software Engineering and Technology

Towards a GUI for Program Verification with KeY. Master of Science Thesis in the Programme Software Engineering and Technology Towards a GUI for Program Verification with KeY Master of Science Thesis in the Programme Software Engineering and Technology Chalmers University of Technology University of Gothenburg Department of Computer

More information

Semantics and Pragmatics of NLP Propositional Logic, Predicates and Functions

Semantics and Pragmatics of NLP Propositional Logic, Predicates and Functions , Semantics and Pragmatics of NLP, and s Alex Ewan School of Informatics University of Edinburgh 10 January 2008 , 1 2 3 4 Why Bother?, Aim: 1 To associate NL expressions with semantic representations;

More information

Lecture 6: Arithmetic and Threshold Circuits

Lecture 6: Arithmetic and Threshold Circuits IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 6: Arithmetic and Threshold Circuits David Mix Barrington and Alexis Maciel July

More information

First-Class Type Classes

First-Class Type Classes First-Class Type Classes Matthieu Sozeau Joint work with Nicolas Oury LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project Gallium Seminar November 3rd 2008 INRIA Rocquencourt Solutions for

More information

Concepts of programming languages

Concepts of programming languages Concepts of programming languages Lecture 5 Wouter Swierstra 1 Announcements Submit your project proposal to me by email on Friday; The presentation schedule in now online Exercise session after the lecture.

More information

Automated Theorem Proving in a First-Order Logic with First Class Boolean Sort

Automated Theorem Proving in a First-Order Logic with First Class Boolean Sort Thesis for the Degree of Licentiate of Engineering Automated Theorem Proving in a First-Order Logic with First Class Boolean Sort Evgenii Kotelnikov Department of Computer Science and Engineering Chalmers

More information

15-819M: Data, Code, Decisions

15-819M: Data, Code, Decisions 15-819M: Data, Code, Decisions 08: First-Order Logic André Platzer aplatzer@cs.cmu.edu Carnegie Mellon University, Pittsburgh, PA André Platzer (CMU) 15-819M/08: Data, Code, Decisions 1 / 40 Outline 1

More information

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 1 Not all languages are regular So what happens to the languages which are not regular? Can we still come up with a language recognizer?

More information

Automated Reasoning. Natural Deduction in First-Order Logic

Automated Reasoning. Natural Deduction in First-Order Logic Automated Reasoning Natural Deduction in First-Order Logic Jacques Fleuriot Automated Reasoning Lecture 4, page 1 Problem Consider the following problem: Every person has a heart. George Bush is a person.

More information

Spark verification features

Spark verification features Spark verification features Paul Jackson School of Informatics University of Edinburgh Formal Verification Spring 2018 Adding specification information to programs Verification concerns checking whether

More information

Abstract Object Creation in Dynamic Logic

Abstract Object Creation in Dynamic Logic to be or not to be created Wolfgang Ahrendt 1 Frank S. de Boer 2 Immo Grabe 3 1 Chalmers University, Göteborg, Sweden 2 CWI, Amsterdam, The Netherlands 3 Christian-Albrechts-University Kiel, Germany KeY

More information

Simply-Typed Lambda Calculus

Simply-Typed Lambda Calculus #1 Simply-Typed Lambda Calculus #2 Back to School What is operational semantics? When would you use contextual (small-step) semantics? What is denotational semantics? What is axiomatic semantics? What

More information

Case by Case. Chapter 3

Case by Case. Chapter 3 Chapter 3 Case by Case In the previous chapter, we used the conditional expression if... then... else to define functions whose results depend on their arguments. For some of them we had to nest the conditional

More information

Separating Shape Graphs

Separating Shape Graphs Separating Shape Graphs Vincent Laviron Bor-Yuh Evan Chang Xavier Rival ENS University of Colorado INRIA Boulder ENS European Symposium on Programming 1/ 23 Shape Analysis Analysis of programs using dynamic

More information

Type checking. Jianguo Lu. November 27, slides adapted from Sean Treichler and Alex Aiken s. Jianguo Lu November 27, / 39

Type checking. Jianguo Lu. November 27, slides adapted from Sean Treichler and Alex Aiken s. Jianguo Lu November 27, / 39 Type checking Jianguo Lu November 27, 2014 slides adapted from Sean Treichler and Alex Aiken s Jianguo Lu November 27, 2014 1 / 39 Outline 1 Language translation 2 Type checking 3 optimization Jianguo

More information

CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011

CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic

More information

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs?

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs? Part II. Hoare Logic and Program Verification Part II. Hoare Logic and Program Verification Dilian Gurov Props: Models: Specs: Method: Tool: safety of data manipulation source code logic assertions Hoare

More information

Calculus of Inductive Constructions

Calculus of Inductive Constructions Calculus of Inductive Constructions Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Calculus of Inductive Constructions

More information

Génie Logiciel Avancé

Génie Logiciel Avancé L3 Mention Informatique Parcours Informatique et MIAGE Génie Logiciel Avancé Part VII : White-Box Test Burkhart Wolff wolff@lri.fr Idea: % Lets exploit the structure of the program!!! (and not, as before

More information

Chapter 15. Functional Programming Languages

Chapter 15. Functional Programming Languages Chapter 15 Functional Programming Languages Copyright 2009 Addison-Wesley. All rights reserved. 1-2 Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages

More information

Semantics. A. Demers Jan This material is primarily from Ch. 2 of the text. We present an imperative

Semantics. A. Demers Jan This material is primarily from Ch. 2 of the text. We present an imperative CS411 Notes 1: IMP and Large Step Operational Semantics A. Demers 23-25 Jan 2001 This material is primarily from Ch. 2 of the text. We present an imperative language called IMP; wegive a formal definition

More information

Dorel LUCANU. University Al.I.Cuza of Iaşi Department of Computer Science Berthelot Iaşi, Romania

Dorel LUCANU. University Al.I.Cuza of Iaşi Department of Computer Science Berthelot Iaşi, Romania Dorel LUCANU University Al.I.Cuza of Iaşi Department of Computer Science Berthelot 16 6600-Iaşi, Romania e-mail: dlucanu@infoiasi.ro Understanding CafeOBJ by examples (Introduction to concurrent object-oriented

More information

The KeY System 1.0 (Deduction Component)

The KeY System 1.0 (Deduction Component) The KeY System 1.0 (Deduction Component) Bernhard Beckert, Martin Giese, Reiner Hähnle, Vladimir Klebanov, Philipp Rümmer, Steffen Schlager, and Peter H. Schmitt www.key-project.org Abstract. The KeY system

More information

Example Scheme Function: equal

Example Scheme Function: equal ICOM 4036 Programming Languages Functional Programming Languages Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming Language: LISP Introduction to

More information

An Inverse Lambda Calculus Algorithm. For Natural Language Processing. Marcos Alvarez Gonzalez

An Inverse Lambda Calculus Algorithm. For Natural Language Processing. Marcos Alvarez Gonzalez An Inverse Lambda Calculus Algorithm For Natural Language Processing by Marcos Alvarez Gonzalez A Thesis Presented In Partial Fulfillment of the Requirements for the Degree Master of Science Approved November

More information

CS4215 Programming Language Implementation

CS4215 Programming Language Implementation CS4215 Programming Language Implementation You have 45 minutes to complete the exam. Use a B2 pencil to fill up the provided MCQ form. Leave Section A blank. Fill up Sections B and C. After finishing,

More information

Contents. Chapter 1 SPECIFYING SYNTAX 1

Contents. Chapter 1 SPECIFYING SYNTAX 1 Contents Chapter 1 SPECIFYING SYNTAX 1 1.1 GRAMMARS AND BNF 2 Context-Free Grammars 4 Context-Sensitive Grammars 8 Exercises 8 1.2 THE PROGRAMMING LANGUAGE WREN 10 Ambiguity 12 Context Constraints in Wren

More information

Introduction to Type Theory August 2007 Types Summer School Bertinoro, It. Herman Geuvers Nijmegen NL

Introduction to Type Theory August 2007 Types Summer School Bertinoro, It. Herman Geuvers Nijmegen NL Introduction to Type Theory August 2007 Types Summer School Bertinoro, It Herman Geuvers Nijmegen NL Lecture 2: Dependent Type Theory, Logical Framework 1 For λ : Direct representation (shallow embedding)

More information

CITS5501 Software Testing and Quality Assurance Formal methods

CITS5501 Software Testing and Quality Assurance Formal methods CITS5501 Software Testing and Quality Assurance Formal methods Unit coordinator: Arran Stewart May 1, 2018 1 / 49 Sources Pressman, R., Software Engineering: A Practitioner s Approach, McGraw-Hill, 2005

More information

Scheme in Scheme: The Metacircular Evaluator Eval and Apply

Scheme in Scheme: The Metacircular Evaluator Eval and Apply Scheme in Scheme: The Metacircular Evaluator Eval and Apply CS21b: Structure and Interpretation of Computer Programs Brandeis University Spring Term, 2015 The metacircular evaluator is A rendition of Scheme,

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

CPS 506 Comparative Programming Languages. Programming Language Paradigm

CPS 506 Comparative Programming Languages. Programming Language Paradigm CPS 506 Comparative Programming Languages Functional Programming Language Paradigm Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming

More information

JML What are model fields? Translation to JavaDL Demo. JML Model Fields. Christian Engel. ITI, Universität Karlsruhe. 08.

JML What are model fields? Translation to JavaDL Demo. JML Model Fields. Christian Engel. ITI, Universität Karlsruhe. 08. ITI, Universität Karlsruhe 08. Juni 2005 Outline JML 1 JML 2 3 4 JML JML...... is a specification language tailored to Java. JML JML...... is a specification language tailored to Java.... serves as an

More information

Decision Making in C

Decision Making in C Decision Making in C Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed

More information

MORE SCHEME. 1 What Would Scheme Print? COMPUTER SCIENCE MENTORS 61A. October 30 to November 3, Solution: Solutions begin on the following page.

MORE SCHEME. 1 What Would Scheme Print? COMPUTER SCIENCE MENTORS 61A. October 30 to November 3, Solution: Solutions begin on the following page. MORE SCHEME COMPUTER SCIENCE MENTORS 61A October 30 to November 3, 2017 1 What Would Scheme Print? Solutions begin on the following page. 1. What will Scheme output? Draw box-and-pointer diagrams to help

More information

F. Brief review of classical predicate logic (PC)

F. Brief review of classical predicate logic (PC) F. Brief review of classical predicate logic (PC) F.I. Syntax (LfP 4.1) F.I.1. Primitive symbols Primitive vocabulary of PC (LfP 90): connectives: Ñ,, @ variables: x, y,... (with or without numerical subscripts)

More information

A Short Introduction to First-Order Theorem Proving with KeY

A Short Introduction to First-Order Theorem Proving with KeY 1 What is KeY? 1.1 Software Verification Karlsruher Institut für Technologie Institut für Theoretische Informatik Prof. Dr. Peter H. Schmitt Mattias Ulbrich A Short Introduction to First-Order Theorem

More information

Introduction au Génie Logiciel Partie3: Test: Static White-Box Test

Introduction au Génie Logiciel Partie3: Test: Static White-Box Test Licence Mention Informatique L3/S6 2009/10 Introduction au Génie Logiciel Partie3: Test: Static White-Box Test Burkhart Wolff Département Informatique Difficulties with Static Unit Tests so far The generation

More information

Refinement Types as Proof Irrelevance. William Lovas with Frank Pfenning

Refinement Types as Proof Irrelevance. William Lovas with Frank Pfenning Refinement Types as Proof Irrelevance William Lovas with Frank Pfenning Overview Refinement types sharpen existing type systems without complicating their metatheory Subset interpretation soundly and completely

More information

Programming Lecture 3

Programming Lecture 3 Programming Lecture 3 Expressions (Chapter 3) Primitive types Aside: Context Free Grammars Constants, variables Identifiers Variable declarations Arithmetic expressions Operator precedence Assignment statements

More information

Pierce Ch. 3, 8, 11, 15. Type Systems

Pierce Ch. 3, 8, 11, 15. Type Systems Pierce Ch. 3, 8, 11, 15 Type Systems Goals Define the simple language of expressions A small subset of Lisp, with minor modifications Define the type system of this language Mathematical definition using

More information

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

Types-2. Polymorphism

Types-2. Polymorphism Types-2 Polymorphism Type reconstruction (type inference) for a simple PL Typing functions Coercion, conversion, reconstruction Rich area of programming language research as people try to provide safety

More information

Hoare logic. A proof system for separation logic. Introduction. Separation logic

Hoare logic. A proof system for separation logic. Introduction. Separation logic Introduction Hoare logic Lecture 6: Examples in separation logic In the previous lecture, we saw how reasoning about pointers in Hoare logic was problematic, which motivated introducing separation logic.

More information

Built-in Module BOOL. Lecture Note 01a

Built-in Module BOOL. Lecture Note 01a Built-in Module BOOL Lecture Note 01a Topics! Built-in Boolean Algebra module BOOL and the equivalence of two boolean expressions (or SAT problems)! Study important concepts about CafeOBJ system through

More information

Semantic analysis and intermediate representations. Which methods / formalisms are used in the various phases during the analysis?

Semantic analysis and intermediate representations. Which methods / formalisms are used in the various phases during the analysis? Semantic analysis and intermediate representations Which methods / formalisms are used in the various phases during the analysis? The task of this phase is to check the "static semantics" and generate

More information

From OCL to Typed First-order Logic

From OCL to Typed First-order Logic 22c181: Formal Methods in Software Engineering The University of Iowa Spring 2008 From OCL to Typed First-order Logic Copyright 2007-8 Reiner Hähnle and Cesare Tinelli. Notes originally developed by Reiner

More information

Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives

Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives CS 6A Scheme Fall 208 Discussion 8: October 24, 208 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write

More information

LING 130: Quantified Noun Phrases

LING 130: Quantified Noun Phrases LING 130: Quantified Noun Phrases James Pustejovsky March 15, 2010 1 Syntax for Typed λ-calculus We will now present a language which uses specific types of entities, where the entities are combined with

More information

Functional programming with Common Lisp

Functional programming with Common Lisp Functional programming with Common Lisp Dr. C. Constantinides Department of Computer Science and Software Engineering Concordia University Montreal, Canada August 11, 2016 1 / 81 Expressions and functions

More information

Logic-Flow Analysis of Higher-Order Programs

Logic-Flow Analysis of Higher-Order Programs Logic-Flow Analysis of Higher-Order Programs Matt Might http://matt.might.net/ POPL 2007 Why? Tim Sweeney, POPL 2006 Static array-bounds checking. Example... a[i]... Will 0 i < a.length always hold? 3

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages Lesson 14 Type Checking Collaboration and Management Dana Fisman www.cs.bgu.ac.il/~ppl172 1 Type Checking We return to the issue of type safety we discussed informally,

More information

Organization of Programming Languages CS3200/5200N. Lecture 11

Organization of Programming Languages CS3200/5200N. Lecture 11 Organization of Programming Languages CS3200/5200N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Functional vs. Imperative The design of the imperative languages

More information

CSCI Compiler Design

CSCI Compiler Design University of Southern California CSCI565 Compiler Design Midterm Exam - Fall 26 CSCI 565 - Compiler Design Fall 26 Midterm Exam Solution Problem : Context-Free-Grammars and Parsing Algorithms [4 points]

More information

Formal Specification and Verification

Formal Specification and Verification Formal Specification and Verification Proof Obligations Bernhard Beckert Based on a lecture by Wolfgang Ahrendt and Reiner Hähnle at Chalmers University, Göteborg Formal Specification and Verification:

More information

Towards a Logical Reconstruction of Relational Database Theory

Towards a Logical Reconstruction of Relational Database Theory Towards a Logical Reconstruction of Relational Database Theory On Conceptual Modelling, Lecture Notes in Computer Science. 1984 Raymond Reiter Summary by C. Rey November 27, 2008-1 / 63 Foreword DB: 2

More information

Defining syntax using CFGs

Defining syntax using CFGs Defining syntax using CFGs Roadmap Last time Defined context-free grammar This time CFGs for specifying a language s syntax Language membership List grammars Resolving ambiguity CFG Review G = (N,Σ,P,S)

More information

Finite Model Generation for Isabelle/HOL Using a SAT Solver

Finite Model Generation for Isabelle/HOL Using a SAT Solver Finite Model Generation for / Using a SAT Solver Tjark Weber webertj@in.tum.de Technische Universität München Winterhütte, März 2004 Finite Model Generation for / p.1/21 is a generic proof assistant: Highly

More information

Semantics and Verification of Software

Semantics and Verification of Software Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ws-1718/sv-sw/ Recap: Operational Semantics of Blocks

More information

Data abstractions: ADTs Invariants, Abstraction function. Lecture 4: OOP, autumn 2003

Data abstractions: ADTs Invariants, Abstraction function. Lecture 4: OOP, autumn 2003 Data abstractions: ADTs Invariants, Abstraction function Lecture 4: OOP, autumn 2003 Limits of procedural abstractions Isolate implementation from specification Dependency on the types of parameters representation

More information

Software Security: Vulnerability Analysis

Software Security: Vulnerability Analysis Computer Security Course. Software Security: Vulnerability Analysis Program Verification Program Verification How to prove a program free of buffer overflows? Precondition Postcondition Loop invariants

More information

Situation Calculus and YAGI

Situation Calculus and YAGI Situation Calculus and YAGI Institute for Software Technology 1 Progression another solution to the projection problem does a sentence hold for a future situation used for automated reasoning and planning

More information

CS422 - Programming Language Design

CS422 - Programming Language Design 1 CS422 - Programming Language Design From SOS to Rewriting Logic Definitions Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign In this chapter we show how SOS language

More information

Context-free Grammars

Context-free Grammars 1 contents of Context-free Grammars Phrase Structure Everyday Grammars for Programming Language Formal Definition of Context-free Grammars Definition of Language Left-to-right Application cfg ects Transforming

More information

COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor

COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor COSC252: Programming Languages: Semantic Specification Jeremy Bolton, PhD Adjunct Professor Outline I. What happens after syntactic analysis (parsing)? II. Attribute Grammars: bridging the gap III. Semantic

More information

Compilers. Compiler Construction Tutorial The Front-end

Compilers. Compiler Construction Tutorial The Front-end Compilers Compiler Construction Tutorial The Front-end Salahaddin University College of Engineering Software Engineering Department 2011-2012 Amanj Sherwany http://www.amanj.me/wiki/doku.php?id=teaching:su:compilers

More information

Exercises Computational Complexity

Exercises Computational Complexity Exercises Computational Complexity March 22, 2017 Exercises marked with a are more difficult. 1 Chapter 7, P and NP Exercise 1. Suppose some pancakes are stacked on a surface such that no two pancakes

More information

Ornaments in ML. Thomas Williams, Didier Rémy. April 18, Inria - Gallium

Ornaments in ML. Thomas Williams, Didier Rémy. April 18, Inria - Gallium Ornaments in ML Thomas Williams, Didier Rémy Inria - Gallium April 18, 2017 1 Motivation Two very similar functions let rec add m n = match m with Z n S m S (add m n) let rec append ml nl = match ml with

More information

Chapter 2 The Language PCF

Chapter 2 The Language PCF Chapter 2 The Language PCF We will illustrate the various styles of semantics of programming languages with an example: the language PCF Programming language for computable functions, also called Mini-ML.

More information

An Improved Rule for While Loops in Deductive Program Verification

An Improved Rule for While Loops in Deductive Program Verification An Improved Rule for While Loops in Deductive Program Verification Bernhard Beckert 1, Steffen Schlager 2,andPeterH.Schmitt 2 1 University of Koblenz-Landau Institute for Computer Science D-56072 Koblenz,

More information