251 points · by orlp · 3y ago · 72 comments
The next step would be to use these properties to write a compiler to run normal source code as floating point integers, maybe with some kind of FFI to call regular OS APIs.
- Using IEEE floating-point error for ML transfer functions http://tom7.org/grad/
- Using IEEE NaN and infinity to build logic gates and a whole CPU http://tom7.org/nand/
This is a proof by construction that the Intel MMU's fault handling mechanism is Turing complete. We have constructed an assembler that translates 'Move, Branch if Zero, Decrement' instructions to C source that sets up various processor control tables. After this code has executed, the CPU computes by attempting to fault without ever executing a single instruction. Optionally, the assembler can also generate X86 instructions that will display variables in the VGA frame buffer and will cause control to be transferred between the native (display) instructions and 'weird machine' trap instructions.
The mov trick is akin to OISC, the "one instruction set computer". Here instead it's building logic circuits.
That implements conversion from an IEEE-754 double to a pair of two such doubles whose values are integers of the low and high 32 bits of the bitwise representation of the argument double, implemented only with double add/sub/mul.
The point of the article was more to illustrate that using nothing but signed zeros and floating point subtraction you can simulate arbitrary circuits, and 'functionally complete' was the most concise term for that I could think of, even if it is bending the rules a little bit when strictly looking at the truth table.
When you're reducing formulas, those are the same thing.
p 🡑 p ≡ ¬p
p 🡑 ¬p ≡ 1
¬1 ≡ 0
So then you're happy to say (p 🡑 (p 🡑 p)) 🡑 (p 🡑 (p 🡑 p)) ≡ (p 🡑 ¬p) 🡑 (p 🡑 ¬p)
≡ 1 🡑 1
≡ 0
The expression "(p 🡑 (p 🡑 p)) 🡑 (p 🡑 (p 🡑 p))" is just a particularly longwinded name for the constant "0".I don't see why you're comparing {NAND, FALSE} to {AND, NOT} - how do you produce TRUE from {AND, NOT} by a standard that {NAND} by itself doesn't also meet? The normal way to produce TRUE from {AND, NOT} is
NOT (p AND (NOT p))
but you seem to have already rejected that? listen 80;
listen [::]:80;
I'm by no means a networking expert, so I'm a bit puzzled. I'll investigate more in a couple of days, not particularly excited to mess with the system while serving a post on the front page.(I disagree with their claim that the subtractive bit is functionally complete on its own - you're right, since it's truth-preserving, it clearly is not functionally complete)
> It turns out this truth table is functionally complete [1]
yet the linked Wikipedia article clearly states that
> every two-element set of connectives containing NOT and one of { AND, OR, IMPLY } is a minimal functionally complete subset of { NOT, AND, OR, IMPLY, IFF }. I.e. IMPLY by itself is not functionally complete.
Turing complete is often misused to say functionally complete, either because people mistake the two or because it makes for a more appealing blog post / article:
- mov is in fact not turing complete: it needs a jmp instruction (https://harrisonwl.github.io/assets/courses/malware/spring20...)
- homomorphic encryption systems are functionally complete but not Turing complete (since looping leaks the number of operations done, break the encryption)
[0] https://github.com/xoreaxeaxeax/movfuscator/blob/90a49f31219...
That's too pedantic. A machine that has enough memory to make it indistinguishable from an infinite tape should be good enough.
> or time.
I don't think infinite time is part of the definition? If it can go step by step indefinitely, that's fine.
> You can bulid a turing-complete machine out of NAND-gates, but to say that a NAND-game is turing-complete is like saying that you can live in a brick. You can't, but you can bulid a house out of bricks and live in that.
fn adder(a: Bit, b: Bit, c: Bit) -> (Bit, Bit) {
let r0 = c - b;
let r1 = c - r0;
let r2 = ZERO - r0;
let r3 = b - r1;
let r4 = r2 - r3;
let r5 = a - r4;
let r6 = r4 - a;
let r7 = ZERO - r5;
let r8 = r7 - r1;
let r9 = r7 - r6;
let r10 = ZERO - r8;
(r9, r10)
}so basically any attempt to use JavaScript 's number as int
This is trivially wrong, or mixing two different meanings of "signs".
Given variables x and y with values 5 and 10, ie both having the same positive sign, x-y will produce a result -5, that has negative sign.
Even if we assume that the sign of the y variable is actually inverted, it's still trivial by choosing say -3 and -6, the latter which has now inverted to 6, and the result is +3, which has different sign than x.
If x and y both have a positive sign the condition "for x−y that means if x and y have different signs" is not met.
With -3 and -6, again, x and y both have the same sign and the condition is not met for subtraction.
If we assume sign of y inverts because of the operation, then direct your attention to the second line "However, for x−y that means if x and y have different signs the output must have the sign of x" x=-3 y=-6=>6 these now have different sign, so result should have sign of x, but z=x+y=3, which again has different sign from x.
The first sentence is referring to addition, with addends, not subtraction. x - y is not an addition, it is a subtraction, so the first sentence does not directly apply. It does apply however if you treat x - y as the sum x + (-y), which the second sentence clarifies.
In other words, the first sentence applies directly to additions, and applies to subtractions if you flip the sign of the second argument. The second sentence applies to subtractions directly without any sign flips, but obviously does not apply to additions.
> If we assume sign of y inverts because of the operation, then direct your attention to the second line "However, for x−y that means if x and y have different signs the output must have the sign of x"
> x=-3 y=-6=>6 these now have different sign, so result should have sign of x, but z=x+y=3, which again has different sign from x.
No, x=-3 and y=-6 both have the same sign, they're both negative.
This is absolutely not true, as already shown. x=5 y=10 z=x-y=-5, which has different sign from x.
If we assume sign of y inverts because of the operation, then direct your attention to the second line "However, for x−y that means if x and y have different signs the output must have the sign of x" x=-3 y=-6=>6 these now have different sign, so result should have sign of x, but z=x+y=3, which again has different sign from x.