Lec03_Satisfaction_and_Pgms

Lec03_Satisfaction_and_Pgms - CS 536 Notes Programs and...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 536 Notes: Programs and State Semantics Lecture 3, Mon Sep 11, 2010 A. Why • Our program speci cations are written using predicates, so it’s good to know what it means for a predicate to be true in a state or in all states. • Our simple programming language is a model for the kind of constructs seen in actual languages. • The meaning of a program is that it transforms states. B. Outcomes After this lecture, you should • Know what it means for a predicate to be satis ed in a state (i.e., true in that state) or valid (i.e., true in all states). • Know the basic syntax of our simple deterministic programming language. • Know the semantics of our programs at intutive and formal levels. C. Quiz 1 next week • 30 minutes; mix of objective and short answer questions. • Covers Lectures 1 and 2 and Homeworks 1 and 2. • Questions will be similar to ones from activities and homeworks. • Closed book, but I’ll provide a list of the proof rules (associativity, commutativity, etc. from Lecture 1. • Review Homework 2 solution? D. Last Time: Predicate Logic, States, and Expressions • Predicates are how we phrase program speci cations. • States describe memory states (maps from simple variables and array element variables to values). • We’re writing states as predicate instead of as functions. • So ! " x = 1 ! b[0] = 4 ! b[1] = 8 instead of ! = {( x , 1), ( b , {(0, 4), (1, 8)})}. • Expressions are pieces of syntax that evaluate to values. • Our expressions don’t have side e ects, so we don’t have to worry about expressions changing the state in addition to yielding a value. • The value of an expression (that contains variables) is relative to a state. • The state needs to be well-formed and proper (type-correct). • (Values of constants, like or 17 , don’t depend on a state.) • Today we’ll look at states and how they a ect the truth of predicates. • We’ll also look at the statements of our simple programming language. Illinois Institute of Technology Notes for Lecture 3 CS 536: Science of Programming - 1 of 8 - © James Sasaki, 2010 E. Semantics of Predicate Logic: Satisfaction and Validity • The truth of a predicate that contains nothing but constants is easy to verify. • E.g., T ! 7 ! 15 " T . • The truth of a predicate that contains variables depends, in general, on a state. • E.g., in ! " 㱻 x = 1 , the predicate x > 0 " T , but in ! # " x =-8 , the predicate is " F • Sometimes, the state doesn’t matter: x = x " T in any proper state, and x " x " F in any proper state. • In math logic, these ideas and their notations are as follows. Let ! be a state proper for predicate P . •Then P is satis ed in/by ! when P evaluates to true in state ! ....
View Full Document

{[ snackBarMessage ]}

Page1 / 8

Lec03_Satisfaction_and_Pgms - CS 536 Notes Programs and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online