Programming Language Semantics Denotational Semantics Chapter 5.

Slides:



Advertisements
Similar presentations
Partial Orderings Section 8.6.
Advertisements

Knaster-Tarski fixed point theorem for complete partial order **************** contents ****************  Who are Knaster-Tarski?  What is elementary.
CSCI 115 Chapter 6 Order Relations and Structures.
Normal Programs with Cardinality Constraints C = L {a 1,..., a n, not b 1,..., not b m } U L lower bound, U upper bound (missing L: 0, missing U: n+m)
Formal Semantics of Programming Languages 虞慧群 Topic 5: Axiomatic Semantics.
Relations - review A binary relation on A is a subset of A×A (set of ordered pairs of elements from A) Example: A = {a,b,c,d,e} R = { (a,a),(a,b),(b,b),(b,c),
Programming Language Semantics Inductive Definitions Mooly SagivEran Yahav Schrirber 317Open space
Programming Language Semantics Axiomatic Semantics Chapter 6.
Programming Language Semantics Denotational Semantics Chapter 5 Based on a lecture by Martin Abadi.
Chapter 3 Review MATH130 Heidi Burgiel. Relation A relation R from X to Y is any subset of X x Y The matrix of a Relation R is a matrix that has a 1 in.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Programming Language Semantics Denotational Semantics Chapter 5 Part II.
FSM Decomposition using Partitions on States 290N: The Unknown Component Problem Lecture 24.
1 Iterative Program Analysis Mooly Sagiv Tel Aviv University Textbook: Principles of Program Analysis.
Regular Expression (EXTRA)
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Claus Brabrand, ITU, Denmark DATA-FLOW ANALYSISMar 25, 2009 Static Analysis: Data-Flow Analysis II Claus Brabrand IT University of Copenhagen (
1 Program Analysis Mooly Sagiv Tel Aviv University Textbook: Principles of Program Analysis.
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Sets, POSets, and Lattice © Marcelo d’Amorim 2010.
Abstract Interpretation (Cousot, Cousot 1977) also known as Data-Flow Analysis.
Solving fixpoint equations
Program Analysis and Verification Noam Rinetzky Lecture 6: Abstract Interpretation 1 Slides credit: Roman Manevich, Mooly Sagiv, Eran Yahav.
Program Analysis and Verification
2.6 Equivalence Relation §1.Equivalence relation §Definition 2.18: A relation R on a set A is called an equivalence relation if it is reflexive, symmetric,
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
Formal Semantics of Programming Languages 虞慧群 Topic 3: Principles of Induction.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 9: Abstract Interpretation I Roman Manevich Ben-Gurion University.
CS 611: Lecture 6 Rule Induction September 8, 1999 Cornell University Computer Science Department Andrew Myers.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Universidad Nacional de ColombiaUniversidad Nacional de Colombia Facultad de IngenieríaFacultad de Ingeniería Departamento de Sistemas- 2002Departamento.
Relations, Functions, and Countability
CS 267: Automated Verification Lecture 3: Fixpoints and Temporal Properties Instructor: Tevfik Bultan.
1 IS 2150 / TEL 2810 Introduction to Security James Joshi Associate Professor, SIS Lecture 3 September 15, 2009 Mathematical Review Security Policies.
Foundations of Discrete Mathematics Chapter 4 By Dr. Dalia M. Gil, Ph.D.
Equivalence Relations. Partial Ordering Relations 1.
Problem Statement How do we represent relationship between two related elements ?
Chapter Relations and Their Properties
Sequence Control Syntax and Semantics Jian Xu March 3, 2004 CS706, CAS McMaster.
Program Analysis and Verification
Web Science & Technologies University of Koblenz ▪ Landau, Germany Models of Definite Programs.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Chap. 7 Relations: The Second Time Around
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Formal Semantics of Programming Languages 虞慧群 Topic 2: Operational Semantics.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Program Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
1 Iterative Program Analysis Part II Mathematical Background Mooly Sagiv Tel Aviv University
Chaotic Iterations Mooly Sagiv Tel Aviv University Textbook: Principles of Program Analysis.
Chaotic Iterations Mooly Sagiv Tel Aviv University Textbook: Principles of Program Analysis.
Lecture 7: Relations Dr Andrew Purkiss-Trew Cancer Research UK Mathematics for Computing.
Chapter 5 Relations and Operations
Chapter 6 Order Relations and Structures
Fixpoints and Reachability
Equivalence Relations
Partial Orderings.
Spring 2016 Program Analysis and Verification
Discrete Math & Fixed points
Discrete Math (2) Haiming Chen Associate Professor, PhD
Concurrent Models of Computation
Sungho Kang Yonsei University
MA/CSSE 474 More Math Review Theory of Computation
Formal Definition and Examples
Lecture 10: Fixed Points ad Infinitum M.C. Escher, Moebius Ants
Background material.
Background material.
Ø Let the universe set U={1,2,3,...,10}.
Presentation transcript:

Programming Language Semantics Denotational Semantics Chapter 5

Outline Least fixed points on relations Motivation Denotational Semantics –Least fixed points Equivalence of Semantics Complete partial orders and continuous functions

Operators and their least fixed points For a set of rule instances R –R(B)={y |  X  B, X/y  R} Proposition 4.11 A set B is closed under R if R(B)  B R is monotonic –A  B  R(A)  R(B) Define the sequence of sets –A 0 = R 0 (  ) =  –A 1 = R 1 (  ) =R(  ) –A 2 = R 2 (  ) =R(R(  )) –…–… –A n = R n (  ) Define A =  n  A n

Proposition 4.12 (i)A is R-closed (ii)R(A) = A (iii)A is the least R-closed set Let fix(R) denotes the least fixed point of R Claim: fix(R)=  n  R n (  )=A 1.R(fix(R)) = fix(R) 2.  X. R(X) = X  fix(R)  X Alternative Formulation

Motivation for Denotational Semantics Equivalence of commands –c 1  c 2  ,  ’  :   ’    ’ The meaning of a command is a (partial) state transformer –C  c 1  = { ( ,  ’) |   ’ } –C  c 2  = { ( ,  ’) |   ’ } – c 1  c 2  C  c 1  = C  c 2  Denotational semantics –A  a  :  N –B  b  :  T –C  c  :   

Denotational semantics A: Aexp  (  N) B: Bexp  (  T) C: Com  (    ) Defined by structural induction

Denotational semantics of Aexp A: Aexp  (  N) A  n  = {( , n) |   } A  X  = {( ,  (X)) |   } A  a 0 +a 1  = {( , n 0 +n 1 ) | ( , n 0 )  A  a 0 , ( ,n 1 )  A  a 1  } A  a 0 -a 1  = {( , n 0 -n 1 ) | ( , n 0 )  A  a 0 , ( ,n 1 )  A  a 1  } A  a 0  a 1  = {( , n 0  n 1 ) | ( , n 0 )  A  a 0 , ( ,n 1 )  A  a 1  } Lemma: A  a  is a function

Denotational semantics of Aexp with A: Aexp  (  N) A  n  = .n A  X  = .  (X) A  a 0 +a 1  = .(  a 0   +A  a 1   ) A  a 0 -a 1  = .(  a 0   -A  a 1   ) A  a 0  a 1  = .(  a 0    A  a 1   )

Denotational semantics of Bexp B: Bexp  (  T) B  true  = {( , true) |   } B  false  = {( , false) |   } B  a 0 =a 1  = {( , true) |   & A  a 0   =A  a 1   }  {( , false) |   & A  a 0   A  a 1   } B  a 0  a 1  = {( , true) |   & A  a 0    A  a 1   }  {( , false) |   & A  a 0    A  a 1   } B  b  = {( ,  T t) |  , ( , t)  B  b  } B  b 0  b 1  = {( , t 0  T t 1 ) |  , ( , t 0 )  B  b 0 , ( , t 1 )  B  b 1  } B  b 0  b 1  = {( , t 0  T t 1 ) |  , ( , t 0 )  B  b 0 , ( , t 1 )  B  b 1  } Lemma: B  b  is a function

Denotational semantics of Com C: Com  (    ) C  skip  = {( ,  ) |   } C  X:=a  = {( ,  [n/X]) |   & n=A  a   } C  c 0 ;c 1  = C  c 1   C  c 0  C  if b then c 0 else c 1  = {( ,  ’) | B  b   =true & ( ,  ’)  C  c 0  }  {( ,  ’) | B  b   =false & ( ,  ’)  C  c 1  } C  while b do c  = ?

Denotational semantics of Com C: Com  (    ) C  if b then c 0 else c 1  = {( ,  ’) | B  b   =true & ( ,  ’)  C  c 0  }  {( ,  ’) | B  b   =false & ( ,  ’)  C  c 1  } w = while b do c w  if b then c;w else skip C  w  = {( ,  ’) | B  b   =true & ( ,  ’)  C  c;w  }  {( ,  ) | B  b   =false} = {( ,  ’) | B  b   =true & ( ,  ’)  C  w  C  c  }  {( ,  ) | B  b   =false}  = {( ,  ’) |  (  )=true & ( ,  ’)     }  {( ,  ) |  (  ) =false}

Denotational semantics of Com C: Com  (    )  = {( ,  ’) |  (  )=true & ( ,  ’)     }  {( ,  ) |  (  ) =false}  (  ) = {( ,  ’) |  (  )=true & ( ,  ’)     }  {( ,  ) |  (  ) =false}= {( ,  ’)|   ’’:  (  )=true & ( ,  ’’)  , (  ’’,  ’)   }  {( ,  ) |  (  ) =false}  (  ) = 

Denotational semantics of Com C: Com  (    )  (  ) = {( ,  ’) |  (  )=true & ( ,  ’)     }  {( ,  ) |  (  ) =false}= {( ,  ’)|   ’’:  (  )=true & ( ,  ’’)  , (  ’’,  ’)   }  {( ,  ) |  (  ) =false}  (  ) =   = R R={({ (  ’’,  ’)}/ ( ,  ’)) |  (  )=true & ( ,  ’’)   }  {(  / ( ,  )) |  (  ) =false}  = fix(R)

Denotational semantics of Com C  skip  ={( ,  )|  } C  X:=a  = {( ,  [n/X]) |   & n=A  a   } C  c 0 ;c 1  = C  c 1   C  c 0  C  if b then c 0 else c 1  = {( ,  ’) | B  b   =true & ( ,  ’)  C  c 0  }  {( ,  ’) | B  b   =false & ( ,  ’)  C  c 1  } C  while b do c  = fix(  ) where  (  ) = {( ,  ’) | B  b   =true & ( ,  ’)    C  c  }  {( ,  ) |  B  b   =false}

Proposition 5.1 w = while b do c C  w  = C  if b then c;w else skip 

Equivalence of Semantics Lemma 5.3: For all a  Aexp –A  a  ={( , n) |  n}

Equivalence of Semantics Lemma 5.4: For all b  Bexp –B  b  ={( , t) |  t}

Equivalence of Semantics Lemma 5.6: For all c  Com –   ’  ( ,  ’)  C  c  Theorem 5.7 For all c  Com –C  c  = {( ,  ’) |   ’ }

Partial Orders A partial order (p.o.) is a set P with a binary relation  –reflexive  p: p  P. p  p –transitive:  p, q, r  P. p  q & q  r  p  r –antisymmetric:  p, q  P. p  q & q  p  p=q For a partial order (P,  ) and a subset X  P –p is an upper bound of X  q  X. q  p –p is a least upper bound of X (denoted by  X) if p is an upper bound of X For all upper bounds q of X: p  q d 1  d 2  … d n =  {d 1, d 2, …, d n }

Complete Partial Orders Let (D,  ) be a partial order –An  -chain is an increasing chain d 0  d 1  …d n .. –D is a complete partial order (c.p.o) if every  - chain has a least upper bound –D is a complete partial order with  if is a c.p.o. with a minimum element 

Monotonic and Continus Functions A function f: D  E between cpos D and E is monotonic if –  d,d’  D.d  d’  f(d)  f(d’) –Such a function is continuous if for all chains d 0  d 1  …d n  … in D:  n  f(d n ) = f(  n  d n )

Fixed Points Let f: D  D be a continuous function on a cpo with  D A fixed point of f is an element d  D such that f(d) =d A pre fixed point of f is an element d  D such that f(d)  d Thm: fix(f) =  n  f n (  )

Missing Greatest lower bounds Knaster-Tarski Theorem Conclusion