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
92
Quantum Computation
spark6251
0
260
Introduction to use Grunt
spark6251
0
79
Introduction to Regular Expression
spark6251
0
330
Introduction to SCSS+COMPASS
spark6251
0
260
Introduction to Psychology
spark6251
1
240
Introduction to HTML5
spark6251
0
260
Other Decks in Technology
See All in Technology
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
2
500
AGIについてChatGPTに聞いてみた
blueb
0
130
LINEヤフーにおけるPrerender技術の導入とその効果
narirou
1
160
あなたの知らない Function.prototype.toString() の世界
mizdra
PRO
2
390
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
150
CDCL による厳密解法を採用した MILP ソルバー
imai448
3
180
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
330
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
1k
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
610
心が動くエンジニアリング ── 私が夢中になる理由
16bitidol
0
100
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Site-Speed That Sticks
csswizardry
0
33
Producing Creativity
orderedlist
PRO
341
39k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
Documentation Writing (for coders)
carmenintech
65
4.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
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 • • •
•
• •