%Lab 3 %1. Prolog facts and rules %armstrong is faster than virenque. faster(armstrong, virenque). %virenque is stronger than armstrong. stronger(virenque, armstrong). %monday's race is short. short_race(monday). %tuesday's race is long. long_race(tuesday). % If the race is short, the faster cyclist wins. % if the race is long, the stronger cyclist wins. % X defeats Y wins(X,Y,Day) :- short_race(Day), faster(X,Y). wins(X,Y,Day) :- long_race(Day), stronger(X,Y). % who wins the race on monday? % who wins the race on tuesday? %2. Prolog data structures figure('ABC', triangle(10,3,5)). figure('XYZ', triangle(5,6,8)). figure('MNPQ', square(10)). perimeter(Name, Result) :- figure(Name, triangle(X,Y,Z)), Result is X+Y+Z. perimeter(Name, Result):- figure(Name, square(X)), Result is 4*X.