BIT predicate

From Wikipedia, the free encyclopedia

In mathematics and computer science, the BIT predicate, sometimes written , is a predicate that tests whether the th bit of the number (starting from the least significant bit) is 1, 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.

The BIT predicate was first introduced in 1937 by Wilhelm Ackermann to define the Ackermann coding, which encodes hereditarily finite sets as natural numbers.[1][2] The BIT predicate can be used to perform membership tests for the encoded sets: is true if and only if the set encoded by is a member of the set encoded by .[1]

Ackermann denoted the predicate as , using a Fraktur font to distinguish it from the notation that he used for set membership (short for " is an element of " in German).[1] The notation , 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 1990s.[a]

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.[6] The BIT predicate is a primitive recursive function.[2][7] 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.[b]

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 can be implemented by the expression (i>>j)&1. The subexpression i>>j shifts the bits in the binary representation of so that bit is shifted to position 0, and the subexpression &1 masks off the remaining bits, leaving only the bit in position 0. As with the modular arithmetic formula above, the value of the expression is 1 or 0, respectively as the value of is true or false.[9]

Applications

Notes

References

Related Articles

Wikiwand AI