Wednesday, November 19, 2008

Important Questions

Que1: what are normal form?
Ans1: sentences written in PL& FOPL are connected into some standards forms for further processing. These forms are called as Normal forms. Further processing of sentences is done with the help of inference methods like unification or resolution which take these sentences as input but in normal forms.
Two type of normal form in PL& FOPL are :
Conjunctive normal form (CNF): given wff’s F1,F2,……….Fn, each possibly containing the disjunction of literals only, we say F1&F2….&Fn is in CNF

Disjunctive normal form(DNF): given wff F!,F2……….Fn each possibly containing the conjunction of literals only. We say F1 V F2 V………V Fn. Is in DNF.

Que2: wht is the system predicate CUT? Discus the operational behaviour and imp use of CUT.

Ans2: the system predicate CUT, also called as CUT operator allows you to tell prolog which previous choices it need not consider again when it back tracks through the choice of satisfied goals. CUT operator is already defined in prolog and is represented with the help of the symbol ‘!’ in prolog program. By using CUT, ur prog will operate faster coz it would nt waste time attempting to satisfy gaols that u can tell before hand will never contribute to a solution. Your program will occupy less of comp. memory space by using CUT because more economical use of memory can be made if backtracking points don’t have to record for later examination.
Operationl behaviour and importance use of CUT :
confirming choice of a rule: first use of CUT isin places where we want to tell prolog system that it has found a right rule for a particular goal. It means CUT says if you get this for you have picked the correct rule for this goal. This rule of CUT can be explained with help of following example:
sum(N,S) is used to store sum of first N natural numbers in S. it can be defined as:
sum(1,1):-! %rule 1

sum(N,S) :-N>1, N1 is N-1, sum (N1,S1),, s is S1+N %rule 2

here rule 1 is used for boundary condition. Here, we have used CUT! So that if value of N is 1, prolog system checks first rule & display answer 1 and if failure, second rule is checked for N=1 and it will indefinitely go for recursive calls without any boundary condition to stop recursive calls. This ! in the definition is to say that in case of N=1, we just have to check rule 1


the “CUT-fail” combination: the second use of CUT is the place where we want to tell prolog system to fail a particular goal immediately without trying for alternative solutions. Here, CUT is used conjunction with the “fail” predicate to say “if you get to here, you should stop trying to satisfy the goal.” “fail” predicate is to built-in predicate having no argument , fail is defined in such a way that as a goal it always fails and causes backtracking to take place, following examples shows the use of CUT.

Taxpayer (X) :- foreigner (X), !,fail.
Taxpayer (X) :- female(X) , income(X,I),
I<85000, !, fail.
Taxpayer (X) :- male(X),income (X, I),
I<150000, !, fail.

Here if in rule 1 , foreigner (X) predicate is true, taxpayer(X) predicate will fail and ! is used to tell that we do not need to check any other rule if this rule does not satisfy goal taxpayer.

terminate general & test sequence: this use of CUT is in the places where we want to terminate the generation of alternative solutions through backtracking. Here, CUT means if you get to here, you have found only solution to the problem and there is no point in ever looking for alternatives. In prolog program, there is a sequence of goals that can succeed in many ways and which generates many possible solutions on backtracking. After this there are goals fail, backtracking will lead to another solution being proposed. This will be tested for appropriates and so on. This process will be found (failure). We can call the goal that are yielding all the alternative the “generator” and those that check whether a solution is acceptable the”tester”. For example
program to implement integer division using addition and multiplication

divide(N1,N2, result) :-
is integer (result),
product 1 is result*N2
product 2 I (result+1) * N2
product 1 = <> N1, !

integer is used as generator to generate result of dividing N1 by N2. rest of goals are tester! is placed at the nd to say that if we ever successfully generate a result that passes the test for being result of division. We need never try any more.


Que 3: short note on normal forms

Ans 3: sentences written in first order predicate logic or propositional logic are converted into some standard form for their further processing. These standard form are called as normal forms. Sentences in FOL and propositional logic are just giving us some information or knowledge about a particular thing. In order to infer new knowledge from these sentences, we need to process these sentences by using inference methods. Almost all the inference methods take these sentences as input but in normal forms.
Following are types of normal forms used in FOL and prepositional logic:

Conjunctive normal form (CNF)

Gives wff’s F1,F2,F3……Fn each possibly consisting of disjunction of literals only, we say F1, & F2&………….Fn is in conjunctive normal form. In these words, we can say each Fi, where i= 1,2,3………n consists only of the disjunction of literals but Fi are connected together with conjunctions.

Disjunctive Normal Form (DNF)
Given wff’s F1,F2,…………Fn, each possibly consisting of the conjunction of literals only, we say F1V F2 V F3…………. V Fn is in disjunction form. In other words if each Fi, i= 1,2,3…………n consists only of the conjunction of literals, we say F1 V F2………. , Fn is in disjunctive normal form.

For example the sentences

(P(x) & Q(y) & R) V P(x) V (M (x,y) & R) is in disjunctive normal form.



Que 4: define the term recursion
Ans 4: recursion is the process a procedure goes through when one of the steps of the procedure involves rerunning the same procedure. A procedure that goes through recursion is said to be recursive.

Thursday, November 13, 2008

EXPECTED QUESTIONS

Important questions from MST & Final Examination point of Vew


1.Diffefentiate between Logic & logic Programming ?
2.what is the need for quantifiers?
3.What do you mean by first order logic?
4What are Horn Clauses?
5Discuss the advantages of Prolog & differentiate between Syntax & Semantics?
6.What is Structural Induction ?
7.How do we represent Structured data in prolog?
8.Explain the concept of SLD trees?
9.What is Resolution? What role does it play in propositional logic?
10.Explain the concept of recursion in prolog?
11.Discuss the interpretation of nondeclarative features of prolog ?
12.What are normal forms. Explain in detail?
13.Discuss the logical limitation of prolog?
14. Write a program in prolog to compute Fibonacci term using recursion in prolog.
15.What is system predicate CUT?Discuss the operational behavior & important uses of CUT?
16.Explain Well formed formula in detail ?
17Discuss the concept of fail predicate in prolog with help of a example?
18Explain the non declarative features of prolog
Important questions from MST & Final Examination point of Vew


1.Diffefentiate between Logic & logic Programming ?
2.what is the need for quantifiers?
3.What do you mean by first order logic?
4What are Horn Clauses?
5Discuss the advantages of Prolog & differentiate between Syntax & Semantics?
6.What is Structural Induction ?
7.How do we represent Structured data in prolog?
8.Explain the concept of SLD trees?
9.What is Resolution? What role does it play in propositional logic?
10.Explain the concept of recursion in prolog?
11.Discuss the interpretation of nondeclarative features of prolog ?
12.What are normal forms. Explain in detail?
13.Discuss the logical limitation of prolog?
14. Write a program in prolog to compute Fibonacci term using recursion in prolog.
15.What is system predicate CUT?Discuss the operational behavior & important uses of CUT?
16.Explain Well formed formula in detail ?
17Discuss the concept of fail predicate in prolog with help of a example?
18Explain the non declarative features of prolog