 # Alternative Logarithms, Part 2

Mar 21st, 2020
635
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. Alternative Logarithms, Part 2
2. ------------------------------
3.
4. Let's look again at the alternative logarithm identity:
5.
6. s(ab) = f( s(a), s(b) ) for some symmetric function f.
7.
8. Consider now f being the XOR operator (working in the integer domain now):
9.
10. s(ab) = s(a) XOR s(b)
11.
12. The XOR operation is in some ways similar to integer addition, and the traditional symbol for it (+) reflects this fact.
13.
14. Let us look at the binary for both addition and XOR:
15.
16. 0+0 = 00 0 XOR 0 = 0
17. 0+1 = 01 0 XOR 1 = 1
18. 1+0 = 01 1 XOR 0 = 1
19. 1+1 = 10 1 XOR 1 = 0
20.
21. The LSB of the addition operator is clearly following the truth table for XOR. But XOR does not elicit an overflow/carry in the way that addition does.
22.
23. The similarity between XOR and addition could have some interesting implications, and this s() may have some association with our familar (discrete) logarithm.
24.
25. Though unlike addition, and unlike the Lp norm we explored in the previous installment of this analysis, XOR is a non-monotonic function.
26.
27.
28. Regardless, we will continue by asking the same question as before: Can we determine a closed form of s() from this rule??
29.
30. Let us evaluate it at some points:
31.
32. s(a.1) = s(a) XOR s(1) = s(a)
33.
34. So s(1) = 0
35.
36. s(a.0) = s(a) XOR s(0) = s(0)
37.
38. Clearly s(0) is undefined.
39.
40. s(a.1/a) = s(a) XOR s(1/a) = s(1) = 0
41.
42. So s(1/a) = s(a), and this gives us a way to extend s() over the field of rationals.
43.
44. s(a^2) = s(a) XOR s(a), which must be zero because XOR is self inverting.
45.
46. So s() sends squares to zero, meaning that s() is not a one-to-one function, as s(a^2) = s(1) = 0 for all non-zero a.
47.
48. In particular, s(x) "ignores" square factors of x:
49.
50. s(a.b^2) = s(a) XOR s(b^2) = s(a) XOR 0 = s(a)
51.
52. Clearly:
53.
54. - prime factors of x which appear an even number of times are ignored.
55. - prime factors of x which appear an odd number of times, need only have appeared once.
56.
57. x s(x)
58. 0 undefined
59. 1 0
60. 2 s(2)
61. 3 s(3)
62. 4 0
63. 5 s(5)
64. 6 s(2) XOR s(3)
65. 7 s(7)
66. 8 [ s(2) XOR s(2) ] XOR s(2) = [ 0 ] XOR s(2) = s(2)
67. 9 0
68. 10 s(2) XOR s(5)
69. etc
70.
71. The most obvious way to realise this function is for the i'th bit of s(x) to count the number of times (modulo 2) that the i'th prime appears as a factor of x.
72.
73. ie,
74. s(2) = 1
75. s(3) = 2
76. s(5) = 4
77. s(7) = 8
78. s(11) = 16
79. s(13) = 32
80. s(17) = 64
81. s(i'th prime) = 2^i
82.
83. Thus, for composite x,
84. s(6) = s(2) XOR s(3) = 1 XOR 2 = 3
85. s(10) = s(2) XOR s(5) = 1 XOR 4 = 5
86. s(15) = s(3) XOR s(5) = 2 XOR 4 = 6
87. etc
88.
89. s(x) is clearly a surjection onto the codomain Y = (0,inf), as every integer in Y has a preimage.
90.
91. To see this, any integer y in Y can be represented as a sequence of bits, with each 1 bit corresponding to a prime. A preimage of y is the x equal to the product of these primes.
92.
93. Also: Because of the fundamental theorem of arithmetic (unique factorisation of x), and because XOR is an associative and commutative operation, there is only one way to arrive at s(composite x). s() is well-defined.
94.
95.
96.
97. -------------------------------
98.
100.
101. - The primes could appear in any order, not necessarily in the ascending order I have used.
102.
103. - Not all primes need to be considered. ie, s() could easily map some primes to zero, such that their presence in x is ignored just like squares are ignored, and without consequence. Mapping squares to zero is unavoidable, but further degeneracy is entirely optional.
104.
105. - A prime could be flagged in more than one bit position. ie, each prime corresponds to a 'bit pattern' rather than a single bit.
106.
107. - The bit patterns corresponding to different primes could overlap! This is not immediately obvious, but it is a simple consequence of XOR. Unlike addition, XOR doesn't entangle neighbouring bits with a cascade of overflows/carries - each bit position is effectively a silo. s() is essentially just a vector of binary flags, without an interesting algebra.
108.
109. - And finally, these bit patterns are actually arbitrary. But they should be an orthogonal set to avoid degeneracy.
110.
111. eg,
112. s(a) = 110
113. s(b) = 011
114. s(c) = 101
115.
116. Then s(abc) = s(a) XOR s(b) XOR s(c) = 000, because these three bit patterns form a degenerate set over XOR.
RAW Paste Data