Documentation

CslibFrontier.Computability.QueryComplexity.AdjacentPair.Local

A block containing exactly two adjacent true bits #

adjacentPair n accepts exactly the words whose two true positions are consecutive in the linear order on Fin n. Overlapping choices are allowed: the middle pair of a four-bit word is accepted. This is the local predicate in [AB07], Chapter 11 Exercise 2, printed page 218 / PDF page 234. The global exercise takes an OR over disjoint blocks.

Main definitions #

Main results #

Exactly two positions are true, and they are adjacent without wraparound. The body is exposed so finite checked examples can evaluate the predicate.

theorem Cslib.BitString.adjacentPair_eq_true_iff {n : ℕ} {x : BitString n} :
adjacentPair n x = true ↔ ∃ (a : Fin n) (b : Fin n), ↑b = ↑a + 1 ∧ ∀ (i : Fin n), x i = decide (i = a ∨ i = b)

Accepted words are precisely the indicators of adjacent pairs.

An adjacent pair has two distinct endpoints, hence exactly two true bits.

@[simp]

The all-false word is not an adjacent pair, including lengths zero and one.

@[simp]
theorem Cslib.BitString.adjacentPair_singleton {n : ℕ} (a : Fin n) :
(adjacentPair n fun (i : Fin n) => decide (i = a)) = false

One true bit does not meet the two-bit acceptance condition.

theorem Cslib.BitString.adjacentPair_pair {n : ℕ} (a b : Fin n) (hab : ↑b = ↑a + 1) :
(adjacentPair n fun (i : Fin n) => decide (i = a ∨ i = b)) = true

Every pair of consecutive positions gives an accepted input.

Flipping one bit into an accepted word starts at weight one or weight three.

Changing any single bit of an accepted pair destroys acceptance.

Every coordinate is sensitive at an accepted adjacent pair.

At a rejected word, at most three single-bit changes can create an adjacent pair. A change into weight two starts at weight one or three. In the former case only the two neighbors of the sole true bit can work; in the latter only its three true bits can work.