propositions and inference self atom=atom def __str__(self)"""returns the string representation of clause ""return "askable self atom def yes(ans)"""returns true if the answer is yes in some form""return ans lower(in ['yes''yes ''oui''oui '' '' 'bilingual knowledge base is list of clauses and askables in order to make top-down inference fasterthis creates dictionary that maps each atoms into the set of clauses with that atom in the head logicproblem py -(continued from display import displayable class kb(displayable)""" knowledge base consists of set of clauses this also creates dictionary to give fast access to the clauses with an atom in head ""def __init__(selfstatements=[])self statements statements self clauses [ for in statements if isinstance(cclause)self askables [ atom for in statements if isinstance(caskable)self atom_to_clauses {dictionary giving clauses with atom as head for in self clausesif head in self atom_to_clausesself atom_to_clauses[ headadd(celseself atom_to_clauses[ head{ def clauses_for_atom(self, )"""returns set of clauses with atom as the head""if in self atom_to_clausesreturn self atom_to_clauses[aelsereturn set( def __str__(self)"""returns string representation of this knowledge base ""return '\njoin([str(cfor in self statements]here is trivial example ( think therefore amusing in the unit testslogicproblem py -(continued triv_kb kb(version june