Parity - Maple Help

Logic

 Parity
 return parity function

 Calling Sequence Parity(e1,e2,...,en)

Parameters

 e1,e2,en - names, functions, or logical expressions

Description

 • The Parity command returns the Boolean expression corresponding to the parity function on a set of variables: that is, the function which is true if and only if an odd number of inputs are true.
 • The parity function is symmetric in its inputs: the order of true or false values is unimportant, only the number of true inputs.

Examples

 > $\mathrm{with}\left(\mathrm{Logic}\right):$
 > $\mathrm{Parity}\left(\mathrm{true},\mathrm{false},\mathrm{true}\right)$
 ${\mathrm{false}}$ (1)

Illustrate the simplification of repeated inputs.

 > $\mathrm{Logic}:-\mathrm{Parity}\left(\mathrm{}\left(x,m\right),\mathrm{}\left(y,n\right),x\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}m::\mathrm{even},n::\mathrm{odd}$
 ${\mathrm{Parity}}{}\left({x}{,}{y}\right)$ (2)

Illustrate the difference in expression size between the parity function and its three different output forms (see Convert).

 > $p≔\mathrm{Parity}\left(x,y,z,w\right)$
 ${p}{≔}{\mathrm{Parity}}{}\left({w}{,}{x}{,}{y}{,}{z}\right)$ (3)
 > $\mathrm{length}\left(\mathrm{Convert}\left(p,\mathrm{form}=\mathrm{CNF}\right)\right)$
 ${280}$ (4)
 > $\mathrm{length}\left(\mathrm{Convert}\left(p,\mathrm{form}=\mathrm{DNF}\right)\right)$
 ${287}$ (5)

Compatibility

 • The Logic[Parity] command was introduced in Maple 2017.