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
磯野家で学ぶ Prolog
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
ckazu
June 06, 2018
Programming
47
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
磯野家で学ぶ Prolog
ckazu
June 06, 2018
More Decks by ckazu
See All by ckazu
2024 コーディング研修
ckazu
2
2k
Introduction fasttext
ckazu
0
48
Query selecterの話
ckazu
0
38
仮想電子工作のすすめ
ckazu
0
63
ウェブエンジニアのための色の話
ckazu
0
35
これさえ読めば知ったかできるかもしれない人工知能の歴史と機械学習の今
ckazu
0
37
Shinjuku.html5.lunch #11
ckazu
0
47
typo の傾向と対策
ckazu
0
56
ずぶの素人がRails開発できるようになるために必要な5つのこと
ckazu
0
47
Other Decks in Programming
See All in Programming
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
Domain-Driven Transformation
hschwentner
2
2.3k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
270
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
JIS keyboard support in Omarchy
lef237
0
110
すこし踏み込む CancellationToken
htkym
2
1.7k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
RailsConf 2023
tenderlove
30
1.6k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
Producing Creativity
orderedlist
PRO
348
41k
Site-Speed That Sticks
csswizardry
13
1.6k
Test your architecture with Archunit
thirion
2
2.4k
The Curse of the Amulet
leimatthew05
3
16k
Marketing to machines
jonoalderson
1
5.9k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
Transcript
磯野家で学ぶ Prolog
About Prolog PROgramming in LOGic 論理プログラミング言語 初期の人工知能研究。 1972年フランス発 一階述語論理の表現 P
⇒ Q 最近だと、 IBM watson Softbank pepper 論理憲法
prolog の基本 事実 (facts) を記述し、 規則 (rules) を定義し、 質問 (queries)
をする
install http://swi-prolog.org $ brew install swi-prolog インタプリタの起動 $ swipl <FILENAME>
終了 ?- halt. ファイルの再読込 ?- reload.
None
事実(facts) 親子関係を列挙してみる $ vi sazae-san.pl parent(波平, サザエ). parent(波平, カツオ). parent(波平,
ワカメ). parent(フネ, サザエ). parent(フネ, カツオ). parent(サザエ, タラ). parent(マスオ, タラ).
質問(queries) ファイルを読み込んでインタプリタを起動する $ swipl sazae-san.pl ?- parent(波平, サザエ). ?- parent(波平,
タラ). ?- parent(サザエ, X). ?- parent(波平, X). ?- parent(カツオ, X). ?- parent(X, タラ).
規則(rules) タラちゃんのおじいちゃん(おばあちゃん)は誰?
規則(rules) タラちゃんのおじいちゃん(おばあちゃん)は誰? ?- parent(X, Y), parent(Y, タラ).
規則(rules) タラちゃんのおじいちゃん(おばあちゃん)は誰? ?- parent(X, Y), parent(Y, タラ). :- (ならば)
規則(rules) タラちゃんのおじいちゃん(おばあちゃん)は誰? ?- parent(X, Y), parent(Y, タラ). :- (ならば) grandparent(X,Z):-
parent(X,Y), parent(Y,Z).
規則(rules) タラちゃんのおじいちゃん(おばあちゃん)は誰? ?- parent(X, Y), parent(Y, タラ). :- (ならば) grandparent(X,Z):-
parent(X,Y), parent(Y,Z). ?- grandparent(X, タラ).
父親と母親を 区別する 事実として性別を列挙する male(波平). male(カツオ). male(タラ). male(マスオ). female(フネ). female(ワカメ). female(サザエ).
?- male(カツオ). ?- female(カツオ). ?- femaile(X).
父親と母親を 区別する father(X, Y):- parent(X, Y), male(X). mother(X, Y):- parent(X,
Y), female(X). ?- parent(X, タラ). ?- mother(X, タラ).
祖父母を定義する
祖父母を定義する grandfather(X, Z):- grandparent(X, Z), male(X). grandmother(X, Z):- grandparent(X, Z),
female(X).
None
ノリスケとカツオの関係 は?
ノリスケとカツオの関係 は? male(波平の父). female(波平の母). parent(波平の父, 波平). parent(波平の父, 海平). parent(波平の父, なぎえ).
parent(波平の母, 波平). parent(波平の母, 海平). parent(波平の母, なぎえ). parent(なぎえ, ノリスケ). parent(ノリスケ, イクラ).
ノリスケとカツオの関係 は? いとこ(X, Y):- parent(A, X), parent(B, Y), sibling(A, B).
はとこ(X, Y):- grandparent(A, X), grandparent(B, Y), sibling(A, B).
宿題 夫婦関係を知るには? 子供がいることを知るには? 娘、息子の定義 離婚している場合 家族の定義 n 等親を知るには? リスト表現を使ってみる 兄弟,
姉妹の生まれ順
https://gist.github.com/ckazu/06697521ab2baee813 44bda1904daee9