0% found this document useful (0 votes)
10 views

402_reading_material_1

The document discusses key concepts in computation theory, including the Church thesis, Turing machines, finite automata, and formal languages. It explains the functionality of Turing machines, their states, and transition tables, as well as the differences between deterministic and non-deterministic machines. Additionally, it covers the principles of verification and validation, Hoare logic, and the construction of NFAs and DFAs.

Uploaded by

FG na Terrorists
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

402_reading_material_1

The document discusses key concepts in computation theory, including the Church thesis, Turing machines, finite automata, and formal languages. It explains the functionality of Turing machines, their states, and transition tables, as well as the differences between deterministic and non-deterministic machines. Additionally, it covers the principles of verification and validation, Hoare logic, and the construction of NFAs and DFAs.

Uploaded by

FG na Terrorists
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

COSC402 Assignment

1. State and explain the Church thesis


Answer:
Any mechanical computation can be performed by a Turing Machine. There is a TM-
n corresponding to every computable problem.A problem is said to be computable if
and only if it is effectively computable. This means that a problem is computable, if
it is possible to construct a Turing machine or its equivalent for the problem.

2. Describe the functionality of a typical Turing machine


Answer:
Conceptually a Turing machine, it consists of a finite control and a tape. At any time
it is in one of the finite number of states. The tape has the left end but it extends
infinitely to the right. It is also divided into squares and a symbol can be written in
each square. However, its head is a read-write head and it can move left, right or stay
at the same square after a read or write.

3.

a. What are the states (Q) of M?


Answer: {q0, q1, q2}

b. What is the alphabet ( ) of M? Answer: {0, 1}

c. What is the start state of M?


Answer: q0

d. What are the accept states (F) of M?


Answer: q2

e. Find T(q2, 1).


Answer: q1

f. Create the transition table of M.


Answer:
0 1
q0 q0 q1
q1 q1 q2
q2 q2 q1
1
g. Give five strings that can be accepted by this machine

Answer: i. 11 ii. 011 iii. 101 iv. 00000011 v. 110

4. Convert this transition table into a DFA.


Answer:

5. Given an alphabet ∑={a, b,c,d} construct: Design an NFA over ∑ that accepts any
string in which baba is a sub-string.
Answer:
c,d
a,c,d b
b a b a
S S S S
0 1 S5
3 4
a,c,d b,c,d b

S a,c,d
2

6. Explain the operation taking place in the above schema

Answer:
The name of the schema is Enrolok. The operation that will occur in this schema will
change the state of the schema “class”, that why it carries the delta symbol. The
input variable is student. The ? shows that is the input variable. The output variable is
response. The ! shows it’s an output variable. Now, the operations. We first check if
the student we are adding to the list of student is already a registered student. If its
2
not, then we check in the next line if the number of student that can be enrolled is not
up to the required size. Then we add the new student to the list of students using the
union operation. The tested is updated and the operation return success as our output
variable.
But in summary, you can just say “we are adding a new student to the list of students
but we have check if the student already belong to the students and the size hasn’t
met max. The operation if successful returns success.”

7. A video renter wants to computerize his shop. The database must keep a record of all
videos in the shop. The system must provide a possibility of performing and
accounting for daily activities such as renting a video or returning a video. Propose a
state schema for the system.

a) Borrow a video to a person


Answer:

b) Add some new videos to the stock Answer:

∉from ⋀ videos’ = videos v {newvideo?} ^ report!


Δ Videorenter newvideo?: VIDEO report!: MESSAGE

= success) ∨ (newvideo? ∈ videos ⋀ report!= alreadyadded )


(newvideo?
c) Return a video videos
a borrower
Answer:

(video? ∈ ⋀ booked’ = booked - {video?} ^ report! =


Δ Videorenter video?: VIDEO report!: MESSAGE

returned) ∨
d) Remove booked
a video Answer:

(video? ∉ videos ⋀ report!= videonotbooked ) e)


Check if a
(video? ∈ videos ⋀ videos’ = videos - {video?} ^ report! =
Ξ Videorenter video?: VIDEO report!: MESSAGE

success) ∨
(video? ∉ videos ⋀ report!=video not in list )

particular video is booked or not


Answer:

8. a)
Ξ What is the difference between Verification and Validation?
(video? ∈ BOOKED ⋀ report! = booked) ∨
Videorenter video?: VIDEO report!: MESSAGE
Answer:
(video? ∉ BOOKED ⋀ report!= not booked)

3
Verification involves checking that the system matches its specification I.e building
the right system while Validation is checking that the specification reflects intention
of the user I.e building the right system.

b) What is Formal specification?


Answer:
Formal specification are the requirement of the desired system written in
mathematical notation statements describing properties of the system without details
of their implementation

9. a) P → (q → r) = q →(p →r) use natural deduction to prove this:


Answer:
1. p→(q → r)
2. Q ass
3. P ass.
4. Q →R →E, 1 and 3
5. R →E, 2 and 4
6. Q →R →I, 3 and 5
7. q →(p →r) I→, 2 and 6
b) P →q, q→r = p →(q ^ r)
Answer:
8. p→q
9. q→r
10. P ass.
11. Q →E, 1 and 3
12. R →E, 2 and 4
13. q^r ^I, 4 and 5
14. p→(q^r) I→, 3 and 6

Therefore: P →q, q→r = p →(q ^ r) is proved

10. Wp(while x>0 do x=x-1,y=x+3 , y=-2)


Find the wp where Q:y=-2, S1:x=x-1; s2: y=x+3; b=x>0
Answer:
P0 = x ≤ 0 ^ y = -2
= x ≤ 0 ^ x + 3 = -2
= x ≤ 0 ^ x = -5
= x = -5

P1 = x > 0 ^ wp(x = x - 1, x = -5)


= x > 0 ^ x – 1 = -5
4
= x > 0 ^ x = -4
= false

P2 = x > 0 ^ wp(x = x -1, false)


= x > 0 ^ false
= false

Pk = false
wp = p1 V p2 V………v pk
wp = x = - 5
Using the appropriate quantifiers, express the statements.

∀x.students(x) => happy(x)


i. All students are happy

∀x.students(x) => not happy(x)


ii. All students are not happy

iii. All cosc402 students registered for the course

∀x.cosc402Students(x) => Registered(x)


p = cosc402 students q = registered for the course

∃x (Student(x) ∧ Hardworking(x))
iv. “some students are hardworking”

v. “not all 400 level students are rich”


¬ (Ɐx ComputerScience400LStudents(x) → Rich(x))

∀x ((300levelCSStudent(x) ∧ WinsTheElection(x)) → NACOSSWillBeReformed)


vi. “if a 300 level cs wins the election, NACOSS will be reformed”

∃x (Students(x) => rich(x))


vii. “Some students are rich”

viii. Not all computer science students are rich


¬ (Ɐx ComputerScienceStudents(x) → Rich(x) )
Convert the statements into English-like statemetns:
i. (x ComputerScience400LStudents(x)  Rich(x))
not all 400 level students are rich
ii. x.cosc402student(x) => happy(x)
all cosc 402 student are happy

5
Consider the machine

1.What is Q in the above FA?


a. 0,1
b. q0,q1,q2

2. Which string is accepted by this machine?


A. 01
B. 11
C. 00
D. 100

3. This finite state machine is an example of a


A. PDA
B. Z
C. DFA
D. NFA

4.

The accepting state for this machine is:


A.q0
B. q1
C. q2
6
5. This machine only accepts
A. A string that contain 10 as sub-string
B. A string that contain 01 as sub-string
C.A string that starts with 10
D. A string that ends with 10

6.
The set of alphabets for the above DFA is
A. {a,b}
B. {0,1}
C. {10,01}
D.{a,b,c}

7. Will this operation change the state of this system change?


A. Yes
B. No

8.The input variable In this schema is


A. class
B. response
C. enrolled
7
D. student

9. The output variable in this schema is

A. class
B. response
C. enrolled
D. student

10.The name of the below schema is

A. class
B. response
C. Enrolok
D. student

8
FORUM DISCUSSION
Models
1. Turing machine
2. Finite automata
3. Formal language
4. Pushdown automata
5. Regular expressions
6. Z
Turing machines
A turing machine is an accepting device which accepts the language generated by 0
grammars. Alan turing in year 1936 invented. It was an attempt to formalize
computation[lamda-calculus, recursive function, concept of computability]. TM is a
universal model of computation.
TM is a mathematical model which of infinite length tape divided into cellson which
input is given, read/write from left to right.

Church thesis says that any real world computation can be translated into an
equivalent computation using a turing machine.
Chruch thesis was invented by Alonzo chruch. It identifies effectively calculable
functions. Chruch believes that, lets M be a method or procedure,and is refered to as
effective will have some set of instructions, produce the desired result when
processed with error and carried out in a human being manner.
The TM is defined using 7-tuples. check it up in your material.
Summary of TM
1. Any mathematical computation can be peformed by a turing machine
2. For every computation problem, there is a corresponding TM
3. If there is no TM that decides the problem P, that means there is no algortithm that
can solve it
Functions of a TM
1. Write a symbol
2. Read a symbol
3. Transit to next state
Parts of the TM
1. head
2. state register
3. input tape
2 Types of TM
1. deterministic
2. non-deterministic

Deterministic Turing Machine


This is a deterministic Turing machine which calculates the two's complement of some binary
input. A deterministic Turing machine is one that uses the concept of determinism to calculate a
solution to a problem.

9
Non-deterministic Turing Machine
A non-deterministic Turing machine is one that uses the concept of non-determinism to calculate a
solution to a problem. A non-deterministic Turing Machine differs from a deterministic Turing
Machine in the sense that a non-deterministic Turing Machine can have several possible states to
which it can transition from any given state.

What is Church thesis?


Church thesis says that any real world computation can be translated into an equivalent
computation using a turing machine. Church thesis was invented by Alonzo chruch. It identifies
effectively calculable functions.
Reasons for accepting chruch-turing thesis
1. Every investigation carried out so far is proof to be true by the TM
2. You can proof all the turing machine when patience is exercised.
State and explain the Church thesis
Any mechanical computation can be performed by a Turing Machine. There is a TM-n
corresponding to every computable problem. A problem is said to be computable if and only if it is
effectively computable. This means that a problem is computable, if it is possible to construct a
Turing machine or its equivalent for the problem.
Describe the functionality of a typical Turing machine
Conceptually a Turing machine, like finite automata, consists of a finite control and a tape. At any
time it is in one of the finite number of states. The tape has the left end but it extends infinitely to
the right. It is also divided into squares and a symbol can be written in each square. However,
unlike finite automata, its head is a read-write head and it can move left, right or stay at the same
square after a read or write.

What is finite automata?


Finite Automata: every is define using 5-tuples i.e Q F q 0 T E where: Q- set of states, F- set of
final/accept state, q0- start state, T- transition fxn and E- set of alphabets
Types of finite automata (FA)
1. deterministic 2. non-deterministic
Formal languages: this is a set of strings over a finite alphabets eg Java, c etc
PDA: they are similar to FA, the only difference is having a stack in the PDA.

10
Refinement: is the inverse of hoare logic where A and S is processed to get Q. The proper subset
symbol is the symbol for refinement.
Laws of Refinement
1. Safety- precondition for S statement must be acceptable for precondition. We need a weak
precondition.
2. Livens- The behavior of I-implementation must be allowed by S. We need strong post condition.
Definition of Hoare logic
The Hoare triple is made of {P} A {Q}. This triple means: If P is true in the initial state and A
terminates then Q will hold in the final state.
Why is Hoare logic partially correct?
Hoare logic expresses partial correctness in a very elegant way. We say a program is partially
correct if it gives the right answer whenever it terminates. This implies that such system never gives
a wrong answer, but it may give no answer at all.
WP Definition
The wp Function: If Q is a predicate on states and S is a code fragment, then the weakest
precondition for S with respect to Q is a predicate that is true for precisely those initial states from
which:
i. S must terminate, and
ii. executing S must produce a state satisfying Q.

Reasons for accepting chruch-turing thesis


1. Every investigation carried out so far is proof to be true by the TM
2. You can proof all the turing machine when patience is exercised.
READ MORE ON CHRUCH-TURING FROM THE INTERNET
FINITE AUTOMATA
Every is define using 5-tuplesi.e Q F qo T E
Q- set of states F- set of final/accept state q0- start state
T- transition fxn
E- set of alphabets
2 types of FA
1. deteriministic
2. non-deteriministic
REGULAR EXPRESSIONS
l- means or*- means 0 or more occurence a(b*c|c*d) - abbbbbc, accccccccccccccd,
ac, ad x(y|z)*(a|b|c) - xyzyyyyzyyzza, xya, xzb, xc
Formal languages
This is a set of strings over a finite alphabets eg Java, c etc
PDA
They are similar to FA, the only difference is having a stack in the PDA. Example of
a PDA.

11
Z to be discussed in next class.
Refinement
Refinement is the inverse of hoare logic where A and S is processed to get Q. The
proper subset symbol is the symbol for refinement.
Refinement is a process of refining a specification S to an implementation Z by
applying a series of transformationss.
Specification to Refinement to implementation to code
Laws
1. Safety- precondition for S statement must be acceptable for precondition. We
need a weak precondition
2. Liveness- The behavior of I-implemantation must be allowed by S. We need
strong postcondition.
NOTE- Weak precondition is needed so as the operation suceed in many states.
While strong postcondition is required to avoid ambiguity.The importance of
refinement is to ensure correctness of a software is checked sucessfully. Refinement
is difficult, expensive and some real life examples cannot be expressed which are
limitations of it.

Verification involves checking that the system matches its specification i.e
buildng the system right while Validation is checking that the specification
reflects the intention of the user [owner of the system] i.e building the right
system. Dear students, drop an assumed insights where a system passes the
verification test but fails to pass the validation test.

A situation where a software development team diligently follows the specifications


outlined for a new e-commerce platform. They meticulously code, test, and verify
every component of the system, ensuring that it meets the specified requirements.
The verification process goes smoothly, and the system passes all the technical
checks with flying colors.

However, when it comes time to validate the system with the end-users the customers
who will actually be using the platform issues begin to arise. Despite meeting the
technical specifications, the system fails to meet the users' expectations and needs.

12
For example, the verification process may have ensured that the checkout process
functions correctly, with all payment methods integrated seamlessly. However,
during validation, users may find the checkout process confusing and cumbersome,
leading to frustration and abandoned carts.

akest precondition calculus


WP A Q Assign statement sequencial conditionals loops
WP it has 2 conditions
S must terminate
Q must be met
P = wp[s,Q] wp x= x +1 [x > 0]
[x +1 > 0] x= x +1 [x > 0]
[x> -1] x= x +1 [x > 0]

assign statement wp[x=e,Q[x]] = Q[e] eg 1 p = wp[x= y +5, x > 10]


[y +5 > 10] = wp[x= y +5, x > 10]
[ y>5] = wp[x= 5 +5, x > 10]
Sequencial
wp[s1,s2,Q] = wp[ s1, wp[s2,Q]]
eg 1 wp[x=x + 2, y=y-2, x + y=0] wp[x=x + 2, wp[ y=y-2,x + y=0]] wp[x=x + 2, wp[
x + y-2=0]] wp[x+ 2+ y -2=0] = x + y=0 P = Q
eg 2 wp[ a= a+ 1, b= b + 1, a x b =0] wp[ a= a+ 1, wp[b= b + 1, a x b=0]] wp[ a = a+
1, wp[ a x b + 1 =0]] wp[ a+ 1 x b + 1 = 0] divide both side by a+ 1 b+ 1 =0 b = -1
divide both side by b + 1 a+ 1 = 0 a = -1
[a = -1] v [b = -1] is the wp
Conditionals wp[if b then s1 else s2, Q] [ b → wp[s1,Q]] and [ `b → wp[s2,Q]]
eg 1
wp[if x > 2 then y=1 else y=-1, y > 0]
[x > 2 → wp[y=1, y > 0]] ˄ [x ≤ 2 → wp[y=-1, y > 0]]
[x > 2 → wp[ 1 > 0]] ˄ [x ≤ 2 → wp[-1 > 0]] [x > 2 → T] ˄ [x ≤ 2 → F ] x > 2
is the wp
Loops wp[while b do S, Q] p0 = ¬b ˄ Q when the loop doesnt execute
P1 ≡ b ˄ wp(S, P0) for only once
P2 ≡ b ˄ wp(S,P1)
P3 ≡ b ˄ wp(S,P2) Pk+1 ≡ b ˄ wp(S,Pk)
eg 1 wp[while n > 0 do n = n-1, n=0] p0 = ¬b ˄ Q
= n≤ 0 ˄ n=0
= n=0 p1 = b ˄ wp(S, P0)
= n > 0 ˄ wp(n=n-1 , n=0 )
= n > 0 ˄ wp[ n-1 =0]
= n > 0 ˄ n=1 = n =1 p2= n > 0 ˄ wp(n=n-1 , n=1 )
=n > 0 ˄ wp( n-1=1 )
= n > 0 ˄ n=2 = n =2
13
pk = n > 0 ˄ n=k
wp = p0 v p1 v p2.....................pk
= n=0 v n=1 v n=2 v .......................................n=k
=n≥ 0
eg 2 wp[ while n ¬=0 do n = n-1, n=0] p0 = n=0 ˄ n=0
= n=0 p1 = n ¬=0 ˄ wp [ n=n-1 , n=0]
= n¬=0 ˄ wp[n-1=0]
= n ¬=0 ˄ n=1 = n=1
pk = n=k
wp = p0 v p1 v p2.....................pk
= n=0 v n=1 v n=2 v .......................................n=k
=n≥ 0
eg 3 wp[ while n > 0 do n = n-1, n=-100] p0 = n≤0 ˄ n=-100
= n =-100 p1 = n > 0 ˄ wp[n=n-1, n =-100]
= n > 0 ˄ wp[n-1=-100 ]
=n > 0 ˄ n=-99 =n= false p2 = n > 0 ˄ wp[n=n-1, false]
= n > 0 ˄ false = false pk = false
wp= n=-100 v false v false v..............................false n =-100
eg 4 wp [ while n¬=0 do n=n-1, n=-100] p0 = n=0 ˄ n=-100
= false
p1 = n¬=0 ˄ wp[n=n-1, false]
= n¬=0 ˄ false
=false
pk=false
wp= p0 v p1 v p2 v p3.....................pk false v false v false
v...............................false
= false
eg 5 wp[while x¬=2 do x=x-1, true] p0= x=2 ˄ true = x=2 p1= x¬=2 ˄ wp[x=x-1,
x=2]
= x¬=2 ˄ wp[x-1=2]
=x¬=2 ˄ x=3 = x=3 p2= x¬=2 ˄ wp[x=x-1, x=3]
=x¬=2 ˄ wp[x-1=3]
=x¬=2 ˄ x=4 =x=4 p3 = x=5 p4 = x= 6
pk= x=k plus 2
wp = p0 v p1 v p2 v p3 v........................pk
= x=2 v x=3 v x=4 v...........................k plus 2 x≥2

This statement '?x, friends[x] ? ¬perfect[x]' can also be written using universal
quantifier as:

ANSWER:

'?x, friends[x] ? ¬perfect[x]' can be rewritten using the universal quantifier (?):

14
?x, friends[x] ? ¬perfect[x]

This means that for all x, if x is friends with someone (friends[x]), then x is not
perfect (¬perfect[x]).

NEXT:
Natural Deduction
introduction I elimination E
Introduction and Elimination
P Q PNQ
PNQ P Q
implication
intro P Q elimination
P implies Q p implies Q, P
Q

OR V intro P Q Elimination q v p ,p implies r, q implies r


r
PVQ PVQ

negation
intro P, q n -q elimination -p, -q n q
-p P
3 eg 1
p n q= q n p 1. P N Q
2. P EN 1
3. Q EN 1 4. Q n P In 2 and 3
eg 2
P implies Q,Q implies R = P implies R
4 1. P implies Q
2. Q implies R
3. P Ass.
4. Q E implies, 1 and 3
5. R E implies, 2 and 4
6. P implies R I implication, 3 and 5
eg 3 p implies Q, Q implies R = p implies [Q n R]
1. p implies Q
2. Q implies R
3. P Ass
4. Q E implication, 1 and 3
5. R E impication, 2 and 4
6. Q n R I and , 4 and 5
7. p implies[Q n R] I impication, 3 and 6
eg 4
P, p implies q = P n Q
15
1. P
2. P implies q
3. Q E implication, 1 and 2 4. P n Q I conjunction, 1 and 3
eg 5
P = Q imples P
1. P
2. Q ass
3. Q implies P I implication, 1 and 2
eg 6 p implies Q, not Q = not p
1. P implies Q
2. not Q
5 3. P ass
4. Q E implication, 1 and 3
5. Q n -q nI, 2 and 4
6. -p not I, 3 and 5
6 eg 7
P V [Q N R] = P V Q
1. p v [q N R]
2. P ass
3. q n R
4. Q n E, 3
5. p v q VI , 2 and 4

NEXT

Hoare logic
assignment
statement
sequencial
conditional loops
P A Q p- precondition A- statement
Q-postcondition
[P] y =x +2 [y >10]
[x + 2 > 10] y =x + 2 [y >10]
[x > 10-2] y =x + 2 [y >10] [x > 8] is the precondition
Assignment statement [Q[e]]x = e[Q[x]] eg 1 [P] x=y +3 [x >3]
[y +3 > 3] x=y +3 [x >3]
[y >0] x=y +3 [x >3] [y >0] is the precondition
eg 2 [P] x=x +1 [x >5]
[x+1 > 5]x =x +1 [x >5]
[x>4]x =x +1 [x >5]
[x >4] is the precondition eg 3 x= x + b +1 [ b=2 AND x=y + b] [ b=2 AND
x + b +1=y + b]
[ b=2 AND x =y + b -b -1]
[ b=2 AND x =y -1] is the precondition
16
Sequencing
[p]s1[Q] [Q]s2[R] [P]s1s2[R]
eg 1 x= x + 5; y =x-2[ y >0] x = x + 5; [ x-2>0] y= x-2 [ y >0]
[ x-2>0] x = x + 5; y= x-2 [ y >0]
[ x + 5-2 >0] x = x+ 5; y= x-2 [ y >0] [x > -3] is the precondition
eg 2 x=x + 1; x = x * x [ x ≥ 16] x=x + 1; [ x * x ≥ 16 ]x = x * x[ x ≥ 16]
[ x + 1 * x + 1 ≥ 16 ]x=x + 1; x = x * x[ x ≥ 16]
[[x + 1]2 ≥ 16]
a2 > b2 = [a > b] v [a < -b]
[[x + 1] 2 ≥ 4 2] a =x + 1 b =4
[x + 1 ≥ 4] v [x +1 ≤ -4]
[x ≥ 4-1] v [x ≤ -4 -1]
[x ≥ 3] v [x ≤ -5] is the precondition conditional statements
[P] if[condition]
statement1; else
statement2; [Q]
if-else b-condition [p and b ] s1 [Q] [p and `b ] s2 [Q]
eg 1 [x >2] if [x >2] then y=1; else y=-1 [y >0] [x >2 and x >2 ] y=1 [y >0]
-------- i
[x >2 and x≤-2] y=-1 [y >0] ------------ ii
`[x >2] = x≤-2
T and T = T
T and F = F
[x >2] y=1[y >0] -------- i [F] y=-1 [y >0]---------------ii
x >2 is the precondition
Loops
[P] while [b] do s1 s2
[Q]
invariant- a condition that never changes inside the loop
inside the loop [ b and p] s1s2 [p]
when the loop terminates = post condition Q
[p and `b]
Hoare logic is partial correct because it says nothing about termination.
Strengthening a precondition
[p]S[Q] S implies p [s]S[Q]
weakening a postcondition
[p]S[Q] Q implies w
[p]S[w]

NEXT
Using inference rule, what is the value of Q given that P ^ Q and P are true?
ANSWER
To infer the value of Q given that P ? Q and P are true.

17
18
Given:
1. P ? Q = T
2. P = T

P Q P?Q
TTT

Therefore, Q is True.

NEXT:
true 1 false 0
7 Conjunction [and]
p q p and q
T T T
T F F
F T F
F F F
8 Disjunction [or]
p q pvq
T T T
T F T
F T T
F F F
9 Negation [not]
p not p
T F
F T
10 Implication
p[IT RAINS] q[THE SOIL GETS WET] p implies q
T T T
T F F
F T T
F F T
when all the variables evaluates to true we have a tautology Contradiction is when all
the variables evaluates to false
Contigency is when you have variables to be true or false
order of priority in logic
1. not
2. and
3. or
4. implies
5. equality
eg 1
-p V q implies r n s
[not p]
19
[r n s]
[not p V q]

universal quantifier[∀] and existential quantifier[∃]


[not p V q] implies [r n s]

General format ∀x.p(x) => q(x) ∀ is the universal quantifier p is the domain q is the
11

function x is the bound variable

∀x.students(x) => happy(x)


All students are happy

∀x.students(x) => not happy(x)


All students are not happy

All cosc402 students registered for the course p = cosc402 students q = registered

∀x.cosc402Students(x) => Registered(x)


for the course

∃x ∈ D,P(x)
Existential quantifier

∃x E students, rich(x)
some students are rich

Not all computer science students are rich


¬ ( x ComputerScienceStudents(x) → Rich(x) )

∃x ComputerScienceStudents(x) → Rich(x)
Conversion from universal quantifier to existential quantifier not all = some

12 Set theory
U=[1,2,3,4,5] A=[1,2] B=[2,3,4] union= [1,2,3,4] intersection = [2] complement=
A`=[3,4,5] B`=[1,5] cardinality = lAl = 2 lBl = 3
Cartesian product A X B =[1,2,3,4] power set[A] = [ [], [1], [2], [1,2]] power set[B]
= [[],[2],[3],[4],[2,3],[2,4],[3,4],[2,3,4]]
power set = 2 power n
A=2 4
B= 3 8
13 Soundness and Completeness
Sound system does not produce any bad results
Complete system can produce all the good results
Consistent system is a system that is always there and it does not produce result with
ambiguity.A consistent system does not produce conflicting results.
14 Inference rule
eg1
1. p v q T
2. not p F
What is the value of q
p v q = pvq F v T = T eg 2
1. p→q T 2. P T
what is q[true or false] q is true

20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy