Finds a common base expression CommonExpr for two input expressions Expr1 and
Expr2 (typically units or quantities), along with their respective scaling factors
Factor1 and Factor2.
The relationship established is that `Expr1*Factor1 = Expr2*Factor2 = CommonExpr`.
This predicate is tabled to memoize its results.
It employs an iterative deepening approach to search for the closest common ancestor
of Expr1 and Expr2.
The search expands definitions (guided by the ChildParentGoal predicate,
e.g., for unit parents or quantity parents) to establish this commonality.
- Arguments:
-
| ChildParentGoal | - A meta-argument (predicate name) that defines how to expand
or find parents of elements within the expressions (e.g.,
unit_parent for units, alias_or_child_quantity_parent
for quantities). |
| Expr1 | - The first input expression (e.g., si:metre, isq:speed). |
| Factor1 | - The numerical scaling factor associated with Expr1 in the context of the common relationship. |
| Expr2 | - The second input expression. |
| Factor2 | - The numerical scaling factor associated with Expr2 in the context of the common relationship. |
| CommonExpr | - The common base expression derived from Expr1 and Expr2. |