%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Knowledge Representation and Reasoning CSC 486/2506, Fall 2007
%
% Sample file for exercise 5 assignment 2 (Prolog implementation)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% is_subsumed(C1,C2): C1, C2 are the input concepts
%
% This predicate should print which concept subsumes which
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% this implementation only prints the two concepts, you should
% implement your program here.
is_subsumed(C1,C2):-
	write('Concept 1:'),write(C1),nl,
	write('Concept 2:'),write(C2).





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%           OBS: You should not modify anything below 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% subsume(File): takes a file name, reads the concepts and calls
%               is_subsumed/1 with such set of clauses
%
%
% This works under SWI Prolog 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subsume(File) :-
        open(File,read,R),	  % Opens the file
        read_clauses(R, Clause1,Clause2), % Reads the clauses in the file
	close(R),                 % Close the file
        is_subsumed(Clause1,Clause2).   % Calls is_subsumed


read_clauses(R, C1,C2) :-
	read(R, C1),
	read(R, C2).	




