Natural constructions and the power interface

The compiler writes its conditions as formulas over integer polynomials with fresh natural witnesses: equality is a difference, conjunction a sum of squares, disjunction a product, and strict inequality, divisibility, congruence and oddness are single equations with fresh witnesses.

DefinitionNatural constructions and their macros#✓

Polynomials live in \(\mathbb Z[X_i:i\in\mathbb N]\) and formulas are those of the specification chapter: atoms \(a\doteq b\) and \(\langle f\rangle\), conjunctions and disjunctions, with the compilation \(\kappa\) (difference, sum of squares, product; empty conjunction \(0\), empty disjunction \(1\)). A formula holds naturally at \(x:\mathbb N\to\mathbb N\) when it holds at the integer point \((x_i)_i\), atoms being read in \(\mathbb Z\).

Constructions. A natural construction with \(k\) inputs keeps a variable counter \(c\), initially \(k\) (the inputs are \(X_0,\dots,X_{k-1}\)), and a list of explicit variables (index and kind, the inputs first). It may

  1. take a fresh variable: record \(X_c\) as an explicit witness and increase \(c\) by one;
  2. in hierarchical mode over a fixed template \(\mathcal P\) with three parameters and \(79\) witnesses (in this chapter always the power template), call \(\mathcal P\) on polynomials \(P,Q,R\): take the block \(X_c,\dots,X_{c+78}\), increase \(c\) by \(79\), and return the atom \(\langle\mathcal P[P,Q,R;c]\rangle\) (block variables are not explicit variables).

The result of a construction is a formula \(\varphi\) and the final counter \(v\); its polynomial is \(\kappa(\varphi)\), with no further squaring, and its node list is the hash-consed node encoding of the specification chapter (an atom \(a\doteq b\) becomes \(a+(-1)\cdot b\), sums and products of lists are left-nested, the empty sum is the constant \(0\) and the empty product the constant \(1\), \(n\cdot x\) is the product node of the constant \(n\) and \(x\), \(x^2\) is the product node \(x\cdot x\), and structurally equal nodes and formulas are created once).

Gadgets and macros. Each of the following is a construction step sequence returning a formula; fresh variables are taken in the order listed, and the witnesses of inner gadgets are taken when those gadgets are created, in the order in which they occur in the formula.

  • \(\mathrm{lt}(a,b)\): fresh \(d\); the atom \(b\doteq a+1+d\).
  • \(\mathrm{divides}(a,b)\): fresh \(d\); the atom \(b\doteq a\cdot d\).
  • \(\mathrm{congruent}(a,M,b)\): fresh \(u,v\); the atom \(a+Mu\doteq b+Mv\).
  • \(\mathrm{odd}(x)\): fresh \(h\); the atom \(x\doteq2h+1\).
  • \(\mathrm{alpha}(X,b,N)\): fresh \(r,s,t,u,v,w,x,y\); the conjunction, in this order, of \(\mathrm{lt}(3,b)\), \(1+b\,u\,t\doteq u^2+t^2\), \(1+b\,s\,r\doteq s^2+r^2\), \(\mathrm{lt}(r,s)\), \(\mathrm{divides}(u^2,s)\), \(v+2r\doteq bs\), \(\mathrm{congruent}(b,v,w)\), \(\mathrm{congruent}(2,u,w)\), \(\mathrm{lt}(2,w)\), \(1+w\,x\,y\doteq x^2+y^2\), \(\mathrm{lt}(2X,u)\), \(\mathrm{lt}(2X,v)\), \(\mathrm{congruent}(x,v,X)\), \(\mathrm{lt}(2N,u)\), \(\mathrm{congruent}(x,u,N)\).
  • \(\mathrm{power}(P,Q,R)\) in flat mode: fresh \(b,m,a_0,a_1,a_2\); the disjunction of \(\bigwedge(Q\doteq0,\ R\doteq0,\ P\doteq1)\), \(\bigwedge(Q\doteq0,\ \mathrm{lt}(0,R),\ P\doteq0)\) and \(\bigwedge\bigl(\mathrm{lt}(0,Q),\ \mathrm{alpha}(a_0,Q+4,R+1),\ b\doteq a_0+Q^2+2,\ m+Q^2+1\doteq bQ,\ \mathrm{lt}(P,m),\ \mathrm{alpha}(a_1,b,R),\ \mathrm{alpha}(a_2,b,R+1),\ \mathrm{congruent}(P+ba_1,m,Qa_1+a_2)\bigr)\). In hierarchical mode, \(\mathrm{power}(P,Q,R)\) is the call of step 2.
  • \(\mathrm{binomial}(C,N,K)\): fresh \(\beta,\tau,\pi,q,r\); the conjunction of \(\mathrm{power}(\beta,2,N+1)\), \(\mathrm{power}(\tau,\beta+1,N)\), \(\mathrm{power}(\pi,\beta,K)\), \(\mathrm{lt}(C,\beta)\), \(\mathrm{lt}(r,\pi)\), \(\tau\doteq\pi(\beta q+C)+r\).
  • \(\mathrm{orthogonal}(a,b)\): fresh \(c\); \(\bigwedge(\mathrm{binomial}(c,a+b,a),\mathrm{odd}(c))\).
  • \(\mathrm{mask}(a,b)\): fresh \(c\); \(\bigwedge(\mathrm{binomial}(c,b,a),\mathrm{odd}(c))\).
  • \(\mathrm{bitAnd}(z,x,y)\): fresh \(a,b\); the conjunction of \(x\doteq z+a\), \(y\doteq z+b\), \(\mathrm{orthogonal}(z,a)\), \(\mathrm{orthogonal}(z,b)\), \(\mathrm{orthogonal}(a,b)\).

This is a definition, a transcription of the compiler's builder. The intended meanings are proved in the macro semantics; the arguments are always polynomials in variables allocated before the macro, so a macro's own variables occur only inside its formula.

inductive NForm
  /-- The atom `a ≐ b`. -/
  | eq (a b : Ex)
  /-- The atom `⟨f⟩`. -/
  | atom (f : Ex)
  /-- The call atom `⟨𝒫[P, Q, R; w]⟩`, with the index of its call node. -/
  | call (P Q R : Ex) (w : ℕ) (node : ℕ)
  /-- The conjunction. -/
  | and (fs : List NForm)
  /-- The disjunction. -/
  | or (fs : List NForm)
def NM (α : Type) : Type := State → α × State
ZInQ.Compiler.Natural.alpha · 28 lines
def alpha (X b N : Ex) : NM NForm := do
  note .alpha
  let r ← fresh
  let s ← fresh
  let t ← fresh
  let u ← fresh
  let v ← fresh
  let w ← fresh
  let x ← fresh
  let y ← fresh
  let one ← constant 1
  let two ← constant 2
  andM [
    do lt (← constant 3) b,
    do pure (.eq (← addL [one, ← mulL [b, u, t]]) (← addL [← square u, ← square t])),
    do pure (.eq (← addL [one, ← mulL [b, s, r]]) (← addL [← square s, ← square r])),
    lt r s,
    do divides (← square u) s,
    do pure (.eq (← addL [v, ← scale 2 r]) (← mulL [b, s])),
    congruent b v w,
    congruent two u w,
    lt two w,
    do pure (.eq (← addL [one, ← mulL [w, x, y]]) (← addL [← square x, ← square y])),
    do lt (← scale 2 X) u,
    do lt (← scale 2 X) v,
    congruent x v X,
    do lt (← scale 2 N) u,
    congruent x u N]
Uses 1 · Used by 5

TheoremThe equational gadgets over the naturals#✓

For all natural numbers \(a,b,M,x\):

  1. \((\exists d\in\mathbb N,\ b=a+1+d)\iff a<b\);
  2. \((\exists d\in\mathbb N,\ b=ad)\iff a\mid b\);
  3. \((\exists u,v\in\mathbb N,\ a+Mu=b+Mv)\iff a\equiv b\pmod M\), where for \(M=0\) the right side means \(a=b\);
  4. \((\exists h\in\mathbb N,\ x=2h+1)\iff x\) is odd.

There is no exception at zero modulus: for \(M=0\) the equation in item 3 says \(a=b\).

Proof sketch. Items 1, 2 and 4 are the definitions of \(<\), \(\mid\) and oddness in \(\mathbb N\). Item 3: if \(a\equiv b\pmod M\) with \(M>0\), say \(a\le b\), then \(M\mid b-a\); take \(u=(b-a)/M\), \(v=0\) (symmetrically if \(b<a\)). Conversely \(a+Mu=b+Mv\) gives \(a\bmod M=b\bmod M\). For \(M=0\) both sides say \(a=b\).

theorem lt_gadget_iff (a b : ℕ) : (∃ d : ℕ, b = a + 1 + d) ↔ a < b
theorem dvd_gadget_iff (a b : ℕ) : (∃ d : ℕ, b = a * d) ↔ a ∣ b
theorem congr_gadget_iff (a M b : ℕ) : (∃ u v : ℕ, a + M * u = b + M * v) ↔ a ≡ b [MOD M]
Used by 2

Over the naturals a compiled formula vanishes exactly where it holds, and the existential quantifiers over the witnesses of different conjuncts separate.

TheoremCompilation and private witnesses over the naturals#✓

  1. For every formula \(\varphi\) and every \(x:\mathbb N\to\mathbb N\), \(\kappa(\varphi)(x)=0\iff\varphi\) holds naturally at \(x\).
  2. Let a natural construction run from counter \(c_0\) to counter \(c_1\) and produce \(\varphi\), with all argument polynomials in variables below \(c_0\). For \(x:\mathbb N\to\mathbb N\) and \(y:[c_0,c_1)\to\mathbb N\) write \(x[y]\) for the assignment equal to \(y\) on \([c_0,c_1)\) and to \(x\) elsewhere. Then the statement $\(\exists y:[c_0,c_1)\to\mathbb N,\ \ \varphi\text{ holds naturally at }x[y]\)$ depends only on \(x\) below \(c_0\). If \(\varphi=\bigwedge_i\varphi_i\) where \(\varphi_i\) is produced on the subinterval \([c_{i-1},c_i)\), it is equivalent to the conjunction of the corresponding statements for the \(\varphi_i\); if \(\varphi=\bigvee_i\varphi_i\), to their disjunction, the variables of inactive disjuncts being set to \(0\).
  3. The same holds when some atoms are power-template calls \(\langle\mathcal P[P,Q,R;w]\rangle\) with blocks inside \([c_0,c_1)\), pairwise disjoint and not occurring in any other atom or argument: the call atom may then be replaced by the statement that some values of its block make \(\mathcal P\) vanish, quantified inside its conjunct.

Proof sketch. (1) For integers, a sum of squares vanishes iff every term does and a product vanishes iff some factor does; induct on \(\varphi\) (this is the specification chapter's statement over \(\mathbb Q\) restricted to integer points). (2) Induct on the construction: atoms and fresh variables are immediate; for a conjunction the intervals of the conjuncts are disjoint, so witnesses for the conjuncts glue to one \(y\) and a common \(y\) restricts to each; for a disjunction a witness for the true disjunct is extended by \(0\) on the other intervals, which do not occur in the true disjunct. Nonemptiness of \(\mathbb N\) is what allows existential quantifiers to be pulled across the connectives. (3) is (2) with the block of each call treated as the interval of a one-atom construction.

theorem compile_zv_eq_zero_iff (φ : Formula) (x : ℕ → ℕ) : zv x φ.compile = 0 ↔ NHolds x φ
theorem exists_agree_congr {φ : Formula} {c₀ c₁ : ℕ} (hφ : VarsLT φ.compile c₁) {x x' : ℕ → ℕ}
    (h : ∀ i < c₀, x i = x' i) :
    (∃ y, Agree x y c₀ c₁ ∧ NHolds y φ) ↔ (∃ y, Agree x' y c₀ c₁ ∧ NHolds y φ)
theorem callPower_spec {τ : ExPoly} (hτ : τ.WF) (hw : τ.witnesses = powerWitnesses)
    {P Q R : Ex} {U : Set ℕ} (hP : VarsIn P.poly (· ∈ U)) (hQ : VarsIn Q.poly (· ∈ U))
    (hR : VarsIn R.poly (· ∈ U)) :
    MSpec τ (callPower P Q R) U fun x => ExNatRel τ (callVals x P.poly Q.poly R.poly τ.params)
Informally uses
Sources
Uses 2 · Used by 4 · Informal links 1

The power template is the compiled power macro: three parameters, \(79\) witnesses, \(474\) nodes. Its natural zeros are exactly the triples with \(P=Q^R\). With it, every macro means what it should.

DefinitionThe power template#✓

The power template \(\mathcal P\) is the template obtained from the natural construction with \(3\) inputs \(P=X_0\), \(Q=X_1\), \(R=X_2\) consisting of the single flat macro \(\mathrm{power}(P,Q,R)\): it has parameter count \(3\), variable count \(82\) (so \(79\) witnesses \(X_3,\dots,X_{81}\), all explicit), and polynomial $\(\mathcal P(P,Q,R,w)=\kappa(\mathrm{power}(P,Q,R)),\)$ the product of the three branch polynomials (each a sum of squares); it is not squared again. Its witnesses are, in order: \(b,m,a_0,a_1,a_2\); the strict-difference witness of \(0<R\); that of \(0<Q\); the \(23\) witnesses of \(\mathrm{alpha}(a_0,Q+4,R+1)\) (its eight variables \(r,s,t,u,v,w,x,y\) followed by the fifteen gadget witnesses: one each for \(3<b\), \(r<s\), \(u^2\mid s\), two for each of the four congruences, one each for \(2<w\), \(2X<u\), \(2X<v\), \(2N<u\), in formula order); the witness of \(P<m\); the \(23\) witnesses of \(\mathrm{alpha}(a_1,b,R)\); the \(23\) of \(\mathrm{alpha}(a_2,b,R+1)\); the two of the final congruence. Its node list is the hash-consed node encoding of the construction; its node statistics (\(474\) nodes, constants \(0,1,4,2,3,-1\) in order of first occurrence, no calls) are a finite check of the universal-circuit section.

This is a definition. A power call \(\mathcal P[g_P,g_Q,g_R;w]\) substitutes the three parameter polynomials and moves the \(79\) witnesses to the block \(X_w,\dots,X_{w+78}\), as in the call semantics of the specification chapter; this is the power interface between the natural circuit and the power-value recipe.

def powerTemplate : ExPoly := ⟨3, 79, powerTemplatePoly⟩
theorem powerTemplate_poly : powerTemplate.poly = powerTemplateFormula.compile
theorem powerTemplateCircuit_stats :
    (powerTemplateCircuit.nodes.length, powerTemplateCircuit.root, powerTemplateCircuit.varCount)
      = (474, 473, 82)
Uses 2 · Used by 5

TheoremSemantics of the power template#✓

For all natural numbers \(P,Q,R\): $\(\bigl(\exists w\in\mathbb N^{79},\ \mathcal P(P,Q,R,w)=0\bigr)\iff P=Q^R,\)$ with \(0^0=1\). Consequently, in any natural construction in hierarchical mode, a power call whose argument polynomials take natural values at every natural point and whose block is private (pairwise disjoint from the other blocks and occurring in no other atom or argument) may be replaced by the relation \(g_P=g_Q^{\,g_R}\) of its argument values.

Proof sketch. By the compilation statement, \(\mathcal P(P,Q,R,w)=0\) iff the flat power formula holds naturally at \((P,Q,R,w)\); by item 2 of that statement the existential over the \(79\) witnesses distributes over the three branches and over the conjuncts of each branch, the witnesses of the two inactive branches being set to \(0\). The branch conditions are those of the power formula once the gadgets and the three alpha macros are replaced by their relations (equational gadgets, alpha soundness and completeness). The power formula expresses exponentiation.

theorem powerTemplate_natRel (P Q R : ℕ) :
    (∃ w : Fin 79 → ℕ, MvPolynomial.eval
        (fun i => (NatCircuit.natPoint 3 79 ![P, Q, R] w i : ℤ)) powerTemplate.poly = 0) ↔
      P = Q ^ R
theorem powerSpec_hierarchical_powerTemplate : PowerSpec powerTemplate .hierarchical
Uses 6 · Used by 2

TheoremSemantics of the natural macros#✓

Let a gadget or macro of the natural constructions be run from counter \(c_0\) to \(c_1\) on argument polynomials in variables below \(c_0\) that take natural values at every natural point, producing \(\varphi\). For every \(x:\mathbb N\to\mathbb N\), writing \(a,b,\dots\) for the values of the arguments at \(x\), $\(\exists y:[c_0,c_1)\to\mathbb N,\ \ \varphi\text{ holds naturally at }x[y]\)$ is equivalent to the following relation (in hierarchical mode, the template is the power template and its calls are read as in item 3 of the compilation statement):

Macro Relation
\(\mathrm{lt}(a,b)\) \(a<b\)
\(\mathrm{divides}(a,b)\) \(a\mid b\)
\(\mathrm{congruent}(a,M,b)\) \(a\equiv b\pmod M\) (\(a=b\) if \(M=0\))
\(\mathrm{odd}(x)\) \(x\) odd
\(\mathrm{alpha}(X,b,N)\) \(b>3\) and \(X=\alpha_b(N)\)
\(\mathrm{power}(P,Q,R)\), flat or hierarchical \(P=Q^R\)
\(\mathrm{binomial}(C,N,K)\) \(C=\binom NK\)
\(\mathrm{orthogonal}(a,b)\) \(a\mathbin{\mathrm{AND}}b=0\)
\(\mathrm{mask}(a,b)\) \(a\mathbin{\mathrm{AND}}b=a\)
\(\mathrm{bitAnd}(z,x,y)\) \(z=x\mathbin{\mathrm{AND}}y\)

The hypothesis on the arguments holds whenever the argument polynomials have nonnegative coefficients, as all arguments in this chapter do (\(Q+4\), \(R+1\), \(2X\), \(a+b\), \(K\cdot N_j\), \(R_j+D\) and so on).

Proof sketch. By the compilation statement each conjunction splits along the intervals of its conjuncts, so each macro reduces to its listed conditions with the inner macros replaced by their relations (induction in the order lt, divides, congruent, odd; alpha; power; binomial; orthogonal, mask; bitAnd). Then: the four equational gadgets; alpha is the alpha formula with its strict inequalities, divisibility and congruences replaced by the gadgets, so soundness and completeness of the alpha formula apply; power is the power formula, whose correctness gives \(P=Q^R\) (hierarchical mode: the power-template semantics); binomial is the binomial-digit statement; orthogonal and mask are Lucas's criterion with the odd gadget; bitAnd is the AND gadget with orthogonality.

theorem lt_spec {U : Set ℕ} {A B : Poly} (hA : VarsIn A (· ∈ U)) (hB : VarsIn B (· ∈ U))
    (hAn : IsNat A) (hBn : IsNat B) {a b : Ex} (ha : a.poly = A) (hb : b.poly = B) :
    MSpec τ (lt a b) U fun x => nv x A < nv x B
theorem divides_spec {U : Set ℕ} {A B : Poly} (hA : VarsIn A (· ∈ U)) (hB : VarsIn B (· ∈ U))
    (hAn : IsNat A) (hBn : IsNat B) {a b : Ex} (ha : a.poly = A) (hb : b.poly = B) :
    MSpec τ (divides a b) U fun x => nv x A ∣ nv x B
theorem alpha_spec {U : Set ℕ} {XP BP NP : Poly} (hX : VarsIn XP (· ∈ U)) (hB : VarsIn BP (· ∈ U))
    (hN : VarsIn NP (· ∈ U)) (hXn : IsNat XP) (hBn : IsNat BP) (hNn : IsNat NP) {X b N : Ex}
    (hXe : X.poly = XP) (hbe : b.poly = BP) (hNe : N.poly = NP) :
    MSpec τ (alpha X b N) U fun x => AlphaFormula (nv x XP) (nv x BP) (nv x NP)
Uses 11 · Used by 2

A natural circuit denotes a polynomial, a call node denoting literal substitution into the power template on a private block; its natural relation quantifies over natural witnesses. A hierarchical construction yields a well-scoped circuit whose relation is the conjunction of its macro relations.

DefinitionNatural semantics of a natural circuit#✓

Let \(\mathcal C\) be a natural circuit in the format of the specification chapter: \(k\) inputs, a list of explicit variables (inputs first, with indices \(0,\dots,k-1\)), a node list of constants, variables, additions, multiplications and calls \(\mathrm{call}\,(a,b,c)\,w\) of the power template on three earlier nodes with block start \(w\), a root node, and a variable count \(V\) (the number of explicit variables plus \(79\) times the number of calls, when the blocks and explicit variables tile \([0,V)\)).

  1. The polynomial \([\![\mathcal C]\!]\in\mathbb Z[X_i:i\in\mathbb N]\) is the denotation of the root under the template semantics of the specification chapter, a call node denoting the power call \(\mathcal P\bigl[[\![a]\!],[\![b]\!],[\![c]\!];w\bigr]\) (literal substitution).
  2. The natural relation of \(\mathcal C\) is the predicate on \(\mathbb N^k\) $\(Z_{\mathcal C}(c_0,\dots,c_{k-1})\iff\exists z\in\mathbb N^{V-k},\ \ [\![\mathcal C]\!](c_0,\dots,c_{k-1},z)=0 ,\)$ the variables of index at least \(V\), if any occur, being set to \(0\).
  3. \(\mathcal C\) is well scoped if every block \([w,w+79)\) lies in \([k,V)\), the blocks are pairwise disjoint and disjoint from the explicit variables, the explicit variables and blocks together cover \([0,V)\), and every variable node refers to an explicit variable.

This is a definition. Item 2 quantifies over natural witnesses only; replacing \(\mathbb N\) by \(\mathbb Q\) here is not justified, and the translation to rational point codes is the subject of the next section.

structure NatCircuit where
  /-- The number `k` of inputs. -/
  inputCount : ℕ
  /-- The explicit variables (index and kind), the inputs first. -/
  explicitVars : List (ℕ × VarKind)
  /-- The node list. -/
  nodes : List NatNode
  /-- The root node. -/
  root : ℕ
  /-- The variable count `V`. -/
  varCount : ℕ
def poly (T : ExPoly) (C : NatCircuit) : Poly := getPoly (denoteNatNodes T C.nodes) C.root
def NatRel (T : ExPoly) (C : NatCircuit) (c : Fin C.inputCount → ℕ) : Prop :=
  ∃ z : Fin (C.varCount - C.inputCount) → ℕ,
    MvPolynomial.eval (fun i => (natPoint C.inputCount (C.varCount - C.inputCount) c z i : ℤ))
      (C.poly T) = 0
Uses 3 · Used by 10

TheoremCircuits of hierarchical constructions#✓

Let a natural construction with \(k\) inputs in hierarchical mode end with formula \(\varphi\) and counter \(V\), and let \(\mathcal C\) be its natural circuit: its explicit variables are the inputs and fresh variables in allocation order, its node list is the node encoding of \(\varphi\) with root the encoding of \(\kappa(\varphi)\), and its call nodes are the power calls with their blocks. Assume every macro argument is a polynomial in variables allocated before the macro. Then:

  1. \(\mathcal C\) is well scoped, its variable count is \(V\), and \([\![\mathcal C]\!]=\kappa(\varphi)\);
  2. if moreover \(k\le V\), the variables of \(\kappa(\varphi)\) are below \(V\), and the call blocks of \(\varphi\) are private (they lie in \([k,\infty)\), are pairwise disjoint, and contain no variable of an atom or of a call argument of \(\varphi\)), then for every \(c\in\mathbb N^k\), \(Z_{\mathcal C}(c)\) holds if and only if there are natural values of the variables, equal to \(c\) on the inputs, for which \(\varphi^\natural\) holds, where \(\varphi^\natural\) is \(\varphi\) with every power call atom replaced by the statement that some natural values of the \(79\) witnesses make \(\mathcal P\) vanish at the values of its arguments; when these values are natural, this is the relation \(g_P=g_Q^{\,g_R}\) of its arguments;
  3. consequently, if the construction has a macro specification \(R\) over its inputs (built from the macro semantics by the composition rules: conjunction, disjunction, and an existential over each fresh variable), then \(Z_{\mathcal C}(c)\iff R(c)\); that is, \(Z_{\mathcal C}(c)\) is equivalent to the conjunction of the relations of the macros of the construction, quantified over the remaining fresh variables.

The flat construction gives the same relation: replacing each power call by the flat power macro changes the polynomial and the variable numbering but not the relation.

Proof sketch. (1) Induction over construction steps as in the specification chapter's construction theorem: every node handed out denotes the polynomial of the expression it was created for (hash-consing returns only structurally equal nodes), the counter only grows, blocks are taken from it consecutively, and a block index is passed only as a call's witness start, so no variable node refers to a block and the explicit variables and blocks tile \([0,V)\). (2) By the compilation statement (items 1 and 3), applied to the private blocks, together with the power-template semantics for natural argument values. (3) is (2) with the macro semantics. The flat/hierarchical remark follows because both readings of a power call have relation \(P=Q^R\).

theorem toCircuit_item1 {k : ℕ} {m : NM NForm} (T : ExPoly) (hpres : Pres k m)
    {P : State → Prop} (hP : P (State.init k)) (hm : Triple P m fun φ s => φ.Valid T s) :
    (m.toCircuit k).WellScoped ∧ (m.toCircuit k).varCount = (m (State.init k)).2.next ∧
      (m.toCircuit k).poly T = (m.formula T k).compile
theorem toCircuit_natRel_iff {k : ℕ} {m : NM NForm} {T : ExPoly} {P : State → Prop}
    (hP : P (State.init k)) (hm : Triple P m fun φ s => φ.Valid T s)
    (hk : k ≤ (m.toCircuit k).varCount) (hscoped : (m.formula T k).Scoped)
    (hblocks : ∀ b ∈ (m.formula T k).blocks, k ≤ b.1)
    (hvars : VarsLT (m.formula T k).compile (m.toCircuit k).varCount) (c : Fin k → ℕ) :
    (m.toCircuit k).NatRel T c ↔
      ∃ y : ℕ → ℕ, (∀ i : Fin k, y i = c i) ∧ NLift y (m.formula T k)
theorem toCircuit_natRel_iff_of_mspec {k : ℕ} {m : NM NForm} {T : ExPoly} {P : State → Prop}
    (hP : P (State.init k)) (hm : Triple P m fun φ s => φ.Valid T s) {R : (ℕ → ℕ) → Prop}
    (hspec : MSpec T m {i | i < k} R) (c : Fin k → ℕ) (x : ℕ → ℕ) (hx : ∀ i : Fin k, x i = c i) :
    (m.toCircuit k).NatRel T c ↔ R x
Uses 5 · Used by 2 · Informal links 1
8 fully proved

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.