Question
use SWI-Prolog to do the problem, show the program screenshots Problem 3: Simple inheritance network % Implement isa and aka predicates in Prolog. % isa(Name,
use SWI-Prolog to do the problem, show the program screenshots
Problem 3: Simple inheritance network % Implement isa and aka predicates in Prolog. % isa(Name, Class): returns true if entity Name is a member of Class. % aka(SubC, Class): returns true if SubC is a Subclass of Class. % Given two types of facts: % prop(Name, type, Class): Name isa member of Class without using % inheritance. % prop(SubC, subclass, Class): Subc is a subclass of Class without % using inheritance % Test data: prop(tweety, type, canary). prop(snoopy, type, beagle). prop(canary, subclass, bird). prop(beagle, subclass, dog). prop(bird, subclass, animal). prop(dog, subclass, animal).
% Implement isa and aka using recursion. DO NOT use assert! % You can implement this problem in 4 rules! % Hints: implement aka using aka and prop, % implement isa using prop and aka.
% test cases: % ?- isa(tweety, canary). (Note: No inheritance used) % true. % ?- isa(tweety, bird). (Note: Inheritance used) % true. % ?- isa(tweety, animal). % true. % ?- isa(tweety, dog). % false. % ?- aka(canary, bird). (Note: no inheritance used) % true. % ?- aka(canary, animal). (Note: inheritance used) % true. % ?- aka(snoopy, animal). % false. (Because snoopy is a member of animal, not a subclass!)
% Type your solution here:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started