Assignment title: Information


Question 1: Probabilistic Propositional Top-Down Prover In this question, you will write a procedure prove to do top down proofs on knowledge bases that just have 0-ary predicates (propositional logic). You should store the knowledge base as a list in the global variable kb. Each clause can be represented as [Head Conjunct1 Conjunct2 ...]. Below is the encoding of the knowledge base a<- b^c b<-d b<-e c d<-h e f<-g^b g<-c^k j<-a^b kb = [["a", "b", "c"], ["b", "d"], ["b", "e"], ["c"], ["d", "h"], ["e"], ["f", "g", "b"], ["g", "c", "k"], ["j", "a", "b"]] Create a procedure called prove that takes as its argument the query it is supposed to prove. The query should be a list of conjuncts. The procedure prove should have a main loop. At each iteration, it will have its current answer cause. Pick the first conjunct in the body. Find all rules in your knowledge base that have a head that matches the first conjunct, and then randomly pick one of the them. Remove the first conjunct from the answer clause and replace it by the body of the rule that you chose. Keep going until either no rule applies, or you have proved the query. If no rule applies, print out the current answer clause and return 0. To randomly pick an index of an element of a list $l, you can do the following. i = int(len(matches)*random.random()) Also, at the beginning of your code, you will need to import the random library: import random Note that we are resolving the non-determinism by randomly choosing one of the choices. Hence, if the first attempt does not prove the query, it might be simply because the wrong choices were made. Create a second procedure called multiprove that calls prove up to a maximum of 100 times. Once prove has succeeded, stop, and return True. Otherwise keep going. If you reach the maximum, return False. Run your code to prove a and prove f. Hand in your code and output from the two runs. Comment on how effective using a randomly chosing a rule as a means of resolving the non-determinism