Answered step by step
Verified Expert Solution
Question
1 Approved Answer
// ProLog Programming 7. Write a Prolog program to save the facts of that Alice and Bob know each other; Bob and Chris know each
// ProLog Programming
7. Write a Prolog program to save the facts of that Alice and Bob know each other; Bob and Chris know each other; Chris and Dan know each other; Dan and Elaine know each other; Elaine and Frank know each other; Dan and Gang know each other; Gang and Henry know each other; Henry and Alice know each other. Add three logics 1st-degree connection People directly connected. For example, in the picture below, Alice and Bob are 1st-degree connection. 2nd-degree connection - People connected to their 1st-degree connections. For example, in the picture below, Bob and Dan are 2nd-degree connection. 3rd-degree connection - People connected to their 2nd-degree connections. For example, in the picture below, Alice and Dan are 3rd-degree connection. Then query (1) whether Alice and Elaine are 1st-degree connection or 2nd-degree connection. (2) whether Alice and Dan are 1st-degree connection or 2nd-degree connection or 3rd-degree connection. 7. Write a Prolog program to save the facts of that Alice and Bob know each other; Bob and Chris know each other; Chris and Dan know each other; Dan and Elaine know each other; Elaine and Frank know each other; Dan and Gang know each other; Gang and Henry know each other; Henry and Alice know each other. Add three logics 1st-degree connection People directly connected. For example, in the picture below, Alice and Bob are 1st-degree connection. 2nd-degree connection - People connected to their 1st-degree connections. For example, in the picture below, Bob and Dan are 2nd-degree connection. 3rd-degree connection - People connected to their 2nd-degree connections. For example, in the picture below, Alice and Dan are 3rd-degree connection. Then query (1) whether Alice and Elaine are 1st-degree connection or 2nd-degree connection. (2) whether Alice and Dan are 1st-degree connection or 2nd-degree connection or 3rd-degree connectionStep 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