CS 536 Activities for Lecture 3
Activity 1: Satisfaction and Validity
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.
B. Outcomes
At the end of this activity you should:
•
Be able to check a predicate for satisfaction (in a state) or validity.
C. Questions
Let
!
!
"
x = 3
#
y = 4
#
b[0] = 7
#
b[1] = 9
, let
!
#
=
!
!
[
x
!
4
], and let
!
$
=
!
#
[
z
!
–5
].
1.
Does
!
!
!
x < y
#
b[x–2] < b[y–3]
?
Does
!
#
!
x < y
#
b[x–2] < b[y–3]
?
2.
Does
!
$
!
z > 0
$
2+2 = 5
?
Does
!
$
!
2+2 = 5
$
z > 0
?
3.
Does
!
!
!
%
k
.
b[k] < b[k+1]
?
If so, what witness did you use?
Are there other
possible witnesses?
4.
Does
!
!
!
%
z
.
b[z] < b[z+1]
?
Does it matter that
z
is unde
±
ned in
!
!
?
5.
Does
!
!
!
%
x
.
b[x] < b[x+1]
?
Does it matter that
!
!
(
x
) is de
±
ned?
Does it matter
what value
!
!
(
x
) is?
[Does it matter that
x
is de
±
ned in
!
!
?]
6.
What do we have to check to determine whether or not
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 cs536
 simple programming language

Click to edit the document details