1 Introduction
In 2002 the first deterministic polynomial-time algorithm for primality testing was found — the AKS algorithm (named after its creators Agrawal, Kayal, and Saxena) [Reference Agrawal, Kayal and Saxena1]. The containment
can be interpreted as saying: “Primality is a feasible property”. The general question we are treating in this work is:
-
• How feasible can a proof of the statement
be?
More concretely, since the AKS algorithm is currently the only known primality testing algorithm unconditionally running in deterministic polynomial time, the particular way we interpret this question is to ask:
-
• How feasible can a proof of the correctness of the AKS algorithm be?
The feasibility of a proof here is captured by concepts from proof complexity, namely from the field of bounded arithmetic. The theories of bounded arithmetic, which are treated in depth in ([Reference Krajíček15], [Reference Cook and Nguyen6]), are comparatively weak subtheories of Peano arithmetic. Each such theory, in some precise technical sense, corresponds to reasoning with concepts from a concrete complexity class — the theory corresponding to polynomial-time (or feasible) reasoning being
$\mathrm {PV}_1$
. There is already a rich body of results formalizing the correctness of various algorithms and parts of complexity theory in
$\mathrm {PV}_1$
and its extensions ([Reference Pich20],[Reference Müller and Pich17],[Reference Jeřábek13],[Reference Chen, Lu, Oliveira, Ren and Santhanam5],[Reference Gaysin8]), the main motivation being:
-
• Bounded reverse mathematics: Formalizing known mathematics in such theories provides insight into the intrinsic power of these theories and into the feasibility of the underlying constructions. For more details, see [Reference Nguyen18, Reference Chen, Li and Oliveira4, Reference Oliveira19].
-
• Propositional translations: Provability of sharply bounded formulas in a bounded arithmetic theory T gives a specific proof system corresponding to T in which all propositional tautologies expressing the formula for inputs of various lengths can be efficiently proved.
-
• Witnessing results: Provability of a suitable existential formula in a bounded arithmetic theory T can give an algorithm computing the witness in the complexity class C corresponding to the theory T.
Regarding primality testing, Jeřábek has proved the correctness of the Rabin–Miller primality test in
$S^2_2 + \mathrm {iWPHP}(\mathrm {PV}) + \text {PHP}(\mathrm {PV})$
[Reference Ježil14, Reference Jeřábek12].
By the correctness of the AKS algorithm, we mean the statement
where
$\text {Prime}(x)$
is the usual
$\Pi ^b_1$
-formula defining primality and
is a predicate stating that the AKS algorithm claims that the number x is a prime. Herbrand’s theorem readily implies that if
then there is a polynomial-time algorithm for factoring integers, which seems highly unlikely. This conditional unprovability result is not the only obstacle in formalizing the proof. While the original proof is relatively elementary, it still involves number-theoretic and algebraic statements, which were so far untreated in the context of bounded arithmetic. We show that the correctness of the AKS algorithm for primality testing can be proved in the bounded arithmetic theory
$T_2^{\text {count}}$
by first showing that it can be proved in
$S^1_2 + \mathrm {iWPHP}$
enriched by two algebraic axioms. The first axiom is Generalized Fermat’s Little Theorem (Definition 2.2), which asserts that the polynomials
$({\mathcal {X}}+a)^p$
and
$({\mathcal {X}}^p+a)$
are congruent modulo any polynomial
${\mathcal {X}}^r-1$
modulo p, where r is of logarithmic size. The second axiom is called Root Upper Bound,
$\mathrm {RUB}$
(Section 4.3): it essentially axiomatizes a new function symbol, which provides an injective function from the roots of the polynomial f into the set
$\{1,\dots ,\deg f\}$
, which we then allow to appear in the formulas of the schemes axiomizing the base theories
$\mathrm {PV}_1$
,
$S^1_2$
and
$T_2$
. As additional background on formalizing complexity-theoretic statements in bounded arithmetic, it is worth noting that [Reference Atserias and Tzameret2] formalizes the Schwartz-Zippel LemmaFootnote
1
in
$S^1_2$
. They also formalize
$\mathrm {FTA}_{\le }$
, half of Fundamental Theorem of Algebra, in
$S^1_2$
[Reference Atserias and Tzameret2, Lemma 3.2.]. Let us compare
$\mathrm {FTA}_{\le }$
and our axiom
$\mathrm {RUB}$
. We see that
$\mathrm {FTA}_{\le }$
works for small-degree univariate polynomials in small-size fields and constructively lists all roots.
$\mathrm {RUB}$
handles arbitrary-degree sparse polynomials and provides an injective indexing of roots.
$\mathrm {FTA}_{\le }$
is stronger constructively within its limited domain, but
$\mathrm {RUB}$
applies to cases
$\mathrm {FTA}_{\le }$
cannot handle, making it essential for general sparse polynomial reasoning.
Along the way, we prove in
$\mathrm {PV}_1$
Legendre’s theorem (Theorem 5.10), the existence of cyclotomic extensions of finite fields
$\mathbb {Z}/p$
(Theorem 4.18) and the correctness of the combinatorial number system (Lemma 5.32), in
$S^1_2$
the bound
$\text {lcm}(1,\dots ,2n) \geq 2^n$
(Corollary 5.17), and in
$\text {VTC}^0$
the correctness of the Kung–Sieveking algorithm (Lemma 6.10) for polynomial division, which could be of independent interest.
Another notable point is that the formalized proofs closely follow the original AKS proofs, preserving their core combinatorial and number-theoretic structure. This shows that bounded arithmetic can naturally capture these fundamental results without requiring major changes to the underlying arguments.
2 Preliminaries
2.1 Bounded arithmetic and the theories in question
In this section, we recall basic facts about the theories relevant to our formalization. We refer the reader interested in a comprehensive treatment of bounded arithmetic to [Reference Krajíček15].
The minimal language we consider is Buss’ language
$L_{S_2}$
[Reference Buss3] used in the original definition of the theory
$S^1_2$
(see below). The language
$L_{S_2}$
consists of the nonlogical symbols
$\{0,S,+,\cdot , \leq , \#, \left \lfloor {x/2} \right \rfloor , {\lvert {x} \rvert }\}$
and all the usual logical symbols. The symbols
$0, S,+,\cdot , \leq $
are the zero constant, the successor function, addition, multiplication, and the less-than-or-equal-to relation. The intended meaning of
$\left \lfloor {x/2} \right \rfloor $
is to divide by two and round down, and
$|x|$
is
$\lceil \text {log}\,_2 (x+1) \rceil $
, which is the length of the binary representation of x. We define
$x \# y=2^{|x| \cdot |y|}$
. The behavior of these symbols is axiomatized by the 32 universal axioms of
$\text {BASIC}$
(see [Reference Buss3, Section 2.2]). As we will only consider logarithms base 2, from now on, by
$\text {log}\, x$
, we mean
$\text {log}\,_2 (x)$
. Denote
$S(0)$
by
$1$
. The
$L_{S_2}$
-terms and
$L_{S_2}$
-formulas are defined as usual.
A bounded quantification of the free variable x in an
$L_{S_2}$
-formula
$\varphi (x)$
is either of the following
$$ \begin{align*} &(\forall x \leq t)(\varphi(x))\equiv(\forall x)(x\leq t \to \varphi(x))\\ &(\exists x \leq t)(\varphi(x))\equiv(\exists x)(x\leq t \land \varphi(x)), \end{align*} $$
where t is an
$L_{S_2}$
-term that does not contain x. We call the quantifiers of the above form bounded. We say a quantifier is sharply bounded if it is bounded and the term t is of the form
${\lvert {s} \rvert }$
for some term s. A (sharply) bounded formula in the language
$L_{S_2}$
is simply a formula in which every quantifier is (sharply) bounded. The set of all bounded formulas is denoted
$\Sigma ^b_\infty $
. An
$L_{S_2}$
-formula is
$\Sigma ^b_0=\Pi ^b_0$
if all its quantifiers are sharply bounded. An
$L_{S_2}$
-formula is
$\Sigma ^b_1$
(resp.
$\Pi ^b_1$
) if it is constructed from sharply bounded formulas using conjunction, disjunction, sharply bounded quantifiers and existential (resp. universal) bounded quantifiers.
The theory
$S^1_2$
is axiomatized over BASIC by the polynomial induction schema
$\Sigma ^b_1$
-PIND for any
$\Sigma ^b_1$
-formula
$\varphi $
:
or alternatively by the length minimization schema
$\Sigma ^b_1$
-LMIN:
for any
$\Sigma ^b_1$
-formula
$\varphi $
, or by the length maximization schema
$\Sigma ^b_1$
-LMAX:
for any
$\Sigma ^b_1$
-formula
$\varphi $
. The theory
$T_2$
is axiomatized over BASIC by the induction schema
$\Sigma ^b_{\infty }$
-IND:
for any
$\Sigma ^b_{\infty }$
-formula, or equivalently bounded formula
$\varphi $
.
Throughout this paper, we shall use the richer language of Cook’s theory
$\mathrm {PV}$
[Reference Cook7] and of the theory
$\mathrm {PV}_1$
[Reference Krajíček, Pudlák and Takeuti16], which contains function symbols for every polynomial-time algorithm. In particular, this language includes
$L_{S_2}$
. With a slight abuse of notation, we also use
$\mathrm {PV}$
to refer to this richer language. We will simply refer to these function symbols for polynomial-time algorithms as
$\mathrm {PV}$
-symbols. We shall sometimes treat them as predicates, which we call
$\mathrm {PV}$
-predicates. The intended meaning of a
$\mathrm {PV}$
-predicate is that a corresponding
$\mathrm {PV}$
-symbol for the characteristic function of the predicate outputs
$1$
. The definitions of
$\Sigma ^b_1$
,
$\Pi ^b_1$
, and
$\Sigma ^b_\infty $
can be extended to this new language by allowing the terms and open formulas to be in
$\mathrm {PV}$
. These classes of formulas are called
$\Sigma ^b_1(\mathrm {PV})$
,
$\Pi ^b_1(\mathrm {PV})$
, and
$\Sigma ^b_\infty (\mathrm {PV})$
, and the expanded theories
$S^1_2(\mathrm {PV})$
and
$T_2(\mathrm {PV})$
. However, with a slight abuse of the notation, we use
$\Sigma ^b_1$
,
$\Pi ^b_1$
, and
$\Sigma ^b_\infty $
,
$S^1_2$
, and
$T_2$
.
The weakest theory we consider is
$\mathrm {PV}_1$
, first defined in [Reference Krajíček, Pudlák and Takeuti16] as a conservative extension of Cook’s equational theoryFootnote
2
$\mathrm {PV}$
[Reference Cook7]. The theory
$\mathrm {PV}_1$
, a universal first-order theory, formalizes polynomial-time reasoning in the language of
$\mathrm {PV}$
. It is shown in [Reference Krajíček15] that
$\mathrm {PV}_1$
proves
$\Sigma ^b_0$
-IND. We say that the formula A is
$\Delta ^b_1$
-definable in a theory R if there are formulas
$B \in \Sigma ^b_1$
and
$C \in \Pi ^b_1$
such that
$A \leftrightarrow B$
and
$A \leftrightarrow C$
are provable in the theory R. Every
$\mathrm {PV}$
-function can be
$\Delta ^b_1$
-defined in
$S^1_2$
, hence we can see
$S^1_2$
as an extension of
$\mathrm {PV}_1$
(see [Reference Buss3]). Also, using Buss’ witnessing theorem [Reference Buss3], we can see that
$S^1_2$
is
$\forall \Sigma ^b_1$
-conservative over
$\mathrm {PV}_1$
. Therefore, when we want to prove a
$\forall \Sigma ^b_1$
-formula in
$\mathrm {PV}_1$
, we can prove it in
$S^1_2$
. As mentioned earlier, we assume that
$S^1_2$
is in the language
$\mathrm {PV}$
. To prove the existence of prime factorization of numbers, it seems to be necessary to work in
$S^1_2$
(see [Reference Jeřábek10]).
Let us define an axiom schema, which we will use later. The injective weak pigeonhole principle
$\mathrm {iWPHP}(\mathrm {PV})$
is the axiom schema
for each
$\mathrm {PV}$
-symbol f. We will introduce two additional axiom schemata, the Generalized Fermat’s Little Theorem (
$\text {GFLT}$
) and the Root Upper Bound (
$\mathrm {RUB}$
), once we have defined all the required notions. The axiom
$\text {GFLT}$
is treated in Definition 2.2, and the axiom
$\mathrm {RUB}$
and the resulting theory
$S^1_2+\mathrm {iWPHP}+ \mathrm {RUB}$
are treated in Section 4.3.
Another essential theory for us is the theory
$T^{\text {count}}_2$
. It consists of the theory
$T_2(\mathrm {PV})$
with its language extended by a recursively defined family of counting functions for each
$\Sigma ^b_\infty $
-formula A. Then, for each bounded formula, it contains the first level counting functions, and so on. We will not work with this theory directly. Instead, we will consider
$\Sigma ^b_\infty $
-consequences of the theory
$\text {VTC}^0_2$
which are fully conservative over
$T^{\text {count}}_2$
[Reference Krajíček15, essentially Lemma 13.1.2].
Let us now define the theory
$\text {VTC}^0_2$
. First, the theory
$V^0_2$
is a two-sorted extension of
$T_2$
, where the first sort is the “number sort” denoted by lowercase variables
$x, y, \ldots $
as in
$T_2$
, and the new “set sort” corresponds to binary strings whose bits are indexed by the number sort and is denoted by uppercase variables
$X, Y, \ldots $
. The language of
$V^0_2$
is extended by an equality symbol for the set sort, the elementhood relation
$x\in X$
between the number sort on the left and the set sort on the right, and the length symbol
${\lvert {X} \rvert }$
, which takes as an input an element of the set sort and outputs an element of the number sort. The intended meaning of
${\lvert {X} \rvert }$
is the least strict upper bound on elements of X. There is one exception to the number sort and set sort notation: The name of an arbitrary bounded field will be denoted F despite bounded fields being objects of the number sort. Note that only in the language of
$V^0_2$
we have two sorts (i.e., the number sort and the set sort), and we use the uppercase and lowercase letters to distinguish between them. However, in the language of
$\mathrm {PV}$
, there is only one sort, i.e., the number sort. Therefore, when we are working in a theory in the language of
$\mathrm {PV}$
, such as
$\mathrm {PV}_1$
or
$S^1_2$
, we freely use uppercase letters also to denote objects of the number sort.
A
$\Sigma ^B_0$
-formula is a bounded formula in this new language without quantification of the set sort. Following [Reference Jeřábek13], the theory
$V^0_2$
can be axiomatized by
$T_2$
, the basic axioms
$$ \begin{align*} &{\lvert {X} \rvert}\neq 0 \to (\exists x)(x\in X \land {\lvert {X} \rvert}=x+1)\\ &x\in X \to x < {\lvert {X} \rvert}\\ &(\forall x)((x\in X \leftrightarrow x\in Y) \to X=Y) \end{align*} $$
and the comprehension schema for
$\Sigma ^B_0$
-formulas. That is, for every
$\Sigma ^B_0$
-formula
$\varphi $
, the following is an axiom schema,
where a bounded quantification of an element of the set sort
$(\exists Y \leq t)(\dots )$
is interpreted as
$(\exists Y)( {\lvert {Y} \rvert }\leq t \land \dots )$
.
Note that using sets, we can encode sequences of the elements of the number sort,
$X^{(i)}$
being the i-th element of such encoding, where X is an element of the set sort and i an element of the number sort. We obtain the theory
$\text {VTC}^0_2$
by extending
$V^0_2$
by the axiom
$(\mathrm {CARD})$
:
$$ \begin{align*} (\forall n)(\forall X)(\exists Y)(&Y^{(0)}=0 \land \\&(\forall i<n )((i\not \in X \to Y^{(i+1)}=Y^{(i)}) \land\\&\:\phantom{(\forall i<n)}\: (i\in X \to Y^{(i+1)} = Y^{(i)}+1))) \end{align*} $$
In essence, the theory
$\text {VTC}^0_2$
is a simple extension of the two-sorted theory
$\text {VTC}^0$
originally defined in [Reference Cook and Nguyen6] by the smash function
$\#$
for the number sort, and in our setting also by all
$\mathrm {PV}$
-symbols for the number sort. In this work, we understand the theory
$\text {VTC}^0$
as a theory whose axioms are the ones of
$\text {VTC}^0_2$
which do not contain the symbol for the smash function
$\#$
.
We say a formula in the language of
$\text {VTC}^0_2$
is
$\Sigma ^B_1$
if it is equivalent over predicate calculus to a formula that contains only bounded number sort quantifications, bounded existential set sort quantification and no negations appear before any of the existential set sort quantifications. A function is
$\Sigma ^B_1$
-definable in
$\text {VTC}^0_2$
if its graph can be defined in the standard model using a
$\Sigma ^B_1$
-formula
$\varphi (X,Y)$
such that
$\text {VTC}^0_2 \vdash (\forall X)(\exists ! Y)\varphi (X,Y)$
. It can be shown [Reference Cook and Nguyen6, Theorem IX.3.7.] that
$\text {VTC}^0_2$
proves the comprehension axiom which we shall denote
$\Sigma ^B_0(\text {card})\text {-}\mathrm {COMP}$
. This comprehension axiom allows the
$\Sigma ^B_0$
-formulas to contain new function symbols each computing a
$\Sigma ^B_1$
-definable function in
$\text {VTC}^0_2$
, similarly it proves the induction axiom
$\Sigma ^B_0(\text {card})\text {-}\mathrm {IND}$
, which allows such formulas in the induction axiom.
2.2 Algebraic primitives in bounded arithmetic
Let us start with the formalization of elementary number theory and polynomial arithmetic in
$\mathrm {PV}_1$
. For numbers x, y we denote x divides y by
$x \mid y$
. There is a well-behaved
$\mathrm {PV}$
-symbol
$x\ \mathrm { mod }\ m$
which computes the remainder of x modulo m. The primality of a number x is defined by the
$\Pi ^b_1$
-formula
$\text {Prime}(x)$
:
Coding of both sets and sequences of elements can be developed in
$\mathrm {PV}_1$
, here we will describe the main ideas. We use the notation
$1^{(r)}$
to denote the number whose binary expansion consists of r-many ones, in other words, the number r is of logarithmic size. Coding of sets is simple, there is a well-behaved
$\mathrm {PV}$
-symbol
$\textrm {bit}(x,i)$
which outputs the i-th bit of the number x, the elementhood relation
$i\in x$
is then defined to be equivalent to
$\textrm {bit}(x,i)=1$
. Regarding sequences, a sequence
$( a_1,\dots , a_k),$
where
$1^{(k)}$
exists, can be coded by a pair
$\langle a,b \rangle $
, with a consisting of a number whose binary expansion is the concatenation of the binary expansions of
$a_1, a_2, \dots , a_k$
and b is the number whose binary expansion contains
$1$
at the positions which correspond to the beginning of each
$a_i$
. We shall denote the pair
$\langle a,b\rangle $
by
$\langle a_1,\dots ,a_k\rangle $
. More details on coding of sequences in
$\mathrm {PV}_1$
can be found in [Reference Krajíček15, Section 5.4]. Sums and products over sequences can also be defined by the obvious iterative algorithm. Such an algorithm obtains a sequence of numbers and outputs the iterated sum/product as a single number.
Let us note that sometimes we consider sets which are not neccesarily codeable in
$\mathrm {PV}_1$
but are definable by a formula: These are just abbreviations in the meta-language where we talk about a definable predicate as if it were the set of all elements which satisfy it. As such, definable sets are not quantifiable. Of special importance are sets of the form
$\{x;C(x)=1\}$
for a Boolean circuit C, as these can appear in the induction formulas. We always make it clear when a set is codeable as oppose to definable.
Polynomials are defined to be sequences of coefficients such that the number of coefficients is one more than the degree of the polynomial, with the addition, multiplication and composition defined as usual, division defined using the long division algorithm, and exponentiation modulo some other polynomial defined using exponentiation by squaring. Divisibility of polynomials is defined as usual, the notation
$f\mid g$
meaning that the polynomial f divides g. A polynomial is called irreducible if it cannot be written as a product of two polynomials, both having positive degrees. We will sometimes call polynomials formalized like this low degree polynomials, as their degree is bounded by a number of logarithmic size. Later in this section we will define a second formalization of polynomials in a two sorted theory, and we will call polynomials following this second formalism high degree polynomials.
The basic properties of the greatest common divisor (
$\gcd $
) of numbers are essential for many arguments. The following is well-known (see [Reference Jeřábek12]):
Lemma 2.1 (
$\mathrm {PV}_1$
, Euclid’s algorithm)
There is a
$\mathrm {PV}$
-function symbol
$\gcd $
such that
$\mathrm {PV}_1$
proves
$$ \begin{align*} &\gcd(x,y) \mid x\\ &\gcd(x,y) \mid y\\ &(z \mid x \land z \mid y) \to (z \mid \gcd(x,y)), \end{align*} $$
and also a
$\mathrm {PV}$
-function symbol
$\text {xgcd}$
for which
$\mathrm {PV}_1$
proves
Throughout this work, we introduce
$\mathrm {PV}$
-symbols by declaring their name and properties inside the Lemma environment. Therefore, in the subsequent parts of this work,
$\gcd $
and
$\text {xgcd}$
in any extension of
$\mathrm {PV}_1$
denote specific
$\mathrm {PV}$
-symbols which satisfy the statement of the Lemma 2.1. We are now ready to define the first algebraic axiom we need for our formalization. Throughout the paper, we will use calligraphic uppercase letters
${\mathcal {X}}$
,
$\mathcal {Y}$
,
$\dots $
for formal variables of polynomials.
Definition 2.2 (Generalized Fermat’s Little Theorem)
Let
$\text {GFLT}$
be the natural
$\Sigma ^b_1$
-sentence formalizing the following statement, where the exponentiation of polynomials is given by a
$\mathrm {PV}$
-symbol for exponentiation by repeatedly squaring modulo the polynomial
${\mathcal {X}}^r-1$
.

The validity of
$\text {GFLT}$
follows in a sufficiently strong meta-theory by applying binomial theorem to the expresison
$({\mathcal {X}}+a)^p$
and considering which coefficients are divisible by p, this gives us
$({\mathcal {X}}+a)^p \equiv {\mathcal {X}}^p + a \ (\mathrm{mod }\ {p})$
which we take modulo
${\mathcal {X}}^r-1$
. Since there are exponentially many monomials in the expansion of
$({\mathcal {X}}+a)^p$
, it is not clear how to adapt the proof strategy in
$\mathrm {PV}_1$
even if we assume the ordinary Fermat’s Little Theorem as an axiom.
Let us now discuss the formalization of algebraic concepts in
$\text {VTC}^0_2$
. As an extension of
$T_2$
, all function and relational symbols on the number sort are carried over from
$\mathrm {PV}_1$
. More interesting is the case of arithmetical operations over the set sort, where we interpret the set X as a number
$\sum _{u\in X}2^u$
. Already
$V^0_2$
can prove the totality and basic properties of addition and ordering. However, multiplication is
$\text {TC}^0$
-complete. Thus, it is known that
$V^0_2$
cannot prove it is total as this would contradict known lower bounds against
$\text {AC}^0$
. Coding of sequences of elements of the set sort can be developed in
$\text {VTC}^0_2$
, with i-th element of a sequence S being
$S^{[i]}$
. It is also well-known that
$\text {VTC}^0_2$
can prove the totality and basic properties of multiplication. Moreover,
$\text {VTC}^0_2$
can
$\Sigma ^B_1$
-define iterated addition
$\sum _{i<n}X^{[i]}$
and prove
$$ \begin{align*} \sum_{i<0} X^{[i]} &= 0,\\ \sum_{i<n+1} X^{[i+1]} &= X^{[n]}+\sum_{i<n} X^{[i]}. \end{align*} $$
Only recently has Jeřábek [Reference Jeřábek13] shown that
$\text {VTC}^0_2$
can also
$\Sigma ^B_1$
-define iterated multiplication and prove the analogous recursive properties. This also implies that it can define the division of integers.
Theorem 2.3 [Reference Jeřábek13]
$\text {VTC}^0$
can
$\Sigma ^B_1$
-define iterated products
$\prod _{i<n} X^{[i]}$
and prove the iterated multiplication axiom
$\text {IMUL}$
:
$$ \begin{align*} \prod_{i<0} X^{[i]} &= 1,\\ \prod_{i<n+1} X^{[i+1]} &= X^{[n]}\cdot\prod_{i<n} X^{[i]}. \end{align*} $$
Moreover,
$\text {VTC}^0$
can
$\Sigma ^B_1$
-define a function
$\left \lfloor {X/Y} \right \rfloor $
such that it proves
Finally, let us treat polynomials encoded by elements of the set sort as a sequence of coefficients, where each coefficient is an element in the number sort, which we shall call high degree polynomials. The totality of addition of high-degree polynomials is straightforward, and using iterated addition, the totality of their multiplication can be proved in
$\text {VTC}^0$
. We will observe in Theorem 6.11 that the Kung-Sieveking
$\text {TC}^0$
-algorithm as presented in [Reference Healy and Viola9] for the division of polynomials can also be proved correct in
$\text {VTC}^0_2$
which also implies the totality of division for high degree polynomials.
3 The AKS algorithm and its correctness

3.1 Proof of the correctness
We begin by providing a high-level overview of the proof of correctness of the AKS algorithm (Algorithm 1) [Reference Agrawal, Kayal and Saxena1], here
$\text {ord}_r(n)$
is the multiplicative order of n modulo r and
$\text {log}\,$
is the base
$2$
logarithm. In doing so, we restate and give new alphabetical names to key Lemmas and Theorems of [Reference Agrawal, Kayal and Saxena1] to avoid confusion with the numbering in our work. The key number-theoretic statement behind the algorithm is the following:
Lemma (A) [Reference Agrawal, Kayal and Saxena1, Lemma 2.1]
Let
$a\in \mathbb {Z}$
,
$n\in \mathbb {N}$
,
$n\geq 2$
and
$\gcd (a,n)=1$
. Then n is prime if and only if
The AKS algorithm essentially emerges as an effectivization of this characterization of primality. As testing for this equality explicitly requires comparing objects of size exponential in
${\lvert {n} \rvert }$
, the AKS algorithm instead checks the equality modulo a low degree polynomial
${\mathcal {X}}^r-1$
for polynomially many values of a. Since the statement of this lemma cannot even be expressed in the language of
$\mathrm {PV}$
, in the formalization, we instead supplement it by the
$\text {GFLT}$
axiom. This axiom is what remains of Lemma A by keeping the only if direction and taking the equality mod
${\mathcal {X}}^r-1$
for r polynomial in
${\lvert {n} \rvert }$
.
This axiom implies the following direction of the correctness.
Lemma (B) [Reference Agrawal, Kayal and Saxena1, Lemma 4.2]
If n is prime, the algorithm returns prime.
Next, the goal is to prove that the number r, which is essentially found by brute force in the AKS algorithm, always exists and has size polynomial in
${\lvert {n} \rvert }$
. This is Lemma D, which is, in turn, proved using Lemma C. Here, we use the symbol
$\text {lcm}$
to denote the function computing the least common multiple.
Lemma (C) [Reference Agrawal, Kayal and Saxena1, Lemma 3.1]
Let
$\text {LCM}(m)$
denote the
$\text {lcm}$
of the first m numbers. Then for
$m\geq 7$
:
Lemma (D) [Reference Agrawal, Kayal and Saxena1, Lemma 4.3]
There exists an
$r \leq \text {max} \{3, \lceil \text {log}\,^5 n \rceil \}$
such that
$\text {ord}_r(n)> \left \lfloor {\text {log}\,{n}} \right \rfloor ^2$
.
We use slightly different bounds in our formalization, but they are always polynomially related to the original ones.
From now on, we assume that on the input n the AKS algorithm answered PRIME. We take r from the statement of Lemma D and fix some prime
$p \mid n$
such that
$\text {ord}_r(p)> 1$
, the rest of the proof consists of showing that
$n=p$
. Furthermore, we fix the number
$\ell = \left \lfloor {\sqrt {\phi (r)}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
.
The proof then continues by defining the concept of introspectivity.
Definition [Reference Agrawal, Kayal and Saxena1, Definition 4.4]
For a polynomial
$f({\mathcal {X}})$
and a number
$m\in \mathbb {N}$
, we say that m is introspective for
$f({\mathcal {X}})$
if
Lemma (E) [Reference Agrawal, Kayal and Saxena1, Lemmas 4.5 and 4.6]
If m and
$m'$
are introspective for
$f({\mathcal {X}})$
, then so is
$m\cdot m'$
. Moreover if m is introspective for
$f({\mathcal {X}})$
and
$g({\mathcal {X}})$
then it is also introspective for
$f({\mathcal {X}})\cdot g({\mathcal {X}})$
Together Lemma A and our assumptions about n and p imply that
$\frac {n}{p}$
and p are both introspective for all
$({\mathcal {X}}+a)$
,
$0\leq a \leq \ell $
. Lemma F then allows us to show that for the sets
$I=\{(\frac {n}{p})^i p^j; i,j \geq 0\}$
and
$P = \{\prod _{a}({\mathcal {X}}+a)^{e_a};e_a\geq 0\}$
it holds that every number from I is introspective for every polynomial in P.
Now we finally define
$G = I\ \mathrm{ mod }\ r$
and
$\mathcal {G} = P \ \mathrm{ mod }\ h$
, where h is an irreducible factor of the cyclotomic polynomial
$Q_r$
over the field
$\mathbb {F}_p$
. After setting
$t={\lvert {G} \rvert }$
, we can state the last two technical Lemmas.
Lemma (F) [Reference Agrawal, Kayal and Saxena1, Lemma 4.7]
${\lvert {\mathcal {G}} \rvert } \geq \binom {t+\ell }{t-1}$
Lemma (G) [Reference Agrawal, Kayal and Saxena1, Lemma 4.8]
If n is not a power of p, then
${\lvert {\mathcal {G}} \rvert } \leq n^{\left \lfloor {\sqrt {t}} \right \rfloor }$
.
Since the AKS algorithm checks whether n is a perfect power and we assume that it is not (otherwise, the algorithm outputs COMPOSITE), we get that both bounds on
$\mathcal {G}$
hold. By showing they are incompatible we obtain:
Lemma (H) [Reference Agrawal, Kayal and Saxena1, Lemma 4.9]
If the algorithm returns PRIME, then n is a prime.
Putting Lemma B and Lemma H together, we get:
Theorem [Reference Agrawal, Kayal and Saxena1, Theorem 4.1]
The AKS algorithm outputs PRIME if and only if the number n is a prime.
3.2 Overview of our formalization
Let us start with the formalization of the AKS algorithm as a
$\mathrm {PV}$
-symbol. The algorithm begins by checking whether the number on the input is not a perfect power; this can be checked in polynomial time, and the algorithm as a
$\mathrm {PV}$
-symbol can be proved correct in
$\mathrm {PV}_1$
.
Lemma 3.1. There is a
$\mathrm {PV}$
-symbol
for which
$\mathrm {PV}_1$
proves:
Proof. The
$\mathrm {PV}$
-symbol
can be constructed to follow the procedure: For each value of
$b\in \{1,\dots ,{\lvert {x} \rvert }+1\}$
, use binary search to find a value of a such that
$a^{b}=x$
or continue if no such value exists. Such values for a and b will be found if and only if such values exist, which is equivalent to the existence of a and
$y=1^{(b)}$
such that
$a^{{\lvert {y} \rvert }}=x$
.
Next, one has to fix some upper bound for the number r, which is polynomial in
${\lvert {n} \rvert }$
. We will later prove in
$S^1_2$
that such a bound exists. For convenience, let us also assume that the algorithm actually checks for the slightly stronger
$\text {ord}_r(n)> {\lvert {n} \rvert }^2$
. We show this stronger assumption is justified in Lemma 5.19 by the same argument as in [Reference Agrawal, Kayal and Saxena1]. For any natural number r, the function
$\phi (r)$
is Euler’s totient function which outputs the number of numbers less than r that are relatively prime to r. The value
$\phi (r)$
can be computed by a
$\mathrm {PV}$
-symbol which obtains
$1^{(r)}$
on the input (see Lemma 4.5). The function
$\lfloor {\sqrt {x}} \rfloor $
can be computed by a binary search for the value y which satisfies
$y^2 \leq x < (y+1)^2$
. The function
$\lfloor {\text {log}\, x} \rfloor $
is exactly equal to
${\lvert {x} \rvert }-1$
. All of these algorithms can be straightforwardly formalized as
$\mathrm {PV}$
-symbols. Altogether, the AKS algorithm can be formalized as a
$\mathrm {PV}$
-symbol
, which outputs
$1$
if and only if the algorithm would output PRIME. By the correctness of the AKS algorithm, we mean the sentence
:
We prove the correctness by following the outline of the proof as in the previous section. For each Lemma or Theorem used in the formalization, we always strive to use the weakest possible theory for the given argument.
In Section 4, we show that
$S^1_2$
proves the existence of cyclotomic extensions of finite fields. This is important later in the argument to prove the existence of the polynomial h.
For the formalization, we will use the following congruence property. Recall that we fixed the number r from Lemma D satisfying
$r \leq \text {max} \{3, \lceil \text {log}\,^5 n \rceil \}$
and
$\text {ord}_r(n)> \left \lfloor {\text {log}\,{n}} \right \rfloor ^2$
. We also fixed
$\ell = \left \lfloor {\sqrt {\phi (r)}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
.
Lemma (Congruence)
Let n be a number such that
holds, i.e., the AKS algorithm asserts that n is prime, and let r be the value provided by the algorithm satisfying
$\text {ord}_r(n)> |n|^{2}$
. Assume p is a prime divisor of n such that
$\text {ord}_r(p)>1$
. And let us fix
$\ell = \left \lfloor {\sqrt {\phi (r)}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
. In
$S^1_2+\text {GFLT}$
it holds that for every
$0 \leq a \leq \ell $
We provide most of our formalization of the original proof in Section 5 in the theory
$S^1_2 + \mathrm {iWPHP} + \mathrm {RUB} + \text {GFLT}$
. We start in Section 5.1 by proving Legendre’s formula in
$\mathrm {PV}_1$
; we use it in Section 5.2 to prove our version of Lemma C, which is used in Section 5.3 to prove Lemma D. In Section 5.4, we prove the Congruence Lemma and in Section 5.5, we formalize the concept of introspectivity and prove Lemma E.
Since the property of a polynomial being in the group
$\mathcal {G}$
is not easily formulated by a
$\mathrm {PV}$
-predicate, we instead use the predicate
$\hat P$
recognizing all those polynomials over F with degree at most r. Our version of Lemma F instead of an inequality states that there exists a function
$\tau $
from
$\{1,\dots , \binom {t+\ell }{t-1}\}$
into
$\hat P$
, which satisfies
. To prove Lemma F in Section 5.6, we first formalize the Combinatorial Number System, which assigns to each number
$i\leq \binom {m}{k}$
a unique k-element subset of
$\{1,\dots ,m\}$
, when m is given in unary. Our version of Lemma G, which again replaces inequality by an existence of a function
$g:\hat P \to n^{\lfloor {\sqrt {t}} \rfloor }$
, with the property
, is proved in Section 5.7 using the axiom
$\mathrm {RUB}$
. We finish in Section 5.8 by proving Lemma H: the composition of the functions from Lemmas F and G results in an injective function which is in contradiction with the axiom
$\mathrm {iWPHP}$
.
The remainder of the formalization is done in Section 6, where we prove that
$\text {VTC}^0_2$
proves the consequences of
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}+\text {GFLT}$
. We thus obtain that both
$\text {VTC}^0_2$
and
$T^{\text {count}}_2$
prove
.
4 Cyclotomic polynomials over finite fields in
$\mathrm {PV}_1$
4.1 Formalization of algebraic structures
In this section, we shall prove in
$\mathrm {PV}_1$
that over the finite fields
$\mathbb {Z}/p$
, where p is prime, there are r-th cyclotomic polynomials for arbitrary
$r<p$
represented in unary. We also define a concept of bounded fields and use
$S^1_2+\text {GFLT}$
to prove that the r-th cyclotomic extension of
$\mathbb {Z}/p$
exists. Bounded fields are simply finite fields on a domain
$[b]=\{0,\dots , b-1\}$
for some number b, such that their operations are computed by boolean circuits. An analogous definition was already provided by Jeřábek in [Reference Jeřábek11]; here, we make the possibility of the field operation being coded by a circuit an explicit part of the definition to allow quantification over bounded fields.
Definition 4.1 (
$\mathrm {PV}_1$
)
A bounded field is a tuple
$(b,\tilde 0, \tilde 1,C_i,C_o,C_a,C_m)$
of elements, where
$C_i$
is a circuit computing
$i:[b]\to [b]$
,
$C_o$
is a circuit computing
$o:[b]\setminus \{\tilde 0\} \to [b]\setminus \{\tilde 0\}$
,
$C_a$
is a circuit computing
$a:[b]^2\to [b]$
and
$C_m$
is a circuit computing
$m:[b]^2\to [b]$
such that a as addition, m as multiplication, i as additive inverse and o as multiplicative inverse satisfy the field axioms on the universe
$[b]$
with
$\tilde 1$
as the
$1$
element, and
$\tilde 0$
as the
$0$
element. That is, for all
$x,y,z \in [b]$
we have
and for all nonzero
$x\in [b]:$
When a bounded ring/field is understood from the context, we shall denote
$a(x,y)$
as
$x+y$
,
$m(x,y)$
as
$x\cdot y$
,
$o(x)$
as
$x^{-1}$
,
$i(x)$
as
$-x$
,
$\tilde 1$
as
$1$
, and
$\tilde 0$
as
$0$
.
Lemma 4.2 (
$\mathrm {PV}_1$
)
If p is a prime, then
$\mathbb {Z}/p=(p,1,0,C_i,C_o,C_a,C_m)$
, where
$C_i$
,
$C_o$
,
$C_a$
,
$C_m$
are the circuits computing the appropriate operations modulo p is a bounded field.
Proof. The existence of a multiplicative inverse follows from Lemma 2.1 and the rest is immediate.
In sections 4 and 5, the usual name for a bounded field is F. Low degree polynomials over a bounded field F are defined as usual in
$\mathrm {PV}_1$
, that is as sequences of elements of F of length equal to the degree of the polynomial plus one, and do not require special treatment. That is, for each bounded field F there is a
$\mathrm {PV}$
-symbol which naturally encodes a predicate
$f\in F[{\mathcal {X}}]$
, we will therefore freely use this notation.
The following is straightforward, as the correctness of the Euclid’s algorithm for polynomials can be proved analogously to the variant for integers.
Lemma 4.3 (
$\mathrm {PV}_1$
, Euclid’s algorithm)
Let F be a bounded field, then there are
$\mathrm {PV}$
-symbols
$\gcd $
and
$\text {xgcd}$
such that for any
$f,g\in F[{\mathcal {X}}]$
we have
$$ \begin{align*} \gcd(f,g) &\in F[{\mathcal{X}}]\\ \text{xgcd}(f,g)&=(h,u,v)\\ h,u,v&\in F[{\mathcal{X}}]\\ h&=\gcd(f,g)\\ h&=uf+vg, \end{align*} $$
and
$$ \begin{align*} \gcd(f,g) & \mid f\\ \gcd(f,g) & \mid g\\ (\forall t\in F[{\mathcal{X}}])((t\mid f \land t & \mid g) \to t \mid \gcd(f,g)). \end{align*} $$
Moreover,
$\gcd (f,g)$
is monic, that is the coefficient of the highest degree monomial is
$1$
.
Lemma 4.4 (
$\mathrm {PV}_1$
)
For a bounded field F, and
$f\in F[{\mathcal {X}}]$
irreducible low degree polynomial, there is a bounded field
$F[{\mathcal {X}}]/(f)$
such that the ring operations are interpreted as on polynomial operations modulo f.
Proof. This is immediate after identifying polynomials of degree less than
$k=\deg f$
with numbers below
$b^k$
, where b is the bound of the field F. The existence of multiplicative inverse follows from Lemma 4.3.
4.2 Existence of Cyclotomic extensions
We will start by proving basic properties of the Euler’s totient function
$\phi $
, which is definable in
$\mathrm {PV}_1$
for numbers represented in unary.
Lemma 4.5 (
$\mathrm {PV}_1$
)
There is a
$\mathrm {PV}$
-symbol
, such that
$\mathrm {PV}_1$
-proves

we will simply denote the value
as
$\phi (r)$
.
Lemma 4.6 (
$\mathrm {PV}_1$
)
Let
$1^{(r)}$
be a number, and r be a prime, then
$\phi (r)=r-1$
.
Proof. Since r is a prime, then for
$1\leq i < r$
we have
$\gcd (i,r)=1$
and these elements simply form the set
$\{1,\dots ,r-1\}$
consisting of
$r-1$
elements.
Definition 4.7 (
$\mathrm {PV}_1$
)
Let
$1^{(r)}$
be a number and let
$d\leq r$
. We define
$S^r_d$
to be the number coding the set
$\{0<m\leq r; \gcd (r,m)=d\}$
.
Lemma 4.8 (
$\mathrm {PV}_1$
)
Let
$1^{(r)}$
be a number and
$d \mid r$
, then
${\lvert {S^r_d} \rvert } = \phi (r/d)$
.
Proof. We will prove the lemma by showing that division by d defines a bijection between
$S^r_d$
and the set
$S^{r/d}_1 = \{0<m\leq r/d; \gcd (r/d,m)=1\}$
.
Indeed, assume
$m \in S^r_d$
, if
$\gcd (m/d,r/d)=a>1$
, then
$a\cdot d$
is a common divisor of m and r, a contradiction with d being a greatest common divisor.
On the other hand, assume
$m\in S^{r/d}_1$
, if
$\gcd (r, m\cdot d)=a\cdot d$
, we get that
$a\cdot d$
divides both
$(r/d)\cdot d$
and
$m \cdot d$
, then a is a common divisor of
$r/d$
and m and thus
$a=1$
.
Lemma 4.9 (
$\mathrm {PV}_1$
)
Let
$1^{(r)}$
be a number, then
$\sum _{d\mid r} \phi (d)=r$
.
Proof. We start with the observation that
$\{1,\dots ,r\} = \bigcup _{d\mid r} S_d^r$
. By taking the cardinality of both sides, we get
$$ \begin{align} r &= \sum_{d\mid r} {\lvert {S^r_d} \rvert} \nonumber\\ &= \sum_{d \mid r} \phi(r/d) \end{align} $$
where (
$\dagger $
) follows from Lemma 4.8 and (
$\ddagger $
) follows from the fact that the map
$d\mapsto r/d$
is an involution on the set of all divisors of r.
We will now prove basic properties of polynomials over bounded fields which are needed to prove the existence of cyclotomic polynomials.
Lemma 4.10 (
$\mathrm {PV}_1$
)
Let
$1^{(k)}$
and
$1^{(l)}$
be numbers,
$k,l\geq 1$
such that
$k\mid l$
. Then,
${\mathcal {X}}^k-1\mid {\mathcal {X}}^l-1,$
over any bounded field.
Proof. Assume that
$l = km$
. Then we have
$$ \begin{align*} ({\mathcal{X}}^k-1) (\sum_{i=1}^m {\mathcal{X}}^{(m-i)k}) &= (\sum_{i=1}^m {\mathcal{X}}^{(m-i)k+k}) - (\sum_{i=1}^m {\mathcal{X}}^{(m-i)k})\\ &= (\sum_{i=1}^m{\mathcal{X}}^{(m-i+1)k})-(\sum_{i=1}^m {\mathcal{X}}^{(m-i)k})\\ &= {\mathcal{X}}^l +(\sum_{i=2}^{m}{\mathcal{X}}^{(m-i+1)k})-(\sum_{i=1}^{m-1} {\mathcal{X}}^{(m-i)k})-1\\ &= {\mathcal{X}}^l +(\sum_{i=1}^{m-1}{\mathcal{X}}^{(m-i-1+1)k})-(\sum_{i=1}^{m-1} {\mathcal{X}}^{(m-i)k})-1\\ &= {\mathcal{X}}^l - 1.\\[-38pt] \end{align*} $$
Lemma 4.11 (
$\mathrm {PV}_1$
)
Let F be a bounded field,
$f,g,h\in F[{\mathcal {X}}]$
and
$\gcd (g,h)=1$
, then
$\gcd (fg,h)=\gcd (f,h)$
.
Proof. bounded Assume that
$$ \begin{align*} \text{xgcd}(g,h) &= (1,u,v)\\ \text{xgcd}(f,h) &=(g_1,u_1,v_1)\\ \text{xgcd}(fg,h)&=(g_2,u_2,v_2), \end{align*} $$
we will show that
$g_1=g_2$
. To prove that
$g_2 \mid g_1$
, we will multiply the equality
$ug+vh=1$
by
$g_1$
to obtain
$$ \begin{align*} (ug+vh)g_1&=g_1\\ (ug+vh)(u_1f+v_1h)&=g_1\\ ugu_1f + ugv_1h+vhu_1f+ vv_1h^2&=g_1\\ fg(uu_1)+h(ugv_1+vu_1f+vv_1h)&=g_1, \end{align*} $$
and since
$g_2$
is a common divisor of both
$fg$
and h, it is a divisor of
$g_1$
. Analogously, by multiplying the equality
$ug+vh=1$
by
$g_2$
we obtain
$$ \begin{align*} (ug+vh)g_2&=g_2\\ (ug+vh)(u_2fg+v_2h)&=g_2\\ ug^2u_2f + ugv_2h+vhu_2fg+ vv_2h^2&=g_2\\ f(ug^2u_2)+h(ugv_2+vu_2fg+vv_2h)&=g_2, \end{align*} $$
and
$g_1$
is a common divisor of both f and h, therefore a divisor of
$g_2$
.
Lemma 4.12 (
$\mathrm {PV}_1$
)
Let
$1^{(k)}$
and
$1^{(l)}$
be numbers,
$k,l\geq 1$
, then
over any bounded field.
Proof. By induction on
$\text {max}\{k,l\}$
. If
$\text {max}\{k,l\}=1$
, the equality is trivial.
Assume that the statement holds for all instances where
$\text {max}\{k,l\}<s$
for some s, where
$1^{(s)}$
exist, we will prove it for the case
$\text {max}\{k,l\}=s$
. Without loss of generality, we can assume
$k<l$
, as the case
$k=l$
is trivial. Note that this is an instance of the second mathematical induction for open formulas and it is available in
$\mathrm {PV}_1$
because the number
$\text {max}\{k,l\}$
is a length as the corresponding quantifier in the induction formula is sharply bounded.
Let
$r,q$
be numbers such that
$l=qk+r$
, and
$r<k$
, by Lemma 4.10 there is a polynomial f, such that
$f\cdot ({\mathcal {X}}^k-1)=({\mathcal {X}}^{kq}-1)$
. We have
$$ \begin{align*} {\mathcal{X}}^l-1 &= {\mathcal{X}}^{kq+r}-1\\ &= {\mathcal{X}}^r({\mathcal{X}}^{kq}-1)+{\mathcal{X}}^r-1\\ &= {\mathcal{X}}^r\cdot f \cdot ({\mathcal{X}}^k-1) + {\mathcal{X}}^r-1, \end{align*} $$
and thus by Lemma 4.11
Lemma 4.13 (
$\mathrm {PV}_1$
)
Let
$1^{(k)}$
be a number for
$k \geq 1$
and F be a bounded field. Let
$\langle f_1,\dots ,f_k\rangle $
be a sequence of elements of
$F[{\mathcal {X}}]$
and let
$g\in F[{\mathcal {X}}]$
such that for all
$i\in \{1,\dots ,k\}$
we have
$\gcd (g,f_i)=1$
. Then
$\gcd (g,\prod _{i=1}^k f_i) = 1$
.
Proof. By induction on k. The case where
$k=1$
is trivial. Assume the lemma holds for
$k-1$
, then
$$ \begin{align} \gcd(g,\prod_{i=1}^kf_i) &= \gcd(g,f_k \prod_{i=1}^{k-1}f_i) \nonumber\\ &=\gcd(g,\prod_{i=1}^{k-1}f_i) \end{align} $$
where (
$\dagger $
) follows from the previous line by Lemma 4.11 and (
$\ddagger $
) follows from the induction hypothesis.
Lemma 4.14 (
$\mathrm {PV}_1$
)
Let
$1^{(k)}$
be a number for
$k \geq 1$
and F be a bounded field. Let
$\langle f_1,\dots ,f_k \rangle $
be a sequence of elements of
$F[{\mathcal {X}}]$
, such that we have
$\gcd (f_i,f_j)=1$
whenever
$i\neq j$
, and
$g\in F[{\mathcal {X}}]$
. If for every
$1\leq i\leq k$
we have
$f_i\mid g$
, then
$\prod _{i=1}^kf_i \mid g$
.
Proof. By induction on k. For
$k=1$
the statement is trivial.
Assume that the statement holds for
$k-1$
, and that we want to prove it for the sequence
$\langle f_1,\dots ,f_k\rangle $
and
$g\in F[{\mathcal {X}}]$
satisfying for every
$1\leq i \leq k: f_i\mid g$
and also that for
$i\neq j$
we have
$\gcd (f_i,f_j)=1$
. Then for
$h=\prod _{i=1}^{k-1} f_i$
we have
$h\mid g$
and by Lemma 4.13 also
$\gcd (h,f_k)=1$
. Assume that
$\text {xgcd}(h,f_k) = (1,u,v)$
, therefore
$uh+vf_k=1$
and fix polynomials
$s,t\in F[{\mathcal {X}}]$
satisfying
$sh = g$
and
$tf_k = g$
.
Then we have
$$ \begin{align*} uh+vf_k&=1\\ uhg+vf_kg&=g\\ uhtf_k + vf_ksh &= g\\ hf_k(ut+vs)&=g, \end{align*} $$
and thus
$\prod _{i=1}^kf_k = hf_k \mid g$
.
Definition 4.15 (
$\mathrm {PV}_1$
)
Let
$1^{(k)}$
be a number for
$k \geq 1$
and F be a bounded field. If
$f\in F[{\mathcal {X}}]$
and
$f=\sum _{i=0}^k a_i {\mathcal {X}}^i$
we define its derivative
$f'\in F[{\mathcal {X}}]$
to be given by
$\sum _{i=0}^{k-1}(i+1)a_{i+1}{\mathcal {X}}^i$
.
Lemma 4.16 (
$\mathrm {PV}_1$
)
Let F be a bounded field. If
$f,g\in F[{\mathcal {X}}]$
, then
$$ \begin{align*} (f+g)'&=f'+g'\\ (fg)'&=f'g+fg'. \end{align*} $$
Proof. Straightforward.
Lemma 4.17 (
$\mathrm {PV}_1$
)
Let F be a bounded field,
$f \in F[{\mathcal {X}}]$
, and
$\gcd (f,f')=1$
. If for
$g \in F[{\mathcal {X}}]$
:
$g^2 \mid f$
, then
$\deg g = 0$
.
Proof. We proceed by proving the contrapositive. Assume
$g^2\mid f$
and
$\deg g $
is at least
$1$
. Then
$f=hg^2$
and by Lemma 4.16 we have
$f' = h'g^2 + 2hg'g$
. Therefore
$g \mid f'$
and thus
$g\mid \gcd (f,f')$
. Hence,
$\gcd (f,f')\neq 1$
.
We are now ready to prove the existence of cyclotomic polynomials in
$\mathrm {PV}_1$
, the proof we use differs from the standard proof by only using elementary concepts and thus not needing the definition of cyclotomic polynomials which uses the field of complex numbers.
Theorem 4.18 (
$\mathrm {PV}_1$
)
There is a
$\mathrm {PV}$
-symbol
such that
$\mathrm {PV}_1$
proves that for every prime p, and every number
$1^{(r)}$
,
$1\leq r < p$
, we have that
is a degree
$\phi (r)$
polynomial over
$\mathbb {Z}/p$
, such that
$$ \begin{align*} &Q_r \mid {\mathcal{X}}^r-1,\\ \forall r'\in\{1,\dots,r-1\}:&\gcd (Q_r, X^{r'}-1)=1. \end{align*} $$
Proof. Let us first define
to be either
${\mathcal {X}}-1$
in the case that
$r=1$
and otherwise
, possibly discarding the remainder. In the rest of this proof, we will denote the value of
by
$Q_{a}$
. We will later show that the product
$\prod _{d\mid r, d<r} Q_d$
indeed divides
${\mathcal {X}}^r-1$
.
The proof continues by induction on the sharply bounded formula
$\psi (r)$
which is formed as a conjunction of the following formulas:
-
•
$(\forall r' \leq {\lvert {1^{(r)}} \rvert })(r'\geq 1 \to ({\mathcal {X}}^{r'}-1 = \prod _{d\mid r'} Q_d))$
-
•
$(\forall r' \leq {\lvert {1^{(r)}} \rvert })(r'\geq 1 \to (\deg Q_{r'} = \phi (r')))$
-
•
$(\forall r_1, r_2 \leq {\lvert {1^{(r)}} \rvert })((r_1 \neq r_2 \land r_1 \geq 1 \land r_2 \geq 1) \to \gcd (Q_{r_1},Q_{r_2})=1).$
The formula
$\psi (r)$
is valid when
$r=1$
, as
$Q_1={\mathcal {X}}-1$
, and the third conjunct of
$\psi (1)$
is vacuously true.
Now for the induction step assume that
$\psi (r-1)$
is true. We will use it to prove
$\psi (r)$
. For distinct divisors
$d_1,d_2$
of r which are not equal to r we have that
$\gcd (Q_{d_1},Q_{d_2})=1$
and by Lemma 4.10 every
$d\mid r, d<r$
satisfies
$Q_{d} \mid {\mathcal {X}}^{d}-1 \mid {\mathcal {X}}^r-1$
, we can obtain by Lemma 4.14 that
$\prod _{d\mid r, d<r} Q_d \mid {\mathcal {X}}^r-1$
.
Regarding the second conjunct, the induction hypothesis implies that
by the definition of
$Q_r$
, we have that
$\deg Q_r = r-\sum _{d\mid r, d<r}\phi (r)$
which is equal to
$\phi (r)$
by Lemma 4.9.
To finish the induction step it remains to show that
$\gcd (Q_r, Q_{r'})=1$
for every
$1 \leq r' < r$
. Assume that
$g = \gcd (Q_r,Q_{r'})$
, then
$$ \begin{align} g \mid Q_r & = \frac{{\mathcal{X}}^r-1}{\prod_{d\mid r, d<r} Q_d} \end{align} $$
Let
$r" = \gcd (r,r')$
, by Lemma 4.12 and the properties of
$\gcd $
we have
thus
$g \mid \prod _{d\mid r"} Q_d \mid \prod _{d\mid r, d<r} Q_d$
, combining this with (
$\dagger $
) gives
$g^2 \mid {\mathcal {X}}^r-1$
. This implies by Lemma 4.17 that
$\deg g =0$
, as
$r<p$
gives us
$\gcd ({\mathcal {X}}^r-1,r{\mathcal {X}}^{r-1})=1$
. This concludes the induction step.
To obtain the statement of the theorem, it remains to prove the equality
$\gcd (Q_r,{\mathcal {X}}^{r'}-1)=1$
for any
$0<r'<r$
. By the third conjunct of
$\psi (r)$
and Lemma 4.13 we have
Lemma 4.19 (
$S^1_2$
)
Let
$1^{(k)}$
be a number for
$k \geq 1$
, F be a bounded field and
$f\in F[{\mathcal {X}}]$
. Then there is a sequence
$\langle h_1,\dots ,h_k\rangle $
such that each
$h_i$
is a nonconstant irreducible member of
$F[{\mathcal {X}}]$
and
$\prod _{i=1}^k h_i = f$
.
Proof. By
$\Sigma ^b_1\text {-LMAX}$
there is a longest sequence of nonconstant polynomials
$\langle h_1,\dots ,h_n \rangle $
such that
$\prod ^{n}_{i=1}h_i = f$
. The irreducibility of
$h_i$
’s follows from the maximality of the length of the sequence.
To prove the existence of the polynomial h from the proof of the correctness in [Reference Agrawal, Kayal and Saxena1], we will first prove some basic properties of exponentiation by squaring.
Lemma 4.20 (
$\mathrm {PV}_1$
, Recursive property of the exponentiation by squaring)
Let
$m \geq 1$
be a number, let p be a prime and let
$1^{(r)}$
be a number and let f and g be polynomials, then
$f^m \equiv f^{m-1}\cdot f \ (\mathrm{mod }\ {g,p}).$
Proof. We will proceed by open polynomial induction on m. If
$m=1$
, the statement is trivial.
For the induction step, we will assume the statement for
$\left \lfloor {m/2} \right \rfloor $
. The case where there is l such that
$m-1=2l$
is trivial, as by the definition of exponentiation by squaring we have
In the case where there is l such that
$m=2l$
, then we have by definition of exponentiation by squaring
$$ \begin{align*} f^m&\equiv (f^l)^2 \ (\mathrm{mod }\ {g,p})\\ f^{m-1} &\equiv (f^{l-1})^2 \cdot f\ (\mathrm{mod }\ {g,p}), \end{align*} $$
which implies
$$ \begin{align} f^{m-1}f &\equiv (f^{l-1})^2 \cdot f^2 \nonumber\\ &\equiv (f^{l-1} f)^2 \nonumber\\ &\equiv (f^l)^2 \\ &\equiv f^m \ (\mathrm{mod }\ {g,p}),\nonumber \end{align} $$
where
$(\dagger )$
follows from the induction hypothesis. The second congruence can be proved analogously.
Lemma 4.21 (
$\mathrm {PV}_1$
, Divisor lemma)
Let p be a prime, l be a number and let f, g and
$g_0$
be polynomials. If
$g_0\mid g$
, then
where
$[f]_g^l$
and
$[f]^l_{g_0}$
denote exponentiation by squaring modulo g and
$g_0$
respectively.
Proof. By induction on l, if
$l=0$
the statement is trivial.
For the induction step, assume the statement holds for l. Then by Lemma 4.20 we have
since
$g_0\mid g$
, then also
$$ \begin{align} [f]^{l+1}_g &\equiv [f]^{l}_g\cdot f \ (\mathrm{mod }\ {g_0,p}) \nonumber\\ &\equiv [f]^l_{g_0} \cdot f \ (\mathrm{mod }\ {g_0,p}) \end{align} $$
where (
$\dagger $
) follows from Lemma 4.20 and (*) follows from the induction hypothesis.
Lemma 4.22 (
$\mathrm {PV}_1$
, Composition of congruences)
Let p be a prime and let l and k be numbers, and let
$f_1$
,
$f_2$
and g be polynomials. If
$f_1^l \equiv f_2 \ (\mathrm{mod }\ {g,p})$
then,
Proof. By induction on k. The case where
$k=0$
is true trivially.
Assume the statement holds for k. Then by Lemma 4.20
$$ \begin{align*} (f_1^l)^{k+1} &\equiv (f_1^l)^{k} \cdot f_1^l\\ &\equiv f_2^{k} \cdot f_1^l\\ &\equiv f_2^{k} \cdot f_2 \equiv f_2^{k+1} \ (\mathrm{mod }\ {g,p}).\\[-39pt] \end{align*} $$
Lemma 4.23 (
$\mathrm {PV}_1$
, Factor Theorem)
Let F be a finite field,
$\alpha \in F$
and
$f\in F[{\mathcal {X}}]$
. Then
$f(\alpha )=0$
if and only if
${\mathcal {X}}-\alpha \mid f$
.
Proof. We will assume that
$f(\alpha )=0$
and prove that
${\mathcal {X}}-\alpha \mid f$
, the other direction is immediate. By long division, there are
$q,r\in F[{\mathcal {X}}], \deg r <1$
such that
$f= q\cdot ({\mathcal {X}}-\alpha )+r$
. After evaluating both sides at
$\alpha $
, we get
$0=f(\alpha )= q(\alpha )\cdot ({\mathcal {X}}-\alpha )+r(\alpha )=r(\alpha )$
, since
$\deg r=0$
it is a constant and therefore
$r(\alpha )=r=0$
. Thus,
$f = q\cdot ({\mathcal {X}}-\alpha )$
.
Corollary 4.24 (
$S^1_2+\text {GFLT}$
)
Let p be a prime and
$1^{(r)}$
be a number such that
$1\leq r < p$
and
$r \nmid p-1$
. Then there is an irreducible divisor h of
${\mathcal {X}}^r-1$
over
$\mathbb {Z}/p$
, which does not divide
${\mathcal {X}}^{r'}-1$
for any
$0 < r' < r$
and
$\deg h$
is at least
$2$
.
Proof. By Theorem 4.18, there is a polynomial
$Q_r$
which divides
${\mathcal {X}}^r-1$
while satisfying
$\gcd (Q_r,{\mathcal {X}}^{r'}-1)=1$
for any
$0<r'<r$
. By Lemma 4.19 there is an irreducible factorization of
$Q_r=\prod _{i=1}^k h_i$
. The
$h=h_1$
satisfies that it is a divisor of
${\mathcal {X}}^r-1$
but not of any
${\mathcal {X}}^{r'}-1$
, where
$0<r'<r$
. It remains to show that h is of degree at least
$2$
.
Assume for contradiction that
$\deg h=1$
, thus without loss of generality
$h={\mathcal {X}}-\alpha $
, for some
$\alpha \in \mathbb {Z}/p$
. By the
$\text {GFLT}$
axiom, we have
for every
$\beta \in \{0,\dots ,p-1\}$
. Since
${\mathcal {X}}-1\mid {\mathcal {X}}^r-1$
, Lemma 4.21 gives us
We also trivially have
$$ \begin{align*} {\mathcal{X}} &\equiv 1 \ (\mathrm{mod }\ {{\mathcal{X}}-1,p})\\ {\mathcal{X}}+\beta &\equiv 1+\beta \ (\mathrm{mod }\ {{\mathcal{X}}-1,p}), \end{align*} $$
by Lemma 4.22, we have that
$$ \begin{align*} {\mathcal{X}}^p &\equiv 1^p \equiv 1 \ (\mathrm{mod }\ {{\mathcal{X}}-1,p})\\ ({\mathcal{X}}+\beta)^p &\equiv (1+\beta)^p \ (\mathrm{mod }\ {{\mathcal{X}}-1,p}), \end{align*} $$
which together with (*) gives us
Thus, by a linear substitution we have in
$\mathbb {Z}/p$
that
$\beta ^p = \beta $
, which implies
$\beta ^{p-1}=1$
for every
$\beta \in \{0,\dots ,p-1\}$
.
Since
$p-1=qr+m$
, for some q and m, where
$0< m < r$
, we have in
$\mathbb {Z}/p$
that
and
$\alpha ^m \neq 1$
as this would imply by Lemma 4.23 that
$h={\mathcal {X}}-\alpha $
divides
${\mathcal {X}}^m-1$
, which is a contradiction with the fact that h does not divide
${\mathcal {X}}^{r'}-1$
for any
$0<r<r'$
.
4.3 The Root Upper Bound axiom
In the proof of Lemma G in [Reference Agrawal, Kayal and Saxena1], polynomials of degree polynomial in n are considered, as such they are not covered by the formalism of low degree polynomials. Polynomials with unrestricted degree can be defined over
$\mathrm {PV}_1$
in a limited way as follows.
A sparse polynomial is a list of pairs of monomials and coefficients, with the intended meaning being the polynomial consisting of the sum of those monomials with those coefficients. Note that the number of monomials in a sparse polynomial is bounded by the length of the list, therefore by a length of some number. For sparse polynomials, we can define addition, multiplication and evaluation at an element of a bounded field in
$\mathrm {PV}_1$
. We will also use the notation
$\deg f$
to denote the highest exponent of a monomial in the sparse polynomial f. In the rest of this section, we define the second algebraic axiom needed for our formalization which facilitates reasoning about sparse polynomials. It uses a new function symbol to provide the injection replacing the inequality between the number of roots of a polynomial over a field and the degree of the polynomial.
Definition 4.25 (Root Upper Bound)
Let
$\mathrm {PV}(\iota )$
denote the language of
$\mathrm {PV}$
extended by a new ternary function symbol
$\iota $
. The axiom
$\mathrm {RUB}$
is the universal
$\mathrm {PV}(\iota )$
-sentence naturally formalizing the following statement.

The injective function obtained from
$\iota $
by fixing a bounded field F and a sparse polynomial
$f\in F[{\mathcal {X}}]$
will be denoted
$\iota _{F,f}$
.
Since the axiom
$\mathrm {RUB}$
introduces a new function symbol, we need to extend the axiom schemas to allow this new function symbol in the formulas that appear in them.
Definition 4.26. The theory
$S^1_2(\iota )+\mathrm {RUB}(\iota )$
is the
$\mathrm {PV}(\iota )$
-theory extending
$S^1_2$
by the axiom
$\mathrm {RUB}$
and allowing the function symbol
$\iota $
in the
$\Sigma ^b_1\text {-LMIN}$
axiom scheme. The theory
$S^1_2(\iota ) + \mathrm {iWPHP}(\iota ) + \mathrm {RUB}(\iota )$
is the
$\mathrm {PV}(\iota )$
-theory extending
$S^1_2+\mathrm {iWPHP}$
by the axiom
$\mathrm {RUB}$
and by allowing the function symbol
$\iota $
to be used in the formulas of the axiom scheme
$\Sigma ^b_1\text {-LMIN}$
and extending
$\mathrm {iWPHP}$
to allow
$\mathrm {PV}(\iota )$
-terms instead of just
$\mathrm {PV}$
-symbols.
For simplicity, we shall omit
$\iota $
in the name of these theories and simply refer to them as
$S^1_2 + \mathrm {RUB}$
and
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}$
. By the name
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}+\text {GFLT}$
we simply mean the theory extending
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}$
by the
$\text {GFLT}$
axiom.
5 The correctness in
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}+\mathrm {GFLT}$
5.1
$\mathrm {PV}_1\vdash $
Legendre’s formula
We start by proving Legendre’s formula in
$\mathrm {PV}_1$
; this is subsequently used to prove our variant of Lemma C — a lower bound on the value of
$\text {lcm}(1,\dots ,2n)$
which is then used to prove our variant of Lemma D.
The following two Lemmas are straightforward and thus we omit their proofs.
Lemma 5.1. There is a binary
$\mathrm {PV}$
-symbol
$\nu _p(x)$
for which
$\mathrm {PV}_1$
proves
$$ \begin{align*} \nu_p(0) &= 0\\ \nu_p(x)&=\begin{cases} \nu_p(\left \lfloor {x/p} \right\rfloor)+ 1 & x \equiv 0 \ (\mathrm{mod }\ {p}) \\ 0 & \text{otherwise.} \end{cases} \end{align*} $$
The value for
$\nu _p(0)$
is often assigned to be
$\infty $
, but since we never use
$0$
as an argument, we simply defined it to be
$0$
to keep the function total.
The following lemma defines the bit-length factorial.
Lemma 5.2. There is a
$\mathrm {PV}$
-symbol
$\text {Fact}({x})$
for which
$\mathrm {PV}_1$
proves
$$ \begin{align*} \text{Fact}({0}) &= 1,\\ \text{Fact}({x}) &= \text{Fact}({\left \lfloor {x/2} \right\rfloor})\cdot {\lvert {x} \rvert}, \end{align*} $$
that is:
Lemma 5.3 (
$\mathrm {PV}_1$
)
Let p be a prime and
$x\cdot y \equiv 0 \ (\mathrm{mod }\ {p})$
then either
$x\equiv 0 \ (\mathrm{mod }\ {p})$
or
$y\equiv 0 \ (\mathrm{mod }\ {p})$
.
Proof. Assume that p is a prime,
and
. Then by the fact that p is prime we have
$\gcd (x,p)=1$
and
$\text {xgcd}(x,p)=(1,u,v)$
such that
$ux+vp=1$
. Hence,
$uxy+vpy = y$
and
Lemma 5.4 (
$\mathrm {PV}_1$
)
For every prime p and a number x there is
$x'$
such that
$x= x'\cdot p^{\nu _p(x)}$
, and
$p\nmid x'$
.
Proof. We will first use induction on the formula
$\psi _1(x)$
:
The case where
$i=0$
is trivial. Assume
$\psi (i)$
and
$i+1\leq \nu _p(x)$
. By the inductive definition of
$\nu _p(x)$
, the case where
$p^{i}\mid x$
but
$p^{i+1}\nmid x$
is contradictory.
We will now use induction on the formula
$\psi _2(x)$
:
Again, the case where
$i=0$
is trivial. Assume
$\psi (i)$
and
$p^{i+1}\mid x$
, then
where (
$\dagger $
) follows from the induction hypothesis, and (
$\ddagger $
) follows from the definition of
$\nu _p$
.
Together, we have established that
Let
$k=\nu _p(x)$
and
$x'=\left \lfloor {x/p^{k}} \right \rfloor $
. From
$(*)$
we get that
$p^k \mid x$
, thus
$x=x'p^k$
. Finally, if
$p\mid x'$
, then
$p^{k+1}\mid x'p^{k}=x$
, which by
$(*)$
implies that
$k=k+1$
, a contradiction.
Lemma 5.5 (
$\mathrm {PV}_1$
)
Let p be a prime, let x and y be numbers and let
$\nu _p(y)=0$
. Then,
$\nu _p(xy)=\nu _p(x)$
.
Proof. By Lemma 5.4 there is
$x'$
which is not divisible by p, such that
$x=x'p^{k}$
, where
$k=\nu _p(p)$
. We will proceed by induction on i on the formula
Assume that
$i=0$
. Since
$p\nmid x'$
and
$p\nmid y$
, then by Lemma 5.3
$p\nmid x'y$
, and thus
$\nu _p(x'y) = 0$
.
Now assume that
$\nu _p(x'yp^i)=i$
, then
which completes the induction step. By putting
$i=k$
, we get that
Lemma 5.6 (
$\mathrm {PV}_1$
)
For a prime p and
$x,y>0$
we have
Proof. By Lemma 5.4 there are
$x'$
and
$y'$
not divisible by p such that
Then
where the last equality follows from Lemma 5.5.
Lemma 5.7 (
$\mathrm {PV}_1$
)
For every
$1^{(n)}$
and a prime p we have
$$\begin{align*}\nu_p(\text{Fact}({1^{(n)}})) = \sum_{i=1}^n \nu_p(i).\end{align*}$$
Proof. By induction on n. The case
$n=0$
is obvious.
Assume the statement holds for n, then by Lemma 5.6:
$$ \begin{align*} \nu_p(\text{Fact}({1^{(n+1)}})) &= \nu_p(\text{Fact}({1^{(n)}})\cdot (n+1))\\ &= \nu_p(\text{Fact}({1^{(n)}}))+\nu_p(n+1)\\ &= \sum_{i=1}^n \nu_p(i)+\nu_p(n+1)\\ &= \sum_{i=1}^{n+1} \nu_p(i).\\[-42pt] \end{align*} $$
Lemma 5.8 (
$\mathrm {PV}_1$
)
Let p be a prime and x be a number, then
$$\begin{align*}\nu_p(x) = \sum_{1\leq j\leq {\lvert {x} \rvert},\:p^j\mid x} 1.\end{align*}$$
Proof. By Lemma 5.4 there is
$x'$
such that
$x=x'p^{\nu _p(x)}$
. We will proceed by induction on the formula
$$\begin{align*}\nu_p(x'p^i) = \sum_{1\leq j \leq i;\:p^j \mid x} 1.\end{align*}$$
The case where
$i=0$
is trivial. Assume that the statement holds for i. Then,
$\nu _p(x'p^{i+1}) = \nu _p(x'p^i)+1=i+1,$
which completes the induction step. The statement of the lemma is obtained by taking
$i=\nu _p(x)$
.
Lemma 5.9 (
$\mathrm {PV}_1$
)
Let
$1^{(a)}$
and b be numbers, and
$b\neq 0$
. Then
$$\begin{align*}\sum_{i=1,b\mid i}^a 1 = \left \lfloor {a/b} \right\rfloor.\end{align*}$$
Proof. By induction on a. The case where
$a=0$
is trivial.
Assume that
$$\begin{align*}\sum_{i=1,b\mid i}^a 1 = \left \lfloor {a/b} \right\rfloor,\end{align*}$$
if
$b\mid a+1$
, then
$$\begin{align*}\sum_{i=1,b\mid i}^{a+1} 1 = 1+ \sum_{i=1,b\mid i}^{a} 1 = 1+\left \lfloor {a/b} \right\rfloor = \left \lfloor {(a+1)/b} \right\rfloor,\end{align*}$$
and if
$b\nmid a+1$
, then
$$\begin{align*}\sum_{i=1,b\mid i}^{a+1} 1 = \sum_{i=1,b\mid i}^{a} 1 =\left \lfloor {a/b} \right\rfloor = \left \lfloor {(a+1)/b} \right\rfloor.\\[-42pt]\end{align*}$$
We are now ready to prove Legendre’s formula in
$\mathrm {PV}_1$
. Our proof is a direct adaptation of a standard proof.
Theorem 5.10 (
$\mathrm {PV}_1$
, Legendre’s formula)
For every
$1^{(n)}$
and a prime p we have
$$\begin{align*}\nu_p(\text{Fact}({1^{(n)}})) = \sum_{i=1}^{\lvert {n} \rvert} \left \lfloor {n/p^i} \right\rfloor.\end{align*}$$
Proof. By direct computation:
$$ \begin{align} \nu_p(\text{Fact}({1^{(n)}}))&=\sum_{j=1}^n \nu_p(j) \end{align} $$
$$ \begin{align} &=\sum_{j=1}^n \sum_{i,p^i\mid j}1\end{align} $$
$$ \begin{align} &= \sum_{i=1}^{{\lvert {n} \rvert}}\sum_{1\leq j\leq n; p^i \mid j} 1 \nonumber\\ &= \sum_{i=1}^{{\lvert {n} \rvert}} \left \lfloor {n/p^i} \right\rfloor, \end{align} $$
where (A) follows from Lemma 5.7, (B) follows from Lemma 5.8 and (C) follows from Lemma 5.9.
5.2 Lemma C
Lemma 5.11 (
$S^1_2$
)
For every
$n\geq 2$
there is a prime
$p\leq n$
such that
$p\mid n$
.
Proof. By
$\Sigma ^b_1\text {-LMIN}$
we have
Let
$n>1$
be a number, then we obtain m by the above formula. If m is not a prime, then there is
$m'\mid m$
,
$1<m'$
and
${\lvert {m'} \rvert }<{\lvert {m} \rvert }$
, which is in contradiction with the formula.
Lemma 5.12 (
$S^1_2$
)
For every n and m: if every prime
$p \leq n$
satisfies that
$\nu _p(n)\leq \nu _p(m)$
, then
$n\mid m$
.
Proof. Assume that n and m satisfy that
$\nu _p(n)\leq \nu _p(m)$
for every prime
$p \leq n$
. Let
$n'=\left \lfloor {n/\gcd (m,n)} \right \rfloor $
and
$m' = \left \lfloor {m/\gcd (m,n)} \right \rfloor $
. If
$n'=1$
then
$n\mid m$
, and we are done. We now prove that
$n'>1$
is impossible.
Assume for contradiction that
$n'> 1$
, therefore by Lemma 5.11 there is a prime p such that
$p\mid n'$
and therefore
$p \mid n$
. If
$\nu _p(m')>0$
, then
$\gcd (m,n)\cdot p$
is a common divisor of both m and n, a contradiction with
$\gcd (m,n)$
being the greatest common divisor. Therefore, we obtain that
$\nu _p(m')=0$
.
Let
$k=\nu _p(\gcd (m,n))$
. Then by Lemma 5.6,
a contradiction.
Lemma 5.13 (
$S^1_2$
)
For every
$1^{(n)}$
we have that
$(\text {Fact}({1^{(n)}}))^2$
divides
$\text {Fact}({1^{(2n)}})$
.
Proof. Let p be a prime. By Lemma 5.6 and Theorem 5.10 we have
$$\begin{align*}\nu_p(\text{Fact}({1^{(n)}})^2)=2\cdot\sum_{i=1}^{\lvert {n} \rvert} \left \lfloor {n/p^i} \right\rfloor.\end{align*}$$
Again by Theorem 5.10
$$ \begin{align*} \nu_p(\text{Fact}({1^{(2n)}}))&=\sum_{i=1}^{{\lvert {2n} \rvert}}\left \lfloor {2n/p^i} \right\rfloor\\ &\geq\sum_{i=1}^{{\lvert {2n} \rvert}}2\cdot\left \lfloor {n/p^i} \right\rfloor\\ &\geq \nu_p(\text{Fact}({1^{(n)}})^2), \end{align*} $$
which by Lemma 5.12 gives
$\text {Fact}({1^{(n)}})^2\mid \text {Fact}({1^{(2n)}})$
.
Lemma 5.14. There is a
$\mathrm {PV}$
-symbol
$\text {lcm}(\langle x_1,\dots ,x_m\rangle )$
, such that
$\mathrm {PV}_1$
proves
and
Proof
(Sketch). We can see that by putting
$$\begin{align*}\text{lcm}(\langle x_1,\dots,x_m\rangle ) = \begin{cases} 1 & m=0,\\ 0 & \exists 1\leq i \leq m: x_i=0,\\ \left \lfloor {\frac{\text{lcm}(\langle x_1,\dots, x_{m-1}\rangle )\cdot x_m }{\gcd(\text{lcm}(\langle x_1,\dots, x_{m-1}\rangle) ,x_m)}} \right\rfloor & \text{otherwise,} \end{cases}\end{align*}$$
the required properties are satisfied.
Lemma 5.15 (
$S^1_2$
)
For every
$1^{(n)}$
, we have
Proof. Let p be a prime. By the length minimization principle for open
$\mathrm {PV}$
-formulasFootnote
3
, there is a minimal r such that
$2n < p^{r+1}$
. Notice that
$r<{\lvert {n} \rvert }+1$
and that
$p^r\leq 2n$
.
By Lemma 5.13 we have
thus by Lemma 5.6
Now by Theorem 5.10 we have
$$ \begin{align} \nu_p(\left \lfloor {\text{Fact}({1^{(2n)}})/\text{Fact}({1^{(n)}})^2} \right\rfloor) &= \sum_{i=1}^{{\lvert {2n} \rvert}} \left \lfloor {2n/p^i} \right\rfloor - 2 \sum_{i=1}^{{\lvert {n} \rvert}}\left \lfloor {n/p^i} \right\rfloor \nonumber\\ &= \sum_{i=1}^{{\lvert {n} \rvert}+1} \left \lfloor {2n/p^i} \right\rfloor - 2 \sum_{i=1}^{{\lvert {n} \rvert}}\left \lfloor {n/p^i} \right\rfloor \nonumber\\ &= \sum_{i=1}^{r} \left \lfloor {2n/p^i} \right\rfloor - 2 \sum_{i=1}^{r}\left \lfloor {n/p^i} \right\rfloor \end{align} $$
$$ \begin{align} &= \sum_{i=1}^{r} (\left \lfloor {2n/p^i} \right\rfloor - 2\left \lfloor {n/p^i} \right\rfloor) \nonumber\\ &\leq r, \end{align} $$
where (*) follows because
$\left \lfloor {2n/p^i} \right \rfloor =0$
for
$i>r$
and
$(\dagger )$
follows from the fact that
$\left \lfloor {2n/p^i} \right \rfloor -2\left \lfloor {n/p^i} \right \rfloor \leq 1$
for every
$i\geq 0$
. By the fact that
$p^r\leq 2n$
we have
and therefore by Lemma 5.12 the statement follows.
Theorem 5.16 (
$S^1_2$
)
For every
$1^{(n)}$
we have
Proof. By Lemma 5.15 it is enough to prove
$2^n \leq \left \lfloor {\text {Fact}({1^{(2n)}})/(\text {Fact}({1^{(n)}})^2)} \right \rfloor $
. We proceed by induction on n. For
$n=1$
the statement holds as
Assume the inequality holds for n. Then
$$ \begin{align*} \left \lfloor {\text{Fact}({1^{(2(n+1))}})/\text{Fact}({1^{(n+1)}})^2} \right\rfloor2&=\left \lfloor {\frac{\text{Fact}({1^{(2n)}})(2n+2)(2n+1)}{\text{Fact}({1^{(n)}})^2(n+1)^2}} \right\rfloor\\ &\geq\left \lfloor {\frac{\text{Fact}({1^{(2n)}})(2n+2)}{\text{Fact}({1^{(n)}})^2(n+1)}} \right\rfloor\\ &=2 \cdot \left \lfloor {\text{Fact}({1^{(2n)}})/(\text{Fact}({1^{(n)}})^2)} \right\rfloor\\ &\geq 2\cdot 2^n = 2^{n+1}.\\[-38pt] \end{align*} $$
Corollary 5.17 (
$S^1_2$
, Lemma C)
For every
$1^{(m)}$
we have
Proof. If
$m=2n$
for some n, then this is Theorem 5.16. Otherwise,
$m=2n+1$
for some n and
$2^{n} \leq \text {lcm}(1,\dots ,2n) \leq \text {lcm}(1,\dots ,2n+1)$
.
5.3 Lemma D
The following Lemma defines order for multiplicative groups whose universe is bounded by a length. The restriction on the size makes all relevant arguments easily formalizable in
$\mathrm {PV}_1$
and thus we omit its proof.
Lemma 5.18. There is a
$\mathrm {PV}$
-symbol
$\text {ORD}$
such that
$\mathrm {PV}_1$
proves for every y and x satisfying
${\gcd (x,{\lvert {y} \rvert })=1}$
that
We will write
$\text {ord}_r(y)$
to denote
$\text {ORD}(y,1^{(r)})$
.
Lemma 5.19 (
$S^1_2$
, Lemma D)
For every
$x\geq 2$
, there is
$r\leq 2{\lvert {x} \rvert }^{6}$
, such that
$\text {ord}_r(x)>{\lvert {x} \rvert }^2$
.
Proof. Notice, that
$\text {ord}_r(x) = i$
implies
$r \mid (x^i-1)$
. Let
$$\begin{align*}a = x^{b}\prod_{i=1}^{{\lvert {x} \rvert}^2}(x^i-1)< x \cdot x ^{{\lvert {x} \rvert}^4} < 2^{{\lvert {x} \rvert}^6},\end{align*}$$
where
$b={\lvert {2{\lvert {x} \rvert }^6} \rvert }$
. By Corollary 5.17 we have
Hence,
$\text {lcm}(1,\dots ,2\cdot {\lvert {x} \rvert }^6)$
does not divide a. By Lemma 5.14 we have that there is
$r\leq 2 \cdot {\lvert {x} \rvert }^6$
such that r does not divide a, and since this value is bounded by a length, we can take the smallest such r.
We will show that
$\gcd (r,x)=1$
. First, notice that from
$r\leq 2{\lvert {x} \rvert }^6$
it follows that for any prime p that
$\nu _p(r)\leq b$
. Also for any prime p we have that
$\nu _p(x)\geq 1$
implies
$\nu _p(x^b)\geq b$
.
Claim. There is a prime p such that
$\nu _p(r)> \nu _p(a)$
and
$\nu _p(x)=0$
.
Proof of claim. First, if
$\nu _p(r)\geq 1$
and
$\nu _p(x)\geq 1$
, then
Since
$r\nmid a$
, then by Lemma 5.12 there is a prime p such that
$\nu _p(r)>\nu _p(a)$
, which cannot happen if
$\nu _p(x)\geq 1$
. This proves the claim.
Consider the value
$r/\gcd (r,x)$
, we have
thus by Lemma 5.12 we have that
$r/\gcd (r,x)\nmid a$
. Since r was chosen as the smallest nondivisor of a, then
$\gcd (r,x)=1$
.
We claim that r has
$\text {ord}_r(x)>{\lvert {x} \rvert }^2$
. If
$\text {ord}_r(x)\leq {\lvert {x} \rvert }^2$
then there is
$i\leq {\lvert {x} \rvert }^2$
such that
$$\begin{align*}r \mid (x^i-1) \mid \prod_{i=1}^{{\lvert {x} \rvert}^2}(x^i-1),\end{align*}$$
a contradiction.
This lemma implies, that the if statement on line 4 of the AKS algorithm is relevant only for finitely many values. The case of correctness where this if statement results in the answer COMPOSITE can be ignored, because it can be expressed a true bounded sentence and thus proved in
$\mathrm {PV}_1$
.
5.4 Congruence Lemma
Let us denote by
$H_0(n,r)$
the following assumptions: n is a number such that
holds, i.e., the AKS algorithm asserts that n is prime, and r is the value provided by the algorithm satisfying
$\text {ord}_r(n)> |n|^{2}$
.
We show that there is a prime divisor of n called p such that
$\text {ord}_r(p)>1$
.
Lemma 5.20 (
$S^1_2$
)
Assuming
$H_0(n,r)$
, there exists a sequence coding the prime factorization of n.
Proof. By
$\Sigma ^b_1\text {-LMAX}$
there is a longest sequence of numbers
$\langle p_1,\dots ,p_m \rangle $
such that
$\prod ^{m}_{i=1}p_i = n$
and for all i we have
$p_i>1$
. The primality of
$p_i$
’s follows from the maximality of the length of the sequence.
Lemma 5.21 (
$S^1_2$
)
Assuming
$H_0(n,r)$
, there exists a prime divisor p of n such that
$\text {ord}_r(p)>1$
.
Proof. Assume that
$\langle p_1,\dots , p_k \rangle $
is the prime factorization given by the previous lemma and assume for contradiction, that
$\text {ord}_r(p_i)=1$
for all
$i\leq k$
. Then
$n= \prod _{i=1}^k p_i \equiv \prod _{i=1}^k 1 \equiv 1 \ (\mathrm{mod }\ {r})$
, a contradiction.
Let us fix p to be a prime divisor of n such that
$\text {ord}_r(p)>1$
. The rest of Section 5 is dedicated to showing that n satisfies
$\text {Prime}(n)$
. To prove the congruence lemma we will use two simple properties of exponentiation by squaring.
Lemma 5.22 (
$\mathrm {PV}_1$
, Evaluation lemma)
Let p be a prime, l be a number and let
$f_1$
,
$f_2$
and g be low degree polynomials. Then,
where
$[g_1](g_2)$
denotes the composition of a polynomial
$g_2$
with a polynomial
$g_1$
.
Proof. By induction on l. The case where
$l=0$
is true trivially.
Assume the statement holds for l. Then by Lemma 4.20
$$ \begin{align*} [f_1^{l+1}](f_2) &\equiv [f_1^l](f_2) \cdot [f_1](f_2)\\ &\equiv ([f_1](f_2))^l \cdot [f_1](f_2)\\ &\equiv ([f_1](f_2))^{l+1} \ (\mathrm{mod }\ {[g](f_2),p}).\\[-39pt] \end{align*} $$
Lemma 5.23 (
$\mathrm {PV}_1$
, Composition of exponentiation)
Let p be a prime and let l and k be numbers, and let f and g be low degree polynomials. Then,
Proof. By induction on k. The case where
$k=0$
is true trivially.
Assume the statement holds for k. Then by Lemma 4.20
$$ \begin{align*} ((f)^l)^{k+1} &\equiv (f^l)^k \cdot f^l\\ &\equiv f^{l\cdot k} \cdot f^l\\ &\equiv f^{l\cdot k + l} \equiv f^{l\cdot (k+1)} \ (\mathrm{mod }\ {g,p}), \end{align*} $$
where the additivity of exponents also follows from Lemma 4.20 by straightforward induction.
Lemma 5.24 (
$S^1_2+\text {GFLT}$
, Congruence Lemma)
Assuming
$H_0(n,r)$
and a being a number such that
$\gcd (a,p)=1$
, we have:
Proof. By the notation
$x \equiv y$
, we mean
$x\equiv y \ (\mathrm{mod }\ {{\mathcal {X}}^r-1, p})$
throughout this proof. By
we have
$({\mathcal {X}}+a)^n \equiv {\mathcal {X}}^n+a \ (\mathrm{mod }\ {{\mathcal {X}}^r-1,n})$
. We have
The equivalence
$(1)$
follows from the fact that p is a prime divisor of n and
$(2)$
is an instance of the axiom GFLT. Since
$r < p$
and p is prime, there exist u and v such that
$\text {xgcd}(r,p)=(1,u,v)$
. Thus,
$pv \equiv 1 \ (\mathrm{mod }\ {r})$
. Without loss of generality, we can assume that
$v>0$
, because otherwise, we can take
$v' = v -rv>0$
. Since
${\mathcal {X}}^v$
is a low degree polynomial (as
$v <r$
), by substituting
${\mathcal {X}}^v$
for
${\mathcal {X}}$
in
$(1)$
using Lemma 4.21 and Lemma 5.22 we get
To be concrete, by (1) we have:
By substituting
${\mathcal {X}}^v$
we get
By Lemma 5.22:
By Lemma 4.21:
Therefore
or simply
$({\mathcal {X}}^v+a)^n \equiv {\mathcal {X}}^{v \cdot n}+a$
. By an analogous argument, we can use (2), Lemma 4.21 and Lemma 5.22 to get
By Lemma 5.23, we obtain
Moreover, using Lemmas 4.22 and 5.23 we get:
Therefore, by Lemma 4.22,
$(*)$
will become
5.5 Lemma E
To prove Lemma E, let us first fix some notation. Let p be a prime divisor of n such that
$\text {ord}_r(p)>1$
. For the ease of notation, we will denote
$\mathbb {Z}/p$
by
$F_p$
. By Corollary 4.24, for
$F_p[{\mathcal {X}}]$
and r, there exists an irreducible divisor h of
${\mathcal {X}}^r -1$
in
$F_p[{\mathcal {X}}]$
such that
$h \not \mid {\mathcal {X}}^{r'}-1$
for all
$r' <r$
and
$1< \deg (h) <r$
. Take such h and fix it and take
$F= F_p[{\mathcal {X}}] / h({\mathcal {X}})$
. The following lemma introduces a set
$G_r$
represented by a
$\mathrm {PV}$
-predicate, which will be used in the rest of the paper.
Lemma 5.25. Assuming
$H_0(n,r)$
, there is a
$\mathrm {PV}$
-symbol
$G_r(x)$
such that
$\mathrm {PV}_1$
proves:
Proof. Suppose that the number x is given. First, we check that
$x <r$
. Then, for each
$i,j \leq r$
, check whether
$x \equiv (n/p)^i \cdot p^j \ (\mathrm{mod }\ {r})$
. If such i and j exist, then
$G_r(x)$
holds. This argument can be formalized in
$\mathrm {PV}_1$
since by Lemma 5.19 we have
$r \leq |n|^{10}$
.
We sometimes use the notation
$m\in G_r$
to mean
$G_r(m)$
. By Lemma 5.19, the number r is bounded by
${\lvert {n} \rvert }^{10}$
. The theory
$\mathrm {PV}_1$
can assign a cardinality to sets bounded by a length (and
$|m|^{10}$
is the length of
$s(m)$
for a suitable term s). We denote the cardinality of the set
$\{x; G_r(x)\}$
by t, where
$t < r$
.
Lemma 5.26 (
$\mathrm {PV}_1$
)
Assuming
$H_0(n,r)$
, we have
$t=|G_r| \leq \phi (r).$
Proof. We already know
We claim that for any x such that
$G_r(x)$
we have
$\gcd (x,r)=1$
. As
$G_r(x)$
, there exist
$i,j \leq r$
such that
$x\equiv (n/p)^i \cdot p^j \ (\mathrm{mod }\ {r})$
. Suppose for the sake of contradiction that
$\gcd (x, r)=c$
where
$c \neq 1$
. Thus,
If
$i \leq j$
then
$ c \mid (n/p)^{i-j}$
which is a contradiction with
$\gcd (n/p,r)=1$
. If
$i < j$
, then
$c \mid n^i p^{j-i}$
, which is a contradiction with the left side of (*).
Lemma 5.27 (
$S^1_2$
)
Assume
$H_0(n,r)$
. Let f be a sparse polynomial and m a number. There is a ternary
$\mathrm {PV}$
-predicate
$\mathrm {int}_{{\mathcal {X}}^r-1}(f,p,m)$
for which
$S^1_2$
proves
The number m is called introspective for
$f({\mathcal {X}})$
.
Let us fix
$\ell = \left \lfloor {\sqrt {\phi (r)}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
. We have the following easy observation.
Lemma 5.28 (
$S^1_2+\text {GFLT}$
)
Assuming
$H_0(n,r)$
, both p and
$\frac {n}{p}$
are introspective for
${\mathcal {X}} + a$
for any
$0 \leq a \leq \ell $
.
Proof. By the axiom
$\text {GFLT}$
and Lemma 5.24.
The following lemma combines Lemmas 4.5 and 4.6 in [Reference Agrawal, Kayal and Saxena1]. It proves the closure of introspective numbers under multiplication and also shows that the set of polynomials for which m is introspective is closed under multiplication.
Lemma 5.29 (
$S^1_2$
, Lemma E)
Assume
$H_0(n,r)$
. For any
$f \in F[{\mathcal {X}}]$
and numbers m and
$m'$
if m and
$m'$
are introspective for
$f({\mathcal {X}})$
then so is
$m \cdot m'$
. Moreover, for any
$f,g \in F[{\mathcal {X}}]$
and number m, if m is introspective for
$f({\mathcal {X}})$
and
$g({\mathcal {X}})$
then it is also introspective for
$f({\mathcal {X}}) \cdot g({\mathcal {X}})$
.
Proof. As m is introspective for
$f({\mathcal {X}})$
we have by Lemma 4.22 and Lemma 5.23:
Let
$m = q\cdot r + m_r$
, where
$0\leq m_r<r$
. Then, by Lemma 4.20, Lemma 4.22, Lemma 5.23, and
${\mathcal {X}}^r \equiv 1 \ (\mathrm{mod }\ {{\mathcal {X}}^r-1,p})$
, we have:
which implies by Lemma 5.23
By Lemma 5.22 we have
As
${\mathcal {X}}^r-1 \mid {\mathcal {X}}^{m_r\cdot r}-1$
, by Lemma 4.21:
$$ \begin{align*} [f]_{{\mathcal{X}}^{m_r\cdot r}-1}^{m'} &\equiv [f]^{m'}_{{\mathcal{X}}^{r}-1}\ (\mathrm{mod }\ {{\mathcal{X}}^r-1,p})\\ [{\mathcal{X}}]^{m'}_{{\mathcal{X}}^{m_r\cdot r}-1} &\equiv [{\mathcal{X}}]^{m'}_{{\mathcal{X}}^{r}-1} \ (\mathrm{mod }\ {{\mathcal{X}}^{r}-1,p}). \end{align*} $$
Moreover, by general algebra
By the introspectivity of
$m'$
Then,
By (C) and (A)
and by (D) and (B)
$$ \begin{align*} f([{\mathcal{X}}]^{m'}_{{\mathcal{X}}^r-1})({\mathcal{X}}^{m_r}) &\equiv f([{\mathcal{X}}]^{m'}_{{\mathcal{X}}^{m_r\cdot r}-1}({\mathcal{X}}^{m_r}))\\ &\equiv f([{\mathcal{X}}^{m_r}]^{m'}_{{\mathcal{X}}^{m_r\cdot r}-1}) \ (\mathrm{mod }\ {{\mathcal{X}}^{m_r\cdot r}-1,p}). \end{align*} $$
Therefore, we have
Thus, by
${\mathcal {X}}^r-1 \mid {\mathcal {X}}^{m_r\cdot r}-1$
and Lemma 4.21 we have
By (
$\dagger $
) we get
$m \cdot m'$
is introspective for
$f({\mathcal {X}})$
:
$$ \begin{align*} \big(f({\mathcal{X}})\big)^{m \cdot m'} \equiv (f({\mathcal{X}}^m))^{m'} &\equiv (f({\mathcal{X}}^{m_r}))^{m'}\\ &\equiv f({\mathcal{X}}^{m_r\cdot m'}) \equiv f({\mathcal{X}}^{m \cdot m'})\ (\mathrm{mod }\ {{\mathcal{X}}^r-1, p}). \end{align*} $$
For the second part of the lemma, by Lemma 4.20 we have:
5.6 Lemma F
Recall that
$H_0(n,r)$
denotes the following assumptions: n is a number such that
holds, i.e., the AKS algorithm asserts that n is prime, and r is the value provided by the algorithm satisfying
$\text {ord}_r(n)> |n|^{2}$
. From now on, we let
$H(n,r)$
denote the assumption
$H_0(n,r)$
extended by fixing the following values:
-
•
$\ell = \left \lfloor {\sqrt {\phi (r)}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
; -
•
$t=|G_r|$
; -
• p as a prime divisor of n such that
$\text {ord}_r(p)>1$
; -
•
$F_p=\mathbb {Z}/p$
; -
• an irreducible divisor h of
${\mathcal {X}}^r -1$
in
$F_p[{\mathcal {X}}]$
such that
$h \not \mid {\mathcal {X}}^{r'}-1$
for all
$r' <r$
and
$1< \deg (h) <r$
; -
•
$F= F_p[{\mathcal {X}}] / h({\mathcal {X}})$
.
Recall that
$G_r$
is the set introduced in Lemma 5.25. We start with an easy observation about
$G_r$
.
Lemma 5.30 (
$S^1_2+\text {GFLT}$
)
Assume
$H(n,r)$
. For any distinct elements m and
$m'$
of
$G_r$
we have
Proof. We prove the lemma by contraposition. Suppose
Then,
$h \mid {\mathcal {X}}^{m'}-{\mathcal {X}}^m$
and hence
However, since
$m'<r$
and
$m \neq m'$
, by Corollary 4.24 we have
Therefore,
$h \mid {\mathcal {X}}^m$
. Since h is an irreducible polynomial, this means that
$h({\mathcal {X}})={\mathcal {X}}$
. However, this contradicts the fact that
$\deg (h)>1$
. Thus, we must have
$m=m'$
.
The following are a series of lemmas necessary for the proof of Lemma F. To state the next lemma, we use the
$\mathrm {PV}$
-symbol
$\text {NumOnes}(x)$
which counts the number of ones in the binary expansion of its argument.
Lemma 5.31 (
$\mathrm {PV}_1$
)
There is a
$\mathrm {PV}$
-symbol
$c_{k}^{m}(x)$
such that
$\mathrm {PV}_1$
proves for any numbers
$1^{(k)}$
and
$1^{(m)}$
Lemma 5.32 (
$\mathrm {PV}_1$
)
There is a
$\mathrm {PV}$
-symbol
$f_{k}^m(i)$
such that
$\mathrm {PV}_1$
proves for any numbers
$1^{(k)}$
and
$1^{(m)}$
, where
$0 \leq k \leq m$
,
$$\begin{align*}f_{k}^m: \left\{0<i \leq \binom{m}{k}\right\} \to \{x; c_k^m(x)=1\}, \end{align*}$$
is an injective function.
Proof. By recursion (simultaneously on k and m) define the function
$f_k^m$
as:
$$\begin{align*}f^0_0(1)=0 \quad \text{and} \quad f_k^{m+1}(i) = \begin{cases} f_k^{m}(i) & 0 < i \leq \binom{m}{k} \\ f_{k-1}^{m}(i-\binom{m}{k})+2^m & \binom{m}{k} < i \leq \binom{m+1}{k} \end{cases} \end{align*}$$
Now, we prove the following claim.
Claim. If
$0 < i \leq \binom {m+1}{k}$
then we have
$c_k^{m+1}(f_k^{m+1}(i))$
.
We prove the claim by induction on k and m. For
$k=m=0$
the claim trivially holds. Suppose by the induction step, for any
$0 < i \leq \binom {m+1}{k}$
, we have
$c_k^{m}(f_k^m (i))$
and
$c_{k-1}^{m}(f_{k-1}^m (i))$
. Using the equality
$\binom {m+1}{k}= \binom {m}{k}+ \binom {m}{k-1}$
and the definition of the predicate
$c_k^{m+1}(x)$
, it is easy to see that the following holds for any
$x < 2^{m+1}$
Now, if
$0 < i \leq \binom {m+1}{k}$
then either
$i \leq \binom {m}{k}$
or
$\binom {m}{k} < i \leq \binom {m+1}{k}$
.
-
• If
$0 < i \leq \binom {m}{k}$
, we have
$f^{m+1}_k(i)=f^m_k(i)$
and by the induction step we have
$c_k^m(f^m_k(i))$
. By (*), we get
$c_k^{m+1}(f^m_k(i))$
. -
• If
$\binom {m}{k} < i \leq \binom {m+1}{k}$
, we have
$f_{k}^{m+1}(i)= f_{k-1}^{m}(i-\binom {m}{k})+2^m$
. By the induction step,
$c_{k-1}^{m}(f_{k-1}^m (i-\binom {m}{k}))$
. Therefore, we get
$c_{k}^{m+1}(f_{k-1}^m (i-\binom {m}{k})+2^m)$
and hence, by (*), we get
$c_{k}^{m+1}(f_{k}^{m+1} (i))$
.
This finishes the proof of the claim. Now, it remains to prove that
$f_k^m$
is injective. By induction on k and m we prove that if
$f_{k}^{m+1}(i)=f_{k}^{m+1}(j)$
then
$i=j$
. By the induction step, we know that
There are three cases:
-
1. If
$i,j \leq \binom {m}{k}$
, then
$f_{k}^{m+1}(i)=f_{k}^{m+1}(j)=f_{k}^{m}(i)=f_{k}^{m}(j)$
. Therefore, by the induction step, we have
$i=j$
. -
2. If
$\binom {m}{k} < i,j \leq \binom {m+1}{k}$
, then
$f_{k}^{m+1}(i)=f_{k}^{m+1}(j)=f_{k-1}^{m}(i-\binom {m}{k})+2^m=f_{k-1}^{m}(j-\binom {m}{k})+2^m$
. Again, by the induction step, we have
$i=j$
. -
3. We show that the case where
$i \leq \binom {m}{k}$
and
$\binom {m}{k} <j \leq \binom {m+1}{k}$
is not possible. For the sake of contradiction, suppose otherwise. Then,
$$ \begin{align*} f_{k}^{m+1}(i) & =f_{k}^{m+1}(j) & \text{(By the assumption)} \\ f_{k}^{m+1}(i) & =f_{k}^{m}(i) & \text{as} \; i \leq \binom{m}{k} \\ f_{k}^{m+1}(j) & =f_{k-1}^{m}(j-\binom{m}{k})+2^m & \text{as} \; \binom{m}{k} <j \leq \binom{m+1}{k} \end{align*} $$
By the claim
$c_k^{m}(f_k^m(i))$
holds, which by definition we get
$|f_k^m(i)| \leq m$
. We have,
$$\begin{align*}|f_{k}^{m}(i)| = |f_{k-1}^{m}(j-\binom{m}{k})+2^m|. \end{align*}$$
However,
$|f_{k}^{m}(i)| \leq m$
, which is a contradiction with
$$\begin{align*}|f_{k-1}^{m}(j-\binom{m}{k})+2^m|> m.\\[-42pt] \end{align*}$$
Definition 5.33. A function
$f: \{1, \ldots , m\} \to \{1, \ldots , m'\} $
is called strictly order-preserving (s.o.p.) if for any
$x , y \leq m$
it satisfies
Recall that
$\ell = \left \lfloor {\sqrt {\phi (r)}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
and r is a length of a string. By Lemma 5.26, we have
$t=|G_r| \leq \phi (r)$
, which means that both t and
$\ell $
are lengths. Lemmas 5.32, 5.35, 5.34, and 5.36 are the ingredients needed to prove the original Lemma F in [Reference Agrawal, Kayal and Saxena1]. In the former three lemmas, we provide injective functions, which we will compose to get the main result in Corollary 5.38.
Lemma 5.34 (
$\mathrm {PV}_1$
)
Assume
$H(n,r)$
. There is a
$\mathrm {PV}$
-symbol
$h^{\ell }_{t}(x)$
such that
$\mathrm {PV}_1$
proves that the function
$h^{\ell }_{t}$
with the domain
and the codomain
is an injective function.
Proof. The function
$h^{\ell }_{t}(x)$
is defined by recursion, sending each x to a function f of the above form. The idea is as follows. Suppose x is given. Let
$x_1=x$
. We start by defining
$f(1)=j$
where j is the smallest bit of
$x_1$
that is one, i.e, for any
$j' < j$
the
$j'$
th bit of
$x_1$
is zero. This is possible in
$\mathrm {PV}_1$
because of the following: there is a
$\mathrm {PV}$
-symbol enumerating small sets and going through it to find the smallest nonzero bit and output the index. To define
$f(2)$
, we first calculate
$x_2=x_1-2^{j-1}$
. Then,
$f(2)=k$
where k is the smallest bit of
$x_2$
that is one. We continue till reaching
$f(\ell +1)$
. Note that in each step the number of ones in
$x_{i+1}$
is one less than the number of ones in
$x_i$
. The function f with the domain
$\{1, \ldots , \ell +1\}$
is well-defined since there are
$\ell +1$
ones in x. Moreover,
$f(i) \in \{1, \ldots , t+\ell \}$
and it is a s.o.p. function. It is clear that the function
$h^{\ell }_{t}$
defined this way is injective.
Lemma 5.35 (
$\mathrm {PV}_1$
)
Assume
$H(n,r)$
. There is a
$\mathrm {PV}$
-symbol
$g^\ell _t(f)$
such that
$\mathrm {PV}_1$
proves that the function
$g^\ell _t$
with the domain
and the codomain
$\{(e_0, \ldots , e_\ell ); \Sigma _{i=0}^\ell e_i \leq t-1\}$
is an injective function.
Proof. The function
$g^\ell _t$
behaves as follows. It takes an f of the above form and sends it to a tuple
$(e_0, \ldots , e_\ell )$
. Take subsets
$s_i \subseteq \{1, \ldots , t+\ell \}$
for
$0 \leq i \leq \ell $
as follows:
$$ \begin{align*} s_0&:= \{j \in \{1, \ldots, t+\ell\}; j < f(1)\}\\ s_i&:= \{j \in \{1, \ldots, t+\ell \}; f(i) < j < f(i+1)\} \; \text{ for } 1 \leq i \leq \ell \end{align*} $$
Now, we take
$g^\ell _t(f):= (|s_0|, \ldots , |s_\ell |)$
, i.e.,
$e_i := |s_i|$
for each
$0 \leq i \leq \ell $
. We have to show that
$\Sigma _{i=0}^\ell |s_i| \leq t-1$
. Note that
$$ \begin{align} \Sigma_{i=0}^\ell |s_i| &=|s_0|+\Sigma_{i=1}^\ell |s_i| \nonumber\\ & = f(1) -1 + \Sigma_{i=1}^\ell (f(i+1)-f(i)-1) \nonumber\\ & = f(\ell+1)- (\ell +1) \nonumber\\ & \leq (t+\ell) - (\ell +1) \\ & \leq t-1\nonumber \end{align} $$
where the inequality (*) is derived by the fact that the codomain of f is
$\{1, \ldots , t+\ell \}$
.
We prove that
$g^\ell _t$
is injective. Suppose
$g^\ell _t(f)=g^\ell _t(f')$
. Therefore, there exist sets
$s_0,\dots ,s_\ell $
and
$s^{\prime }_0,\dots ,s^{\prime }_\ell $
such that
$(|s_0|, \ldots , |s_\ell |)=(|s^{\prime }_0|, \ldots , |s^{\prime }_\ell |)$
. By induction on
$1 \leq i \leq \ell +1$
, we will show that
$f(i)=f'(i)$
. Since
$|s_0|=|s^{\prime }_0|$
we get
which means that
$f(1)=f'(1)$
. Now, suppose for an
$i \leq \ell $
we have
$f(i)=f'(i)$
. Since
$|s_i|=|s^{\prime }_i|$
we have:
Therefore,
$f(i+1)=f'(i+1)$
.
Lemma 5.36 (
$\mathrm {PV}_1$
)
Let u and v be sets with cardinality bounded by a length. Then we have:
Proof. For the sake of contradiction, suppose
$\Pi _{b \in u} ({\mathcal {X}} +b) = \Pi _{b \in v} ({\mathcal {X}} +b)$
and
$u \neq v$
. Then, without loss of generality we can assume that there is an element
$c \in u$
such that
$c \notin v$
. Therefore,
and
$$ \begin{align*} \Pi_{b \in u} ({\mathcal{X}}+b) & \equiv \Pi_{b \in v} ({\mathcal{X}}+b)\\ & \equiv \Pi_{b \in v} \big(({\mathcal{X}}+c) + (b-c)\big)\\ & \equiv \Pi_{b \in v} (b-c) \quad (\mathrm{mod }\ {{\mathcal{X}}+c}) \end{align*} $$
Therefore,
Hence, there exists
$b \in v$
such that
$b=c$
, a contradiction with
$c \notin v$
.
The following lemma introduces a set
$\hat {P}_t$
, which will be used later.
Lemma 5.37. Assuming
$H(n,r)$
, there is a
$\mathrm {PV}$
-symbol
$\hat P_t(f)$
such that
$\mathrm {PV}_1$
proves:
$$ \begin{align*} \hat P_t(f) \leftrightarrow &\:\text{there is a sequence } \langle e_0,\dots, e_\ell \rangle \text{ such that:}\\ &\sum_{a=0}^\ell e_a < t, f\equiv \Pi_{a=0}^\ell ({\mathcal{X}} +a)^{e_a} \ (\mathrm{mod }\ {h,p});\quad \deg f <\deg h. \end{align*} $$
Proof. Let f be a given polynomial of degree t. The truth value of
$\hat P_t(f)$
is computed as follows,
-
• if
for all
$0 \leq a \leq \ell $
, then
$\hat {P}_t(f)$
is false. -
• Otherwise, take the smallest a such that
$f \equiv 0 \ (\mathrm{mod }\ {{\mathcal {X}}+a})$
and assign
$f_1=\frac {f}{{\mathcal {X}}+a}$
.
Repeat the step for
$f_1$
, i.e.,
-
• if
for all
$0 \leq a \leq \ell $
, then
$\hat {P}_t(f)$
is false. -
• Otherwise, take the smallest a such that
$f \equiv 0 \ (\mathrm{mod }\ {{\mathcal {X}}+a})$
and assign
$f_2=\frac {f_1}{{\mathcal {X}}+a}$
.
Repeat the step at most t many times, where each step takes
$\ell $
many divisions. If we reach some i such that
$f_i \equiv 1 \ (\mathrm{mod }\ {{\mathcal {X}}+a})$
for some
$0 \leq a \leq \ell $
, then
$\hat {P}_t(f)$
is true. Otherwise,
$\hat {P}_t(f)$
is false. To compute the sequence
$\langle e_0,\dots , e_\ell \rangle $
from the process, initially assign
$s_0=\langle e_0,\dots , e_\ell \rangle = \langle 0,\dots , 0 \rangle $
. In step
$i+1$
$$ \begin{align*} \text{if} \quad f_i=\frac{f_{i-1}}{{\mathcal{X}}+a} \quad \text{and} \quad s_i&=\langle e_0,\dots, e_a, \dots, e_\ell \rangle \quad \text{then}\\ s_{i+1}&=\langle e_0,\dots, e_a+1, \dots, e_\ell \rangle \end{align*} $$
Now, to finish the proof, we need the following easy facts:
-
1. For all
$1 \leq a \leq \ell $
we have
${\mathcal {X}}+a \neq 0$
in F, because by Corollary 4.24 we have
$\deg (h)>1$
. -
2. The polynomials
${\mathcal {X}}, {\mathcal {X}}+1, \cdots , {\mathcal {X}}+\ell $
are all distinct in F. The reason is as follows. Let
$1 \leq i \neq j \leq \ell $
. Since then
$$\begin{align*}\ell =\left \lfloor {\sqrt{\phi(r)}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor < \left \lfloor {\sqrt{r}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor <r \quad \text{and} \quad r <p, \end{align*}$$
$i \neq j$
in
$F_p$
.
Moreover, the argument can be formalized in
$\mathrm {PV}_1$
as
$\ell = \left \lfloor {\sqrt {\varphi (r)}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
and by Lemma 5.19 we have
$r \leq |n|^{10}$
.
Corollary 5.38 (
$\mathrm {PV}_1$
)
Assume
$H(n,r)$
. There is a
$\mathrm {PV}$
-symbol
$\sigma _t^\ell (i)$
such that
$\mathrm {PV}_1$
proves
$$\begin{align*}\sigma^{\ell}_t: \binom{t+\ell}{\ell+1}\to \hat{P}_t \end{align*}$$
is an injective function.
Proof. Take the functions
$f_{\ell +1}^{t+\ell }$
,
$g_t^\ell $
, and
$h^{\ell }_t$
as in Lemmas 5.32, 5.35, and 5.34, respectively. By composing these functions, we get
$e_0, \ldots , e_\ell $
such that
Define
$\sigma ^\ell _t(i)=\prod _{a=0}^{\ell } ({\mathcal {X}}+a)^{e_a}$
. The function
$\sigma ^\ell _t$
is injective by Lemma 5.36 and by the fact that the functions
$f_{\ell +1}^{t+\ell }$
,
$g^\ell _t$
, and
$h^\ell _t$
are all injective.
Lemma 5.39 (
$\mathrm {PV}_1$
, Lemma F)
Assume
$H(n,r)$
. There is a
$\mathrm {PV}$
-symbol
$\tau ^\ell _t(x)$
such that
$\mathrm {PV}_1$
proves that the function
$$\begin{align*}\tau^\ell_t: \binom{t+\ell}{t-1} \to \hat{P}_t \end{align*}$$
satisfies the following condition:
Proof. We know that
$\binom {t+\ell }{\ell +1}=\binom {t+\ell }{t-1}$
. So, we will use them interchangeably. Using Corollary 5.38, take the injective function
$$\begin{align*}\sigma^\ell_t: \binom{t+\ell}{\ell+1}\to \{f \in \hat{P}_t; \deg (f) < t\}. \end{align*}$$
Consider the function
We have to show that
For the sake of contradiction, suppose
$x \neq y$
but
$\tau ^\ell _t(x) \equiv \tau ^\ell _t(y) \ (\mathrm{mod }\ {h,p})$
. Denote
$\tau ^\ell _t(x)=f({\mathcal {X}})$
and
$\tau ^\ell _t(y)=g({\mathcal {X}})$
. Let
$m \in G_r$
, i.e., there are
$0 \leq i,j \leq r$
such that
Thus,
By Lemmas 5.28 and 5.29, m is introspective for both f and g. Therefore,
Since
$h({\mathcal {X}})$
divides
${\mathcal {X}}^r-1$
we get
Define
$Q(\mathcal {Y})=f(\mathcal {Y}) - g(\mathcal {Y})$
. Then,
${\mathcal {X}}^m$
is a root of
$Q(\mathcal {Y})$
for each
$m \in G_r$
. Moreover, if
${\mathcal {X}}^m\equiv {\mathcal {X}}^{m'} \ (\mathrm{mod }\ {h, p})$
for each
$m,m' \in G_r$
, then by Lemma 5.30 we get
$m=m'$
. Hence, there are
$|G_r|=t$
many distinct roots of
$Q(\mathcal {Y})$
in the field F. However, the degree of
$Q(\mathcal {Y})$
is less than t and we get a contradiction. Thus
. This argument can be formalized in
$\mathrm {PV}_1$
because the polynomials used here have logarithmically bounded degrees.
5.7 Lemma G
Lemma 5.40 (
$\mathrm {PV}_1$
)
Let x,y and
$1^{(k)}$
be numbers such that for any numbers
$a, b\leq k$
we have
$x^a \neq y^b$
. There is a
$\mathrm {PV}$
-symbol
$f_{x,y}(i)$
such that
$\mathrm {PV}_1$
proves
is an injective function.
Proof. For any
$1 \leq l \leq (k+1)^2$
we can write
$l=i(k+1)+j+1$
where
$0 \leq i,j \leq k$
. We can find i and j as follows and define the function
$f_{x,y}$
as
$f_{x,y}(l)=x^iy^j$
where
$$\begin{align*}i = \left \lfloor {\frac{l-1}{k+1}} \right\rfloor \qquad \text{and} \qquad j = l-1 \; \bmod{(k+1)}. \end{align*}$$
It is clear that
$0 \leq i, j \leq k$
. Now, we prove that
$f_{x,y}$
is injective, i.e.,
Suppose
$f_{x,y}(l)=f_{x,y}(m)$
for some
$l,m \in \{1, \ldots , (k+1)^2\}$
. Therefore, there are
$0 \leq i,i',j',j' \leq k$
such that
$$ \begin{align*} i &= \left \lfloor {\frac{l-1}{k+1}} \right\rfloor & i' &= \left \lfloor {\frac{m-1}{k+1}} \right\rfloor\\ j &= l-1 \; \bmod{k+1} & j' &=m-1 \; \bmod{k+1} \end{align*} $$
and
There are several cases:
-
• If
$i> i'$
and
$j < j'$
, then
$x^{i-i'}=y^{j'-j}$
, which is a contradiction with the assumption that for any numbers
$a, b$
we have
$x^a \neq y^b$
. -
• If
$i<i'$
and
$j>j'$
, we have a situation similar to the previous case. -
• If
$i> i'$
and
$j> j'$
, then
$x^{i-i'} y^{j-j'}=1$
. This only happens when
$x=y=1$
, which is again a contradiction with the assumption. -
• If
$i<i'$
and
$j<j'$
, we have a situation similar to the previous case.
Thus,
$i=i'$
,
$j=j'$
, and
$l=m$
. Hence,
$f_{x,y}$
is injective.
Lemma 5.41 (
$\mathrm {PV}_1$
)
Assume
$H(n,r)$
. There is a
$\mathrm {PV}$
-symbol
$\hat {I}_t(y)$
for which
$\mathrm {PV}_1$
proves
$$\begin{align*}\hat{I}_t(y) \leftrightarrow \exists \; 0 \leq i,j \leq \lfloor \sqrt{t} \rfloor \quad y= \left(\frac{n}{p}\right)^i \cdot p^j. \end{align*}$$
Proof. Note that
$t < r$
by the discussion after Lemma 5.25 and
$r< |n|^{10}$
by Lemma 5.19. Therefore, it is easy to see that given a number y, in
$\mathrm {PV}_1$
we can check whether there are numbers
$0 \leq i,j \leq \lfloor \sqrt {t} \rfloor $
such that
$y= (\frac {n}{p})^i \cdot p^j$
.
Lemma 5.42 (
$S^1_2+\mathrm {RUB}$
, Lemma G)
Assume
$H(n,r)$
. If n is not a power of p then there exists a function
which satisfies the condition:
Proof. Assuming n is not a power of p, then by Lemma 5.20, there is a prime divisor
$p'$
of n distinct from p. This implies, that
$(n/p)^a \neq p^b$
for any numbers
$a,b\leq \left \lfloor {\sqrt {t}} \right \rfloor $
. Thus, we can use Lemma 5.40, to obtain the function
$f_{\frac {n}{p}, p}$
or alternatively
which is an injective function. This means that the number of distinct numbers y such that
$\hat {I}_t(y)=1$
is at least
$(\lfloor \sqrt {t} \rfloor +1)^2>t$
. As
$|G_r|=t$
, there are two numbers
$m_1> m_2$
such that
It is easy to see that
We want to define the function
$\hat {g}_t: \hat {P}_t \to n^{\lfloor \sqrt {t} \rfloor }$
such that
Let
$f_1, f_2 \in \hat {P}_t$
such that
. Thus, for
$i \in \{1,2\}$
we get
$$ \begin{align*} \big(f_i({\mathcal{X}})\big)^{m_1} & \equiv f_i({\mathcal{X}}^{m_1})\\ & \equiv f_i({\mathcal{X}}^{m_2}) \\ & \equiv \big(f_i({\mathcal{X}})\big)^{m_2} \; \ (\mathrm{mod }\ {{\mathcal{X}}^r-1, p}) \end{align*} $$
Therefore, in the field F, we have
$\big (f_i({\mathcal {X}})\big )^{m_1} = \big (f_i({\mathcal {X}})\big )^{m_2}$
. Now, take the sparse polynomial
$Q'(\mathcal {Y})=\mathcal {Y}^{m_1} - \mathcal {Y}^{m_2}$
. We have
$\deg (Q')=m_1$
and
$f_i({\mathcal {X}})$
is a root of
$Q'(\mathcal {Y})$
in the field F. By the axiom
$\mathrm {RUB}$
, the function
is injective. Thus, the number of distinct roots of
$Q'$
is at least
$m_1$
. In addition, we have
$m_1 \leq (\frac {n}{p} \cdot p)^{\lfloor \sqrt {t} \rfloor } \leq n^{\lfloor \sqrt {t} \rfloor }$
. Take the function
$\hat {g}_t(\mathcal {Y})$
as
$\iota _{F,Q'}(\mathcal {Y})$
. By the above observations we get
$\hat {g}_t(f_1) \neq \hat {g}_t(f_2)$
and this finishes the proof.
5.8 Lemma H
We start with some easy combinatorial facts.
Lemma 5.43 (
$\mathrm {PV}_1$
)
For any numbers
$1^{(k)}$
,
$1^{(l)}$
, and
$1^{(s)}$
where
$k \geq s$
we have
$\binom {k+l}{k}\geq \binom {s+l}{s}$
.
Proof. Since
$k \geq s$
, we have
$k+i \geq s+i$
for each
$1 \leq i \leq l$
. Therefore,
$\Pi _{i=1}^{l} (k+i) \geq \Pi _{i=1}^{l} (s+i)$
. Hence,
$\frac {(k+l)!}{k!l!} \geq \frac {(s+l)!}{s!l!}$
, which is
$\binom {k+l}{k}\geq \binom {s+l}{s}$
.
Lemma 5.44 (
$\mathrm {PV}_1$
)
For any number
$1^{(k)}$
, where
$k \geq 6$
, we have
$\binom {2k+1}{k}> 2^{k+2}$
.
Proof. We have
$$ \begin{align*} \binom{2k+1}{k} &= \frac{(2k+1)(2k) \ldots (k+2)}{k!} \\ & = (k+2) \Pi_{i=0}^{k-2}\frac{2(k-i)+(i+1)}{k-i}\\ &> (k+2)2^{k-1} \end{align*} $$
If
$k\geq 6$
then we have
$(k+2)2^{k-1} \geq 2^{k+2}$
. Therefore,
$\binom {2k+1}{k}> 2^{k+2}$
.
Lemma 5.45 (
$S^1_2 + \mathrm {iWPHP} + \mathrm {RUB} + \text {GFLT}$
, Lemma H)
Assume
$H(n,r)$
. If the algorithm returns
$\mathrm {PRIME}$
then n is prime.
Proof. By Lemma 5.39, there is an injective function from
$\binom {t+\ell }{t-1}$
to
$\hat {P}_t$
. Recall the definition of
$G_r$
in Lemma 5.25 and
$|G_r|=t$
. We have
where the rightmost inequality holds by Lemma 5.19 and the leftmost inequality is clear by Lemma 5.25. Hence,
$$\begin{align} t & \geq \left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\sqrt{t}} \right\rfloor\qquad\qquad\qquad\qquad\qquad \nonumber\\ & \geq \left \lfloor {\sqrt{t}} \right\rfloor \cdot |n|\qquad\qquad \qquad\qquad\qquad \end{align} $$
Consequently,
$t-1 \geq \left \lfloor {\sqrt {t}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
. In Lemma 5.43 substitute
$t-1$
for k and
$\left \lfloor {\sqrt {t}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
for s and
$\ell +1$
for l to get
$$\begin{align*}\binom{t+\ell}{t-1} \geq \binom{\ell+1 + \left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor}{\left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor}. \end{align*}$$
By Lemma 5.26, we have
$t \leq \phi (r)$
. Hence,
Therefore,
$$\begin{align*}\binom{\ell+1 + \left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor}{\left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor} \geq \binom{2\left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor+1}{\left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor}. \end{align*}$$
In Lemma 5.44, if we substitute
$\left \lfloor {\sqrt {t}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor $
for k, we get
$$\begin{align*}\binom{2\left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor+1}{\left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor}> 2^{\left \lfloor {\sqrt{t}} \right\rfloor \cdot \left \lfloor {\text{log}\, n} \right\rfloor+2} \end{align*}$$
for
$\left \lfloor {\sqrt {t}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor \geq 6$
, which we can assume to hold as the remaining cases form a true bounded sentence. Moreover, we have
$2^{\left \lfloor {\sqrt {t}} \right \rfloor \cdot \left \lfloor {\text {log}\, n} \right \rfloor +2} \geq 2 n^{\lfloor \sqrt {t} \rfloor }$
. This means that there exists an injective function from
$2 n^{\lfloor \sqrt {t} \rfloor }$
to
$\hat {P}_t$
. However, by Lemma 5.42, we have if n is not a power of p, then there exists an injective function from
$\hat {P}_t$
to
$n^{\lfloor \sqrt {t} \rfloor }$
. This means that there exists an injective function
computed by a
$\mathrm {PV}(\iota )$
-term, which is a contradiction with the axiom scheme
$\mathrm {iWPHP}$
(because what we do is essentially composing
$\iota $
with
$\mathrm {PV}$
functions and not iterating
$\iota $
in some p-time process). Thus, n is a power of p. But, if
$n=p^k$
for some
$k>1$
then the algorithm would have returned
$\mathrm {COMPOSITE}$
in Step 1. Hence
$n=p$
.
5.9 The correctness
With the Lemma 5.45 in hand we have everything we need to prove the correctness in
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}+\text {GFLT}$
.
Theorem 5.46.
6
$VTC^0_2$
proves
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}+\mathrm {GFLT}$
In this section, we show that the axioms with which we extended
$S^1_2$
to prove the correctness of the algorithm are actually provable in
$VTC^0_2$
. The theory
$\text {VTC}^0_2$
includes
$T_2$
by definition. We then show that
$\text {GFLT}$
can be proved and then that
$\mathrm {RUB}$
can be proved with
$\iota $
being replaced by
$\Sigma ^B_1$
-definable function. By the
$\Sigma ^B_0(\text {card})-\mathrm {COMP}$
scheme and the axioms defining counting sequences we obtain that
$S^1_2(\iota ) + \mathrm {iWPHP}(\iota ) + \mathrm {RUB}(\iota )+\text {GFLT}$
is provable in
$\text {VTC}^0_2$
and thus
.
6.1
$\Sigma ^B_1$
-definability of algebraic operations
In this section, we will prove the factorial and binomial coefficient functions are
$\Sigma ^B_1$
-definable when the inputs are from the number sorts. Similarly, we will show that the function computing the powers of high degree polynomials is
$\Sigma ^B_1$
-definable, provided that the exponent is from the number sort. The following two lemmas follow straightforwardly from the provability of the axiom
$\text {IMUL}$
(see Theorem 2.3).
Lemma 6.1 (
$\text {VTC}^0$
)
There is a
$\Sigma ^B_1$
-definition of a function
$x \mapsto x!$
, whose values are objects of the set sort, for which
$\text {VTC}^0_2$
can prove the inductive properties:
$$ \begin{align*} 0!&=1\\ (x+1)!&=(x+1)\cdot x! \end{align*} $$
Lemma 6.2 (
$\text {VTC}^0$
)
There is a
$\Sigma ^B_1$
-definition of a function
$\binom {x}{y}$
, whose values are objects of the set sort, which for
$y\leq x$
satisfies:
$$\begin{align*}\binom{x}{y}=\left \lfloor {\frac{x!}{y!(x-y)!}} \right\rfloor,\end{align*}$$
and otherwise
$\binom {x}{y}=0$
.
The main principle behind the proof of the following Lemma is still the axiom
$\text {IMUL}$
.
Lemma 6.3 (
$\text {VTC}^0$
)
There is a
$\Sigma ^B_1$
-definable function, which to each high degree polynomial P and each number x assigns a high degree polynomial
$P^x$
such that
$\text {VTC}^0_2$
proves for every x and P:
$$ \begin{align*} P^0 &= 1 \\ P^{x+1} & = P\cdot P^{x}. \end{align*} $$
Proof. For
$P= \sum _{i=0}^d A_i{\mathcal {X}}^i$
we define
$P^x$
to be
$\sum _{i=0}^{xd} B_i{\mathcal {X}}^i$
such that for any
$0\leq i \leq xd$
:
$B_i=(\sum _{j_1+\dots +j_x = i}\prod _{k=1}^x A_{j_k}),$
where
$0 \leq j_k \leq n$
. This is
$\Sigma ^B_1$
-definable as both iterated multiplication and iterated addition are.
We shall prove the recursive properties of this function by induction. For
$x=0$
, the statement is clear. Assume the statement holds for x, then
$$ \begin{align*} P\cdot P^{x} &= P \cdot \sum_{i=0}^{xd} \left( \sum_{j_1+\dots + j_x = i}\prod_{l=1}^x A_{j_l}\right) {\mathcal{X}}^i\\ &= \sum_{i=0}^{(x+1)d}\left(\sum_{j+k=i} A_i \cdot\left( \sum_{j_1+\dots + j_x = j}\prod_{l=1}^x A_{j_l}\right) \right){\mathcal{X}}^i\\ &= \sum_{i=0}^{(x+1)d}\left( \sum_{j_1+\dots + j_x + k = i} A_k\prod_{l=1}^x A_{j_l}\right) {\mathcal{X}}^i\\ &= \sum_{i=0}^{(x+1)d}\left( \sum_{j_1+\dots + j_x + j_{x+1} = i} \prod_{l=1}^{x+1} A_{j_l}\right) {\mathcal{X}}^i\\ &= P^{x+1}.\\[-39pt] \end{align*} $$
6.2 The binomial theorem and provability of
$\text {GFLT}$
With the factorial and binomial coefficient functions
$\Sigma ^B_1$
-defined, we will prove the binomial theorem, which then serves as a lemma to prove the
$\text {GFLT}$
axiom.
Lemma 6.4 (
$\text {VTC}^0$
, Pascal’s triangle)
Let
$1 \leq x$
and
$y\leq x$
, then
$$\begin{align*}\binom{x}{y} = \binom{x-1}{y}+\binom{x-1}{y-1}\end{align*}$$
and
$$\begin{align*}\binom{x}{y}y!(x-y)! = x!\end{align*}$$
Proof. By induction on x. If
$x=1$
, we can check that both equations hold. Assume the statement holds for x. Regarding the first equation, we have
$$ \begin{align*} \binom{x}{y}+\binom{x}{y-1}&= \left \lfloor {\frac{x!}{y!(x-y)!}} \right\rfloor+ \left \lfloor {\frac{x!}{(y-1)!(x-y+1)!}} \right\rfloor\\ &= \left \lfloor {\frac{x!(x-y+1)}{y!(x-y+1)!}} \right\rfloor+ \left \lfloor {\frac{x!\cdot y}{y!(x-y+1)!}} \right\rfloor \end{align*} $$
by the second equation in the induction hypothesis, both of the denominators divide the numerators and thus
$$ \begin{align*} \left \lfloor {\frac{x!(x-y+1)}{y!(x-y+1)!}} \right\rfloor+ \left \lfloor {\frac{x!\cdot y}{y!(x-y+1)!}} \right\rfloor = \left \lfloor {\frac{x!\cdot (x+1)}{y!(x+1-y)!}} \right\rfloor &= \binom{x+1}{y}. \end{align*} $$
To prove the second equation, we start with
$$\begin{align*}\binom{x+1}{y}=\binom{x}{y}+\binom{x}{y-1}\end{align*}$$
which we multiply by
$y!(x+1-y)!$
to obtain
$$\begin{align*}\binom{x+1}{y}y!(x+1-y)!=\binom{x}{y}y!(x+1-y)!+\binom{x}{y-1}y!(x+1-y)!\end{align*}$$
which by the application of the induction hypothesis becomes:
$$\begin{align*}\binom{x+1}{y}y!(x+1-y)!=x!(x+1-y)+x!y=x!(x+1)=(x+1)!\\[-42pt]\end{align*}$$
Theorem 6.5 (
$\text {VTC}^0$
)
For any numbers a and b:
$$\begin{align*}({\mathcal{X}}+a)^b=\sum_{i=0}^b \binom{b}{i} {\mathcal{X}}^i a^{b-i}\end{align*}$$
Proof. By induction on b. If
$b=0$
, then both sides evaluate to
$1$
.
Assume the statement holds for b. Then
$$ \begin{align*} ({\mathcal{X}}+a)^{b+1} &= ({\mathcal{X}}+a)({\mathcal{X}}+a)^{b}\\ &= ({\mathcal{X}}+a)\sum_{i=0}^b \binom{b}{i}{\mathcal{X}}^i a^{b-i}\\ &= \left(\sum_{i=0}^b \binom{b}{i}{\mathcal{X}}^{i+1} a^{b-i}\right) + \left(\sum_{i=0}^b \binom{b}{i}{\mathcal{X}}^{i} a^{b+1-i}\right)\\ &= \left(\sum_{i=1}^{b+1} \binom{b}{i-1}{\mathcal{X}}^{i} a^{b+1-i}\right) + \left(\sum_{i=0}^b \binom{b}{i}{\mathcal{X}}^{i} a^{b+1-i}\right)\\ &= {\mathcal{X}}^{b+1} + a^{b+1} + \sum_{i=1}^{b} \left(\binom{b}{i}+\binom{b}{i-1}\right ){\mathcal{X}}^{i} a^{b+1-i}, \end{align*} $$
which by Lemma 6.4 equals
$$\begin{align*}\sum_{i=0}^{b+1} \binom{b+1}{i} {\mathcal{X}}^i a^{b+1-i}.\\[-44pt]\end{align*}$$
Lemma 6.6 (
$\text {VTC}^0_2$
)
Let p be a prime, and let X code a sequence of m elements of the number sort. If for each
$i\leq m:p\nmid X^{[i]}$
, then
$p \nmid \prod _{i=1}^m X^{[i]}$
.
Proof. By induction on m. For
$m\leq 1$
this is clear. Assume the statement holds for m and let
$\tilde X=\prod _{i=1}^m X^{[i]}$
and
$x=X^{(m+1)}$
and assume for contradiction that
$p\mid \tilde X x$
. By Lemma 2.1 there is
$\text {xgcd}(x,p)=(1,u,v)$
such that
$ux+vp=1$
. Multiplying by
$\tilde X$
we get
As both summands on the left hand side are divisible by p, so is
$\tilde X$
, which is a contradiction.
Lemma 6.7 (
$\text {VTC}^0_2$
)
Let p be a prime, then for every
$0<m<p$
we have
$p \mid \binom {p}{m}$
.
Proof. All numbers less than p are not divisible by p, thus by Lemma 6.6 we have that
$p\nmid m!(p-m)!$
, and thus
. On the other hand by Lemma 6.4 we have that
$m!(p-m)! \mid m!$
, therefore the following are equivalent
$$ \begin{align*} \binom{p}{m} &\equiv 0 \ (\mathrm{mod }\ {p})\\ \binom{p}{m}m!(p-m)! &\equiv 0 \ (\mathrm{mod }\ {p}). \end{align*} $$
By the second part of Lemma 6.4 we have that
$$\begin{align*}\binom{p}{m}m!(p-m)! = p! \equiv 0 \ (\mathrm{mod }\ {p}).\\[-42pt]\end{align*}$$
Lemma 6.8 (The theory
$\text {VTC}^0_2$
proves
$\text {GFLT}$
.)
Let p be a prime,
$a\leq p$
a number and
$1^{(r)}$
be a number such that
$r<p$
. Then
where the exponentiation is computed using a
$\mathrm {PV}$
-symbol for exponentiation by squaring modulo
${\mathcal {X}}^r-1$
.
Proof. By Theorem 6.5 we have
$$\begin{align*}({\mathcal{X}}+a)^p=\sum_{i=0}^p \binom{p}{i} {\mathcal{X}}^i a^{p-i},\end{align*}$$
by Lemma 6.7 we get
To obtain the final congruence, we take both sides modulo
${\mathcal {X}}^r-1$
. By Lemma 4.20 and Lemma 6.3 it follows by
$\Sigma ^B_0(\text {card})$
-induction that exponentiation by squaring is equivalent to first taking true exponentiation and then compute the remainder modulo
${\mathcal {X}}^r-1$
.
6.3 Division of high degree polynomials and provability of
$\mathrm {RUB}$
In this section, we will show that the division of high degree polynomials over a bounded field is total in
$\text {VTC}^0_2$
, and thus we can formalize the usual proof of the
$\mathrm {RUB}$
axiom. It is straightforward to find a
$\Sigma^B_0 (\mathrm{card})$
-formula defining a predicate
$P\in F[{\mathcal {X}}]$
formalizing that P is a high degree polynomial over the bounded field F.
Lemma 6.9 (
$\text {VTC}^0_2$
)
Let F be a bounded field, then there is a
$\Sigma ^B_1$
-definable function which to each high degree polynomial
$P\in F[{\mathcal {X}}]$
and a number x assigns a high degree polynomial
$P^x$
and
$\text {VTC}^0_2$
proves for every x and every high degree polynomial
$P\in F[{\mathcal {X}}]$
:
$$ \begin{align*} P^0 &= 1 \\ P^{x+1} &= P \cdot P^x \end{align*} $$
Proof. This can be proved analogously to Lemma 6.3.
Lemma 6.10 (
$\text {VTC}^0_2$
, adapted from [Reference Healy and Viola9])
For every bounded field F and every
$P,S\in F[{\mathcal {X}}]$
there are
$Q,R \in F[{\mathcal {X}}]$
such that
Proof. Without loss of generality, we can assume P and S to be monic. Further let
$\deg P = n$
,
$\deg S = m$
,
$P=\sum _{i=0}^n a_i {\mathcal {X}}^i$
and
$S=\sum _{i=0}^m b_i {\mathcal {X}}^i$
. Define
$S_{\text {R}}=\sum _{i=0}^n a_{n-i}{\mathcal {X}}^i$
and
$S_{\text {R}}=\sum _{i=0}^m b_{m-i}{\mathcal {X}} ^i$
. By Lemma 6.3 and the totality of iterated addition we can define
$\tilde S_{\text {R}} = \sum _{i=0}^{n-m} (1-S_{\text {R}})^i$
.
Then put
$H=P_{\text {R}}\tilde S_{\text {R}}$
, assume
$H=\sum _{i=0}^{2n+m} c_i {\mathcal {X}}^i$
. Finally, define the polynomials
$Q=\sum _{i=0}^{n-m} c_{n-m-i}{\mathcal {X}}^i$
and
$R=f-g\cdot q$
.
Now it just remains to show that
$\deg R < m$
. First notice that
$$ \begin{align*} \tilde S_{\text{R}} S_{\text{R}} &= \tilde S_{\text{R}}(1-(1-S_{\text{R}})) \\ &= \tilde S_{\text{R}}- \tilde S_{\text{R}}(1-S_{\text{R}})\\ &=\left (\sum_{i=0}^{n-m}(1-g_R)^i \right) - \left(\sum_{i=0}^{n-m}(1-g_R)^{i+1}\right)\\ &= 1-(1-S_{\text{R}})^{n-m+1}. \end{align*} $$
Since S is monic,
$1-S_{\text {R}}$
has no constant term and so
$(1-S_R)^{n-m+1}$
has its lowest
$n-m+1$
coefficients with value
$0$
, in other words there exists
$T \in F[{\mathcal {X}}]$
such that
$(1-S_{\text {R}})^{n-m+1}={\mathcal {X}}^{n-m+1}T$
. Let
$d=\deg R$
, assume for contradiction, that
$d\geq m$
. Define
$Q_{\text {R}} = {\mathcal {X}}^{n-m}Q(1/{\mathcal {X}})$
,
$R_{\text {R}} = {\mathcal {X}}^d R(1/{\mathcal {X}})$
. Then
$$ \begin{align*} P &= S\cdot Q + R\\ P(1/{\mathcal{X}}) &= S(1/{\mathcal{X}})\cdot Q(1/{\mathcal{X}}) + R(1/{\mathcal{X}})\\ {\mathcal{X}}^n P(1/{\mathcal{X}}) &= ({\mathcal{X}}^m S(1/{\mathcal{X}})) \cdot ({\mathcal{X}}^{n-m} Q(1/{\mathcal{X}})) + {\mathcal{X}}^{n-d} ({\mathcal{X}}^d R(1/{\mathcal{X}}))\\ P_{\text{R}} &= S_{\text{R}} \cdot Q_{\text{R}} + x^{n-d}R_{\text{R}}. \end{align*} $$
Now since
$H= P_{\text {R}} \tilde S_{\text {R}} = (S_{\text {R}}\cdot Q_{\text {R}} + x^{n-d}R_{\text {R}})\tilde S_{\text {R}} = Q_{\text {R}} (1-(1-S_{\text {R}})^{n-m+1})+{\mathcal {X}}^{n-d} \tilde S_{\text {R}} R_{\text {R}}$
then
${H= Q_{\text {R}} - {\mathcal {X}}^{n-m+1}T + {\mathcal {X}}^{n-d}\tilde S_{\text {R}} R_{\text {R}}}$
. But from the fact that
$n-d < n-m+1$
and
$\tilde S_{\text {R}}$
and
$R_{\text {R}}$
have their constant coefficients equal to
$1$
we obtain that
${\mathcal {X}}^{n-d}\tilde S_{\text {R}} R_{\text {R}}$
has the coefficient of the monomial
${\mathcal {X}}^{n-d}$
nonzero and thus
$Q_{\text {R}}$
is not equal to the lowest
$n-m+1$
coefficients of H, a contradiction.
The following theorem shows provability of
$\mathrm {RUB}$
in
$\text {VTC}^0_2$
. In the original formulation of
$\mathrm {RUB}$
, sparse polynomial are used but every such polynomial determines a high degree polynomial, so the statement we give is actually at least as strong as the original one.
Theorem 6.11 (The theory
$\text {VTC}^0_2$
proves
$\mathrm {RUB}$
.)
There is a
$\Sigma ^B_1$
-definable function
$I_{F,G}(x)$
such that
$\text {VTC}^0_2$
proves:
For every bounded field F and a high degree polynomial
$G\in k[{\mathcal {X}}]$
the function
is injective.
Proof. There is a
$\Sigma ^B_1$
-definable function
$D(F,G,x)$
such that for any bounded field F with bound b on its universe and a high degree polynomial
$G\in F[{\mathcal {X}}]$
we have for all
$m\leq b$
:
$D_{F,G}(x)(m)=\prod _{i\in \{0,\dots ,m-1\},G(i)=0} ({\mathcal {X}}-i)$
.
Claim. For all
$m\leq b$
:
$D_{F,G}(m)\mid G$
.
Proof of claim. By induction on m. For
$m=0$
, we have
$D_{F,G}(0)=1$
and thus
$D_{F,G}(0) \mid G$
. Assume the statement holds for m, that is
$D_{F,G}(m)$
divides G. If
$G(m)\neq 0$
, then
$D_{F,G}(m+1)=D_{F,G}(k) \mid G$
and we are done. Therefore, we assume that
$G(m)=0$
. By the induction hypothesis, there is
$H\in k[{\mathcal {X}}]$
such that
$G = D_{F,G}(m) \cdot H$
. Hence,
$0=G(m)=D_{F,G}(m)\cdot H(m)$
. And since
$D_{F,G}(m) = \prod _{i\in \{0,\dots , m-1\},G(i)=0}(m-i)$
is a product of nonzero elements of k, we have that
$H(m)=0$
. By Lemma 6.10, there are Q and R such that
$H=({\mathcal {X}}-m)Q+R$
, if
$R\neq 0$
, then
$0=H(0) = 0\cdot Q + R \neq 0$
. This implies that
$R=0$
and therefore
$({\mathcal {X}}-m)\cdot Q = H$
. Together we get that
$D_{F,G}(k+1)Q = D_{F,G}(m) ({\mathcal {X}}-m) Q = G_k H = G$
and that
$D_{F,G}(m+1)\mid G$
which proves the claim.
Finally, we can
$\Sigma ^B_1$
-define a function
$I_{F,G}(x)$
such that for any bounded field F with bound b on its universe and a high degree polynomial
$G\in k[{\mathcal {X}}]$
we have for all
$m\in \{0,\dots , b\}:$
$$\begin{align*}I_{F,G}(m) = \begin{cases} 0 & m=0,\\ I_{F,G}(m-1)+1 & \text{else if }D_{F,G}(m-1)\neq D_{F,G}(m),\\ I_{F,G}(m-1) & \text{otherwise.}\\ \end{cases} \end{align*}$$
By induction on m we get that for all
$m\leq b$
we have
and that
$I_{F,G}(-)$
is nondecreasing. Let
$a,b\in k$
such that
$G(a)=G(b)=0$
and
$a<b$
, then
$I_{F,G}(a)<I_{F,G}(b)$
, which shows the injectivity of
$I_{F,G}(x)$
.
Finally, we have everything needed to finish the proof of correctness in the theory
$\text {VTC}^0_2$
.
Theorem 6.12.
$\text {VTC}^0_2$
proves the consequences of the theory
$S^1_2+\mathrm {iWPHP}+\mathrm {RUB}+\text {GFLT}$
restricted to the language of
$\mathrm {PV}$
, that is, the consequences without the symbol
$\iota $
.
Proof. By Theorem 6.11, the theory
$\text {VTC}^0_2$
proves that a
$\Sigma ^B_1$
-definition of
$I_{F,G}(x)$
satisfies the axiom
$\mathrm {RUB}(\iota )$
with
$\iota $
replaced by the definable function
$I_{F,G}(x)$
. By the
$\Sigma ^B_0(\text {card})\text {-}\mathrm {COMP}$
, we can show that it also proves the
$\Sigma ^b_1\text {-LMIN}$
scheme with the symbol
$\iota $
being replaced by the definition of
$I_{F,G}(x)$
.
It is well known that
$\text {VTC}^0$
proves the
$\text {PHP}$
for maps represented by an object of the set sort, by the
$\Sigma ^B_0(\text {card})\text {-}\mathrm {COMP}$
scheme and the
$\Sigma ^B_1$
-definability of
$I_{F,G}(x)$
we obtain that it also proves
$S^1_2 + \mathrm {iWPHP}(\iota )+ \mathrm {RUB}$
with
$\iota $
replaced by the definable map
$I_{F,G}(x)$
. The remaining
$\text {GFLT}$
axiom is provable in
$\text {VTC}^0_2$
by Lemma 5.13.
Using Theorem 6.12 and Theorem 5.46 we obtain the following.
Corollary 6.13. The theory
$\text {VTC}^0_2$
, and consequently the theory
$T^{\text {count}}_2$
, both prove the sentence
.
7 Concluding remarks
In this work, we proved the correctness of the AKS algorithm as a first order sentence in the language of
$\mathrm {PV}$
in the theory
$\text {VTC}^0_2$
. Obtaining such a proof inside
$T_2$
seems to be unlikely as even ordinary Fermat’s Little Theorem implies, over
$T_2$
, an instance of
$\text {PHP}$
which is not known to be provable in
$T_2$
[Reference Jeřábek12]. Therefore, we believe it is natural to ask about the following problem.
Problem 7.1. Does
$T_2 + \text {PHP}(\Sigma ^b_\infty )$
prove the correctness of the AKS algorithm?
We do know, by Jeřábek’s work [Reference Jeřábek12], that
$T_2+\text {PHP}$
proves Fermat’s Little Theorem. Does this imply anything about
$\text {GFLT}$
in
$T_2+\text {PHP}$
?
Problem 7.2. Does
$T_2 + \text {PHP}(\Sigma ^b_\infty )$
prove the
$\text {GFLT}$
axiom?
Showing the unprovability of either of the above statements under some complexity theoretic assumptions is just as interesting. In fact, it is an old problem of Macintyre whether
$I\Delta _0$
proves
$\text {PHP}$
for bounded formulas. It is also tempting to understand the role of the function computed by the polynomial
$({\mathcal {X}} + a)^p$
, or any similar function, in the context of proof complexity generators.
The provability of the implication
, which is a
$\Sigma ^b_1$
-formula, relates to the complexity of total
$\text {NP}$
search problems by well known witnessing theorems. The relevant total problem is: For an input number x either verify it is prime using the AKS algorithm or find a proper divisor. We show provability of this implication in the theory
$S^1_2 + \text {GFLT}$
. Unfortunately, it seems the corresponding witnessing theorem gives only trivial reductions for the factorization problem. It would be interesting to find a provability of this implication in a theory which gives nontrivial witnessing.
The other implication,
, is a
$\Pi ^b_1$
statement and thus relates to propositional proof complexity by results about propositional translations. Our proof in
$\text {VTC}^0_2$
implies a proof in
$U^1_2$
whose corresponding proof system is the quantified sequent calculus G. The theory
$\text {VTC}^0_2$
also proves everything
$T_2$
does, which implies that the proof we obtain by propositional translations should be in a system above every
$G_i$
, but below G.
Problem 7.3. Describe the propositional proof system corresponding to the
$\Pi ^b_1$
-consequences of the theory
$\text {VTC}^0_2$
or alternatively to the theory
$T^{\text {count}}_2$
.
The theory
$S^1_2+\mathrm {RUB}+\mathrm {iWPHP}+\text {GFLT}$
is likely weaker than full
$T^{\text {count}}_2$
. It could also be interesting to find the propositional proof system corresponding to its
$\Pi ^b_1$
-consequences.
Acknowledgment
We are deeply grateful to Emil Jeřábek for his generous and thoughtful feedback on an earlier draft of this work. His comments helped us clarify key arguments, correct important inaccuracies, and his suggestion to consult [Reference Healy and Viola9] was especially valuable. We are grateful to Jan Krajíček and Pavel Pudlák for their comments and guidance. We also thank Eitetsu Ken, Erfan Khaniki, Faruk Göloglu, and Amir Tabatabai for helpful discussions.
Competing interests
The authors have no competing interests to declare.
Financial support
Ondřej Ježil was supported by Charles University Research Center program No. UNCE/24/SCI/022, the project SVV-2025-260837, and by the GA UK project No. 246223.














