Semantics and Verification of Software
|
|
- Jean Sullivan
- 5 years ago
- Views:
Transcription
1 Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University
2 Recap: Operational Semantics of Blocks and Procedures Outline of Lecture 15 Recap: Operational Semantics of Blocks and Procedures Denotational Semantics of Blocks and Procedures Handling Variable Declarations Handling Procedures Two Examples Justification of Fixpoint Semantics 2 of 22 Semantics and Verification of Software
3 Recap: Operational Semantics of Blocks and Procedures Extending the Syntax Syntactic categories: Category Domain Meta variable Procedure identifiers PVar = {P, Q,...} P Procedure declarations PDec p Variable declarations VDec v Commands (statements) Cmd c Context-free grammar: p ::= proc P is c end;p ε PDec v ::= var x;v ε VDec c ::= skip x := a c 1 ;c 2 if b then c 1 else c 2 end while b do c end call P begin v p c end Cmd All used variable/procedure identifiers have to be declared Identifiers declared within a block must be distinct 3 of 22 Semantics and Verification of Software
4 Recap: Operational Semantics of Blocks and Procedures Locations and Stores So far: states Σ = {σ σ : Var Z} Now: explicit control over all (nested) instances of a variable: variable environments VEnv := {ρ ρ : Var Loc} (partial function to maintain declaredness information) locations Loc := N stores Sto := {σ σ : Loc Z} (partial function to maintain allocation information) Two-level access to a variable x Var: 1. determine current memory location of x: l := ρ(x) 2. reading/writing access to σ at location l Thus: previous state information represented as σ ρ 4 of 22 Semantics and Verification of Software
5 Recap: Operational Semantics of Blocks and Procedures Procedure Environments and Declarations Effect of procedure call determined by its body and variable and procedure environment of its declaration: PEnv := {π π : PVar Cmd VEnv PEnv} denotes the set of procedure environments Effect of declaration: update of environment (and store) upd v. : VDec VEnv Sto VEnv Sto upd v var x;v (ρ, σ) := upd v v (ρ[x l x ], σ[l x 0]) upd v ε (ρ, σ) := (ρ, σ) upd p. : PDec VEnv PEnv PEnv upd p proc P is c end;p (ρ, π) := upd p p (ρ, π[p (c, ρ, π)]) upd p ε (ρ, π) := π where l x := min{l Loc σ(l) = } 5 of 22 Semantics and Verification of Software
6 Recap: Operational Semantics of Blocks and Procedures Execution Relation I Definition (Execution relation) For c Cmd, σ, σ Sto, ρ VEnv, and π PEnv, the execution relation (ρ, π) c, σ σ ( in environment (ρ, π), statement c transforms store σ into σ ) is defined by the following rules: (seq) (if-t) (asgn) (skip) (ρ, π) skip, σ σ a, σ ρ z (ρ, π) x := a, σ σ[ρ(x) z] (ρ, π) c 1, σ σ (ρ, π) c 2, σ σ (ρ, π) c 1 ;c 2, σ σ b, σ ρ true (ρ, π) c 1, σ σ (ρ, π) if b then c 1 else c 2 end, σ σ 6 of 22 Semantics and Verification of Software
7 Recap: Operational Semantics of Blocks and Procedures Execution Relation II Definition (Execution relation; continued) (wh-t) (call) (block) (if-f) b, σ ρ false (ρ, π) c 2, σ σ (ρ, π) if b then c 1 else c 2 end, σ σ b, σ ρ false (wh-f) (ρ, π) while b do c end, σ σ b, σ ρ true (ρ, π) c, σ σ (ρ, π) while b do c end, σ σ (ρ, π) while b do c end, σ σ (ρ, π [P (c, ρ, π )]) c, σ σ (ρ, π) call P, σ σ if π(p) = (c, ρ, π ) upd v v (ρ, σ) = (ρ, σ ) upd p p (ρ, π) = π (ρ, π ) c, σ σ (ρ, π) begin v p c end, σ σ 7 of 22 Semantics and Verification of Software
8 Denotational Semantics of Blocks and Procedures Outline of Lecture 15 Recap: Operational Semantics of Blocks and Procedures Denotational Semantics of Blocks and Procedures Handling Variable Declarations Handling Procedures Two Examples Justification of Fixpoint Semantics 8 of 22 Semantics and Verification of Software
9 Denotational Semantics of Blocks and Procedures The Approach Operational semantics: syntactic approach procedure environment stores code of body semantics of call = inlining 9 of 22 Semantics and Verification of Software
10 Denotational Semantics of Blocks and Procedures The Approach Operational semantics: syntactic approach procedure environment stores code of body semantics of call = inlining Denotational semantics: semantic approach procedure environment stores (partial) storage transformations semantics of call = function application variables handled as in operational semantics (by environment and stores) declarations of recursive procedures handled by fixpoint approach 9 of 22 Semantics and Verification of Software
11 Handling Variable Declarations Outline of Lecture 15 Recap: Operational Semantics of Blocks and Procedures Denotational Semantics of Blocks and Procedures Handling Variable Declarations Handling Procedures Two Examples Justification of Fixpoint Semantics 10 of 22 Semantics and Verification of Software
12 Handling Variable Declarations Handling Variable Declarations Exactly as in operational semantics: Variable environments keep location information: with Loc := N VEnv := {ρ ρ : Var Loc} 11 of 22 Semantics and Verification of Software
13 Handling Variable Declarations Handling Variable Declarations Exactly as in operational semantics: Variable environments keep location information: with Loc := N VEnv := {ρ ρ : Var Loc} Effect of variable declaration: update of environment and store upd v. : VDec VEnv Sto VEnv Sto where l x := min{l Loc σ(l) = } upd v var x;v (ρ, σ) := upd v v (ρ[x l x ], σ[l x 0]) upd v ε (ρ, σ) := (ρ, σ) 11 of 22 Semantics and Verification of Software
14 Handling Variable Declarations Statement Semantics Using Variable Environments First step: reformulation of Definition 6.3 using variable environments and locations So far: C. : Cmd (Σ Σ) 12 of 22 Semantics and Verification of Software
15 Handling Variable Declarations Statement Semantics Using Variable Environments First step: reformulation of Definition 6.3 using variable environments and locations So far: C. : Cmd (Σ Σ) Definition 15.1 (Denotational semantics using locations) The (denotational) semantic functional for statements, C. : Cmd VEnv (Sto Sto), is given by: C skip ρ := id Sto C x := a ρ σ := σ[ρ(x) A a (lookup ρ σ)] C c 1 ;c 2 ρ := (C c 2 ρ) (C c 1 ρ) C if b then c 1 else c 2 end ρ := cond(b b (lookup ρ), C c 1 ρ, C c 2 ρ) C while b do c end ρ := fix(φ) where lookup : VEnv Sto Σ with lookup ρ σ := σ ρ and Φ : (Sto Sto) (Sto Sto) : f cond(b b (lookup ρ), f C c ρ, id Sto ) 12 of 22 Semantics and Verification of Software
16 Handling Procedures Outline of Lecture 15 Recap: Operational Semantics of Blocks and Procedures Denotational Semantics of Blocks and Procedures Handling Variable Declarations Handling Procedures Two Examples Justification of Fixpoint Semantics 13 of 22 Semantics and Verification of Software
17 Handling Procedures Procedure Environments Procedure environments now store semantic information: So far: PEnv := {π π : PVar Cmd VEnv PEnv} Now: PEnv := {π π : PVar (Sto Sto)}, to be used in C. : Cmd VEnv PEnv (Sto Sto) 14 of 22 Semantics and Verification of Software
18 Handling Procedures Procedure Environments Procedure environments now store semantic information: So far: PEnv := {π π : PVar Cmd VEnv PEnv} Now: PEnv := {π π : PVar (Sto Sto)}, to be used in C. : Cmd VEnv PEnv (Sto Sto) Procedure declarations ( proc P is c end ) update procedure environment: upd p. : PDec VEnv PEnv PEnv non-recursive case: P not (indirectly) called within c π(p) immediately given by C c ρ π upd p proc P is c end;p (ρ, π) := upd p p (ρ, π[p C c ρ π]) recursive case: π(p) must be a solution of equation f = C c ρ π[p f] (cf. fixpoint semantics of while loop Slide 6.12) upd p proc P is c end;p (ρ, π) := upd p p (ρ, π[p fix(ψ)]) where Ψ : (Sto Sto) (Sto Sto) : f C c ρ π[p f] 14 of 22 Semantics and Verification of Software
19 Handling Procedures Procedure Environments Procedure environments now store semantic information: So far: PEnv := {π π : PVar Cmd VEnv PEnv} Now: PEnv := {π π : PVar (Sto Sto)}, to be used in C. : Cmd VEnv PEnv (Sto Sto) Procedure declarations ( proc P is c end ) update procedure environment: upd p. : PDec VEnv PEnv PEnv non-recursive case: P not (indirectly) called within c π(p) immediately given by C c ρ π upd p proc P is c end;p (ρ, π) := upd p p (ρ, π[p C c ρ π]) recursive case: π(p) must be a solution of equation f = C c ρ π[p f] (cf. fixpoint semantics of while loop Slide 6.12) upd p proc P is c end;p (ρ, π) := upd p p (ρ, π[p fix(ψ)]) where Ψ : (Sto Sto) (Sto Sto) : f C c ρ π[p f] upd p ε (ρ, π) := π Remark: non-recursive is special case of recursive situation 14 of 22 Semantics and Verification of Software
20 Handling Procedures Statement Semantics Including Procedures So far: C. : Cmd VEnv (Sto Sto) 15 of 22 Semantics and Verification of Software
21 Handling Procedures Statement Semantics Including Procedures So far: C. : Cmd VEnv (Sto Sto) Definition 15.2 (Denotational semantics with procedures) C. : Cmd VEnv PEnv (Sto Sto) is given by C skip ρ π := id Sto C x := a ρ π σ := σ[ρ(x) A a (lookup ρ σ)] C c 1 ;c 2 ρ π := (C c 2 ρ π) (C c 1 ρ π) C if b then c 1 else c 2 end ρ π := cond(b b (lookup ρ), C c 1 ρ π, C c 2 ρ π) C while b do c end ρ π := fix(φ) C call P ρ π := π(p) C begin v p c end ρ π σ := C c ρ π σ where upd v v (ρ, σ) = (ρ, σ ) upd p p (ρ, π) = π lookup ρ σ := σ ρ Φ(f) := cond(b b (lookup ρ), f C c ρ π, id Sto ) 15 of 22 Semantics and Verification of Software
22 Two Examples Outline of Lecture 15 Recap: Operational Semantics of Blocks and Procedures Denotational Semantics of Blocks and Procedures Handling Variable Declarations Handling Procedures Two Examples Justification of Fixpoint Semantics 16 of 22 Semantics and Verification of Software
23 Two Examples Example: Non-Recursive Case Example 15.3 (Non-recursive procedure call) (also demonstrates static scoping principle) c = begin var x; proc P is x := x - 1 end; x := 2; } c 1 begin var x; x := 3; c 2 call P; end; end Initial environments/store: ρ VEnv, π PEnv, σ Sto Computation of C c ρ π σ : on the board 17 of 22 Semantics and Verification of Software
24 Two Examples Example: Recursive Case Example 15.4 (Recursive procedure call) c = begin proc F is if x = 1 then skip; else y := x * y; x := x - 1; call F end end } y := 1; c call F; 2 end c 1 p Initial environments/store: ρ 1 := ρ [x 0, y 1] VEnv π PEnv σ 1 Sto (with σ 1 (0) σ 1 (1)) Computation of C c ρ 1 π σ 1 : on the board 18 of 22 Semantics and Verification of Software
25 Justification of Fixpoint Semantics Outline of Lecture 15 Recap: Operational Semantics of Blocks and Procedures Denotational Semantics of Blocks and Procedures Handling Variable Declarations Handling Procedures Two Examples Justification of Fixpoint Semantics 19 of 22 Semantics and Verification of Software
26 Justification of Fixpoint Semantics Justification of Fixpoint Semantics Lemma (cf. Lemma 7.9) (Sto Sto, ) is a CCPO where f g iff for all σ, σ Σ: f (σ) = σ g(σ) = σ 20 of 22 Semantics and Verification of Software
27 Justification of Fixpoint Semantics Justification of Fixpoint Semantics Lemma (cf. Lemma 7.9) (Sto Sto, ) is a CCPO where f g iff for all σ, σ Σ: f (σ) = σ g(σ) = σ 2. (cf. Lemmata 7.13 and 7.16) Let b BExp, c Cmd, ρ VEnv, π PEnv, and Φ : (Sto Sto) (Sto Sto) with Φ(f ) := cond(b b (lookup ρ), f C c ρ π, id Sto ). Then Φ is monotonic and continuous w.r.t. (Sto Sto, ). 20 of 22 Semantics and Verification of Software
28 Justification of Fixpoint Semantics Justification of Fixpoint Semantics Lemma (cf. Lemma 7.9) (Sto Sto, ) is a CCPO where f g iff for all σ, σ Σ: f (σ) = σ g(σ) = σ 2. (cf. Lemmata 7.13 and 7.16) Let b BExp, c Cmd, ρ VEnv, π PEnv, and Φ : (Sto Sto) (Sto Sto) with Φ(f ) := cond(b b (lookup ρ), f C c ρ π, id Sto ). Then Φ is monotonic and continuous w.r.t. (Sto Sto, ). 3. Let proc P is c end PDec, ρ VEnv, π PEnv, and Ψ : (Sto Sto) (Sto Sto) with Ψ(f ) := C c ρ π[p f ]. Then Ψ is monotonic and continuous w.r.t. (Sto Sto, ). Proof. omitted 20 of 22 Semantics and Verification of Software
29 Outline of Lecture 15 Recap: Operational Semantics of Blocks and Procedures Denotational Semantics of Blocks and Procedures Handling Variable Declarations Handling Procedures Two Examples Justification of Fixpoint Semantics 21 of 22 Semantics and Verification of Software
30 Blocks allow to declare local variables and recursive procedures 22 of 22 Semantics and Verification of Software
31 Blocks allow to declare local variables and recursive procedures Requires concept of locations to support instantiation of variables 22 of 22 Semantics and Verification of Software
32 Blocks allow to declare local variables and recursive procedures Requires concept of locations to support instantiation of variables Static scoping: meaning of identifier determined by declaration (rather than calling) context 22 of 22 Semantics and Verification of Software
33 Blocks allow to declare local variables and recursive procedures Requires concept of locations to support instantiation of variables Static scoping: meaning of identifier determined by declaration (rather than calling) context Meaning of variable declaration: storage allocation 22 of 22 Semantics and Verification of Software
34 Blocks allow to declare local variables and recursive procedures Requires concept of locations to support instantiation of variables Static scoping: meaning of identifier determined by declaration (rather than calling) context Meaning of variable declaration: storage allocation Meaning of procedure call: operationally: execution of procedure body procedure environment records statement ( symbol table ) denotationally: application of procedure meaning procedure environment records (partial) store transformation recursive behavior again handled by fixpoint approach 22 of 22 Semantics and Verification of Software
35 Blocks allow to declare local variables and recursive procedures Requires concept of locations to support instantiation of variables Static scoping: meaning of identifier determined by declaration (rather than calling) context Meaning of variable declaration: storage allocation Meaning of procedure call: operationally: execution of procedure body procedure environment records statement ( symbol table ) denotationally: application of procedure meaning procedure environment records (partial) store transformation recursive behavior again handled by fixpoint approach Further extensions: axiomatic semantics (for proc P is c end PDec) {A} c {B} non-recursive: (call) {A} call P {B} {A} call P {B} {A} c {B} recursive: (call) {A} call P {B} procedure parameters and higher-order procedures 22 of 22 Semantics and Verification of Software
Static Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1617/spa/ Schedule of Lectures Jan 17/19: Interprocedural DFA
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1819/cc/ Generation of Intermediate Code Outline of Lecture 15
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Generation of Intermediate Code Outline of Lecture 15 Generation
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Seminar Analysis and Verification of Pointer Programs (WS
More informationStatic Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-18/spa/ Preliminaries Outline of Lecture 1 Preliminaries Introduction
More informationStatic Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1617/spa/ Recap: Taking Conditional Branches into Account Extending
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Generation of Intermediate Code Conceptual Structure of
More informationApplication: Programming Language Semantics
Chapter 8 Application: Programming Language Semantics Prof. Dr. K. Madlener: Specification and Verification in Higher Order Logic 527 Introduction to Programming Language Semantics Programming Language
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Seminar Analysis and Verification of Pointer Programs (WS
More informationDenotational 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 informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Circularity of Attribute Grammars Circularity of
More informationStatic Program Analysis
Static Program Analysis Lecture 1: Introduction to Program Analysis Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ws-1415/spa/
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Intermediate Code Syntax of EPL Definition (Syntax
More informationNote 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 informationProving Properties on Programs From the Coq Tutorial at ITP 2015
Proving Properties on Programs From the Coq Tutorial at ITP 2015 Reynald Affeldt August 29, 2015 Hoare logic is a proof system to verify imperative programs. It consists of a language of Hoare triples
More informationaxiomatic 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 informationA 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 informationCompiler Construction
Compiler Construction Lecture 15: Code Generation I (Intermediate Code) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ss-14/cc14/
More informationCompiler Construction
Compiler Construction Lecture 15: Code Generation I (Intermediate Code) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ss-14/cc14/
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Static Data Structures Outline of Lecture 18 Recap:
More informationBig-step Operational Semantics (aka Natural Semantics)
x = 1 let x = 1 in... x(1).!x(1) x.set(1) Programming Language Theory Big-step Operational Semantics (aka Natural Semantics) Ralf Lämmel A big-step operational semantics for While 2 This slide is derived
More informationLecture 12: Executing Alpha
High-Performance Embedded Systems-on-a-Chip Lecture 12: Executing Alpha Sanjay Rajopadhye Computer Science, Colorado State University High-Performance Embedded Systems-on-a-Chip p.1/10 Outline Operational
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Recap: LR(1) Parsing Outline of Lecture 11 Recap: LR(1)
More informationMore 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 informationPROGRAM ANALYSIS & SYNTHESIS
Lecture 02 Structural Operational Semantics (SOS) PROGRAM ANALYSIS & SYNTHESIS EranYahav 1 Previously static analysis over-approximation of program behavior abstract interpretation abstraction, transformers,
More informationDenotational Semantics
Denotational Semantics 10 lectures for Part II CST 2011/12 Andrew Pitts Course web page: http://www.cl.cam.ac.uk/teaching/1112/denotsem/ 1 Styles of formal semantics Operational. Meanings for program phrases
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Recap: LR(1) Parsing LR(1) Items and Sets Observation:
More informationLecture 6: The Declarative Kernel Language Machine. September 13th, 2011
Lecture 6: The Declarative Kernel Language Machine September 13th, 2011 Lecture Outline Computations contd Execution of Non-Freezable Statements on the Abstract Machine The skip Statement The Sequential
More informationCS 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 information1 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 informationComp 411 Principles of Programming Languages Lecture 7 Meta-interpreters. Corky Cartwright January 26, 2018
Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters Corky Cartwright January 26, 2018 Denotational Semantics The primary alternative to syntactic semantics is denotational semantics.
More informationCVO103: Programming Languages. Lecture 5 Design and Implementation of PLs (1) Expressions
CVO103: Programming Languages Lecture 5 Design and Implementation of PLs (1) Expressions Hakjoo Oh 2018 Spring Hakjoo Oh CVO103 2018 Spring, Lecture 5 April 3, 2018 1 / 23 Plan Part 1 (Preliminaries):
More informationPrinciples of Programming Languages
Principles of Programming Languages Lecture 08 Control Semantics & Continuations Semantics of Control Flow Sequencers: commands that cause control transfers:! goto! return! exit! break! continue! resultis
More informationCOP 3402 Systems Software Top Down Parsing (Recursive Descent)
COP 3402 Systems Software Top Down Parsing (Recursive Descent) Top Down Parsing 1 Outline 1. Top down parsing and LL(k) parsing 2. Recursive descent parsing 3. Example of recursive descent parsing of arithmetic
More informationContents. 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 informationCompiler Construction Lecture 1: Introduction Winter Semester 2018/19 Thomas Noll Software Modeling and Verification Group RWTH Aachen University
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1819/cc/ Preliminaries Outline of Lecture 1 Preliminaries What
More informationLecture 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 informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: First-Longest-Match Analysis Outline of Lecture
More informationSpecifying 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 informationInduction 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 informationHoare logic. WHILE p, a language with pointers. Introduction. Syntax of WHILE p. Lecture 5: Introduction to separation logic
Introduction Hoare logic Lecture 5: Introduction to separation logic In the previous lectures, we have considered a language, WHILE, where mutability only concerned program variables. Jean Pichon-Pharabod
More informationHoare logic. Lecture 5: Introduction to separation logic. Jean Pichon-Pharabod University of Cambridge. CST Part II 2017/18
Hoare logic Lecture 5: Introduction to separation logic Jean Pichon-Pharabod University of Cambridge CST Part II 2017/18 Introduction In the previous lectures, we have considered a language, WHILE, where
More informationCSc 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 informationLecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far
Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify
More informationIntroduction 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 informationIntroduction 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 informationMutual Summaries: Unifying Program Comparison Techniques
Mutual Summaries: Unifying Program Comparison Techniques Chris Hawblitzel 1, Ming Kawaguchi 2, Shuvendu K. Lahiri 1, and Henrique Rebêlo 3 1 Microsoft Research, Redmond, WA, USA 2 University of California,
More informationProgramming Language Concepts, cs2104 Lecture 04 ( )
Programming Language Concepts, cs2104 Lecture 04 (2003-08-29) Seif Haridi Department of Computer Science, NUS haridi@comp.nus.edu.sg 2003-09-05 S. Haridi, CS2104, L04 (slides: C. Schulte, S. Haridi) 1
More informationHoare Logic and Model Checking
Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Pointers Pointers and
More informationLast 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 informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Conceptual Structure of a Compiler Source code x1 := y2
More informationSémantique des Langages de Programmation (SemLP) DM : Region Types
Sémantique des Langages de Programmation (SemLP) DM : Region Types I) Submission Submission Date : 21/05/2017 Submission Format : Submit a virtual machine (.ova) 1 with 1. an executable of the interpreter,
More informationStatic analysis and all that
Static analysis and all that Martin Steffen IfI UiO Spring 2014 uio Static analysis and all that Martin Steffen IfI UiO Spring 2014 uio Plan approx. 15 lectures, details see web-page flexible time-schedule,
More informationFormal 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 informationFormal 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 informationCMSC 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 informationDatabase Theory VU , SS Codd s Theorem. Reinhard Pichler
Database Theory Database Theory VU 181.140, SS 2011 3. Codd s Theorem Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 29 March, 2011 Pichler 29 March,
More informationProgram Analysis: Lecture 02 Page 1 of 32
Program Analysis: Lecture 02 Page 1 of 32 Program Analysis/ Mooly Sagiv Lecture 1, 31/10/2012 Operational Semantics Notes by: Kalev Alpernas As background to the subject of Program Analysis, we will first
More informationPropositional 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 informationStatic semantics. Lecture 3-6: Semantics. Attribute grammars (2) Attribute grammars. Attribute grammars example. Dynamic semantics
Lecture 3-6: Semantics Static semantics Attribute grammars Dynamic semantics Denotational semantics: semantic equations Axiomatic semantics: inference rules and correctness proofs Static semantics Semantics
More informationSemantics. 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 informationGoals: 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 informationFundamentals of Software Engineering
Fundamentals of Software Engineering Reasoning about Programs with Dynamic Logic - Part I Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Recap: First-Longest-Match Analysis The Extended Matching
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter
More informationCompiler Construction Lecture 1: Introduction Summer Semester 2017 Thomas Noll Software Modeling and Verification Group RWTH Aachen University
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Preliminaries People Lectures: Thomas Noll (noll@cs.rwth-aachen.de)
More informationSemantics with Applications 3. More on Operational Semantics
Semantics with Applications 3. More on Operational Semantics Hanne Riis Nielson, Flemming Nielson (thanks to Henrik Pilegaard) [SwA] Hanne Riis Nielson, Flemming Nielson Semantics with Applications: An
More informationLecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far.
Lecture Outline Operational Semantics of Cool COOL operational semantics Motivation Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Notation The rules CS781(Prasad) L24CG 1 CS781(Prasad)
More informationCS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014
CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014 1 Introduction to Abstract Interpretation At this point in the course, we have looked at several aspects of programming languages: operational
More informationInterleaving and Lock-Step Semantics for Analysis and Verification of GPU Kernels
Interleaving and Lock-Step Semantics for Analysis and Verification of GPU Kernels Peter Collingbourne 1, Alastair F. Donaldson 1, Jeroen Ketema 1, and Shaz Qadeer 2 1 Imperial College London peter@pcc.me.uk,{afd,jketema}@imperial.ac.uk
More informationQualifying Exam in Programming Languages and Compilers
Qualifying Exam in Programming Languages and Compilers University of Wisconsin Fall 1991 Instructions This exam contains nine questions, divided into two parts. All students taking the exam should answer
More informationHarvard 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 informationOperational Semantics. One-Slide Summary. Lecture Outline
Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:
More informationCS422 - 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 informationProgram Evaluation. From our evaluation rules we have, We have σ =(σ 0 [2/x])[3/y]. What is the value for σ(y) and σ(x)? How about σ(z), z Loc?
Program Evaluation Compute the semantic value of the program x := 2; y := 3. Assume the initial state σ 0. We want to compute the value σ Σ where (x := 2; y := 3,σ 0 ) σ From our evaluation rules we have,
More informationHomework 6: Big- & small-step semantics for LC
Homework 6: Big- & small-step semantics for LC CIS 352: Programming Languages 23 February 2018, Version 2 Administrivia Typo corrections in red. Trade ideas with another student? Document it in your source
More informationFormal Systems II: Applications
Formal Systems II: Applications Functional Verification of Java Programs: Java Dynamic Logic Bernhard Beckert Mattias Ulbrich SS 2017 KIT INSTITUT FÜR THEORETISCHE INFORMATIK KIT University of the State
More informationCS 6110 S11 Lecture 12 Naming and Scope 21 February 2011
CS 6110 S11 Lecture 12 Naming and Scope 21 February 2011 In this lecture we introduce the topic of scope in the context of the λ-calculus and define translations from λ-cbv to FL for the two most common
More informationFormal 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 informationProgramming 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 informationIntermediate Code Generation
Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target
More informationChapter 2 & 3: Representations & Reasoning Systems (2.2)
Chapter 2 & 3: A Representation & Reasoning System & Using Definite Knowledge Representations & Reasoning Systems (RRS) (2.2) Simplifying Assumptions of the Initial RRS (2.3) Datalog (2.4) Semantics (2.5)
More informationInformal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility
Informal Semantics of Data semantic specification names (identifiers) attributes binding declarations scope rules visibility 1 Ways to Specify Semantics Standards Documents (Language Definition) Language
More informationMosig M1 - PLSCD Written exam
Mosig M1 - PLSCD 0809 - Written exam 1 Exercise I : Operational semantics - a debugger In this exercise we consider program execution with the help of a debugger. This execution will be defined on an intermediate
More informationFrom Hoare Logic to Matching Logic Reachability
From Hoare Logic to Matching Logic Reachability Grigore Roşu 1,2 and Andrei Ştefănescu 1 1 University of Illinois at Urbana-Champaign, USA 2 Alexandru Ioan Cuza University, Iaşi, Romania {grosu, stefane1}@illinois.edu
More informationStatic Checking and Type Systems
1 Static Checking and Type Systems Chapter 6 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2009 2 The Structure of our Compiler Revisited Character stream Lexical
More informationSemantics of Programming Languages
P Lecture Notes on Semantics of Programming Languages for Part IB of the Computer Science Tripos Andrew M. Pitts University of Cambridge Computer Laboratory c A. M. Pitts, 1997-2002 First edition 1997.
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1819/cc/ Recap: LR(1) Parsing Outline of Lecture 11 Recap: LR(1)
More informationFormal 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 informationCS 4110 Programming Languages & Logics
CS 4110 Programming Languages & Logics Lecture 38 Typed Assembly Language 30 November 2012 Schedule 2 Monday Typed Assembly Language Wednesday Polymorphism Stack Types Today Compilation Course Review Certi
More informationChecks and Balances - Constraint Solving without Surprises in Object-Constraint Programming Languages: Full Formal Development
Checks and Balances - Constraint Solving without Surprises in Object-Constraint Programming Languages: Full Formal Development Tim Felgentreff, Todd Millstein, Alan Borning and Robert Hirschfeld Viewpoints
More informationPolyèdres et compilation
Polyèdres et compilation François Irigoin & Mehdi Amini & Corinne Ancourt & Fabien Coelho & Béatrice Creusillet & Ronan Keryell MINES ParisTech - Centre de Recherche en Informatique 12 May 2011 François
More informationThe 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 informationHomework 3 COSE212, Fall 2018
Homework 3 COSE212, Fall 2018 Hakjoo Oh Due: 10/28, 24:00 Problem 1 (100pts) Let us design and implement a programming language called ML. ML is a small yet Turing-complete functional language that supports
More informationLectures 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 informationMeeting14:Denotations
Meeting14:Denotations Announcements Homework 3 due next week Friday at 6:00pm Reminder: 5-minute feedback discussion with Sean is part of the assignment ("interview light") Talk (with me, with the class
More informationCOP4020 Programming Assignment 2 - Fall 2016
COP4020 Programming Assignment 2 - Fall 2016 To goal of this project is to implement in C or C++ (your choice) an interpreter that evaluates arithmetic expressions with variables in local scopes. The local
More informationHandout 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 informationErrata Chapter 1 Chapter 2 touched surprised then else Chapter 3
Errata Page ix, Line 13 Chapter 1 ftp.cs.uiowa.edu Page 17, Line 7 Page 23, Line -9 Chapter 2 programming language, Page 40, Line -4 and -11 touched surprised Page 45, Line -10 Reduce
More informationDenotational 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