程序代写代做代考 Logic Tutorial 1

Logic Tutorial 1

Predicate Logic Formalisation

1. Assuming the following relations
term(C,T) course C is taught in term T

compulsory(C) course C is compulsory

prereq(C1,C2) course C1 is a prerequisite for course C2

lecturer(X) X is a lecturer

teaches(L,C) L teaches course C

express the following in predicate logic.

a. Logic is taught in term 1.
b. All term 1 courses are compulsory.
c. There is a course taught in term 2 which is compulsory.
d. Term 2 courses either have no prerequisites or have prerequisites that are

taught in term 1.

e. All prerequisites of term 2 courses are taught in term 1.
f. Every term 1 and term 2 course has a lecturer teaching it.
g. There is a lecturer who teaches every term 1 and term 2 course.

2. Using the predicates:

input1(G,I) input 1 of gate G is I

input2(G,I) input 2 of gate G is I

output(G,O) output of gate G is O

andgate(G) G is an and-gate

orgate(G) G is an or-gate

xorgate(G) G is an exclusive-or-gate

and any others you want

formalise in predicate logic, the following configuration of gates and the output of

the whole system.

An and-gate produces 1 if both of its inputs are 1, otherwise it produces 0.

An or-gate produces 0 if both of its inputs are 0, otherwise it produces 1.

An exclusive-or-gate produces 1 if its two inputs are different, otherwise it

produces 0.

g1 g2

g5

g3

g4

1

1

0

Denotes

And-gate

Denotes

Xor-gate

Denotes

or-gate