Structural Operations

The library file structure.pl contains a number of predicates for analysing the internal structure of gua. There are some predicates targetted specifically at the traditional structural decompositions of hexagrams. In additional, there are predicates for performing general decomposition of gua of arbitary size.

nuclear_hexagram(+Hexagram, ?Nuclear)

This predicate determines the Nuclear figure for the given Hexagram.

component_trigrams(?Hexagram, ?LowerTrigram, ?UpperTrigram)

This predicate decomposes the Hexagram into its LowerTrigram and UpperTrigram. If Hexagram is instantaited, then the two trigrams will be computed. Conversely, if LowerTrigram and UpperTrigram are instantiated, then Hexagram will be computed.

component_bigrams(?Hexagram, ?LowerBigram, ?MiddleBiGram, ?UpperBigram)

This predicate decomposes the Hexagram into its constituent bigrams. If Hexagram is instantaited, then the three bigrams will be computed. Conversely, if LowerBigram, MiddleBigram and UpperBigram are instantiated, then Hexagram will be computed.

distinguished_pair(+Gua, ?LowerGua, ?UpperGua)

This predicate decomposes the given Gua (which must be instantiated) into its two primary components. For hexagrams, this predicate has the same effect as component_trigrams/3 although the calling mode is more restrictive.

canonical(+Gua, +Pattern, ?CanonicalSet)

This predicate breaks down the Gua by extracting non-overlapping instances of the Pattern until the Gua is exhausted. The result is the CanonicalSet. The Pattern must be a list of variables of the arity to be extracted. Thus, an initial Gua of arity 6 (a hexagram) and a Pattern of arity 2 (a bigram) generates a CanonicalSet that contains, in order, the lower bigram, the middle bigram, and the upper bigram, and would thus be equivalent to calling component_bigrams, although the calling mode is more restrictive.

exhaustive(+Gua, +Pattern, ?CanonicalSet)

This predicate breaks down the Gua by exhaustively extracting every occurance of the Pattern to give the ExhaustiveSet. The Pattern must be a list of variables of the arity to be extracted. Thus, an initial Gua of arity 6 (a hexagram) and a Pattern of arity 3 (a trigram) generates an ExhaustiveSet that contains, in order, the lower primary trigram, the lower nuclear trigram, the upper nuclear trigram and the upper primary trigram.