# 第 379 題：模反元素

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

[← 逐題詳解目錄](https://ocme.evemisslab.com/zh-Hant/questions/) · [原題批次](https://ocme.evemisslab.com/zh-Hant/practice/batch-20261014-advance-20261103-r07-modular-inverse-foundations/#q-20261014-advance-20261103-r07-modular-inverse-0079)

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

P1000-0379 · q-20261014-advance-20261103-r07-modular-inverse-0079



## 原題與已知條件

整數a與模數n大於等於2的exact Euclidean arithmetic。操作=modinv-nonunit-boundary；資料={"a":5,"n":10}。請依 [a,n,gcd,inverse,exists,boundary] 欄序回答。


- G001 — 整數a與模數n大於等於2的exact Euclidean arithmetic。操作=modinv-nonunit-boundary；資料={"a":5,"n":10}。請依 [a,n,gcd,inverse,exists,boundary] 欄序回答。





## 定義與適用範圍

gcd(a,n)>1 時共同因數整除 au+nv，不可能等於 1，故沒有逆元；null 表示不存在。


- [mko-modular-inverse](https://ocme.evemisslab.com/zh-Hant/mko/mko-modular-inverse/)





## 逐步推導

S001 · implies操作前

a=5; n=10≥2

操作後

compute gcd and a Bezout certificate before inversion

條件：無

逆元存在性需要互質；先保留模數條件。

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





S002 · implies操作前

divide 5 by 10

操作後

5=0·10+5

條件：無

下一步改用除數與餘數，非零餘數嚴格下降。

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





S003 · implies操作前

divide 10 by 5

操作後

10=2·5+0

條件：無

下一步改用除數與餘數，非零餘數嚴格下降。

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





S004 · calculation操作前

a·x := mul(5, 1)

操作後

a·x = 5

條件：無

乘回原本帶符號的 a。

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





S005 · calculation操作前

n·y := mul(10, 0)

操作後

n·y = 0

條件：無

同時保留模數係數。

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





S006 · calculation操作前

Bezout value := sum(5, 0)

操作後

Bezout value = 5

條件：無

兩項相加應等於最後非零餘數 gcd。

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





S007 · implies操作前

gcd(5,10)=5>1

操作後

no u can satisfy a·u≡1 (mod n)

條件：無

若有逆元便有 au+nv=1，但左邊被共同因數 g 整除而右邊不被整除，矛盾。

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





S008 · implies操作前

inverse does not exist

操作後

inverse field=null; exists=false

條件：無

null 表示沒有逆元，不是假造的整數0代表元。

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









## 逐步反向核對


- S008 · premise_and_result_audit — 核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。
- S007 · premise_and_result_audit — 核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。
- S006 · premise_and_result_audit — 以精確有理數重算 Bezout value，不以小數近似替代。
- S005 · premise_and_result_audit — 以精確有理數重算 n·y，不以小數近似替代。
- S004 · premise_and_result_audit — 以精確有理數重算 a·x，不以小數近似替代。
- S003 · premise_and_result_audit — 核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。
- S002 · premise_and_result_audit — 核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。
- S001 · premise_and_result_audit — 核對整數等式、餘數範圍與 gcd 條件，不把同餘當整數相等。





## 結論

(5, 10, 5, null, 否, nonunit_has_no_modular_inverse)

上述完整代值與條件核對得到原題答案；欄位次序及真假標記保持原始合約。





## 本題覆核與來源綁定

覆核日期：2026-10-26

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

來源雜湊與覆核憑證
- input commit: 0f7be61e2c22317a4075561dc822c87d881a50db
- original question SHA-256: 7fee845931a20bcd24ae5cc92c618ad44e13369c91c43e88b108a9ebc7e93fb9
- candidate record SHA-256: 870bf480c416296cd2c6559d572461e97cb8463681783540ce24f68a2a819c39
- semantic review receipt SHA-256: 6c2c6d46aded7582a11ac41a8c0b3bdde2669a53bdb6e796eea2039994a02772
- question-first witness SHA-256: 77e43898df9efdbf8094ad81fe4ab91cf4b4bd82f481eb9b4699b73cb4da612b
- Lean: NOT_RUN · human review: NOT_PERFORMED

[同源完整 JSON](https://ocme.evemisslab.com/data/question-derivations/questions/q-20261014-advance-20261103-r07-modular-inverse-0079.json)




