COSC 574: Automated Reasoning

Project 2
Spring 2016

Due: W 3/23 @ 11:59 PM
10 points

  1. Using Prolog, write predicates that are true if they can unify a list holding the minimum and maximum values in a list of numbers. Do not use built-in predicates (e.g., max/2) in your implementation.

  2. Encode the following tree as a list asserted as a fact. Write the predicates preorder/2 and postorder/2 that are true if they can unify a list holding the pre-order and post-order traversals of the tree, respectively.

    For example:

    ?- tree(T), preorder(T, L).
    T = [o, [r, [e, [g], [o]], [e, [g], [t]]], [o, [n, [w], [h]], [a, [y], [...]]]],
    L = [o, r, e, g, o, e, g, t, o|...].
    

  3. Encode the following graph using facts. Write predicates that are true if they use depth-first search to unify a list holding a path between a start node and an end node.

    For example:

    ?- dfs(a, g, Path).
    Path = [a, b, c, d, e, g] ;
    Path = [a, b, c, f, e, g] ;
    Path = [a, b, d, e, g] ;
    Path = [a, c, d, e, g] ;
    Path = [a, c, f, e, g] ;
    false.
    
  4. Pick your favorite step from the process that transforms wffs to clausal form and implement it using Prolog. Make sure it recursively handles nested patterns.

  5. Use Prolog to prove that Colonel West is a criminal. For example:
    ?- criminal(west).
    true.
    
    ?- criminal(X).
    X = west.
    

Instructions for Electronic Submission

In the header comments of the primary file, provide the following information:
%
% Name
% E-mail Address
% Platform: Windows, Linux (cs-class), etc.
% Prolog Environment: SWI-Prolog
%
% In accordance with the class policies and Georgetown's Honor Code,
% I certify that, with the exceptions of the course materials and those
% items noted below, I have neither given nor received any assistance
% on this project.
%

For all of the predicates, demonstrate their use in a transcript. Put everything in a zip file and upload it to Blackboard.

Copyright © 2019 Mark Maloof. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.