Question: in prolog Course Project In prolog, it is invalid to ask a query like: ?-5 is 3 +X. However we may ask a similar query

in prolog
Course Project In prolog, it is invalid to ask a query like: ?-5 is 3 +X. However we may ask a similar query through Peano's numbers, using the successor notation ?- add(s(s(s(0))), X, s(s (s(s(s(0)))) X-s(s(O) We can represent Negative numbers by p(...), where p stands for predecessor. Prolog has a "structure" data structure (e.g. date (3,6,2016). Hence, we can represent fractional Peano numbers (numerator and denominator) by a prolog structure: (Example: Provide a complete library of mathematical operations using these numbers. The operations must include: Addition, subtraction, multiplication, integer division, mod, power (exponentiaition), gcd and lcm. It also must include all these comparison operations: greater, greater or equal, smaller, smaller or equal, equal and not equal. Your library must include two versions, one for numbers (Peano's integers) and another for fractions (implement applicable operations only, for example no "mod" operations is defined for fractions, whereas division is defined). In case of fractions, the result must be in the simplest form (e.g. instead of)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
