Daniel Carruth CLIPS Assignment 11/3/03 TRUE CLIPS> (assert (ltm-fact flipper is-a dolphin)) CLIPS> (assert (ltm-fact mammal bears live-young)) CLIPS> (assert (ltm-fact animal eats food)) CLIPS> (assert (ltm-fact butter is-a golden-retriever)) CLIPS> (assert (ltm-fact dog a-kind-of mammal)) CLIPS> (assert (ltm-fact animal must breathe)) CLIPS> (assert (ltm-fact dolphin a-kind-of mammal)) CLIPS> (assert (ltm-fact mammal a-kind-of animal)) CLIPS> (assert (ltm-fact animal a-kind-of living-thing)) CLIPS> (assert (ltm-fact golden-retriever a-kind-of dog)) CLIPS> (assert (ltm-fact mammal has-part fur)) CLIPS> (defrule infer-category ?q <- (query ?name is-a ?fact) (not (oldquery ?item ?attrib ?fact)) (ltm-fact ?name is-a ?category) => (assert (query ?category a-kind-of ?fact)) (assert (oldquery ?name is-a ?fact)) (retract ?q)) CLIPS> (defrule true-end ?q <- (query ?name ?attrib ?fact) (not (oldquery ?item ?relat ?fact)) (ltm-fact ?name ?attrib ?fact) => (printout t "Yes it is true that " ?name " " ?attrib " " ?fact crlf) (retract ?q)) CLIPS> (defrule infer-true-end ?o <- (oldquery ?name ?relat ?fact) ?q <- (query ?item ?attrib ?fact) (ltm-fact ?item ?attrib ?fact) => (printout t "Yes it is true that " ?name " " ?relat " " ?fact crlf) (retract ?q) (retract ?o)) CLIPS> (defrule false-end ?q <- (query ?name ?attrib ?fact) (not (oldquery ?item ?relat ?fact)) (not (ltm-fact ?name ?attrib ?fact)) (not (ltm-fact ?name is-a|a-kind-of ?thing)) => (printout t "No it is false that " ?name " " ?attrib " " ?fact crlf) (retract ?q)) CLIPS> (defrule infer-false-end ?o <- (oldquery ?name ?relat ?fact) ?q <- (query ?item ?attrib ?fact) (not (ltm-fact ?item ?attrib ?fact)) (not (ltm-fact ?item is-a|a-kind-of ?thing)) => (printout t "No it is false that " ?name " " ?relat " " ?fact crlf) (retract ?o) (retract ?q)) CLIPS> (defrule start-looking ?q <- (query ?name ?attrib ?fact) (not (oldquery ?item ?relat ?fact)) (not (ltm-fact ?name ?attrib ?fact)) (ltm-fact ?name is-a|a-kind-of ?thing) => (assert (query ?thing ?attrib ?fact)) (assert (oldquery ?name ?attrib ?fact)) (retract ?q)) CLIPS> (defrule keep-looking ?q <- (query ?item ?attrib ?fact) (oldquery ?name ?relat ?fact) (not (ltm-fact ?item ?attrib ?fact)) (ltm-fact ?item is-a|a-kind-of ?thing) => (assert (query ?thing ?attrib ?fact)) (retract ?q)) CLIPS> (assert (query butter eats food)) CLIPS> (assert (query flipper has-part fur)) CLIPS> (assert (query mammal bears live-young)) CLIPS> (assert (query dog has-part wings)) CLIPS> (assert (query flipper is-a animal)) CLIPS> (assert (query butter is-a mammal)) CLIPS> (assert (query butter is-a golden-retriever)) CLIPS> (assert (query mammal a-kind-of living-thing)) CLIPS> (assert (query butter is-a dolphin)) CLIPS> (assert (query flipper is-a dog)) CLIPS> (assert (query flipper made-of stone)) CLIPS> (run) No it is false that flipper made-of stone No it is false that flipper is-a dog No it is false that butter is-a dolphin Yes it is true that mammal a-kind-of living-thing No it is false that butter is-a golden-retriever Yes it is true that butter is-a mammal Yes it is true that flipper is-a animal No it is false that dog has-part wings Yes it is true that mammal bears live-young Yes it is true that flipper has-part fur Yes it is true that butter eats food CLIPS> (dribble-off)