---
title: "SRBC Theory Validation Program — Round 10：Concurrency / MVCC / Multi-Writer Conflict"
author: "Neo.K with Aletheia (GPT-5.6 Sol)"
institution: "EveMissLab / 一言諾科技有限公司"
version: "v0.1"
date: "2026-09-23"
language: "zh-TW"
document_type: "Multi-Writer MVCC / Concurrency Validation Report"
status: "Round 10 completed"
---

# SRBC Theory Validation Program — Round 10

## Concurrency / MVCC / Multi-Writer Conflict

**作者：** Neo.K with Aletheia (GPT-5.6 Sol)  
**機構：** EveMissLab / 一言諾科技有限公司  
**日期：** 2026-09-23  
**版本：** v0.1  

---

## Canonical Source Note

本輪把 PQRSRC 從 single-writer persistent runtime 推進到 multi-writer MVCC。

所有 writer mutation 在 base snapshot 上先被 canonicalize 成 **absolute patch**，再進行 CAS / optimistic read-footprint validation。這一點很重要：若 transaction 只保存「toggle / increment」而不保存 base-relative intent，stale rebase 的語義可能改變。

---

# 0. 問題

兩個 agent：

$$
T_A,
\quad
T_B
$$

同時從：

$$
S_0
$$

開始。

如果 A 先 commit，B 還拿著舊 base：

$$
S_0,
$$

系統要回答：

1. B 一律拒絕？
2. B 可不可以 rebase？
3. 哪些 dependency 被 A 改了？
4. A/B 是否其實互不影響？
5. reader 是否仍看到自己的 old snapshot？
6. 只靠 write-write conflict 夠不夠？

---

# 1. Pairwise Test

建立五類 transaction pairs，每類 1000：

| class | n | OCC conflicts | policy classification correct |
|---|---:|---:|---:|
| random | 1000 | 26 | 1000 |
| dependency_stale | 1000 | 1000 | 1000 |
| evidence_vs_semantic | 1000 | 1000 | 1000 |
| nuisance_vs_semantic | 1000 | 0 | 1000 |
| same_key | 1000 | 1000 | 1000 |

總：

$$
\boxed{
5000
}
$$

pairs。

MVCC/OCC classification：

$$
\boxed{
5000/5000
}
$$

符合 read-footprint policy。

---

# 2. CAS-only

兩個 writer 都從同一 base 開始。

A commit 後，B 的 base hash 必然 stale。

純 CAS 因此：

$$
\boxed{
5000/5000
}
$$

全部拒絕第二 writer。

安全，但其中其實有：

$$
\boxed{
1974
}
$$

個 transaction 可安全 rebase。

比例：

$$
\boxed{
39.48\%.
}
$$

所以 CAS-only 會浪費大量可合併 work。

---

# 3. Blind overwrite

對 direct write key 不同的 pairs，共：

$$
\boxed{
3987
}
$$

組。

若完全不做 CAS / MVCC，而讓 B 把自己從舊 base 算出的 snapshot 直接覆蓋 HEAD：

$$
\boxed{
3987
}
$$

組全部發生 lost update。

rate：

$$
\boxed{
100\%.
}
$$

這不是說所有真實 workload 都會 100% lost update，而是這個控制實驗故意比較：

> B-only stale snapshot vs A→B serial state。

只要 A 有非重疊變更，B-only publish 就把 A 丟掉。

---

# 4. Direct write-write heuristic

只看：

$$
W_A\cap W_B.
$$

結果：

| heuristic | precision | recall | FP | FN |
|---|---:|---:|---:|---:|
| direct write overlap | 100.00% | 33.48% | 0 | 2013 |
| affected-set overlap | 98.18% | 100.00% | 56 | 0 |

direct write overlap precision：

$$
100\%.
$$

但 recall 只有：

$$
\boxed{
33.48\%.
}
$$

漏掉：

$$
\boxed{
2013
}
$$

個 OCC conflicts。

典型：

- `random`: A=`random-A-8`, B=`random-B-8`, stale reads=['sd::MH-C1']
- `random`: A=`random-A-168`, B=`random-B-168`, stale reads=['sd::BER-C2']
- `random`: A=`random-A-233`, B=`random-B-233`, stale reads=['sd::BG-C2']
- `random`: A=`random-A-254`, B=`random-B-254`, stale reads=['sd::BER-C1']
- `random`: A=`random-A-346`, B=`random-B-346`, stale reads=['sd::MH-C1']
- `random`: A=`random-A-442`, B=`random-B-442`, stale reads=['sd::TE-C3']

這些 transaction 沒寫同一 key，但讀取 dependency 已 stale。

---

# 5. Affected-set overlap heuristic

如果只看：

$$
\operatorname{Aff}(A)
\cap
\operatorname{Aff}(B)
\neq\varnothing,
$$

recall：

$$
\boxed{
100\%.
}
$$

但有：

$$
\boxed{
56
}
$$

個 false positives。

例：

- `random`: A=`random-A-0`, B=`random-B-0`
- `random`: A=`random-A-15`, B=`random-B-15`
- `random`: A=`random-A-19`, B=`random-B-19`
- `random`: A=`random-A-68`, B=`random-B-68`
- `random`: A=`random-A-69`, B=`random-B-69`
- `random`: A=`random-A-93`, B=`random-B-93`

這些 pair 雖然最後需要重算某些相同 certificates，但 transaction read footprint 沒失效，因此仍可用 serial rebase 合法合併。

所以：

$$
\boxed{
\text{affected overlap}
}
$$

是很好的保守 prefilter，

但不是 final conflict criterion。

---

# 6. Dependency stale control

1000 組：

$$
\text{parent semantic writer}
+
\text{child local writer}.
$$

例如：

$$
MH\text{-}C1
+
MH\text{-}C2.
$$

direct write keys 不同。

但 child transaction read：

$$
SD(MH\text{-}C1).
$$

所以：

$$
\boxed{
1000/1000
}
$$

被 OCC 正確判 conflict。

這正是 write-write detector 會漏掉的核心類型。

---

# 7. Evidence vs Semantic

同一 certificate：

- A 改 semantic state；
- B 只更新 evidence。

B transaction 在開始時讀：

$$
SD(C).
$$

A commit 後：

$$
SD(C)
$$

改變。

因此：

$$
\boxed{
1000/1000
}
$$

正確 conflict。

證據不能悄悄附著到另一個 semantic epoch。

---

# 8. Nuisance vs Semantic

同一 certificate：

- A 改 semantic；
- B 改 rendering / nuisance metadata。

nuisance transaction 不讀 semantic digest。

所以：

$$
\boxed{
0/1000
}
$$

conflict。

這再次顯示：

$$
\boxed{
\text{artifact layer}
\neq
\text{semantic layer}.
}
$$

---

# 9. Safe rebase 的 commutativity

對雙向 read footprint 都穩定的 pairs：

$$
\boxed{
1960
}
$$

組。

比較：

$$
A;B
$$

與：

$$
B;A.
$$

failure：

$$
\boxed{
0.
}
$$

因此這批 safe merge 不只可序列化，而且在此 workload 中實際 commute。

---

# 10. 1000 rounds × 5 concurrent writers

每 round：

$$
5
$$

個 writers 全部從同一 base snapshot 開始。

共：

$$
\boxed{
5000
}
$$

writer attempts。

OCC/MVCC：

- accepted：
  $$
  \boxed{
  4701
  }
  $$
- conflicted：
  $$
  \boxed{
  299
  }
  $$
- accepted rate：
  $$
  \boxed{
  94.02\%
  }
  $$

每次 accepted commit 都和「依 commit order 重放 absolute patches」的 serial oracle 比較。

failure：

$$
\boxed{
0.
}
$$

---

# 11. Snapshot reader

reader 在 epoch 0 pin 一份 snapshot。

接著 current HEAD 連續 advance：

$$
1000
$$

步。

old reader snapshot：

$$
\boxed{
1000/1000
\text{ stable}.
}
$$

current HEAD 已改變。

所以第一代 MVCC reader isolation 成立：

$$
\boxed{
\operatorname{Read}_{E_0}
\text{ 不被 later commits 污染}.
}
$$

---

# 12. Write Skew / Predicate Dependency

這輪又故意做一個 synthetic global invariant：

> MH source root 與 MH observed-query root 不得同時進入 revised state。

兩個 transaction：

- A 改 source；
- B 改 query。

direct keys 完全不同。

如果 transaction read footprint 沒宣告這個跨 key predicate：

$$
\boxed{
A,B
\text{ 都可 commit，最後 invariant 被破壞}.
}
$$

加入 predicate dependency footprint 後：

$$
\boxed{
\text{第二 writer conflict}.
}
$$

因此：

$$
\boxed{
\text{key-level MVCC}
\not\Rightarrow
\text{serializable semantic invariants}.
}
$$

跨 key / range / graph invariant 必須是一等 read dependency。

---

# 13. Same-Intent Conflict

1000 組 same-key transaction：

A 與 B 從同一 base 寫同一 absolute target。

conservative OCC：

$$
\boxed{
1000/1000
}
$$

都 conflict。

但從 closure-state semantics 看：

$$
\boxed{
1000/1000
}
$$

可辨識為 idempotent same-intent write。

所以可選擇：

```text
ALREADY_APPLIED / COALESCED
```

而不必要求 B 重算。

但這個優化只對 pure closure-state write 安全。

如果 transaction 還有外部 side effect，必須用 txid / outbox / idempotency key。

---

# 14. Transaction Intent

Round 10 因此正式要求 transaction 不只是：

$$
(\text{base},\text{write set}).
$$

而是：

$$
\boxed{
T
=
(
\mathrm{txid},
E_b,
H_b,
R_T,
W_T,
P_T,
I_T
).
}
$$

其中：

$$
I_T
$$

是 canonical intent digest。

這使：

- same-intent dedup；
- stale rebase；
- audit；
- conflict explanation；

都有穩定 identity。

---

# 15. MVCC Conflict 不等於 Semantic Contradiction

B 被 OCC reject，只表示：

> B 的 base assumptions / reads 已經 stale。

不表示：

$$
\boxed{
\text{A 和 B 的命題互相邏輯矛盾}.
}
$$

有些 transaction rebase 後可能完全合法，只是需要人／agent 再確認新 context。

因此 conflict artifact 應保存：

```yaml
conflict:
  stale_reads:
    - ...
  semantic_contradiction: unknown
```

不能把 concurrency conflict 偷換成 logic refutation。

---

# 16. Round 10 核心結果

## CAS

安全，但過度拒絕：

$$
1974
$$

個安全 rebase opportunity。

## Blind overwrite

lost update control：

$$
3987/3987.
$$

## Direct WW

precision 高但 recall 低：

$$
33.48\%.
$$

## Affected overlap

recall 高：

$$
100\%
$$

但有 false positive。

## Read-footprint OCC

pair policy：

$$
5000/5000.
$$

## Multi-writer serialization

$$
5000
$$

attempts，serial oracle：

$$
0
$$

failures。

## Predicate guard

write-skew control 成功被攔截。

---

# 17. 本輪沒有證明什麼？

這仍然是 single-process shared-memory MVCC simulator。

沒有證明：

1. distributed consensus；
2. network partition；
3. clock / lease correctness；
4. real database MVCC implementation；
5. external side-effect exactly-once；
6. arbitrary semantic predicate discovery；
7. automatic human-intent equivalence。

本輪證據是：

$$
\boxed{
\text{transaction dependency / conflict geometry validation}.
}
$$

---

# 18. 下一輪

Round 11 最自然的是：

$$
\boxed{
\text{Three-Way Semantic Merge / Branch Reconciliation}.
}
$$

也就是不只 conflict / reject，而是對兩個 diverged semantic branches：

$$
B_A,
\quad
B_B
$$

建立：

- common ancestor；
- semantic diff；
- query-sensitive conflict；
- automatically mergeable commitments；
- non-mergeable commitments；
- conflict certificate；
- human / agent resolution patch；
- post-merge QRC / QRU / QDU re-evaluation。

這會把 SREG 一直講的：

$$
\boxed{
\text{Branch}
\rightarrow
\text{Merge}
}
$$

真正做成機器原生 semantic merge。

---

# 附錄 A：Pair Classes

| class | n | conflict | classification correct |
|---|---:|---:|---:|
| random | 1000 | 26 | 1000 |
| dependency_stale | 1000 | 1000 | 1000 |
| evidence_vs_semantic | 1000 | 1000 | 1000 |
| nuisance_vs_semantic | 1000 | 0 | 1000 |
| same_key | 1000 | 1000 | 1000 |

---

# 附錄 B：Heuristic Comparison

| heuristic | precision | recall | FP | FN |
|---|---:|---:|---:|---:|
| direct write overlap | 100.00% | 33.48% | 0 | 2013 |
| affected-set overlap | 98.18% | 100.00% | 56 | 0 |

---

# 附錄 C：Machine Results

```json
{
  "base": {
    "round": "SRBC Theory Validation Round 10",
    "pair_tests": 5000,
    "classes": {
      "random": {
        "n": 1000,
        "conflict": 26,
        "merge_ok": 1000
      },
      "dependency_stale": {
        "n": 1000,
        "conflict": 1000,
        "merge_ok": 1000
      },
      "evidence_vs_semantic": {
        "n": 1000,
        "conflict": 1000,
        "merge_ok": 1000
      },
      "nuisance_vs_semantic": {
        "n": 1000,
        "conflict": 0,
        "merge_ok": 1000
      },
      "same_key": {
        "n": 1000,
        "conflict": 1000,
        "merge_ok": 1000
      }
    },
    "cas": {
      "stale_second_writer_rejected": 5000,
      "failures": 0
    },
    "mvcc_occ": {
      "expected_classifications_correct": 5000,
      "failures": 0
    },
    "blind_overwrite": {
      "direct_disjoint_candidates": 3987,
      "lost_update_cases": 3987,
      "lost_update_rate": 1.0
    },
    "heuristics": {
      "direct_write_overlap": {
        "precision": 1.0,
        "recall": 0.33476536682088565,
        "tp": 1013,
        "fp": 0,
        "tn": 1974,
        "fn": 2013
      },
      "affected_overlap": {
        "precision": 0.981829980532122,
        "recall": 1.0,
        "tp": 3026,
        "fp": 56,
        "tn": 1918,
        "fn": 0
      }
    },
    "commutativity": {
      "safe_bidirectional_rebase_pairs": 1960,
      "failures": 0
    },
    "same_intent": {
      "same_key_pairs": 1000,
      "occ_conflicts": 1000,
      "note": "Conservative OCC rejects even idempotent same-intent writes unless transaction identity/intent dedup is added."
    },
    "predicate_write_skew_control": {
      "without_predicate_guard_invariant_violated": true,
      "with_predicate_footprint_second_writer_conflicted": true
    },
    "snapshot_reader": {
      "steps": 1000,
      "pinned_snapshot_stable": true,
      "pinned_hash": "913da29d5bc4b2847a5e0d69d4b82e32467d19a440c44282171d2d069ec3ab50",
      "current_head_hash": "bcf345f9cc58194af9bae68d826419386728283cf143ed5afe384375ae372b19",
      "head_advanced": true
    }
  },
  "extended": {
    "multi_writer": {
      "rounds": 1000,
      "writers_per_round": 5,
      "writer_attempts": 5000,
      "accepted": 4701,
      "conflicted": 299,
      "serial_oracle_failures": 0,
      "accept_rate": 0.9402
    },
    "same_intent_coalescing": {
      "tests": 1000,
      "normal_occ_conflicts": 1000,
      "semantically_idempotent_coalescible": 1000,
      "coalescible_rate": 1.0,
      "boundary": "Safe only for closure-state semantics; external side effects require tx-id/idempotency-key rules."
    },
    "pairwise_capacity": {
      "occ_conflicts": 3026,
      "safe_rebases": 1974,
      "safe_rebase_rate": 0.3948,
      "cas_only_would_reject_safe_rebases": 1974
    }
  }
}
```

---

# 附錄 D：Artifacts

- `SRBC_Theory_Validation_Round10_Report_v0.1_2026-09-23.md`
- `SRBC_Core_Patch_v0.10_2026-09-23.md`
- `pqrsrc_mvcc_protocol_v010.yaml`
- `round10_mvcc_runtime.py`
- `results_round10.json`
- `results_round10_extended.json`
- `results_round10_combined.json`
- `pair_results_round10.jsonl`
- `multiwriter_round10.jsonl`
- `input_certificates_v07/*.json`
- `validation.json`
