222 Predicate Encoding of the Core: Logic, ZFC, Categories, Type Theory, Algebra

Thesis. The essential content of five formal frameworks can be carried by four predicates. Membership, composition, typing, and divisibility all reduce to combinations of \(\mathsf {Eq}\), \(\mathsf {Comp}\), \(\mathsf {Lev}\), and \(\mathsf {Tr}\); objects become derived notions; and the three classical paradoxes are blocked by a single axiom, the irreflexivity of \(\mathsf {Lev}\).

The four primitives
\begin{equation} \boxed { \begin {array}{ll} \mathsf {Eq}(s,t) & \text {identity}\\ \mathsf {Comp}(s,t,u) & \text {composition, } u=s\ast t\\ \mathsf {Lev}(s,t) & \text {grading, } s\ \text {below}\ t\\ \mathsf {Tr}(\varphi ) & \text {truth} \end {array}} \tag{13830}\end{equation}

Derived notions.

\begin{equation} \mathsf {Sub}(s,t):\equiv \mathsf {Comp}(s,t,t), \qquad \mathsf {Mem}(s,t):\equiv \mathsf {Sub}(s,t)\wedge \mathsf {Lev}(s,t), \tag{13831}\end{equation}
\begin{equation} \mathsf {Obj}(a):\equiv \mathsf {Comp}(a,a,a), \qquad \mathsf {Id}(a):\equiv \mathsf {Eq}(a,a). \tag{13832}\end{equation}
I. Logic
\begin{equation} \mathsf {And}(\varphi ,\psi ,\chi ), \qquad \mathsf {Or}(\varphi ,\psi ,\chi ), \qquad \mathsf {Not}(\varphi ,\psi ), \tag{13833}\end{equation}
with the truth clauses as schemes:
\begin{equation} \mathsf {And}(\varphi ,\psi ,\chi ) \;\Rightarrow \; \bigl (\mathsf {Tr}(\chi )\leftrightarrow \mathsf {Tr}(\varphi )\wedge \mathsf {Tr}(\psi )\bigr ). \tag{13834}\end{equation}
The three laws of thought:
\begin{equation} \boxed {\mathsf {Eq}(a,a)} \quad \text {(identity)}, \qquad \boxed {\neg \mathsf {Eq}(a,\neg a)} \quad \text {(non-contradiction)}, \tag{13835}\end{equation}
\begin{equation} \boxed {\mathsf {Tr}(\varphi )\vee \mathsf {Tr}(\neg \varphi )} \quad \text {(excluded middle)}. \tag{13836}\end{equation}
II. ZFC



Axiom Predicate form


Extensionality \(\mathsf {Sub}(s,t)\wedge \mathsf {Sub}(t,s)\to \mathsf {Eq}(s,t)\)
Pairing \(\mathsf {Comp}(s,t,u)\) (grammar supplies \(u\))
Union associativity of \(\mathsf {Comp}\)
Power Set the predicate \(\mathsf {Sub}(\cdot ,t)\) itself
Separation \(\mathsf {Sub}(s,t)\wedge \varphi (s)\)
Infinity unbounded generation of terms
Replacement \(\mathsf {Comp}\)-preserving rewriting
Foundation \(\neg \mathsf {Lev}(t,t)\)
Choice uniqueness of normal form


\begin{equation} \boxed {\text {nine axioms on three predicates}.} \tag{13837}\end{equation}
III. Categories
\begin{equation} \mathsf {Arr}(f), \qquad \mathsf {Src}(f,a), \qquad \mathsf {Tgt}(f,b), \qquad \mathsf {Cmp}(f,g,h), \qquad \mathsf {IdA}(a,f). \tag{13838}\end{equation}
Associativity and units:
\begin{equation} \mathsf {Cmp}(f,g,h)\wedge \mathsf {Cmp}(h,k,m) \;\leftrightarrow \; \mathsf {Cmp}(g,k,n)\wedge \mathsf {Cmp}(f,n,m), \tag{13839}\end{equation}
\begin{equation} \mathsf {IdA}(a,e)\wedge \mathsf {Src}(f,a) \;\Rightarrow \; \mathsf {Cmp}(e,f,f). \tag{13840}\end{equation}
Objects are not primitive:
\begin{equation} \boxed {\mathsf {Obj}(a):\equiv \exists e\,\mathsf {IdA}(a,e) \quad \text {--- objects are derived from identity arrows}.} \tag{13841}\end{equation}
IV. Type theory
\begin{equation} \mathsf {Typed}(a,A), \qquad \mathsf {Univ}(U), \qquad \mathsf {Sig}(A,B,C), \qquad \mathsf {Pi}(A,B,C), \qquad \mathsf {IdT}(A,a,b,C). \tag{13842}\end{equation}
Typing is graded:
\begin{equation} \mathsf {Typed}(a,A)\wedge \mathsf {Typed}(A,U) \;\Rightarrow \; \mathsf {Lev}(a,A), \tag{13843}\end{equation}
and universes are barred from self-typing:
\begin{equation} \boxed {\mathsf {Univ}(U)\wedge \mathsf {Typed}(U,V) \;\Rightarrow \; \mathsf {Lev}(U,V)\ \wedge \ \neg \mathsf {Lev}(U,U).} \tag{13844}\end{equation}
V. Algebra
\begin{equation} \mathsf {Add}(s,t,u), \qquad \mathsf {Mul}(s,t,u), \tag{13845}\end{equation}
\begin{equation} \mathsf {Div}(f,g):\equiv \exists h\,\mathsf {Mul}(f,h,g), \qquad \mathsf {Root}(a,p), \qquad \mathsf {Van}(a,f):\equiv \mathsf {Root}(a,f). \tag{13846}\end{equation}
Both \(\mathsf {Add}\) and \(\mathsf {Mul}\) are instances of \(\mathsf {Comp}\) with different axioms — idempotence present or absent (Section 221.2).
VI. Verification

Russell.

\begin{equation} \mathsf {Mem}(t,t) \;\Rightarrow \; \mathsf {Lev}(t,t) \;\Rightarrow \; \bot . \tag{13847}\end{equation}

Girard.

\begin{equation} \mathsf {Typed}(U,U) \;\Rightarrow \; \mathsf {Lev}(U,U) \;\Rightarrow \; \bot . \tag{13848}\end{equation}

Burali-Forti. An order containing itself would require \(\mathsf {Lev}(\Omega ,\Omega )\), likewise excluded.

\begin{equation} \boxed {\neg \mathsf {Lev}(t,t)\ \text {blocks all three paradoxes}.} \tag{13849}\end{equation}

Depth.

\begin{equation} \text {maximal }\mathsf {Lev}\text {-chain} =|\operatorname {ran}(\mathsf {Lev})|-1 , \tag{13850}\end{equation}
recovering the results of Section 212.2.
VII. The summary table




Field core notion predicate



logic truth \(\mathsf {Tr}\)
logic identity \(\mathsf {Eq}\)
ZFC membership \(\mathsf {Sub}\wedge \mathsf {Lev}\)
ZFC foundation \(\neg \mathsf {Lev}(t,t)\)
categories composition \(\mathsf {Comp}\)
categories object \(\mathsf {Comp}(a,a,a)\)
type theory typing \(\mathsf {Lev}\)
type theory universe \(\neg \mathsf {Lev}(U,U)\)
algebra operation \(\mathsf {Comp}\)
algebra divisibility existence of \(\mathsf {Comp}\)



\begin{equation} \boxed {\text {four predicates, five fields}.} \tag{13851}\end{equation}

The encoding makes one structural fact visible that the separate formalisms obscure: identity and grading differ exactly in their behaviour at the diagonal.

\begin{equation} \boxed {\mathsf {Eq}(a,a)\ \text {holds}, \qquad \neg \mathsf {Lev}(t,t)\ \text {is required}.} \tag{13852}\end{equation}
Identity applies to itself; grading must not. Every paradox treated in this work — Russell’s, Girard’s, Burali-Forti’s — is an attempt to make the grading reflexive, and every classical repair — Foundation, the universe hierarchy, ramified types — is a way of forbidding it. Stated in predicates, the three repairs are one axiom, and the distinction between the frameworks is a matter of which derived notions they choose to name.

222.1 Below the Predicate: Application, Arity, and the Binary Floor

Predicates are not primitive: \(P(x)\) already presupposes a symbol, a term, and the act of applying one to the other. Application is the more basic notion, and application is binary. Descending further — to unary predicates, to rewriting, to a single constant — does not reach below two places, because a relation with fewer than two relata relates nothing. Two is the floor, for symbols and for arity alike.

Step 1: What a predicate presupposes
\begin{equation} P(x) \tag{13853}\end{equation}
requires three things at once:
\begin{equation} \boxed {\text {predicate}=\text {symbol}+\text {term}+\text {application}.} \tag{13854}\end{equation}
Application is therefore prior: a predicate is one instance of it.
Step 2: Keeping only application
\begin{equation} P(x)=\mathrm {App}(P,x), \qquad \boxed {\text {predicates}\subset \text {application}.} \tag{13855}\end{equation}
This is exactly the combinatory setting of Section 220.1, which has \(S\), \(K\), and application, and no predicates at all. The identity computation
\begin{equation} SKKx=Kx(Kx)=x \tag{13856}\end{equation}
uses four applications and no predicate.
Step 3: Application is binary
\begin{equation} \mathrm {App}(f,x) \;\Longrightarrow \; \text {two places}. \tag{13857}\end{equation}
Attempting to reduce to one place by using rewriting instead,
\begin{equation} t\rightsquigarrow t' , \tag{13858}\end{equation}
does not help: this too relates two terms, \(t\) and \(t'\).
\begin{equation} \boxed {\text {a relation has at least two places}.} \tag{13859}\end{equation}
Step 4: Unary predicates are binary in disguise

Consider a one-place predicate such as

\begin{equation} \mathsf {Halt}(t). \tag{13860}\end{equation}
Deciding it requires comparing \(t\) with its normal form,
\begin{equation} t\rightsquigarrow ^{*}\mathrm {nf}, \tag{13861}\end{equation}
which is again a two-term comparison. More generally, asserting \(P(x)\) separates \(x\) from what fails \(P\):
\begin{equation} P(x) \;\Longrightarrow \; x\ \text {distinguished from}\ \neg P\ \text {cases}, \tag{13862}\end{equation}
\begin{equation} \boxed {\text {a unary predicate is defined against its complement}.} \tag{13863}\end{equation}
Step 5: Zero places

With no places there is a single expression,

\begin{equation} \top , \tag{13864}\end{equation}
and hence no distinction:
\begin{equation} \operatorname {Aut}(\{\top \})=\{\mathrm {id}\}, \qquad \text {nothing computed, nothing stated}. \tag{13865}\end{equation}
Step 6: Arity tabulated




arity form status



\(0\) \(\top \) no expression
\(1\) \(P(x)\) reduces to binary
\(2\) \(R(x,y)\) minimal sufficient
\(\geq 3\) \(R(x,y,z)\) iterated binary



Higher arities are recovered by currying:

\begin{equation} \mathsf {Comp}(s,t,u) \iff \mathrm {App}\bigl (\mathrm {App}(\oplus ,s),t\bigr )=u . \tag{13866}\end{equation}
\begin{equation} \boxed {\text {binary is the floor}.} \tag{13867}\end{equation}
Step 7: Why two is minimal

To relate is to relate something to something. One relatum leaves nothing to relate it to; zero leaves nothing at all. The requirement is not a limitation of notation but the content of the word:

\begin{equation} \text {relation} \;\Longrightarrow \; \text {relata} \;\Longrightarrow \; \text {at least two}. \tag{13868}\end{equation}
Step 8: The descent




Level primitives reducible to



predicate \(P(x)\) \(P\), \(x\), \(\mathrm {App}\) application
application \(\mathrm {App}(f,x)\) \(f\), \(x\) binary relation
rewriting \(t\rightsquigarrow t'\) \(t\), \(t'\) binary relation
binary \(R(x,y)\) \(x\), \(y\) irreducible
unary \(P(x)\) \(x\) binary (with complement)
nullary \(\top \) — no expression



\begin{equation} \text {predicate} \;\longrightarrow \; \text {application} \;\longrightarrow \; \text {binary relation} \;\longrightarrow \; \text {halt}. \tag{13869}\end{equation}
Closure

The descent through arity ends where the descent through symbols ended:

\begin{equation} \boxed { \begin {array}{ll} \text {symbols }n\geq 2: & \text {computation possible}\\ \text {arity }2: & \text {relation possible}\\ \text {either below }2: & \text {nothing expressible} \end {array}} \tag{13870}\end{equation}
Two symbols and two places are the minimum, and they are the same minimum found earlier in other guises — the spectrum \(\{0,1\}\), the group \(\mathbb {Z}_2\), the law \(A\neq \neg A\). Predicates were treated as primitive throughout this work for convenience; what is actually primitive is application, and what application requires is a pair. The elimination cannot proceed past that point, since a system with fewer than two places has nothing to apply and nothing to distinguish.

222.2 Set Notation as Abbreviation: \(x\in \{A,\neg A\}\) and \(x\in \{a_1,\dots ,a_n\}\)

Thesis. Two of the most basic uses of braces — membership in a complementary pair, and membership in a finite list — are abbreviations for disjunctions. We give eight encodings of each, none using \(\{\,\}\), \(\in \), or the ellipsis, and observe that stripping the notation from the first leaves the excluded middle, and from the second leaves a finite disjunction of identities.

Part I: \(x\in \{A,\neg A\}\)

What the notation bundles.

\begin{equation} x\in \{A,\neg A\} \quad \text {requires}\quad \begin {cases} \text {forming the pair }\{A,\neg A\}\\ \text {the relation }\in \\ \text {the claim that }x\ \text {is one of the two} \end {cases} \tag{13871}\end{equation}

1. Disjunction of identities.

\begin{equation} \boxed {x\in \{A,\neg A\} \;\longrightarrow \; \mathsf {Eq}(x,A)\vee \mathsf {Eq}(x,\neg A).} \tag{13872}\end{equation}
Check: for \(x=A\) the left disjunct holds; for an unrelated \(B\) both fail.

2. Excluded middle directly.

\begin{equation} \boxed {x\in \{A,\neg A\} \;\longrightarrow \; \mathsf {Tr}(x)\vee \mathsf {Tr}(\neg x),} \tag{13873}\end{equation}
since the truth value is already two-valued, \(\mathsf {Tr}(x)\in \{0,1\}\).

3. A single unary predicate.

\begin{equation} \mathsf {Bin}(x):\equiv \mathsf {Eq}(x,A)\vee \mathsf {Eq}(x,\neg A). \tag{13874}\end{equation}
By Section 222.1 this unary predicate is binary in substance, comparing \(x\) with \(A\).

4. Characteristic function.

\begin{equation} \chi (A)=1, \qquad \chi (\neg A)=0, \qquad x\in \{A,\neg A\} \;\longrightarrow \; \chi (x)\ \text {is defined}. \tag{13875}\end{equation}

5. Type.

\begin{equation} x:\mathsf {Bool}, \qquad \mathsf {Bool}::=\mathsf {true}\ \mid \ \mathsf {false}. \tag{13876}\end{equation}
The grammar has exactly two constructors; no collection is formed.

6. Grading.

\begin{equation} \mathsf {Lev}(x)=0\ \vee \ \mathsf {Lev}(x)=1 , \tag{13877}\end{equation}
the two-element range of the grading function.

7. Equations.

\begin{equation} x\otimes x=x \ \wedge \ x\oplus \neg x=1 . \tag{13878}\end{equation}
Solving \(x^2=x\) gives \(x\in \{0,1\}\); the equations characterise the Boolean elements.

8. Combinators.

\begin{equation} \mathsf {true}:=K, \qquad \mathsf {false}:=KI, \qquad x\,a\,b= \begin {cases} a & x=\mathsf {true}\\ b & x=\mathsf {false} \end {cases} \tag{13879}\end{equation}
Two-valuedness is the selection behaviour itself.

Comparison.




Encoding form uses \(\{\,\}\)



1. disjunction \(\mathsf {Eq}(x,A)\vee \mathsf {Eq}(x,\neg A)\) no
2. excluded middle \(\mathsf {Tr}(x)\vee \mathsf {Tr}(\neg x)\) no
3. unary predicate \(\mathsf {Bin}(x)\) no
4. characteristic fn. \(\chi (x)\) defined no
5. type \(x:\mathsf {Bool}\) no
6. grading \(\mathsf {Lev}(x)\in \{0,1\}\) no
7. equations \(x\otimes x=x\) no
8. combinators \(x\,a\,b\) no



What remains after stripping.

\begin{equation} \boxed { \begin {array}{ll} \text {original:} & x\in \{A,\neg A\}\\ \text {minimal:} & \mathsf {Eq}(x,A)\vee \mathsf {Eq}(x,\neg A)\\ \text {smaller:} & \mathsf {Tr}(x)\vee \mathsf {Tr}(\neg x)\\ \text {root:} & A\vee \neg A \end {array}} \tag{13880}\end{equation}
\begin{equation} \boxed {\{A,\neg A\}\ \text {is }A\vee \neg A\ \text {made into an object}.} \tag{13881}\end{equation}
The set notation objectifies the excluded middle, in the order the historical record shows: the logical law precedes the set-theoretic encoding of it.
Part II: \(x\in \{a_1,\dots ,a_n\}\)

What the notation bundles. Besides braces and \(\in \), the ellipsis presupposes an enumeration and tacit finiteness.

1. Recursive disjunction.

\begin{equation} \mathsf {In}_1(x):\equiv \mathsf {Eq}(x,a_1), \qquad \mathsf {In}_{k+1}(x):\equiv \mathsf {In}_k(x)\vee \mathsf {Eq}(x,a_{k+1}). \tag{13882}\end{equation}
For \(n=3\): \(\bigl (\mathsf {Eq}(x,a_1)\vee \mathsf {Eq}(x,a_2)\bigr ) \vee \mathsf {Eq}(x,a_3)\), true at \(x=a_2\).

2. A term in System E.

\begin{equation} t:=a_1\oplus a_2\oplus \cdots \oplus a_n, \qquad \boxed {x\in \{a_1,\dots ,a_n\} \;\longrightarrow \; x\sqsubseteq t \iff x\oplus t=t .} \tag{13883}\end{equation}
Check at \(x=a_2\): \(a_2\oplus t=t\) by idempotence.

3. Characteristic function by recursion.

\begin{equation} \chi _1(x)=\mathrm {eq}(x,a_1), \qquad \chi _{k+1}(x)=\max \bigl (\chi _k(x),\mathrm {eq}(x,a_{k+1})\bigr ), \tag{13884}\end{equation}
with \(\chi _n(x)=1\) iff \(x\) is one of them.

4. Roots of a polynomial.

\begin{equation} p(X):=(X\ominus a_1)\otimes (X\ominus a_2)\otimes \cdots \otimes (X\ominus a_n), \qquad \boxed {x\in \{a_1,\dots ,a_n\}\;\longrightarrow \;p(x)=0.} \tag{13885}\end{equation}
Check with \(n=2\), \(a_1=1\), \(a_2=2\): \(p(X)=X^2-3X+2\), and \(p(1)=0\), \(p(3)=2\neq 0\). This is the predicate \(\mathsf {Root}\) of Section 221.2.

5. List grammar.

\begin{equation} \ell ::=\mathsf {nil}\ \mid \ \mathsf {cons}(a,\ell ), \tag{13886}\end{equation}
\begin{equation} \mathsf {Mem}(x,\mathsf {nil}):\equiv \bot , \qquad \mathsf {Mem}(x,\mathsf {cons}(a,\ell )):\equiv \mathsf {Eq}(x,a)\vee \mathsf {Mem}(x,\ell ). \tag{13887}\end{equation}
The ellipsis disappears: the grammar generates the list, and \(n\) need not be named.

6. Selection predicate.

\begin{equation} \mathsf {Sel}(i,a)\quad \text {``the $i$-th item is $a$''}, \qquad \mathsf {Sel}(1,x)\vee \cdots \vee \mathsf {Sel}(n,x), \tag{13888}\end{equation}
the existential over indices being finite and hence expandable.

7. Church encoding.

\begin{equation} L:=\lambda f.\,f\,a_1\,a_2\cdots a_n , \tag{13889}\end{equation}
with membership a fold over \(L\); the list is a function, not a collection.

8. Item predicate.

\begin{equation} \mathsf {Item}(a_1),\ \dots ,\ \mathsf {Item}(a_n), \qquad \forall y\bigl (\mathsf {Item}(y)\to \mathsf {Eq}(y,a_1)\vee \cdots \bigr ), \tag{13890}\end{equation}
so that \(x\in \{a_1,\dots ,a_n\}\) becomes \(\mathsf {Item}(x)\).

Comparison.





Encoding form \(\{\,\}\) \(\dots \)




1. recursive disjunction \(\mathsf {In}_k(x)\) no no
2. term \(x\sqsubseteq t\) no no
3. characteristic fn. \(\chi _n(x)=1\) no no
4. polynomial \(p(x)=0\) no no
5. list grammar \(\mathsf {Mem}(x,\ell )\) no no
6. selection \(\bigvee _i\mathsf {Sel}(i,x)\) no no
7. Church fold over \(L\) no no
8. item predicate \(\mathsf {Item}(x)\) no no




The infinite case. A list cannot hold infinitely many items, but a coinductive stream can:

\begin{equation} s::=\mathsf {cons}(a,s), \qquad \mathsf {Mem}(x,s):\equiv \exists n\,\mathsf {Eq}\bigl (x,\mathsf {nth}(n,s)\bigr ), \tag{13891}\end{equation}
with the index generated by the numeral grammar \(i::=0\mid s(i)\).

What remains after stripping.

\begin{equation} \boxed { \begin {array}{ll} \text {original:} & x\in \{a_1,\dots ,a_n\}\\ \text {term:} & x\oplus (a_1\oplus \cdots \oplus a_n) =a_1\oplus \cdots \oplus a_n\\ \text {polynomial:} & \textstyle \prod _i(x\ominus a_i)=0\\ \text {list:} & \mathsf {Mem}(x,\ell )\ \text {by recursion}\\ \text {logic:} & \bigvee _i\mathsf {Eq}(x,a_i) \end {array}} \tag{13892}\end{equation}
\begin{equation} \boxed {\{a_1,\dots ,a_n\}\ \text {is a name for } \mathsf {Eq}(\cdot ,a_1)\vee \cdots \vee \mathsf {Eq}(\cdot ,a_n).} \tag{13893}\end{equation}
Both notations are abbreviations for disjunctions of identities, and in each case eight independent encodings recover the content without braces, membership, or ellipsis. The first strips to the excluded middle: \(\{A,\neg A\}\) is the objectification of \(A\vee \neg A\). The second strips to a finite disjunction, with the ellipsis replaced by recursion or by a grammar that generates the list without naming its length. In neither case is the collection doing work that the disjunction does not already do — which is why every encoding succeeds, and why the historical order (logical law first, set notation afterwards) is the order of dependence as well.

222.3 Implementations Already Do This

Thesis. The encoding derived in Section 222.2 — grammar plus recursion, with no braces, no membership primitive, and no ellipsis — is not a proposal. It is what proof assistants and functional languages have implemented for decades. Writing the definition out in code forces three things that informal set notation conceals: explicit finiteness, an explicit recursion, and, in the proof-relevant setting, explicit witnesses.

Step 1: The target

Our encoding 5 was

\begin{equation} \mathsf {Mem}(x,\mathsf {nil}):\equiv \bot , \qquad \mathsf {Mem}\bigl (x,\mathsf {cons}(a,\ell )\bigr ) :\equiv \mathsf {Eq}(x,a)\ \vee \ \mathsf {Mem}(x,\ell ), \tag{13894}\end{equation}
over the grammar
\begin{equation} \ell ::=\mathsf {nil}\ \mid \ \mathsf {cons}(a,\ell ). \tag{13895}\end{equation}
Step 2: Coq
Inductive list (A : Type) : Type :=
  | nil  : list A
  | cons : A -> list A -> list A.

Fixpoint In (a : A) (l : list A) : Prop :=
  match l with
  | nil     => False
  | b :: m  => b = a \/ In a m
  end.

Line by line: nil => False is \(\mathsf {Mem}(x,\mathsf {nil})=\bot \), and b :: m => b = a \/ In a m is \(\mathsf {Eq}(x,a)\vee \mathsf {Mem}(x,\ell )\).

Step 3: Agda — membership as a datatype
data List (A : Set) : Set where
  []  : List A
  _::_ : A -> List A -> List A

data _in_ {A : Set} (x : A) : List A -> Set where
  here  : forall {xs} -> x in (x :: xs)
  there : forall {y xs} -> x in xs -> x in (y :: xs)

Here membership is not a proposition but an inductive type whose inhabitants are positions. This makes the witness structure visible in the source: for

\begin{equation} x\in (x::x::[\,]) \tag{13896}\end{equation}
there are two distinct inhabitants,
\begin{equation} \texttt {here} \qquad \text {and}\qquad \texttt {there here}, \tag{13897}\end{equation}
\begin{equation} \boxed {\texttt {here}\neq \texttt {there here} \quad \text {--- two witnesses of one membership}.} \tag{13898}\end{equation}
This is the witness multiplicity computed in Remark 209.3, appearing as a matter of course in a working implementation: which occurrence is meant is data, not a side condition.
Step 4: Lean
inductive List (a : Type u) where
  | nil  : List a
  | cons : a -> List a -> List a

def Mem (a : a) : List a -> Prop
  | .nil       => False
  | .cons b bs => a = b \/ Mem a bs

Identical in shape to the Coq definition.

Step 5: Haskell
elem :: Eq a => a -> [a] -> Bool
elem _ []     = False
elem x (y:ys) = x == y || elem x ys

The Eq a constraint is the decidability requirement: returning Bool rather than a proposition demands that equality be decidable. Otherwise the recursion is the same.

Step 6: The correspondence




Our encoding Implementation Result type



\(\mathsf {Mem}(x,\mathsf {nil})=\bot \) nil => False —
\(\mathsf {Eq}(x,a)\vee \mathsf {Mem}(x,\ell )\) b = a \/ In a m —
grammar \(\ell ::=\mathsf {nil}\mid \mathsf {cons}\) Inductive list —



Coq In proposition Prop
Lean Mem proposition Prop
Agda _in_ witness type Set
Haskell elem decision Bool



\begin{equation} \boxed {\text {four implementations, one recursion}.} \tag{13899}\end{equation}
Step 7: What the code forces

No ellipsis. The notation \(\{a_1,\dots ,a_n\}\) has no counterpart; a list is built by constructors, and \(n\) is never named.

Explicit finiteness. Every inhabitant of List A is finite by construction, since the type is inductively generated. Infinite sequences require a separate, coinductive declaration — exactly the distinction drawn at the end of Section 222.2:

codata Stream (A : Set) : Set where
  _::_ : A -> Stream A -> Stream A

Explicit recursion. Membership is not a primitive relation but a function defined by cases on the constructors, which is why it terminates and why it can be computed.

Explicit witnesses (Agda). Proof-relevant membership records the position, so two occurrences of the same element give two inhabitants. Informal notation writes \(x\in \{x,x\}\) and discards the distinction; the implementation cannot.

Step 8: Where the practices diverge




informal mathematics implementation



list \(\{a_1,\dots ,a_n\}\) inductive type
length implicit in “\(\dots \)” structural
membership primitive \(\in \) defined recursion
witnesses discarded data (Agda)
finiteness assumed enforced by the type
decidability assumed a constraint (Eq a)



\begin{equation} \boxed {\text {the encoding is standard practice in implementation and unusual only in informal prose}.} \tag{13900}\end{equation}

Nothing in Section 222.2 is a novel proposal about how membership might be defined; it is a transcription of what every proof assistant does. The interest lies in what the transcription reveals. Informal set notation hides the recursion, hides the finiteness assumption, hides the decidability assumption, and — in the proof-relevant case — hides the witnesses, since \(x\in \{x,x\}\) is written once although it holds in two ways. An implementation cannot hide any of these, because each must be supplied before the definition type-checks. That the same recursion appears in Coq, Lean, Agda, and Haskell, with the differences confined to the result type (Prop, Set, Bool), indicates that the recursion, and not the collection, is where the content lies.

Remark 222.1 (Why the trajectory runs toward the recursive form).

The encoding of Section 222.3 is not merely current practice in proof assistants; it is the form that mechanised mathematics is converging on, for reasons that match the analysis given here.

The record so far.




Result system effort



Four Colour Theorem (2005) Coq original proof already computational
Feit–Thompson (2012) Coq six years, 255-page source
Kepler conjecture (2014) HOL Light / Isabelle Flyspeck, eleven years
Liquid Tensor Experiment (2022) Lean eighteen months



The formalisation cost has been falling, and in the last case the process surfaced gaps in the informal argument — which is the expected outcome if, as argued above, informal notation conceals recursion, finiteness, decidability, and witnesses.

\begin{equation} \boxed {\text {formalisation} =\text {making the concealed assumptions explicit}.} \tag{13901}\end{equation}

Machine provers operate on the same form. Recent systems — AlphaProof and AlphaGeometry, LeanDojo and ReProver, Lean Copilot — all generate candidate proofs and submit them to a kernel. Generation alone is insufficient:

\begin{equation} \text {plausible text}\ \neq \ \text {verified proof}, \tag{13902}\end{equation}
so the pipeline is
\begin{equation} \text {generate}\;\longrightarrow \;\text {type-check} \;\longrightarrow \;\text {accept or reject}. \tag{13903}\end{equation}
In the predicate language of Section 222 this is
\begin{equation} \boxed {\mathsf {Tr}(\varphi ) \iff \text {the term type-checks},} \tag{13904}\end{equation}
which is available because of Curry–Howard:
\begin{equation} \text {proof}=\text {term}, \qquad \text {proposition}=\text {type}, \qquad \text {proof checking}=\text {type checking}. \tag{13905}\end{equation}

The design principles are the ones computed here.



Derived above Implementation


term grammar \(t::=\cdots \) Inductive declaration
structural recursion Fixpoint / def
witness multiplicity Agda here vs there here
grading \(\mathsf {Lev}\) universe levels Type u
\(\neg \mathsf {Lev}(t,t)\) no type-in-type; Girard blocked
unique normal form confluence and termination


Why mechanisation selects this form. The conclusion of Section 222.3 was that the content resides in the recursion rather than in the collection. A recursion is an algorithm; a grammar generates; both are executable. An informal collection is not:

\begin{equation} \{a_1,\dots ,a_n\} \;\Longrightarrow \; \text {the ellipsis is not machine-readable}. \tag{13906}\end{equation}
\begin{equation} \boxed {\text {mechanisability selects the notation}.} \tag{13907}\end{equation}

Three pressures, one direction.

1.
Logical: the recursion carries the content (Sections 222.2–222.3).
2.
Practical: proof assistants require that form before a definition type-checks.
3.
Computational: machine provers can only search and verify in a checkable calculus.
\begin{equation} \boxed { \text {mathematics} \;\longrightarrow \; \text {terms and recursion} \;\longrightarrow \; \text {machine-checkable}.} \tag{13908}\end{equation}

Closure. Informal set notation is an abbreviation adequate for communication between people who can reconstruct the omitted recursion. Once a machine participates — as checker, as generator, or as search procedure — the abbreviation must be expanded, and expanding it produces exactly the form derived in this work: a grammar, a structural recursion, an explicit grading, and, where proofs are relevant, explicit witnesses. The trajectory is therefore not a stylistic preference but a consequence of what can be checked.

222.4 Eliminating \(\in \) from the Witness Example

Thesis. Section 222.3 used \(x\in (x::x::[\,])\) to exhibit two distinct witnesses, here and there here. The example still writes \(\in \). We remove it in seven ways and observe that six of them retain the witness structure while one destroys it — the difference being entirely a matter of the result type.

Step 1: What the Agda witnesses record

The two inhabitants of \(x\in (x::x::[\,])\) are positions: here is position \(0\) and there here is position \(1\). So the content of the membership claim is positional, and can be stated as such.

Step 2: Encoding 1 — indexed position
\begin{equation} \mathsf {At}(n,\ell ,a) \quad \text {``the $n$-th entry of $\ell $ is $a$''}, \tag{13909}\end{equation}
defined by recursion:
\begin{equation} \mathsf {At}\bigl (0,\mathsf {cons}(a,\ell ),a\bigr ), \qquad \mathsf {At}(n,\ell ,a) \;\Longrightarrow \; \mathsf {At}\bigl (n{+}1,\mathsf {cons}(b,\ell ),a\bigr ). \tag{13910}\end{equation}
For \(\ell =x::x::[\,]\):
\begin{equation} \mathsf {At}(0,\ell ,x)\ \checkmark , \qquad \mathsf {At}(1,\ell ,x)\ \checkmark , \tag{13911}\end{equation}
\begin{equation} \boxed {\texttt {here}=0, \qquad \texttt {there here}=1 .} \tag{13912}\end{equation}
Step 3: Encoding 2 — decomposition equation
\begin{equation} \exists \,\ell _1,\ell _2:\quad \ell =\ell _1\mathbin {+\!\!+}(x::\ell _2). \tag{13913}\end{equation}
For \(\ell =x::x::[\,]\) there are two solutions:
\begin{equation} (\ell _1,\ell _2)=\bigl ([\,],\ x::[\,]\bigr ), \qquad (\ell _1,\ell _2)=\bigl (x::[\,],\ [\,]\bigr ), \tag{13914}\end{equation}
\begin{equation} \boxed {\text {two decompositions}=\text {two witnesses}, \quad \text {stated by equations alone}.} \tag{13915}\end{equation}
Step 4: Encoding 3 — occurrence count
\begin{equation} \mathsf {cnt}(x,[\,])=0, \qquad \mathsf {cnt}\bigl (x,\mathsf {cons}(a,\ell )\bigr ) =\mathsf {cnt}(x,\ell )+[x=a], \tag{13916}\end{equation}
\begin{equation} x\in \ell \ \longrightarrow \ \mathsf {cnt}(x,\ell )>0, \qquad \mathsf {cnt}(x,\ x::x::[\,])=2 . \tag{13917}\end{equation}
This is the multiplicity function of System M (Section 212.10).
Step 5: Encoding 4 — filter
\begin{equation} \mathsf {filter}(x,[\,])=[\,], \qquad \mathsf {filter}\bigl (x,\mathsf {cons}(a,\ell )\bigr )= \begin {cases} \mathsf {cons}\bigl (a,\mathsf {filter}(x,\ell )\bigr ) & x=a\\ \mathsf {filter}(x,\ell ) & \text {otherwise} \end {cases} \tag{13918}\end{equation}
\begin{equation} x\in \ell \ \longrightarrow \ \mathsf {filter}(x,\ell )\neq [\,], \qquad \mathsf {filter}(x,\ x::x::[\,])=x::x::[\,]. \tag{13919}\end{equation}
Step 6: Encoding 5 — polynomial

With \(\ell =a_1::a_2::[\,]\) put \(p(X)=(X\ominus a_1)\otimes (X\ominus a_2)\); then

\begin{equation} x\in \ell \ \longrightarrow \ p(x)=0 . \tag{13920}\end{equation}
For \(\ell =x::x::[\,]\),
\begin{equation} p(X)=(X\ominus x)^{\otimes 2}, \qquad p(x)=0\ \text {with multiplicity }2, \tag{13921}\end{equation}
\begin{equation} \boxed {\text {occurrence multiplicity}=\text {root multiplicity}.} \tag{13922}\end{equation}
Step 7: Encoding 6 — fold
\begin{equation} \mathsf {any}(x,\ell ) :=\mathsf {fold}\bigl (\lambda a\,r.\ (x=a)\vee r,\ \bot ,\ \ell \bigr ), \tag{13923}\end{equation}
which for \(\ell =x::x::[\,]\) unfolds to
\begin{equation} (x=x)\vee \bigl ((x=x)\vee \bot \bigr )=\top . \tag{13924}\end{equation}
The result is a single truth value: both occurrences collapse into \(\top \), and the witness distinction is lost.
Step 8: Encoding 7 — bare equations
\begin{equation} \ell =x::x::[\,], \tag{13925}\end{equation}
\begin{equation} \text {position }0:\quad \mathsf {hd}(\ell )=x, \qquad \text {position }1:\quad \mathsf {hd}\bigl (\mathsf {tl}(\ell )\bigr )=x . \tag{13926}\end{equation}
\begin{equation} \boxed {\text {two equations}=\text {two witnesses}, \qquad \in \ \text {entirely absent}.} \tag{13927}\end{equation}
Step 9: Comparison





Encoding form witnesses retained




1. index \(\mathsf {At}(n,\ell ,x)\) \(n\in \{0,1\}\) yes
2. decomposition \(\ell =\ell _1\mathbin {+\!\!+}(x::\ell _2)\) two solutions yes
3. count \(\mathsf {cnt}(x,\ell )=2\) the number \(2\) yes
4. filter \(\mathsf {filter}(x,\ell )\neq [\,]\) length \(2\) yes
5. polynomial \(p(x)=0\) multiplicity \(2\) yes
6. fold \(\mathsf {any}(x,\ell )=\top \) — no
7. equations \(\mathsf {hd}(\dots )=x\) two equations yes




\begin{equation} \boxed {\text {all seven avoid }\in ;\ \text {six retain the witnesses}.} \tag{13928}\end{equation}
Step 10: The result type decides



Result type witnesses


\(\mathsf {Bool}\), \(\mathsf {Prop}\) discarded
\(\mathbb {N}\), \(\mathsf {List}\), \(\mathsf {Set}\) retained


\begin{equation} \boxed {\text {proof-irrelevant targets lose the witness; proof-relevant ones keep it}.} \tag{13929}\end{equation}
This is why Agda declares membership in Set rather than Prop: the inductive type has room for the position, whereas a truth value does not.
Step 11: Result
\begin{equation} \boxed { \begin {array}{ll} \text {original:} & x\in (x::x::[\,])\\ \text {index:} & \mathsf {At}(0,\ell ,x)\ \wedge \ \mathsf {At}(1,\ell ,x)\\ \text {equations:} & \mathsf {hd}(\ell )=x\ \wedge \ \mathsf {hd}(\mathsf {tl}(\ell ))=x\\ \text {count:} & \mathsf {cnt}(x,\ell )=2\\ \text {polynomial:} & (X\ominus x)^{\otimes 2}\ \text {has }x\ \text {as a double root} \end {array}} \tag{13930}\end{equation}

The example that introduced witness multiplicity did so through a membership type, but the multiplicity is not a feature of membership. It is positional information: two occurrences means two positions, two decompositions, a count of two, a filter of length two, a root of multiplicity two. Each of these is stated without \(\in \), and each keeps the information that the informal \(x\in \{x,x\}\) discards. Only the Boolean fold loses it, and it loses it for a reason visible in its signature — the target has two values and cannot record which occurrence was found. The witness structure identified throughout this work is therefore independent of the membership relation, and survives its elimination.

222.5 Extensional Equality without Sets: Eight Predicates

Thesis. The identification \(\{x:\varphi \}=\{x:\psi \}\) collapses eight distinct relations into a single equation. Writing them as predicates keeps them apart and shows that they are strictly ordered by strength. Three primitives suffice — \(\mathsf {Eq}\), \(\mathsf {Comp}\), \(\mathsf {Tr}\); notably \(\mathsf {Lev}\) is not needed, since grading is required for membership but not for comparison.

Step 0: The example
\begin{equation} \varphi (x):\ x^2=1 , \qquad \psi (x):\ x=1\vee x=-1 . \tag{13931}\end{equation}
Set-theoretically one writes \(\{x:\varphi \}=\{x:\psi \}\). We give eight predicate formulations of what that equation might mean.
Step 1: The eight predicates

1. Biconditional (extensional).

\begin{equation} \mathsf {ExtEq}(\varphi ,\psi ) :\equiv \forall x\bigl (\mathsf {Tr}(\varphi x)\leftrightarrow \mathsf {Tr}(\psi x)\bigr ). \tag{13932}\end{equation}

2. Term identity.

\begin{equation} \mathsf {TermEq}(p,q):\equiv \mathsf {Eq}(p,q), \tag{13933}\end{equation}
with \(p=X^2\ominus 1\) and \(q=(X\ominus 1)\otimes (X\oplus 1)\).

3. Interderivability.

\begin{equation} \mathsf {Interderiv}(\varphi ,\psi ) :\equiv \mathsf {Der}(\varphi ,\psi )\wedge \mathsf {Der}(\psi ,\varphi ), \tag{13934}\end{equation}
the two derivations being factorisation and substitution.

4. Decision procedures agree.

\begin{equation} \mathsf {DecEq}(\varphi ,\psi ) :\equiv \forall x\,\mathsf {Eq}\bigl (\chi _\varphi (x),\chi _\psi (x)\bigr ). \tag{13935}\end{equation}

5. Same roots.

\begin{equation} \mathsf {SameRoots}(p,q) :\equiv \forall a\bigl (\mathsf {Root}(a,p)\leftrightarrow \mathsf {Root}(a,q)\bigr ). \tag{13936}\end{equation}

6. Mutual divisibility.

\begin{equation} \mathsf {IdealEq}(p,q) :\equiv \mathsf {Div}(p,q)\wedge \mathsf {Div}(q,p). \tag{13937}\end{equation}

7. Isomorphism (witness explicit).

\begin{equation} \mathsf {Iso}_{f,g}(A,B) :\equiv \mathsf {Cmp}(f,g,\mathrm {id})\wedge \mathsf {Cmp}(g,f,\mathrm {id}), \tag{13938}\end{equation}
the subscripts naming the witnesses so that no existential is required.

8. Common normal form.

\begin{equation} \mathsf {NFEq}(s,t) :\equiv \mathsf {Eq}\bigl (\mathrm {nf}(s),\mathrm {nf}(t)\bigr ), \tag{13939}\end{equation}
again quantifier-free, since normalisation computes the witness.
Step 2: Verification on the example

Term identity.

\begin{equation} q=(X\ominus 1)\otimes (X\oplus 1) \rightsquigarrow X^2\ominus 1=p, \qquad \mathsf {TermEq}(p,q)\ \checkmark \tag{13940}\end{equation}

Same roots.

\begin{equation} \mathsf {Root}(1,p),\ \mathsf {Root}(-1,p), \qquad \mathsf {Root}(1,q),\ \mathsf {Root}(-1,q), \qquad \mathsf {SameRoots}(p,q)\ \checkmark \tag{13941}\end{equation}

Mutual divisibility.

\begin{equation} q=p\otimes 1, \qquad p=q\otimes 1, \qquad \mathsf {IdealEq}(p,q)\ \checkmark \tag{13942}\end{equation}

Biconditional.

\begin{equation} x^2=1\Rightarrow (x-1)(x+1)=0\Rightarrow x=1\vee x=-1, \tag{13943}\end{equation}
\begin{equation} 1^2=1\ \checkmark , \qquad (-1)^2=1\ \checkmark , \tag{13944}\end{equation}
so \(\mathsf {ExtEq}(\varphi ,\psi )\) holds.
Step 3: Reduction to primitives




Predicate definition uses primitive



\(\mathsf {ExtEq}\) truth values \(\mathsf {Tr}\)
\(\mathsf {TermEq}\) term identity \(\mathsf {Eq}\)
\(\mathsf {Interderiv}\) derivation schemes \(\mathsf {Tr}\)
\(\mathsf {DecEq}\) values of \(\chi \) \(\mathsf {Eq}\)
\(\mathsf {SameRoots}\) \(\mathsf {Root}\) \(\mathsf {Eq}\)
\(\mathsf {IdealEq}\) \(\mathsf {Div}\) \(\mathsf {Comp}\)
\(\mathsf {Iso}_{f,g}\) composition \(\mathsf {Comp}\)
\(\mathsf {NFEq}\) rewriting, identity \(\mathsf {Eq}\), \(\mathsf {Comp}\)



\begin{equation} \boxed {\text {eight predicates, three primitives; } \mathsf {Lev}\ \text {unused}.} \tag{13945}\end{equation}
Grading is required to define membership (Section 222) but plays no role in comparison — a separation the set-theoretic notation cannot display, since both are written with the same symbol.
Step 4: The strength ordering

Define

\begin{equation} \mathsf {Stronger}(R_1,R_2) :\equiv \forall s,t\,\bigl (R_1(s,t)\to R_2(s,t)\bigr ). \tag{13946}\end{equation}
Then
\begin{equation} \boxed {\mathsf {Eq} \;\Rightarrow \;\mathsf {NFEq} \;\Rightarrow \;\mathsf {ExtEq} \;\Rightarrow \;\mathsf {Iso},} \tag{13947}\end{equation}
each implication holding and none reversing:
Step 5: What the set equation discards




Predicate strength what it records



\(\mathsf {TermEq}\) strongest the terms themselves coincide
\(\mathsf {NFEq}\) strong they compute to one form
\(\mathsf {ExtEq}\) middle they hold of the same things
\(\mathsf {Iso}_{f,g}\) weakest a specific pair of translations



\begin{equation} \boxed {\{x:\varphi \}=\{x:\psi \} \ \text {erases all four distinctions}.} \tag{13948}\end{equation}

Extensional equality is not one relation but a family, ordered by strength, and the set-theoretic equation names only the coarsest thing they have in common. Written as predicates, one must say which is meant: whether the terms are identical, whether they normalise alike, whether they merely hold of the same objects, or whether some specified pair of maps translates one into the other. The example \(x^2=1\) versus \(x=1\vee x=-1\) satisfies all four, which is why the set notation is harmless there and misleading in general. And the primitive \(\mathsf {Lev}\) does not appear at all: comparison needs identity, composition, and truth, but not grading — membership is the only notion that needs a level.

Remark 222.2 (Eight verifications of one extensional identity).

Let

\begin{equation} \varphi (x):\ x^2=1, \qquad \psi (x):\ x=1\vee x=-1 . \tag{13949}\end{equation}
Set-theoretically the claim is \(\{x:\varphi \}=\{x:\psi \}\). Eight verifications are available, none using braces, and they do not all assert the same thing.

1. Biconditional.

\begin{equation} \forall x\bigl (\varphi (x)\leftrightarrow \psi (x)\bigr ). \tag{13950}\end{equation}
Forward: \(x^2=1\Rightarrow x^2-1=0\Rightarrow (x-1)(x+1)=0\Rightarrow x=1\vee x=-1\). Backward: \(1^2=1\) and \((-1)^2=1\).

2. Polynomial identity.

\begin{equation} p(X)=X^2-1, \qquad q(X)=(X-1)(X+1), \tag{13951}\end{equation}
\begin{equation} q(X)=X^2-X+X-1=X^2-1=p(X), \qquad \boxed {p=q}. \tag{13952}\end{equation}
This asserts identity of terms, not merely of the objects they select.

3. Interderivability.

\begin{equation} \varphi \vdash \psi \quad \text {by factorisation}, \qquad \psi \vdash \varphi \quad \text {by substitution}, \tag{13953}\end{equation}
so the datum is a pair of derivations.

4. Decision procedures.

\begin{equation} \chi _\varphi (x)= \begin {cases}1 & x^2=1\\ 0 & \text {otherwise}\end {cases} \qquad \chi _\varphi (x)=\chi _\psi (x)\ \ \forall x . \tag{13954}\end{equation}

5. Degree and root count.

\begin{equation} \deg p=2, \qquad p(1)=0, \quad p(-1)=0, \quad 1\neq -1 , \tag{13955}\end{equation}
so \(p\) has exactly two roots and the factorisation is forced.

6. Mutual divisibility.

\begin{equation} \mathsf {Div}(p,q)\ \wedge \ \mathsf {Div}(q,p), \qquad q=p\cdot 1, \quad p=q\cdot 1 . \tag{13956}\end{equation}

7. Type isomorphism.

\begin{equation} \Sigma _{x:A}\,\varphi (x)\ \simeq \ \Sigma _{x:A}\,\psi (x), \tag{13957}\end{equation}
witnessed by
\begin{equation} f:(x,\pi )\mapsto (x,\text {factor}(\pi )), \qquad g:(x,\rho )\mapsto (x,\text {subst}(\rho )). \tag{13958}\end{equation}
This is \(\simeq \), not \(=\).

8. Common normal form.

\begin{equation} x^2-1=0 \ \rightsquigarrow \ (x-1)(x+1)=0 \ \rightsquigarrow \ \mathrm {nf}, \qquad x=1\vee x=-1 \ \rightsquigarrow \ \mathrm {nf}, \tag{13959}\end{equation}
equality by confluence.

Comparison.





Method form braces strength




1. biconditional \(\forall x(\varphi \leftrightarrow \psi )\) no extensional
2. polynomial \(p=q\) no term identity
3. derivations \(\varphi \dashv \vdash \psi \) no proof
4. decision \(\chi _\varphi =\chi _\psi \) no extensional
5. degree root count no extensional
6. divisibility \(\mathsf {Div}\) both ways no algebraic
7. type \(\simeq \) no isomorphism
8. normal form same \(\mathrm {nf}\) no computational




\begin{equation} \boxed {\text {all eight without }\{\,\}.} \tag{13960}\end{equation}

The strengths differ.

\begin{equation} \begin {array}{lll} p=q\ \text {(terms)}: & \text {strongest} & \text {intension coincides}\\ \text {same }\mathrm {nf}: & \text {strong} & \text {verified by computation}\\ \text {biconditional}: & \text {middle} & \text {extension only}\\ \simeq : & \text {weakest} & \text {witnesses remain} \end {array} \tag{13961}\end{equation}
\begin{equation} \boxed {\{x:\varphi \}=\{x:\psi \} \ \text {collapses all eight into one equation}.} \tag{13962}\end{equation}