User:GrafZahl/Botched attempt to prove JHilbert definition soundness

This page is obsolete! It contains incorrect and misleading information and is preserved for historical curiosity only!

Names
Definition. $$\Sigma$$ is a finite, non-empty set, the characters.

Definition. $$N:=\Sigma^*\setminus\{\epsilon\}$$, that is, the set of all non-empty, finite sequences of characters is the set of names.

Lemma 1. The set of names $$N$$ is countably infinite.

$$N$$ is infinite because $$\Sigma\neq\emptyset$$, and countable because $$\Sigma$$ is finite.

Kinds
Definition. The kinds are a tuple $$(K,\sim)$$ where $$K\subseteq N$$ is finite and $$\sim$$ is an equivalence relation on $$K$$. We denote the set $$K/\sim$$ of all equivalence classes by $$\mathcal{K}$$.

Where no confusion is possible, we shall not distinguish between kinds and equivalence classes of kinds.

Explanation. $$K$$ and $$\sim$$ are user-defined in JHilbert through the  and   commands. The  command adds a new name to $$K$$ which initially is equivalent only to itself. The  command adds a relation between two kinds in $$K$$ to $$\sim$$ (possibly after adding a new name to $$K$$) and completes $$\sim$$ by reflexive, symmetric and transitive closure.

Variables
Definition. A tuple $$(n,k)$$ with $$n\in N$$ and $$k\in\mathcal{K}$$ is a variable. For each variable $$v=(n,k)$$ we denote the projection $$(n,k)\mapsto n$$, the name of $$v$$, by $$N(v)$$, and the projection $$(n,k)\mapsto k$$, the kind of $$v$$, by $$K(v)$$.

Definition. A finite set $$V$$ is called a permissible set of variables if all elements of $$V$$ are variables, and the restriction of the name projection $$N$$ to $$V$$ is injective.

Lemma 2. Let $$V$$ be a permissible set of variables. Then any $$W\subseteq V$$ is also a permissible set of variables.

$$W$$ is finite since $$V$$ is finite. $$W$$ contains only variables since $$W$$ is contained in $$V$$. Finally, the restriction of an injective function remains injective.

Theorem 1. Let $$V$$ be a permissible set of variables. Then for any $$k\in\mathcal{K}$$ there is a $$n\in N$$ such that $$(n,k)\notin V$$ and $$V':=V\cup\{(n,k)\}$$ is a permissible set of variables.

Since $$V$$ is finite, the image $$N(V)$$ is finite as well. Now, $$N$$ is infinite by Lemma 1. Therefore, there exists an $$n\in N\setminus N(V)$$. Since $$n\notin (\left.N\right|_V)^{-1}(N)$$, $$(n,k)\notin V$$. $$V'$$ is finite because $$V$$ and the singleton $$\{(n,k)\}$$ are finite, and $$(n,k)$$ is clearly a variable. Again, since $$n\notin (\left.N\right|_V)^{-1}(N)$$, $$N((n,k))\neq N(v)$$ for all $$v\in V$$. Therefore, the name projection is injective on $$V'$$.

Definition. The variables are a permissible set of variables $$V$$. It is partitioned into three subsets, the named variables $$V_N$$, the unnamed variables $$V_U$$ and the dummy variables $$V_D$$. By Lemma 2, these subsets are also permissible sets of variables.

Explanation. The named variables $$V_N$$ are user-defined in JHilbert through the  command. Unnamed variables and dummy variables are automatically introduced as explained later. Since the empty set is a permissible set of variables, Theorem 1 ensures that such automatic introduction of new variables is always possible. In fact, JHilbert cheats a little by extending $$\Sigma$$ for this purpose, so the namespace for user-defined variables doesn't become polluted.

DV constraints
Definition. Let $$A$$ be a set and $$R\subseteq A\times A$$. Then $$R$$ is called self-avoiding if $$(x,x)\notin R$$ for all $$x\in A$$.

Definition. Let $$R\subseteq A\times A$$. Then the set $$R\setminus\{(x,x):x\in A\}$$ is called the self-avoiding aperture of $$R$$.

Lemma 3. Let $$R\subseteq A\times A$$. Furthermore, let $$R_1$$ be the symmetric closure of the self-avoiding aperture of $$R$$ and $$R_2$$ the self-avoiding aperture of the symmetric closure of $$R$$. Then $$R_1=R_2$$.

Let $$(x,y)\in R_1$$. Then $$(x,y)\in R\setminus\{(x,x):x\in A\}$$ or $$(y,x)\in R\setminus\{(x,x):x\in A\}$$. In particular $$x\neq y$$ and $$(x,y)\in R$$ or $$(y,x)\in R$$. Therefore $$(x,y)$$ is an element of the symmetric closure of $$R$$. Since $$x\neq y$$, $$(x,y)\in R_2$$. If, on the other hand, $$(x,y)\in R_2$$, then $$x\neq y$$ and $$(x,y)\in R$$ or $$(y,x)\in R$$. Therefore $$(x,y)\in R_1$$

Definition. A symmetric, self-avoiding relation on $$V$$ is called a DV constraint.

Definition. Let $$\Delta$$ be a DV constraint. Then we define the set $$A(\Delta):=\{v\in V:\exists w\in V:(v,w)\in\Delta\}$$. If $$A(\Delta)\subseteq V_N$$, then $$\Delta$$ is called a named DV constraint, and if $$A(\Delta)\subseteq V_U$$, then $$\Delta$$ is called an unnamed DV constraint.

Lemma 4. The union of two DV constraints is again a DV constraint. The same holds for named and unnamed DV constraints, respectively.

This follows since the union of two self-avoiding relations is self-avoiding, and likewise the union of two symmetric relations is again symmetric.

Functors
Definition. A tuple $$(n,k,l)$$ with $$n\in N$$, $$k\in\mathcal{K}$$ and $$l\in\mathcal{K}^*$$ is a functor. For each functor $$f=(n,k,l)$$, we denote the projection $$(n,k,l)\mapsto n$$, the name of $$f$$, by $$N(f)$$, and the projection $$(n,k,l)\mapsto k$$, the kind of $$f$$, by $$K(f)$$. Furthermore, we denote the function $$(n,k,l)\mapsto|l|$$, where $$|l|$$ is the length of the sequence $$l$$, the place count of $$f$$, by $$PC(f)$$. For each $$i=1,\ldots,PC(f)$$, we denote by $$IK_i(f)$$ the mapping of $$(n,k,l)$$ to the $$i$$-th projection of $$l$$. We call $$IK_i(f)$$ the $$i$$-th input kind of $$f$$.

Definition. A finite set $$F$$ is called a permissible set of functors if all elements of $$F$$ are functors and the restriction of the name projection $$N$$ to $$F$$ is injective.

Lemma 5. Let $$F$$ be a permissible set of functors. Then any $$G\subseteq F$$ is also a permissible set of functors.

The proof is similar to the proof of Lemma 2.

Definition. The functors are a permissible set of functors $$F$$.

Term functors
Definition. The term functors are a set $$F_T\subseteq F$$. By Lemma 5, term functors are a permissible set of functors.

Explanation. Term functors are user-defined in JHilbert through the  command. However, they are not the only functors as definitions (see below) give rise to further functors.

Expressions
Definition. We define when some element $$e$$ is an expression, and what the kind of $$e$$, $$K(e)$$, is, recursively as follows: We denote the set of all expressions by $$E(V,F)$$.
 * 1) If $$e\in V$$ then $$e$$ is an expression. (In this case, $$K(e)$$ is defined by the definition of the kind of a variable.)
 * 2) If $$e=(f,s)$$ where $$f\in F$$ and $$s$$ is a finite sequence of expressions such that $$PC(f)=|s|$$ and for $$i=1,\ldots,|s|$$ the $$i$$-th element of $$s$$, $$s_i$$, fulfils the equation $$IK_i(f)=K(s_i)$$, then $$e$$ is an expression.
 * 3) Nothing else is an expression.
 * 4) If $$e=(f,s)$$ is an expression, then $$K(e)=K(f)$$.

Lemma 6. The set $$E(V,F)$$ is either finite or countably infinite.

By using polish notation we may consider $$E(V,F)$$ a subset of $$(V\cup F)^*$$. Since both $$V$$ and $$F$$ are finite, that set is finite or countably infinite. Hence $$E(V,F)$$ is finite or countably infinite.

Definition. Let $$e\in E(V,F)$$. Then we define the length of $$e$$, $$|e|$$ recursively as follows:
 * 1) If $$e\in V$$ then $$|e|=1$$.
 * 2) If $$e=(f,s)$$ then $$|e|$$ is the sum of the lengths of the expressions in $$s$$, plus one.

Lemma 7. Let $$e\in E(V,F)$$. Then $$|e|=1$$ if and only if either $$e\in V$$ or $$e=(f,s)$$ with $$PC(f)=0$$ and hence $$s=\epsilon$$.

If $$e\in V$$ or $$e=(f,s)$$ with the stated properties then clearly $$|e|=1$$. Now assume $$e=(f,s)$$ with $$PC(f)\neq 0$$. But then surely $$|e|>1$$ since all expressions in $$s$$ have length at least one.

Definition. Let $$e_1,e_2\in E(V,F)$$. Then we define when $$e_2$$ is a subexpression of $$e_1$$ recursively as follows.
 * 1) If $$e_1\in V$$ then $$e_2$$ is a subexpression of $$e_1$$ if and only if $$e_1=e_2$$.
 * 2) If $$e_1=(f,s)$$ then $$e_2$$ is a subexpression of $$e_1$$ if and only if either $$e_1=e_2$$ or $$e_2$$ is a subexpression of one of the expressions in $$s$$.

Lemma 8. Let $$e_1\in E(V,F)$$ and let $$e_2$$ be a subexpression of $$e_1$$. Then $$|e_2|\leq|e_1|$$ and equality holds if and only if $$e_1=e_2$$.

This follows from the strict monotonicity of the addition of positive integers.

Definition. Let $$e\in E(V,F)$$ and $$f\in F$$. We define when $$f$$ is apparent in $$e$$ recursively as follows:
 * 1) If $$e=(f',\epsilon)$$ then $$f$$ is apparent in $$e$$ if and only if $$f=f'$$.
 * 2) If $$e=(f',s)$$ then $$f$$ is apparent in $$e$$ if and only if either $$f=f'$$ or $$f$$ is apparent in at least one of the expressions in $$s$$.
 * 3) In no other case is $$f$$ apparent in $$e$$.

Definition. Let $$e\in E(V,F)$$ and $$v\in V$$. We define when $$v$$ is apparent in $$e$$ recursively as follows: We denote the set of apparent variables of $$e$$ by $$A(e)$$.
 * 1) If $$e\in V$$ then $$v$$ is apparent in $$e$$ if and only if $$e=v$$.
 * 2) If $$e=(f,s)$$ then $$v$$ is apparent in $$e$$ if and only if it is apparent in at least one of the expressions in $$s$$.

Definition. Let $$W\subseteq V$$ and $$u\colon W\to E(V,F)$$ a map such that all $$w\in W$$ fulfil the equation $$K(w)=K(u(w))$$. Then $$u$$ is called a proper substitution map. We also define the extension $$\tilde{u}$$ of $$u$$ on $$E(V,F)$$ recursively by
 * 1) $$\tilde{u}(w)=u(w)$$ for all $$w\in W$$,
 * 2) $$\tilde{u}(v)=v$$ for all $$v\in V\setminus W$$,
 * 3) $$\tilde{u}((f,(e_1,\ldots,e_n)))=(f,(\tilde{u}(e_1),\ldots,\tilde{u}(e_2)))$$ for all $$(f,(e_1,\ldots,e_n))\in E(V,F)\setminus V$$.

Lemma 9. Let $$u\colon W\to E(V,F)$$ be a proper substitution map. Then the image of the extension $$\tilde{u}(E(V,F))\subseteq E(V,F)$$ and for all $$e\in E(V,F)$$ the equation $$K(e)=K(\tilde{u}(e))$$ holds.

Let $$e\in E(V,F)$$. We have to show that $$\tilde{u}(e)\in E(V,F)$$ and $$K(e)=K(\tilde{u}(e))$$. We prove this by induction over $$|e|$$. First, assume $$|e|=1$$. Then either $$e=(f,\epsilon)$$ in which case $$\tilde{u}(e)=e$$, or $$e\in V$$. If $$e\in V\setminus W$$ then again $$\tilde{u}(e)=e$$. If $$e\in W$$ then $$\tilde{u}(e)=u(e)\in E(V,F)$$ and $$K(\tilde{u}(e))=K(u(e))=K(e)$$ by the definition of a proper substitution map. This proves the statement for $$|e|=1$$. Now assume the statement proven for all expressions of length smaller than $$|e|>1$$. Then $$e=(f,(e_1,\ldots,e_n))$$. By the induction hypothesis, $$(\tilde{u}(e_1),\ldots,\tilde{u}(e_n))$$ is a sequence of expressions. Its length is equal to the length of $$(e_1,\ldots,e_n)$$. The induction hypothesis also implies that for $$i=1,\ldots,n$$ we have $$IK_i(f)=K(e_i)=K(\tilde{u}(e_i))$$. Therefore $$\tilde{u}(e)\in E(V,F)$$. Since $$K(\tilde{u}(e))=K(f)$$ and $$K(e)=K(f)$$, the statement is proven.

Lemma 10. Let $$u\colon W\to E(V,F)$$ be a proper substitution map and $$W'\subseteq W$$. Then the restriction $$\left.u\right|_{W'}$$ is also a proper substitution map and $$\tilde{u}(e)=(\left.u\right|_{W'})^\sim(e)$$ for all $$e\in E(V,K)$$ with $$A(e)\subseteq W'$$.

That $$\left.u\right|_{W'}$$ is also a proper substitution map is clear from the definition. Now let $$e\in E(V,F)$$ such that $$A(e)\subseteq W'$$. We prove the remainder of the statement by induction over $$|e|$$. First, assume $$|e|=1$$. Then either $$e=(f,\epsilon)$$ in which case the statement is clear, or $$e\in V$$, in which case it follows by $$e\in W'$$. Now, for the case $$|e|>1$$ we have $$e=(f,(e_1,\ldots,e_n))$$ and since clearly $$A(e_i)\subseteq A(e)$$ for $$i=1,\ldots,n$$, the statement follows in this case also from the induction hypothesis.

Definition. Let $$e_1,e_2\in E(V,F)$$. Then $$e_2$$ arises from $$e_1$$ by proper substitution if there is a proper substitution map $$u\colon A(e_1)\to E(V,F)$$ such that $$\tilde{u}(e_1)=e_2$$.

Lemma 11. Let $$e_1=(f_1,(e_{11},\ldots,e_{1n}))$$ and $$e_2=(f_2,(e_{21},\ldots,e_{2m}))$$ be expressions. Assume furthermore that $$e_2$$ arises from $$e_1$$ by proper substitution. Then $$f_1=f_2$$, $$n=m$$ and if $$u\colon A(e_1)\to E(V,F)$$ is a proper substitution map such that $$\tilde{u}(e_1)=e_2$$ then $$(\left. u\right|_{A(e_{1i})})^\sim(e_{1i})=e_{2i}$$ for all $$i=1,\ldots,n$$.

That $$f_1=f_2$$ and $$n=m$$ is clear. The remainder of the statement follows from the definition of a proper substitution map and Lemma 11.

Lemma 12. Let $$e_1,e_2\in E(V,F)$$ be such that $$e_2$$ arises from $$e_1$$ by proper substitution. Then the proper substitution map $$u\colon A(e_1)\to E(V,F)$$ such that $$\tilde{u}(e_1)=e_2$$ is unique.

Assume there are two such maps $$u_1,u_2\colon A(e_1)\to E(V,F)$$ which are different. Then there is a $$v\in A(e_1)$$ such that $$u_1(v)\neq u_2(v)$$. We proceed with an induction over $$|e_1|$$. If $$|e_1|=1$$, then either $$e_1=(f,\epsilon)$$ in which case $$A(e_1)=\emptyset$$, so $$u_1,u_2$$ cannot be distinct, or $$e_1\in V$$. In this case, $$e_1=v$$ since $$v$$ is apparent in $$e_1$$. But then $$u_1(e_1)\neq u_2(e_1)$$, which is absurd. Now assume the statement proven for all expressions of length smaller than $$|e_1|>1$$. Then $$e_1=(f,(e_{11},\ldots,e_{1n}))$$, so there must be a positive integer $$1\leq i\leq n$$ such that $$\tilde{u}_1(e_{1i})\neq\tilde{u}_2(e_{1i})$$ since $$v$$ must be apparent in one of the $$e_{1i}$$. But this contradicts the induction hypothesis in combination with Lemma 11.

Definition. Let $$(f,s)$$ be an expression. Then $$f$$ is called the head functor of $$(f,s)$$.

Definitions
Definition. We define the definition functors as $$F_D:=F\setminus F_T$$.

Definition. Let $$l\in V^*$$. Write $$l=(v_1,\ldots,v_n)$$. Then we set $$K(l):=(K(v_1),\ldots,K(v_n))\in\mathcal{K}^*$$.

Definition. Let $$d=(n,\Delta,l,e)$$ with $$n\in N$$, $$\Delta$$ a DV constraint, $$l\in V_U^*$$ and $$e\in E(V,K)$$ with $$A(\Delta)\subseteq A(e)$$ such that $$F(d):=(n,K(e),K(l))\in F_D$$. Assume furthermore that for all $$v\in A(e)$$ either $$v$$ occurs in $$l$$ or $$v\in V_D$$. Then $$d$$ is called a definition-like tuple.

Definition. Let $$D$$ be a set of definition-like tuples such that $$F\colon D\to F_D$$ is bijective. Assume furthermore that there exists a function $$\beta$$, the depth, defined on $$F$$ and $$E(V,F)$$, with values in $$\mathbb{Z}_{\geq 0}$$ such that all of the following properties hold: Then $$D$$ is called a valid set of definitions for $$F_D$$.
 * 1) $$\beta(f)=0$$ for all $$f\in F_T$$.
 * 2) $$\beta(v)=0$$ for all $$v\in V$$.
 * 3) For all $$(f,s)\in E(V,F)\setminus V$$, $$\beta((f,s))=\beta(f)$$.
 * 4) For all $$f\in F_D$$ the definition-like tuple $$F^{-1}(f)=(n,\Delta,l,e)$$ fulfils the property that $$\beta(f)>\beta(e')$$ for all subexpressions $$e'$$ of $$e$$. Specifically, $$\beta(f)=\beta(e)+1$$.
 * 5) For each $$v\in V_D$$ there is exactly one $$f\in F_D$$ such that for the definition-like tuple $$F^{-1}(f)=(n,l,e)$$ the property $$v\in A(e)$$ holds.

Explanation. The definitions of JHilbert, user-defined via the  command fulfil the above properties of a valid set of definitions. When new  commands are evaluated, $$F_D$$, $$V_U$$ and $$V_D$$ are grown accordingly. Theorem 1 ensures that this is always possible. There are, of course, many valid sets of definitions. From now on, we shall assume $$D$$ to be one arbitrary such set.

Lemma 13. The set $$D$$ is finite.

Since $$F$$ is finite, so is $$F_D$$. The finiteness of $$D$$ now follows from the bijectivity of $$F\colon D\to F_D$$.

Lemma 14. If $$f\in F_D$$ then $$\beta(f)>0$$.

This follows from the definition of $$\beta$$.

Definition. Let $$e\in E(V,F)$$. Then we define the maximum depth of $$e$$ as $$\hat{\beta}(e):=\max\beta(e')$$, where $$e'$$ runs over all subexpressions of $$e$$.

Definition. Let $$e=(f,(e_1,\ldots,e_m))\in E(V,F)\setminus V$$ be an expression such that $$f\in F_D$$ and let $$(n,\Delta,(v_1,\ldots,v_m),e')=F^{-1}(f)$$. Define the proper substitution map $$u$$ by setting $$u(v_i)=e_i$$ for $$i=1,\ldots,m$$. Then $$\tilde{u}(e')$$ is called the unfolding of $$e$$.

Lemma 15. Let $$e=(f,(e_1,\ldots,e_m))\in E(V,F)\setminus V$$ be an expression such that $$f\in F_D$$ and let $$e'$$ be the unfolding of $$e$$. Then $$K(e)=K(e')$$.

By definition, there is a proper substitution map such that $$\tilde{u}(e')=e$$. The claim now follows from lemma 9.

Lemma 16. Let $$e_1,e_2\in E(V,F)$$. If $$e_2$$ is the unfolding of $$e_1$$ then $$\beta(e_1)=\beta(e_2)+1$$ and $$\hat{\beta}(e_1)\geq\hat{\beta}(e_2)$$.

Since $$e_1$$ has an unfolding, it has a head functor which is a definition functor. The first claim now results from the definition of $$\beta$$. The second claim follows since by the definition of $$D$$, all apparent functors of $$e_2$$ which are not apparent functors of $$e_1$$ have lower depth than $$e_1$$.

Definition. Let $$e\in E(V,F)$$. Then we define the complete unfolding of $$e$$, $$CUF(e)$$ recursively as follows. Lemma 16 ensures that the recursion in this definition terminates.
 * 1) If $$e\in V$$ then $$CUF(e)=e$$.
 * 2) If $$e=(f,(e_1,\ldots,e_m))$$ with $$f\in F_T$$ then $$CUF(e)=(f,(CUF(e_1),\ldots,CUF(e_m)))$$ (see lemma 17 for justification of this definition).
 * 3) If the head functor of $$e$$ is a definition functor and $$e'$$ is the unfolding of $$e$$ then $$CUF(e)=CUF(e')$$.

Lemma 17. Let $$e\in E(V,F)$$. Then $$K(e)=K(CUF(e))$$.

If $$e\in V$$ this is clear. If $$e=(f,(e_1,\ldots,e_m))$$ with $$f\in F_T$$, then $$K(CUF(e_i))=K(e_i)$$ for $$i=1,\ldots,m$$ implies $$K(CUF(e))=K((f,(CUF(e_1),\ldots,CUF(e_m))))=K(f)=K(e)$$. If the head functor of $$e$$ is a definition functor and $$e'$$ is the unfolding of $$e$$, then $$K(CUF(e'))=K(e')$$ and lemma 16 together imply that $$K(CUF(e))=K(e)$$. The whole statement now follows by induction as suggested by lemma 16.

Lemma 18. Let $$e\in E(V,F)$$. Then all apparent functors of $$CUF(e)$$ are term functors. In other words, $$\hat{\beta}(e)=0$$.

Due to the definition of $$CUF$$, $$\beta(f)=0$$ for all apparent functors of $$e$$. Hence the claim follows from Lemma 14.

Definition. We denote the subset of $$E(V,F)$$ of expressions all of whose apparent functors are term functors by $$E(V,F_T)$$.

Lemma 19. $$CUF$$ is an idempotent operation.

Let $$e\in E(V,F_T)$$. By Lemma 18 it is sufficient to show that $$CUF(e)=e$$. If $$|e|=1$$, this follows by direct calculation. Assume the statement proven for expressions of length smaller than $$|e|>1$$. Then $$e=(f,(e_1,\ldots,e_m))$$ and $$CUF(e)=CUF((f,(e_1,\ldots,e_m)))=(f,CUF(e_1),\ldots,CUF(e_m))=(f,(e_1,\ldots,e_m))=e$$ by induction hypothesis.

Definition. Let $$e\in E(V,F)$$. Then a variable $$v\in V$$ occurs in $$e$$ if $$v\in A(CUF(e))$$. We denote the set of all variables occurring in $$e$$ by $$O(e)$$.

Lemma 20. Let $$e\in E(V,F)$$. Then $$O(e)\setminus V_D\subseteq A(e)$$.

By the definition of $$D$$, the only new variables an unfolding of a subexpression of $$e$$ can incur are dummy variables.

Definition. Let $$u$$ be a proper substitution map and $$R\subseteq V\times V$$. Then we extend $$\tilde{u}$$ to $$R$$ by $$\tilde{u}(R):=\bigcup\limits_{(v,w)\in R}O(\tilde{u}(v))\times O(\tilde{u}(w))$$.

Lemma 21. Let $$R\subseteq V\times V$$ be a symmetric relation and $$u$$ a proper substitution map. Then $$\tilde{u}(R)$$ is also a symmetric relation.

Let $$(v,w)\in \tilde{u}(R)$$, then there is a $$(v',w')\in R$$ such that $$(v,w)\in O(\tilde{u}(v'))\times O(\tilde{u}(w'))$$. Now, $$R$$ is symmetric, so $$(w',v')\in R$$ and thus $$O(\tilde{u}(w'))\times O(\tilde{u}(v'))\subseteq\tilde{u}(R)$$. This proves the lemma.

Note that the application of a proper substitution map to a DV constraint does not necessarily yield a DV constraint.

Lemma 22. Let $$u_1,u_2$$ be proper substitution maps. Then $$u\colon V\to E(V,F)$$, $$u(v):=\tilde{u}_1(CUF(\tilde{u}_2(v)))$$ is also a proper substitution map with $$CUF\circ\tilde{u}=CUF\circ\tilde{u}_1\circ CUF\circ\tilde{u}_2\circ CUF$$ on $$E(V,F)$$ and $$\tilde{u}=\tilde{u}_1\circ\tilde{u}_2$$ on $$R\subseteq V\times V$$.

Let $$v\in V$$, then we have $$K(u(v))=K(\tilde{u}_1(CUF(\tilde{u}_2(v))))$$, by lemma 9, $$=K(CUF(\tilde{u}_2(v)))$$, by lemma 18, $$=K(\tilde{u}_2(v))$$, again by lemma 9, $$=K(v)$$. By definition, $$\tilde{u}=\tilde{u}_1\circ CUF\circ\tilde{u}_2\circ CUF$$ on $$V$$. If $$e=(f,(e_1,\ldots,e_m))$$ with $$f\in F_T$$, and if the statement is already proven for $$e_1,\ldots,e_m$$, then $$CUF(\tilde{u}(e))=(f,(CUF(\tilde{u}(e_1)),\ldots,CUF(\tilde{u}(e_m))))=(f,(CUF(\tilde{u}_1(CUF(\tilde{u}_2(CUF(e_1))))),\ldots,CUF(\tilde{u}_1(CUF(\tilde{u}_2(CUF(e_m))))))=CUF(\tilde{u}_1(CUF(\tilde{u}_2(CUF(e)))))$$. Lastly, if the statement has already been proven for $$CUF(e)$$, then the statement follows by idempotence. The whole statement now follows for $$E(V,F)$$ by induction as suggested by lemma 16. Now finally, due to the definition of an occurring variable, $$O(CUF(\tilde{u}_2(CUF(v))))=O(\tilde{u}_2(v))$$. This implies the statement for $$R\subseteq V\times V$$.

Definition. Let $$\Delta$$ be a symmetric relation on $$V$$ and $$e$$ an expression. Then $$(\Delta,e)$$ is called an extended expression. For an extended expression $$(\Delta,e)$$ we define $$DV((\Delta,e)):=\Delta$$ and $$EXP((\Delta,e)):=e$$.

Definition. Let $$e\in E(V,F)$$. Then we define the extended complete unfolding $$ECUF(e)$$ recursively as follows. Again, lemma 16 guarantees that the recursion in this definition terminates.
 * 1) If $$e\in V$$ then $$ECUF(e)=(\emptyset,e)$$.
 * 2) If $$e=(f,(e_1,\ldots,e_m))$$ with $$f\in F_T$$ then $$ECUF(e):=(\Delta,(f,(CUF(e_1),\ldots,CUF(e_m)))$$, where $$\Delta=\bigcup\limits_{i=1}^mDV(ECUF(e_i))$$.
 * 3) If $$e=(f,(e_1,\ldots,e_m))$$ with $$f\in F_D$$ and $$e'$$ is the unfolding of $$e$$ with unfolding map $$u$$, then $$ECUF(e)=(\Delta,CUF(e'))$$, where $$\Delta=\tilde{u}(DV(F^{-1}(f)))\cup DV(ECUF(e'))$$.

Lemma 23. Let $$e\in E(V,F)$$, then $$EXP(ECUF(e))=CUF(e)\in E(V,F_T)$$.

This follows from the definition and lemma 17.

Statements
Definition. A tuple $$s=(n,\Delta,h,e)$$ with $$n\in N$$, $$\Delta$$ a DV constraint, $$h\subseteq E(V,F)$$ a finite set, and $$e\in E(V,F)$$ is a generalised statement if the following additional properties are fulfilled: We define the name, $$A(s):=n$$, the DV constraints $$DV(s):=\Delta$$, the hypotheses $$H(s):=h$$, the number of hypotheses $$NH(s):=|h|$$, and the consequent $$C(s):=e$$. We also define the mandatory variables of $$s$$ to be $$M(s):=A(s)\setminus\bigcup A(h)$$ and the occurring variables $$O(s):=O(e)\cup\bigcup O(h)$$. If $$s$$ fulfils precisely the same properties except that $$V$$ is replaced by $$V_N$$, then $$s$$ is a pending statement. If $$s$$ fulfils precisely the same properties except that $$V$$ is replaced by $$V_U$$ and $$A(\Delta)\subseteq A(s)$$, then $$s$$ is a statement.
 * $$A(e)\subseteq V$$ and $$A(e')\subseteq V$$ for all $$e'\in h$$. In other words, $$A(s)\subseteq V$$, where we define $$A(s):=A(e)\cup\bigcup A(h)$$,

Definition. A finite set $$S$$ is called a permissible set of statements if all elements of $$S$$ are statements and the restriction of the name projection $$N$$ to $$S$$ is injective.

Lemma 24. Let $$S$$ be a permissible set of statements. Then any $$S'\subseteq S$$ is also a permissible set of statements.

The proof is similar to the proof of Lemma 2.

Definition. Let $$s$$ be a generalised statement. Then we set $$CUF(s):=(N(s),DV(s)\cup\bigcup\limits_{h\in H(s)}DV(ECUF(h))\cup DV(ECUF(C(s)),CUF(H(s)),CUF(C(s)))$$. Let $$u$$ be a proper substitution map. Now define We extend $$\tilde{u}$$ to $$s$$ by setting $$\tilde{u}(s):=s':=(n',\Delta'_{A(s)},h',c')$$. Note that the restriction on $$\Delta'$$ has no effect if $$\tilde{u}$$ is applied to $$CUF(s)$$.
 * $$n':=N(s)$$,
 * $$\Delta':=\tilde{u}(DV(s))$$,
 * $$h':=\tilde{u}(H(s))$$,
 * $$c':=\tilde{u}(C(s))$$.

Lemma 25. Let $$s$$ be a pending statement and let $$u\colon A(s)\to V_U$$ be an injective proper substitution map. Then $$\tilde{u}(s)$$ is a statement. We call such a statement an anonymisation of $$s$$.

Since $$u$$ is injective, $$\tilde{u}(DV(s))$$ is self-avoiding and therefore a DV constraint by lemma 21. The remainder of the lemma is clear.

Explanation. First, statements are user-defined in JHilbert using the  and   commands (where the   statements have first to be derived as defined below). The user writes the statements as pending statements which are subsequently anonymised by introducing new unnamed variables that replace the named ones in the pending statement. Note that by theorem 1, it is always possible to introduce new unnamed variables if necessary for the anonymisation.

Definition. Let $$S$$ be a permissible set of statements, $$s$$ be a pending statement and $$u_D\colon V_N\setminus O(s)\to V_D$$ an injective proper substitution map. Assume $$\Delta^s:=DV(s)\cup\bigcup\limits_{h\in H(s)}DV(ECUF(h))\cup DV(ECUF(C(s)))$$ is a DV constraint. Then we define the sets $$Cl(S,s,u_D)_k\subseteq\wp(V\times V)\times E(V,F_T)$$ for $$k\in\mathbb{Z}_{\geq 0}$$ recursively as follows.
 * 1) $$Cl(S,s,u_D)_0:=ECUF(H(s))$$.
 * 2) For all $$s'\in S$$, all proper substitution maps $$u$$ and all DV constraints $$\Delta$$, $$(\Delta,CUF(\tilde{u}(CUF(C(s')))))\in Cl(S,s,u_D)_k$$ whenever all of the following are true:
 * $$\tilde{u}(DV(s')\cup DV(ECUF(C(s'))))\subseteq\Delta$$.
 * $$A(\tilde{u}(v))\subseteq V_N$$ for all $$v\in M(s')$$.
 * For all $$h\in H(s')$$, some $$(\Delta',CUF(\tilde{u}(CUF(h))))\in\bigcup\limits_{j=0}^{k-1}Cl(S,s,u_D)_j$$, where $$\tilde{u}(DV(ECUF(h)))\subseteq\Delta'\subseteq\Delta$$.
 * $$\tilde{u}_D(\Delta)\subseteq\Delta^s$$.

We call the union $$Cl(S,s,u_D):=\bigcup\limits_{k\in\mathbb{Z}_{\geq 0}}Cl(S,s,u_D)_k$$ the (preliminary definition of) closure of $$s$$ with respect to $$S$$ and $$u_D$$. The statement $$s$$ is called provable from $$S$$ if there exists a $$u_D$$ and an $$e\in Cl(S,s,u_D)$$ such that $$\tilde{u}_D(EXP(e))=CUF(C(s))$$.

Lemma 26. Let $$S$$ be a permissible set of statements, $$s$$ be a pending statement and $$u_D\colon V_N\setminus O(s)\to V_D$$ an injective proper substitution map. Then for all $$(\Delta,e)\in Cl(S,s,u_D)$$, $$\tilde{u}_D(\Delta)\subseteq\Delta^s$$.

The only case where this is not clear is when $$(\Delta,e)\in Cl(S,s,u_D)_0$$. But since the domain of $$u_D$$ excludes $$O(s)$$, $$\tilde{u}_D$$ acts identically on $$ECUF(H(s))$$. Hence the lemma follows.

Lemma 27. Let $$S$$ be a permissible set of statements, $$s$$ be a pending statement and $$u_1,u_2\colon V_N\setminus O(s)\to V_D$$ proper substitution maps whose images coincide. Then $$(\Delta,e)\in Cl(S,s,u_1)$$ if and only if $$((u_2^{-1}\circ u_1)^\sim(\Delta)),(u_2^{-1}\circ u_1)^\sim(e))\in Cl(S,s,u_2)$$.

This follows since $$u_1,u_2$$ map variables to variables and are injective.

Lemma 28. Let $$S$$ be a permissible set of statements and $$s$$ a pending statement which is provable from $$S$$ via $$u_1\colon V_N\setminus O(s)\to V_D$$. Then $$s$$ is provable from $$s$$ via any $$u_D\colon V_N\setminus O(s)\to V_D$$ whose image coincides with $$u_1$$.

So we have some $$(\Delta,e)\in Cl(S,s,u_1)$$ such that $$\tilde{u}_1(e)=CUF(C(s))$$. Now, $$\tilde{u}_D((u_D^{-1}\circ u_1)^\sim(e))=\tilde{u}_1(e)$$. The statement now follows from lemma 27.

This lemma shows that the map $$u_D$$ is rather immaterial as far as provability is concerned. It merely irons out some choice of named variables which serve as placeholders for dummy variables. A JHilbert user could obviate the need for different $$u_D$$ altogether by maintaining a batch of named variables in one-to-one correspondence with dummy variables such that this batch never occurs in any statement (though in reality such bookkeeping would be rather cumbersome). Therefore we can make the following simplified definition for provability.

Definition. Let $$S$$ be a permissible set of statements and $$s$$ a generalised statement. Assume $$\Delta^s:=DV(s)\cup\bigcup\limits_{h\in H(s)}DV(ECUF(h))\cup DV(ECUF(C(s)))$$ is a DV constraint. Then we define the sets $$Cl_S(s)_k\subseteq\wp(V\times V)\times E(V,F_T)$$ for $$k\in\mathbb{Z}_{\geq 0}$$ recursively as follows.
 * 1) $$Cl_S(s)_0:=ECUF(H(s))$$.
 * 2) For all $$s'\in S$$, all proper substitution maps $$u$$ and all DV constraints $$\Delta\subseteq\Delta^s$$, $$(\Delta,CUF(\tilde{u}(CUF(C(s')))))\in Cl_S(s)_k$$ whenever all of the following are true:
 * $$\tilde{u}(DV(s')\cup DV(ECUF(C(s'))))\subseteq\Delta$$.
 * For all $$h\in H(s')$$, some $$(\Delta',CUF(\tilde{u}(CUF(h))))\in\bigcup\limits_{j=0}^{k-1}Cl_S(s)_j$$, where $$\tilde{u}(DV(ECUF(h)))\subseteq\Delta'\subseteq\Delta$$.

We call the union $$Cl_S(s):=\bigcup\limits_{k\in\mathbb{Z}_{\geq 0}}Cl_S(s)_k$$ the (final definition of) closure of $$s$$ with respect to $$S$$ and $$u_D$$. The statement $$s$$ is called provable from $$S$$ if there exists an $$e\in Cl_S(s)$$ such that $$EXP(e)=CUF(C(s))$$.

Lemma 29. Let $$S$$ be a permissible set of statements, $$s$$ a generalised statement and $$u$$ a proper substitution map such that $$\tilde{u}(CUF(s))$$ is also a generalised statement. Then if $$s$$ is provable from $$S$$, so is $$\tilde{u}(CUF(s))$$.

Let $$s$$ be provable from $$S$$, then there is a $$(\Delta,e)\in Cl_S(s)$$ such that $$e=CUF(C(s))$$. Assume first that $$(\Delta,e)\in Cl_S(s)_0$$. Then $$(\Delta,e)\in ECUF(H(s))$$, and hence $$(\tilde{u}(\Delta),CUF(\tilde{u}(e)))\in ECUF(H(\tilde{u}(CUF(s))))=Cl_S(\tilde{u}(CUF(s)))_0$$. Now let $$k\in\mathbb{Z}_{>0}$$ and assume that $$(\Delta',e')\in Cl_S(s)_j$$ implies $$(\tilde{u}(\Delta'),CUF(\tilde{u}(e')))\in Cl_S(\tilde{u}(CUF(s)))_j$$ for $$j=0,\ldots,k-1$$. Let $$(\Delta,e)\in Cl_S(s)_k$$. Let $$s'\in S$$ be the statement and $$u'$$ be the proper substitution map giving rise to $$(\Delta,e)$$. Then $$\tilde{u}'(DV(s')\cup DV(ECUF(C(s'))))\subseteq\Delta$$ and thus $$\tilde{u}(\tilde{u}'(DV(s')\cup DV(ECUF(C(s')))))\subseteq\tilde{u}(\Delta)$$. Furthermore, for each $$h\in H(s')$$ there is a $$\Delta'$$ such that $$\tilde{u}'(DV(ECUF(h)))\subseteq\Delta'\subseteq\Delta$$ and $$(\Delta',CUF(\tilde{u}'(CUF(h))))\in\bigcup\limits_{j=0}^{k-1}Cl_S(s)_j$$. Hence $$\tilde{u}(\tilde{u}'(DV(ECUF(h)))\subseteq\tilde{u}(\Delta')\subseteq\tilde{u}(\Delta)$$ and, by induction hypothesis, $$(\tilde{u}(\Delta'),CUF(\tilde{u}(CUF(\tilde{u}'(CUF(h))))))\in\bigcup\limits_{j=0}^{k-1}Cl_S(\tilde{u}(CUF(s)))_j$$. Since $$CUF\circ\tilde{u}\circ CUF\circ\tilde{u}'\circ CUF$$ arises from a proper substitution map by lemma 22 and $$CUF$$ is idempotent, it follows that $$(\tilde{u}(\Delta),CUF(\tilde{u}(e)))=(\tilde{u}(\Delta),CUF(\tilde{u}(CUF(\tilde{u}'(CUF(C(s')))))))\in Cl_S(\tilde{u}(CUF(s)))_k$$.

Lemma 30. Let $$S_1$$ be a permissible set of statements, $$s_1\in S_1$$, and set $$S_2:=S_1\setminus\{s_1\}$$. Assume $$s_1$$ is an anonymisation of $$s_2$$ such that $$s_2$$ is provable from $$S_2$$. Then all pending statements $$s$$ which are provable from $$S_1$$ are also provable from $$S_2$$.

Let $$u_A$$ be an anonymisation map which transports $$s_2$$ to $$s_1$$. Let $$s$$ be a pending statement which is provable from $$S_1$$. Let $$(\Delta,e)\in Cl_{S_1}(s)$$ be such that $$e=CUF(C(s))$$. Now, assume first that $$(\Delta,e)\in Cl_{S_1}(s)_0$$. Then $$(\Delta,e)\in ECUF(H(s))=Cl_{S_2}(s)_0\subseteq Cl_{S_2}(s)$$. Next, let $$k\in\mathbb{Z}_{>0}$$ and assume that $$\bigcup\limits_{j=0}^{k-1}Cl_{S_1}(s)_j\subseteq Cl_{S_2}(s)$$ and $$(\Delta,e)\in Cl_{S_1}(s)_k$$. Let $$s'\in S$$ and $$u$$ be a proper substitution map such that $$e=CUF(\tilde{u}(CUF(C(s'))))$$. Then $$\Delta\subseteq\Delta^s$$, $$\tilde{u}(DV(s')\cup DV(ECUF(C(s'))))\subseteq\Delta$$, and for all $$h\in H(s')$$ there is a $$\Delta'\subseteq\Delta$$ such that $$(\Delta',CUF(\tilde{u}(CUF(h))))\in\bigcup\limits_{j=0}^{k-1}Cl_{S_1}(s)$$ and $$\tilde{u}(DV(ECUF(h)))\subseteq\Delta'$$. Now, $$(\Delta',CUF(\tilde{u}(CUF(h))))\in Cl_{S_2}(s)$$ by induction hypothesis. So if $$s'\in S_2$$, it follows that $$(\Delta,e)\in Cl_{S_2}(s)$$. Otherwise, $$s'=s_1$$. In this case, $$CUF(s)=\tilde{u}(CUF(s_1))$$ is a generalised statement. Since $$u_A$$ is injective with domain $$A(s_2)$$, $$\tilde{u}(CUF(s_1))=\tilde{u}(CUF(\tilde{u}_A(s_2)))=\tilde{u}(\tilde{u}_A(CUF(s_2)))$$. Hence $$s$$ is provable from $$S_2$$ by lemma 29.

Due to this lemma, we need only consider closures $$Cl_S(s)$$ where $$S$$ is a set of axioms, presumably logically independent.

Implementation of Metamath first order logic in JHilbert
In this section we implement the first order logic part of the Metamath proof explorer in JHilbert. Our interface is as follows: kind (set) kind (class) kind (wff) var (set x y z) var (wff φ χ ψ) term (class (cv set)) term (wff (= class class)) term (wff (∈ class class)) term (wff (¬ wff)) term (wff (→ wff wff)) term (wff (∀ set wff)) stmt (ax-mp (φ (φ → χ)) χ) stmt (ax-gen (φ) (∀ x φ)) stmt (ax-1  (φ → (χ → φ))) stmt (ax-2  ((φ → (χ → ψ)) → ((φ → χ) → (φ → ψ)))) stmt (ax-3  (((¬ φ) → (¬ χ)) → (χ → φ))) stmt (ax-4  ((∀ x φ) → φ)) stmt (ax-5  ((∀ x (φ → χ)) → ((∀ x φ) → (∀ x χ)))) stmt (ax-6  ((¬ (∀ x φ)) → (∀ x (¬ (∀ x φ))))) stmt (ax-7  ((∀ x (∀ y φ)) → (∀ y (∀ x φ)))) stmt (ax-8  (((cv x) = (cv y)) → (((cv x) = (cv z)) → ((cv y) = (cv z))))) stmt (ax-9  (¬ (∀ x (¬ ((cv x) = (cv y)))))) stmt (ax-10  ((∀ x ((cv x) = (cv y))) → (∀ y ((cv y) = (cv x))))) stmt (ax-11  (((cv x) = (cv y)) → ((∀ x φ) → (∀ x (((cv x) = (cv y)) → φ))))) stmt (ax-12  ((¬ (∀ z ((cv z) = (cv x)))) → ((¬ (∀ z ((cv z) = (cv y)))) →  (((cv x) = (cv y)) → (∀ z ((cv x) = (cv y))))))) stmt (ax-13  (((cv x) = (cv y)) → (((cv x) ∈ (cv z)) → ((cv y) ∈ (cv z))))) stmt (ax-14  (((cv x) = (cv y)) → (((cv z) ∈ (cv x)) → ((cv z) ∈ (cv y))))) stmt (ax-15  ((¬ (∀ z ((cv z) = (cv x)))) → ((¬ (∀ z ((cv z) = (cv y)))) →  (((cv x) ∈ (cv y)) → (∀ z ((cv x) ∈ (cv y))))))) stmt (ax-17 ((φ x)) (φ → (∀ x φ))) Note that we do not need  due to. Also note that we do not need any variables of kind.

From now on we consider some JHilbert proof module which imports only the above interface but otherwise has arbitrary valid content. In what follows we shall make frequent references to the formalisation of Metamath as done in Appendix C of the Metamath book.

Note that the above interface serves only an exemplary purpose. Our methodology is sufficiently general to work with any valid representation of a Metamath database, for the correct meaning of "valid". We shall now describe the translation of certain JHilbert data structures to Metamath.

Definition. Let $$CN:=\{,\mathrm{set},\mathrm{class},\mathrm{wff},=,\in,\neg,\rightarrow,\forall,\vdash\}$$, $$VR:=V$$ and $$T:=\{(t,v):v\in VR, t=K(v)\}$$ (in particular, the first component of all elementf of $$T$$ is one of $$\mathrm{set},\mathrm{class},\mathrm{wff}$$).

Definition. We define the mapping $$MM$$ from JHilbert expressions to Metamath expressions recursively as follows:
 * 1) For all $$\texttt{v}\in V$$, $$MM(\texttt{(cv~v)})=MM(\texttt{v})=\texttt{v}$$.
 * 2) For expressions $$A,B$$ of type , $$MM(\texttt{(}A\texttt{=}B\texttt{)})=MM(A)\texttt{=}MM(B)$$.
 * 3) For expressions $$A,B$$ of type , $$MM(\texttt{(}A\in B\texttt{)})=MM(A)\texttt{e.}MM(B)$$.
 * 4) For an expression $$A$$ of type , $$MM(\texttt{(}\neg A\texttt{)})=\texttt{-.}MM(A)$$.
 * 5) For expressions $$A,B$$ of type , $$MM(\texttt{(}A\rightarrow B\texttt{)})=\texttt{(}MM(A)\texttt{->}MM(B)\texttt{)}$$.
 * 6) For expressions $$A,B$$ of type   and   respectively, $$MM(\texttt{(}\forall A B\texttt{)})=\texttt{A.}MM(A) MM(B)$$.
 * 7) For all $$e\in E(V,F)$$, set $$MM(e)=MM(CUF(e))$$.
 * 8) Prepend a turnstile symbol $$\texttt{|-}$$ if necessary.

Definition. We extend $$MM$$ to relations $$R\subseteq V\times V$$ by $$MM(R):=\{\{v,w\}:(v,w)\in R\wedge (w,v)\in R\}$$.

Definition. We extend $$MM$$ to map generalised JHilbert statements $$s$$ to Metamath pre-statements $$PS:=(D,T,H,A)$$ as follows: Then $$MM(s):=PS$$.
 * 1) Set $$D:=MM(DV(s)\cup\bigcup\limits_{h\in H(s)}DV(ECUF(h))\cup DV(ECUF(C(s)))$$.
 * 2) Set $$H:=MM(H(s))$$.
 * 3) Set $$A:=MM(C(s))$$.

Definition. Let $$\Gamma$$ be the set of Metamath statements representing the functors and axioms given above (note that  is rendered as an "invisible" functor in Metamath). We shall then consider the Metamath formal system $$\mathfrak{F}:=(CN,VR,\Gamma)$$. We denote the Metamath universe of $$\mathfrak{F}$$ by $$\mathfrak{U}$$.

Example. The Metamath reduct of $$MM(\texttt{ax-11})$$ is $$(\emptyset,\{(\mathrm{set},x),(\mathrm{set},y),(\mathrm{wff},\varphi)\},\emptyset,\vdash (x=y\rightarrow(\forall x\varphi\rightarrow\forall x(x=y\rightarrow\varphi))))$$.

Lemma 31. There is a unique map $$JH$$ from Metamath expressions to $$E(V,F_T)$$ such that for all Metamath expressions $$E$$ which are valid with respect to $$\mathfrak{F}$$, $$MM(JH(E))=E$$, and for all $$e\in E(V,F)$$, $$JH(MM(e))=CUF(e)$$.

We have $$VR=V$$, and the only JHilbert functor not appearing in $$CN$$ is. However, whether to use  or not can be determined by the relevant functor's input kinds.

Definition. Let $$u$$ be a JHilbert proper substitution map. Then we define $$MM(u)$$, defined on valid Metamath expressions, by $$(MM(u))(E):=MM(\tilde{u}(JH(E)))$$.

Soundness of JHilbert
In order to prove the soundness of JHilbert, we must show that each pending JHilbert statement for which a JHilbert proof exists, is provable in Metamath as well (this proves soundness under the assumption that Metamath is sound as well). This means that for each provable JHilbert statement $$s$$ we must show that the reduct of $$MM(s)$$ is in $$\mathfrak{U}$$. Essentially, we show this by induction over the minimum number of steps a proof must have. According to lemma 30, it is sufficient to consider the permissible set of JHilbert statements $$S$$ defined by,  ,   through   and.

Lemma 32. Let $$s$$ be a pending JHilbert statement. Let $$(\Delta,e)\in Cl_S(s)$$. Then $$MM(e)\in Cl(MM(s))$$.

If $$(\Delta,e)\in Cl_S(s)_0$$, then $$e\in CUF(H(s))$$ and thus $$MM(e)\in MM(CUF(H(s))=MM(H(s)))$$. Let $$k\in\mathbb{Z}_{>0}$$ and assume the statement proven for $$(\Delta,e)\in\bigcup\limits_{j=0}^{k-1}Cl_S(s)_j$$. Let $$(\Delta,e)\in Cl_S(s)_k$$. Then $$\Delta\subseteq\Delta^s$$ and hence $$MM(\Delta)\subseteq D$$. Let $$s'\in S$$ be the statement and $$u$$ be the proper substitution map giving rise to $$(\Delta,e)$$. Let $$(D_M',T_M',H',A'):=MM(s')$$. Then $$(MM(u))(T_M')\subseteq Cl(MM(s))$$ by the properness of $$u$$. Furthermore, $$(MM(u))(H')=MM(\tilde{u}(JH(H')))=MM(\tilde{u}(JH(MM(H(s')))))=MM(\tilde{u}(CUF(H(s'))))=MM(CUF(\tilde{u}(CUF(H(s')))))$$, by induction hypothesis, $$\subseteq Cl(MM(s))$$. Finally, let $$\{v,w\}\in D_M'$$. Then $$(v,w)\in DV(s')\cup\bigcup\limits_{h\in H(s')}DV(ECUF(h))\cup DV(ECUF(C(s')))$$. Assume first that $$(v,w)\in DV(s')\cup DV(ECUF(C(s')))$$. Then $$MM(\tilde{u}(\{(v,w)\}))\subseteq MM(\tilde{u}(DV(s')\cup DV(ECUF(C(s')))))\subseteq MM(\Delta)\subseteq D$$. Otherwise, there is an $$h\in H(s')$$ such that $$(v,w)\in DV(ECUF(h))$$. By definition, there is a $$\Delta'\subseteq\Delta$$ for this $$h$$ such that $$\tilde{u}(DV(ECUF(h)))\subseteq\Delta'$$. This implies $$MM(\tilde{u}(\{(v,w)\}))\subseteq MM(\Delta)\subseteq D$$. Hence, by definition of Metamath closure, $$MM(e)=MM(CUF(\tilde{u}(CUF(C(s')))))=MM(\tilde{u}(CUF(C(s'))))=(MM(u))(MM(C(s')))=(MM(u))(A')\in Cl(MM(s))$$.

Theorem 2. Let $$s$$ be a pending JHilbert statement provable from $$S$$. Then the reduct of $$MM(s)$$ is in $$\mathfrak{U}$$, that is $$MM(s)$$ is provable in Metamath.

Let $$(\Delta,e)\in Cl_S(s)$$ be such that $$e=CUF(C(s))$$. By lemma 32, $$MM(e)\in Cl(MM(s))$$. Now the assertion of $$MM(s)$$ is $$MM(C(s))=MM(CUF(C(s)))=MM(e)$$. Hence, $$MM(s)$$ is a provable pre-statement, so its reduct belongs to $$\mathfrak{U}$$.