BIT predicate
Template:Good article Template:Short description In mathematics and computer science, the BIT predicate, sometimes Template:Nowrap is a predicate that tests whether the Template:Nowrap bit of the Template:Nowrap (starting from the least significant digit) Template:Nowrap when is written as a binary number. Its mathematical applications include modeling the membership relation of hereditarily finite sets, and defining the adjacency relation of the Rado graph. In computer science, it is used for efficient representations of set data structures using bit vectors, in defining the private information retrieval problem from communication complexity, and in descriptive complexity theory to formulate logical descriptions of complexity classes.
History
The BIT predicate was first introduced in 1937 by Wilhelm Ackermann to define the Ackermann coding, which encodes hereditarily finite sets as Template:Nowrap The BIT predicate can be used to perform membership tests for the encoded sets: is true if and only if the set encoded Template:Nowrap is a member of the set encoded Template:Nowrap
Ackermann denoted the predicate Template:Nowrap using a Fraktur font to distinguish it from the notation that he used for set membership (short for Template:Nowrap an element Template:Nowrap in German).Template:R The notation Template:Nowrap and the name "the BIT predicate", come from the work of Ronald Fagin and Neil Immerman, who applied this predicate in computational complexity theory as a way to encode and decode information in the late 1980s and early Template:Nowrap
Description and implementation
The binary representation of a number is an expression for as a sum of distinct powers of two, where each bit in this expression is either 0 or 1. It is commonly written in binary notation as just the sequence of these bits, . Given this expansion for , the BIT predicate is defined to equal . It can be calculated from the formula where is the floor function and mod is the modulo function.Template:R The BIT predicate is a primitive recursive function.Template:R As a binary relation (producing true and false values rather than 1 and 0 respectively), the BIT predicate is asymmetric: there do not exist two numbers and for which both and are true.Template:Efn
In programming languages such as C, C++, Java, or Python that provide a Template:Nowrap and a Template:Nowrap the BIT predicate can be implemented by the expression
(i>>j)&1. The subexpression i>>j shifts the bits in the binary representation of so that Template:Nowrap is shifted to Template:Nowrap and the Template:Nowrap masks off the remaining bits, leaving only the bit in Template:Nowrap As with the modular arithmetic formula above, the value of the expression is Template:Nowrap respectively as the value of is true or false.Template:R
Applications
Set data structures
For a set represented as a bit array, the BIT predicate can be used to test set membership. For instance, subsets of the non-negative integers may be represented by a bit array with a one in Template:Nowrap when is a member of the subset, and a zero in that position when it is not a member. When such a bit array is interpreted as a binary number, the set for distinct is represented as the binary number . If is a set, represented in this way, and is a number that may or may not be an element of , then returns a nonzero value when is a member and zero when it is not.Template:Efn
The same technique may be used to test membership in subsets of any sequence of distinct values, encoded using powers of two whose exponents are the positions of the elements in this sequence, rather than their values. For instance, in the Java collections framework, java.util.EnumSet uses this technique to implement a set data structure for enumerated types.Template:R Ackermann's encoding of the hereditarily finite sets is an example of this technique, for the recursively-generated sequence of hereditarily finite sets.Template:Efn
Private information retrieval
In the mathematical study of computer security, the private information retrieval problem can be modeled as one in which a client, communicating with a collection of servers that store a binary Template:Nowrap wishes to determine the result of a BIT predicate without divulging the value Template:Nowrap to the servers. Template:Harvtxt describe a method for replicating across two servers in such a way that the client can solve the private information retrieval problem using a substantially smaller amount of communication than would be necessary to recover the complete value Template:Nowrap
Complexity and logic
The BIT predicate is often examined in the context of first-order logic, where systems of logic result from adding the BIT predicate to first-order logic. In descriptive complexity, the complexity class FO describes the class of formal languages that can be described by a formula in first-order logic with a comparison operation on totally ordered variables (interpreted as the indexes of characters in a string) and with predicates that test whether this string has a given character at a given numerical index. A formula in this logic defines a language consisting of its finite models.Template:Efn However, with these operations, only a very restricted class of languages, the star-free regular languages, can be described.Template:R Adding the BIT predicate to the repertoire of operations used in these logical formulas results in a more robust complexity class, Template:Nowrap, meaning that it is less sensitive to minor variations in its definition.Template:Efn
The class Template:Nowrap is the same as the class Template:Nowrap, of first-order logic with addition and multiplication predicates.Template:R It is also the same as the circuit complexity class DLOGTIME-uniform AC0. Here, AC0 describes the problems that can be computed by circuits of AND gates and OR gates with polynomial size, bounded height, and unbounded fanout. "Uniform" means that the circuits of all problem sizes must be described by a single algorithm. More specifically, it must be possible to index the gates of each circuit by numbers in such a way that the type of each gate and the adjacency between any two gates can be computed by a deterministic algorithm whose time is logarithmic in the size of the circuit (DLOGTIME).Template:R
Construction of the Rado graph

In 1964, German–British mathematician Richard Rado used the BIT predicate to construct the infinite Rado graph. Rado's construction is just the symmetrization of Ackermann's 1937 construction of the hereditary finite sets from the BIT predicate: two vertices numbered and are adjacent in the Rado graph when either or is nonzero.Template:R
The resulting graph has many important properties: it contains every finite undirected graph as an induced subgraph, and any isomorphism of its induced subgraphs can be extended to a symmetry of the whole graph.Template:R