Artificial intelligent assistant

Mapping logical expressions to arithmetical expressions I wrote a program that is able to evaluate arithmetical expressions, like 1 + 3.0 * 4 / (1 - 1 * 3.2) What I want is to use the same program to evaluate logical expressions. For that, suppose $1$ means true and $0$ means false. For example, let's consider the logical operation AND 0 ^ 0 = 0 0 ^ 1 = 0 1 ^ 0 = 0 1 ^ 1 = 1 We could easily represent the AND operator using multiplication 0 * 0 = 0 0 * 1 = 0 1 * 0 = 0 1 * 1 = 1 My question is: given a logical expression (e.g.: $1 \lor \lnot1\land(0\rightarrow 1)$), is there a mapping to turn it into an arithmetical expression such that its evaluation would give the same value than the logical?

Yes, this is possible:

* NOT(A) = 1-A
* AND(A,B) = A*B = min(A,B)
* OR(A,B) = A+B-A*B = max(A,B)
* IMPLIES(A,B) = 1-A+A*B
* BIIMPLIES(A,B) = 1-|A-B|
* XOR(A,B) = |A-B|

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 5e9e86660fe19c5b4ccfa916bdea1c72