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
Finite Automaton equivalents to Regular Expression
Search
N@N
December 13, 2015
Technology
0
110
Finite Automaton equivalents to Regular Expression
数物セミナー冬の大談話会2015 in 岡山での発表資料
N@N
December 13, 2015
Tweet
Share
More Decks by N@N
See All by N@N
introduction to modern numerical analysis
spark6251
0
140
Programmer and English
spark6251
0
110
Let's go to the study session
spark6251
0
95
Quantum Computation
spark6251
0
260
Introduction to use Grunt
spark6251
0
80
Introduction to Regular Expression
spark6251
0
330
Introduction to SCSS+COMPASS
spark6251
0
270
Introduction to Psychology
spark6251
1
250
Introduction to HTML5
spark6251
0
260
Other Decks in Technology
See All in Technology
明日からできる!技術的負債の返済を加速するための実践ガイド~『ホットペッパービューティー』の事例をもとに~
recruitengineers
PRO
3
100
株式会社EventHub・エンジニア採用資料
eventhub
0
4.2k
現場で役立つAPIデザイン
nagix
29
10k
AWSでRAGを実現する上で感じた3つの大事なこと
ymae
3
1k
Postmanを使いこなす!2025年ぜひとも押さえておきたいPostmanの10の機能
nagix
2
120
Moved to https://speakerdeck.com/toshihue/presales-engineer-career-bridging-tech-biz-ja
toshihue
2
550
バックエンドエンジニアのためのフロントエンド入門 #devsumiC
panda_program
16
6.5k
SCSAから学ぶセキュリティ管理
masakamayama
0
140
トラシューアニマルになろう ~開発者だからこそできる、安定したサービス作りの秘訣~
jacopen
2
1.5k
Platform Engineeringは自由のめまい
nwiizo
4
1.9k
マルチモーダル理解と生成の統合 DeepSeek Janus, etc... / Multimodal Understanding and Generation Integration
hiroga
0
360
モノレポ開発のエラー、誰が見る?Datadog で実現する適切なトリアージとエスカレーション
biwashi
6
770
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
Designing for Performance
lara
604
68k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
A designer walks into a library…
pauljervisheath
205
24k
How GitHub (no longer) Works
holman
313
140k
Building Your Own Lightsaber
phodgson
104
6.2k
Six Lessons from altMBA
skipperchong
27
3.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
How to Ace a Technical Interview
jacobian
276
23k
Facilitating Awesome Meetings
lara
51
6.2k
Transcript
None
• • •
• • • • • • •
• : → • ∈ , ⊂ , ∀ ,
∃ •
• •
• • •
• • • •
None
•
$ perl -i -pe 's/foo/bar/g' input foo oaaahhhhhhhh! -> bar
oaaahhhhhhhh! $ perl -i'*.bak' -pe 's/foo/bar/g' input
• HT 0x09 ¥t LF 0x0a ¥n CR 0x0d ¥r
LF ¥n CR ¥r CR+LF ¥r¥n
$ perl -i -pe 's/^¥t*//g' input
<A>B</C> -> B $ perl -i -pe 's/<(.*)>(.*)</(.*)>/$2/g' input <saflijlsa>BBBBBBBIAA</fjsaljfoa>
-> BBBBBBBIAA ¥1
• http://www.rexv.org/ • https://jex.im/regulex/
• • https://speakerdeck.com/spark6251/
• • • •
• 0 ∈ ℕ
None
•
None
None
1 1 2
• 1 1 1 1 1 2 2 2 1
2
• ≠ Σ • • Σ • • • Σ
Σ5 ∋ = = 5 • = 0 • Σ = , , , , , , , , ⋯
def = , Σ, , 0 , Σ : ×
Σ → 0 ∈ ⊂
1 = {1 , 2 } Σ = 0,1 :
× Σ → 1 ∈ 2 ⊂ 0 1 1 2 1 2 2 2 1 2
def =
1 = 0 1 (.*)0(.*) 1 2
1 2 1 2 2
Σ = < RESET >, 0,1, ⋯ , • •
< RESET >
• = , Σ, , 0 , • Σ ∋
= 1 2 ⋯ ∀ ∈ Σ def ∃ ∈ s. t. 0 = 0 , +1 = +1 ∈
def ∃: NFA s. t. recognize
• , • ∪ ≔ ∈ or ∈ • ∘
≔ ∈ and ∈ • ∗ ≔ 1 2 ⋯ ∈ ℕ, ∈ •
• Σ ≔ , , ⋯ , • ≔ good,
bad • ≔ start, end • ∪ = good, bad, start, end • ∘ = goodstart, goodend, badstart, badend • ∗ = , good, bad, goodgood, goodbad, badbad, ⋯
1 , 2 : Reg. Lang. ⇒ 1 ∪ 2
: Reg. Lang. 1 , 2 : Reg. Lang. ⇒ 1 ∘ 2 : Reg. Lang. : Reg. Lang. ⇒ ∗: Reg. Lang.
• 1 , 2 1 , 2 • 1 ∪
2 • 1 , 2 • 1 or 2 • • 1 2 •
• 1 = 1 , Σ, 1 , 1 ,
1 1 • 2 = 2 , Σ, 2 , 2 , 2 2 1. ≔ 1 , 2 1 ∈ 1 and 2 ∈ 2 2. ∀ 1 , 2 ∈ : ∀ ∈ Σ: 1 , 2 , = 1 1 , , 2 2 , 3. 0 ≔ 1 , 2 4. ≔ 1 , 2 1 ∈ 1 or 2 ∈ 2 = 1 × 2 ∪ 2 × 1 = , Σ, , 0 ,
1 1 2 1 2 1 2
• = , Σ, , 0 , = 1 ,
2 , 1 , 1 , 1 , 2 , 1 , 2 , 1 , 1 , 1 , 2 : 1 × 2 × Σ → 1 × 2 0 = 1 , 2 = 1 , 2 , 1 , 1 , 1 , 2 , 1 , 1 1 1 2 1 2 1 2
• • •
• • • • •
• 2 1 3 4
2 1 1 1 2 1 3 3 3 4
2 1 3 4
def = , Σ, , 0 , Σ : ×
Σ → Σ ≔ Σ ∪ 0 ∈ ⊂
= {1 , 2 , 3 , 4 } Σ
= 0,1 : × Σ → 1 ∈ 2 ⊂ 0 1 ε 1 1 1 , 2 ∅ 2 3 ∅ 3 3 4 ∅ ∅ 4 ∅ ∅ ∅ 2 1 3 4
• = , Σ, , 0 , • Σ ∋
= 1 2 ⋯ ∀ ∈ Σ def ∃ ∈ s. t. 0 = 0 ∀ ∈ ℕ, ≤ − 1: +1 ∈ , +1 ∈
iff ∀1 : NFA: ∃2 : DFA s. t. 1
≡ 2 ∀1 , 2 : FA 1 ≡ 2 def 1 2
• = , Σ, , 0 , • ′ =
′, Σ, ′, 0 ′ , ′ • ′ • • • • card = ⇒ card = 2
• = , Σ, , 0 , • ′ =
′, Σ, ′, 0 ′ , ′ 1. ′ ≔ 2. ∀ ∈ ′: ∀ ∈ Σ: ′ , = ∈ ∈ , , ∈ = , ∈ 3. 0 ′ ≔ 0 4. ′ ≔ ∈ ′ ⊂
• ⊂ ′ ∈ ′ ∗ → • ⊂ ≔
∗ → ′ , = , = ∈ ∈ , , ∈ 0 ′ = 0 ///
∃: DFA s. t. recognize
• • • ′ = ′ ′ 2 1 3
• = , Σ, , 0 , • ′ =
′, Σ, ′, 0 ′ , ′ • 0 ′ = 0 = 1 , 2 • ′ = 3 , 1 , 3 , 2 , 3 , 1 , 2 , 3 2 1 3
0 1 ε 1 1 1 , 2 ∅ 2
3 ∅ 3 3 ∅ ∅ ∅ ′ 0 1 1 1 , 2 , 3 1 , 2 2 3 ∅ 3 ∅ ∅ 2 1 3
′ 0 1 1 1 , 2 , 3 1
, 2 2 3 ∅ 3 ∅ ∅ ′ 0 1 1 1 , 2 , 3 1 , 2 2 3 ∅ 3 ∅ ∅ 1 , 2 1 , 2 , 3 1 , 2 1 , 2 , 3 1 , 2 , 3 1 , 2 2 1 3
1 , 2 , 3 1 , 2 3 2
1
1 , 2 , 3 1 , 2
′ = 1 , 2 , 1 , 2 ,
3 0 ′ = 1 , 2 ′ = 1 , 2 , 3 1 , 2 , 3 1 , 2 ′ 0 1 1 , 2 1 , 2 , 3 1 , 2 1 , 2 , 3 1 , 2 , 3 1 , 2
1 , 2 : Reg. Lang. ⇒ 1 ∪ 2
: Reg. Lang. 1 , 2 : Reg. Lang. ⇒ 1 ∘ 2 : Reg. Lang. : Reg. Lang. ⇒ ∗: Reg. Lang.
1. ≔ 0 ∪ 1 ∪ 2 2. ∀ ∈
: ∀ ∈ Σ : , = 1 , ∈ 1 2 , ∈ 2 1 , 2 = 0 and = ∅ = 0 and ≠ 3. ≔ 1 ∪ 2 • = 0 and = • 1 ∘ 2 , ∗
• • •
• Σ = 0,1 • 0 ∪ 1 ∗ •
0 ∪ 1 ∗0 0 ∪ 1 ∗ ∘ 0 • 0Σ∗ ∪ 1Σ∗ ΣΣ∗
• ∗, 1 ∘ 2 , 1 ∪ 2 •
1 ∗ ∪ 2 ∘ 3 ∪ 4 ∗ 1 ∗ ∪ 2 ∘ 3 ∪ 4 ∗
def 1. ∈ Σ 2. 3. ∅ 4. 1 ∪
2 5. 1 ∘ 2 6. 1 ∗ 1 , 2
• + ≔ ∗ • + = ∪ • ≔
⋯ ∈ ℕ • 1∗∅ ≔ ∅ • ∅∗ ≔ • ∗
+∪−∪ + ∪ +. ∗ ∪ ∗. + +72, −5.2,
2. , −.6
•
• NFA DFA def ∃: NFA s. t. recognize
⇐ ⇒ ⇒
⇐ 1. ∈ Σ = = = 1 , 2
, Σ, , 1 , 2 2. = = = 1 , Σ, , 1 , 1 a 1 2 1
⇐ 3. = ∅ = ∅ = 1 , Σ,
, 1 , ∅ 4. = 1 ∪ 2 5. = 1 ∘ 2 6. = 1 ∗ 1
⇒
• • • • •
• = , Σ, , 0 , • ′ =
′, Σ, ′, , • → ′ 1. 0 → 2. ∈ : → ∅
+ 2 + 1 2
1 2 2 3 3 1 1 3 1 2
∗3
def = , Σ, , , Σ : − ×
− → ℛ ℛ ∈ ∈ 1 , 2 = 1 2
• = , Σ, , , • Σ ∋ =
1 2 ⋯ ∀ ∈ Σ∗ def ∃ ∈ s. t. 0 = = ∀ ∈ ℕ: = −1 , ⇒ ∈
⇒ • CONVERT
⇒ CONVERT 5. 6. = 2 →
⇒ CONVERT 7. > 2 , ≠ rip ∈ ′
= ′, Σ, ′, , ′ = − rip ∀ ∈ ′ − , ∀ ∈ ′ − : ′ , = 1 2 ∗ 3 ∪ 4 1 = , rip , 2 = rip , rip , 3 = rip , , 4 = , 8. CONVERT ′ = 2
⇒ CONVERT CONVERT CONVERT CONVERT G′ CONVERT ′ CONVERT ′′
CONVERT −2
⇒ ∀: GNFA: CONVERT ≡ ′ = CONVERT ∀1 ,
2 : FA 1 ≡ 2 def 1 2
⇒ ⇒ = 2 • •
⇒ ⇒ − 1 ′ , 1 , 2 ,
⋯ , ≠ rip ∀ ′
⇒ ⇒ rip → rip → ′
⇒ ⇐ ′ rip ′
⇒ ′ − 1 ′ ≡ ≡
2 1 3
1 ∪ 0 ∪ 1 2 1 3 0
1 ∪ 0 ∪ 1 2 1 0
1 ∪ 0 0 ∪ 1 1
0 ∪ 1 ∗ 1 ∪ 0 [01]*1?0
• 0∗1∗ • 01 • • •
•
• •