Ask Experts Questions for FREE Help !
Ask
    princevalentino's Avatar
    princevalentino Posts: 1, Reputation: 1
    New Member
     
    #1

    Dec 10, 2011, 06:33 PM
    Predic logic
    1.
    A. Using the predicates provided below, translate the following formulae of predicate logic into English:

    L6CMS(x): x is a student at Level 6 in CMS.
    BelowC(x): x's English grade is below C.
    Study(x, y): x studies why.
    Know(x, y): x knows why.

    (I) x(L6CMS(x)  Know(x, JixinMa) ® Study(x, AI))
    (ii) xy(L6CMS(x)  BelowC(x) ® Study(x, Extra-English))
    (iii) xy(L6CMS(x)  ¬BelowC(x)  Study(x, Extra-English))
    (iv) x((L6CMS(x)  Study(x, AI)) ® ¬y(L6CMS(y)  BelowC(x)  ¬Know(x, y))
    (v) xyz(¬(x = y)  ¬(x = z)  ¬(y = z)  L6CMS(x)  L6CMS(y)  L6CMS(z)
     Know(x, Jixin)  Know(y, Jixin)  Know(z, Jixin))


    B. Using the same predicates provided above in question a, translate the following English sentences into formulae of predicate logic:

    (I) No CMS students at Level 6 studies Chinese.
    (ii) All CMS students at Level 6 study at least three courses.
    (iii) Jixin Ma knows all those CMS students at Level 6 who study AI.
    (iv) Some CMS students at Level 6 do not study Extra-English.
    (v) There are at least two CMS students at Level 6 study both AI and extra-English.



    2.
    A. Let the world of discourse be the set of integers. “Translate” each of the following expressions into English, state whether they are true or false, and give your justifications for each of them:

    • nm(n = m  n > m  n < m)
    • n(n = 8  n < 8  n > 8)
    • nm(n m = 8)
    • nm(n * m = 8)
    • nm( n m = 8)



    B. Use truth table to verify the following equivalence:

    (I) ~(A ® B)  A  B
    (ii) ~(A  B  A  C)  (A  B)  (A  C)




    3.
    Use your own words, explain your understanding of the actual meaning of “A materially implies B”, that is, A  B, in propositional logic. Use your own example to show the difference between the use of A  B in propositional logic and the use of “If A then B” in instructions or commands.



    4.
    Use natural deduction to prove:

    A  B  C ╞ C  B  A




    5.
    Suppose we have the following parent database in prolog:

    Parent(tom, harry).
    Parent(mary, harry).
    Parent(steve, emma).
    Parent(helen, emma).
    Parent(harry, ed).
    Parent(harry, roger).
    Parent(emma, ed).

    A. Write a query to find Tom's children who have children of their own, and their children's names (Hint: use letter variables such as X and Y).


    B. Write a query to find Tom's children who have children of their own, but without listing their children's names (Hint: use both letter variable and anonymous variable “_”).


    C. Is the following query:

    ?- parent(mary, _), parent(_, _).

    The same as the query:

    ?- parent(mary, X), parent(X, _).

    Justify your answer.


    D. Write a query to which the query:

    ?- parent(mary, _), parent(_, _).

    Is equivalent.




    6.
    Unify each of the following pairs where possible and give the unifying substitutions. In the case where unification is impossible, justify your answer.
    A. [tom, liz, sandy] = [H | T]
    B. [ [tom, liz], sandy] = [H | T]
    C. [ [tom, liz, X], sandy] = [H | [X]]
    D. [ [tom, liz | X], why, sandy] = [H | X]
    E. [ [tom], [liz,sandy] ] = [ X , why | Z]


    7.
    Consider the following list-membership program:

    MemberCheck(X,[X|_]).
    MemberCheck(X,[_|T]) :- memberCheck(X,T).

    A. What happens with the following queries?

    ?- memberCheck(1, X).
    ?- memberCheck(X, Y).

    B. Prolog is not a typed language, e.g. The following queries perhaps should give type errors, but they don't:

    ?- memberCheck(a, [a|b]).
    True (Yes)

    ?- memberCheck(b, [a|b]).
    False (No)
    How does Prolog come to the above two conclusions?

    C. Suppose we define a predicate “list”, where list(X) would be true if X is a list.

    List([]).
    List([X|T]) :- list(T).

    How could we then make the memberCheck predicate more type safe? Write a revised type safer program memberCheck2 for list-membership checking, which will make the queries in b. Behave as expected, that is:

    ?- memberCheck(a, [a|b]).
    False (No)

    ?- memberCheck(b, [a|b]).
    False (No)
    TUT317's Avatar
    TUT317 Posts: 657, Reputation: 76
    Senior Member
     
    #2

    Dec 11, 2011, 02:18 PM
    Hi prince,


    What you have here is largely programming logic. You may do better to post this in the computer section.

    Sorry I can't help.

    Tut

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Logic Devices [ 19 Answers ]

P1010034.jpg picture by superutails - Photobucket What is 39 and 40?

Inventory logic [ 1 Answers ]

What is the difference between cost of sales and cost of goods sold??

Vote logic [ 4 Answers ]

Five people each voted to boot one of the other four off a reality show MNIT Roadies. There wasn't a tie so The person with the most votes was booted from the show. If the Person is the only person who is lying, then who was voted out of the show? Shikhar: I voted for someone who voted for...

Now this is logic? [ 2 Answers ]

The way engineers think; A priest, a doctor, and an engineer were waiting one morning for a particularly slow group of golfers. Engineer: What's with these guys? We must have been waiting for 15 minutes! Doctor: I don't know but I've never seen such ineptitude! Priest: Hey, here comes...


View more questions Search