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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Hiroki Tokunaga
July 22, 2025
Programming
75
0
Share
定理証明をやろう
24th Dev #3 ~好きな技術シェア会~ のLTのスライドです。
Hiroki Tokunaga
July 22, 2025
More Decks by Hiroki Tokunaga
See All by Hiroki Tokunaga
RocqのProgram機構の紹介 〜型を活用した安全なプログラミング〜
_toku_san
0
6
Other Decks in Programming
See All in Programming
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
160
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
5.5k
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
180
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
130
Feature Toggle は捨てやすく使おう
gennei
0
400
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
210
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
190
AI-DLC 入門 〜AIコーディングの本質は「コード」ではなく「構造」〜 / Introduction to AI-DLC: The Essence of AI Coding Is Not “Code” but “Structure”
seike460
PRO
0
190
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.5k
AI 開発合宿を通して得た学び
niftycorp
PRO
0
190
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
130
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
510
Featured
See All Featured
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
510
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
500
Claude Code のすすめ
schroneko
67
220k
Bash Introduction
62gerente
615
210k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
800
エンジニアに許された特別な時間の終わり
watany
106
240k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
GraphQLとの向き合い方2022年版
quramy
50
14k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
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