Professional Documents
Culture Documents
Unit 1
Unit 1
Unit 1
• ∧ and
• ∨ or
• ¬ not
• => implies
Sequences
• A sequence is a mathematical structure that
models the fact that its elements are ordered.
• The items that form the first elements of the
pairs are collectively known as the domain of
the sequence and the collection of second
elements is known as the range of the
sequence.
• {(1, Jones), (2, Wilson), (3, Shapiro), (4, Eva)}
• Catenation, ,
• Empty sequence {}
• Head{2, 3, 34, 1, 99, 101} = 2
• Tail{2, 3, 34, 1, 99, 101} = {3, 34, 1,99, 101}
• Last{2, 3, 34, 1, 99, 101} = 101
• Front{2, 3, 34, 1, 99, 101} = {2, 3, 34, 1, 99}
APPLYING MATHEMATICAL NOTATION
FOR FORMAL SPECIFICATION
• The state can be described as
– used, free: P BLOCKS
– BlockQueue: seq P BLOCKS
• The data invariant can be written as
used ∩ free = ∅ ∧
used ∪ free = AllBlocks ∧
∀ i: dom BlockQueue . BlockQueue i used ∧
∀i, j : dom BlockQueue . i ≠ j => BlockQueue i ∩
BlockQueue j = ∅
• The first operation we shall define is one that removes
an element from the head of the block queue. The
precondition is that there must be at least one item in
the queue:
– #BlockQueue > 0,