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
磯野家で学ぶ Prolog
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
ckazu
June 06, 2018
Programming
39
0
Share
磯野家で学ぶ Prolog
ckazu
June 06, 2018
More Decks by ckazu
See All by ckazu
2024 コーディング研修
ckazu
2
1.9k
Introduction fasttext
ckazu
0
39
Query selecterの話
ckazu
0
29
仮想電子工作のすすめ
ckazu
0
51
ウェブエンジニアのための色の話
ckazu
0
27
これさえ読めば知ったかできるかもしれない人工知能の歴史と機械学習の今
ckazu
0
30
Shinjuku.html5.lunch #11
ckazu
0
41
typo の傾向と対策
ckazu
0
35
ずぶの素人がRails開発できるようになるために必要な5つのこと
ckazu
0
44
Other Decks in Programming
See All in Programming
ECR拡張スキャンでSBOMを収集して サプライチェーン攻撃の影響調査を 爆速で終わらせてみた
akihisaikeda
2
200
Migrations : C'est une question d'hygiène !
vinceamstoutz
0
1.8k
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
400
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
5
640
色即是空、空即是色、データサイエンス
kamoneggi
1
160
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
3
1.1k
Agentic UI beyond Chats Architecture Patterns & Open Standards @ngMunich 05/2026
manfredsteyer
PRO
0
140
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
360
Agent Skills を社内で育てる仕組み作り
jackchuka
1
2.4k
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
120
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
2.1k
AWSはOSSをどのように 考えているのか?
akihisaikeda
1
140
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
Claude Code のすすめ
schroneko
67
220k
How to Talk to Developers About Accessibility
jct
2
210
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
390
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
250
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
So, you think you're a good person
axbom
PRO
2
2k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
240
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