COM555 Theory of Computation: Functions
COM555 Theory of Computation: Functions
Theory of Computation
Lecture 3
Functions
• What is function g? g= ( i + j ) % 4
addition function modulo 4
Arity of Functions
• When
the domain of a function is for some
sets ,…, , the input to f is a k-tuple ( and we
call arguments to f.
• A function with k arguments is called a k-ary
function, and k is called the arity of the
function.
• If k=1 (singe argument), the f is called a unary
function.
• If k=2, f is called a binary function.
Predicate/Property
• A predicate or property is a function whose
range is {TRUE, FALSE}.
• Eg. even is a property that is TRUE if its input
is an even number and FALSE if its input is an
odd number.
– even(4)=TRUE, even(9)=FALSE
• A property whose domain is a set of k-tuples
Ax…xA is called a relation, a k-ary relation,
such as the example beats game.
Predicate/Property (Cont.)
• Eg. Beats game have values of TRUE or FALSE.
beats scissors paper Stone
Scissors FALSE TRUE FALSE
Paper FALSE FALSE TRUE
stone TRUE FALSE FALSE