SlideShare ist ein Scribd-Unternehmen logo
1 von 14
MaudeTerm Rewriting Logic簡単な紹介 2010/07/19 tmiya
Maude http://maude.cs.uiuc.edu/ Membership equational logic, Rewriting Logicに基づくプログラミング言語 OBJ系の仲間 宣言的。原理は明確でシンプルだが表現力は高い でもパフォーマンスも出る LTL -> Büchi automataの変換のJavaプログラムより3倍速かった 複数の用途 Deterministic:関数モジュール Concurrent, nondeterministic:システムモジュール OO:オブジェクトモジュール 何に使えるか プログラミング:DSL。宣言的プログラミング。 形式仕様記述:代数的仕様記述 モデル検査:停止性とかCR性とか色々
Maude 教科書 “All About Maude - A High-Performance Logical Framework: How to Specify, Program, and Verify Systems in Rewriting Logic” SpringerのLNCSシリーズ (2007) Maude 2 Primer : PDF(2003) A Maude Tutorial : PS(2000) インストール Core Maudeインストール Linux on Intel, MacOS on Intel -> 実行可能バイナリあり その他:ソースから頑張って Full Maude : Maudeで書かれている その他のツール Inductive Theorem Prover Maude Termination Tool : eq仕様の停止性 Church Rosser Checker : CR性の検査 Real-Time Maude : timed-rewriting, LTL, などなど。
Peano自然数(定義) Maude> fmod PEANO-NAT-EXTRA is	// 関数モジュール > sort Nat .										// sortは型とか集合みたいなもの > op 0 : -> Nat [ctor] .				// [ctor]はコンストラクタ > op s : Nat -> Nat [ctoriter] .	// [iter]は繰り返し有り > op _+_ : Nat Nat -> Nat .		// _でプレースホルダ > vars M N : Nat . > eq 0 + N = N .								// eqは書き換え規則 > eqs(M) + N = s(M + N) . > endfm Maude>
Peano自然数(簡約) Maude> set trace on .					// 変形をトレース表示 Maude> reduce s(0) + s(s(0)) . reduce in PEANO-NAT-EXTRA : s(0) + s^2(0) . *********** equation eqs(M) + N = s(M + N) . M --> 0 N --> s^2(0) s(0) + s^2(0) ---> s(0 + s^2(0)) *********** equation eq 0 + N = N . N --> s^2(0) 0 + s^2(0) ---> s^2(0) rewrites: 2 in 0ms cpu (0ms real) (9009 rewrites/second) result Nat: s^3(0) Maude>
タバコ(定義) Maude> mod CIGARETTE is			// モジュール > sort State . > op c : -> State [ctor] . *** cigarette > op b : -> State [ctor] . *** butt > op __ : State State -> State [ctor assoc comm] . > rl [smoke] : c => b .						// 状態遷移規則 > rl [makenew] : bbbb => c . > endm Maude>  [assoc comm] : 結合則、可換則 項書き換えの無限ループを避け、効率化するため、明示的に指定
タバコ(実行) rewrite [100] in CIGARETTE : cccccccccccccccc . *********** rule rlc => b [label smoke] . empty substitution c ---> b 中略 *********** rule rlbbbb => c [label makenew] . empty substitution ccccccccccccbbbb ---> (cccccccccccc) c 中略 *********** rule rlc => b [label smoke] . empty substitution c ---> b rewrites: 26 in 1ms cpu (1ms real) (14046 rewrites/second) result State: b Maude>
アーケードクレーン(定義) Maude> mod ARCADE-CRANE is > protecting QID . > sorts ToyID State . > subsortQid < ToyID . > op floor : ToyID -> State [ctor] . > op on : ToyIDToyID -> State [ctor] . > op clear : ToyID -> State [ctor] . > op hold : ToyID -> State [ctor] . > op empty : -> State [ctor] . > op 1 : -> State [ctor] . *** identity state > op _&_ : State State -> State [ctor assoc comm id: 1] . > vars X Y : ToyID . > rl [pickup] : empty & clear(X) & floor(X) => hold(X) . > rl [putdown] : hold(X) => empty & clear(X) & floor(X) . > rl [unstack] : empty & clear(X) & on(X,Y) => hold(X) & clear(Y) . > rl [stack] : hold(X) & clear(Y) => empty & clear(X) & on(X,Y) . > endm Maude>
アーケードクレーン(状態) Maude> search in ARCADE-CRANE : empty & floor('mothergoose) & on('teddybear, 'mothergoose) & on('soccerball, 'teddybear) & clear('soccerball) & floor('dragondude) & clear('dragondude) =>+ empty & floor('teddybear) & on ('mothergoose,'teddybear) & on('soccerball,'mothergoose) & clear('soccerball) & floor('dragondude) & clear('dragondude) . *********** rule rl empty & floor(X) & clear(X) => hold(X) [label pickup] . X --> 'dragondude empty & floor('dragondude) & floor('mothergoose) & clear('dragondude) & clear(     'soccerball) & on('soccerball, 'teddybear) & on('teddybear, 'mothergoose) ---> (floor('mothergoose) & clear('soccerball) & on('soccerball, 'teddybear) & on(     'teddybear, 'mothergoose)) & hold('dragondude) 中略 *********** rule rl empty & clear(X) & on(X, Y) => clear(Y) & hold(X) [label unstack] . X --> 'soccerball Y --> 'dragondude empty & floor('teddybear) & clear('soccerball) & on('dragondude, 'mothergoose)     & on('mothergoose, 'teddybear) & on('soccerball, 'dragondude) ---> (floor('teddybear) & on('dragondude, 'mothergoose) & on('mothergoose,     'teddybear)) & clear('dragondude) & hold('soccerball) No more solutions. states: 125  rewrites: 272 in 37ms cpu (391ms real) (7237 rewrites/second) Maude>
アーケードクレーン(状態) Maude> search in ARCADE-CRANE : empty & floor('mothergoose) & on('teddybear,'mothergoose) & on('soccerball,'teddybear) & clear('soccerball) & floor('dragondude) & clear('dragondude) =>+ empty & floor('teddybear) & floor('mothergoose) & clear('teddybear) & clear('mothergoose) & X:State . Solution 1 (state 10) states: 11  rewrites: 16 in 0ms cpu (0ms real) (49844 rewrites/second) X:State --> floor('dragondude) & clear('soccerball) & on('soccerball,     'dragondude) Solution 2 (state 15) states: 16  rewrites: 23 in 0ms cpu (0ms real) (40280 rewrites/second) X:State --> floor('dragondude) & floor('soccerball) & clear('dragondude) & clear('soccerball) Solution 3 (state 33) states: 34  rewrites: 54 in 1ms cpu (1ms real) (39560 rewrites/second) X:State --> floor('soccerball) & clear('dragondude) & on('dragondude,     'soccerball) No more solutions. states: 125  rewrites: 272 in 5ms cpu (5ms real) (50670 rewrites/second) Maude>  X
川渡しパズル(定義1) Maude> mod RIVER-CROSSING is > sorts Side Group . > ops left right : -> Side [ctor] . > op change : Side -> Side . > eqchange(left) = right . > eqchange(right) = left . > ops swlc : Side -> Group [ctor] . > op __ : Group Group -> Group [ctor assoc comm] . > var S : Side . > rl [shepherd] : s(S) => s(change(S)) . > rl [wolf] : s(S) w(S) => s(change(S)) w(change(S)) . > rl [lamb] : s(S) l(S) => s(change(S)) l(change(S)) . > rl [cabbage] : s(S) c(S) => s(change(S)) c(change(S)) . > endm
川渡しパズル(定義2) Maude> mod RIVER-CROSSING-PROP is > protecting RIVER-CROSSING . > including MODEL-CHECKER . > subsort Group < State . > op initial : -> Group . > eq initial = s(left) w(left) l(left) c(left) . > ops disaster success : -> Prop . > vars S S' S'' : Side . > ceq (w(S) l(S) s(S') c(S'') |= disaster) = true if S =/= S' . > ceq (w(S'') l(S) s(S') c(S) |= disaster) = true if S =/= S' . > eq (s(right) w(right) l(right) c(right) |= success) = true . > endm Maude>
川渡しパズル(実行) % ./maude.intelDarwin -interactive model-checker.maude Maude> red modelCheck(initial, > <> success -> (<> disaster /((success) U disaster))) . reduce in RIVER-CROSSING-PROP : modelCheck(initial, <> success -> <> disaster     /(success U disaster)) . rewrites: 76 in 1ms cpu (1ms real) (60995 rewrites/second) result ModelCheckResult: counterexample({s(left) w(left) l(left) c(left),'lamb}     {s(right) w(left) l(right) c(left),'shepherd} {s(left) w(left) l(right) c( left),'wolf} {s(right) w(right) l(right) c(left),'lamb} {s(left) w(right) l(left) c(left),'cabbage} {s(right) w(right) l(left) c(right),'shepherd} { s(left) w(right) l(left) c(right),'lamb} {s(right) w(right) l(right) c( right),'lamb} {s(left) w(right) l(left) c(right),'shepherd} {s(right) w(     right) l(left) c(right),'wolf} {s(left) w(left) l(left) c(right),'lamb} {s(     right) w(left) l(right) c(right),'cabbage} {s(left) w(left) l(right) c( left),'wolf}, {s(right) w(right) l(right) c(left),'lamb} {s(left) w(right) l(left) c(left),'lamb}) Maude>
触り始めたばかりだが Maudeは割と面白い 普通に項書き換え系プログラミングとして遊べる 例えば型無しλ計算とか、当たり前だけど書ける 違和感があるところ Subsorts Nat < NeList < List Nat は要素1個の (Nat)のList である!

Weitere ähnliche Inhalte

Was ist angesagt?

CFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAMCFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAMFumiya Nozaki
 
LLVM Backend の紹介
LLVM Backend の紹介LLVM Backend の紹介
LLVM Backend の紹介Akira Maruoka
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++Seok-joon Yun
 
The Power of CSS
The Power of CSSThe Power of CSS
The Power of CSSAniket Pant
 
Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)François-Guillaume Ribreau
 
Show innodb status
Show innodb statusShow innodb status
Show innodb statusjustlooks
 
Extreme JavaScript Performance
Extreme JavaScript PerformanceExtreme JavaScript Performance
Extreme JavaScript PerformanceThomas Fuchs
 
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...Iosif Itkin
 
The mighty js_function
The mighty js_functionThe mighty js_function
The mighty js_functiontimotheeg
 
Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++Sergey Platonov
 
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...PROIDEA
 

Was ist angesagt? (13)

CFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAMCFD for Rotating Machinery using OpenFOAM
CFD for Rotating Machinery using OpenFOAM
 
LLVM Backend の紹介
LLVM Backend の紹介LLVM Backend の紹介
LLVM Backend の紹介
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
 
What is recursion?
What is recursion? What is recursion?
What is recursion?
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
 
The Power of CSS
The Power of CSSThe Power of CSS
The Power of CSS
 
Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)
 
Show innodb status
Show innodb statusShow innodb status
Show innodb status
 
Extreme JavaScript Performance
Extreme JavaScript PerformanceExtreme JavaScript Performance
Extreme JavaScript Performance
 
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
TMPA-2017: Predicate Abstraction Based Configurable Method for Data Race Dete...
 
The mighty js_function
The mighty js_functionThe mighty js_function
The mighty js_function
 
Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++
 
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
 

Andere mochten auch

カークマンの女学生問題と有限幾何
カークマンの女学生問題と有限幾何カークマンの女学生問題と有限幾何
カークマンの女学生問題と有限幾何yam6da
 
代数的実数とCADの実装紹介
代数的実数とCADの実装紹介代数的実数とCADの実装紹介
代数的実数とCADの実装紹介Masahiro Sakai
 
Shibuya.lisp #28: 仮題: R について
Shibuya.lisp #28: 仮題: R についてShibuya.lisp #28: 仮題: R について
Shibuya.lisp #28: 仮題: R についてtnoda
 
プログラミング・パラダイム
プログラミング・パラダイムプログラミング・パラダイム
プログラミング・パラダイムYusuke Matsushita
 
NPC April Fool's Contest 2014 累乗数
NPC April Fool's Contest 2014 累乗数NPC April Fool's Contest 2014 累乗数
NPC April Fool's Contest 2014 累乗数Yusuke Matsushita
 
数学プログラムを Haskell で書くべき 6 の理由
数学プログラムを Haskell で書くべき 6 の理由数学プログラムを Haskell で書くべき 6 の理由
数学プログラムを Haskell で書くべき 6 の理由Hiromi Ishii
 

Andere mochten auch (7)

カークマンの女学生問題と有限幾何
カークマンの女学生問題と有限幾何カークマンの女学生問題と有限幾何
カークマンの女学生問題と有限幾何
 
代数的実数とCADの実装紹介
代数的実数とCADの実装紹介代数的実数とCADの実装紹介
代数的実数とCADの実装紹介
 
Shibuya.lisp #28: 仮題: R について
Shibuya.lisp #28: 仮題: R についてShibuya.lisp #28: 仮題: R について
Shibuya.lisp #28: 仮題: R について
 
プログラミング・パラダイム
プログラミング・パラダイムプログラミング・パラダイム
プログラミング・パラダイム
 
NPC April Fool's Contest 2014 累乗数
NPC April Fool's Contest 2014 累乗数NPC April Fool's Contest 2014 累乗数
NPC April Fool's Contest 2014 累乗数
 
Haskell超入門 Part.1
Haskell超入門 Part.1Haskell超入門 Part.1
Haskell超入門 Part.1
 
数学プログラムを Haskell で書くべき 6 の理由
数学プログラムを Haskell で書くべき 6 の理由数学プログラムを Haskell で書くべき 6 の理由
数学プログラムを Haskell で書くべき 6 の理由
 

Ähnlich wie Maude20100719

What you forgot from your Computer Science Degree
What you forgot from your Computer Science DegreeWhat you forgot from your Computer Science Degree
What you forgot from your Computer Science DegreeStephen Darlington
 
Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3guesta3202
 
Python And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And PythonwinPython And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And PythonwinChad Cooper
 
zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimizationKaren Morton
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lispkyleburton
 
Functional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network PerceptionFunctional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network PerceptionAtsushi Nitanda
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Raffi Krikorian
 
Yahoo! Mail antispam - Bay area Hadoop user group
Yahoo! Mail antispam - Bay area Hadoop user groupYahoo! Mail antispam - Bay area Hadoop user group
Yahoo! Mail antispam - Bay area Hadoop user groupHadoop User Group
 
Beholding the giant pyramid of application development; why Ajax applications...
Beholding the giant pyramid of application development; why Ajax applications...Beholding the giant pyramid of application development; why Ajax applications...
Beholding the giant pyramid of application development; why Ajax applications...Javeline B.V.
 
Laboratory Report Sample
Laboratory Report SampleLaboratory Report Sample
Laboratory Report SampleMarkus Flicke
 
The_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdfThe_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdfssuser340a0c
 
SICP勉強会について
SICP勉強会についてSICP勉強会について
SICP勉強会についてYusuke Sasaki
 
Python and sysadmin I
Python and sysadmin IPython and sysadmin I
Python and sysadmin IGuixing Bai
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8alish sha
 

Ähnlich wie Maude20100719 (20)

What you forgot from your Computer Science Degree
What you forgot from your Computer Science DegreeWhat you forgot from your Computer Science Degree
What you forgot from your Computer Science Degree
 
Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3Erlang Introduction Bcberlin3
Erlang Introduction Bcberlin3
 
Python And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And PythonwinPython And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And Pythonwin
 
Oscon 2010 Specs talk
Oscon 2010 Specs talkOscon 2010 Specs talk
Oscon 2010 Specs talk
 
Macro
MacroMacro
Macro
 
05-Debug.pdf
05-Debug.pdf05-Debug.pdf
05-Debug.pdf
 
zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimization
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
 
Prototype js
Prototype jsPrototype js
Prototype js
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
Functional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network PerceptionFunctional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network Perception
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....
 
Yahoo! Mail antispam - Bay area Hadoop user group
Yahoo! Mail antispam - Bay area Hadoop user groupYahoo! Mail antispam - Bay area Hadoop user group
Yahoo! Mail antispam - Bay area Hadoop user group
 
Scala en
Scala enScala en
Scala en
 
Beholding the giant pyramid of application development; why Ajax applications...
Beholding the giant pyramid of application development; why Ajax applications...Beholding the giant pyramid of application development; why Ajax applications...
Beholding the giant pyramid of application development; why Ajax applications...
 
Laboratory Report Sample
Laboratory Report SampleLaboratory Report Sample
Laboratory Report Sample
 
The_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdfThe_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdf
 
SICP勉強会について
SICP勉強会についてSICP勉強会について
SICP勉強会について
 
Python and sysadmin I
Python and sysadmin IPython and sysadmin I
Python and sysadmin I
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 

Mehr von tmiya

Coq for ML users
Coq for ML usersCoq for ML users
Coq for ML userstmiya
 
Proofsummit2011a
Proofsummit2011aProofsummit2011a
Proofsummit2011atmiya
 
Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011tmiya
 
Typeclass
TypeclassTypeclass
Typeclasstmiya
 
Coq Tutorial
Coq TutorialCoq Tutorial
Coq Tutorialtmiya
 
RegExp20110305
RegExp20110305RegExp20110305
RegExp20110305tmiya
 
Coq setoid 20110129
Coq setoid 20110129Coq setoid 20110129
Coq setoid 20110129tmiya
 
Coq Party 20101127
Coq Party 20101127Coq Party 20101127
Coq Party 20101127tmiya
 
Formal methods20100529
Formal methods20100529Formal methods20100529
Formal methods20100529tmiya
 
Coq 20100208a
Coq 20100208aCoq 20100208a
Coq 20100208atmiya
 

Mehr von tmiya (10)

Coq for ML users
Coq for ML usersCoq for ML users
Coq for ML users
 
Proofsummit2011a
Proofsummit2011aProofsummit2011a
Proofsummit2011a
 
Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011
 
Typeclass
TypeclassTypeclass
Typeclass
 
Coq Tutorial
Coq TutorialCoq Tutorial
Coq Tutorial
 
RegExp20110305
RegExp20110305RegExp20110305
RegExp20110305
 
Coq setoid 20110129
Coq setoid 20110129Coq setoid 20110129
Coq setoid 20110129
 
Coq Party 20101127
Coq Party 20101127Coq Party 20101127
Coq Party 20101127
 
Formal methods20100529
Formal methods20100529Formal methods20100529
Formal methods20100529
 
Coq 20100208a
Coq 20100208aCoq 20100208a
Coq 20100208a
 

Kürzlich hochgeladen

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Maude20100719

  • 2. Maude http://maude.cs.uiuc.edu/ Membership equational logic, Rewriting Logicに基づくプログラミング言語 OBJ系の仲間 宣言的。原理は明確でシンプルだが表現力は高い でもパフォーマンスも出る LTL -> Büchi automataの変換のJavaプログラムより3倍速かった 複数の用途 Deterministic:関数モジュール Concurrent, nondeterministic:システムモジュール OO:オブジェクトモジュール 何に使えるか プログラミング:DSL。宣言的プログラミング。 形式仕様記述:代数的仕様記述 モデル検査:停止性とかCR性とか色々
  • 3. Maude 教科書 “All About Maude - A High-Performance Logical Framework: How to Specify, Program, and Verify Systems in Rewriting Logic” SpringerのLNCSシリーズ (2007) Maude 2 Primer : PDF(2003) A Maude Tutorial : PS(2000) インストール Core Maudeインストール Linux on Intel, MacOS on Intel -> 実行可能バイナリあり その他:ソースから頑張って Full Maude : Maudeで書かれている その他のツール Inductive Theorem Prover Maude Termination Tool : eq仕様の停止性 Church Rosser Checker : CR性の検査 Real-Time Maude : timed-rewriting, LTL, などなど。
  • 4. Peano自然数(定義) Maude> fmod PEANO-NAT-EXTRA is // 関数モジュール > sort Nat . // sortは型とか集合みたいなもの > op 0 : -> Nat [ctor] . // [ctor]はコンストラクタ > op s : Nat -> Nat [ctoriter] . // [iter]は繰り返し有り > op _+_ : Nat Nat -> Nat . // _でプレースホルダ > vars M N : Nat . > eq 0 + N = N . // eqは書き換え規則 > eqs(M) + N = s(M + N) . > endfm Maude>
  • 5. Peano自然数(簡約) Maude> set trace on . // 変形をトレース表示 Maude> reduce s(0) + s(s(0)) . reduce in PEANO-NAT-EXTRA : s(0) + s^2(0) . *********** equation eqs(M) + N = s(M + N) . M --> 0 N --> s^2(0) s(0) + s^2(0) ---> s(0 + s^2(0)) *********** equation eq 0 + N = N . N --> s^2(0) 0 + s^2(0) ---> s^2(0) rewrites: 2 in 0ms cpu (0ms real) (9009 rewrites/second) result Nat: s^3(0) Maude>
  • 6. タバコ(定義) Maude> mod CIGARETTE is // モジュール > sort State . > op c : -> State [ctor] . *** cigarette > op b : -> State [ctor] . *** butt > op __ : State State -> State [ctor assoc comm] . > rl [smoke] : c => b . // 状態遷移規則 > rl [makenew] : bbbb => c . > endm Maude> [assoc comm] : 結合則、可換則 項書き換えの無限ループを避け、効率化するため、明示的に指定
  • 7. タバコ(実行) rewrite [100] in CIGARETTE : cccccccccccccccc . *********** rule rlc => b [label smoke] . empty substitution c ---> b 中略 *********** rule rlbbbb => c [label makenew] . empty substitution ccccccccccccbbbb ---> (cccccccccccc) c 中略 *********** rule rlc => b [label smoke] . empty substitution c ---> b rewrites: 26 in 1ms cpu (1ms real) (14046 rewrites/second) result State: b Maude>
  • 8. アーケードクレーン(定義) Maude> mod ARCADE-CRANE is > protecting QID . > sorts ToyID State . > subsortQid < ToyID . > op floor : ToyID -> State [ctor] . > op on : ToyIDToyID -> State [ctor] . > op clear : ToyID -> State [ctor] . > op hold : ToyID -> State [ctor] . > op empty : -> State [ctor] . > op 1 : -> State [ctor] . *** identity state > op _&_ : State State -> State [ctor assoc comm id: 1] . > vars X Y : ToyID . > rl [pickup] : empty & clear(X) & floor(X) => hold(X) . > rl [putdown] : hold(X) => empty & clear(X) & floor(X) . > rl [unstack] : empty & clear(X) & on(X,Y) => hold(X) & clear(Y) . > rl [stack] : hold(X) & clear(Y) => empty & clear(X) & on(X,Y) . > endm Maude>
  • 9. アーケードクレーン(状態) Maude> search in ARCADE-CRANE : empty & floor('mothergoose) & on('teddybear, 'mothergoose) & on('soccerball, 'teddybear) & clear('soccerball) & floor('dragondude) & clear('dragondude) =>+ empty & floor('teddybear) & on ('mothergoose,'teddybear) & on('soccerball,'mothergoose) & clear('soccerball) & floor('dragondude) & clear('dragondude) . *********** rule rl empty & floor(X) & clear(X) => hold(X) [label pickup] . X --> 'dragondude empty & floor('dragondude) & floor('mothergoose) & clear('dragondude) & clear( 'soccerball) & on('soccerball, 'teddybear) & on('teddybear, 'mothergoose) ---> (floor('mothergoose) & clear('soccerball) & on('soccerball, 'teddybear) & on( 'teddybear, 'mothergoose)) & hold('dragondude) 中略 *********** rule rl empty & clear(X) & on(X, Y) => clear(Y) & hold(X) [label unstack] . X --> 'soccerball Y --> 'dragondude empty & floor('teddybear) & clear('soccerball) & on('dragondude, 'mothergoose) & on('mothergoose, 'teddybear) & on('soccerball, 'dragondude) ---> (floor('teddybear) & on('dragondude, 'mothergoose) & on('mothergoose, 'teddybear)) & clear('dragondude) & hold('soccerball) No more solutions. states: 125 rewrites: 272 in 37ms cpu (391ms real) (7237 rewrites/second) Maude>
  • 10. アーケードクレーン(状態) Maude> search in ARCADE-CRANE : empty & floor('mothergoose) & on('teddybear,'mothergoose) & on('soccerball,'teddybear) & clear('soccerball) & floor('dragondude) & clear('dragondude) =>+ empty & floor('teddybear) & floor('mothergoose) & clear('teddybear) & clear('mothergoose) & X:State . Solution 1 (state 10) states: 11 rewrites: 16 in 0ms cpu (0ms real) (49844 rewrites/second) X:State --> floor('dragondude) & clear('soccerball) & on('soccerball, 'dragondude) Solution 2 (state 15) states: 16 rewrites: 23 in 0ms cpu (0ms real) (40280 rewrites/second) X:State --> floor('dragondude) & floor('soccerball) & clear('dragondude) & clear('soccerball) Solution 3 (state 33) states: 34 rewrites: 54 in 1ms cpu (1ms real) (39560 rewrites/second) X:State --> floor('soccerball) & clear('dragondude) & on('dragondude, 'soccerball) No more solutions. states: 125 rewrites: 272 in 5ms cpu (5ms real) (50670 rewrites/second) Maude> X
  • 11. 川渡しパズル(定義1) Maude> mod RIVER-CROSSING is > sorts Side Group . > ops left right : -> Side [ctor] . > op change : Side -> Side . > eqchange(left) = right . > eqchange(right) = left . > ops swlc : Side -> Group [ctor] . > op __ : Group Group -> Group [ctor assoc comm] . > var S : Side . > rl [shepherd] : s(S) => s(change(S)) . > rl [wolf] : s(S) w(S) => s(change(S)) w(change(S)) . > rl [lamb] : s(S) l(S) => s(change(S)) l(change(S)) . > rl [cabbage] : s(S) c(S) => s(change(S)) c(change(S)) . > endm
  • 12. 川渡しパズル(定義2) Maude> mod RIVER-CROSSING-PROP is > protecting RIVER-CROSSING . > including MODEL-CHECKER . > subsort Group < State . > op initial : -> Group . > eq initial = s(left) w(left) l(left) c(left) . > ops disaster success : -> Prop . > vars S S' S'' : Side . > ceq (w(S) l(S) s(S') c(S'') |= disaster) = true if S =/= S' . > ceq (w(S'') l(S) s(S') c(S) |= disaster) = true if S =/= S' . > eq (s(right) w(right) l(right) c(right) |= success) = true . > endm Maude>
  • 13. 川渡しパズル(実行) % ./maude.intelDarwin -interactive model-checker.maude Maude> red modelCheck(initial, > <> success -> (<> disaster /((success) U disaster))) . reduce in RIVER-CROSSING-PROP : modelCheck(initial, <> success -> <> disaster /(success U disaster)) . rewrites: 76 in 1ms cpu (1ms real) (60995 rewrites/second) result ModelCheckResult: counterexample({s(left) w(left) l(left) c(left),'lamb} {s(right) w(left) l(right) c(left),'shepherd} {s(left) w(left) l(right) c( left),'wolf} {s(right) w(right) l(right) c(left),'lamb} {s(left) w(right) l(left) c(left),'cabbage} {s(right) w(right) l(left) c(right),'shepherd} { s(left) w(right) l(left) c(right),'lamb} {s(right) w(right) l(right) c( right),'lamb} {s(left) w(right) l(left) c(right),'shepherd} {s(right) w( right) l(left) c(right),'wolf} {s(left) w(left) l(left) c(right),'lamb} {s( right) w(left) l(right) c(right),'cabbage} {s(left) w(left) l(right) c( left),'wolf}, {s(right) w(right) l(right) c(left),'lamb} {s(left) w(right) l(left) c(left),'lamb}) Maude>
  • 14. 触り始めたばかりだが Maudeは割と面白い 普通に項書き換え系プログラミングとして遊べる 例えば型無しλ計算とか、当たり前だけど書ける 違和感があるところ Subsorts Nat < NeList < List Nat は要素1個の (Nat)のList である!