Professional Documents
Culture Documents
Idea!
Discrete Mathematics Clear
Mathematics!
High Quality
Program!
Write Build
Specification Implementation
As To Make
A Brief Survey* A Set Of Predicates
Predicates True
Model-Based Specifications
State Description
(Sets, relations, etc)
Invariants
(Predicate Calculus)
Propositions
Operation Name
& Pre/Post Condx
REALLY Important
REALLY Important (Pred Calculus)
Propositions Examples
A proposition is a statement that is either true or false: The Sun is shining.
Alice Is A Super User The Earth is a planet.
Edit Is A USER Command A term in the Senate is six years.
1
CS686 - Dependable Computing
Uses Of Implication
Following natural-language fragments translate to A ⇒ B:
A implies B.
If A then B.
B if A.
Implication
A only if B.
A is sufficient for B.
B is necessary for A.
Example of why natural language can be confusing
BE CAREFUL WITH IMPLICATION—MAJOR SOURCE
OF ERRORS
(p1 ⇒ p2) does not mean (p2 ⇒ p1)
2
CS686 - Dependable Computing
Predicates
Predicates are:
Expressions containing variables
Boolean valued expressions when variables have values
Typical predicates define relationships
Predicates Example predicates:
Expressions built with relational operators
<, ≤, =, ≠, ≥, >
Compound expressions are built with operators from
propositional calculus
Examples:
temperature < temperature_limit
filesize < 1000 ∧ ((date-lastref) < 100)
Quantifiers Quantifiers
Propositions cannot express facts easily about classes of Three quantifiers are:
objects Existential ∃
Examples: Fact is true for at least one member of a class
If any one of the control computers is not available, the air traffic
Unique ∃1
control system must not operate.
Fact is true for exactly one member of a class
All of the files in the file system that have been changed since the
last backup was taken are scheduled to be written to tape. Universal ∀
Quantifiers are a notation for expressing facts about classes Fact is true for every member of a class
of objects Quantified expressions are propositions - they are
either true or false
3
CS686 - Dependable Computing
Sets
A set is:
An unordered collection of items
without replication
Elements come from a Universe of elements
Sets Sets can be defined by enumeration:
colors == {red, green, blue, grey}
sizes == {1, 3, 10, 7, 36}
people == {Jack, John, Jim, Joanne}
Sets can also be defined by comprehension
Sometimes called “set builder notation”
4
CS686 - Dependable Computing
5
CS686 - Dependable Computing
6
CS686 - Dependable Computing
7
CS686 - Dependable Computing
Relation Inverse
Inverse of a relation is a relation!
Inverse of a relation:
Reverse order of pairs
Denoted by superscript -1 Functions
Example:
memory-1 = {512 ¯ Sun03, 1024 ¯ Sun06,
128 ¯ Mac2}
Note the power available with the inverse
45
Discrete Mathematics (CS686 John Knight 2009)
University of Virginia 46 University of Virginia
Discrete Mathematics (CS686 John Knight 2009)
8
CS686 - Dependable Computing
9
CS686 - Dependable Computing
injective
bijective total
surjective
Function
Bijection
10