Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
定理証明をやろう
Search
Hiroki Tokunaga
July 22, 2025
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
定理証明をやろう
24th Dev #3 ~好きな技術シェア会~ のLTのスライドです。
Hiroki Tokunaga
July 22, 2025
More Decks by Hiroki Tokunaga
See All by Hiroki Tokunaga
RocqのProgram機構の紹介 〜型を活用した安全なプログラミング〜
_toku_san
0
37
Other Decks in Programming
See All in Programming
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
660
Event is what happens
moro
2
850
APNsからLive Activityを開始する話
yumnumm
0
170
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
250
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
220
phperだってパンチカードでコーディングしたい
o0h
PRO
0
340
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
2
410
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
19k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Exploring anti-patterns in Rails
aemeredith
4
540
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Un-Boring Meetings
codingconduct
0
460
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
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