# WSFC Round 14
## Phase Safety Formalization：四種 Nearest-Feature Phase 的完整安全核心

**English Title:** *Phase Safety Formalization: A Complete Safety Kernel for the Four Nearest-Feature Phases*  
**文件代號：** `WSFC-R14-v0.1`  
**版本：** v0.1  
**日期：** 2026-09-23  
**作者：** Neo.K  
**AI 協力研究者：** Aletheia / OpenAI GPT-5.6 Sol  
**系列：** Worm Sequence Freedom Closure  
**前置：** `WSFC-R13-v0.1`  
**狀態：** `PHASE SAFETY CORE CLOSED / EXACT IDENTITIES / CELL COMPOSITION NEXT`  
**Canonical Source：** UTF-8 Markdown

---

# 摘要

Round 13 關掉 compiler 的 root-completeness trust gap：

$$
\boxed{
\text{complete root cover}
\rightarrow
\text{root-free atomic cells}
\rightarrow
\text{sign invariance}.
}
$$

Round 14 不再修改 root machinery，而專門證：

> nearest-feature phase 與 active safety quantity 一旦在 cell 中固定，為什麼整條 finite segment 必安全？

令：

$$
X(\lambda)
=
P_0+\lambda v,
\qquad
0\le\lambda\le1,
$$

$$
w=P_0-C.
$$

定義：

$$
H(\lambda)
=
\|w+\lambda v\|^2-r^2.
$$

再定義：

$$
H_0
=
\|w\|^2-r^2,
$$

$$
A
=
w\cdot v,
$$

$$
N
=
\|v\|^2,
$$

$$
S
=
A+N,
$$

$$
H_1
=
H_0+2A+N,
$$

以及 interior line-clearance numerator：

$$
L
=
NH_0-A^2.
$$

因此：

$$
\boxed{
H(\lambda)
=
H_0+2A\lambda+N\lambda^2.
}
$$

Round 14 將四種 phase 分別化成純 scalar theorem。

---

# 1. Fixed Endpoint Phase

guard：

$$
A\ge0.
$$

因：

$$
N\ge0,
$$

且：

$$
\lambda\ge0,
$$

exact identity：

$$
\boxed{
H(\lambda)-H_0
=
\lambda
(
2A+N\lambda
).
}
$$

右邊 nonnegative。

所以：

$$
\boxed{
H_0\ge0
\Rightarrow
H(\lambda)\ge0
}
$$

對所有：

$$
\lambda\in[0,1].
$$

其實 fixed phase safety甚至不需要上界：

$$
\lambda\le1.
$$

---

# 2. Interior Projection Phase

guard：

$$
N>0,
$$

$$
A\le0,
$$

$$
A+N\ge0.
$$

後兩個 guard確保 unconstrained projection落在：

$$
[0,1].
$$

但安全 theorem本身只需：

$$
N>0
$$

以及：

$$
L\ge0.
$$

exact complete-square identity：

$$
\boxed{
N H(\lambda)
=
L
+
(N\lambda+A)^2.
}
$$

所以：

$$
L\ge0
\Rightarrow
N H(\lambda)\ge0.
$$

因：

$$
N>0,
$$

得到：

$$
\boxed{
H(\lambda)\ge0.
}
$$

這對所有 real $\lambda$ 都成立，因此當然涵蓋 finite segment。

---

# 3. Moving Endpoint Phase

guard：

$$
S=A+N\le0.
$$

令：

$$
\mu=1-\lambda.
$$

對：

$$
0\le\lambda\le1,
$$

有：

$$
\mu\ge0.
$$

exact identity：

$$
\boxed{
H(\lambda)-H_1
=
(1-\lambda)
\left[
-2S+N(1-\lambda)
\right].
}
$$

因：

$$
S\le0,
$$

$$
N\ge0,
$$

兩 factors nonnegative。

因此：

$$
\boxed{
H_1\ge0
\Rightarrow
H(\lambda)\ge0.
}
$$

所以 moving-endpoint safety quantity確實是：

$$
H_1.
$$

---

# 4. Degenerate Segment Phase

若：

$$
N=\|v\|^2=0,
$$

在 Euclidean coordinates：

$$
v_x^2+v_y^2=0.
$$

因 squares nonnegative：

$$
\boxed{
v_x=v_y=0.
}
$$

所以：

$$
v=0,
$$

並：

$$
A=w\cdot v=0.
$$

此時：

$$
\boxed{
H(\lambda)=H_0
}
$$

對所有 $\lambda$。

並：

$$
\boxed{
H_1=H_0.
}
$$

所以 degenerate segment自然降為 point-state safety。

---

# 5. 四個 Phase Safety Rules

因此 compiler 的安全 interface 可以固定：

```text
FIXED_ENDPOINT
    guard:
      N >= 0
      A >= 0
    active safety:
      H0 >= 0

INTERIOR_PROJECTION
    guard:
      N > 0
      A <= 0
      A+N >= 0
    active safety:
      L >= 0

MOVING_ENDPOINT
    guard:
      N >= 0
      A+N <= 0
    active safety:
      H1 >= 0

DEGENERATE_SEGMENT
    guard:
      N = 0
      A = 0
    active safety:
      H0 >= 0
```

這就是 Round 12 compiler 所需的 generic phase theorem API。

---

# 6. Phase Boundary Compatibility

phase switch root不應產生安全語義裂縫。

Round 14 exact check三個 boundary。

## Fixed / Interior

當：

$$
A=0,
$$

有：

$$
\boxed{
L=NH_0.
}
$$

如果：

$$
N>0,
$$

則：

$$
L\ge0
\iff
H_0\ge0.
$$

所以兩側 certificate 語義一致。

---

# 7. Interior / Moving Endpoint

boundary：

$$
S=A+N=0,
$$

即：

$$
A=-N.
$$

exactly：

$$
\boxed{
L=NH_1.
}
$$

對：

$$
N>0,
$$

因此：

$$
L\ge0
\iff
H_1\ge0.
$$

兩 phase在 switch boundary對同一 minimum clearance負責。

---

# 8. Degenerate Boundary

若：

$$
N=0
$$

且它真的來自 geometric norm-square：

$$
N=v_x^2+v_y^2,
$$

則：

$$
v=0.
$$

所以：

$$
A=0,
$$

並：

$$
H_1=H_0.
$$

因此 degenerate state可由 point-state certificate承接。

---

# 9. 為什麼這對 Compiler Soundness 重要

Round 13 已知 atomic cell 中：

- $A$ sign constant；
- $N$ sign constant；
- $S$ sign constant；
- active safety sign constant。

Round 14 現在補：

$$
\boxed{
\text{這些 signs}
\Rightarrow
\text{finite-segment safety}.
}
$$

所以一個 cell的完整責任鏈變成：

$$
\boxed{
\begin{aligned}
&\text{Root Cover}\\
&\Downarrow\\
&\text{Sign-Invariant Cell}\\
&\Downarrow\\
&\text{Nearest Feature}\\
&\Downarrow\\
&\text{Active Safety Quantity}\\
&\Downarrow\\
&\text{Phase Safety Theorem}\\
&\Downarrow\\
&\forall\lambda\in[0,1],\
H(\lambda)\ge0.
\end{aligned}
}
$$

---

# 10. Exact Machine Checks

本輪 SymPy exact 驗：

$$
H-H_0
-
\lambda(2A+N\lambda)
=
0,
$$

$$
NH
-
\left[
L+(N\lambda+A)^2
\right]
=
0,
$$

$$
H-H_1
-
(1-\lambda)
\left[
-2S+N(1-\lambda)
\right]
=
0.
$$

boundary identities：

$$
A=0
\Rightarrow
L-NH_0=0,
$$

$$
A=-N
\Rightarrow
L-NH_1=0,
$$

以及 degenerate identities全部 residual $0$。

---

# 11. Exact Fraction Red Team

Round 14 隨機生成：

$$
12000
$$

組 rational planar geometry：

$$
(w_x,w_y,v_x,v_y,r).
$$

由真實 coordinates計算：

$$
A,
N,
H_0.
$$

依 phase rule求 analytic minimum。

再以六個 rational segment parameters：

$$
0,
\frac17,
\frac13,
\frac12,
\frac57,
1
$$

exact Fraction 比較：

$$
H(\lambda)
\ge
H_{\min}.
$$

總比較：

$$
72000.
$$

全部通過。

這不是 theorem，但適合抓 phase direction / sign convention錯誤。

---

# 12. Lean Draft

本輪建立：

```text
WSFC_R14_Phase_Safety_DRAFT.lean
```

包含預期 no-`sorry` candidate：

```text
fixed_phase_identity
fixed_phase_safe_TARGET

interior_complete_square
interior_phase_safe_TARGET

moving_phase_identity
moving_phase_safe_TARGET

degenerate_phase_safe_TARGET

fixed_interior_boundary
interior_moving_boundary
degenerate_endpoint_compat

normsq_zero_implies_coords_zero_TARGET
```

真正尚未組合的是：

```text
phase_cell_safe_TARGET
```

也就是把 Round 13 root-free/sign-invariant cell 連進本輪 phase theorem。

---

# 13. Phase Safety Certificate

本輪新增：

```text
WSFC-PHASE-SAFETY-0.1
```

它不是新的 runtime root certificate，而是一份 theorem-interface specification：

```text
phase guards
active safety quantity
exact identity
conclusion
boundary compatibility
```

因此 compiler未來可以只引用 theorem ID，不必重複嵌入推導。

---

# 14. Remaining Gap

Point-to-Segment Compiler 的數學核心現在只差 composition：

$$
\boxed{
\text{Root-free atomic cell}
+
\text{sample sign vector}
+
\text{Phase Safety Rule}
\Rightarrow
\text{cell-safe}.
}
$$

再對所有 atomic cells 與 root boundaries glue：

$$
\boxed{
\text{domain-safe}.
}
$$

boundary compatibility已在本輪給出，所以 glue不需要發明新 safety semantics。

---

# 15. 下一步

Round 15 最自然是：

$$
\boxed{
\textbf{Whole-Domain Certificate Composition}.
}
$$

也就是把 Round 13 + Round 14真正接起來：

1. trusted root cover；
2. sign-invariant cells；
3. phase classification；
4. phase safety；
5. boundary compatibility；
6. union of cells + boundaries；
7. whole parameter interval segment safety；
8. first actual event soundness。

此時 Generic Point-to-Segment Certificate Compiler 的 core theorem chain才會完整。

---

# 結論

Round 14 關掉的是 generic compiler的最後一塊局部幾何數學：

$$
\boxed{
\text{Nearest Feature Phase}
+
\text{Active Safety}
\Rightarrow
\text{Finite Segment Safe}.
}
$$

四個 phase現在都有獨立、簡單、可形式化的 scalar proof。

再加上 phase boundary compatibility：

$$
\boxed{
L=NH_0
}
$$

與：

$$
\boxed{
L=NH_1,
}
$$

WSFC 的 atomic cells 已經可以在不產生 safety semantic gap 的情況下拼接。

下一輪只剩真正的 global composition。

===END===
