3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

Size: px
Start display at page:

Download "3.4 Deduction and Evaluation: Tools Conditional-Equational Logic"

Transcription

1 3.4 Deduction and Evaluation: Tools Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax of a specification language. At this point, it should be clear that algebraic specifications fulfil this criterion: The semantic domain is constituted by heterogeneous algebras, and it can be defined precisely which of these algebras are accepted as models for a given by a specification (those which are of the right signature, fulfil the import constraints and in which all axioms are valid). However, similar to the notion of a formal system in mathematical logic, the most interesting use of a formal specification is when some transformations are applied on the syntactic documents that can be proven to preserve the semantics. This is the core idea of most support tools for algebraic specifications. The following diagram depicts the general approach where a fixed specification is assumed (and therefore the models are fixed as well). In the framework of algebraic specifications, any term is given a value in a model by the interpretation of the term. What are now allowed syntactic transformations such that the semantic value of the term remains unchanged? Syntax Term 1 Term 2 Semantics Value The following (shortened) example dialog with the CafeOBJ system shows that the tool support of this system is based on the idea from above. Input is shown boldface. % unix> cafeobj -- loading standard prelude -- CafeOBJ system Version 1.3.1(Roman) -- CafeOBJ> input vector.mod -- processing input : /home/hh14/cafeexs/vector.mod File: fss3 Page: 39

2 -- defining module DATA. done. -- defining module VECTOR. done. -- defining module NATVECTOR. done. CafeOBJ> select NATVECTOR NATVECTOR> reduce size(addelement(addelement(initvector,1),2)). 2 : Nat NATVECTOR> This means that the system tried to provide another term (2) for a given term (size(addelement(addelement(initvector,1),2))). The semantics are identical in each chosen model, but the simpler term is much easier to understand and is a commonly accepted normal form for natural numbers. A formally based transformation of syntactic units makes it possible to "lift" many questions about the semantics of the specification from the level of models to a level of syntactic transformation of terms. In the CafeOBJ tool and similar tools, the specification itself is used to provide answers for questions about its meaning. This can also be seen as a very early step of prototyping (logical prototyping). Equational logic is the calculus of replacing terms by equal terms. It can be easily extended to conditional equations. This calculus derives (proves) a term equation from a conditional-equational axiom set. The deduction rules in this calculus are: Reflexivity: Any term is provably equal to itself (t = t). Transitivity: If t1 is provably equal to t2 and t2 is provably equal to t3, then t1 is provably equal to t3. Symmetry: If t1 is provably equal to t2, then t2 is provably equal to t1. Congruence: If t1 is provably equal to t2, then any two terms are provably equal which consist of some context built around t1 and t2. (More formally: Take an arbitrary term t and choose a subterm of it. The two terms obtained by replacing the term with t1 and t2, respectively, are provably equal.) Axiom: Let l = r if c be an axiom of the axiom set. For any substitution of terms for the variables in l, r and c (giving terms l, c and r ), the terms l and r are provably equal if the condition c is provably equal to true. These rules provide a way how one can establish new equations based on the axiom set of a conditional-equational axiomatic specification. File: fss3 Page: 40

3 Sometimes the notation S - t1 = t2 is used to denote the fact that the terms t1 and t2 are provably equal based on the axioms of a specification S. Please note that the rules of the calculus are based on a purely syntactic transformation, which can in principle be executed by a computer. The obvious question is how the "provable equality" corresponds to the equality of terms induced by the semantic construction of heterogeneous algebras (models). For this purpose, the notion of "validity" from above is helpful. Of course, for a given specification all axioms are valid in all models (that is the definition of the model). But there are many other equations which are valid in all models of a given specification. So we slightly extend the notion of validity. Definition For a given specification S, an equation "t1 = t2" is valid in S iff for all models M of S and for all environments e in M holds: I M (t1, e) = I M (t1, e). Sometimes the notion S = t1 = t2 is used to denote that fact that an equation is valid in a specification (i.e. in all its models). The classical relationships between calculus-based and semantics-based facts are soundness and completeness. Definition A calculus is sound for some kind of axiomatic specifications and some kind of semantics iff all provable formulae in a specification are also valid in the specification. In the case of conditional-equational algebraic specifications discussed here, the only relevant formulae are equations. Definition A calculus is complete for some kind of axiomatic specifications and some kind of semantics iff all valid formulae in a specification are also provable in the specification. In the case of conditional-equational algebraic specifications discussed here, the only relevant formulae are equations. The most important result in our context is the following: Theorem Conditional-equational logic is sound and complete for the (loose) model semantics introduced above. The proof is relatively trivial for soundness. For completeness, it relies on the construction of a special term model which uses terms as elements of its carrier sets and is based on the deduction calculus. File: fss3 Page: 41

4 3.4.2 Term Rewriting It has turned out that many useful specifications can be written in a style in which the axioms are always applied from left to right. This usage of the axioms in (conditional-)equational logic is called (conditional) term rewriting. Definition A rewriting step for a term t and an axiom l = r if c is carried out as follows: A matching substitution is determined such that the substituted term l is a subterm of t. The condition c is tested whether c can be reduced to true. If this is the case, the rewritten term is t, where the matching subterm is replaced by r. A reduction for a term is a sequence of consecutive rewrite steps. A term is in normal form if no further rewrite steps are possible. Examples: see lecture. Term rewriting is an algorithmic version of the conditional-equational calculus: The two terms of an equation are reduced to normal form. If the normal forms are literally equal, the equation of the original terms has been derived from the axiom set. Term rewriting is by definition sound for our semantics (since it is a special case of conditional-equational logic) and under special conditions it is also complete. Definition A system of term rewriting rules is confluent if the following diamond condition holds: Whenever a term t can be reduced to two terms t1 and t2, then t1 and t2 can both be further reduced to some term t3. A system of term rewriting rules is terminating if all reductions starting from a term are finite (i.e. end in a normal form). For confluent and terminating axiom systems, the term rewriting algorithm is a decision procedure for conditional-equational logic. This means that if the axioms of an algebraic specification form a confluent and terminating term rewriting system, then term rewriting is sound and complete wrt. our (loose) semantics. The axioms of the VECTOR example are confluent since there are no overlaps between rewrite rules. This is in general a sufficient condition for confluence that is also easy to check. Moreover, they are terminating, which is easy to see intuitively, but difficult to prove formally. File: fss3 Page: 42

5 (However, the theory of term rewriting provides a number of powerful tools that are able to fully automatically prove termination in many cases.) The CafeOBJ system supports term rewriting (but unfortunately no checks of criteria for confluence and/or termination) 1. The system has a line-oriented user interface which supports, among many others, the following commands: input <file> Read a file containing specifications and/or commands (i.e. a script file in the latter case). select <spec> Interpret all following commands in the context of the given specification. reduce <term> Reduce a term to normal form. let <variable> = <term> Define an abbreviation for a term. match it to <pattern> Check whether the result of the last evaluation is of a specific form. Many additional features of the system help in debugging, e.g. a trace mode for term rewriting and an interactive stepper mode. These commands can be used interactively, but also for writing scripts which are interpreted by the system line by line. A useful script giving some more confidence in the VECTOR specification is the following: input vector.mod select NATVECTOR let v0 = initvector. let v1 = addelement(initvector,0). let v2 = addelement(v1,1). let v3 = addelement(v2,2). let v4 = addelement(v3,3). reduce v4. reduce isempty(v0). match it to true. reduce isempty(v4). match it to false. reduce size(v4). match it to 4. reduce contains(v1,4). match it to false. reduce contains(v4,1). match it to true. 1 There exist systems incorporating powerful tests for constructor-completeness, confluence and termination, including an implementation done by the author of these notes. Unfortunately, there is currently no single stable software system incorporating the full state of the art of tool support for algebraic specifications. File: fss3 Page: 43

6 reduce firstelement(v4). match it to 0. reduce firstelement(v0). --> error case reduce lastelement(v4). match it to 3. reduce elementat(v4,2). match it to 2. reduce indexof(v4,2). match it to 2. reduce insertelementat(v4,100,2). match it to addelement(addelement(addelement(addelement (addelement(initvector,0),1),100),2),3). Note: The sign --> is a special form of a comment which makes the text following the > appear in the output of the system. The system output for this script is (after removal of some noise): reduce v4 addelement(addelement(addelement(addelement( initvector,0),1),2),3) : Vector reduce isempty(v0). true : Bool match it to true. reduce isempty(v4). false : Bool match it to false. reduce size(v4). 4 : Nat match it to 4. reduce contains(v1,4). false : Bool match it to false. reduce contains(v4,1). true : Bool match it to true. reduce firstelement(v4). 0 : Nat match it to 0. reduce firstelement(v0). firstelement(initvector) : Nat --> error case reduce lastelement(v4). 3 : Nat match it to 3. reduce elementat(v4,2). 2 : Nat match it to 2. reduce indexof(v4,2). File: fss3 Page: 44

7 2 : Nat match it to 2. reduce insertelementat(v4,100,2). addelement(addelement(addelement(addelement (addelement(initvector,0),1),100),2),3). match it to addelement(addelement(addelement(addelement (addelement(initvector,0),1),100),2),3). The style of the script and the features offered by the interpreter are very similar to software testing environments. However, here we are testing specifications Term Models By reducing terms, we have somehow constructed a prototype, i.e. a model of the specification. This is a software realisation of a technique that is frequently used in mathematical logic: the construction of a term model. In a term model, sets of terms are used as the carrier sets and term manipulations like reduction to normal form are taken to define the operations. A very important consequence of the term model construction is a method to prove consistency. In an algebraic specification approach, consistency can be easily defined as follows. Definition An algebraic specification is consistent if there is at least one model for the specification. Consistency is difficult to test for arbitrary axiomatic theories, as is known from mathematical logic. Nevertheless, there exist systematic ways to write a specification which ensure consistency or make consistency decidable. Theorem Every basic specification the axioms of which form a confluent and terminating term rewriting system is consistent. For specifications with extending or protecting import, additional conditions are necessary. For the no confusion principle (required by extending import), it is a sufficient condition that the left hand sides of all axioms contain at least one operation symbol which is not in the imported signature. For the no junk principle (required by protecting import), it has to be ensured that for any term of imported sort its normal form is completely in the imported signature. The error completion File: fss3 Page: 45

8 techniques explained above always give axiom sets with this property. Another interesting observation on term models is that it is easy, and also natural, to construct a term model in which the terms in the carrier sets are variable-free. Terms without variables are often called ground terms, and therefore such a model is called a ground term model. In the ground term model, equations are valid which are not valid in the non-ground term model. The ground term model of a conditional-equational specification is unique, it is often also called the initial model. In many algebraic specification languages, the semantics of a specification is defined by this single model. 2 Example The terms firstelement(v) and elementat(v,0) are interpreted differently in the non-ground model (consider the assignment of value v to the variable v). In the ground term model, these terms are interpreted identically, since the only possible assignments for v are ground terms of sort Vector. Definition A model A of a specification S is term-generated if any element of its carrier sets is the interpretation of a ground term of S. All practically relevant models are term-generated. A complete calculus for this model class involves induction principles (and therefore does not conform to the meaning of a formal system in mathematical logic) Constructor-Completeness When considering the specification VECTOR, it is pretty clear that the term model uses only a subset of the signature for its carriers. Results of term reductions are always built either from primitive data values or from the Vector operations initvector or addelement. Therefore, these two 2 In CafeOBJ, this tight semantics can be indicated by writing module! instead of just module. 3 For readers interested in mathematical logic: Please note that it is possible to specify natural numbers in algebraic specifications with term-generated models. Therefore, Goedel s incompleteness result implies that there cannot be a complete formal calculus for this specification. File: fss3 Page: 46

9 algebraic operations are called constructor operations for Vector (in slight contradiction to the terminology used in object-oriented programming). Definition A specification is constructor-complete wrt. a subset of constructor operations of its signature, if each ground term over the full signature either is intended to be undefined or can be reduced to a ground term in the constructor signature. The completeness of a set of axioms wrt. a set of constructor operations can be guaranteed by syntactic conditions. The basic idea is that all axioms have to be of the form f(c 1,, c n ) = r where f is a nonconstructor operation and all c i are constructor terms. Under this condition, the set of constructor arguments provided for each nonconstructor operation f has to form a complete case analysis over constructor terms. The implicit error completion discussed above always ensures constructor-completeness, whereas explicit error specification makes it necessary to check the completeness of the case analyses. There are straightforward algorithms for this check. File: fss3 Page: 47

Operational Semantics 1 / 13

Operational Semantics 1 / 13 Operational Semantics 1 / 13 Outline What is semantics? Operational Semantics What is semantics? 2 / 13 What is the meaning of a program? Recall: aspects of a language syntax: the structure of its programs

More information

Computing Fundamentals 2 Introduction to CafeOBJ

Computing Fundamentals 2 Introduction to CafeOBJ Computing Fundamentals 2 Introduction to CafeOBJ Lecturer: Patrick Browne Lecture Room: K408 Lab Room: A308 Based on work by: Nakamura Masaki, João Pascoal Faria, Prof. Heinrich Hußmann. See notes on slides

More information

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010 What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010 1 Goedel s second incompleteness theorem Theorem (Goedel) It is impossible to prove the consistency of

More information

Propositional Logic. Part I

Propositional Logic. Part I Part I Propositional Logic 1 Classical Logic and the Material Conditional 1.1 Introduction 1.1.1 The first purpose of this chapter is to review classical propositional logic, including semantic tableaux.

More information

Handout 9: Imperative Programs and State

Handout 9: Imperative Programs and State 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 9: Imperative Programs and State Imperative

More information

EXTENSIONS OF FIRST ORDER LOGIC

EXTENSIONS OF FIRST ORDER LOGIC EXTENSIONS OF FIRST ORDER LOGIC Maria Manzano University of Barcelona CAMBRIDGE UNIVERSITY PRESS Table of contents PREFACE xv CHAPTER I: STANDARD SECOND ORDER LOGIC. 1 1.- Introduction. 1 1.1. General

More information

Formal Systems and their Applications

Formal Systems and their Applications Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction

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

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

From Types to Sets in Isabelle/HOL

From Types to Sets in Isabelle/HOL From Types to Sets in Isabelle/HOL Extented Abstract Ondřej Kunčar 1 and Andrei Popescu 1,2 1 Fakultät für Informatik, Technische Universität München, Germany 2 Institute of Mathematics Simion Stoilow

More information

A Simplified Abstract Syntax for the Dataflow Algebra. A. J. Cowling

A Simplified Abstract Syntax for the Dataflow Algebra. A. J. Cowling Verification and Testing Research Group, Department of Computer Science, University of Sheffield, Regent Court, 211, Portobello Street, Sheffield, S1 4DP, United Kingdom Email: A.Cowling @ dcs.shef.ac.uk

More information

Functional Logic Programming: From Theory to Curry

Functional Logic Programming: From Theory to Curry Functional Logic Programming: From Theory to Curry Michael Hanus Institut für Informatik, CAU Kiel, D-24098 Kiel, Germany. mh@informatik.uni-kiel.de Abstract. Functional logic programming languages combine

More information

1 Scope, Bound and Free Occurrences, Closed Terms

1 Scope, Bound and Free Occurrences, Closed Terms CS 6110 S18 Lecture 2 The λ-calculus Last time we introduced the λ-calculus, a mathematical system for studying the interaction of functional abstraction and functional application. We discussed the syntax

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

Lecture 5: The Halting Problem. Michael Beeson

Lecture 5: The Halting Problem. Michael Beeson Lecture 5: The Halting Problem Michael Beeson Historical situation in 1930 The diagonal method appears to offer a way to extend just about any definition of computable. It appeared in the 1920s that it

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

Denotational Semantics. Domain Theory

Denotational Semantics. Domain Theory Denotational Semantics and Domain Theory 1 / 51 Outline Denotational Semantics Basic Domain Theory Introduction and history Primitive and lifted domains Sum and product domains Function domains Meaning

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

Proving Theorems with Athena

Proving Theorems with Athena Proving Theorems with Athena David R. Musser Aytekin Vargun August 28, 2003, revised January 26, 2005 Contents 1 Introduction 1 2 Proofs about order relations 2 3 Proofs about natural numbers 7 3.1 Term

More information

SOFTWARE ENGINEERING DESIGN I

SOFTWARE ENGINEERING DESIGN I 2 SOFTWARE ENGINEERING DESIGN I 3. Schemas and Theories The aim of this course is to learn how to write formal specifications of computer systems, using classical logic. The key descriptional technique

More information

Rewriting. Andreas Rümpel Faculty of Computer Science Technische Universität Dresden Dresden, Germany.

Rewriting. Andreas Rümpel Faculty of Computer Science Technische Universität Dresden Dresden, Germany. Rewriting Andreas Rümpel Faculty of Computer Science Technische Universität Dresden Dresden, Germany s9843882@inf.tu-dresden.de ABSTRACT This is an overview paper regarding the common technologies of rewriting.

More information

Data-Driven Induction of Recursive Functions from Input/Output-Examples

Data-Driven Induction of Recursive Functions from Input/Output-Examples Data-Driven Induction of Recursive Functions from Input/Output-Examples Emanuel Kitzelmann Faculty of Information Systems and Applied Computer Sciences University of Bamberg ECML/PKDD 2007 Workshop on

More information

An Annotated Language

An Annotated Language Hoare Logic An Annotated Language State and Semantics Expressions are interpreted as functions from states to the corresponding domain of interpretation Operators have the obvious interpretation Free of

More information

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions.

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions. CS 6110 S18 Lecture 18 Denotational Semantics 1 What is Denotational Semantics? So far we have looked at operational semantics involving rules for state transitions, definitional semantics involving translations

More information

Checking Conservativity With HETS

Checking Conservativity With HETS Checking Conservativity With HETS Mihai Codescu 1, Till Mossakowski 2,3, and Christian Maeder 2 1 University of Erlangen-Nürnberg, Germany 2 DFKI GmbH Bremen, Germany 3 SFB/TR 8 Spatial Cognition, University

More information

Fundamental Concepts. Chapter 1

Fundamental Concepts. Chapter 1 Chapter 1 Fundamental Concepts This book is about the mathematical foundations of programming, with a special attention on computing with infinite objects. How can mathematics help in programming? There

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

CSC 501 Semantics of Programming Languages

CSC 501 Semantics of Programming Languages CSC 501 Semantics of Programming Languages Subtitle: An Introduction to Formal Methods. Instructor: Dr. Lutz Hamel Email: hamel@cs.uri.edu Office: Tyler, Rm 251 Books There are no required books in this

More information

CafeOBJ. CafeOBJ. Starting CafeOBJ. Wolfgang Schreiner 1. A Quick Overview. 2.

CafeOBJ. CafeOBJ. Starting CafeOBJ. Wolfgang Schreiner 1. A Quick Overview. 2. CafeOBJ Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at 1. A Quick Overview Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

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

Inductive Definitions, continued

Inductive Definitions, continued 1 / 27 Inductive Definitions, continued Assia Mahboubi Jan 7th, 2016 2 / 27 Last lecture Introduction to Coq s inductive types: Introduction, elimination and computation rules; Twofold implementation :

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

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré Hoare Logic COMP2600 Formal Methods for Software Engineering Rajeev Goré Australian National University Semester 2, 2016 (Slides courtesy of Ranald Clouston) COMP 2600 Hoare Logic 1 Australian Capital

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

Propositional Theories are Strongly Equivalent to Logic Programs

Propositional Theories are Strongly Equivalent to Logic Programs Under consideration for publication in Theory and Practice of Logic Programming 1 Propositional Theories are Strongly Equivalent to Logic Programs Pedro Cabalar Department of Computer Science, University

More information

Multi-paradigm Declarative Languages

Multi-paradigm Declarative Languages c Springer-Verlag In Proc. of the International Conference on Logic Programming, ICLP 2007. Springer LNCS 4670, pp. 45-75, 2007 Multi-paradigm Declarative Languages Michael Hanus Institut für Informatik,

More information

An Evolution of Mathematical Tools

An Evolution of Mathematical Tools An Evolution of Mathematical Tools From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world.

More information

System Assistance in Structured Domain Model Development*

System Assistance in Structured Domain Model Development* System Assistance in Structured Domain Model Development* Susanne Biundo and Werner Stephan German Research Center for Artificial Intelligence (DFKI) Stuhlsatzenhausweg 3 D-66123 Saarbriicken, Germany

More information

A CONSTRUCTIVE SEMANTICS FOR REWRITING LOGIC MICHAEL N. KAPLAN

A CONSTRUCTIVE SEMANTICS FOR REWRITING LOGIC MICHAEL N. KAPLAN A CONSTRUCTIVE SEMANTICS FOR REWRITING LOGIC BY MICHAEL N. KAPLAN A DISSERTATION SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSOPHY IN COMPUTER SCIENCE UNIVERSITY

More information

On Meaning Preservation of a Calculus of Records

On Meaning Preservation of a Calculus of Records On Meaning Preservation of a Calculus of Records Emily Christiansen and Elena Machkasova Computer Science Discipline University of Minnesota, Morris Morris, MN 56267 chri1101, elenam@morris.umn.edu Abstract

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

Lecture Notes on Real-world SMT

Lecture Notes on Real-world SMT 15-414: Bug Catching: Automated Program Verification Lecture Notes on Real-world SMT Matt Fredrikson Ruben Martins Carnegie Mellon University Lecture 15 1 Introduction In the previous lecture we studied

More information

Lecture Notes on Program Equivalence

Lecture Notes on Program Equivalence Lecture Notes on Program Equivalence 15-312: Foundations of Programming Languages Frank Pfenning Lecture 24 November 30, 2004 When are two programs equal? Without much reflection one might say that two

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

The Typed λ Calculus and Type Inferencing in ML

The Typed λ Calculus and Type Inferencing in ML Notes on Types S. Arun-Kumar Department of Computer Science and Engineering Indian Institute of Technology New Delhi, 110016 email: sak@cse.iitd.ernet.in April 14, 2002 2 Chapter 1 The Typed λ Calculus

More information

Formal Methods in Software Design. Markus Roggenbach

Formal Methods in Software Design. Markus Roggenbach Formal Methods in Software Design Markus Roggenbach October 2001 2 Formal Methods Use of mathematics in software development main activities: writing formal specifications 2 Formal Methods Use of mathematics

More information

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics CONVENTIONAL EXECUTABLE SEMANTICS Grigore Rosu CS522 Programming Language Semantics Conventional Semantic Approaches A language designer should understand the existing design approaches, techniques and

More information

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214 Theorem proving PVS theorem prover Abhik Roychoudhury National University of Singapore Both specification and implementation can be formalized in a suitable logic. Proof rules for proving statements in

More information

RAISE in Perspective

RAISE in Perspective RAISE in Perspective Klaus Havelund NASA s Jet Propulsion Laboratory, Pasadena, USA Klaus.Havelund@jpl.nasa.gov 1 The Contribution of RAISE The RAISE [6] Specification Language, RSL, originated as a development

More information

CMSC 330: Organization of Programming Languages. Operational Semantics

CMSC 330: Organization of Programming Languages. Operational Semantics CMSC 330: Organization of Programming Languages Operational Semantics Notes about Project 4, Parts 1 & 2 Still due today (7/2) Will not be graded until 7/11 (along with Part 3) You are strongly encouraged

More information

the Common Algebraic Specification Language

the Common Algebraic Specification Language Introduction to CASL, the Common Algebraic Specification Language Franz Lichtenberger Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Franz.Lichtenberger@risc.uni

More information

Substitution in Structural Operational Semantics and value-passing process calculi

Substitution in Structural Operational Semantics and value-passing process calculi Substitution in Structural Operational Semantics and value-passing process calculi Sam Staton Computer Laboratory University of Cambridge Abstract Consider a process calculus that allows agents to communicate

More information

6. Hoare Logic and Weakest Preconditions

6. Hoare Logic and Weakest Preconditions 6. Hoare Logic and Weakest Preconditions Program Verification ETH Zurich, Spring Semester 07 Alexander J. Summers 30 Program Correctness There are many notions of correctness properties for a given program

More information

Introduction to Homotopy Type Theory

Introduction to Homotopy Type Theory Introduction to Homotopy Type Theory Lecture notes for a course at EWSCS 2017 Thorsten Altenkirch March 5, 2017 1 What is this course about? To explain what Homotopy Type Theory is, I will first talk about

More information

CS422 - Programming Language Design

CS422 - Programming Language Design 1 CS422 - Programming Language Design Denotational Semantics Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 Denotational semantics, alsoknownasfix-point semantics,

More information

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen Formal semantics of loosely typed languages Joep Verkoelen Vincent Driessen June, 2004 ii Contents 1 Introduction 3 2 Syntax 5 2.1 Formalities.............................. 5 2.2 Example language LooselyWhile.................

More information

A Michael Jackson presentation. CSE503: Software Engineering. The following slides are from his keynote at ICSE 1995

A Michael Jackson presentation. CSE503: Software Engineering. The following slides are from his keynote at ICSE 1995 A Michael Jackson presentation CSE503: Software Engineering The following slides are from his keynote at ICSE 1995 David Notkin University of Washington Computer Science & Engineering Spring 2006 1 2 3

More information

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions): CS 70 Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 7 This lecture returns to the topic of propositional logic. Whereas in Lecture Notes 1 we studied this topic as a way of understanding

More information

Software Engineering Lecture Notes

Software Engineering Lecture Notes Software Engineering Lecture Notes Paul C. Attie August 30, 2013 c Paul C. Attie. All rights reserved. 2 Contents I Hoare Logic 11 1 Propositional Logic 13 1.1 Introduction and Overview..............................

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

The design of a programming language for provably correct programs: success and failure

The design of a programming language for provably correct programs: success and failure The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts

More information

A Rewriting Logic Approach to Operational Semantics

A Rewriting Logic Approach to Operational Semantics A Rewriting Logic Approach to Operational Semantics Traian Florin Şerbănuţă, Grigore Roşu and José Meseguer Department of Computer Science, University of Illinois at Urbana-Champaign. {tserban2,grosu,meseguer}@cs.uiuc.edu

More information

Decision Procedures for Recursive Data Structures with Integer Constraints

Decision Procedures for Recursive Data Structures with Integer Constraints Decision Procedures for Recursive Data Structures with Ting Zhang, Henny B Sipma, Zohar Manna Stanford University tingz,sipma,zm@csstanfordedu STeP Group, June 29, 2004 IJCAR 2004 - p 1/31 Outline Outline

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

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics CONVENTIONAL EXECUTABLE SEMANTICS Grigore Rosu CS422 Programming Language Semantics Conventional Semantic Approaches A language designer should understand the existing design approaches, techniques and

More information

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m. CS 6110 S18 Lecture 8 Structural Operational Semantics and IMP Today we introduce a very simple imperative language, IMP, along with two systems of rules for evaluation called small-step and big-step semantics.

More information

Algebraic Processors

Algebraic Processors Algebraic Processors Algebraic Processors By Pouya Larjani, B.Sc. A Thesis Submitted to the School of Graduate Studies in partial fulfilment of the requirements for the degree of Master of Science Department

More information

Com S 541. Programming Languages I

Com S 541. Programming Languages I Programming Languages I Lecturer: TA: Markus Lumpe Department of Computer Science 113 Atanasoff Hall http://www.cs.iastate.edu/~lumpe/coms541.html TR 12:40-2, W 5 Pramod Bhanu Rama Rao Office hours: TR

More information

Basic Foundations of Isabelle/HOL

Basic Foundations of Isabelle/HOL Basic Foundations of Isabelle/HOL Peter Wullinger May 16th 2007 1 / 29 1 Introduction into Isabelle s HOL Why Type Theory Basic Type Syntax 2 More HOL Typed λ Calculus HOL Rules 3 Example proof 2 / 29

More information

Introduction to Denotational Semantics. Class Likes/Dislikes Survey. Dueling Semantics. Denotational Semantics Learning Goals. You re On Jeopardy!

Introduction to Denotational Semantics. Class Likes/Dislikes Survey. Dueling Semantics. Denotational Semantics Learning Goals. You re On Jeopardy! Introduction to Denotational Semantics Class Likes/Dislikes Survey would change [the bijection question] to be one that still tested students' recollection of set theory but that didn't take as much time

More information

Discrete Mathematics Lecture 4. Harper Langston New York University

Discrete Mathematics Lecture 4. Harper Langston New York University Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a

More information

Lecture 5 - Axiomatic semantics

Lecture 5 - Axiomatic semantics Program Verification March 2014 Lecture 5 - Axiomatic semantics Lecturer: Noam Rinetzky Scribes by: Nir Hemed 1.1 Axiomatic semantics The development of the theory is contributed to Robert Floyd, C.A.R

More information

Last class. CS Principles of Programming Languages. Introduction. Outline

Last class. CS Principles of Programming Languages. Introduction. Outline Last class CS6848 - Principles of Programming Languages Principles of Programming Languages V. Krishna Nandivada IIT Madras Interpreters A Environment B Cells C Closures D Recursive environments E Interpreting

More information

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS 1 THE FORMALIZATION OF MATHEMATICS by Harvey M. Friedman Ohio State University Department of Mathematics friedman@math.ohio-state.edu www.math.ohio-state.edu/~friedman/ May 21, 1997 Can mathematics be

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

Multi-paradigm Declarative Languages

Multi-paradigm Declarative Languages Michael Hanus (CAU Kiel) Multi-paradigm Declarative Languages ICLP 2007 1 Multi-paradigm Declarative Languages Michael Hanus Christian-Albrechts-University of Kiel Programming Languages and Compiler Construction

More information

Hoare triples. Floyd-Hoare Logic, Separation Logic

Hoare triples. Floyd-Hoare Logic, Separation Logic Hoare triples Floyd-Hoare Logic, Separation Logic 1. Floyd-Hoare Logic 1969 Reasoning about control Hoare triples {A} p {B} a Hoare triple partial correctness: if the initial state satisfies assertion

More information

3.2 Big-Step Structural Operational Semantics (Big-Step SOS)

3.2 Big-Step Structural Operational Semantics (Big-Step SOS) 3.2 Big-Step Structural Operational Semantics (Big-Step SOS) Known also under the names natural semantics, relational semantics, and evaluation semantics, big-step structural operational semantics, or

More information

A Small Interpreted Language

A Small Interpreted Language A Small Interpreted Language What would you need to build a small computing language based on mathematical principles? The language should be simple, Turing equivalent (i.e.: it can compute anything that

More information

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013 Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 1 Tuesday, January 29, 2013 1 Intro to semantics What is the meaning of a program? When we write a program, we use

More information

System Description: Twelf A Meta-Logical Framework for Deductive Systems

System Description: Twelf A Meta-Logical Framework for Deductive Systems System Description: Twelf A Meta-Logical Framework for Deductive Systems Frank Pfenning and Carsten Schürmann Department of Computer Science Carnegie Mellon University fp@cs.cmu.edu carsten@cs.cmu.edu

More information

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

CHAPTER 8. Copyright Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS Copyright Cengage Learning. All rights reserved. SECTION 8.3 Equivalence Relations Copyright Cengage Learning. All rights reserved. The Relation Induced by a Partition 3 The Relation

More information

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions. THREE LECTURES ON BASIC TOPOLOGY PHILIP FOTH 1. Basic notions. Let X be a set. To make a topological space out of X, one must specify a collection T of subsets of X, which are said to be open subsets of

More information

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur Module 6 Knowledge Representation and Logic (First Order Logic) 6.1 Instructional Objective Students should understand the advantages of first order logic as a knowledge representation language Students

More information

4.5 Pure Linear Functional Programming

4.5 Pure Linear Functional Programming 4.5 Pure Linear Functional Programming 99 4.5 Pure Linear Functional Programming The linear λ-calculus developed in the preceding sections can serve as the basis for a programming language. The step from

More information

Techniques for the unambiguous specification of software

Techniques for the unambiguous specification of software Formal Techniques for the unambiguous of software Objectives To explain why formal techniques help discover problems in system requirements To describe the use of algebraic techniques for interface To

More information

ISR 2014 Strategies. Hélène KIRCHNER Inria. August Topics, Objectives, Contents. Hélène KIRCHNER Inria ISR 2014 Strategies 1 / 48

ISR 2014 Strategies. Hélène KIRCHNER Inria. August Topics, Objectives, Contents. Hélène KIRCHNER Inria ISR 2014 Strategies 1 / 48 ISR 2014 Strategies Hélène KIRCHNER Inria August 2014 Topics, Objectives, Contents Hélène KIRCHNER Inria ISR 2014 Strategies 1 / 48 Computation, Deduction and Strategies Series of workshops since 1997

More information

Chapter 3. The While programming language

Chapter 3. The While programming language Chapter 3 The While programming language 1 Contents 3 The While programming language 1 3.1 Big-step semantics........................... 2 3.2 Small-step semantics.......................... 9 3.3 Properties................................

More information

Automatic Synthesis of Decision Procedures: a Case Study of Ground and Linear Arithmetic

Automatic Synthesis of Decision Procedures: a Case Study of Ground and Linear Arithmetic Automatic Synthesis of Decision Procedures: a Case Study of Ground and Linear Arithmetic Predrag Janičić Faculty of Mathematics, University of Belgrade Studentski trg 16, 11000 Belgrade, Serbia and Montenegro

More information

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Propositional Logic Formal Syntax and Semantics. Computability and Logic Propositional Logic Formal Syntax and Semantics Computability and Logic Syntax and Semantics Syntax: The study of how expressions are structured (think: grammar) Semantics: The study of the relationship

More information

The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England

The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England The Formal Semantics of Programming Languages An Introduction Glynn Winskel The MIT Press Cambridge, Massachusetts London, England Series foreword Preface xiii xv 1 Basic set theory 1 1.1 Logical notation

More information

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic. Overview CS389L: Automated Logical Reasoning Lecture 6: First Order Logic Syntax and Semantics Işıl Dillig So far: Automated reasoning in propositional logic. Propositional logic is simple and easy to

More information

From Hoare Logic to Matching Logic Reachability. Grigore Rosu and Andrei Stefanescu University of Illinois, USA

From Hoare Logic to Matching Logic Reachability. Grigore Rosu and Andrei Stefanescu University of Illinois, USA From Hoare Logic to Matching Logic Reachability Grigore Rosu and Andrei Stefanescu University of Illinois, USA Matching Logic Reachability - Goal - Language independent program verification framework Derives

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

Symmetry in Type Theory

Symmetry in Type Theory Google May 29th, 2012 What is Symmetry? Definition Symmetry: Two or more things that initially look distinct, may actually be instances of a more general underlying principle. Why do we care? Simplicity.

More information

Embedding logics in Dedukti

Embedding logics in Dedukti 1 INRIA, 2 Ecole Polytechnique, 3 ENSIIE/Cedric Embedding logics in Dedukti Ali Assaf 12, Guillaume Burel 3 April 12, 2013 Ali Assaf, Guillaume Burel: Embedding logics in Dedukti, 1 Outline Introduction

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

Lecture Notes on Data Representation

Lecture Notes on Data Representation Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular

More information

Logic and Computation

Logic and Computation Logic and Computation From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world. This is

More information