Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
定理証明をやろう
Search
Hiroki Tokunaga
July 22, 2025
Programming
0
73
定理証明をやろう
24th Dev #3 ~好きな技術シェア会~ のLTのスライドです。
Hiroki Tokunaga
July 22, 2025
Tweet
Share
More Decks by Hiroki Tokunaga
See All by Hiroki Tokunaga
RocqのProgram機構の紹介 〜型を活用した安全なプログラミング〜
_toku_san
0
5
Other Decks in Programming
See All in Programming
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
750
AtCoder Conference 2025
shindannin
0
930
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
760
Grafana:建立系統全知視角的捷徑
blueswen
0
280
Python札幌 LT資料
t3tra
7
1.1k
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
0
500
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
210
はじめてのカスタムエージェント【GitHub Copilot Agent Mode編】
satoshi256kbyte
0
160
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
250
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
320
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
730
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
3
1.2k
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
180
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
140
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Side Projects
sachag
455
43k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
Exploring anti-patterns in Rails
aemeredith
2
230
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
130
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Designing for Timeless Needs
cassininazir
0
120
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Transcript
定理証明をやろう Hiroki Tokunaga
自己紹介 名前 :Hiroki Tokunaga 仕事 :セキュリティエンジニア@DeNA 趣味 :Haskell、OCaml、Rocq、Lean 関数型まつり2025で登壇した X
:_toku_san GitHub :toku-sa-n 2
定理証明で「何」ができる? プログラムも数学も 形式化して ⇨ 証明できる! 3 ➕ 🗺 🛡 ⾜し算 四⾊定理 型安全性
▼ 機械的に確認できる例
どうやって? 定理証明⽀援系を使う 4
定理証明支援系? 定理証明を⾏うための ソフトウェア 5 例:Lean, Agda, Isabelle, F*, Rocq(旧称Coq)
スクリーンショット 6
Leanのコード例:リストを逆順にする def reverse : List α → List α |
[] => [] | h :: t => reverse t ++ [h] 7
Leanのコード例:2つのリストの結合の逆順 theorem reverse_app : ∀ (xs ys : List α),
reverse (xs ++ ys) = reverse ys ++ reverse xs := by intro xs ys induction xs with | nil => rewrite [List.nil_append, reverse, List.append_nil] rfl | cons h t ih => rewrite [reverse, ← List.append_assoc, ← ih] rfl 8
証明の流れ (1/13) theorem reverse_app : ∀ (xs ys : List
α), reverse (xs ++ ys) = reverse ys ++ reverse xs := by 9 α : Type u_1 ⊢ ∀ (xs ys : List α), reverse (xs ++ ys) = reverse ys ++ reverse xs
証明の流れ (2/13) intro xs ys 10 α : Type u_1
xs ys : List α ⊢ reverse (xs ++ ys) = reverse ys ++ reverse xs
証明の流れ (3/13) induction xs with 11 α : Type u_1
xs ys : List α ⊢ reverse (xs ++ ys) = reverse ys ++ reverse xs
証明の流れ (4/13) | nil => 12 α : Type u_1
ys : List α ⊢ reverse ([] ++ ys) = reverse ys ++ reverse []
証明の流れ (5/13) rewrite [List.nil_append, reverse, List.append_nil] 13 case nil α
: Type u_1 ys : List α ⊢ reverse ys = reverse ys ++ reverse [] List.nil_append : ∀ as, [] ++ as = as
証明の流れ (6/13) rewrite [List.nil_append, reverse, List.append_nil] 14 case nil α
: Type u_1 ys : List α ⊢ reverse ys = reverse ys ++ []
証明の流れ (7/13) rewrite [List.nil_append, reverse, List.append_nil] 15 case nil α
: Type u_1 ys : List α ⊢ reverse ys = reverse ys List.append_nil : ∀ as, as ++ [] = as
証明の流れ (8/13) rfl 16 Goals accomplished 🎉
証明の流れ (9/13) | cons h t ih => 17 case
cons α : Type u_1 ys : List α h : α t : List α ih : reverse (t ++ ys) = reverse ys ++ reverse t ⊢ reverse (h :: t ++ ys) = reverse ys ++ reverse (h :: t)
証明の流れ (10/13) rewrite [reverse, ← List.append_assoc, ← ih] 18 case
cons α : Type u_1 ys : List α h : α t : List α ih : reverse (t ++ ys) = reverse ys ++ reverse t ⊢ reverse (h :: t ++ ys) = reverse ys ++ (reverse t ++ [h])
証明の流れ (11/13) rewrite [reverse, ← List.append_assoc, ← ih] 19 case
cons α : Type u_1 ys : List α h : α t : List α ih : reverse (t ++ ys) = reverse ys ++ reverse t ⊢ reverse (h :: t ++ ys) = reverse ys ++ reverse t ++ [h] List.append_assoc : ∀ (as bs cs : List α), as ++ bs ++ cs = as ++ (bs ++ cs)
証明の流れ (12/13) rewrite [reverse, ← List.append_assoc, ← ih] 20 case
cons α : Type u_1 ys : List α h : α t : List α ih : reverse (t ++ ys) = reverse ys ++ reverse t ⊢ reverse (h :: t ++ ys) = reverse (t ++ ys) ++ [h]
証明の流れ (13/13) rfl 21 Goals accomplished 🎉
定理証明の活用例 22 🔒 HACL*[1] 🔨 seL4[3] - 暗号化ライブラリ - FirefoxのCurve25519実装で
使用[2] - F*で実装[1] - OS - 自動車などで使用[4] - Isabelleで実装[5] [1] https://github.com/hacl-star/hacl-star [2] https://blog.mozilla.org/security/2020/07/06/performance-improvements-via-formally-verified-cryptography-in-firefox/ [3] https://sel4.systems/ [4] https://sel4.systems/use.html [5] https://sel4.systems/Verification/proofs.html
定理証明をやってみたい? Rocq Software Foundations (特に第⼀巻のLogical Foundations ) Lean Theorem Proving
in Lean 4 Functional Programming in Lean 23