Discussion: In this programming assignment, we are creating an "agent" that will store a knowlege base and retrieve information from that knowlege base. This knowlege base (or KB) consists of a list of facts, some of which were directly input into the agent and some that were inferred by the rules that the agent has. This list of rules is the second piece of information that the agent keeps track of and defines exactly what the knowlege base will contain other than the facts directly input into the KB. Each element of the list of rules is a statement of the form: ( (if ( ... ) then )) The effect that we want to produce with this is that when the new rules that are input into the function are run past all of these rules and satisfy the to , a new fact will be generated, and that fact will be . The result of this will be the transitive closure of all facts that are implied or given as rules. This means that the knowlege base is complete in the sense of the rules given, in other words, all inferences that can be made by a particular fact will have been made and a reintroduction of that same fact will result in no net addition to the knowlege base. We also want to be able to ask questions that our agent can answer about the knowlege base. Questions that pertain to the types of facts that are generated by the rule list and input facts. An example would be to ask the agent who is older than a certain person. We would input: (query (older ?x Bob)) and the agent would return a list of all of the facts in the database that fit the form (older * Bob) where the * can be anything. You can also ask it more general questions like: (query (older ?x ?y)) and it will give you all of the relations between two objects that are older. Algorithms: An optimization made to the udpate and satisfy procedures is to separate the new facts input from the facts allready in the knowlege base. This is done since we allready have the transitive closure of all of the facts contained in the original knowlege base, therefore the only new facts that will be introduced into the KB will come from the new facts. The optimization lies in the checking of the list of satisfying propositions for each rule against the new input facts to see if there are any mention of them. If not, the entire rule can be skipped, if so we must process like normal. Another optimization that we made was to sort the knowlege base into a kind of a hash table. We grouped facts with the same predicate into lists and then grouped those lists to make up the knowlege base. This is done to be able to quickly skip over a large number of facts when searching for ones to satisfy the preconditions for a rule. There is a penalty when inserting a new fact into the list since we have to find the correct place to put it but that operation is not done as often as searching for rule condition satisfaction. Results: Conclusions: The unavailability of disjunctions in the rule condiditons makes the list list of rules much larger than it could be. For example, we must generate several different rules to say that a person is a male like if he is an uncle or if he is a father or a husband or a grandfather and so on. If we could add all of these into one rule, the processing time would have been sped up greatly due to the smaller number of rules to traverse for each new fact.