Evaluating atomic formulas.

Take any string S representing some atomic formula. We want to compute the truth value of S, or decide that S is an open formula without a fixed truth value. We first replace round brackets by square brackets, because Mathematica notation requires square brackets. We replace <=, >=, ==,!= with the special symbols ≤, ≥, ==,≠. These special symbols are considered, in Mathematica,  different from <=, >=, ==,!=, as we check below:

In[91]:=

"<=" == "≤" ">=" == "≥" ""  "=="  "!=" == "≠"

Out[91]=

False

Out[92]=

False

Out[93]=

False

Out[94]=

False

Then every = not occurring in some <=, >=, = =, != in S is replaced by the special symbol ==.

In[95]:=

SquareBrackets[S__String] := StringReplace[S,  {"("    ... bsp;         ""}] ;

Eventually we can evaluate S, or decide it has no fixed truth value, using ternary ``if'' of Mathematica. If S is neither true nor false, we say that the truth value of S is open.

In[96]:=

TruthValue[S_String] := If[ToExpression[SquareBrackets[S]], "true", "false", "open"] ;

Some examples.

In[97]:=

f[x_] := x * x ; (* we define f (x) = x * x *)

In[98]:=

TruthValue["f(3)<=f(5)"]

Out[98]=

true

In[99]:=

TruthValue["f(3)>f(5)"]

Out[99]=

false

In[100]:=

TruthValue["f(3)>f(x)"]

Out[100]=

open

Mathematica can recognize some simple algebraic identities, like x^2 = (-x)^2. Do not rely too much on it.

In[101]:=

TruthValue["f(x) = f(-x)"]

Out[101]=

true

In[102]:=

TruthValue["f(x) == f(-x)"]

Out[102]=

true


Created by Mathematica  (October 17, 2006)