Ask Your Question

Revision history [back]

Optimization of boolean evaluation

In a code like

if (P_1 or P_2 or ... or P_n):


if (Q_1 and Q_2 and ... and Q_n):

if only one P_i is true, or only one Q_i is false,then the boolean evaluation of the whole propositions (P_1 or P_2 or ... or P_n), (Q_1 and Q_2 and ... and Q_n) are determined.
So in a goal of optimization, the program could stop to evaluate the P_i from the first true.

Does SAGE stop to evaluate like that ? (if no, is there a way to do that ?)