aboutsummaryrefslogblamecommitdiffstats
path: root/examples/arithmetic.sol
blob: a56d82ec8d5e7c5277cbe491b415fcd32eb4049d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                  
% Arithmetic solves backward, and the numeric tower keeps its
% minimal shape: an integer-valued rational IS the integer.

% Forward: 3 + 4.
Query expression: [Plus left: 3 right: 4 result: R]

% Backward: what plus 5 gives 12?
Query expression: [Plus left: X right: 5 result: 12]

% Through the rationals: 3 * X = 2.
Query expression: [Times left: 3 right: X result: 2]

% Minimal shape: 1/2 + 1/2 is the integer 1, not the rational 2/2.
Query expression: [Plus left: 1/2 right: 1/2 result: R]

% Rationals reduce on sight: 2/4 equals 1/2.
Query expression: [Equal left: 2/4 right: 1/2]