













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Expressing RelationshipsExpressing RelationshipsExpressing RelationshipsExpressing Relationships ^ It’s useful to be able to refer to
binary relations
RelationRelationRelationRelation ^ A binary relation R between A and B isan element of
⊆
Tuple ComponentsTuple ComponentsTuple ComponentsTuple Components ^ The set of first elements^ ^ is the
of the relation
(Square) = {1,-1,-2}
(Square) = {1,4}
image?
FunctionsFunctionsFunctionsFunctions ^ A^ function
distinct pairs contain the same firstelement, i.e., (^ )^ Examples:^ ^ e.g., {(2,red),(3,blue),(5,red)}^ ^ e.g., {(4,2),(6,3),(8,4)}
(^
)^
(^21) (^21) , 2 , (^2) , (^1) , 1
bb aa Fb aF ba
∈ ∀∈ ∀
For You To DoFor You To DoFor You To DoFor You To Do ^ Which of the following are functions?^ ^ Parent == {(John,Autumn),(John,Sam)}^ ^ Square == {(1,1),(-1,1),(-2,4)}^ ^ ClassGrades == {(Todd,A),(Virg,B)}
Special Kinds of FunctionsSpecial Kinds of FunctionsSpecial Kinds of FunctionsSpecial Kinds of Functions ^ Consider a function f from S to T ^ f is^ total
if defined for all values of S
if defined for some values of S
Squares = {(-1,1),(2,4)} ^ Abs = {(x,y) : Z x N |
(x < 0 and y=-x) or (x>=0 and y=x)}
Function StructuresFunction StructuresFunction StructuresFunction Structures Total Function
Undefined for this input Partial Function
Function StructuresFunction StructuresFunction StructuresFunction Structures Injective Function Surjective Function
For You To DoFor You To DoFor You To DoFor You To Do ^ What kind of function/relation is Abs?^ ^ Abs = {(x,y) : Z x N | (x <
0 and^
y=-x) or (x>=0 and y=x)}
Squares = {(-1,1),(2,4)}
Functions as SetsFunctions as SetsFunctions as SetsFunctions as Sets ^ Functions are relations and hence sets ^ We can apply all of the usual operators^ ^ ClassGrades == {(Todd,A),(Virg,B)}^ ^ #(ClassGrades
{(Matt,C)}) = 3∪
Relation CompositionRelation CompositionRelation CompositionRelation Composition ^ Use two relations to produce a new one^ ^ map ddomain of first to image of second^ ^ Given s:A x B and r:B x C then s;r : A x C ^ For example^ ^ s == {(red,1),(blue,2)}^ ^ r == {(1,2),(2,4),(3,6)}^ ^ s;r = {(red,2),(blue,4)}
(^ ){^
} rc bs bac ar s^
∈ ∧∈ ≡^
),( ),(| , ;
Relation TransposeRelation TransposeRelation TransposeRelation Transpose ^ Intuitively, the transpose of a relation
{^
} rb aab r^
∈ ≡^
),(|) ,( ~
Reading AssignmentReading AssignmentReading AssignmentReading Assignment ^ Daniel Jackson.
Dependable Software by Design