# 第 9569 題：算法正確性責任

[返回所在分頁 48](https://ocme.evemisslab.com/zh-Hant/questions/page/48/)

[← 逐題詳解目錄](https://ocme.evemisslab.com/zh-Hant/questions/) · [原題批次](https://ocme.evemisslab.com/zh-Hant/practice/batch-20261013-advance-20261019-r05-algorithm-correctness-foundations/#q-20261013-advance-20261019-r05-algorithm-correctness-0069)

本頁是已完成第二對話 AI 數理與中英語義覆核的教學詳解，只支持本題明示的模型與前提。沒有人工審查或新 Lean 證明，也不提升原題或 MKO 的 Canonical 真值狀態。

R0018-09569 · q-20261013-advance-20261019-r05-algorithm-correctness-0069



## 原題與已知條件

完整有限正確性模型。操作=correctness-ranking-audit；資料={"n":6,"init":[0],"halt":[5],"steps":[[0,1],[1,2],[2,5],[3,4],[1,1]],"rank":[24,5,4,3,2,0]}。請依 [rank,bad_decrease_edges,ranking_valid,stuck,ranking_plus_no_stuck,actual_termination] 欄序回答。


- G001 — 完整有限正確性模型。操作=correctness-ranking-audit；資料={"n":6,"init":[0],"halt":[5],"steps":[[0,1],[1,2],[2,5],[3,4],[1,1]],"rank":[24,5,4,3,2,0]}。請依 [rank,bad_decrease_edges,ranking_valid,stuck,ranking_plus_no_stuck,actual_termination] 欄序回答。





## 定義與適用範圍

沿用原題明示的論域、假設與來源 MKO 定義。本題已完成第二對話數理與中英語義覆核，並由原始參數逐題獨立重算模型、答案與每個算術步驟；原題仍為 candidate。


- [mko-algorithm-correctness](https://ocme.evemisslab.com/zh-Hant/mko/mko-algorithm-correctness/)





## 逐步推導

S001 · implies操作前

n=6;raw Init=[0];raw Halt=[5];raw Step=[[0, 1], [1, 2], [2, 5], [3, 4], [1, 1]]

操作後

Init=[0];Halt=[5];canonical raw Step=[[0, 1], [1, 1], [1, 2], [2, 5], [3, 4]]

條件：無

整張有限資料先合型，再去重原有向邊。保留halt的原始出邊在資料中，但執行語意在halt停止；不把stuck當成功halt，也不由一條prefix推一般程式終止。

步驟識別與依賴規則：finite_transition_normalization · 依賴：G001





S002 · implies操作前

Init=[0]

操作後

zero-step reachable=[0]

條件：無

每個初始狀態以0步可達，包括初始即halt者；空Init沒有可達狀態。

步驟識別與依賴規則：zero_step_reachability · 依賴：G001, S001





S003 · implies操作前

depth=0;state=0;halt=否;raw successors=[1]

操作後

expanded successors=[1];newly reached=[1]

條件：無

從非halt狀態展開全部後繼，不只挑一條路；已見狀態不重複加入。halt即使列有出邊也不展開。

步驟識別與依賴規則：reachability_halt_truncates_expansion · 依賴：G001, S002





S004 · implies操作前

completed frontier=[0];depth=0

操作後

next frontier=[1];all reached=[0, 1]

條件：無

前緣清空時才到達完整閉包；有限狀態及只加未見者保證此列舉終止，不依賴路徑長度抽樣。

步驟識別與依賴規則：complete_finite_reachability_layer · 依賴：G001, S003





S005 · implies操作前

depth=1;state=1;halt=否;raw successors=[1, 2]

操作後

expanded successors=[1, 2];newly reached=[2]

條件：無

從非halt狀態展開全部後繼，不只挑一條路；已見狀態不重複加入。halt即使列有出邊也不展開。

步驟識別與依賴規則：reachability_halt_truncates_expansion · 依賴：G001, S004





S006 · implies操作前

completed frontier=[1];depth=1

操作後

next frontier=[2];all reached=[0, 1, 2]

條件：無

前緣清空時才到達完整閉包；有限狀態及只加未見者保證此列舉終止，不依賴路徑長度抽樣。

步驟識別與依賴規則：complete_finite_reachability_layer · 依賴：G001, S005





S007 · implies操作前

depth=2;state=2;halt=否;raw successors=[5]

操作後

expanded successors=[5];newly reached=[5]

條件：無

從非halt狀態展開全部後繼，不只挑一條路；已見狀態不重複加入。halt即使列有出邊也不展開。

步驟識別與依賴規則：reachability_halt_truncates_expansion · 依賴：G001, S006





S008 · implies操作前

completed frontier=[2];depth=2

操作後

next frontier=[5];all reached=[0, 1, 2, 5]

條件：無

前緣清空時才到達完整閉包；有限狀態及只加未見者保證此列舉終止，不依賴路徑長度抽樣。

步驟識別與依賴規則：complete_finite_reachability_layer · 依賴：G001, S007





S009 · implies操作前

depth=3;state=5;halt=是;raw successors=[]

操作後

expanded successors=[];newly reached=[]

條件：無

從非halt狀態展開全部後繼，不只挑一條路；已見狀態不重複加入。halt即使列有出邊也不展開。

步驟識別與依賴規則：reachability_halt_truncates_expansion · 依賴：G001, S008





S010 · implies操作前

completed frontier=[5];depth=3

操作後

next frontier=[];all reached=[0, 1, 2, 5]

條件：無

前緣清空時才到達完整閉包；有限狀態及只加未見者保證此列舉終止，不依賴路徑長度抽樣。

步驟識別與依賴規則：complete_finite_reachability_layer · 依賴：G001, S009





S011 · implies操作前

reached state=0;declared halt=否;raw successors=[1]

操作後

status=active-nonhalt

條件：無

halt標記優先；非halt且無後繼才是stuck，有後繼者為active。沒有出邊不會自動變成成功停止。

步驟識別與依賴規則：halt_stuck_active_are_distinct · 依賴：G001, S010





S012 · implies操作前

reached state=1;declared halt=否;raw successors=[1, 2]

操作後

status=active-nonhalt

條件：無

halt標記優先；非halt且無後繼才是stuck，有後繼者為active。沒有出邊不會自動變成成功停止。

步驟識別與依賴規則：halt_stuck_active_are_distinct · 依賴：G001, S011





S013 · implies操作前

reached state=2;declared halt=否;raw successors=[5]

操作後

status=active-nonhalt

條件：無

halt標記優先；非halt且無後繼才是stuck，有後繼者為active。沒有出邊不會自動變成成功停止。

步驟識別與依賴規則：halt_stuck_active_are_distinct · 依賴：G001, S012





S014 · implies操作前

reached state=5;declared halt=是;raw successors=[]

操作後

status=halt

條件：無

halt標記優先；非halt且無後繼才是stuck，有後繼者為active。沒有出邊不會自動變成成功停止。

步驟識別與依賴規則：halt_stuck_active_are_distinct · 依賴：G001, S013





S015 · implies操作前

natural rank vector=[24, 5, 4, 3, 2, 0];reachable=[0, 1, 2, 5];Halt=[5]

操作後

all active ranking edges=[[0, 1], [1, 1], [1, 2], [2, 5]]

條件：無

自然數ranking只在可達非halt出邊要求嚴格下降，包含進入halt的邊；halt原始出邊不構成繼續執行。

步驟識別與依賴規則：ranking_reachable_nonhalt_edge_scope · 依賴：G001, S014





S016 · calculation操作前

rank decrease on edge0,1 := sub(24, 5)

操作後

rank decrease on edge0,1 = 19

條件：無

前態rank減後態rank，必須嚴格大於0才下降。

步驟識別與依賴規則：exact_rational_arithmetic · 依賴：G001, S015





S017 · implies操作前

edge=[0, 1];ranks=[24, 5];difference=19

操作後

strictly decreasing=是

條件：無

相等不算下降；保留所有不下降的原邊，不只報第一條。

步驟識別與依賴規則：ranking_each_strict_decrease · 依賴：G001, S016





S018 · calculation操作前

rank decrease on edge1,1 := sub(5, 5)

操作後

rank decrease on edge1,1 = 0

條件：無

前態rank減後態rank，必須嚴格大於0才下降。

步驟識別與依賴規則：exact_rational_arithmetic · 依賴：G001, S017





S019 · implies操作前

edge=[1, 1];ranks=[5, 5];difference=0

操作後

strictly decreasing=否

條件：無

相等不算下降；保留所有不下降的原邊，不只報第一條。

步驟識別與依賴規則：ranking_each_strict_decrease · 依賴：G001, S018





S020 · calculation操作前

rank decrease on edge1,2 := sub(5, 4)

操作後

rank decrease on edge1,2 = 1

條件：無

前態rank減後態rank，必須嚴格大於0才下降。

步驟識別與依賴規則：exact_rational_arithmetic · 依賴：G001, S019





S021 · implies操作前

edge=[1, 2];ranks=[5, 4];difference=1

操作後

strictly decreasing=是

條件：無

相等不算下降；保留所有不下降的原邊，不只報第一條。

步驟識別與依賴規則：ranking_each_strict_decrease · 依賴：G001, S020





S022 · calculation操作前

rank decrease on edge2,5 := sub(4, 0)

操作後

rank decrease on edge2,5 = 4

條件：無

前態rank減後態rank，必須嚴格大於0才下降。

步驟識別與依賴規則：exact_rational_arithmetic · 依賴：G001, S021





S023 · implies操作前

edge=[2, 5];ranks=[4, 0];difference=4

操作後

strictly decreasing=是

條件：無

相等不算下降；保留所有不下降的原邊，不只報第一條。

步驟識別與依賴規則：ranking_each_strict_decrease · 依賴：G001, S022





S024 · implies操作前

reachable=[0, 1, 2, 5];Halt=[5]

操作後

reachable nonhalt graph vertices=[0, 1, 2]

條件：無

只在可達且非halt的子圖查環；不可達環與halt出邊不影響這個執行問題。

步驟識別與依賴規則：reachable_nonhalt_cycle_scope · 依賴：G001, S023





S025 · implies操作前

peeling layer=0;remaining=[0, 1, 2]

操作後

vertices with no remaining nonhalt successor=[2]

條件：無

逐層移除沒有剩餘非halt後繼的頂點；有向環的頂點不可能被這樣移除。stuck也可能被移除，所以另保留stuck檢查。

步驟識別與依賴規則：finite_cycle_sink_peeling · 依賴：G001, S024





S026 · implies操作前

peeling layer=1;remaining=[0, 1]

操作後

vertices with no remaining nonhalt successor=[]

條件：無

逐層移除沒有剩餘非halt後繼的頂點；有向環的頂點不可能被這樣移除。stuck也可能被移除，所以另保留stuck檢查。

步驟識別與依賴規則：finite_cycle_sink_peeling · 依賴：G001, S025





S027 · implies操作前

nonempty residual=[0, 1];deterministic walk=[0, 1, 1]

操作後

reachable nonhalt cycle=[1, 1]

條件：無

剩餘每點都有剩餘後繼，沿最小標籤後繼走，有限集合必重複頂點並給出實際環；可選擇一直走這個環，所以即使也有halt出口，仍非所有路徑到halt。

步驟識別與依賴規則：explicit_reachable_cycle_witness · 依賴：G001, S026





S028 · implies操作前

reachable stuck=[];reachable nonhalt cycle=是

操作後

all paths reach Halt=否

條件：無

有限模型中，無窮非halt路徑必重複狀態而有環；有限極大路徑若不halt就停在stuck。因此排除兩者才是所有路徑到halt。空Init時是空泛真，不外推任意無限狀態程式。

步驟識別與依賴規則：finite_all_paths_termination_joint_gate · 依賴：G001, S027





S029 · implies操作前

ranking valid=否;reachable stuck=[]

操作後

ranking plus no stuck=否;actual all-path termination=否

條件：無

自然數嚴格下降排除無窮執行，但仍要排除stuck才到成功halt。候選ranking失敗不代表模型不終止；實際終止性由完整有限圖另核。

步驟識別與依賴規則：ranking_candidate_not_actual_termination_identity · 依賴：G001, S028









## 逐步反向核對


- S029 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S028 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S027 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S026 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S025 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S024 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S023 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S022 · premise_and_result_audit — 以精確有理數重算 rank decrease on edge2,5，不以小數近似替代。
- S021 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S020 · premise_and_result_audit — 以精確有理數重算 rank decrease on edge1,2，不以小數近似替代。
- S019 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S018 · premise_and_result_audit — 以精確有理數重算 rank decrease on edge1,1，不以小數近似替代。
- S017 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S016 · premise_and_result_audit — 以精確有理數重算 rank decrease on edge0,1，不以小數近似替代。
- S015 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S014 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S013 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S012 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S011 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S010 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S009 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S008 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S007 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S006 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S005 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S004 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S003 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S002 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S001 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。





## 結論

([24, 5, 4, 3, 2, 0], [[1, 1]], 否, [], 否, 否)

依上列完整代值及條件核對得到原題答案；原題編號、格式與狀態保持不變。





## 本題覆核與來源綁定

覆核日期：2026-10-26

原題、答案、步驟表達式、數值 AST 與既有歷史保持原樣；原來的候選狀態屬於來源歷史，不覆寫為形式化證明。

來源雜湊與覆核憑證
- input commit: 0f7be61e2c22317a4075561dc822c87d881a50db
- original question SHA-256: 0499b17205a5bfa70db28aee981a18cd0a2bba0e8ab374c5430fb1e711a47fe1
- candidate record SHA-256: 433f6d03217b89d40a1701904c51e49bd855ae7efb44162cbf235b2caf6c98b0
- semantic review receipt SHA-256: bd35da62087a15d6b89b45585dc46e89b9efbe097cba7b3c707b5030496f013c
- question-first witness SHA-256: fab45a10d8ac95c7d61d32e47d1bdd3ca862c17c3289a6bf4b01d4dc9492fbb6
- Lean: NOT_RUN · human review: NOT_PERFORMED

[同源完整 JSON](https://ocme.evemisslab.com/data/question-derivations/questions/q-20261013-advance-20261019-r05-algorithm-correctness-0069.json)




