3. Create a program kb.py that is able to take in a file containing a knowledge base(KB) and a model and returns the truth value of the KB. The KB should be in CNF (that is, OR clauses joined by AND...


3. Create a program kb.py that is able to take in a file containing a knowledge<br>base(KB) and a model and returns the truth value of the KB. The KB should be<br>in CNF (that is, OR clauses joined by AND clauses). Your program should read<br>a file where each line is comprised of a sentence in propositional logic, a comma<br>and a set of key3Dvalue pairs separated by comma that denote the model. The<br>symbols T,F,V are not allowed as they have a special meaning: True, False and<br>OR. An example of a file is the following (you can use it to test):<br>(j V t) ^ (p V q)<br>(jon V chris V frank) * (candy V beef),jon=F,chris=T,frank=F, candy=F,beef%=F<br>^ (~p V t),j=T,t=F,p=F,q=T<br>(C[cl] V C[bo] V C[ve]) ^<br>(P[pinera] V P[morales) V P[chavez]),C[cl]=T,C[bo]=T,C[ve]=T,P[pinera]=T,P[morales]=T,P[chavez]=F<br>If you save this in a file called prep.kb then executing python kb.py prep.kb<br>should return the truth value of each line. That is: True, False, True<br>

Extracted text: 3. Create a program kb.py that is able to take in a file containing a knowledge base(KB) and a model and returns the truth value of the KB. The KB should be in CNF (that is, OR clauses joined by AND clauses). Your program should read a file where each line is comprised of a sentence in propositional logic, a comma and a set of key3Dvalue pairs separated by comma that denote the model. The symbols T,F,V are not allowed as they have a special meaning: True, False and OR. An example of a file is the following (you can use it to test): (j V t) ^ (p V q) (jon V chris V frank) * (candy V beef),jon=F,chris=T,frank=F, candy=F,beef%=F ^ (~p V t),j=T,t=F,p=F,q=T (C[cl] V C[bo] V C[ve]) ^ (P[pinera] V P[morales) V P[chavez]),C[cl]=T,C[bo]=T,C[ve]=T,P[pinera]=T,P[morales]=T,P[chavez]=F If you save this in a file called prep.kb then executing python kb.py prep.kb should return the truth value of each line. That is: True, False, True

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here