%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FILE. . . . . /home/hak/d/life/gen-inputs.lf
% EDIT BY . . . Hassan Ait-Kaci
% ON MACHINE. . Latitude407
% STARTED ON. . Fri Dec 26 10:12:08 2003
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Last modified on Sun Jan 04 13:43:45 2004 by hak@ilog.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This file contains the test cases for the generalizer.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% simple co-references
generalize_p(a(f1 => Y:x1, f3 => Y),a(f1 => Z:x1, f3 => Z), Ans)?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% coreference and expansion needed at the same time
% case where the original formulation failed
generalize_p(A:a(f1 => x1, f2 => A), a(f1 => x1, f2 => a(f1 => x1)), Ans)?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% coreferences across the two terms
generalize_p(a(f1 => x1, f2 => A), A:a(f1 => x1, f2 => a(f1 => x1)), Ans)?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the diamond test
generalize_p(a(f1 => b(g1 => C:c), f2 =>d(g2 => C)),
a(f1 => b(g1 => D:c), f2 =>d(g2 => D)),
Ans)?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% using sub-sorts
a <| b.
c <| b.
write(generalize_f(a(f1=>x1, f3=>x3),c(f2=>x2, f3=>x3)))?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% school example
person := {student ; employee}.
employee := {staff ; faculty}.
workstudy <| student.
workstudy <| staff.
bob <| student.
piotr <| student.
pablo <| student.
elena <| workstudy.
simon <| workstudy.
art <| staff.
judy <| staff.
don <| faculty.
john <| faculty.
sheila <| faculty.
stu -> X:student(advisor => faculty(secretary => Y:staff,
assistant => X),
roommate => employee(representative => Y)).
emp -> employee(advisor => don(secretary => elena,
assistant => U : student),
roommate => V:student(representative => V),
helper => simon(spouse => U)).
generalize_p(stu,emp, Working_Student)?