1 ! Copyright (C) 2018 Alexander Ilin.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays help.markup help.syntax kernel ;
8 ARTICLE: "boolean-expr" "Boolean expressions"
9 "The " { $vocab-link "boolean-expr" } " vocab demonstrates the use of Unicode symbols in source files and multi-method dispatch."
17 { $description "Convert the " { $snippet "expr" } " to Disjunctive Normal Form (DNF), i.e. an array of subexpressions, each not containing disjunctions. See " { $url "https://en.wikipedia.org/wiki/Disjunctive_normal_form" } "." }
19 { $example "USING: boolean-expr prettyprint ;"
23 { $example "USING: boolean-expr prettyprint ;"
25 "{ { X } { Y } { Z } }"
33 { $description "Print the expression followed by newline." }
35 { $example "USING: boolean-expr ;"
37 "((X ⋀ (¬X ⋀ Y)) ⋁ (Y ⋀ (¬X ⋀ Y)))"
45 { $description "Print the expression." }
47 { $example "USING: boolean-expr ;"
49 "((X ⋀ (¬X ⋀ Y)) ⋁ (Y ⋀ (¬X ⋀ Y)))"
53 { expr. op. } related-words
60 { $description "Return " { $link t } " if the " { $snippet "expr" } " can be true." }
62 { $example "USING: boolean-expr prettyprint ;"
66 { $example "USING: boolean-expr prettyprint ;"
70 { $example "USING: boolean-expr prettyprint ;"
71 "X X ¬ ⋀ satisfiable? ."
74 { $example "USING: boolean-expr prettyprint ;"
75 "X Y ⋁ X ¬ Y ¬ ⋀ ⋀ satisfiable? ."
78 { $example "USING: boolean-expr prettyprint ;"
79 "X Y ⋁ X ¬ Y ⋀ ⋀ satisfiable? ."
85 { $class-description "Logical negation (NOT)." $nl
86 { $snippet "¬(¬A) " { $link ≣ } " A" } "."
94 { $description "Material implication (if..then)." $nl
95 { $snippet "x→y" } " " { $link ≣ } " " { $link ¬ } "x" { $link ⋁ } "y"
103 { $description "Material equivalence (if and only if)." $nl
104 { $snippet "(x≣y) ≣ ((x" } { $link ⋀ } { $snippet "y) " }
105 { $link ⋁ } { $snippet " (" } { $link ¬ } { $snippet "x" } { $link ⋀ } { $link ¬ } { $snippet "y))" }
113 { $description "Exclusive disjunction (XOR)." } ;
116 { $class-description "Logical tautology. This statement is unconditionally true." } ;
119 { $class-description "Logical contradiction. This statement is unconditionally false." } ;
122 { $class-description "Logical conjunction (AND)." } ;
125 { $class-description "Logical disjunction (OR)." } ;
128 { $class-description "A union class of all classes defined in this vocab. In methods signatures it stands for \"any variable or expression\"." } ;