Write the formal statements for each of the informal statement given below; each
ID: 3591392 • Letter: W
Question
Write the formal statements for each of the informal statement given below; each statement is separate and has no relationships with other statements. Hint:Use predicate logic in order to write the formal statements
0. The only prime number that is even is 2.
Hint: You can use the boolean function prime(n) which returns true if n is a prime number.
1. Let A be an array of integers.
(a) A contains only zeroes and ones.
(b) The element at every third position (positions which are multiples of 3) is a zero.
Hint: Use the notation A(i) to represent the ith value of A and #A to represent the size of the array A. The first element of the array is at position 1, not at zero.
2. Every person likes at least one color.
Hint: Assume that the types Person and Color and the boolean function likes( person,color) are all defined.
3. In a computer system, no two users have the same user names.
Hint: Assume the type User and the function username (u) are already de ned; the function returns the user name of the user u.
Explanation / Answer
1.
statement: The only prime number that is even 2
Even(n): n is even
Prime(n):n is prime
means 2 is an even prime and there exists no other even prime
Predicate logic: (Prime(2) Even(2)) V ¬ ( n ( Prime(n) Even (n) (n 2 ) ) )
2. A is a binary number since only zeros and ones in it
A(i) : i is a number
#A is the size of Array
Given A contains zeros or ones
it can be written as i: 0i<N: A(i)=0,1
next element at every third position (positions which are multiples of 3) is a zero.
i: 3i<3n: A(i)=0
so predicate logic is i(0i<N: A(i)=0,1) V i ( A(i)=0 (3i<3n) )
3
likes(person,color)
the truth of the.above function depends upon the values provided
Given every person likes atleast one color
means there exists a color for all person which they like
(Prime(2) Even(2)) V ¬ ( n ( Prime(n) Even (n) (n 2 ) ) )
can be defined as for every person there exists a color he likes
so predicate logic will be
Person( Color( Likes(Person,Color) ->true) )
4.
means a particular user name can be given to a user only
defined as
there exists a username for every users where u1 not equal to u2
Person( Color( Likes(Person,Color) ->true) )
User( u( username(u) (u1 u2 ) )
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.