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

[返回所在分頁 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-0091)

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

R0018-09591 · q-20261013-advance-20261019-r05-algorithm-correctness-0091



## 原題與已知條件

完整有限正確性模型。操作=correctness-total-separation；資料={"n":6,"init":[0],"halt":[5],"steps":[[0,1],[1,2],[2,5],[0,3],[3,4],[4,5],[2,1]],"post":[5]}。請依 [reachable_halts,post,bad_halts,partial,vacuous,stuck,cycle,termination,total] 欄序回答。


- G001 — 完整有限正確性模型。操作=correctness-total-separation；資料={"n":6,"init":[0],"halt":[5],"steps":[[0,1],[1,2],[2,5],[0,3],[3,4],[4,5],[2,1]],"post":[5]}。請依 [reachable_halts,post,bad_halts,partial,vacuous,stuck,cycle,termination,total] 欄序回答。





## 定義與適用範圍

沿用原題明示的論域、假設與來源 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], [0, 3], [3, 4], [4, 5], [2, 1]]

操作後

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

條件：無

整張有限資料先合型，再去重原有向邊。保留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, 3]

操作後

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

條件：無

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

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





S004 · implies操作前

completed frontier=[0];depth=0

操作後

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

條件：無

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

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





S005 · implies操作前

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

操作後

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

條件：無

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

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





S006 · implies操作前

depth=1;state=3;halt=否;raw successors=[4]

操作後

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

條件：無

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

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





S007 · implies操作前

completed frontier=[1, 3];depth=1

操作後

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

條件：無

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

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





S008 · implies操作前

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

操作後

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

條件：無

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

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





S009 · implies操作前

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

操作後

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

條件：無

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

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





S010 · implies操作前

completed frontier=[2, 4];depth=2

操作後

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

條件：無

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

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





S011 · implies操作前

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

操作後

expanded successors=[];newly reached=[]

條件：無

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

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





S012 · implies操作前

completed frontier=[5];depth=3

操作後

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

條件：無

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

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





S013 · implies操作前

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

操作後

status=active-nonhalt

條件：無

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

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





S014 · implies操作前

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

操作後

status=active-nonhalt

條件：無

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

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





S015 · implies操作前

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

操作後

status=active-nonhalt

條件：無

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

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





S016 · implies操作前

reached state=3;declared halt=否;raw successors=[4]

操作後

status=active-nonhalt

條件：無

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

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





S017 · implies操作前

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

操作後

status=active-nonhalt

條件：無

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

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





S018 · implies操作前

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

操作後

status=halt

條件：無

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

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





S019 · implies操作前

reachable Halt state=5;postcondition=[5]

操作後

postcondition satisfied=是

條件：無

部分正確性只在可達halt狀態核後置條件；不可達halt不算反例，尚未停止的狀態也不冒充成功結果。

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





S020 · implies操作前

reachable halts=[5];bad halts=[]

操作後

partial correctness=是;no reachable halt=否

條件：無

沒有可達halt時，部分正確性可能空泛成立，但尚未證明會停。

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





S021 · implies操作前

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

操作後

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

條件：無

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

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





S022 · implies操作前

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

操作後

vertices with no remaining nonhalt successor=[4]

條件：無

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

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





S023 · implies操作前

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

操作後

vertices with no remaining nonhalt successor=[3]

條件：無

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

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





S024 · implies操作前

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

操作後

vertices with no remaining nonhalt successor=[]

條件：無

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

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





S025 · implies操作前

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

操作後

reachable nonhalt cycle=[1, 2, 1]

條件：無

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

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





S026 · implies操作前

reachable stuck=[];reachable nonhalt cycle=是

操作後

all paths reach Halt=否

條件：無

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

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





S027 · implies操作前

partial=是;all-path termination=否

操作後

total correctness=否

條件：無

總正確性同時要求所有可達停止結果正確與每條執行成功終止；一條成功路徑或空泛部分正確性都不夠。

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









## 逐步反向核對


- 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 — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S021 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S020 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S019 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S018 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S017 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- S016 · premise_and_result_audit — 回到原始資料與本步條件核對，不把單向推論誤稱等價。
- 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 — 回到原始資料與本步條件核對，不把單向推論誤稱等價。





## 結論

([5], [5], [], 是, 否, [], 是, 否, 否)

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





## 本題覆核與來源綁定

覆核日期：2026-10-26

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

來源雜湊與覆核憑證
- input commit: 0f7be61e2c22317a4075561dc822c87d881a50db
- original question SHA-256: 69a1d90f167cdba3ceeb60f24e36a4c242fd0dd061d49ea7b9353e35ec49fa2d
- candidate record SHA-256: 9715cecc17234c248faeecb06628bae2964704be7d757dfd5d7983e16d634982
- 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-0091.json)




