Read-once function
# Read-once function

In mathematics, a read-once function is a special type of Boolean function that can be described by a Boolean expression in which each variable appears only once.

More precisely, the expression is required to use only the operations of logical conjunction, logical disjunction, and negation. By applying De Morgan's laws, such an expression can be transformed into one in which negation is used only on individual variables (still with each variable appearing only once). By replacing each negated variable with a new positive variable representing its negation, such a function can be transformed into an equivalent positive read-once Boolean function, represented by a read-once expression without negations.

## Examples

For example, for three variables a, b, and c, the expressions

    $a\wedge b\wedge c$
    $a\wedge (b\vee c)$
    $(a\wedge b)\vee c$, and
    $a\vee b\vee c$

are all read-once (as are the other functions obtained by permuting the variables in these expressions). However, the Boolean median operation, given by the expression

    $(a\vee b)\wedge (a\vee c)\wedge (b\vee c)$

is not read-once: this formula has more than one copy of each variable, and there is no equivalent formula that uses each variable only once.

## Characterization

The disjunctive normal form of a (positive) read-once function is not generally itself read-once. Nevertheless, it carries important information about the function. In particular, if one forms a co-occurrence graph in which the vertices represent variables, and edges connect pairs of variables that both occur in the same clause of the conjunctive normal form, then the co-occurrence graph of a read-once function is necessarily a cograph. More precisely, a positive Boolean function is read-once if and only if its co-occurrence graph is a cograph, and in addition every maximal clique of the co-occurrence graph forms one of the conjunctions (prime implicants) of the disjunctive normal form. That is, when interpreted as a function on sets of vertices of its co-occurrence graph, a read-once function is true for sets of vertices that contain a maximal clique, and false otherwise. For instance the median function has the same co-occurrence graph as the conjunction of three variables, a triangle graph, but the three-vertex complete subgraph of this graph (the whole graph) forms a subset of a clause only for the conjunction and not for the median. Two variables of a positive read-once expression are adjacent in the co-occurrence graph if and only if their lowest common ancestor in the expression is a conjunction, so the expression tree can be interpreted as a cotree for the corresponding cograph.

Another alternative characterization of positive read-once functions combines their disjunctive and conjunctive normal form. A positive function of a given system of variables, that uses all of its variables, is read-once if and only if every prime implicant of the disjunctive normal form and every clause of the conjunctive normal form have exactly one variable in common.

## Recognition

It is possible to recognize read-once functions from their disjunctive normal form expressions in polynomial time. It is also possible to find a read-once expression for a positive read-once function, given access to the function only through a "black box" that allows its evaluation at any truth assignment, using only a quadratic number of function evaluations.

