construct a random Boolean function - Maple Help

Home : Support : Online Help : Programming : Logic : Boolean : Logic Package : Logic/Random

Logic[Random] - construct a random Boolean function

 Calling Sequence Random(alpha, opt)

Parameters

 alpha - list or set of symbols representing the alphabet opt - (optional) equation of the form form=fname, where fname is one of CNF, DNF, or MOD2.

Description

 • The Random command returns a random Boolean expression in a specific canonical form.  By default, disjunctive normal form is used. The Boolean expression returned is in normal form with respect to the symbols in alpha.

Examples

 > $\mathrm{with}\left(\mathrm{Logic}\right):$
 > $\mathrm{Random}\left(\left\{a,b\right\}\right)$
 ${a}{&and}{b}$ (1)
 > $\mathrm{Random}\left(\left[a,b,c\right],\mathrm{form}=\mathrm{DNF}\right)$
 $\left(\left(\left(\left(\left({a}{&and}{b}\right){&and}{c}{&or}\left({a}{&and}{b}\right){&and}{\mathrm{¬}}{}\left({c}\right)\right){&or}\left({a}{&and}{c}\right){&and}{\mathrm{¬}}{}\left({b}\right)\right){&or}\left({a}{&and}{\mathrm{¬}}{}\left({b}\right)\right){&and}{\mathrm{¬}}{}\left({c}\right)\right){&or}\left({b}{&and}{c}\right){&and}{\mathrm{¬}}{}\left({a}\right)\right){&or}\left({b}{&and}{\mathrm{¬}}{}\left({a}\right)\right){&and}{\mathrm{¬}}{}\left({c}\right)$ (2)
 > $\mathrm{Random}\left(\left[a,b\right],\mathrm{form}=\mathrm{CNF}\right)$
 ${b}{&or}{\mathrm{¬}}{}\left({a}\right)$ (3)
 > $\mathrm{Random}\left(\left\{a,b,c\right\},\mathrm{form}=\mathrm{MOD2}\right)$
 ${a}{}{b}{}{c}{+}{a}{}{c}{+}{b}{}{c}{+}{b}{+}{c}{+}{1}$ (4)