Noble Boolean functions

From testwiki
Jump to navigation Jump to search

Template:Boolf header Template:Zhegalkin stuff Noble Boolean functions are those who are their own Zhegalkin twins, i.e. the binary expression of their ANF is equal to their truth table.
They correspond to Template:W in the Zhegalkin permutation.
They are all even, i.e. the first digit of their truth table is false.
When a Boolean function is noble, its whole faction is noble.
Within the this project it is slightly misleading to apply the term noble to Boolean functions. It is a property of a truth table with a specific length.

Template:Zhegalkin matrix/Triangle Pi

Template:Zhegalkin matrix/Triangle Phi

Template:Collapsible START Template:Collapsible END

Template:Collapsible START These matrices show the 2-ary and 3-ary Boolean functions, represented by the big gray integers (corresponding to the truth tables).
The small black integers above them are the senior nobles (i.e. one arity above).
(The highlighted big numbers are the king indices.)

Error creating thumbnail:
3-ary nobles
4-ary nobles

Template:Collapsible END

Template:Collapsible START File:Zhegalkin 256; fixed.svg Template:Collapsible END

Template:Collapsible START

row 3

Template:Clear

row 4

Template:Clear The images show how Φn is derived from Πn1, the permutation of the same length.
The long matrices have two halves:
In the upper half the bit pattern in column k is that of Ξn1,k=Πn1,kk.    (Compare triangle Ξ in the next section.)
The bit pattern in the lower half is identical to that of the gray column indices.

Φn,k=Ξn1,k+(22n1k)=(Πn1,kk)+(22n1k)

The small matrices on the left are divided in the same way:
The upper half is a Sierpiński triangle without the main diagonal, and the lower half is the main diagonal.

These properties of noble Boolean functions can be derived from this:

  • They are even, i.e. place 0 is always false.
  • The 1-bit places (e.g. 1, 2, 4, 8) have the same truth value. (Those where it is false/true shall be called weak/strong.)
  • Half of them are evil/odious, which is indicated by the last place being false/true. (The odious ones are on the right, just like in triangle Π.)

Template:Collapsible END

Template:Collapsible START The row sum of Φn for n1 is 2a(2b1)=2a+b2a with a=2n1 and b=2n1.
That is a binary number consisting of a 0s at the little and b 1s at the big end.

E.g. that of Φ2 is 0 + 6 + 8 + 14 = 28. (11100 as a binary number.)

n sum of row n
0 1
1 21(211)=2221 2
2 22(231)=2522 28
3 24(271)=21124 2032
4 28(2151)=22328 8388352
5 216(2311)=247216 140737488289792

Template:Collapsible END

quadrants

It is easily seen, that the left and right half of each row differ only in the last digit.
Those on the left/right have even/odd weight. They shall be called evil/odious.

Template:Collapsible START

There are two ways to derive one half from the other.

Let L be the left (evil) and R be the right (odious) half.
Let p=2(2n1) be the unique power of two, and q=22n2 be the highest entry.   (They are the first and last entries of R.)
Let j be the mirrored index of i.   (j is as far from the right as i is from the left.)

Then Ri=Li+p=qLj. Template:Spaces (Template:W can be used instead of plus and minus.)

The following Python code illustrates this for rows 1 to 3:

left_and_right_half = {
    1: [
        [0], 
        [2]
    ],
    2: [
        [0,  6], 
        [8, 14]
    ],
    3: [
        [  0,  30,  40,  54,  72,  86,  96, 126], 
        [128, 158, 168, 182, 200, 214, 224, 254]
    ]
}

for n, (left, right) in left_and_right_half.items():
    length = 2 ** (2 ** (n - 1) - 1)
    p = 2 ** (2 ** n - 1)
    q = 2 ** (2 ** n) - 2
    for i in range(length):
        j = length - i - 1
        assert right[i] == left[i] + p == q - left[j]
        assert right[i] == left[i] ^ p == q ^ left[j]

Template:Collapsible END

There is a second way to partition the nobles in two halves:
Those in even/odd places of the triangle row have false/true entries in all 1-bit places of their truth table. They shall be called weak/strong.

So the nobles can be partitioned into four quadrants by depravity and strength.

Template:Collapsible START Vertically adjacent quadrants contain relative complements. Horizontally adjacent quadrants differ only in the central vertex.
(40 and 214 are relative complements. 40 and 168 differ only in the central vertex.)

The 16 noble 3-ary Boolean functions form 8 factions. So there are 2 royal factions.

Error creating thumbnail:

Template:Collapsible END

Nobles that are evil and weak shall be called royal.
Each noble corresponds to a royal, and can easily be derived from it. (A royal corresponds to itself.)
When a Boolean function is royal, its whole faction is royal.
The function with the smallest Zhegalkin index in a faction shall be called king, and be used to represent it.
So all nobles of a given arity can effectively be represented by a rather short list of kings.

Template:Noble Boolean functions/royal triangle

Template:Collapsible START The columns of this matrix are the 4-ary royal Boolean functions.
Error creating thumbnail:
Compare Φ4 as 16×256 matrix, shown above.
The 16×6 matrix on the left is shown as the 16×8 matrix from that file, with the left and right column blacked out. Template:Collapsible END

<templatestyles src="Zhegalkin matrix/triangle.css" />

Template:Collapsible START Error creating thumbnail:

The top left corner in each 2×2 matrix is a king. The other corners are its equivalents in the other quadrants.
(Vertically adjacent quadrants contain relative complements. Horizontally adjacent quadrants differ only in the central vertex.)

The two tables below correspond to the image above. The one on the left shows the same numbers as the image.
The one on the right shows the smallest Zhegalkin index for each of the 44 factions. (They differ only for the odd factions, i.e. those with green and blue background.)

Template:Noble reps/outer/match Template:Noble reps/outer/minimal

The black integers are Zhegalkin indices. The gray numbers below are their noble indices, i.e. the positions in the sequence of nobles.
The beige numbers in the image are faction sizes, i.e. the number of different permutations of the example shown. Template:Collapsible END

Template:Collapsible START Error creating thumbnail: Template:Collapsible END

group under exclusive or

With XOR as a group operation the n-ary noble and royal Boolean functions form a power of the Template:W C2.

Template:Collapsible START The 3-ary nobles form the group C24.

The Python operator ^ represents the Template:W.

nobles = [0,  30,  40, 54,  72, 86, 96, 126, 128, 158, 168, 182, 200, 214, 224, 254]

for i, a in enumerate(nobles):
    for j, b in enumerate(nobles):
        assert nobles.index(a ^ b) == i ^ j

This works for any row of the noble triangle Φ, or from the royal triangle. (But not from the triangle of kings.) Template:Collapsible END


patrons

The XOR of twins is noble, i.e. the XOR of a key and a value in Πn is an entry of Φn.
For a Boolean function this means, that the XOR of its ANF and its truth table is a noble Boolean function, which shall be called its patron.
The patron of a noble is the contradiction.

<templatestyles src="Zhegalkin matrix/triangle.css" />

For n1 the entries in Ξn are repetitions of those in Φn. E.g. Ξ2 contains the entries {0,6,8,14}, each repeated four times.

The set of places where Ξn has entries Φn,k can be calculated by XORing Πn1,k with the entries of Φn.

3-ary Boolean functions with patron 168

<templatestyles src="Zhegalkin matrix/matrix pi xor phi.css" /> Template:Collapsible START Let π=Π2 (length 16), ϕ=Φ3 (length 16) and ξ=Ξ3 (length 256).
Let Ik={iξi=ϕk} be the set of places where ξ has the entry ϕk.

π is the left column of the following matrix.
ϕ is its top row, and also shown in the column to its right.
The matrix entries are the bitwise XORs of its left column and top row.
Ik is row k as a set of numbers: {πkffϕ}

Example:   In which places is ξ equal to ϕ10=168?
π10=2I10={2ffϕ}={2,28,...,226,252}
It can be easily seen, that the first and the last entry 168 in ξ is in places 2 and 252.

0 0 30 40 54 72 86 96 126 128 158 168 182 200 214 224 254 0
1 15 17 39 57 71 89 111 113 143 145 167 185 199 217 239 241 30
2 10 20 34 60 66 92 106 116 138 148 162 188 194 220 234 244 40
3 5 27 45 51 77 83 101 123 133 155 173 179 205 211 229 251 54
4 12 18 36 58 68 90 108 114 140 146 164 186 196 218 236 242 72
5 3 29 43 53 75 85 99 125 131 157 171 181 203 213 227 253 86
6 6 24 46 48 78 80 102 120 134 152 174 176 206 208 230 248 96
7 9 23 33 63 65 95 105 119 137 151 161 191 193 223 233 247 126
8 8 22 32 62 64 94 104 118 136 150 160 190 192 222 232 246 128
9 7 25 47 49 79 81 103 121 135 153 175 177 207 209 231 249 158
10 2 28 42 52 74 84 98 124 130 156 170 180 202 212 226 252 168
11 13 19 37 59 69 91 109 115 141 147 165 187 197 219 237 243 182
12 4 26 44 50 76 82 100 122 132 154 172 178 204 210 228 250 200
13 11 21 35 61 67 93 107 117 139 149 163 189 195 221 235 245 214
14 14 16 38 56 70 88 110 112 142 144 166 184 198 216 238 240 224
15 1 31 41 55 73 87 97 127 129 159 169 183 201 215 225 255 254
The lower 8×16 matrix corresponds to row 10.
The one above contains the Zhegalkin indices, and has the same set of columns.
Nobles for comparison

Template:Collapsible END

Template:Zhegalkin matrix/clusters with patron 168

Template:Collapsible START

File:3-ary Boolean functions; patrons 10.svg
Boolean functions with patron 168 in octeract matrix
(This is the transpose of Zhegalkin indices with quaestor 3.)

Template:Collapsible END