cafeinst commited on
Commit
a0cb8b8
·
verified ·
1 Parent(s): c02f1ea

Upload 2 files

Browse files

This dataset contains an Isabelle/HOL formalization and accompanying PDF document related to information-theoretic barriers for trace-based proof strategies for the Collatz conjecture. The development formalizes structural properties of the Collatz map and proves a conditional theorem showing that, under explicit assumptions about the representation and preservation of parity-trace information, no finite proof can establish global convergence for all inputs within the corresponding class of proof systems.

.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ Collatz_Information_Barriers.pdf filter=lfs diff=lfs merge=lfs -text
Collatz_Information_Barriers.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:09be6b548362701873d2657f0fa6c8ae42b844edfa0e8954e760081883879cf0
3
+ size 185149
Collatz_Information_Barriers.thy ADDED
@@ -0,0 +1,1047 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ text \<open>
2
+ \section*{Information--Theoretic Barriers for Collatz Proofs}
3
+
4
+ \begin{center}
5
+ {\Large Craig A. Feinstein}
6
+
7
+ \vspace{0.5em}
8
+
9
+ Machine-Checked Formalization in Isabelle/HOL
10
+ \end{center}
11
+
12
+ \subsection*{Abstract}
13
+
14
+ In an earlier paper, \emph{The Collatz $3n+1$ Conjecture is Unprovable}
15
+ (2012), the author argued that any proof of the Collatz conjecture would need
16
+ to contain arbitrarily large amounts of information about the parity pattern of
17
+ Collatz trajectories, making a finite proof impossible. The present work
18
+ formalises that idea in Isabelle/HOL. Under explicit assumptions about how
19
+ proofs store and preserve information, we prove that no finite proof
20
+ can establish the required convergence property. This yields a
21
+ machine-checked information-theoretic barrier theorem inspired by the earlier
22
+ argument.
23
+
24
+ \tableofcontents
25
+
26
+ \clearpage
27
+
28
+ \subsection*{Provenance}
29
+ The present development formalises the information--theoretic ideas
30
+ underlying the author's earlier paper:
31
+ \begin{quote}
32
+ C.\ A.\ Feinstein, \emph{``The Collatz $3n+1$ Conjecture is Unprovable''},
33
+ arXiv:math/0312309; \emph{Global Journal of Science Frontier Research},
34
+ Mathematics and Decision Sciences, Volume 12, Issue 8 (2012), 13--15.
35
+ \end{quote}
36
+
37
+ \noindent The assumptions required for that argument are made explicit and
38
+ formalised within Isabelle/HOL, yielding a machine-checked theorem showing that
39
+ no finite proof can exist within the corresponding class of proof
40
+ systems. These assumptions are motivated by structural properties of the Collatz map,
41
+ including the realisability of arbitrary parity vectors, the injective dependence
42
+ of affine parameters on parity traces, and the essential role of parity information
43
+ in determining the dynamics.
44
+
45
+ The author of this formalisation received assistance from two AI systems ---
46
+ ChatGPT (OpenAI) and Claude (Anthropic). Their assistance consisted of drafting
47
+ and refining explanatory text, improving the readability of the introduction
48
+ and comments, and helping diagnose or structure Isabelle/HOL proof scripts.
49
+
50
+ \subsection*{Main goal}
51
+
52
+ The present development investigates the consequences of requiring a proof system
53
+ to represent Collatz trace information explicitly. The resulting theorem
54
+ establishes an information-theoretic barrier for a broad class of trace-based
55
+ proof methods based on explicit representations of parity information.
56
+
57
+ \subsection*{High-level strategy}
58
+
59
+ The argument formalised here isolates the following phenomena:
60
+
61
+ \begin{enumerate}
62
+ \item Certain proof strategies must expose or encode complete computational
63
+ traces of the Collatz iteration (parity vectors).
64
+ \item The Collatz map realises parity vectors of arbitrary length, including
65
+ information--theoretically incompressible ones.
66
+ \item Under explicit assumptions governing how proofs represent information,
67
+ finite proof certificates cannot accommodate arbitrarily long
68
+ incompressible traces.
69
+ \end{enumerate}
70
+
71
+ \noindent The structure of the argument is inspired by Chaitin--style incompressibility
72
+ methods, but is applied to the representation of computational traces within
73
+ proof certificates rather than to the computation of specific strings.
74
+
75
+ \subsection*{Structure of the formalisation}
76
+
77
+ \begin{description}
78
+
79
+ \item[1. Collatz map and parity vectors]
80
+ We define the simplified Collatz function $T$ and formalise parity vectors as
81
+ computational traces of the iteration.
82
+
83
+ \item[2. Affine formula characterisation]
84
+ We show that $T^{(k)}(n)$ admits an affine representation
85
+ $(3^s \cdot n + c) / 2^k$, and prove that the parameters $(k,s,c)$ are uniquely
86
+ determined by the parity vector.
87
+
88
+ \item[3. Two--adic invariance]
89
+ We establish a key invariance property: adding $2^k$ to a starting value does
90
+ not affect the first $k$ parity bits. This property underlies the realisability
91
+ construction.
92
+
93
+ \item[4. Every parity vector is realisable]
94
+ We prove that every finite binary string occurs as the parity vector of some
95
+ starting value. This shows that arbitrarily complex computational traces are
96
+ inherent to the Collatz dynamics.
97
+
98
+ \item[5. Proof system setup]
99
+ We introduce an abstract model of proof certificates based on bitstrings,
100
+ substring containment, and information--theoretic compressibility.
101
+
102
+ \item[6. A trace--based barrier theorem]
103
+ Under explicit assumptions on trace containment, incompressibility
104
+ preservation, and unbounded verification, we derive a formal barrier result:
105
+ no finite proof exists within this class of proof systems.
106
+
107
+ \end{description}
108
+ \<close>
109
+
110
+ theory Collatz_Information_Barriers
111
+ imports Main
112
+ begin
113
+
114
+ section \<open>Collatz map and parity vectors\<close>
115
+
116
+ text \<open>
117
+ \subsection*{The Collatz function}
118
+ We define the simplified Collatz function $T$ by
119
+ \[
120
+ T(n) =
121
+ \begin{cases}
122
+ n/2 & \text{if $n$ is even},\\
123
+ (3n+1)/2 & \text{if $n$ is odd}.
124
+ \end{cases}
125
+ \]
126
+ \<close>
127
+
128
+ definition T :: "nat \<Rightarrow> nat" where
129
+ "T n = (if even n then n div 2 else (3*n + 1) div 2)"
130
+ (* Convenient notation for iterated application of T *)
131
+ abbreviation Tpow :: "nat \<Rightarrow> nat \<Rightarrow> nat"
132
+ where "Tpow k n \<equiv> (T ^^ k) n"
133
+
134
+ text \<open>
135
+ \subsection*{The Collatz conjecture (unbounded version)}
136
+
137
+ The standard formulation of the Collatz conjecture is:
138
+ \[
139
+ \forall n.\ \exists k.\ T^{(k)}(n) = 1.
140
+ \]
141
+
142
+ \noindent An unbounded formulation is:
143
+ \[
144
+ \forall n\ \forall L.\ \exists k \ge L.\ T^{(k)}(n) = 1.
145
+ \]
146
+
147
+ \noindent These formulations are equivalent: Once a number reaches $1$, the Collatz
148
+ iteration enters the cycle
149
+ \[
150
+ 1 \to 2 \to 1 \to 2 \to \cdots
151
+ \]
152
+ and therefore reaches $1$ infinitely many times. Consequently, for any
153
+ threshold $L$, there exists some $k \ge L$ such that $T^{(k)}(n) = 1$.
154
+
155
+ \subsection*{The parity vector as computational trace}
156
+
157
+ The parity vector $\textit{parity\_vec}\ n\ k$ records the sequence of even and
158
+ odd values encountered during the first $k$ iterations starting from $n$:
159
+ \[
160
+ \textit{parity\_vec}\ n\ k =
161
+ [\ \textit{odd}(n),\ \textit{odd}(T(n)),\ \textit{odd}(T^{(2)}(n)),\ \ldots,\
162
+ \textit{odd}(T^{(k-1)}(n))\ ].
163
+ \]
164
+
165
+ \noindent This parity vector represents the \emph{computational trace}: the sequence of
166
+ branching decisions taken during the iteration of the Collatz map.
167
+
168
+ \subsection*{Example}
169
+
170
+ For $n = 27$ we have:
171
+ \[
172
+ T(27) = 41,\quad T^{(2)}(27) = 62,\quad T^{(3)}(27) = 31.
173
+ \]
174
+
175
+ \noindent Thus:
176
+ \[
177
+ \begin{aligned}
178
+ \textit{parity\_vec}\ 27\ 4
179
+ &= [\ \textit{odd}(T^{(0)}(27)),\ \textit{odd}(T^{(1)}(27)),\
180
+ \textit{odd}(T^{(2)}(27)),\ \textit{odd}(T^{(3)}(27))\ ] \\
181
+ &= [\ \textit{odd}(27),\ \textit{odd}(41),\
182
+ \textit{odd}(62),\ \textit{odd}(31)\ ] \\
183
+ &= [\ \text{True},\ \text{True},\ \text{False},\ \text{True}\ ].
184
+ \end{aligned}
185
+ \]
186
+ \<close>
187
+
188
+ definition parity_vec :: "nat \<Rightarrow> nat \<Rightarrow> bool list"
189
+ where "parity_vec n k = map (\<lambda>i. odd (Tpow i n)) [0..<k]"
190
+ (* Basic property: length is always k *)
191
+ lemma length_parity_vec[simp]: "length (parity_vec n k) = k"
192
+ by (simp add: parity_vec_def)
193
+
194
+ section \<open>Affine formula characterisation\<close>
195
+
196
+ text \<open>
197
+ After $k$ iterations of the Collatz map $T$, the result admits an affine
198
+ representation:
199
+ \[
200
+ T^{(k)}(n) = \frac{3^s \cdot n + c}{2^k}.
201
+ \]
202
+
203
+ \noindent Here:
204
+ \begin{itemize}
205
+ \item $k$ is the number of iterations.
206
+ \item $s$ counts the number of odd values in the parity vector, that is, the
207
+ number of steps of the form $(3n+1)/2$.
208
+ \item $c$ is a constant determined by the specific parity sequence.
209
+ \end{itemize}
210
+
211
+ \subsection*{Intuition}
212
+ Each odd step multiplies the current value by $3$, adds $1$, and then divides by
213
+ $2$, while each even step simply divides by $2$. After $k$ steps, the cumulative
214
+ effect is multiplication by $3^s$, division by $2^k$, and the addition of an
215
+ accumulated constant $c$.
216
+
217
+ \subsection*{Uniqueness}
218
+ The parameters $(k,s,c)$ are uniquely determined by the parity vector. In
219
+ particular, the parity vector encodes all computational information needed to
220
+ reconstruct the affine formula for $T^{(k)}(n)$.
221
+ \<close>
222
+
223
+ fun params :: "nat \<Rightarrow> bool list \<Rightarrow> nat \<times> nat" where
224
+ "params i [] = (0, 0)" |
225
+ "params i (b # bs) =
226
+ (let (c,s) = params (Suc i) bs in
227
+ if b then (3*c + 2^i, Suc s) else (c, s))"
228
+
229
+ definition params0 :: "bool list \<Rightarrow> nat \<times> nat" where
230
+ "params0 x = params 0 x"
231
+
232
+ definition formula_of :: "bool list \<Rightarrow> nat \<times> nat \<times> nat" where
233
+ "formula_of x = (length x, snd (params0 x), fst (params0 x))"
234
+
235
+ text \<open>
236
+ \subsection*{Injectivity}
237
+ Different parity vectors produce different affine formula parameters. In
238
+ particular, distinct parity sequences yield distinct triples $(k,s,c)$ in the
239
+ representation
240
+ \[
241
+ T^{(k)}(n) = \frac{3^s \cdot n + c}{2^k}.
242
+ \]
243
+ \<close>
244
+
245
+ (* Helper lemma: the constant c from params is always divisible by appropriate powers of 2 *)
246
+ lemma pow2_dvd_fst_params_Suc:
247
+ "2 ^ Suc i dvd fst (params (Suc i) zs)"
248
+ proof (induction zs arbitrary: i)
249
+ case Nil
250
+ show ?case by simp
251
+ next
252
+ case (Cons b bs)
253
+ obtain c s where P: "params (Suc (Suc i)) bs = (c, s)"
254
+ by (cases "params (Suc (Suc i)) bs") auto
255
+ from Cons.IH[of "Suc i"] P have IH: "2 ^ Suc (Suc i) dvd c" by simp
256
+ then obtain t where c_rep: "c = 2 ^ Suc (Suc i) * t"
257
+ by (auto simp: dvd_def)
258
+ have div_c: "2 ^ Suc i dvd c"
259
+ proof (unfold dvd_def, intro exI)
260
+ show "c = 2 ^ Suc i * (2 * t)"
261
+ by (simp add: c_rep)
262
+ qed
263
+ with P show ?case
264
+ by (cases b) simp_all
265
+ qed
266
+ (* Helper: dropping multiples on the left in modular arithmetic *)
267
+ lemma mod_drop_left_multiple_nat:
268
+ fixes m a r :: nat
269
+ shows "(m * a + r) mod m = r mod m"
270
+ by (simp add: mod_add_left_eq mod_mult_left_eq)
271
+
272
+ lemma params_injective_len:
273
+ assumes "length xs = length ys" and "params i xs = params i ys"
274
+ shows "xs = ys"
275
+ using assms
276
+ proof (induction xs arbitrary: ys i)
277
+ case Nil
278
+ then show ?case by (cases ys) auto
279
+ next
280
+ case (Cons a xs)
281
+ from Cons.prems(1) obtain b ys' where [simp]: "ys = b # ys'"
282
+ by (cases ys) auto
283
+
284
+ obtain c s where Pxs: "params (Suc i) xs = (c,s)"
285
+ by (cases "params (Suc i) xs") auto
286
+ obtain c' s' where Pys: "params (Suc i) ys' = (c',s')"
287
+ by (cases "params (Suc i) ys'") auto
288
+
289
+ have Eq:
290
+ "(if a then (3*c + 2^i, Suc s) else (c,s)) =
291
+ (if b then (3*c' + 2^i, Suc s') else (c',s'))"
292
+ using Cons.prems(2) Pxs Pys by simp
293
+
294
+ have len_tails: "length xs = length ys'" using Cons.prems(1) by simp
295
+
296
+ show ?case
297
+ proof -
298
+ have "a = b"
299
+ proof (rule ccontr)
300
+ assume "a \<noteq> b"
301
+ then consider (TF) "a" "\<not> b" | (FT) "\<not> a" "b" by auto
302
+ then show False
303
+ proof cases
304
+ case TF
305
+ from pow2_dvd_fst_params_Suc[of i xs] Pxs
306
+ have div_c: "2 ^ Suc i dvd c" by simp
307
+ from pow2_dvd_fst_params_Suc[of i ys'] Pys
308
+ have div_c': "2 ^ Suc i dvd c'" by simp
309
+ let ?M = "2 ^ Suc i"
310
+
311
+ obtain t where c_rep: "c = ?M * t"
312
+ using div_c by (auto simp: dvd_def)
313
+ obtain t' where c'rep: "c' = ?M * t'"
314
+ using div_c' by (auto simp: dvd_def)
315
+
316
+ have Lmod: "(3 * c + 2 ^ i) mod ?M = 2 ^ i"
317
+ proof -
318
+ have "(3 * c + 2 ^ i) mod ?M
319
+ = ((?M * (3 * t)) + 2 ^ i) mod ?M" by (simp add: c_rep algebra_simps)
320
+ also have "... = (2 ^ i) mod ?M"
321
+ by (meson mod_drop_left_multiple_nat)
322
+ also have "... = 2 ^ i" by simp
323
+ finally show ?thesis .
324
+ qed
325
+
326
+ have Rmod: "c' mod ?M = 0" by (simp add: c'rep)
327
+
328
+ from Eq TF have "(3*c + 2^i, Suc s) = (c', s')" by simp
329
+ hence "(3*c + 2^i) = c'" by simp
330
+ hence "(3*c + 2^i) mod ?M = c' mod ?M" by simp
331
+ hence "2 ^ i = 0" using Lmod Rmod by simp
332
+ thus False using power_eq_0_iff by fastforce
333
+ next
334
+ case FT
335
+ from pow2_dvd_fst_params_Suc[of i ys'] Pys
336
+ have div_c': "2 ^ Suc i dvd c'" by simp
337
+ from pow2_dvd_fst_params_Suc[of i xs] Pxs
338
+ have div_c: "2 ^ Suc i dvd c" by simp
339
+ let ?M = "2 ^ Suc i"
340
+
341
+ obtain t' where c'rep: "c' = ?M * t'"
342
+ using div_c' by (auto simp: dvd_def)
343
+ obtain t where c_rep: "c = ?M * t"
344
+ using div_c by (auto simp: dvd_def)
345
+
346
+ have Rmod: "(3 * c' + 2 ^ i) mod ?M = 2 ^ i"
347
+ proof -
348
+ have "(3 * c' + 2 ^ i) mod ?M
349
+ = ((?M * (3 * t')) + 2 ^ i) mod ?M" by (simp add: c'rep algebra_simps)
350
+ also have "... = (2 ^ i) mod ?M"
351
+ using mod_drop_left_multiple_nat by blast
352
+ also have "... = 2 ^ i" by simp
353
+ finally show ?thesis .
354
+ qed
355
+
356
+ have Lmod: "c mod ?M = 0" by (simp add: c_rep)
357
+
358
+ from Eq FT have "(c, s) = (3*c' + 2^i, Suc s')" by simp
359
+ hence "c = 3*c' + 2^i" by simp
360
+ hence "c mod ?M = (3*c' + 2^i) mod ?M" by simp
361
+ hence "0 = 2 ^ i" using Lmod Rmod by simp
362
+ thus False by (metis not_exp_less_eq_0_int verit_comp_simplify1(2))
363
+ qed
364
+ qed
365
+
366
+ then have bits_eq: "a = b" by simp
367
+ from Eq bits_eq have "c = c' \<and> s = s'" by (cases a) auto
368
+ hence "xs = ys'"
369
+ using Cons.IH[OF len_tails] Pxs Pys by metis
370
+ with bits_eq show ?thesis by simp
371
+ qed
372
+ qed
373
+
374
+ (* Main injectivity theorem: formula uniquely determines parity vector *)
375
+ lemma formula_determines_parity_on_len:
376
+ assumes "length x = k" "length y = k" "formula_of x = formula_of y"
377
+ shows "x = y"
378
+ proof -
379
+ from assms(3)
380
+ have "snd (params0 x) = snd (params0 y)"
381
+ "fst (params0 x) = fst (params0 y)"
382
+ by (auto simp: formula_of_def)
383
+ hence "params0 x = params0 y"
384
+ by (cases "params0 x"; cases "params0 y"; simp)
385
+ thus ?thesis
386
+ using assms(1,2) params_injective_len[of x y 0]
387
+ by (simp add: params0_def)
388
+ qed
389
+
390
+ section \<open>Two-adic invariance\<close>
391
+
392
+ text \<open>
393
+ \subsection*{Key lemma}
394
+ Adding $q \cdot 2^k$ to $m$ preserves the first $k$ parity bits:
395
+ \[
396
+ \textit{parity\_vec}(m + q \cdot 2^k, k) = \textit{parity\_vec}(m, k).
397
+ \]
398
+
399
+ \subsection*{Intuition}
400
+ The offset $q \cdot 2^k$ is beyond the resolution of the first $k$ steps. After
401
+ one application of the Collatz map $T$, the offset becomes $q \cdot 2^{k-1}$ if
402
+ $m$ is even, or $3q \cdot 2^{k-1}$ if $m$ is odd, and therefore remains a
403
+ multiple of $2^{k-1}$. This behaviour continues inductively through subsequent
404
+ iterations.
405
+
406
+ \subsection*{Consequence}
407
+ This invariance property enables realisability. One can tune a number to have
408
+ any desired parity sequence by adding suitable multiples of $2^k$, without
409
+ affecting parity bits that have already been fixed.
410
+ \<close>
411
+
412
+ (* Helper: iterated T commutes with a single T *)
413
+ lemma T_funpow_commute: "T ((T ^^ j) n) = (T ^^ j) (T n)"
414
+ proof (induction j)
415
+ case 0
416
+ show ?case by simp
417
+ next
418
+ case (Suc j)
419
+ have "T ((T ^^ Suc j) n) = T (T ((T ^^ j) n))" by simp
420
+ also have "... = T ((T ^^ j) (T n))" by (simp add: Suc.IH)
421
+ also have "... = (T ^^ Suc j) (T n)" by simp
422
+ finally show ?case .
423
+ qed
424
+ (* Parity vector decomposes: head is parity of n, tail is parity vector of T(n) *)
425
+ lemma parity_vec_Suc:
426
+ "parity_vec n (Suc k) = odd n # parity_vec (T n) k"
427
+ proof (rule nth_equalityI)
428
+ show "length (parity_vec n (Suc k)) = length (odd n # parity_vec (T n) k)"
429
+ by simp
430
+ next
431
+ fix i assume iLt: "i < length (parity_vec n (Suc k))"
432
+ then have iSk: "i < Suc k" by (simp add: parity_vec_def)
433
+ consider (Z) "i = 0" | (S) j where "i = Suc j" "j < k"
434
+ using iSk by (cases i) auto
435
+ then show "parity_vec n (Suc k) ! i = (odd n # parity_vec (T n) k) ! i"
436
+ proof cases
437
+ case Z
438
+ show ?thesis
439
+ using Z by (simp add: parity_vec_def del: upt_Suc)
440
+ next
441
+ case (S j)
442
+ show ?thesis
443
+ using S
444
+ by (simp add: parity_vec_def T_funpow_commute del: upt_Suc)
445
+ qed
446
+ qed
447
+
448
+ lemma parity_vec_add_pow2_invariant:
449
+ fixes m q k :: nat
450
+ shows "parity_vec (m + q * 2 ^ k) k = parity_vec m k"
451
+ proof (induction k arbitrary: m q)
452
+ case 0
453
+ show ?case by (simp add: parity_vec_def)
454
+ next
455
+ case (Suc k)
456
+ let ?\<Delta> = "q * 2 ^ Suc k"
457
+
458
+ have head: "odd (m + ?\<Delta>) = odd m"
459
+ by simp
460
+
461
+ have tail: "parity_vec (T (m + ?\<Delta>)) k = parity_vec (T m) k"
462
+ proof (cases "even m")
463
+ case True
464
+ then obtain t where m2: "m = 2*t" by (elim evenE)
465
+ have "(m + ?\<Delta>) div 2 = t + q * 2 ^ k"
466
+ by (simp add: m2)
467
+ hence "T (m + ?\<Delta>) = t + q * 2 ^ k"
468
+ using True by (simp add: T_def)
469
+ moreover have "T m = t"
470
+ using True m2 by (simp add: T_def)
471
+ ultimately show ?thesis
472
+ using Suc.IH[of t q] by simp
473
+ next
474
+ case False
475
+ then obtain t where m2: "m = 2*t + 1" by (elim oddE)
476
+ have "(3*(m + ?\<Delta>) + 1) div 2
477
+ = (3*m + 1) div 2 + (3*q) * 2 ^ k"
478
+ proof -
479
+ have "3*(m + ?\<Delta>) + 1 = (3*m + 1) + (3*q) * 2 ^ Suc k"
480
+ by simp
481
+ moreover have "even (3*m + 1)"
482
+ using False m2 by simp
483
+ ultimately show ?thesis by simp
484
+ qed
485
+ hence "T (m + ?\<Delta>) = T m + (3*q) * 2 ^ k"
486
+ using False by (simp add: T_def)
487
+ thus ?thesis
488
+ using Suc.IH[of "T m" "3*q"] by simp
489
+ qed
490
+
491
+ have step1: "parity_vec (m + ?\<Delta>) (Suc k) =
492
+ odd (m + ?\<Delta>) # parity_vec (T (m + ?\<Delta>)) k"
493
+ by (simp add: parity_vec_Suc)
494
+ also have step2: "... = odd m # parity_vec (T m) k"
495
+ using head tail by blast
496
+ also have step3: "... = parity_vec m (Suc k)"
497
+ by (simp add: parity_vec_Suc)
498
+ finally show ?case .
499
+ qed
500
+
501
+ section \<open>Every parity vector is realisable\<close>
502
+
503
+ text \<open>
504
+ \subsection*{Realisability}
505
+ For any finite binary string $x$, there exists a natural number $n$ whose parity
506
+ sequence agrees with $x$:
507
+ \[
508
+ \forall x.\ \exists n.\ \textit{parity\_vec}\ n\ (\text{length } x) = x.
509
+ \]
510
+
511
+ \noindent This means that every possible computational trace of the Collatz map actually
512
+ occurs for some starting number. In particular, parity traces of arbitrary
513
+ length, including incompressible traces, are realised.
514
+ \<close>
515
+
516
+ text \<open>
517
+ \subsection*{Helper lemmas for modular arithmetic}
518
+ The following lemmas establish basic modular-arithmetic facts that are used in
519
+ the realisability construction.
520
+ \<close>
521
+
522
+ (* Power distributes over modulus *)
523
+ lemma power_mod_nat:
524
+ fixes a m n :: nat
525
+ shows "(a ^ n) mod m = ((a mod m) ^ n) mod m"
526
+ proof (induction n)
527
+ case 0
528
+ show ?case by simp
529
+ next
530
+ case (Suc n)
531
+ have "(a ^ Suc n) mod m = (a * a ^ n) mod m" by simp
532
+ also have "... = (((a mod m) * a ^ n) mod m)"
533
+ by (simp add: mod_mult_left_eq)
534
+ also have "... = (((a mod m) * ((a ^ n) mod m)) mod m)"
535
+ by (simp add: mod_mult_right_eq)
536
+ also have "... = (((a mod m) * (((a mod m) ^ n) mod m)) mod m)"
537
+ by (simp add: Suc.IH)
538
+ also have "... = (((a mod m) * ((a mod m) ^ n)) mod m)"
539
+ by (simp add: mod_mult_right_eq)
540
+ also have "... = ((a mod m) ^ Suc n) mod m" by simp
541
+ finally show ?case .
542
+ qed
543
+
544
+ (* Power of product: a^(m*n) = (a^m)^n *)
545
+ lemma power_mult_nat:
546
+ fixes a :: nat
547
+ shows "a ^ (m * n) = (a ^ m) ^ n"
548
+ proof (induction n)
549
+ case 0
550
+ show ?case by simp
551
+ next
552
+ case (Suc n)
553
+ have "a ^ (m * Suc n) = a ^ (m*n + m)" by (simp add: add.commute)
554
+ also have "... = a ^ (m*n) * a ^ m" by (simp add: power_add)
555
+ also have "... = (a ^ m) ^ n * a ^ m" by (simp add: Suc.IH)
556
+ also have "... = (a ^ m) ^ Suc n" by simp
557
+ finally show ?case .
558
+ qed
559
+
560
+ lemma pow4_mod3: "((4::nat) ^ m) mod 3 = 1"
561
+ by (simp add: power_mod_nat)
562
+
563
+ lemma pow2_mod3_even:
564
+ assumes "even l"
565
+ shows "(2 :: nat) ^ l mod 3 = 1"
566
+ proof -
567
+ obtain m where L: "l = 2*m" using assms by (erule evenE)
568
+ have "2 ^ l mod 3 = (2 ^ (2*m)) mod 3" by (simp add: L)
569
+ also have "... = (((2::nat) ^ 2) ^ m) mod 3" by (simp add: power_mult_nat)
570
+ also have "... = (4 ^ m) mod 3" by simp
571
+ also have "... = 1" by (rule pow4_mod3)
572
+ finally show ?thesis .
573
+ qed
574
+
575
+ lemma pow2_mod3_odd:
576
+ assumes "odd l"
577
+ shows "(2 :: nat) ^ l mod 3 = 2"
578
+ proof -
579
+ obtain m where L: "l = Suc (2*m)" using assms by (metis Suc_eq_plus1 oddE)
580
+ have "2 ^ l mod 3 = (2 * 2 ^ (2*m)) mod 3" by (simp add: L)
581
+ also have "... = (2 * (((2::nat) ^ 2) ^ m)) mod 3"
582
+ by (simp add: power_mult_nat)
583
+ also have "... = (2 * ((4 ^ m) mod 3)) mod 3"
584
+ by (simp add: mod_mult_right_eq)
585
+ also have "... = (2 * 1) mod 3" by (simp add: pow4_mod3)
586
+ also have "... = 2" by simp
587
+ finally show ?thesis .
588
+ qed
589
+
590
+ lemma pow2_mod3:
591
+ fixes l :: nat
592
+ shows "(2 :: nat) ^ l mod 3 = (if even l then 1 else 2)"
593
+ by (cases "even l") (simp add: pow2_mod3_even, simp add: pow2_mod3_odd)
594
+
595
+ lemma choose_t_even_mod3:
596
+ fixes m0 l :: nat
597
+ assumes "even l"
598
+ shows "\<exists>t\<le>2. (m0 + t * (2 :: nat) ^ l) mod 3 = 2"
599
+ proof -
600
+ define t where "t = (2 - (m0 mod 3)) mod 3"
601
+ have t_le2: "t \<le> 2" by (simp add: t_def)
602
+
603
+ have "(m0 + t * 2 ^ l) mod 3
604
+ = (m0 mod 3 + t * (2 ^ l mod 3)) mod 3"
605
+ by (metis mod_add_cong mod_mod_trivial mod_mult_right_eq)
606
+ also have "... = (m0 mod 3 + t) mod 3"
607
+ using assms by (simp add: pow2_mod3)
608
+ also have "... = (m0 mod 3 + ((2 - (m0 mod 3)) mod 3)) mod 3"
609
+ by (simp add: t_def)
610
+ also have "... = 2"
611
+ by (cases "m0 mod 3") simp_all
612
+ finally have targ: "(m0 + t * 2 ^ l) mod 3 = 2" .
613
+ from t_le2 targ show ?thesis by blast
614
+ qed
615
+
616
+ lemma choose_t_odd_mod3:
617
+ fixes m0 l :: nat
618
+ assumes "odd l"
619
+ shows "\<exists>t\<le>2. (m0 + t * (2 :: nat) ^ l) mod 3 = 2"
620
+ proof -
621
+ define t where "t = (2 * (2 - (m0 mod 3))) mod 3"
622
+ have t_le2: "t \<le> 2" by (simp add: t_def)
623
+ have "(m0 + t * 2 ^ l) mod 3
624
+ = (m0 mod 3 + t * (2 ^ l mod 3)) mod 3"
625
+ by (metis mod_add_cong mod_mod_trivial mod_mult_right_eq)
626
+ also have "... = (m0 mod 3 + ((2 * (2 - (m0 mod 3))) mod 3) * 2) mod 3"
627
+ by (simp add: t_def pow2_mod3 assms)
628
+ also have "... = (m0 mod 3 + (4 * (2 - (m0 mod 3))) mod 3) mod 3"
629
+ using mod_mult_right_eq by (metis (no_types, lifting)
630
+ distrib_right mod_add_eq mod_add_left_eq mult_2_right numeral_Bit0_eq_double)
631
+ also have "... = (m0 mod 3 + ((4 mod 3) *
632
+ ((2 - (m0 mod 3)) mod 3)) mod 3) mod 3"
633
+ using mod_mult_left_eq by (metis mod_mult_right_eq)
634
+ also have "... = (m0 mod 3 + ((2 - (m0 mod 3)) mod 3)) mod 3" by simp
635
+ also have "... = 2" by (cases "m0 mod 3") simp_all
636
+ finally have targ: "(m0 + t * 2 ^ l) mod 3 = 2" .
637
+ show ?thesis using t_le2 targ by blast
638
+ qed
639
+
640
+ lemma parity_vector_realizable:
641
+ fixes x :: "bool list"
642
+ shows "\<exists>n. parity_vec n (length x) = x"
643
+ proof (induction x)
644
+ case Nil
645
+ show ?case by (metis length_0_conv length_parity_vec)
646
+ next
647
+ case (Cons b bs)
648
+ obtain m0 where IH: "parity_vec m0 (length bs) = bs"
649
+ using Cons.IH by blast
650
+ show ?case
651
+ proof (cases b)
652
+ case False
653
+ let ?n = "2*m0"
654
+ have "parity_vec ?n (length (b # bs))
655
+ = odd ?n # parity_vec (T ?n) (length bs)"
656
+ by (simp add: parity_vec_Suc)
657
+ also have "... = False # bs" by (simp add: T_def IH)
658
+ also have "... = b # bs" by (simp add: False)
659
+ finally show ?thesis by (intro exI[of _ ?n])
660
+ next
661
+ case True
662
+ let ?l = "length bs"
663
+ obtain t where t_le2: "t \<le> 2" and targ: "(m0 + t * 2 ^ ?l) mod 3 = 2"
664
+ by (cases "even ?l")
665
+ (use choose_t_even_mod3[of ?l m0] choose_t_odd_mod3[of ?l m0] in auto)
666
+ let ?m = "m0 + t * 2 ^ ?l"
667
+ have tail_preserved: "parity_vec ?m ?l = bs"
668
+ using IH parity_vec_add_pow2_invariant[of m0 t ?l] by simp
669
+ define q where "q = ?m div 3"
670
+ have m_eq: "?m = 3*q + 2"
671
+ proof -
672
+ have "?m = 3 * (?m div 3) + (?m mod 3)" by (simp add: div_mult_mod_eq)
673
+ also have "... = 3*q + 2" by (simp add: q_def targ)
674
+ finally show ?thesis .
675
+ qed
676
+ let ?n = "(2 * ?m - 1) div 3"
677
+ have head: "odd ?n"
678
+ proof -
679
+ have "?n = (2 * (3*q + 2) - 1) div 3" by (simp add: m_eq)
680
+ also have "... = (6*q + 3) div 3" by simp
681
+ also have "... = 2*q + 1" by simp
682
+ finally show ?thesis by simp
683
+ qed
684
+ have tail_step: "parity_vec (T ?n) ?l = bs"
685
+ using tail_preserved head by (simp add: m_eq T_def)
686
+ have "parity_vec ?n (length (b # bs)) = odd ?n # parity_vec (T ?n) ?l"
687
+ by (simp add: parity_vec_Suc)
688
+ also have "... = True # bs" using head tail_step by simp
689
+ also have "... = b # bs" by (simp add: True)
690
+ finally show ?thesis by (intro exI[of _ ?n])
691
+ qed
692
+ qed
693
+
694
+ section \<open>Proof system setup\<close>
695
+
696
+ type_synonym bit = bool
697
+ type_synonym bitstring = "bit list"
698
+
699
+ text \<open>
700
+ \subsection*{Substring containment}
701
+
702
+ We introduce a substring-containment relation as a \emph{concrete and explicit}
703
+ model of proofs that store computational trace information as literal data.
704
+ Formally, a bitstring $p$ contains a bitstring $s$ if $s$ occurs verbatim as a
705
+ contiguous substring of $p$, i.e.\ if there exist bitstrings $u$ and $v$ such
706
+ that $p = u @ s @ v$.
707
+
708
+ \paragraph{Remark.}
709
+ The choice of substring containment is deliberately strong. It provides a
710
+ simple, syntactic notion of explicit information storage that is easy to reason
711
+ about formally and avoids ambiguity about how information is represented inside
712
+ a proof certificate. In the main barrier theorem, we exploit only the elementary
713
+ consequence that storing a string of length $m$ requires at least $m$ bits of space.
714
+ Stronger notions of information encoding (for example, distributed or implicit
715
+ encodings) are intentionally left outside the scope of this development.
716
+ \<close>
717
+
718
+ definition contains :: "bitstring \<Rightarrow> bitstring \<Rightarrow> bool"
719
+ where "contains p s \<longleftrightarrow> (\<exists>u v. p = u @ s @ v)"
720
+
721
+ lemma contains_len_bound: "contains p s ==> length s <= length p"
722
+ by (auto simp: contains_def)
723
+
724
+ section \<open>The unprovability theorem\<close>
725
+
726
+ (* Finiteness lemmas for counting *)
727
+
728
+ lemma finite_bitstrings_of_len:
729
+ "finite {s::bitstring. length s = m}"
730
+ proof -
731
+ have fin_aux:
732
+ "finite {s::bool list. set s <= (UNIV::bool set) \<and> length s = m}"
733
+ by (rule finite_lists_length_eq) simp
734
+ have "{s::bitstring. length s = m}
735
+ = {s. set s <= (UNIV::bool set) \<and> length s = m}"
736
+ by auto
737
+ then show ?thesis using fin_aux by (simp only:)
738
+ qed
739
+
740
+ lemma many_strings_of_length:
741
+ "card {s::bitstring. length s = m} = 2 ^ m"
742
+ proof (induction m)
743
+ case 0
744
+ have "{s::bitstring. length s = 0} = {[]}" by auto
745
+ thus ?case by simp
746
+ next
747
+ case (Suc m)
748
+ have "{s. length s = Suc m} =
749
+ (%b. True # b) ` {s. length s = m}
750
+ Un (%b. False # b) ` {s. length s = m}"
751
+ by (auto simp: length_Suc_conv)
752
+ moreover have "(\<lambda>b. True # b) ` {s. length s = m}
753
+ Int (\<lambda>b. False # b) ` {s. length s = m} = {}"
754
+ by auto
755
+ moreover have "inj_on (\<lambda>b. True # b) {s. length s = m}"
756
+ by (auto simp: inj_on_def)
757
+ moreover have "inj_on (\<lambda>b. False # b) {s. length s = m}"
758
+ by (auto simp: inj_on_def)
759
+ ultimately show ?case
760
+ using Suc.IH card_Un_disjoint card_image
761
+ by (smt (verit) Suc_1 Suc_pred card.infinite diff_add_zero mult_2 nat.discI
762
+ plus_1_eq_Suc power_Suc0_right power_add power_eq_0_iff zero_less_one)
763
+ qed
764
+ (* Incompressibility definitions *)
765
+ definition compressible :: "bitstring \<Rightarrow> (bitstring \<Rightarrow> bitstring) \<Rightarrow> bool" where
766
+ "compressible s enc \<equiv> length (enc s) < length s"
767
+
768
+ definition incompressible_by :: "bitstring \<Rightarrow> (bitstring \<Rightarrow> bitstring) \<Rightarrow> bool" where
769
+ "incompressible_by s enc \<equiv> \<not>compressible s enc"
770
+ (* Sum of geometric series: 2^0 + 2^1 + ... + 2^(m-1) = 2^m - 1 *)
771
+ lemma sum_pow2_lt: "sum (%i. (2::nat) ^ i) {..<m} = 2 ^ m - 1"
772
+ by (induction m) simp_all
773
+
774
+ lemma finite_bitstrings_le_len:
775
+ "finite {s::bitstring. length s \<le> m}"
776
+ proof (induction m)
777
+ case 0 show ?case by (simp add: finite_bitstrings_of_len)
778
+ next
779
+ case (Suc m)
780
+ have "{s::bitstring. length s <= Suc m}
781
+ = {s. length s <= m} Un {s. length s = Suc m}" by auto
782
+ thus ?case using Suc.IH finite_bitstrings_of_len by (simp add: finite_UnI)
783
+ qed
784
+
785
+ lemma card_bitstrings_le_len:
786
+ "card {s::bitstring. length s <= m} = sum (%i. 2 ^ i) {..m}"
787
+ proof -
788
+ let ?S = "\<lambda>i. {s::bitstring. length s = i}"
789
+ have union_eq: "{s::bitstring. length s <= m} = Union ((%i. ?S i) ` {..m})"
790
+ by auto
791
+ have fin_index: "finite ({..m}::nat set)" by simp
792
+ have fin_each: "!!i. i <= m ==> finite (?S i)"
793
+ by (simp add: finite_bitstrings_of_len)
794
+ have disj: "!!i j. i <= m ==> j <= m ==> i ~= j ==> ?S i Int ?S j = {}"
795
+ by auto
796
+ have "card (Union ((%i. ?S i) ` {..m})) = sum (%i. card (?S i)) {..m}"
797
+ by (rule card_UN_disjoint) (use fin_index fin_each disj in auto)
798
+ also have "... = sum (%i. 2 ^ i) {..m}"
799
+ by (simp add: many_strings_of_length)
800
+ finally show ?thesis
801
+ by (simp add: union_eq)
802
+ qed
803
+
804
+ text \<open>
805
+ \subsection*{The pigeonhole argument}
806
+
807
+ \paragraph{Theorem.}
808
+ For any injective encoding, there exists an incompressible bitstring.
809
+ \<close>
810
+
811
+ theorem incompressible_strings_exist_for_enc:
812
+ fixes enc :: "bitstring \<Rightarrow> bitstring"
813
+ assumes "inj enc"
814
+ shows "\<exists>s. length s = m \<and> incompressible_by s enc"
815
+ proof (cases m)
816
+ case 0
817
+ have "length ([]::bitstring) = 0 \<and> 0 \<le> length (enc [])"
818
+ by simp
819
+ then show ?thesis using 0 incompressible_by_def compressible_def by auto
820
+ next
821
+ case (Suc r)
822
+ let ?S = "{t::bitstring. length t = Suc r}"
823
+ let ?T = "{u::bitstring. length u \<le> r}"
824
+ have finS: "finite ?S" by (simp add: finite_bitstrings_of_len)
825
+ have finT: "finite ?T" by (simp add: finite_bitstrings_le_len)
826
+ have Sm: "card ?S = 2 ^ Suc r"
827
+ by (simp add: many_strings_of_length)
828
+ have Tm: "card ?T = sum (%i. (2::nat) ^ i) {..r}"
829
+ by (simp add: card_bitstrings_le_len)
830
+ also have "... = sum (%i. (2::nat) ^ i) {..<Suc r}"
831
+ by (simp add: lessThan_Suc_atMost)
832
+ finally have Tm': "card ?T = sum (%i. (2::nat) ^ i) {..<Suc r}" .
833
+ from Tm' have lt: "card ?T = 2 ^ Suc r - 1"
834
+ by (simp add: sum_pow2_lt)
835
+ from Sm lt have card_less: "card ?T < card ?S" by simp
836
+
837
+ have not_all_shrink: "~(ALL t:?S. length (enc t) <= r)"
838
+ proof
839
+ assume H: "ALL t:?S. length (enc t) <= r"
840
+ have "enc ` ?S <= ?T" using H by auto
841
+ hence "card (enc ` ?S) <= card ?T"
842
+ using finT card_mono by blast
843
+ moreover from assms finS have "card (enc ` ?S) = card ?S"
844
+ using card_image by (metis subset_UNIV subset_inj_on)
845
+ ultimately show False using card_less by linarith
846
+ qed
847
+
848
+ then obtain t where tS: "t : ?S" and len: "~ length (enc t) <= r" by blast
849
+
850
+ hence "length (enc t) \<ge> Suc r" by simp
851
+ moreover from tS have "length t = Suc r" by auto
852
+ ultimately show ?thesis
853
+ using Suc incompressible_by_def compressible_def by auto
854
+ qed
855
+
856
+ text \<open>
857
+ \subsection*{Proof system locale}
858
+
859
+ This locale models a class of proof-certificate encodings used by trace-based
860
+ approaches to Collatz. We introduce three explicit assumptions capturing
861
+ a class of trace-based proof systems.
862
+
863
+ \begin{enumerate}
864
+ \item \textbf{Containment.}
865
+ Proofs must encode parity information. This is not derived from first
866
+ principles, but is assumed based on structural properties of the Collatz
867
+ function, namely realisability, injectivity of the affine formula, and opposite
868
+ monotonicity.
869
+
870
+ \item \textbf{Incompressibility preservation.}
871
+ The encoding cannot compress truly incompressible information. This is a basic
872
+ information-theoretic constraint.
873
+
874
+ \item \textbf{Unbounded verification.}
875
+ A proof of the Collatz conjecture must work for arbitrarily large iteration
876
+ counts. This follows from the equivalence of the standard and unbounded
877
+ formulations.
878
+ \end{enumerate}
879
+
880
+ \noindent The resulting unprovability statement is therefore conditional. If every valid
881
+ proof must encode parity vectors, and if such encodings preserve
882
+ information-theoretic incompressibility, then no finite proof of the Collatz
883
+ $3n+1$ conjecture can exist.
884
+
885
+ \subsection*{Justification of the containment assumption}
886
+
887
+ The assumption
888
+ \[
889
+ \text{is\_proof\_of\_convergence}(p,k,n) \Longrightarrow
890
+ p\ \text{contains}\ \text{enc\_parity}(\textit{parity\_vec}\ n\ k)
891
+ \]
892
+ formalises the idea that any proof asserting that $n$ converges to $1$ within
893
+ $k$ steps must, at least implicitly, encode the parity vector of the first $k$
894
+ Collatz iterates of $n$. This assumption is justified by three structural properties
895
+ that are specific to the Collatz function.
896
+
897
+ \paragraph{1. Realisability of all parity vectors}
898
+ For the Collatz map, every finite bitstring occurs as a parity vector. As a
899
+ result, any proof of universal convergence must account for all possible parity
900
+ patterns; none can be excluded a priori.
901
+ By contrast, consider the function
902
+ \[
903
+ T_1(n) =
904
+ \begin{cases}
905
+ n/2 & \text{if $n$ is even},\\
906
+ n + 1 & \text{if $n$ is odd}.
907
+ \end{cases}
908
+ \]
909
+ This map is not realisable in the above sense: after an odd step, the next value
910
+ is always even, so the parity pattern $[\text{True},\ \text{True}]$ never
911
+ occurs. Proofs for $T_1$ therefore do not need to consider arbitrary parity
912
+ strings.
913
+
914
+ \paragraph{2. Opposite monotonicity}
915
+ In the Collatz map, even steps always decrease the value, while odd steps always
916
+ increase it. Because the size may increase or decrease depending on the parity,
917
+ the behaviour of the iteration cannot be understood without knowing which branch
918
+ was taken at each step.
919
+ By contrast, consider the function
920
+ \[
921
+ T_2(n) =
922
+ \begin{cases}
923
+ n/2 & \text{if $n$ is even},\\
924
+ (n + 1)/2 & \text{if $n$ is odd}.
925
+ \end{cases}
926
+ \]
927
+ Both branches decrease for $n > 1$, so convergence can be proved using a global
928
+ monotone invariant, without referring to individual parity choices.
929
+
930
+ \paragraph{3. Injectivity of the affine formula}
931
+ For the Collatz map, we have the identity
932
+ \[
933
+ T^{(k)}(n) = \frac{3^s \cdot n + c}{2^k},
934
+ \]
935
+ where the parameters $(k,s,c)$ depend on the parity vector. As shown earlier,
936
+ these parameters uniquely determine the parity vector. Consequently, any argument
937
+ that relies on the affine formula implicitly determines the full parity
938
+ sequence.
939
+
940
+ \subsection*{Why these properties force parity encoding}
941
+
942
+ The Collatz function simultaneously satisfies the following three properties:
943
+ \begin{enumerate}
944
+ \item Every bitstring is realisable as a parity vector.
945
+ \item The behaviour of the iteration is unpredictable without branch
946
+ information.
947
+ \item The affine parameters encode the parity vector injectively.
948
+ \end{enumerate}
949
+
950
+ \noindent Because realisability forces a proof to account for all parity patterns,
951
+ opposite monotonicity makes parity information indispensable, and
952
+ injectivity shows that affine data and parity data are equivalent, these properties
953
+ provide strong justification for the containment assumption that proofs effectively
954
+ encode the relevant parity vector. Since these properties fail for many superficially
955
+ similar functions, the containment assumption is not arbitrary; it reflects a genuine
956
+ structural feature of the actual Collatz dynamics.\<close>
957
+
958
+ locale Collatz_Trace_Barrier =
959
+ fixes enc_parity :: "bool list \<Rightarrow> bitstring"
960
+ and is_proof_of_convergence :: "bitstring \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> bool"
961
+ and is_collatz_proof :: "bitstring \<Rightarrow> bool"
962
+ (* ASSUMPTION 1: Proofs must contain encoded parity information *)
963
+ assumes proof_contains_parity:
964
+ "is_proof_of_convergence p k n
965
+ ==> contains p (enc_parity (parity_vec n k))"
966
+ (* ASSUMPTION 2: Encoding preserves incompressibility *)
967
+ assumes encoding_preserves_incompressibility:
968
+ "[| incompressible_by s enc_parity; length s = m; take m t = s |]
969
+ ==> length (enc_parity t) >= m"
970
+ (* ASSUMPTION 3: Collatz proofs work for unbounded iterations *)
971
+ assumes collatz_proof_unbounded:
972
+ "is_collatz_proof p ==> ALL n L. EX k>=L. is_proof_of_convergence p k n"
973
+ begin
974
+
975
+ lemma incompressible_parity_encodings_exist:
976
+ assumes "inj enc_parity"
977
+ shows "\<exists>s. length s = m \<and> incompressible_by s enc_parity"
978
+ using incompressible_strings_exist_for_enc[OF assms] .
979
+
980
+ lemma parity_vec_prefix:
981
+ assumes "m \<le> k"
982
+ shows "take m (parity_vec n k) = parity_vec n m"
983
+ using assms by (simp add: parity_vec_def take_map)
984
+
985
+ text \<open>
986
+ \subsection*{Interpretation of the main theorem}
987
+
988
+ Under Assumptions (1)–(3), no finite proof exists within this class of proof
989
+ systems. The theorem is conditional on these assumptions, which are motivated
990
+ by structural properties of the Collatz map.
991
+ \<close>
992
+
993
+ theorem no_finite_collatz_proof:
994
+ assumes "inj enc_parity"
995
+ assumes "is_collatz_proof p"
996
+ shows False
997
+ proof -
998
+ define L where "L = length p"
999
+ (* By pigeonhole, an incompressible string exists *)
1000
+ obtain s where
1001
+ s_len: "length s = Suc L" and
1002
+ s_incomp: "incompressible_by s enc_parity"
1003
+ using incompressible_parity_encodings_exist[OF assms(1), of "Suc L"]
1004
+ by blast
1005
+ (* By realizability, this parity vector is realized by some number *)
1006
+ obtain n where pv_eq: "parity_vec n (Suc L) = s"
1007
+ using parity_vector_realizable[of s] s_len by auto
1008
+ (* By unbounded form, the proof must handle this number at large iterations *)
1009
+ have "\<exists>k\<ge>Suc L. is_proof_of_convergence p k n"
1010
+ using assms(2) collatz_proof_unbounded
1011
+ by blast
1012
+
1013
+ then obtain k where
1014
+ k_ge: "k \<ge> Suc L" and
1015
+ k_proof: "is_proof_of_convergence p k n"
1016
+ by blast
1017
+ (* The parity vector has s as its prefix *)
1018
+ have "take (Suc L) (parity_vec n k) = parity_vec n (Suc L)"
1019
+ using k_ge parity_vec_prefix by auto
1020
+ also have "... = s" using pv_eq by simp
1021
+ finally have prefix: "take (Suc L) (parity_vec n k) = s" .
1022
+ (* By assumption 2, encoding s preserves its length *)
1023
+ have enc_large: "length (enc_parity (parity_vec n k)) \<ge> Suc L"
1024
+ using encoding_preserves_incompressibility[OF s_incomp s_len prefix]
1025
+ by blast
1026
+ (* But the proof contains this encoding, so must be at least Suc L long *)
1027
+ have contains_fact: "contains p (enc_parity (parity_vec n k))"
1028
+ using proof_contains_parity[OF k_proof] .
1029
+
1030
+ have len_le: "length (enc_parity (parity_vec n k)) <= length p"
1031
+ using contains_len_bound[OF contains_fact] .
1032
+
1033
+ have "Suc L <= length p"
1034
+ using enc_large len_le by linarith
1035
+
1036
+ thus False
1037
+ by (simp add: L_def)
1038
+ qed
1039
+
1040
+ corollary no_collatz_proof_in_this_system:
1041
+ assumes "inj enc_parity"
1042
+ shows "\<not> (\<exists>p. is_collatz_proof p)"
1043
+ using no_finite_collatz_proof[OF assms]
1044
+ by blast
1045
+
1046
+ end (* End of locale *)
1047
+ end (* End of theory *)