The library file algebra.pl contains the main code for
evaluating algebraic expressions involving gua. This engine is used extensively
throughout the rest of the library code.
eval(+Expression, ?Result)
This predicate evaluates algegraic expressions involving gua.
Expression - the expression to evaluate.
Result - the result of evaluating the expression.
Note that all the gua in the expression must have the same number of lines or the evaluation will fail. This predicate understands expressions involving the following operators:
~&, v, xResult will be a single gua.
top_of(+Gua, ?Top)
This predicate determines the energetic top for the given gua.
Gua - the gua to find the top of.Top - the top of the given gua.The top of a gua is the corresponding gua with all yang lines.
is_top(+Gua)
This predicate succeeds if the given gua is composed of all yang
lines. Therefore, the following expression is guaranteed to be true,
what ever value G is given:
?- top_of(G, T), is_top(T).
bot_of(+Gua, ?Bot)
This predicate determines the energetic bottom for the given gua.
Gua - the gua to find the top of.Bot - the bottom of the given gua.The bottom of a gua is the corresponding gua with all yin lines.
is_bot(+Gua)
This predicate succeeds if the given gua is composed of all yin
lines. Therefore, the following expression is guaranteed to be true,
what ever value G is given:
?- bot_of(G, T), is_bot(T).
lesseq(+Gua1, +Gua2)
This predicate succeeds if Gua1 is less than,
or equal to, Gua2 in the energy order. Note that
at least one of the two arguments must be instantiated. If only one
argument is instantiated, then the predicate will iterate through all
solutions on backtracking. See also covers/2.
less(+Gua1, +Gua2)
This predicate succeeds if Gua1 is strictly
less than Gua2 in the energy order. Note that at
least one of the two arguments must be instantiated. If only one
argument is instantiated, then the predicate will iterate through all
solutions on backtracking. See also covers/2.
yi_constant(?Constant)
This predicate identifies the two constants of the Yi; yin is
0 and yang is 1.