formula holding a logical formula. Evaluate it and return True or False.
A formula is built as follows:
- t is true and f is false;
- !(x) is the negation of the formula x;
- &(x1,x2,...,xk) is the logical AND of the formulas x1, ..., xk, where k ≥ 1;
- |(x1,x2,...,xk) is the logical OR of the formulas x1, ..., xk, where k ≥ 1.
Arguments are separated by commas with no spaces. The formula is always well formed.formula="&(t,!(f),|(f,t))" → True
!(f) is true and |(f,t) is true, so the AND of three true values is true.
formula="|(f,&(t,f),!(t))" → False
&(t,f) is false and !(t) is false, so the OR of three false values is false.
formula="!(!(f))" → False
formula contains only the characters (, ), &, |, !, t, f and ,formula="&(t,!(f),|(f,t))"
True
Run checks the first 3 tests in your browser. Submit checks all 129 tests on the server, hidden ones included.