# GERES P1：形式世界語義學

**Formal World Semantics for Global Equivalence Reconstruction and Scaling**

版本：v0.1  
系列：GERES — Global Equivalence Reconstruction and Scaling  
階段：P1  
性質：形式語義／方法論基礎／可實作規格  
主要 benchmark：Perfect Cuboid  
Canonical source：UTF-8 Markdown

---

## 摘要

GERES P0 提出一個基本轉向：幾何問題不應只被視為一組彼此獨立的數值，而應被視為一個具有容器、中心、物件、關係、度量、約束、表示與算術狀態的完整世界。

P1 的目標，是把這個直覺轉換成一套可計算、可比較、可驗證、可進一步數學化的形式語義。

本文區分三個彼此不可混同的層：

$$
\boxed{
\text{World State}
\neq
\text{Representation State}
\neq
\text{Arithmetic State}
}
$$

其中：

- **World State** 描述幾何世界本身的結構；
- **Representation State** 描述同一世界如何被座標、浮點數、符號或圖形表示；
- **Arithmetic State** 描述該表示是否具有 exact rational、integer、algebraic 或其他算術性質。

因此，一個浮點候補不能只因為視覺上接近某個整數形狀，就被視為 exact arithmetic object。反過來，同一個 exact world 也可能有許多不同 representation，而仍屬於同一個世界等價類。

P1 將正式定義：

1. finite geometric world；
2. container 與 center；
3. object graph 與 relation graph；
4. metric field；
5. constraint system；
6. scale action；
7. gauge；
8. representation map；
9. arithmetic annotation；
10. world equivalence；
11. world homomorphism / isomorphism；
12. canonical world state；
13. reconstruction target；
14. verification semantics。

最後本文將 Perfect Cuboid 編碼成 GERES world object，作為後續 P2 Global Scale Engine 與 P3 Synthetic Rational Recovery 的形式輸入。

---

# 1. 世界作為基本研究物件

## 1.1 基本定義

定義一個有限幾何世界：

$$
W
=
(\mathcal C,
\mathfrak c,
\mathcal O,
\mathcal R,
\mathcal A,
\mathcal M,
\Phi,
\Gamma).
$$

各部分含義如下。

### Container

$$
\mathcal C
$$

是承載世界狀態的 ambient container。

它可以是：

$$
\mathbb R^n,
$$

也可以是某個更一般的 metric space、manifold、affine space、projective space 或離散嵌入空間。

### Center

$$
\mathfrak c
$$

是指定的中心、參考點或 transformation origin。

它不必永遠是幾何質心，也不必是 intrinsic invariant。它是一個可以由 gauge policy 指定的 reference object。

### Object Set

$$
\mathcal O
=
\{o_1,\ldots,o_N\}
$$

是世界中被追蹤的基本物件集合。

例如：

- vertices；
- edges；
- faces；
- diagonals；
- planes；
- centers；
- auxiliary points；
- derived metric objects。

### Relation Set

$$
\mathcal R
$$

描述物件間的關係。

例如：

$$
o_i\;\mathsf{incident}\;o_j,
$$

$$
o_i\;\mathsf{parallel}\;o_j,
$$

$$
o_i\;\mathsf{orthogonal}\;o_j,
$$

$$
o_i\;\mathsf{contains}\;o_j.
$$

### Attribute Field

$$
\mathcal A
$$

描述非純度量屬性。

例如：

- type；
- orientation；
- layer；
- role；
- dependency；
- symbolic name；
- scale weight。

### Metric Field

$$
\mathcal M
$$

描述可測量的幾何量，例如：

$$
L,
\qquad
A,
\qquad
V,
\qquad
\theta,
\qquad
d,
\qquad
\kappa.
$$

### Constraint System

$$
\Phi
=
\{\phi_1,\ldots,\phi_m\}
$$

是世界合法性的約束集合。

### Gauge Policy

$$
\Gamma
$$

指定哪些自由度被視為 representation redundancy，以及如何選擇 canonical representative。

---

# 2. 世界不是座標

## 2.1 抽象世界與其表示

定義一個 representation map：

$$
\rho:
W
\longrightarrow
\widetilde W.
$$

其中：

$$
\widetilde W
$$

不是世界本身，而是世界的一個具體表示。

例如：

- Cartesian coordinates；
- homogeneous coordinates；
- floating-point arrays；
- symbolic expressions；
- graph serialization；
- JSON；
- SVG；
- 3D mesh。

因此：

$$
W
\neq
\rho(W).
$$

同一個 $W$ 可以有多個表示：

$$
\rho_1(W),
\qquad
\rho_2(W),
\qquad
\ldots
$$

它們在數值、格式甚至維度上可能不同，但仍指向同一抽象世界。

---

## 2.2 Representation State

定義：

$$
R_W
=
(\rho,\mathbb D,p,\eta),
$$

其中：

- $\rho$：representation map；
- $\mathbb D$：representation domain；
- $p$：precision policy；
- $\eta$：encoding / serialization metadata。

例如一個浮點表示可以寫成：

$$
R_W^{\mathrm{float64}}.
$$

而 exact rational 表示可以寫成：

$$
R_W^{\mathbb Q}.
$$

兩者可能表示同一個 world state。

---

# 3. 算術狀態獨立於世界狀態

## 3.1 Arithmetic Annotation

定義算術註記函數：

$$
\alpha:
\mathcal M
\longrightarrow
\mathfrak A,
$$

其中：

$$
\mathfrak A
=
\{
\mathrm{Float},
\mathrm{Interval},
\mathrm{Rational},
\mathrm{Integer},
\mathrm{Algebraic},
\mathrm{TranscendentalUnknown},
\mathrm{Symbolic},
\mathrm{Unresolved}
\}.
$$

例如：

$$
\alpha(L_i)
=
\mathrm{Rational}.
$$

或：

$$
\alpha(L_j)
=
\mathrm{Float}.
$$

---

## 3.2 三層分離原則

GERES 採用：

$$
\boxed{
\text{Geometry}
\perp
\text{Representation}
\perp
\text{Arithmetic Annotation}
}
$$

這裡的 $\perp$ 不是指嚴格的數學正交，而是表示三種語義不能被互相替代。

例如：

$$
\text{a visually rectangular box}
$$

不能推出：

$$
\text{all seven lengths are rational}.
$$

而：

$$
\text{all coordinates stored as integers}
$$

也不能單獨推出：

$$
\text{the intended geometric constraints hold}.
$$

---

# 4. Object Graph

## 4.1 世界圖

定義 object graph：

$$
G_O
=
(V_O,E_O),
$$

其中：

$$
V_O
\equiv
\mathcal O.
$$

邊：

$$
E_O
$$

代表物件間的語義關係。

若 relation 有類型，則：

$$
E_O
\subseteq
\mathcal O
\times
\mathcal T_R
\times
\mathcal O.
$$

其中 $\mathcal T_R$ 是 relation type set。

---

## 4.2 Constraint Graph

除了 object graph，還需要 constraint graph：

$$
G_\Phi
=
(V_\Phi,E_\Phi).
$$

一個方便的設計是 bipartite graph：

$$
V_\Phi
=
\mathcal Q
\cup
\Phi,
$$

其中 $\mathcal Q$ 是所有被 constraints 使用的 quantities。

若某 quantity $q_i$ 出現在 constraint $\phi_j$，則：

$$
(q_i,\phi_j)\in E_\Phi.
$$

這使我們可以直接看到：

- 哪些量彼此耦合；
- 哪些 constraint 是局部的；
- 哪些 constraint 具有高 dependency degree；
- 哪個 arithmetic channel 尚未閉合。

---

# 5. Dependency Semantics

## 5.1 Primitive 與 Derived Quantities

將 metric quantities 分成：

$$
\mathcal Q
=
\mathcal Q_{\mathrm{primitive}}
\cup
\mathcal Q_{\mathrm{derived}}.
$$

Primitive quantity 是 world definition 的自由參數。

Derived quantity 則由：

$$
q_j
=
f_j(q_{i_1},\ldots,q_{i_k})
$$

決定。

例如長方體中可以選：

$$
a,b,c
$$

為 primitive quantities，

而：

$$
d_{ab},
d_{ac},
d_{bc},
g
$$

作為 derived quantities。

但在 arithmetic reconstruction 階段，也可以暫時把全部七個 quantity 都提升為 joint unknowns，再由 constraint system enforce consistency。

這兩種模式必須在語義中分開：

$$
\mathrm{GenerativeMode}
$$

與：

$$
\mathrm{ConstraintMode}.
$$

---

# 6. Scale Weight

## 6.1 尺度權重函數

定義：

$$
\omega:
\mathcal Q
\longrightarrow
\mathbb Z.
$$

例如：

$$
\omega(L)=1,
$$

$$
\omega(A)=2,
$$

$$
\omega(V)=3,
$$

$$
\omega(\theta)=0.
$$

全域尺度作用：

$$
S_\lambda(q)
=
\lambda^{\omega(q)}q.
$$

若：

$$
\omega(q)=0,
$$

則 $q$ 為 scale invariant。

---

## 6.2 Dimensionless Invariants

定義：

$$
\mathcal I(W)
$$

為所有在 scale action 下不變的 quantities。

例如：

$$
\frac{L_i}{L_j},
$$

$$
\theta,
$$

$$
\frac{A_i}{L_j^2},
$$

$$
\frac{V_i}{L_j^3}.
$$

若：

$$
W'
=
S_\lambda(W),
$$

則應有：

$$
\mathcal I(W')
=
\mathcal I(W).
$$

這是世界等價檢驗的重要必要條件。

---

# 7. Container 與 Center

## 7.1 Container Semantics

Container 不只是畫布。

對 GERES 而言，container 至少包含：

$$
\mathcal C
=
(X,\mathsf d,\mathsf B,\mathsf F),
$$

其中：

- $X$：ambient set；
- $\mathsf d$：metric 或 distance rule；
- $\mathsf B$：boundary policy；
- $\mathsf F$：reference frame。

若 world transformation 改變 container 本身，必須明確區分：

$$
T_W
$$

與：

$$
T_{\mathcal C}.
$$

---

## 7.2 Center Semantics

中心：

$$
\mathfrak c
$$

可以是：

- geometric center；
- centroid；
- circumcenter；
- origin；
- user-selected anchor；
- canonical gauge point。

全域縮放：

$$
T_{\lambda,\mathfrak c}(x)
=
\mathfrak c+\lambda(x-\mathfrak c).
$$

若同時讓 container 也縮放，則：

$$
T_{\lambda,\mathfrak c}(\mathcal C)
$$

與：

$$
T_{\lambda,\mathfrak c}(W)
$$

必須共享同一 transformation parameter。

這正是「從中心與容器開始」的全域一致性要求。

---

# 8. Global Transformation

## 8.1 世界轉換算子

定義：

$$
T:
W
\longrightarrow
W'.
$$

一個合法 GERES world transformation 必須指定：

$$
T
=
(T_{\mathcal C},
T_{\mathfrak c},
T_{\mathcal O},
T_{\mathcal R},
T_{\mathcal A},
T_{\mathcal M},
T_{\Phi},
T_{\Gamma}).
$$

實作中某些分量可能是 identity map，但不可省略其語義。

---

## 8.2 Transformation Consistency

若 object $o_i$ 的 metric quantity $q_i$ 是由其他物件推導得到，則 transformation 必須滿足：

$$
T(q_i)
=
T(f_i(q_{j_1},\ldots,q_{j_k}))
$$

與：

$$
f_i(T(q_{j_1}),\ldots,T(q_{j_k}))
$$

一致。

理想情況要求 commute：

$$
T\circ f_i
=
f_i\circ T.
$$

這是 transformation legitimacy 的核心條件。

---

# 9. 世界等價關係

## 9.1 Scale Equivalence

定義：

$$
W_1
\sim_s
W_2
$$

若存在 $\lambda>0$ 與合法 center，使：

$$
W_2
=
S_\lambda(W_1)
$$

並保持指定 invariants。

---

## 9.2 Rigid Equivalence

定義：

$$
W_1
\sim_r
W_2
$$

若可由 rigid transformation：

$$
x
\mapsto
Rx+t
$$

互相取得，其中：

$$
R^\top R
=
I.
$$

---

## 9.3 Similarity Equivalence

定義：

$$
W_1
\sim_{\mathrm{sim}}
W_2
$$

若存在：

$$
x
\mapsto
\lambda Rx+t.
$$

GERES 的第一版主要處理：

$$
\sim_{\mathrm{sim}}
$$

中的 scale subaction。

---

## 9.4 Representation Equivalence

若：

$$
\rho_1(W)
$$

與：

$$
\rho_2(W)
$$

只是 encoding 不同，則記：

$$
\rho_1(W)
\sim_{\mathrm{repr}}
\rho_2(W).
$$

---

## 9.5 Arithmetic Equivalence

若兩個 exact representations 代表同一 normalized rational world，但只是 common denominator 不同，則可以定義：

$$
W_1
\sim_{\mathrm{arith}}
W_2.
$$

例如：

$$
(3,4,5)
\sim_{\mathrm{arith}}
(6,8,10).
$$

---

# 10. Equivalence Class Stack

同一個 world 可以同時落在多層 quotient 中：

$$
W
\rightarrow
[W]_{\mathrm{repr}}
\rightarrow
[W]_{\mathrm{rigid}}
\rightarrow
[W]_{\mathrm{scale}}
\rightarrow
[W]_{\mathrm{sim}}.
$$

GERES 不應在一開始把所有 quotient 混成一個。

不同問題需要不同的等價層。

例如 Perfect Cuboid 的 arithmetic existence，主要關心：

$$
[W]_{\mathrm{scale}},
$$

因為 common scaling 不改變其「是否存在有理形狀」的本質。

---

# 11. Gauge

## 11.1 Gauge Freedom

若：

$$
W
\sim_s
S_\lambda(W),
$$

則 $\lambda$ 是 redundancy。

不 quotient 這個自由度，搜索空間會多一個無意義維度。

---

## 11.2 Gauge Fixing

定義 gauge condition：

$$
\gamma(W)=0.
$$

例如：

$$
g-1=0.
$$

因此：

$$
g=1.
$$

也可以使用：

$$
a+b+c=1,
$$

或：

$$
\|L\|_2=1.
$$

但 gauge 必須滿足：

1. 在 admissible orbit 上存在；
2. 儘可能唯一；
3. 不引入奇異點；
4. 對 arithmetic reconstruction 友善。

---

## 11.3 Gauge Singularity

若 gauge denominator 為零，或某 orbit 多次穿越 gauge surface，則 gauge 可能失效。

因此每個 gauge 都必須附帶 domain：

$$
\operatorname{Dom}(\Gamma).
$$

---

# 12. Canonical Representative

定義 canonicalization map：

$$
\kappa:
[W]
\longrightarrow
W_{\mathrm{can}}.
$$

理想上：

$$
\kappa(W_1)
=
\kappa(W_2)
$$

只要：

$$
W_1\sim W_2.
$$

對 rational metric world，一個可能的 canonicalization pipeline 是：

$$
W
\rightarrow
W_{\mathrm{norm}}
\rightarrow
W_{\mathbb Q}
\rightarrow
W_{\mathbb Z}
\rightarrow
W_{\mathrm{primitive}}.
$$

最後再加 ordering convention：

$$
a\le b\le c
$$

或其他 symmetry-breaking rule。

---

# 13. Arithmetic Domain

## 13.1 Arithmetic Universe

GERES 不應把 arithmetic domain 固定成 $\mathbb Q$。

定義：

$$
\mathbb A
\in
\{
\mathbb Z,
\mathbb Q,
\overline{\mathbb Q},
K,
R
\}.
$$

其中 $K$ 可為 number field，$R$ 可為指定 ring。

因此 reconstruction target 可以寫成：

$$
W^\ast
\in
\mathcal V(\mathbb A).
$$

Perfect Cuboid 第一階段選：

$$
\mathbb A
=
\mathbb Q.
$$

---

# 14. Exact 與 Approximate Constraint

每個 constraint 必須有 mode：

$$
\mu(\phi_i)
\in
\{
\mathrm{Exact},
\mathrm{Approximate},
\mathrm{Observed}
\}.
$$

例如：

$$
a^2+b^2-d_{ab}^2=0
$$

若是 Perfect Cuboid theorem constraint，必須標示：

$$
\mathrm{Exact}.
$$

若只是浮點 sensor observation，才可以有：

$$
|a^2+b^2-d_{ab}^2|
<
\epsilon.
$$

這兩種語義不可交換。

---

# 15. Residual 不是 Truth Value

定義 numerical residual：

$$
r_i(\widetilde W)
=
|\phi_i(\widetilde W)|.
$$

若：

$$
r_i
\ll1,
$$

只能表示：

$$
\widetilde W
$$

在目前 representation precision 下接近 constraint locus。

不能推出：

$$
\phi_i(W^\ast)=0.
$$

因此 GERES 將：

$$
\mathrm{ResidualScore}
$$

與：

$$
\mathrm{ExactTruth}
$$

完全分開。

---

# 16. Interval World

對 floating observations，建議不直接儲存單一數：

$$
\tilde q.
$$

而使用 interval：

$$
I(q)
=
[\tilde q-\delta_q,\tilde q+\delta_q].
$$

因此 observed world 可以寫成：

$$
W_I.
$$

Exact candidate $W^\ast$ 若要與 observation 相容，至少要求：

$$
q^\ast
\in
I(q)
$$

或滿足明確指定的 likelihood / tolerance semantics。

---

# 17. World Homomorphism

定義世界映射：

$$
F:
W_1
\longrightarrow
W_2.
$$

若 $F$ 保持指定的 object types、relations 與 constraints，稱為 world homomorphism。

若存在 inverse：

$$
F^{-1},
$$

且：

$$
F^{-1}\circ F
=
\mathrm{id},
$$

$$
F\circ F^{-1}
=
\mathrm{id},
$$

則稱為 world isomorphism。

如果只在 quotient 後可逆，則稱：

$$
\text{equivalence isomorphism}.
$$

這個概念後續會用於：

- cross-geometry transfer；
- normalized world 對 integer world；
- floating projection 對 exact source world。

---

# 18. Reconstruction 不是任意 Best Fit

定義 reconstruction operator：

$$
\mathcal R:
(\widetilde W,\Phi,\mathbb A,\mathcal B)
\longrightarrow
\mathcal P,
$$

其中 $\mathcal B$ 是 search / height / precision bounds。

輸出：

$$
\mathcal P
$$

必須是以下之一：

$$
\mathrm{Unique}(W^\ast),
$$

$$
\mathrm{Ambiguous}(\{W_1^\ast,\ldots,W_k^\ast\}),
$$

$$
\mathrm{NoCertifiedRecovery},
$$

$$
\mathrm{InsufficientPrecision}.
$$

禁止把 optimization 的 best-fit 結果直接等同：

$$
\mathrm{Unique}(W^\ast).
$$

---

# 19. Unique Recovery 的形式條件

若要宣稱 unique recovery，至少需要：

$$
W^\ast
\in
\mathcal V(\mathbb A),
$$

並且在 admissible region $\Omega$ 與 complexity bound $H$ 下：

$$
\forall W'\in\mathcal V(\mathbb A)\cap\Omega,
$$

若：

$$
H(W')\le H_{\max},
$$

且 $W'$ 與 observation 相容，則：

$$
W'=W^\ast
$$

在指定 equivalence relation 下成立。

更準確地：

$$
[W']=[W^\ast].
$$

---

# 20. World Certificate

GERES certificate 定義為：

$$
\mathcal C_W
=
(
W^\ast,
\Phi^\ast,
\Pi,
\Sigma,
\Gamma,
\mathcal T,
\mathcal H
).
$$

其中：

- $W^\ast$：exact world；
- $\Phi^\ast$：exact constraints；
- $\Pi$：proof / verification data；
- $\Sigma$：symmetry data；
- $\Gamma$：gauge data；
- $\mathcal T$：transformation trace；
- $\mathcal H$：hash / provenance。

---

# 21. Certificate 最小要求

一個 Perfect Cuboid exact certificate 至少需要輸出：

$$
a,b,c,d_{ab},d_{ac},d_{bc},g\in\mathbb Z_{>0},
$$

以及：

$$
a^2+b^2=d_{ab}^2,
$$

$$
a^2+c^2=d_{ac}^2,
$$

$$
b^2+c^2=d_{bc}^2,
$$

$$
a^2+b^2+c^2=g^2.
$$

此外若要求 primitive：

$$
\gcd(a,b,c,d_{ab},d_{ac},d_{bc},g)=1.
$$

這些必須由 exact integer arithmetic 驗證。

---

# 22. Perfect Cuboid 世界編碼

現在將 Perfect Cuboid 編碼成：

$$
W_{\mathrm{PC}}.
$$

---

## 22.1 Container

$$
\mathcal C
=
\mathbb R^3.
$$

---

## 22.2 Center

若使用軸對稱中心式表示，可取：

$$
\mathfrak c
=
(0,0,0).
$$

---

## 22.3 Vertices

令：

$$
V
=
\left\{
\left(
\pm\frac a2,
\pm\frac b2,
\pm\frac c2
\right)
\right\}.
$$

共八個頂點。

---

## 22.4 Edge Classes

三個 edge classes：

$$
E_a,
\qquad
E_b,
\qquad
E_c.
$$

長度：

$$
|E_a|=a,
$$

$$
|E_b|=b,
$$

$$
|E_c|=c.
$$

---

## 22.5 Face Diagonal Classes

$$
D_{ab},
\qquad
D_{ac},
\qquad
D_{bc}.
$$

長度：

$$
d_{ab},
\qquad
d_{ac},
\qquad
d_{bc}.
$$

---

## 22.6 Body Diagonal

$$
D_g
$$

長度：

$$
g.
$$

---

## 22.7 Constraint System

$$
\Phi_{\mathrm{PC}}
=
\{
\phi_{ab},
\phi_{ac},
\phi_{bc},
\phi_g
\},
$$

其中：

$$
\phi_{ab}
=
a^2+b^2-d_{ab}^2,
$$

$$
\phi_{ac}
=
a^2+c^2-d_{ac}^2,
$$

$$
\phi_{bc}
=
b^2+c^2-d_{bc}^2,
$$

$$
\phi_g
=
a^2+b^2+c^2-g^2.
$$

Perfect Cuboid exact condition 為：

$$
\phi_{ab}
=
\phi_{ac}
=
\phi_{bc}
=
\phi_g
=
0.
$$

---

# 23. Perfect Cuboid 的 Scale Action

所有長度的尺度權重均為：

$$
\omega=1.
$$

因此：

$$
a'
=
\lambda a,
$$

$$
b'
=
\lambda b,
$$

$$
c'
=
\lambda c,
$$

$$
d'_{ab}
=
\lambda d_{ab},
$$

$$
d'_{ac}
=
\lambda d_{ac},
$$

$$
d'_{bc}
=
\lambda d_{bc},
$$

$$
g'
=
\lambda g.
$$

所以：

$$
\phi'_{ab}
=
\lambda^2\phi_{ab},
$$

其餘同理。

因此若原世界 exact：

$$
\Phi_{\mathrm{PC}}=0,
$$

則縮放後仍 exact。

---

# 24. Perfect Cuboid Gauge

取：

$$
g=1.
$$

定義：

$$
x=\frac ag,
$$

$$
y=\frac bg,
$$

$$
z=\frac cg,
$$

$$
u=\frac{d_{ab}}g,
$$

$$
v=\frac{d_{ac}}g,
$$

$$
w=\frac{d_{bc}}g.
$$

得到 normalized world：

$$
\widehat W_{\mathrm{PC}}
=
(x,y,z,u,v,w).
$$

constraints：

$$
x^2+y^2-u^2=0,
$$

$$
x^2+z^2-v^2=0,
$$

$$
y^2+z^2-w^2=0,
$$

$$
x^2+y^2+z^2-1=0.
$$

---

# 25. Perfect Cuboid 的 Arithmetic Target

Exact rational target：

$$
\widehat W_{\mathrm{PC}}^\ast
\in
\mathbb Q_{>0}^6.
$$

若存在：

$$
\widehat W_{\mathrm{PC}}^\ast,
$$

則可取共同 denominator：

$$
Q
=
\operatorname{lcm}
(
\operatorname{den}(x),
\operatorname{den}(y),
\operatorname{den}(z),
\operatorname{den}(u),
\operatorname{den}(v),
\operatorname{den}(w)
).
$$

恢復：

$$
a=Qx,
$$

$$
b=Qy,
$$

$$
c=Qz,
$$

$$
d_{ab}=Qu,
$$

$$
d_{ac}=Qv,
$$

$$
d_{bc}=Qw,
$$

$$
g=Q.
$$

之後再 primitive reduction。

---

# 26. Symmetry

Perfect Cuboid 在 edge permutation 下具有：

$$
S_3
$$

對稱性。

也就是：

$$
(a,b,c)
$$

可被置換。

因此 canonical ordering 可取：

$$
a\le b\le c.
$$

在 normalized world：

$$
x\le y\le z.
$$

這可以排除六倍重複搜索。

---

# 27. Orientation 與 Arithmetic 不應混淆

在純長度問題中，orientation：

$$
\operatorname{sgn}(\det R)
$$

通常不是 Perfect Cuboid arithmetic existence 的核心 invariant。

因此可以在 geometry rendering 保留 orientation，但在 arithmetic quotient 中忽略 mirror equivalence。

這表示：

$$
\text{rendering equivalence}
$$

與：

$$
\text{arithmetic equivalence}
$$

不必完全相同。

---

# 28. 世界狀態機

為方便實作，定義 GERES world state：

$$
\sigma(W)
\in
\{
\mathrm{Observed},
\mathrm{Normalized},
\mathrm{Proposed},
\mathrm{ConstraintChecked},
\mathrm{ExactRecovered},
\mathrm{Integralized},
\mathrm{Canonicalized},
\mathrm{Certified},
\mathrm{Rejected}
\}.
$$

合法 transition 例如：

$$
\mathrm{Observed}
\rightarrow
\mathrm{Normalized},
$$

$$
\mathrm{Normalized}
\rightarrow
\mathrm{Proposed},
$$

$$
\mathrm{Proposed}
\rightarrow
\mathrm{ConstraintChecked}.
$$

但禁止：

$$
\mathrm{Observed}
\rightarrow
\mathrm{Certified}
$$

直接跳躍。

---

# 29. World Ledger

每一步 transition 都必須寫入 ledger：

$$
\mathcal L
=
\{
\ell_1,\ldots,\ell_T
\}.
$$

每筆至少包含：

$$
\ell_t
=
(
t,
\sigma_{\mathrm{in}},
T_t,
\sigma_{\mathrm{out}},
\mathrm{params},
\mathrm{verification}
).
$$

這是日後 algorithm-to-theorem compilation 的原始材料。

---

# 30. Formal Invariants

GERES 第一版至少追蹤以下 invariant classes。

## 30.1 Structural Invariants

$$
I_{\mathrm{struct}}
$$

例如 object count、incidence、adjacency。

## 30.2 Geometric Invariants

$$
I_{\mathrm{geom}}
$$

例如 angle、parallelism、orthogonality。

## 30.3 Scale Invariants

$$
I_{\mathrm{scale}}
$$

例如：

$$
\frac ab,
\qquad
\frac ac,
\qquad
\frac{d_{ab}}g.
$$

## 30.4 Arithmetic Invariants

$$
I_{\mathrm{arith}}
$$

例如 reduced rational ratios、denominator structure、primitive gcd。

不同 transformation 可以保持不同 invariant subset。

---

# 31. Transformation Contract

任何 transformation 必須附 contract：

$$
\mathfrak T
=
(
\mathrm{Pre},
\mathrm{Action},
\mathrm{Preserve},
\mathrm{Post},
\mathrm{Proof}
).
$$

例如 scale transformation：

### Pre

$$
\lambda>0.
$$

### Action

$$
q\mapsto\lambda^{\omega(q)}q.
$$

### Preserve

$$
I_{\mathrm{struct}},
I_{\mathrm{geom}},
I_{\mathrm{scale}}.
$$

### Post

world remains in same scale equivalence class。

### Proof

加權齊次 preservation。

---

# 32. Reconstruction Contract

Reconstruction 與 transformation 不同。

Transformation 已知 source world，改變 representation / scale。

Reconstruction 則由 observation 推測 source world。

因此：

$$
\mathrm{Transform}
\neq
\mathrm{Recover}.
$$

Reconstruction contract：

$$
\mathfrak R
=
(
\mathrm{Observation},
\mathrm{Domain},
\mathrm{Bounds},
\mathrm{CandidateGenerator},
\mathrm{ExactGate},
\mathrm{UniquenessGate}
).
$$

---

# 33. 可視化與 Canonical State

WESL 可視化軟體應同時顯示四個 state：

$$
W_{\mathrm{obs}},
$$

$$
W_{\mathrm{norm}},
$$

$$
W_{\mathrm{exact}},
$$

$$
W_{\mathrm{can}}.
$$

如果某 state 尚不存在，不應偽造。

例如尚未 exact recover 時：

$$
W_{\mathrm{exact}}
=
\varnothing.
$$

UI 應標記：

**UNRESOLVED**

而不是畫出一個看似精確的整數長方體。

---

# 34. 世界差異函數

可定義多種 distance。

## Representation Distance

$$
D_{\mathrm{repr}}
(
\widetilde W_1,
\widetilde W_2
).
$$

## Shape Distance

在 quotient scale 後：

$$
D_{\mathrm{shape}}
(
[W_1],
[W_2]
).
$$

## Constraint Distance

$$
D_\Phi(W)
=
\sum_i
w_i|\phi_i(W)|^2.
$$

## Arithmetic Complexity Distance

例如：

$$
D_{\mathrm{arith}}(W)
=
\log H(W).
$$

但這些 distance 都只是 search aids，不是 exact equivalence proof。

---

# 35. Arithmetic Height

對：

$$
r=\frac pq
$$

且：

$$
\gcd(p,q)=1,
$$

可定義：

$$
H(r)
=
\max(|p|,|q|).
$$

對 world：

$$
W=(r_1,\ldots,r_n),
$$

可定義：

$$
H(W)
=
\max_iH(r_i).
$$

或 multiplicative height。

GERES P3 之後應固定一套 canonical height convention，避免不同實驗不可比較。

---

# 36. Local Proposal 與 Global Acceptance

局部工具可以提出：

$$
q_i
\approx
\frac{p_i}{q_i'}.
$$

但 acceptance 只能在 world 層發生：

$$
\mathrm{Accept}(W^\ast)
\iff
\left[
W^\ast\in\mathcal V(\mathbb A)
\right]
\land
\left[
\mathrm{ObsCompatible}(W^\ast)
\right]
\land
\left[
\mathrm{UniquenessOrDeclaredAmbiguity}
\right].
$$

這條規則是 GERES 的核心安全閘。

---

# 37. 世界閉合

定義 arithmetic closure predicate：

$$
\operatorname{Closed}_{\mathbb A}(W).
$$

若所有 theorem-required quantities 均位於 arithmetic domain $\mathbb A$，且全部 exact constraints 成立，則：

$$
\operatorname{Closed}_{\mathbb A}(W)
=
\mathrm{True}.
$$

Perfect Cuboid 要求：

$$
\operatorname{Closed}_{\mathbb Q}
(
\widehat W_{\mathrm{PC}}
).
$$

再透過 global scaling 得到：

$$
\operatorname{Closed}_{\mathbb Z}
(
W_{\mathrm{PC}}
).
$$

---

# 38. Partial Closure

允許定義：

$$
\operatorname{ClosureVector}(W)
=
(c_1,\ldots,c_m),
$$

其中：

$$
c_i\in\{0,1\}
$$

代表第 $i$ 個 arithmetic channel 是否閉合。

這對目前已有的 Perfect Cuboid near-world 特別有用。

例如可以表成：

$$
(1,1,1,0)
$$

而不是模糊說：

「幾乎完美」。

這種表示能避免心理或視覺上的近似誤導。

---

# 39. World Semantics 的最小公理集

P1 暫定以下公理作為 GERES 實作核心。

### Axiom W1 — Object Integrity

世界物件具有穩定 identity。

### Axiom W2 — Relation Explicitness

所有 theorem-relevant relation 必須顯式記錄。

### Axiom W3 — Constraint Separation

Exact constraint 與 observed tolerance 不得混用。

### Axiom W4 — Transformation Globality

若 operation 被標為 global transformation，則所有被 transformation contract 覆蓋的 quantities 必須由同一 transformation parameter set 作用。

### Axiom W5 — Representation Non-Identity

representation 不等同 world。

### Axiom W6 — Arithmetic Non-Inference

浮點接近不自動推出 exact arithmetic property。

### Axiom W7 — Gauge Transparency

所有 gauge fixing 必須可追蹤、可反轉或明確聲明 quotient。

### Axiom W8 — Certificate Finality

只有 exact verification 通過後，world 才能進入 Certified state。

---

# 40. P1 的核心命題

### 命題 P1-A：Representation Independence

若兩個 representation：

$$
\rho_1(W),
\qquad
\rho_2(W)
$$

都忠實表示同一 abstract world，則 theorem-relevant property 應由 $W$ 決定，而不應由 serialization format 決定。

### 命題 P1-B：Scale Quotient Reduction

若研究命題對 uniform scaling invariant，則可先研究：

$$
W/\mathbb R_{>0}.
$$

### 命題 P1-C：Exact Closure Invariance

若 $W$ 在某 arithmetic domain 中 exact closed，且 transformation 是該 domain 上的合法 exact equivalence map，則 transformed world 仍 exact closed。

### 命題 P1-D：Approximation Non-Closure

任意有限小 residual：

$$
D_\Phi(\widetilde W)>0
$$

不能單獨推出存在 exact source world。

---

# 41. 實作資料結構草案

未來程式可以用以下抽象 schema：

```text
World
├── world_id
├── container
├── center
├── objects[]
├── relations[]
├── attributes{}
├── quantities[]
├── constraints[]
├── gauge
├── representation_state
├── arithmetic_state
├── invariants[]
├── transformations[]
├── ledger[]
└── certificate
```

Quantity：

```text
Quantity
├── quantity_id
├── semantic_role
├── value
├── domain
├── precision
├── interval
├── scale_weight
├── primitive_or_derived
└── dependencies[]
```

Constraint：

```text
Constraint
├── constraint_id
├── expression
├── mode
├── variables[]
├── scale_degree
├── exact_status
└── verification_record
```

---

# 42. Machine-Oriented Canonical Form

為了讓多 AI、多程式語言與 proof system 互通，建議每個 world 同時保留：

1. human-readable Markdown；
2. canonical JSON / ISQL-like structure；
3. exact symbolic expressions；
4. deterministic ordering；
5. hashable certificate bundle。

Canonical serialization 必須避免：

- 隨機 object ordering；
- locale-dependent number format；
- float-only exact data；
- 隱性 unit conversion。

---

# 43. Units

scale 與 unit conversion 不應混為一談。

若：

$$
1\mathrm m
=
100\mathrm{ cm},
$$

這是 representation / unit conversion。

而：

$$
W
\mapsto
2W
$$

是幾何 world scaling。

兩者數值上可能相似，但語義不同。

因此：

$$
T_{\mathrm{unit}}
\neq
T_{\mathrm{world}}.
$$

---

# 44. Dimensional Consistency

每個 quantity 除了 scale weight 外，還應具有 dimension signature：

$$
\dim(q).
$$

例如：

$$
\dim(L)=L,
$$

$$
\dim(A)=L^2,
$$

$$
\dim(V)=L^3.
$$

constraints 必須 dimensionally consistent。

例如：

$$
a^2+b^2=d^2
$$

三項 dimension 都是：

$$
L^2.
$$

---

# 45. Degenerate Worlds

GERES 不應假定所有 world 都 nondegenerate。

Perfect Cuboid admissibility 必須加入：

$$
a>0,
$$

$$
b>0,
$$

$$
c>0.
$$

必要時還可加入：

$$
a<b<c
$$

作 canonical symmetry-breaking，但這不是幾何存在條件。

---

# 46. Boundary Conditions

若 container 有 finite boundary，global scaling 可能導致：

$$
T_\lambda(W)
\not\subseteq
\mathcal C.
$$

因此需要區分：

$$
\text{mathematical container}
$$

與：

$$
\text{visualization viewport}.
$$

數學 world 不應因為畫面裁切而被視為非法。

---

# 47. Multi-World Comparison

定義 comparison operator：

$$
\mathfrak C(W_1,W_2).
$$

可輸出：

- structural match；
- scale-equivalence status；
- shape distance；
- arithmetic-domain difference；
- constraint difference；
- certificate difference。

這會成為 P3、P4 benchmark 的核心工具。

---

# 48. 反事實世界

世界模型方法允許建立 counterfactual world：

$$
W_{\mathrm{cf}}.
$$

例如：

只改變一個 face diagonal，保持其他數值不變。

但這種世界不必合法。

因此它必須標記：

$$
\mathrm{Counterfactual}
$$

而非：

$$
\mathrm{Equivalent}.
$$

這對測試 reconstruction gate 非常重要。

---

# 49. Perfect Cuboid 的最小 World Graph

可以用下列 quantity nodes：

$$
\{
a,b,c,d_{ab},d_{ac},d_{bc},g
\}.
$$

constraint nodes：

$$
\{
\phi_{ab},
\phi_{ac},
\phi_{bc},
\phi_g
\}.
$$

edges：

$$
a\leftrightarrow\phi_{ab},
$$

$$
b\leftrightarrow\phi_{ab},
$$

$$
d_{ab}\leftrightarrow\phi_{ab},
$$

其餘同理。

這個 graph 已足以讓程式：

- 顯示 arithmetic channel；
- 做 dependency propagation；
- 做 exact gate；
- 標示哪個 constraint 未 closure。

---

# 50. 後續 P2 的直接輸入

P1 完成後，P2 Global Scale Engine 不需要再重新定義語義。

P2 只需要實作：

$$
S_\lambda
$$

並驗證：

$$
\mathcal I(W)
=
\mathcal I(S_\lambda W),
$$

以及：

$$
\Phi(W)=0
\Longrightarrow
\Phi(S_\lambda W)=0.
$$

此外軟體上要同時縮放：

- container reference；
- center-relative geometry；
- all dependent metric quantities；
- constraint visualization。

---

# 51. 後續 P3 的直接輸入

P3 Synthetic Rational Recovery 可自動：

1. 生成 exact rational world：

$$
W^\ast;
$$

2. 轉成 high precision real representation；

3. 人為加入 controlled perturbation：

$$
\widetilde W
=
W^\ast+\epsilon;
$$

4. 丟給 reconstruction engine；

5. 比較：

$$
\mathcal R(\widetilde W)
$$

與：

$$
W^\ast.
$$

如果無法在 known-answer control 上可靠恢復，則不得直接對未知 Perfect Cuboid candidate 宣稱成功。

---

# 52. 本階段不處理的問題

P1 刻意不解決：

- 最佳 rational reconstruction algorithm；
- denominator bound 如何選；
- LLL / PSLQ 如何整合；
- Perfect Cuboid candidate 是否真的來自 exact rational world；
- 是否存在 Perfect Cuboid；
- 一般 algebraic number field reconstruction；
- proof assistant encoding。

這些將在後續階段逐步加入。

---

# 53. Claim Boundary

截至 GERES P1：

已完成：

- finite world formal object；
- representation / arithmetic / geometry 三層分離；
- object graph；
- constraint graph；
- dependency semantics；
- scale weights；
- center / container semantics；
- transformation contract；
- world equivalence stack；
- gauge；
- canonical representative；
- exact / approximate constraint separation；
- reconstruction status semantics；
- certificate schema；
- Perfect Cuboid formal world encoding；
- world state machine；
- ledger；
- minimal axioms。

尚未完成：

- exact reconstruction algorithm；
- uniqueness theorem；
- practical denominator bounds；
- Perfect Cuboid witness；
- general transfer theorem。

---

# 54. 結論

GERES P1 把「全域等價縮放」從直覺提升成可操作語義。

最重要的不是某一條公式，而是以下分離：

$$
\boxed{
W
\neq
\rho(W)
}
$$

以及：

$$
\boxed{
\text{Geometric Validity}
\neq
\text{Numerical Proximity}
\neq
\text{Arithmetic Exactness}.
}
$$

因此後續所有 Perfect Cuboid 實驗都必須沿著：

$$
\text{Observed World}
\rightarrow
\text{Normalized World}
\rightarrow
\text{Proposed Exact World}
\rightarrow
\text{Exact Constraint Gate}
\rightarrow
\text{Canonical Representative}
\rightarrow
\text{Certificate}
$$

進行。

P1 的最終核心對象可以濃縮為：

$$
\boxed{
W
=
(\mathcal C,
\mathfrak c,
\mathcal O,
\mathcal R,
\mathcal A,
\mathcal M,
\Phi,
\Gamma)
}
$$

而 GERES 的工作不是讓一串浮點數「看起來更漂亮」，而是判斷：

$$
\boxed{
\text{這個觀測表示，究竟屬於哪一個 exact world equivalence class？}
}
$$

---

## 下一階段

**GERES P2 — Global Scale Engine**

目標：

$$
\boxed{
\text{把 P1 的形式語義轉成一個真正可以操作、可視化、驗證 invariant 的全域縮放引擎。}
}
$$

P2 將第一次把：

- container；
- center；
- geometry；
- constraint graph；
- scale orbit；
- normalized state；
- exact state；

放進同一個可執行世界模型中。
