Reversing a logical ( OR )
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
Maybe you should be more clear about what you are saying.
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
If you already have both original values in order to "undo" the OR, you've already effectively undone the OR. Or am I missing something? :doh: Pretty sure this is an equivalency too, not an undo. If it was an undo it would generate two values from a single OR'd value, or generate a value given an OR'd value and one of the original values.
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
To stay with binary logic operations, what your formula boils down to is (using C syntax) :
A | B = ( A ^ B ) | ( A & B )
That is not "undoing" the OR operation. That is a sequence of operations which arrive at the same result. To undo A | B = C you need to perform operations on C with B to give a result of A or operations on C with A that give B. I find it easier to do binary logic with hexadecimal numbers so with the first numbers,
100 = 0x64
5 = 0x05
0x64 | 0x05 = 0x65To undo the OR what you need is
0x65 ? 0x05 = 0x64
or
0x65 ? 0x64 = 0x05
I don't know what that expression would be and I can see why you were told it is impossible.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
albert_redditt wrote:
I was told that there's no way to undo an OR as it loses value in the output..
That is correct. Boolean algebra is implemented in programming languages but it still originates from that branch of mathematics. If you have a value '1' there is no way you will ever be able to tell which of the following statements it originated from.
1 | 1
1 | 0
0 | 1Because of that you cannot do that you cannot, in a programming language, recover the original values from a value that was created by oring other values together.
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
To reverse a OR operation, given on something like
A | B = C
solve for B knowing only A & C. For example:
6 | B = 7
Given that, B could be 1 or 3 or 5 or 7. Any of those would work in the equation, and there is no way to know which it was.
Truth, James
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
The formula is correct (though as mentioned it doesn't "undo" the OR, it computes the OR in terms of other operations) and I'll prove it algebraically, starting at the end and deriving that it must be equal to `v1 | or_val`. ```text ( v1 ^ or_val ) + ( v1 & or_val ) = (the left and right operands do not "intersect", their bitwise AND is zero, in that case A + B == A | B) ( v1 ^ or_val ) | ( v1 & or_val ) = (OR distributes over AND) (v1 ^ or_val | v1) & (v1 ^ or_val | or_val) = (A ^ B | B == A | B) (or_val | v1) & (v1 | or_val) = (A AND A == A) v1 | or_val ```
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
It uses the value you are trying to find to find the value you are trying to find. No point to it. E.g. for X OR 9 = 11, use it to find the value of X.
-
I was told that there's no way to undo an OR as it loses value in the output.. I fumbled upon a formula , to undo an OR v1 or or_val = ( v1 xor or_val ) + ( v1 and or_val ) 100 or 5 = ( (100 or 5) xor 5 ) + ( 100 and 5 ) 100 or 10 = ( (100 or 10) xor 10 ) + ( 100 and 10 ) 255 or 12 = ( (255 or 12) xor 12 ) + ( 255 and 12 )
I suspect the person telling you that meant there is no mathematical inverse to the OR operator - which means that the input of a function (or operator) must be reconstructable from the input to that function. In this sense, OR definitely has no inverse.
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
-
I suspect the person telling you that meant there is no mathematical inverse to the OR operator - which means that the input of a function (or operator) must be reconstructable from the input to that function. In this sense, OR definitely has no inverse.
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
Rob Grainger wrote:
the input of a function (or operator) must be reconstructable from the input to that function
That's trivial. It's reconstructing it from the output that's difficult. ;P
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
If you already have both original values in order to "undo" the OR, you've already effectively undone the OR. Or am I missing something? :doh: Pretty sure this is an equivalency too, not an undo. If it was an undo it would generate two values from a single OR'd value, or generate a value given an OR'd value and one of the original values.
But, what's the utility of using this type of syntax to "exec-undo" "dual-values"? :confused: