Let's have all the grams with the same number of lines (eg. hexagram). The set of these grams and the states they represent are the level (or domain) of our operations.
What kind of operations could we do with the lines of a gram (and the gram itself)? Let's take a look.
= (identity, tautology)
1 = 1
0 = 0
In this form, this is not really an operator, but a statement: Yang is yang. Yin is yin.
NOT (negation, complementation) NOT 1 = 0
NOT 0 = 1
The easiest operator: the complement of yang is yin, and the complement of yin is yang. Traditionally, it is the old yang that changes into new yin, and the old yin that changes into new yang.
OR (union of yang, intersection of yin) 1 OR 1 = 1
1 OR 0 = 1
0 OR
1 = 1
0 OR 0 = 0
AND (union of yin, intersection of yang)
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0
NOR (separation of yang, new yang  old yin)
1 NOR 1 = 0
1 NOR 0 = 0
0 NOR 1 = 0
0 NOR 0 = 1
NAND (separation of yin, new yin  old yang)
1 AND 1 = 0
1 AND 0 = 1
0 AND 1 = 1
0 AND 0 = 1
I suppose you could use OR, AND, NAND, and NOR if you wish to find out the extent of yin or yang in the relations of the two states the grams represent.
These operators are symmetrical (commutative); it doesn't matter to them which gram comes first or second.
XOR (difference, change)
1 XOR 1 = 0
1 XOR 0 = 1
0 XOR 1 = 1
0 XOR 0 = 0
We like this one the most. Why? Because if we have a gram, and we wish to make some changes to it, we can simply create another gram: we can mark the lines we wish to change with yang (1) and the lines we wish to keep with yin (0).
Of course, we could also just make the gram, already complete with changes. In this case, the intermediary gram would represent the difference between the original gram and the new gram.
If we place the new gram to the right of the original gram, we get a two letter word which we can read lefttoright.
So the state (which the original gram represents) changes into another state. (We can have the change happen through time  or some other or continuum.)
XNOR (unity, reverse change)
1 XNOR 1 = 1
1 XNOR 0 = 0
0 XNOR 1 = 0
0 XNOR 0 = 1
In the context of changing from one state to another, the resulting gram would show how to change back from the second state to the first one.
In the context of difference between two states, the resulting gram would show how to shift the relation between the two to a complementary state.
=>> (yangimply) 1 =>> 1 = 1
1 =>> 0 = 0
0 =>> 1 = 1
0 =>> 0 = 1
=> (yinimply)
1 => 1 = 0
1 => 0 = 0
0 => 1 = 1
0 => 0 = 0
(( (yangsubset of)
1 (( 1 = 1
1 (( 0 = 1
0 (( 1 = 0
0 (( 0 = 1
( (yinsubset of)
1 ( 1 = 0
1 ( 0 = 1
0 ( 1 = 0
0 ( 0 = 0
In logic, "A=>B" means "if A is true, B is true". Thus, the result of "A=>B" is true if the statement "if A is true, B is true" is true.
In logic, "A implies B" also means "B is subset of A".
The above is similar to this use in logic (only instead 'true' and 'false' we use 'yang' and 'yin').
Think of it this way:
For "A yangimplies B" to be yang, either A has to be yin, or both A and B have to be yang.
For "A yinimplies B" to be yin, either A has to be yang, or both A and B have to be yin.
For "A is yangsubset of B" to be yang, either A has to be yang, or both A and B have to be yin.
For "A is yinsubset of B" to be yin, either A has to be yin, or both A and B be have to yang.
In conclusion, the complement (NOT) and difference (XOR) operators seem directly usable  the others less so.
