75.1k views
4 votes
What is 2+2= to. My teacher says its not four im confused.

1 Answer

2 votes

Answer:

Because they aren't equivalent. Prolog allows the definition of symbols as inline operators using the op/3 predicate, which allows one to convert arbitrary compounds to formulae and back again.

Explanation:

Since 2+2 is a compound with arity 2 and 4 is just an atom unification is impossible and the query fails. To actually do arithmetic equivalence you must use =:=/2 (2 + 2 =:= 4). To solve arithmetic problems you must use is/2 or use an interpreter with arithmetic constraint extensions.Yes, the moment you begin to tie math to real world items, it can turn false very quickly. For example:

(2 red balls + 2 blue balls = 4 orange balls) = false

(2 women + 2 women = 4 men) = false

(2 cats + 2 mice = 4 dogs) = false

(2 oxygen as a single molecule (o₂) + 2 oxygen as a single molecule (o₂) = 4 oxygen as a single molecule (0₄)) = false

That is to say, in the real world there is often non-numerical 'metadata' in additional to the numbers being added, such that a perfect equality (beyond mere quantity) is false. This 'metadata' would include everything from size, to composition, to structure, to color, to temperature, to species, to intelligence, to flavor, to temperament, to physical laws of union and relation, and many other properties.

User Jjanes
by
5.6k points