Documentation

CslibFrontier.Computability.MCSP.Magnification.MergeTree

The oracle of the McKay–Murray–Williams merge tree #

McKay, Murray and Williams decide MCSP[s] on N = 2 ^ n-bit truth tables with a merge tree over the subcubes of {0, 1} ^ n [McKayMurrayWilliams2019, Lemma 3.1]. The [MMW19] bullet of [ChenHiraharaOliveiraPichRajgopalSanthanam2020, Appendix A.2, Proposition 63] states the resulting oracle circuits: MCSP[s] ∈ [O(N/poly(s)), poly(s), O(n/log s)]–Circuit[N/poly(s)], from a tree whose nodes merge many children at once and whose leaves read poly(s) table bits. This module fixes one oracle for such trees and proves what its queries answer. The circuits are built on top.

The state of a subcube p (Cslib.MCSP.subcubeState) is its validity bit and least size-s certificate. If L encodes CircuitMinMergeLanguage, then Cslib.MCSP.mergeVec L merges the states of p ++ [false] and p ++ [true] into that of p (Cslib.MCSP.mergeVec_eq_subcubeState). Iterating it k times (Cslib.MCSP.iterMergeVec) merges the 2 ^ k states of the subcubes p ++ e, e ∈ {0, 1} ^ k, into the state of p (Cslib.MCSP.iterMergeVec_eq_subcubeState), by induction on k from the binary step. At a point, the state depends only on the value of the function there (Cslib.MCSP.subcubeState_eq_pointState).

A query (Cslib.MCSP.MergeTree.Query) carries n, s, the prefix p, the number k of merge levels, a leaf flag, the requested bit j as a unary field, and a payload: the 2 ^ k child states for an inner node, or the 2 ^ k table bits at the points p ++ e for a leaf. Its answer is bit j of the k-fold merge of its children. The oracle Cslib.MCSP.MergeTree.oracle is the set of encodings of the queries answering yes. It is one language for every n and s, which the header carries. A node query built from correct child states (Cslib.MCSP.MergeTree.encQuery_ofNode_mem_oracle_iff_merge) or from table bits (Cslib.MCSP.MergeTree.encQuery_ofNode_mem_oracle_iff_leaf) answers bit j of the state of p. At the root, bit 0 is the answer of MCSP[s] (Cslib.GapMCSP.yesSet s, the yes set alone, with no gap). For a node query with j < stateWidth n s, the header length does not depend on j or on the payload (Cslib.MCSP.MergeTree.length_encQuery_ofNode).

Relation to the source. CHOPRS Definition 62 allows any oracle language, and CHOPRS do not bound its uniform complexity ("for our discussion, this is not going to be relevant"); neither does this module. The oracle is derived from CircuitMinMergeLanguage, the binary Circuit-Min-Merge language of Cslib.MCSP.circuitMinMergeLanguage_mem_PPolyOn: k levels of its merge step, plus leaf queries on 2 ^ k table bits. Querying CircuitMinMergeLanguage itself gives only the binary-tree parameters: each oracle gate answers one bit, so each of the N - 1 binary merges takes stateWidth n s oracle gates, for ≈ N · poly(n, s) oracle gates of fan-in poly(n, s) and adaptivity n.

Main definitions #

Main results #

References #

Iterated merges #

The encodings of CircuitMinMergeLanguage under encMerge.

mergeLanguage encodes CircuitMinMergeLanguage; mergeVec_eq_subcubeState takes the reverse direction.

noncomputable def Cslib.MCSP.iterMergeVec (L : Language Bool) (n s : ℕ) (p : List Bool) (k : ℕ) :

k levels of the merge step mergeVec L: merges the 2 ^ k states y e of the subcubes p ++ e, e ∈ {0, 1} ^ k, into one state, splitting on the first bit of e.

theorem Cslib.MCSP.iterMergeVec_eq_subcubeState {L : Language Bool} (hL : ∀ (a : MergeInput), a ∈ CircuitMinMergeLanguage ↔ encMerge a ∈ L) {n s : ℕ} (f : BooleanFunction n) {p : List Bool} {k : ℕ} (hpk : p.length + k ≤ n) {y : BitString k → BitString (stateWidth n s)} (hy : ∀ (e : BitString k), y e = subcubeState n s f (p ++ List.ofFn e)) :
iterMergeVec L n s p k y = subcubeState n s f p

k merge levels. If L encodes CircuitMinMergeLanguage and y e is the state of the subcube p ++ e for every e ∈ {0, 1} ^ k, where p ++ e has at most n bits, then iterMergeVec L n s p k y is the state of p.

noncomputable def Cslib.MCSP.pointState (n s : ℕ) (p : List Bool) (b : Bool) :

The state of the subcube p for the constant function b. At a point p, it is the state of every function with value b there (Cslib.MCSP.subcubeState_eq_pointState).

theorem Cslib.MCSP.subcubeState_eq_pointState {n s : ℕ} (f : BooleanFunction n) {p : List Bool} (hp : p.length = n) :
subcubeState n s f p = pointState n s p (f (BitString.ofList n p))

The state of a point p is the point state of the value of f at p.

Queries and the oracle #

A query to the merge-tree oracle: bit j of the levels-fold merge (Cslib.MCSP.iterMergeVec) of the 2 ^ levels children of the subcube subcube, for arity arity and size bound size.

  • arity : ℕ

    The arity n of the truth table.

  • size : ℕ

    The size bound s.

  • subcube : List Bool

    The prefix p of the node's subcube.

  • levels : ℕ

    The number k of merge levels; the node has 2 ^ k children.

  • leaf : Bool

    Whether the children are points read from table bits (true) or subcubes whose states the payload holds (false).

  • bitField : List Bool

    The requested bit j, as the number of true bits of a unary field.

  • payload : List Bool

    The children, in the order of BitString.equivFin: one table bit each for a leaf, and otherwise a block of stateWidth arity size bits each.

theorem Cslib.MCSP.MergeTree.encQuery_size_polyTime {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Query} :
theorem Cslib.MCSP.MergeTree.encQuery_leaf_polyTime {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Query} :
theorem Cslib.MCSP.MergeTree.encQuery_leaf_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query} :
theorem Cslib.MCSP.MergeTree.encQuery_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 x1 T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 x3 T3 S3 : γ → ℕ} {x4 : γ → Bool} {T4 S4 : γ → ℕ} {x5 : γ → List Bool} {T5 S5 : γ → ℕ} {x6 : γ → List Bool} {T6 S6 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encUnary T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encUnary T3 S3) (h4 : Turing.MultiTapeTM.ComputableInO x4 encIn Turing.MultiTapeTM.encBool T4 S4) (h5 : Turing.MultiTapeTM.ComputableInO x5 encIn Turing.MultiTapeTM.encBits T5 S5) (h6 : Turing.MultiTapeTM.ComputableInO x6 encIn Turing.MultiTapeTM.encBits T6 S6) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { arity := x0 x, size := x1 x, subcube := x2 x, levels := x3 x, leaf := x4 x, bitField := x5 x, payload := x6 x }) encIn encQuery (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + (T4 x + (T5 x + T6 x)))))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + (S4 x + (S5 x + S6 x)))))

Unary parameters, raw prefix, leaf flag, raw bit field, then the payload: arity, size and levels in unary, subcube, bitField and payload as raw bits, and every field but the payload framed.

theorem Cslib.MCSP.MergeTree.encQuery_arity_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query} :
theorem Cslib.MCSP.MergeTree.encQuery_size_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query} :
theorem Cslib.MCSP.MergeTree.encQuery_mk_deg :
Turing.MultiTapeTM.ComputableInDegree (fun (p : ℕ × ℕ × List Bool × ℕ × Bool × List Bool × List Bool) => { arity := p.1, size := p.2.1, subcube := p.2.2.1, levels := p.2.2.2.1, leaf := p.2.2.2.2.1, bitField := p.2.2.2.2.2.1, payload := p.2.2.2.2.2.2 }) encQueryFields encQuery 1 1
theorem Cslib.MCSP.MergeTree.encQuery_bitField_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query} :
theorem Cslib.MCSP.MergeTree.encQuery_subcube_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query} :
@[reducible, inline]

The tuple of the fields of encQuery.

theorem Cslib.MCSP.MergeTree.encQuery_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget x0 x1 : γ → ℕ} {x2 : γ → List Bool} {x3 : γ → ℕ} {x4 : γ → Bool} {x5 x6 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encUnary budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encUnary budget) (h4 : Turing.MultiTapeTM.ComputableInSpace x4 encIn Turing.MultiTapeTM.encBool budget) (h5 : Turing.MultiTapeTM.ComputableInSpace x5 encIn Turing.MultiTapeTM.encBits budget) (h6 : Turing.MultiTapeTM.ComputableInSpace x6 encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { arity := x0 x, size := x1 x, subcube := x2 x, levels := x3 x, leaf := x4 x, bitField := x5 x, payload := x6 x }) encIn encQuery budget
theorem Cslib.MCSP.MergeTree.encQuery_payload_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query} :
theorem Cslib.MCSP.MergeTree.encQuery_levels_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Query} :

The length of a query: twice its unary parameters, prefix and bit field, plus 8 for the six frame terminators and the framed leaf flag, plus the payload.

def Cslib.MCSP.MergeTree.Query.ofNode (n s : ℕ) (p : List Bool) (k : ℕ) (leaf : Bool) (j : ℕ) (v : List Bool) :

The query for bit j of the node p with k merge levels, arity n, size bound s, leaf flag leaf and payload v. Its bit field is the unary field of width stateWidth n s for j.

theorem Cslib.MCSP.MergeTree.encQuery_ofNode (n s : ℕ) (p : List Bool) (k : ℕ) (leaf : Bool) (j : ℕ) (v : List Bool) :
encQuery (Query.ofNode n s p k leaf j v) = encQuery (Query.ofNode n s p k leaf j []) ++ v

A node query is its header followed by its payload: the encoding of the query with payload v is the encoding of the query with empty payload, followed by v.

theorem Cslib.MCSP.MergeTree.length_encQuery_ofNode (n s : ℕ) (p : List Bool) (k : ℕ) (leaf : Bool) {j : ℕ} (hj : j ≤ stateWidth n s) :
(encQuery (Query.ofNode n s p k leaf j [])).length = 2 * (n + s + p.length + k + stateWidth n s) + 8

The header length of a node query for a bit j ≤ stateWidth n s does not depend on j.

noncomputable def Cslib.MCSP.MergeTree.childState (n s : ℕ) (p : List Bool) (k : ℕ) (leaf : Bool) (v : List Bool) (e : BitString k) :

The state of child e of a node with prefix p, k merge levels and payload v: for a leaf, the point state of p ++ e for table bit equivFin k e; otherwise the block of stateWidth n s payload bits starting at equivFin k e · stateWidth n s. Missing bits read as false.

The answer to a query: bit j of the levels-fold merge of its children under mergeLanguage, where j is the number of true bits of the bit field, or false when j ≥ stateWidth arity size.

The merge-tree oracle: the encodings of the queries whose answer is true. It is one language for every arity n and size bound s, since every query carries them, so it can be fixed before n.

It is derived from CircuitMinMergeLanguage: a query asks for a bit of k levels of its merge step (Cslib.MCSP.iterMergeVec of Cslib.MCSP.mergeVec under Cslib.MCSP.mergeLanguage), on 2 ^ k child states, or, at a leaf, on the point states of 2 ^ k table bits. Querying CircuitMinMergeLanguage itself, one binary merge per oracle gate, gives only the binary-tree parameters. No bound on the complexity of this language is claimed.

A single root leaf query with k = n already decides MCSP[s] (Cslib.MCSP.MergeTree.encQuery_ofNode_nil_mem_oracle_iff_leaf), so the content of the [MMW19] bullet lies in the oracle-gate, fan-in and adaptivity bounds of the circuit built from these queries, not in the oracle.

The oracle decides the queries answering yes.

theorem Cslib.MCSP.MergeTree.answer_ofNode {n s : ℕ} (p : List Bool) (k : ℕ) (leaf : Bool) (j : Fin (stateWidth n s)) (v : List Bool) :
(Query.ofNode n s p k leaf (↑j) v).answer = iterMergeVec mergeLanguage n s p k (childState n s p k leaf v) j

A node query for bit j < stateWidth n s answers bit j of the merge of its children.

Correctness of node queries #

theorem Cslib.MCSP.MergeTree.encQuery_ofNode_mem_oracle_iff_merge {n s : ℕ} (f : BooleanFunction n) {p : List Bool} {k : ℕ} (hpk : p.length + k ≤ n) (j : Fin (stateWidth n s)) {v : List Bool} (hv : ∀ (e : BitString k) (i : Fin (stateWidth n s)), v.getD (↑((BitString.equivFin k) e) * stateWidth n s + ↑i) false = subcubeState n s f (p ++ List.ofFn e) i) :
encQuery (Query.ofNode n s p k false (↑j) v) ∈ oracle ↔ subcubeState n s f p j = true

An inner node. If block equivFin k e of the payload v holds the state of the subcube p ++ e for every e ∈ {0, 1} ^ k, where p ++ e has at most n bits, then the node query for bit j is in the oracle exactly when bit j of the state of p is true.

theorem Cslib.MCSP.MergeTree.encQuery_ofNode_mem_oracle_iff_leaf {n s : ℕ} (f : BooleanFunction n) {p : List Bool} {k : ℕ} (hpk : p.length + k = n) (j : Fin (stateWidth n s)) {v : List Bool} (hv : ∀ (e : BitString k), v.getD (↑((BitString.equivFin k) e)) false = f (BitString.ofList n (p ++ List.ofFn e))) :
encQuery (Query.ofNode n s p k true (↑j) v) ∈ oracle ↔ subcubeState n s f p j = true

A leaf. If bit equivFin k e of the payload v is the value of f at the point p ++ e for every e ∈ {0, 1} ^ k, where p ++ e has n bits, then the node query for bit j is in the oracle exactly when bit j of the state of p is true.

theorem Cslib.MCSP.MergeTree.encQuery_ofNode_nil_mem_oracle_iff_leaf (s : ℕ → ℕ) {n : ℕ} (T : BitString (2 ^ n)) {v : List Bool} (hv : ∀ (e : BitString n), v.getD (↑((BitString.equivFin n) e)) false = T ((BitString.equivFin n) e)) :

The root, as a leaf, answers MCSP[s]. If bit equivFin n e of the payload v is bit equivFin n e of the truth table T, then bit 0 of the root leaf query with n levels is the answer of MCSP[s] (GapMCSP.yesSet s) on T.