BIT predicate
In mathematics and computer science, the BIT predicate, sometimes written BIT(i, j), is a predicate that tests whether the jth bit of the number i (starting from the least significant digit) is 1, when i is written in binary.
History
The BIT predicate was first introduced in 1937 by Wilhelm Ackermann to define the Ackermann coding, which encodes hereditarily finite sets as natural numbers. The BIT predicate can be used to perform membership tests for the encoded sets.[1][2]
Description
In mathematical notation, the BIT predicate can be described as
where is the floor function and mod is the modulo function.
The BIT predicate is primitive recursive.[3]
Implementation
In programming languages such as C, C++, Java, or Python that provide a right shift operator >>
and a bitwise Boolean and operator &
, the BIT predicate BIT(i, j) can be implemented by the expression
(i>>j)&1
. Here the bits of i are numbered from the low-order bits to high-order bits in the binary representation of i, with the ones bit being numbered as bit 0. The subexpression i>>j
shifts these bits so that bit j is shifted to position 0, and the subexpression &1
masks off the remaining bits, leaving only the bit in position 0. The value of the expression is 1 or 0, respectively as the value of BIT(i, j) is false or true.[4]
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 position 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 all 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 BIT returns a nonzero value when is a member and zero when it is not.
The same technique may be used to encode subsets of any sequence of distinct values, using powers of two whose exponents are the positions of the elements in this sequence, rather than their values. Ackermann's encoding of the hereditarily finite sets is an example of this technique, for the recursively-generated sequence of hereditarily finite sets.
Applications
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 number i, wishes to determine the result of a BIT predicate BIT(i, j) without divulging the value of j to the servers. Chor et al. (1998) describe a method for replicating i 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 of i.[5]
Mathematical 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 + BIT resulting from adding the BIT predicate to FO results in a more robust complexity class.[6] The class FO + BIT, of first-order logic with the BIT predicate, is the same as the class FO + PLUS + TIMES, of first-order logic with addition and multiplication predicates.[7]
Construction of the Rado graph

Ackermann in 1937 and Richard Rado in 1964 used this predicate to construct the infinite Rado graph. In their construction, the vertices of this graph correspond to the non-negative integers, written in binary, and there is an undirected edge from vertex i to vertex j, for i < j, when BIT(j,i) is nonzero.[8]
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.
References
- Ackermann, Wilhelm (1937). "Die Widerspruchsfreiheit der allgemeinen Mengenlehre". Mathematische Annalen. 114: 305–315. doi:10.1007/bf01594179. S2CID 120576556. Retrieved 2012-01-09.
- Kirby, Laurence (2009). "Finitary Set Theory". Notre Dame Journal of Formal Logic. 50 (3): 227–244. doi:10.1215/00294527-2009-009.
- Rautenberg, Wolfgang (2010). A Concise Introduction to Mathematical Logic (3rd ed.). New York: Springer Science+Business Media. p. 261. doi:10.1007/978-1-4419-1221-3. ISBN 978-1-4419-1220-6.
- Venugopal, K. R. (1997). Mastering C++. Muhammadali Shaduli. p. 123. ISBN 9780074634547..
- Chor, Benny; Kushilevitz, Eyal; Goldreich, Oded; Sudan, Madhu (1998). "Private information retrieval". Journal of the ACM. 45 (6): 965–981. doi:10.1145/293347.293350. S2CID 544823..
- Immerman, Neil (1999). Descriptive Complexity. New York: Springer-Verlag. ISBN 0-387-98600-6.
- Immerman (1999, pp. 14–16)
- Rado, Richard (1964). "Universal graphs and universal functions" (PDF). Acta Arith. 9 (4): 331–340. doi:10.4064/aa-9-4-331-340..