The Programming Language Core

Size: px
Start display at page:

Download "The Programming Language Core"

Transcription

1 The Programming Language Core Wolfgang Schreiner Research Institute for Symbolic Computation (RISC-Linz) Johannes Kepler University, A-4040 Linz, Austria Wolfgang Schreiner RISC-Linz

2 The Programming Language Core \Core" of values and operations establish fundamental capabilities of a language. { Numerical computation: numeric values. { Text editing: string values. { General purpose: core for many applications. Starting point for language design. Design programs and study their computational powers. Later extend core by conveniences. { Subroutines, modules,... Let's study the nature of a programming language core! Wolfgang Schreiner 1

3 A Core Imperative Language A while loop language Syntax domains. Syntax rules. C 2 Command E 2 Expression L 2 Location N 2 Numeral C ::= L:=E j C 1 ;C 2 j if E then C 1 else C 2 j while E do C od j skip E ::= N j E 1 +E 2 j :E j E 1 =E 2 L ::= loc i, if i > 0 N ::= n, if n 2 Integer Example loc 1 := 0; 1 =0 do loc 2 :=@loc 1 +1 od Wolfgang Schreiner 2

4 Abstract Syntax Non-terminal symbols. { C, E, L, N. { Variables over syntax trees. Terminal symbols. +, :=, skip { Labels of syntax trees. Inductive denition of syntax trees. Abstract syntax denes syntax trees! Wolfgang Schreiner 3

5 Example loc 1 := 0; 1 =0 do loc 2 :=@loc 1 +1 od C C ; C L := E while E do C loc_1 od N 0 E = E L := E loc_1 N 0 E + loc_1 N 1 Semantics gives meaning to syntax trees! Wolfgang Schreiner 4

6 Typing Rules Abstruct syntax does not dene wellformed programs only. { Phrase \(0=1)+2" allowed. { Cannot add boolean to integer. Rene abstract syntax denition. { Integer and boolean expressions. { Dene two distinct syntax domains? { Better: add typing annotations! Attributed syntax trees { Type attributes to all phrase forms. { Syntax tree is well typed if type attributes can be attached to all of its nonterminals. Inference rules used for describing type structures. Wolfgang Schreiner 5

7 Example C: comm C: comm ; C: comm L: intloc := E: intexp loc_1 while E: boolexp do C: comm od N: int E: intexp = E: intexp L: intloc := E: intexp 0 L: intloc loc_1 N: 0 int E: intexp + E: L: intloc loc_1 N: 1 Each subtree is annotated with its type! Wolfgang Schreiner 6

8 Typing Rules Command L: intloc E: intexp C 1 : comm C 2 : comm L:=E: comm C 1 ;C 2 : comm E: boolexp C 1 : comm C 2 : comm if E then C 1 else C 2 : comm E: boolexp C: comm while E do C od: comm skip: comm Expression N: int N: intexp L: intexp E 1 : intexp E 2 : intexp E: boolexp E 1 +E 2 : intexp E 1 : exp E 2 : exp E 1 =E 2 : boolexp Location loc i : intloc, if i > 0 :E: boolexp if 2 fint, boolg Numeral n: int, if n 2 Integer Wolfgang Schreiner 7

9 Typing Rules One typing rule for each construction of each syntax rule. Conditions under which constructions are well typed. Linear Notation (full type annotation): { ((loc 1 ) intloc :=((0) int ) intexp (while ((@(loc 1 ) intloc ) intexp =((0) int ) intexp ) boolexp (do (loc 2 ) intloc := ((@(loc 1 ) intloc ) intexp + ((1) int ) intexp ) intexp ) comm ) comm ) comm. Abbreviation (root type annotation): { loc 1 := 0; 1 =0 do loc 2 :=@loc 1 +1 od: comm Wolfgang Schreiner 8

10 Typing Rules Logic assertion U:. { Tree U is well typed with type. Static typing for language. { Type attributes can be calculated without evaluating the program. Strongly typed language. { No run-time incompatibility errors. Unicity of typing. { Can a syntax tree be typed in multiple ways? Soundness of typing rules. { Are the typing rules sensible in their assignment of type attributes to phrases? Questions will be addressed later. Wolfgang Schreiner 9

11 Induction and Recursion Syntax rule E ::= true j :E j E 1 &E 2 Inductive denition: { true is in Expression. { If E is in Expression, then so is :E. { If E 1 and E 2 are in Expression, then so is E 1 &E 2. { No other trees are in expression. Expression = set of trees! Generate all trees in stages. { stage 0 = fg. { stage i+1 = stage i [ f :E j E 2 stage i g [ f E 1 &E 2 j E 1, E 2 2 stage i g. { Expression = [ i0 stage i. Any tree in Expression is constructed in a nite number of stages. Wolfgang Schreiner 10

12 Structural Induction Proof technique for syntax trees. { Goal: prove P (t) for all trees t in a a language. { Inductive base: Prove that P holds for all trees in stage 1. { Inductive hypothesis: Assume that P holds for all trees in stages stage j with j i. { Inductive step: Prove that P holds for all trees in stage i. Prove P (t) for all trees t in Expression. { P (true) holds. { P (:E) holds assuming that P (E) holds (for arbitrary E). { P (E 1 &E 2 ) holds assuming that P (E 1 ) holds and P (E 2 ) holds (for arbitrary E 1, E 2 ). Syntax rules guide the proof! Wolfgang Schreiner 11

13 Unicity of Typing Can a syntax tree be typed in multiple ways? Unicity of typing property. { Every syntax tree has as most one assignment of typing attributes to its nodes. { If P : holds, then is unique. Unicity of Typing holds for Numeral. { By single typing rule, if N: holds, then = int (for all N 2 Numeral). Unicity of Typing holds for Location. { By single typing rule, if L: holds, then = intloc (for all L 2 Location). Wolfgang Schreiner 12

14 Unicity of Typing Unicity of typing holds for Expression: { Case N. N:int holds. By single typing rule, N:intexp holds. { Case E 1 +E 2. By inductive hypothesis, E 1 : 1 and E 2 : 2 hold for unique 1 and 2. By single typing rule, E 1 :intexp and E 2 :intexp must hold. If 1 = 2 =intexp, then E 1 +E 2 :intexp. Otherwise, E 1 +E 2 has no typing. {... Unicity of typing holds for Command: { Case L := E. L:intloc holds. E: 1 holds for unique 1. By single typing rule, 1 must be intexp to have L:=E: comm. Otherwise, L:=E has no typing. {... Unicity of typing holds for all four syntax domains. Wolfgang Schreiner 13

15 Typing Rules Dene a Language Typing rules (not abstract syntax) dene language. { Only well-formed programs are of value. { Programs are well-typed trees. Signicance of unicity of typing: { Linear representation without type annotations represents (at most) one program. { Example: 0+1. Without unicity of typing: { Coherence: dierent tree derivations of a linear representation should have same meaning. { E:intexp E:realexp E 1 :realexp E 2 :realexp E 1 +E 2 :realexp { (((0) int +(1) int ) intexp ) realexp. { ((((0) int ) intexp ) realexp + (((1) int ) intexp ) realexp ) realexp Wolfgang Schreiner 14

16 Proof Trees Programs may be directly derived from typing rules. Typing rules form a logic. Set of axioms and inference rules. (Inverted) trees are logic proof trees. loc_1: intloc 1: int loc_1: intloc 0: intexp 1: intexp 0: intexp loc_2 : +1: =0 : intexp loc_2 :=@ loc_1 +1: comm =0 do loc_2 :=@ loc_1+1 od : comm Wolfgang Schreiner 15

17 Semantics of the Core Language Denotational semantics Recursively dened function. { Mapping of a well-typed derivation tree to its mathematical meaning. Semantic algebras. { Meaning sets (domains) and operations. { Bool, Int, Location, Store. For each typing rule, a recursive denition. { L: intloc E: intexp L:=E: comm { [[L:=E: comm]]... =... [[L: intloc]]... [[E: intexp]]... Compositional semantic denitions. { Meaning of tree constructed from meanings of its subtrees. Function [[.]] is read as \the meaning of" Wolfgang Schreiner 16

18 Semantic Algebras Bool = ftrue, falseg not: Bool! Bool not(false) = true; not(true) = false equalbool: Bool Bool! Bool equalbool(m, n) = (m=n) Int = f..., -1, 0, 1,... g plus: Int Int! Int plus(m, n) = m + n equalint: Int Int! Bool equalint(m, n) = (m=n) Location = floc i j i > 0g Wolfgang Schreiner 17

19 Semantic Algebras Store = f hn 1 ; n 2 ; : : : ; n m i j n i 2 Int, 1 i m, m 0 g lookup: Location Store! Int lookup(loc j, hn 1 ; n 2 ; : : : ; n j ; : : : ; n m i) = n j (if j > m, then lookup(loc j, hn 1 ; : : : ; n m i) = 0) update: Location Int Store! Store update(loc j, j, hn 1 ; n 2 ; : : : ; n j ; : : : ; n m i) = hn 1 ; n 2 ; : : : ; n; : : : ; n m i (if j > m, then update(loc j, n, hn 1 ; : : : ; n m i) = hn 1 ; n 2 ; : : : ; n m i) if : Bool Store? Store?! Store? if (true, s 1, s 2 ) = s 1 if (false, s 1, s 2 ) = s 2 (Store? = Store [ f?g,? = \bottom" = non-termination) Wolfgang Schreiner 18

20 Command Semantics [[.: comm]]: Store! Store? [[L:=E: comm]](s) = update([[l: intloc]], [[E: intexp]](s), s) [[C 1 ;C 2 : comm]](s) = [[C 2 : comm]]([[c 1 : comm]](s)) [[if E then C 1 else C 2 : comm]](s) = if ([[E: boolexp]](s), [[C 1 : comm]](s), [[C 2 : comm]](s)) [[while E do C od: comm]](s) = w(s) where w(s) = if ([[E: boolexp]](s), w([[c: comm]](s)), s) [[skip: comm]](s) = s The meaning of a command is a function from Store to Store. Wolfgang Schreiner 19

21 Expression Semantics [[.: exp]]: Store! (Int [ Bool) [[N: intexp]](s) = [[N: int]] [[@L: intexp]](s) = lookup([[l: intloc]], s) [[:E: boolexp]](s) = not([[e: boolexp]](s)) [[E 1 +E 2 : intexp]](s) = plus([[e 1 : intexp]](s), [[E 2 : intexp]](s)) [[E 1 =E 2 : boolexp]](s) = equalbool([[e 1 : boolexp]](s), [[E 2 : boolexp]](s)) [[E 1 =E 2 : boolexp]](s) = equalint([[e 1 : intexp]](s), [[E 2 : intexp]](s)) [[.: intloc]]: Location [[loc i : intloc]] = loc i [[.: int]]: Int [[n: int]] = n The meaning of an expression is a function from Store to Int or Bool. Wolfgang Schreiner 20

22 Example P = Q; R Q = loc 2 :=1; R = 2 =0 then skip else S S = loc 1 :=@loc 2 +4 [[P: comm]](s) = [[R: comm]]([[q: comm]](s)) = [[R: comm]]update(loc 2, 1, s) = if ([[@loc 2 =0: boolexp]]update(loc 2, 1, s), [[skip: comm]]update(loc 2, 1, s), [[S: comm]]update(loc 2, 1, s)) = if (false, [[skip: comm]]update(loc 2, 1, s), [[S: comm]]update(loc 2, 1, s)) = [[S: comm]]update(loc 2, 1, s) = update(loc 1, [[@loc 2 +4: intexp]]update(loc 2, 1, s), update(loc 2, 1, s)) = update(loc 1, 5, update(loc 2, 1, s)) Program semantics can be studied independently of specic storage vector! Wolfgang Schreiner 21

23 Soundness of the Typing Rules. Are the typing rules sensible in their assignment of type attributes to phrases? Typing rules must be sound. { Every well-typed program has a meaning. Type attributes: { ::= int j bool { ::= intloc j exp j comm Mapping of attributes to meanings: { [[int]] = Int { [[bool]] = Bool { [[intloc]] = Location { [[ exp]] = Store! [[ ]] { [[comm]] = Store! Store? How are [[P:]] and [[]] related? Wolfgang Schreiner 22

24 Soundness Theorem [[P:]] 2 [[]], for every well-typed phrase P: Case n: int { [[n: int]] = n 2 Int = [[int]] intexp { We know [[L: intloc]] = l 2 [[intloc]] = Location. Then, for every Store s, [[@L: intexp]](s) = lookup(l, s) 2 Int i.e. [[@L: intexp]] 2 Store! Int = [[intexp]]. Case C 1 ;C 2 : comm { We know [[C 1 : comm]] and [[C 2 : comm]] are elements of Store! Store?. For every Store s, we have [[C 1 ;C 2 : comm]](s) = [[C 2 : comm]]([[c 1 : comm]](s)) and [[C 2 :comm]](s) = s 1 2 Store?. If s 1 =?, [[C 2 : comm]](s 1 )=? 2 Store?. If s 1 2 Store, then [[C 2 : comm]](s 1 ) 2 Store?. Hence, [[C 1 ;C 2 : comm]] 2 Store! Store? = [[comm]]. Prove one case for each typing rule. Wolfgang Schreiner 23

25 Operational Properties Denotational semantics constructs mathematical functions. { Function extensionality for reasoning. Operational semantics reveals computational patterns. { Computation steps undertaken for evaluating the program. Denotational semantics has operational ower. { [[loc 3 :=@loc 1 +1: comm]]h3; 4; 5i ) update(loc 3, [[@loc 1 +1: intexp]]h3; 4; 5i, h3; 4; 5i) )... ) update(loc 3, 4, h3; 4; 5i) ) h3; 4; 4i Can we use denotational denitions as operational rewrite rules? Wolfgang Schreiner 24

26 Denotations as Rewrite Rules Op. semantics reduces programs to values. A program is a phrase [[C: comm]]s 0. Values are from semantic domains. { Booleans, numerals, locations, storage vectors. Equational denitions get rewrite rules. { Denotation: f (x 1 ; x 2 ; : : : ; x n ) = v { Rule: f (x 1 ; x 2 ; : : : ; x n ) ) v Computation is a sequence of rewrite steps p 0 ) pn. { p 0 ) p 1 ) : : : ) p n. { Each computation step p i ) p i+1 replaces a subphrase (the redex) in p i according to some rewrite rule. If pn is a value, computation terminates. Which properties shall semantics fulll? Wolfgang Schreiner 25

27 Properties of Operational Semantics Soundness. { If p has an underlying \meaning" m and p ) p 0, then p 0 means m as well. { By denition of ). Subject reduction. { If p has an underlying \type" and p ) p 0, then p 0 has as well. { By soundness of typing. Strong typing. { If p is well-typed and p ) p 0, then p 0 contains no operatoroperand incompatibilities. { By induction over computation rules. Computational adequacy. { A program p's underlying meaning is a proper meaning m, if there is some value v such that p ) v and v means m. Wolfgang Schreiner 26

28 Computability of Phrases Predicate comp (computable): { comp intloc (p) := p ) v and v means l where l 2 Location is the meaning of p. { comp exp (p) := p(s) ) v and v means n where s 2 Store and p(s) means n 2 [[ ]]. { compcomm(p) := p(s) ) v and v means s 0 where s 2 Store and p(s) means s 0 2 Store. comp [[U: ]] holds for all well-typed phrases U:. { Induction on typing rules. Computational adequacy follows from soundness of typing, soundness of operational semantics and the computability of phrases. Wolfgang Schreiner 27

29 Design of a Language Core Contradictory design objectives: Oriented towards a specic problem area. General purpose. User friendly. Ecient implementation possible. Extensible by new language features. Secure agains programming errors. Simple syntax and semantics. Logical support for verication.... Design is an artistic activity! Wolfgang Schreiner 28

30 Orthagonality A language should be based on few fundamental principles that may be combined without unneccessary restrictions. Orthagonal languages are easier to understand for programmers and implementors. Denotational semantics may help to achieve this. { Dene sets of meanings and operations. { Give syntactic representations. { Organize into abstract syntax denition. In the following we will study a set of basic design principles. Wolfgang Schreiner 29

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

The Prototype Verification System PVS

The Prototype Verification System PVS The Prototype Verification System PVS Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

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

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

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

Languages with Contexts II: An Applicative Language

Languages with Contexts II: An Applicative Language Languages with Contexts II: An Applicative Language Wolfgang Schreiner Research Institute for Symbolic Computation (RISC-Linz) Johannes Kepler University, A-4040 Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

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

A CRASH COURSE IN SEMANTICS

A CRASH COURSE IN SEMANTICS LAST TIME Recdef More induction NICTA Advanced Course Well founded orders Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 Well founded recursion Calculations: also/finally {P}... {Q}

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

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

Formally Specified Computer Algebra Software - DK10

Formally Specified Computer Algebra Software - DK10 1 / 23 Formally Specified Computer Algebra Software - DK10 Muhammad Taimoor Khan Supervisor: Prof. Wolfgang Schreiner Doktoratskolleg Computational Mathematics Johannes Kepler University Linz, Austria

More information

Introduction to Denotational Semantics. Brutus Is An Honorable Man. Class Likes/Dislikes Survey. Dueling Semantics

Introduction to Denotational Semantics. Brutus Is An Honorable Man. Class Likes/Dislikes Survey. Dueling Semantics Brutus Is An Honorable Man HW2 will not be due today. Homework X+1 will never be due until after I have returned Homework X to you. Normally this is never an issue, but I was sick yesterday and was hosting

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

Formally Specified Computer Algebra Software - DK10

Formally Specified Computer Algebra Software - DK10 1 / 28 Formally Specified Computer Algebra Software - DK10 Muhammad Taimoor Khan Supervisor: Prof. Wolfgang Schreiner Doktoratskolleg Computational Mathematics Johannes Kepler University Linz, Austria

More information

Denotational Semantics

Denotational Semantics Denotational Semantics 8 12 lectures for Part II CST 2010/11 Marcelo Fiore Course web page: http://www.cl.cam.ac.uk/teaching/1011/denotsem/ 1 Lecture 1 Introduction 2 What is this course about? General

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

More on Operational Semantics

More on Operational Semantics More on Operational Semantics (Slides modified from those created by Xinyu Feng) 1 / 23 Outline Various formulations Extensions Going wrong Local variable declaration Heap Big-step operational semantics

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

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

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

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

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics Recall Architecture of Compilers, Interpreters CMSC 330: Organization of Programming Languages Source Scanner Parser Static Analyzer Operational Semantics Intermediate Representation Front End Back End

More information

Programming Languages

Programming Languages CSE 230: Winter 2008 Principles of Programming Languages Ocaml/HW #3 Q-A Session Push deadline = Mar 10 Session Mon 3pm? Lecture 15: Type Systems Ranjit Jhala UC San Diego Why Typed Languages? Development

More information

Program Design in PVS. Eindhoven University of Technology. Abstract. Hoare triples (precondition, program, postcondition) have

Program Design in PVS. Eindhoven University of Technology. Abstract. Hoare triples (precondition, program, postcondition) have Program Design in PVS Jozef Hooman Dept. of Computing Science Eindhoven University of Technology P.O. Box 513, 5600 MB Eindhoven, The Netherlands e-mail: wsinjh@win.tue.nl Abstract. Hoare triples (precondition,

More information

Induction and Semantics in Dafny

Induction and Semantics in Dafny 15-414 Lecture 11 1 Instructor: Matt Fredrikson Induction and Semantics in Dafny TA: Ryan Wagner Encoding the syntax of Imp Recall the abstract syntax of Imp: a AExp ::= n Z x Var a 1 + a 2 b BExp ::=

More information

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Alessandro Artale UniBZ - http://www.inf.unibz.it/ artale/ SECTION 5.5 Application: Correctness of Algorithms Copyright Cengage Learning. All

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

Syntax vs. semantics. Detour: Natural deduction. Syntax vs. semantics (cont d) Syntax = grammatical structure Semantics = underlying meaning

Syntax vs. semantics. Detour: Natural deduction. Syntax vs. semantics (cont d) Syntax = grammatical structure Semantics = underlying meaning Syntax vs. semantics CMSC 631 Program nalysis and Understanding Spring 2013 Operational Semantics Syntax = grammatical structure Semantics = underlying meaning Sentences in a language can be syntactically

More information

Basic concepts. Chapter Toplevel loop

Basic concepts. Chapter Toplevel loop Chapter 3 Basic concepts We examine in this chapter some fundamental concepts which we will use and study in the following chapters. Some of them are specific to the interface with the Caml language (toplevel,

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

Semantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics

Semantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics There is no single widely acceptable notation or formalism for describing semantics Operational Describe the meaning of a program by executing its statements on a machine, either simulated or actual. The

More information

Provably Correct Software

Provably Correct Software Provably Correct Software Max Schäfer Institute of Information Science/Academia Sinica September 17, 2007 1 / 48 The Need for Provably Correct Software BUT bugs are annoying, embarrassing, and cost gazillions

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

7. Introduction to Denotational Semantics. Oscar Nierstrasz

7. Introduction to Denotational Semantics. Oscar Nierstrasz 7. Introduction to Denotational Semantics Oscar Nierstrasz Roadmap > Syntax and Semantics > Semantics of Expressions > Semantics of Assignment > Other Issues References > D. A. Schmidt, Denotational Semantics,

More information

Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have

Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have been red in the sequence up to and including v i (s) is deg(v)? s(v), and by the induction hypothesis this sequence

More information

Chapter 3. Describing Syntax and Semantics ISBN

Chapter 3. Describing Syntax and Semantics ISBN Chapter 3 Describing Syntax and Semantics ISBN 0-321-49362-1 Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the

More information

Chapter 3. Describing Syntax and Semantics

Chapter 3. Describing Syntax and Semantics Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:

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

Introduction to Axiomatic Semantics

Introduction to Axiomatic Semantics Introduction to Axiomatic Semantics Meeting 10, CSCI 5535, Spring 2009 Announcements Homework 3 due tonight Homework 2 is graded 13 (mean), 14 (median), out of 21 total, but Graduate class: final project

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

Chapter 3 (part 3) Describing Syntax and Semantics

Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings

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

Mutable References. Chapter 1

Mutable References. Chapter 1 Chapter 1 Mutable References In the (typed or untyped) λ-calculus, or in pure functional languages, a variable is immutable in that once bound to a value as the result of a substitution, its contents never

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

CSE 505: Concepts of Programming Languages

CSE 505: Concepts of Programming Languages CSE 505: Concepts of Programming Languages Dan Grossman Fall 2009 Lecture 4 Proofs about Operational Semantics; Pseudo-Denotational Semantics Dan Grossman CSE505 Fall 2009, Lecture 4 1 This lecture Continue

More information

Softwaretechnik. Lecture 03: Types and Type Soundness. Peter Thiemann. University of Freiburg, Germany SS 2008

Softwaretechnik. Lecture 03: Types and Type Soundness. Peter Thiemann. University of Freiburg, Germany SS 2008 Softwaretechnik Lecture 03: Types and Type Soundness Peter Thiemann University of Freiburg, Germany SS 2008 Peter Thiemann (Univ. Freiburg) Softwaretechnik SWT 1 / 35 Table of Contents Types and Type correctness

More information

Program certification with computational

Program certification with computational Program certification with computational effects Burak Ekici j.w.w. Jean-Guillaume Dumas, Dominique Duval, Damien Pous y LJK, University Joseph Fourier, Grenoble y LIP, ENS-Lyon November 5, 2014 JNCF 14,

More information

Verifying Safety Property of Lustre Programs: Temporal Induction

Verifying Safety Property of Lustre Programs: Temporal Induction 22c181: Formal Methods in Software Engineering The University of Iowa Spring 2008 Verifying Safety Property of Lustre Programs: Temporal Induction Copyright 2008 Cesare Tinelli. These notes are copyrighted

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

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

Recursive Definitions Structural Induction Recursive Algorithms

Recursive Definitions Structural Induction Recursive Algorithms Chapter 4 1 4.3-4.4 Recursive Definitions Structural Induction Recursive Algorithms 2 Section 4.1 3 Principle of Mathematical Induction Principle of Mathematical Induction: To prove that P(n) is true for

More information

1 Introduction One of the contributions of Java is in its bytecode verier, which checks type safety of bytecode for JVM (Java Virtual Machine) prior t

1 Introduction One of the contributions of Java is in its bytecode verier, which checks type safety of bytecode for JVM (Java Virtual Machine) prior t On a New Method for Dataow Analysis of Java Virtual Machine Subroutines Masami Hagiya Department of Information Science, Graduate School of Science, University of Tokyo hagiyais.s.u-tokyo.ac.jp Abstract

More information

(Refer Slide Time: 4:00)

(Refer Slide Time: 4:00) Principles of Programming Languages Dr. S. Arun Kumar Department of Computer Science & Engineering Indian Institute of Technology, Delhi Lecture - 38 Meanings Let us look at abstracts namely functional

More information

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 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

More information

Type Checking. Outline. General properties of type systems. Types in programming languages. Notation for type rules.

Type Checking. Outline. General properties of type systems. Types in programming languages. Notation for type rules. Outline Type Checking General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time

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

Outline. General properties of type systems. Types in programming languages. Notation for type rules. Common type rules. Logical rules of inference

Outline. General properties of type systems. Types in programming languages. Notation for type rules. Common type rules. Logical rules of inference Type Checking Outline General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time

More information

Introduction to Axiomatic Semantics (1/2)

Introduction to Axiomatic Semantics (1/2) #1 Introduction to Axiomatic Semantics (1/2) How s The Homework Going? Remember: just do the counterexample guided abstraction refinement part of DPLL(T). If you notice any other errors, those are good

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

More information

In Our Last Exciting Episode

In Our Last Exciting Episode In Our Last Exciting Episode #1 Lessons From Model Checking To find bugs, we need specifications What are some good specifications? To convert a program into a model, we need predicates/invariants and

More information

Integers and Mathematical Induction

Integers and Mathematical Induction IT Program, NTUT, Fall 07 Integers and Mathematical Induction Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology TAIWAN 1 Learning Objectives Learn about

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

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

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

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Operational Semantics CMSC 330 Summer 2018 1 Formal Semantics of a Prog. Lang. Mathematical description of the meaning of programs written in that language

More information

More Untyped Lambda Calculus & Simply Typed Lambda Calculus

More Untyped Lambda Calculus & Simply Typed Lambda Calculus Concepts in Programming Languages Recitation 6: More Untyped Lambda Calculus & Simply Typed Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky,

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

Specifying and Verifying Programs (Part 2)

Specifying and Verifying Programs (Part 2) Specifying and Verifying Programs (Part 2) 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

Design of the Programming Language Forsythe. John C. Reynolds. June 28, 1996 CMU{CS{96{146. School of Computer Science. Carnegie Mellon University

Design of the Programming Language Forsythe. John C. Reynolds. June 28, 1996 CMU{CS{96{146. School of Computer Science. Carnegie Mellon University Design of the Programming Language Forsythe John C. Reynolds June 28, 1996 CMU{CS{96{146 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 To be reprinted in Algol-like Languages,

More information

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction Topics Chapter 3 Semantics Introduction Static Semantics Attribute Grammars Dynamic Semantics Operational Semantics Axiomatic Semantics Denotational Semantics 2 Introduction Introduction Language implementors

More information

Propositional Calculus: Boolean Functions and Expressions. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus: Boolean Functions and Expressions. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus: Boolean Functions and Expressions CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Objective: To provide students with the concepts and

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

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in .

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in  . 0.1 More on innity.math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in email. 0.1.1 If you haven't read 1.3, do so now! In notes#1

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

Inference rule for Induction

Inference rule for Induction Inference rule for Induction Let P( ) be a predicate with domain the positive integers BASE CASE INDUCTIVE STEP INDUCTIVE Step: Usually a direct proof Assume P(x) for arbitrary x (Inductive Hypothesis),

More information

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1 Introduction to Automata Theory BİL405 - Automata Theory and Formal Languages 1 Automata, Computability and Complexity Automata, Computability and Complexity are linked by the question: What are the fundamental

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

Reasoning About Imperative Programs. COS 441 Slides 10

Reasoning About Imperative Programs. COS 441 Slides 10 Reasoning About Imperative Programs COS 441 Slides 10 The last few weeks Agenda reasoning about functional programming It s very simple and very uniform: substitution of equal expressions for equal expressions

More information

Program analysis parameterized by the semantics in Maude

Program analysis parameterized by the semantics in Maude Program analysis parameterized by the semantics in Maude A. Riesco (joint work with I. M. Asăvoae and M. Asăvoae) Universidad Complutense de Madrid, Madrid, Spain Workshop on Logic, Algebra and Category

More information

CSc 520 Principles of Programming Languages

CSc 520 Principles of Programming Languages CSc 520 Principles of Programming Languages 50: Semantics Introduction Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona Copyright c 2005 Christian Collberg

More information

Specifying Syntax. An English Grammar. Components of a Grammar. Language Specification. Types of Grammars. 1. Terminal symbols or terminals, Σ

Specifying Syntax. An English Grammar. Components of a Grammar. Language Specification. Types of Grammars. 1. Terminal symbols or terminals, Σ Specifying Syntax Language Specification Components of a Grammar 1. Terminal symbols or terminals, Σ Syntax Form of phrases Physical arrangement of symbols 2. Nonterminal symbols or syntactic categories,

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

Introduction to the Lambda Calculus. Chris Lomont

Introduction to the Lambda Calculus. Chris Lomont Introduction to the Lambda Calculus Chris Lomont 2010 2011 2012 www.lomont.org Leibniz (1646-1716) Create a universal language in which all possible problems can be stated Find a decision method to solve

More information

Chapter 3. Describing Syntax and Semantics ISBN

Chapter 3. Describing Syntax and Semantics ISBN Chapter 3 Describing Syntax and Semantics ISBN 0-321-49362-1 Chapter 3 Topics Describing the Meanings of Programs: Dynamic Semantics Copyright 2015 Pearson. All rights reserved. 2 Semantics There is no

More information

Abstract This paper describes AxSL, an Axiomatic Specication Language that extends algebraic axiom methods to support object-oriented concepts such as

Abstract This paper describes AxSL, an Axiomatic Specication Language that extends algebraic axiom methods to support object-oriented concepts such as Extending Algebraic Axiom Techniques to Handle Object-Oriented Specications Alyce Brady, Member, IEEE David R. Musser, Member, IEEE Computer Society David L. Spooner, Member, IEEE August 2, 1999 Abstract

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

Programming Languages Fall 2013

Programming Languages Fall 2013 Programming Languages Fall 2013 Lecture 3: Induction Prof. Liang Huang huang@qc.cs.cuny.edu Recursive Data Types (trees) data Ast = ANum Integer APlus Ast Ast ATimes Ast Ast eval (ANum x) = x eval (ATimes

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

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

Lectures 20, 21: Axiomatic Semantics

Lectures 20, 21: Axiomatic Semantics Lectures 20, 21: Axiomatic Semantics Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Static Analysis Based on slides by George Necula Pratikakis (CSD) Axiomatic Semantics

More information

Trees Rooted Trees Spanning trees and Shortest Paths. 12. Graphs and Trees 2. Aaron Tan November 2017

Trees Rooted Trees Spanning trees and Shortest Paths. 12. Graphs and Trees 2. Aaron Tan November 2017 12. Graphs and Trees 2 Aaron Tan 6 10 November 2017 1 10.5 Trees 2 Definition Definition Definition: Tree A graph is said to be circuit-free if, and only if, it has no circuits. A graph is called a tree

More information

Introduction to Axiomatic Semantics (1/2)

Introduction to Axiomatic Semantics (1/2) #1 Introduction to Axiomatic Semantics (1/2) How s The Homework Going? Remember that you can t just define a meaning function in terms of itself you must use some fixed point machinery. #2 #3 Observations

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

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

CS152: Programming Languages. Lecture 2 Syntax. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 2 Syntax. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 2 Syntax Dan Grossman Spring 2011 Finally, some formal PL content For our first formal language, let s leave out functions, objects, records, threads, exceptions,...

More information

time using O( n log n ) processors on the EREW PRAM. Thus, our algorithm improves on the previous results, either in time complexity or in the model o

time using O( n log n ) processors on the EREW PRAM. Thus, our algorithm improves on the previous results, either in time complexity or in the model o Reconstructing a Binary Tree from its Traversals in Doubly-Logarithmic CREW Time Stephan Olariu Michael Overstreet Department of Computer Science, Old Dominion University, Norfolk, VA 23529 Zhaofang Wen

More information

Fall Lecture 3 September 4. Stephen Brookes

Fall Lecture 3 September 4. Stephen Brookes 15-150 Fall 2018 Lecture 3 September 4 Stephen Brookes Today A brief remark about equality types Using patterns Specifying what a function does equality in ML e1 = e2 Only for expressions whose type is

More information

Fall Recursion and induction. Stephen Brookes. Lecture 4

Fall Recursion and induction. Stephen Brookes. Lecture 4 15-150 Fall 2018 Stephen Brookes Lecture 4 Recursion and induction Last time Specification format for a function F type assumption guarantee (REQUIRES) (ENSURES) For all (properly typed) x satisfying the

More information