Consistency Ordination Program (COP)  renamed Naieve Assumption Gratifier  (NAG)

 
 

    This program was originally designed to be a detective program which would catch users in the inconsitency of their statements, but after analyzing what it had become, I realized that it sounded more like a nagging mother.  Also, the user is a very weird child for being questioned by their mother when they are of drinking age(21).  There are 3 stages of Agent complexity for this problem.   First is the simple reflex agent, which knows where the user was and the program asks you about events you should have seen and should not have seen.  I have developed at the next stage of complexity which does not initially know where you were.  Through an implementation resembling the frame and effect axioms of the Strips model, as well as storing the previous locations; I am able to infer what events the user should not have been able to see.  The final stage, which I only thought of 3 days before the project was due, would be to have a certain location where a crime took place and then use an event driven hypothesis method to try to goad the user into being at the crime scene.  As one can see, the methods are increasing in complexity and sophistication.

    The program has an event database with event names, event locations, start times and stop times.  It also has a predicate, which keeps track of the current time.  In order to be able to immediately quit the program in case of inconsistencies in the database, which would then cause instantiation errors, I have introduced quit and continue terms to allow the program to exit gracefully.  There is also a change_location predicate, which allows the program to know that  the previous answer dictates that it needs to change its location.  The other method for changing location would have been to keep track of it in the State term, however, this information is only valuable during the immediate term, and is inconsequential afterwards, so storing it is a waste.   The main flow of the program is as follows: There is an outer loop, which picks random Length, within certain bounds, until the program will try to catch you in an inconsistency;  this idea was extracted from an lprove example in an exam.  Then you iterate and are asked a question and the state is updated until you hit a Length of 0.  Then the program tries to catch the person in an inconsistency, by asking them about an event in a place during a time when they were somewhere else.  If they answer yes, then they lied, otherwise, they answer no.  An intelligent and necessary design of the program is not to ask questions twice, so this is why unasked and asked predicates are declared.  It stops the user from feeling that they are being questioned by a "dumb" program.  As part of the questioning, the program randomly selects a clause from a set of clauses as the beginning of the question, again to make the user feel like the program is smart.

    One of the many problems I had while coding this program was I/O.  If you enter a word that starts with a capital letter, prolog will try to unify the word, so instead of treating the input word as a term, prolog treats it as a variable.  Another problem as described above was the reunification problem, I needed to one additional clause usually that would always succeed so that prolog would not fail and try reunification.  I tried very hard not to have to code in the quit and continue clauses, because I wanted to try to keep the proof system pure, but I found it inevitable, because the other update clauses tried unifying variables which would not be defined in the quit state.  I recently thought about the event based analysis, and one may have problems with overlapping time schedules and whether the user may have seen the trailing minute of an event if the events overlap; to combat this problem, I created time increments of 59 minutes and a 1 minute location moving time.
 
 

Example Sample Runs:

This example shows how it will catch you, there was a power outage from 8:00 - 8:59 in the restaurant, but you are
at the movies at 8:00.  Notice that the internal representation of time requires a lot of code, but is easier to read than
military time.

Where did you go first [movies, restaurant, bar] ? bar.
What time was it [pm(HH,MM) | am(HH,MM)] ? pm(6,00).
Is it true that you saw the fight [yes, no] ? yes.
Can you verify that you saw the Legend of Drunken Master [yes, no] ? no.
Did you see the drunken man [yes, no] ? yes.
You must have seen the robot bar tender [yes, no] ? no.
Where did you go next [movies, restaurant, bar] ? movies.
Can you verify that you saw the power outage [yes, no] ? yes.
Where did I go wrong and teach you to lie.  You are grounded.
Done
yes
This example shows the error handling and truthful person ending.  If you are asked a question and respond incorrectly, you will be
asked the question again.  If you answer correctly, you are sent away with a warning.
Where did you go first [movies, restaurant, bar] ? restaurant.
What time was it [pm(HH,MM) | am(HH,MM)] ? pm(6,00).
Is it true that you saw the fire [yes, no] ? yep.
Invalid entry
Can you verify that you saw the Legend of Drunken Master [yes, no] ? no.
You must have seen the fire [yes, no] ? yes.
Can you verify that you saw the martian [yes, no] ? no.
Where did you go next [movies, restaurant, bar] ? bar.
You must have seen the drunken man [yes, no] ? yes.
Can you verify that you saw the robot bar tender [yes, no] ? yes.
You must have seen Moe [yes, no] ? yes.
Can you verify that you saw Duff Man [yes, no] ? yes.
You can go now but I am keeping my eye on you.
Done.
yes