Lean Machine-Checked Mathematics and Verified Programming, Past and Future (Leonardo de Moura)
[seminar] 3 min read
Leonardo de Moura, AWS
Z3์ ๋ถํ์ด ๋ง๋ค - whole-program ํ ๋, minor code edit์ด solver trace๋ฅผ ๊นจ๋จ๋ฆฐ๋ค
Lean์ ๋ชจ๋ฅด๋ ์ฌ๋๋ค๋ผ๋ฆฌ๋ ํ์ ์ด ๊ฐ๋ฅํ๊ฒ ๋์ผ๋ฉฐ,
extensibleํ๊ณ , own system์ ๊ตฌํํ ์ ์๋ค.
types, systems = first-class objects
- Lean์์๋ ํ์ ๊ณผ ์์คํ (์: ๋ชจ๋๋, ๋ฆฌ๋ผ์ดํธ ๊ท์น ๋ฑ)์ ํ๋ก๊ทธ๋จ ๊ฐ์ฒ๋ผ ๋ค๋ฃฌ๋ค. ์ฆ, ํจ์์ ์ธ์๋ก ๋๊ธฐ๊ฑฐ๋ ๋ฆฌ์คํธ์ ๋ด๊ณ , ๋ฐํ์์ ์์ฑยท์กฐ์ํ ์ ์์ด ๋ฉํํ๋ก๊ทธ๋จ ์์ฑ๊ณผ ๋๋ฉ์ธ ํน์ ํ์ฅ์ด ์ฌ์์ง๋ค.
dependent type theory
- Lean์ ์ข ์ ํ์ ์ด๋ก (dependent type theory)์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉฐ, X๋ โCIC(Calculus of Inductive Constructions)โ ๊ฐ์ ๊ตฌ์ฒด์ ๋ณํ์ ๊ฐ๋ฆฌํจ๋ค. ์ข ์ ํ์ ๋๋ถ์ ํ๋ก๊ทธ๋จ๊ณผ ์ฆ๋ช ์ด ๊ฐ์ ์ธ์ด์์ ์์ฑยท๊ฒ์ฆ๋๋ฉฐ, ๋ณต์กํ ์ฌ์ ์กฐ๊ฑดยทํ์กฐ๊ฑด์ ํ์ ์์ค์์ ํํํ ์ ์๋ค.
์ํ์๋ค์ด constructive class๋ ์ง ๋ญ๋ ์ง, Lean๊ฐ๋ฐ์๋ค๋ ๋ชจ๋ฅด๋ ๊ฒ๋ค ๋๋ฌธ์ Lean์ ์ข์ํ๊ณ ์๋ค.
A Lean proof of Fermatโs Last Theorem
https://imperialcollegelondon.github.io/FLT/blueprint.pdf -> https://pitmonticone.github.io/FLT3/blueprint/dep_graph_document.html (n=3) -> https://pitmonticone.github.io/FLT3/docs/FLT3/FLT3.html#Solution'.multiplicity_lambda_c_finite (specific lemma)
Lean in software verification
Cedar - https://aws.amazon.com/ko/blogs/opensource/lean-into-verified-software-development/ Cedar๋ ๊ฐ๋ฐ์๊ฐ ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ถํ์ ์ ์ํ๊ณ ์ ์ฉํ๋ ๋ฐ ์ฌ์ฉํ ์ ์๋ ๊ถํ ๋ถ์ฌ ์ ์ฑ ์ ์์ฑํ๋ย ์คํ ์์ค ์ธ์ดย ์ ๋๋ค .
“Maintaining the proofs” ์์ Lean์ด ๋งค์ฐ ์ข์.
SampCert
Geometrics๊ฐ CompCert์ ๊ธฐ์ฌํ๋ฏ์ด. Mathlib ๋๋ถ์, Lean์ผ๋ก SampCert๋ฅผ ๋ง๋ค ์ ์์๋ค - ํธ๋ฆฌ์ ๋ถ์, ์ ์๋ก , ์์์ํ
Lean is extensible - can build own proofs
https://techcommunity.microsoft.com/blog/microsoft-security-blog/microsofts-quantum-resistant-cryptography-is-here/4238780 https://www.microsoft.com/en-us/research/publication/aeneas-rust-verification-by-functional-translation/
https://github.com/phlippe/Lean_hammer
- https://www.themoonlight.io/ko/review/premise-selection-for-a-lean-hammer Lean์์ โhammerโ๋ ๋ณต์กํ ์ฆ๋ช ๋ชฉํ๋ฅผ ์๋ํ๋ ์ธ๋ถ ์ ๋ฆฌ ์ฆ๋ช ๊ธฐ(์: Z3, Vampire)๋ SMT ์๋ฒ์ ๋๊ฒจ ๋์ ์ฆ๋ช ํ๋๋ก ํ ๋ค, ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ๋ค์ Lean ๋ด๋ถ์ ์ฆ๋ช ์ฒด๊ณ๋ก ๋์ด์ค๋ ๋๊ตฌ์ ๋๋ค.
-
์ญํ
-
์ฌ์ฉ์๊ฐ ์๋์ผ๋ก ์์ฑํ๊ธฐ ์ด๋ ค์ด ๋ณต์กํ ์ฆ๋ช ์๋ฌด(goal)๋ฅผ ์ธ๋ถ ATP(Automated Theorem Prover)์ ๋งก๊น๋๋ค.
-
ATP๊ฐ ์ฐพ์ ์ฆ๋ช ์คํ ์ Lean์ ์ ๋ฆฌ๋ ์ ์ (tactic) ํํ๋ก ์ฌ๊ตฌ์ฑํ์ฌ, ์ฌ์ฉ์๋ ๋จ์ํ ํ ์ค์ ๋ช ๋ น์ผ๋ก ๊ฐ๋ ฅํ ์๋ ์ฆ๋ช ๊ธฐ๋ฅ์ ํ์ฉํ ์ ์์ต๋๋ค. 1(https://github.com/phlippe/Lean_hammer)
-
-
์ด๋ฆ ์ ๋
- Isabelle/HOL์์ ์ ๊ณตํ๋ โSledgehammerโ ์ ์ ์์ ์ํฅ๋ฐ์์ต๋๋ค. โSledgehammerโ๊ฐ ๋ชป์ ๋ฐ๋ฏ, ์ด๋ ต๊ฒ ๋๊ปด์ง๋ ์ฆ๋ช ๋ชฉํ๋ฅผ ๊ฐ๋ ฅํ๊ฒ ํ๊ฒฉ(ํด๊ฒฐ)ํด ์ค๋ค๋ ์๋ฏธ๋ฅผ ๋ด๊ณ ์์ต๋๋ค. 5(https://www.themoonlight.io/ko/review/premise-selection-for-a-lean-hammer)
-
์ฅ์
- ์ฆ๋ช ์๊ฐ์ ํฌ๊ฒ ๋จ์ถ
- ๋ณต์กํ ๋ ผ๋ฆฌ ๊ตฌ์กฐ๋ ์ธ๋ถ ์๋ฒ์ ํ์ ๋ฅ๋ ฅ์ผ๋ก ์ฒ๋ฆฌ
- Lean ์ํ์ ๋๊ตฌ๋ฅผ ๊ฒฐํฉํด ์ฆ๋ช ์๋ํ ํ๊ฒฝ์ ํ์ฅ
์ด์ฒ๋ผ Lean hammer๋ โ๋ฌด๊ฑฐ์ด ๋ง์นโ์ฒ๋ผ ๊ฐ๋ ฅํ ์๋ ์ฆ๋ช ์ง์์ ์ ๊ณตํ์ฌ, ์ฆ๋ช ๊ฐ๋ฐ ์๋๋ฅผ ๋์ด๊ณ ์ฌ์ฉ์ ๋ถ๋ด์ ์ค์ฌ ์ค๋๋ค.
๐ Sources
-
themoonlight.io - [๋ ผ๋ฌธ ๋ฆฌ๋ทฐ] Premise Selection for a Lean Hammer
-
openreview.net - LeanAgent: Lifelong Learning for Formal Theorem Proving
grind
Grind๋ SMT ์๋ฒ ๊ตฌ์กฐ๋ฅผ ๋ณธ๋ฌ ์๋ํ ํ๋ ์์ํฌ๋ค. ๋ค์ ๋ค ๋จ๊ณ๋ก ๋์ํ๋ค.
-
์ ์ฝ ์์ง ๋ฐ ๊ธฐ์ฌ
-
์ ๋ ฅ ๋ฌธ์ ์์ ๋ํ๋๋ ๋ฑ์ยท๋ถ๋ฑ์์ ํ์ํด โ๊ฒ์ฌํ(board)โ์ ๊ธฐ๋ก
-
๊ฐ ์ ์ฝ์ ๋ชฉ๋กํํด ์ ์ฒด ์ปจํ ์คํธ๋ฅผ ๊ตฌ์ฑ
-
-
๋์น๋ฅ ๋ณํฉ(Equivalence Merging)
-
๊ธฐ๋ก๋ ๋ฑ์๋ค์ ํตํด ๋ณ์๋ ํํ์์ ๋์ผ ํด๋์ค์ ๋ฌถ์
-
Congruence closure ๊ธฐ๋ฒ์ผ๋ก ์ ๋ ๊ฐ๋ฅํ ๋ชจ๋ ๋์น ๊ด๊ณ๋ฅผ ํจ์จ์ ์ผ๋ก ํตํฉ
-
-
ํ๋ ฅ ์์ง(Cooperating Engines)
-
Case Analysis Engine: ๋ถ๊ธฐ๋ณ ๊ฐ๋ฅํ ์ผ์ด์ค(์: x>0, xโค0)๋ฅผ ๋๋ ๊ฐ๊ฐ ๋ ๋ฆฝ ํด๊ฒฐ
-
E-Analysis Engine: ๋ฑ์ ๋ฐ ํจ์ ๊ฒฐํฉ ํน์ฑ์ ์ฌ์ฉํด ์ถ๊ฐ ๋์นยท๋ถ๋ฑ์ ์ ๋
-
Theory Solvers: ์ ํ์ฐ์ , ๋ถ๋์์์ , ๋ฐฐ์ด ๋ฑ ๊ฐ ์ด๋ก ์ ์ฉ ํ์ ์๋ฒ์ ์ฐ๋
-
-
์ถฉ๋ ํ์ง ๋ฐ ํด์(Conflict Resolution)
-
์๋ก ๋ชจ์๋๋ ์ ์ฝ์ด ๋ฐ๊ฒฌ๋๋ฉด ๊ฐ๋จํ ํ์ต(clause learning)์ผ๋ก ์์ธ ๊ธฐ๋ก
-
๋ชจ์์ ์ผ์ผํค๋ ๊ฒฝ๋ก๋ฅผ ์ฐจ๋จํด ๋ ๊น์ ํ์์ผ๋ก ์ ๋
-
์ด ๊ณผ์ ์ ๋ฐ๋ณตํ๋ฉฐ, ๋ชจ๋ ์ ์ฝ์ด ๋ง์กฑ๋๊ฑฐ๋ ๋ชจ์์ด ์ฆ๋ช ๋ ๋๊น์ง ์๋์ผ๋ก ์ฆ๋ช ยทํด๊ฒฐ์ ์ํํ๋ค. SMT ์๋ฒ์ ํต์ฌ ์์์ธ ์ ์ฝ ์ ํ(constraint propagation), ๋ถ๊ธฐ(case splitting), ๋์น ์ถ๋ก (equivalence reasoning)์ ์ฒด๊ณ์ ์ผ๋ก ๊ฒฐํฉํจ์ผ๋ก์จ ๋งค์ฐ ํ์ฅ ๊ฐ๋ฅํ๊ณ ํจ์จ์ ์ธ ์๋ํ ํ๊ฒฝ์ ์ ๊ณตํ๋ค.
๐ Sources
Verified AI(-generated proof)
AlphaProof, AlphaGeometry, ChatGPT ๊ทธ๋ฆฌ๊ณ ์ ๊ฒฝ-๊ธฐํธ์ AI์ ๋ฏธ๋ 2024-07
์์ฐ์ด๋ฅผ formal language๋ก ๋ณํํ๋ฉด์ lean์ผ๋ก ๊ฒ์ฆ