annotate agda/nfa.agda @ 89:e919e82e95a2

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 10 Nov 2019 12:21:44 +0900
parents f124fceba460
children b3f05cd08d24
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 module nfa where
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 -- open import Level renaming ( suc to succ ; zero to Zero )
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 open import Data.Nat
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import Data.List
27
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
6 open import Data.Fin hiding ( _<_ )
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 open import Data.Maybe
27
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
8 open import Relation.Nullary
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
9 open import Data.Empty
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
10 -- open import Data.Bool using ( Bool ; true ; false ; _∧_ ; _∨_ )
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 open import Relation.Binary.PropositionalEquality hiding ( [_] )
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 open import Relation.Nullary using (¬_; Dec; yes; no)
44
aa15eff1aeb3 seprate finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 38
diff changeset
13 open import finiteSet
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
14 open import logic
36
9558d870e8ae add cfg and derive
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
15
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 data States1 : Set where
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 sr : States1
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 ss : States1
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 st : States1
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 data In2 : Set where
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 i0 : In2
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 i1 : In2
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 record NAutomaton ( Q : Set ) ( Σ : Set )
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 : Set where
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 field
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 Nδ : Q → Σ → Q → Bool
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 Nend : Q → Bool
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 open NAutomaton
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
29
2887577a3d63 simpler exists , nfa accept dones not wokred
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
34 finState1 : FiniteSet States1
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 finState1 = record {
30
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
36 Q←F = Q←F
26
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
37 ; F←Q = F←Q
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
38 ; finiso→ = finiso→
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
39 ; finiso← = finiso←
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 } where
27
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
41 Q←F : Fin 3 → States1
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 Q←F zero = sr
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 Q←F (suc zero) = ss
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 Q←F (suc (suc zero)) = st
26
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
45 F←Q : States1 → Fin 3
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
46 F←Q sr = zero
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
47 F←Q ss = suc zero
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
48 F←Q st = suc (suc zero)
26
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
49 finiso→ : (q : States1) → Q←F (F←Q q) ≡ q
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
50 finiso→ sr = refl
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
51 finiso→ ss = refl
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
52 finiso→ st = refl
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
53 finiso← : (f : Fin 3) → F←Q (Q←F f) ≡ f
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
54 finiso← zero = refl
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
55 finiso← (suc zero) = refl
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
56 finiso← (suc (suc zero)) = refl
27
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
57 finiso← (suc (suc (suc ())))
26
7ce76b3acc62 improve finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
58
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 open FiniteSet
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 Nmoves : { Q : Set } { Σ : Set }
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 → NAutomaton Q Σ
29
2887577a3d63 simpler exists , nfa accept dones not wokred
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
64 → {n : ℕ } → FiniteSet Q {n}
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
65 → ( Qs : Q → Bool ) → (s : Σ ) → Q → Bool
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 Nmoves {Q} { Σ} M fin Qs s q =
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
67 exists fin ( λ qn → (Qs qn /\ ( Nδ M qn s q ) ))
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 Naccept : { Q : Set } { Σ : Set }
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 → NAutomaton Q Σ
29
2887577a3d63 simpler exists , nfa accept dones not wokred
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
72 → {n : ℕ } → FiniteSet Q {n}
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
73 → (Nstart : Q → Bool) → List Σ → Bool
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
74 Naccept M fin sb [] = exists fin ( λ q → sb q /\ Nend M q )
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
75 Naccept M fin sb (i ∷ t ) = Naccept M fin ( Nmoves M fin sb i ) t
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 transition3 : States1 → In2 → States1 → Bool
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 transition3 sr i0 sr = true
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 transition3 sr i1 ss = true
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 transition3 sr i1 sr = true
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 transition3 ss i0 sr = true
31
9b00dc130ede nfa using subset mapping done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
83 transition3 ss i1 st = true
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 transition3 st i0 sr = true
31
9b00dc130ede nfa using subset mapping done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
85 transition3 st i1 st = true
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 transition3 _ _ _ = false
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 fin1 : States1 → Bool
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 fin1 st = true
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 fin1 ss = false
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 fin1 sr = false
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 start1 : States1 → Bool
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 start1 sr = true
29
2887577a3d63 simpler exists , nfa accept dones not wokred
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 28
diff changeset
95 start1 _ = false
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 am2 : NAutomaton States1 In2
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
98 am2 = record { Nδ = transition3 ; Nend = fin1}
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
99
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
100 example2-1 = Naccept am2 finState1 start1 ( i0 ∷ i1 ∷ i0 ∷ [] )
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
101 example2-2 = Naccept am2 finState1 start1 ( i1 ∷ i1 ∷ i1 ∷ [] )
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102
69
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
103 transition4 : States1 → In2 → States1 → Bool
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
104 transition4 sr i0 sr = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
105 transition4 sr i1 ss = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
106 transition4 sr i1 sr = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
107 transition4 ss i0 ss = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
108 transition4 ss i1 st = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
109 transition4 st i0 st = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
110 transition4 st i1 st = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
111 transition4 _ _ _ = false
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
112
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
113 fin4 : States1 → Bool
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
114 fin4 st = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
115 fin4 _ = false
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
116
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
117 start4 : States1 → Bool
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
118 start4 ss = true
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
119 start4 _ = false
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
120
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
121 am4 : NAutomaton States1 In2
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
122 am4 = record { Nδ = transition4 ; Nend = fin4}
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
123
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
124 example4-1 = Naccept am4 finState1 start4 ( i0 ∷ i1 ∷ i1 ∷ i0 ∷ [] )
f124fceba460 subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
125 example4-2 = Naccept am4 finState1 start4 ( i0 ∷ i1 ∷ i1 ∷ i1 ∷ [] )
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126
30
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
127 fin0 : States1 → Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
128 fin0 st = false
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
129 fin0 ss = false
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
130 fin0 sr = false
25
256b7a6de863 how to use Data.Fin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131
31
9b00dc130ede nfa using subset mapping done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
132 test0 : Bool
9b00dc130ede nfa using subset mapping done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
133 test0 = exists finState1 fin0
9b00dc130ede nfa using subset mapping done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
134
30
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
135 test1 : Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
136 test1 = exists finState1 fin1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 29
diff changeset
137
31
9b00dc130ede nfa using subset mapping done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
138 test2 = Nmoves am2 finState1 start1
9b00dc130ede nfa using subset mapping done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
139
36
9558d870e8ae add cfg and derive
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
140 -- test4 : Fin 2 → Bool
9558d870e8ae add cfg and derive
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
141 -- test4 zero = {!!}
9558d870e8ae add cfg and derive
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
142 -- test4 (suc zero) = {!!}
9558d870e8ae add cfg and derive
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
143 -- test4 (suc (suc ()))
38
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
144
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
145 -- 0011
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
146 -- 00000111111
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
147 inputnn : { n : ℕ } → { Σ : Set } → ( x y : Σ ) → List Σ → List Σ
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
148 inputnn {zero} {_} _ _ s = s
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
149 inputnn {suc n} x y s = x ∷ ( inputnn {n} x y ( y ∷ s ) )
44
aa15eff1aeb3 seprate finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 38
diff changeset
150
38
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
151 -- lemmaNN : { Q : Set } { Σ : Set } → ( x y : Σ ) → (M : NAutomaton Q Σ)
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
152 -- → ( n : ℕ ) → (fin : FiniteSet Q {n} )
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
153 -- → Naccept M fin ( inputnn {n} x y [] ) ≡ true
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
154 -- → Naccept M fin ( inputnn {suc n} x y [] ) ≡ false
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
155 -- lemmaNN {Q} {Σ} x y M n fin nac = {!!}
ab265470c2d0 push down automaton example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
156