Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Something like this maybe?</p> <pre><code>string previous = string.Empty; while (b != previous) { previous = b; b = b.Replace("true and false", "false"); b = b.Replace("true and true", "true"); b = b.Replace("false and true", "false"); b = b.Replace("false and false", "false"); b = b.Replace("false or false", "false"); b = b.Replace("true or false", "true"); b = b.Replace("true or true", "true"); b = b.Replace("false or true", "true"); b = b.Replace("(false)", "false"); b = b.Replace("(true)", "true"); b = b.Replace("not false", "true"); b = b.Replace("not true", "false"); } </code></pre> <p>Note that the specification allows ambigious formulations, such as these:</p> <pre><code>"false and false or true" "false and true or true" </code></pre> <p>Both of these expressions are "true" if the <em>and</em> is evaluted first, and "false" if the <em>or</em> is evaluated first. Therefore, requireing parenthesis at every level would be better. Requiring left-to-right evaluation is another option, but that makes the code a bit more complex.</p> <p>For those of you who may object to this style of solution for this style of problem, remember that some mathematicians believe that all of mathematics may be reduced to this sort of symbol manipulation. It is <a href="http://en.wikipedia.org/wiki/Principia_Mathematica#The_logicistic_construction_of_the_theory_of_PM" rel="nofollow">said</a> that one of the main criticisms of Russell and Whitehead’s <em>Principia Mathematica</em> is that it embues the formulas with too much meaning.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload