Mercurial > hg > Members > kono > Proof > automaton
changeset 298:1b5c09f12373
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 31 Dec 2021 17:02:31 +0900 |
parents | afc7db9b917d |
children | 841f4064e515 |
files | automaton-in-agda/src/non-regular.agda |
diffstat | 1 files changed, 30 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/automaton-in-agda/src/non-regular.agda Fri Dec 31 15:42:27 2021 +0900 +++ b/automaton-in-agda/src/non-regular.agda Fri Dec 31 17:02:31 2021 +0900 @@ -105,9 +105,10 @@ open import Relation.Binary.HeterogeneousEquality as HE using (_≅_ ) -record TA { Q : Set } { Σ : Set } (fa : Automaton Q Σ ) (phase : ℕ) ( q qd : Q ) : Set where +record TA { Q : Set } { Σ : Set } (fa : Automaton Q Σ ) (phase : ℕ) ( q qd : Q ) (is : List Σ) : Set where field x y z : List Σ + xyz=is : x ++ y ++ z ≡ is trace-z : phase > 1 → Trace fa z qd trace-yz : phase > 0 → Trace fa (y ++ z) qd trace-xyz : phase ≡ 0 → Trace fa (x ++ y ++ z) q @@ -118,31 +119,46 @@ make-TA : { Q : Set } { Σ : Set } (fa : Automaton Q Σ ) (finq : FiniteSet Q) (q qd : Q) (is : List Σ) → (tr : Trace fa is q ) → dup-in-list finq qd (tr→qs fa is q tr) ≡ true - → TA fa 0 q qd + → TA fa 0 q qd is make-TA {Q} {Σ} fa finq q qd is tr dup = tra-phase1 q is tr dup where open TA - tra-phase2 : (q : Q) → (is : List Σ) → (tr : Trace fa is q ) → phase2 finq qd (tr→qs fa is q tr) ≡ true → TA fa 1 q qd + tra-phase2 : (q : Q) → (is : List Σ) → (tr : Trace fa is q ) → phase2 finq qd (tr→qs fa is q tr) ≡ true → TA fa 1 q qd is tra-phase2 q (i ∷ is) (tnext q tr) p with equal? finq qd q | inspect ( equal? finq qd) q ... | true | record { eq = eq } = {!!} ... | false | record { eq = eq } = {!!} - tra-phase1 : (q : Q) → (is : List Σ) → (tr : Trace fa is q ) → phase1 finq qd (tr→qs fa is q tr) ≡ true → TA fa 0 q qd + tra-phase1 : (q : Q) → (is : List Σ) → (tr : Trace fa is q ) → phase1 finq qd (tr→qs fa is q tr) ≡ true → TA fa 0 q qd is tra-phase1 q (i ∷ is) (tnext q tr) p with equal? finq qd q | inspect (equal? finq qd) q - ... | true | record { eq = eq } = record { x = [] ; y = y TA0 ; z = z TA0 ; trace-z = λ () ; trace-yz = λ _ → trace-yz TA0 a<sa + | phase1 finq qd (tr→qs fa is (δ fa q i) tr) | inspect ( phase1 finq qd) (tr→qs fa is (δ fa q i) tr) + ... | true | record { eq = eq } | false | record { eq = np} = record { x = [] ; y = y TA0 ; z = z TA0 ; xyz=is = {!!} -- cong (i ∷_ ) + ; trace-z = λ () ; trace-yz = λ _ → trace-yz TA0 a<sa ; trace-xyz = λ _ → subst (λ k → Trace fa (y TA0 ++ z TA0) k ) (equal→refl finq eq) (trace-yz TA0 a<sa) - ; trace-xyyz = λ _ → subst (λ k → Trace fa (y TA0 ++ y TA0 ++ z TA0) k ) (equal→refl finq eq) (tra-01 (y TA0) (trace-yz TA0 a<sa)) } where - TA0 : TA fa 1 (δ fa q i ) qd + ; trace-xyyz = λ _ → subst (λ k → Trace fa (y TA0 ++ y TA0 ++ z TA0) k ) (equal→refl finq eq) (tra-02 (y TA0) qd (trace-yz TA0 a<sa) {!!} {!!}) } where +-- : phase2 finq qd (tr→qs fa (y TA0 ++ z TA0) qd (trace-yz TA0 a<sa)) +-- ≡ true +-- : phase1 finq qd (tr→qs fa (y TA0 ++ z TA0) qd (trace-yz TA0 a<sa)) +-- ≡ false + TA0 : TA fa 1 (δ fa q i ) qd is TA0 = tra-phase2 (δ fa q i ) is tr p tra-02 : (y1 : List Σ) → (q : Q) → (tr : Trace fa (y1 ++ z TA0) q) - → phase2 finq qd (tr→qs fa (y1 ++ z TA0) q tr) ≡ true → Trace fa (y1 ++ y TA0 ++ z TA0) q - tra-02 [] q tr p with equal? finq qd q | inspect ( equal? finq qd) q - ... | true | record { eq = eq } = subst (λ k → Trace fa (y TA0 ++ z TA0) k ) (equal→refl finq eq) (trace-yz TA0 a<sa ) - ... | false | record { eq = eq } = {!!} - tra-02 (y1 ∷ ys) q (tnext q tr) p = tnext q (tra-02 ys (δ fa q y1) tr {!!} ) + → phase2 finq qd (tr→qs fa (y1 ++ z TA0) q tr) ≡ true + → phase1 finq qd (tr→qs fa (y1 ++ z TA0) q tr) ≡ false + → Trace fa (y1 ++ y TA0 ++ z TA0) q + tra-02 [] q tr p np with equal? finq qd q | inspect ( equal? finq qd) q + ... | true | record { eq = eq } = subst (λ k → Trace fa (y TA0 ++ z TA0) k ) (equal→refl finq eq) (trace-yz TA0 a<sa ) + ... | false | record { eq = ne } = {!!} + tra-02 (y1 ∷ ys) q (tnext q tr) p np with equal? finq qd q | inspect ( equal? finq qd) q + ... | true | record { eq = eq } = {!!} + ... | false | record { eq = ne } = tnext q (tra-02 ys (δ fa q y1) tr p np ) tra-01 : (y1 : List Σ) → Trace fa (y1 ++ z TA0) qd → Trace fa (y1 ++ y TA0 ++ z TA0) qd tra-01 = {!!} - ... | false | _ = record { x = i ∷ x TA0 ; y = y TA0 ; z = z TA0 ; trace-z = λ () ; trace-yz = λ () + ... | true | record { eq = eq } | true | record { eq = np} = record { x = i ∷ x TA0 ; y = y TA0 ; z = z TA0 ; xyz=is = cong (i ∷_ ) (xyz=is TA0) + ; trace-z = λ () ; trace-yz = λ () ; trace-xyz = λ _ → tnext q (trace-xyz TA0 refl ) ; trace-xyyz = λ _ → tnext q (trace-xyyz TA0 refl )} where - TA0 : TA fa 0 (δ fa q i ) qd + TA0 : TA fa 0 (δ fa q i ) qd is + TA0 = tra-phase1 (δ fa q i ) is tr np + ... | false | _ | _ | _ = record { x = i ∷ x TA0 ; y = y TA0 ; z = z TA0 ; xyz=is = cong (i ∷_ ) (xyz=is TA0) ; trace-z = λ () ; trace-yz = λ () + ; trace-xyz = λ _ → tnext q (trace-xyz TA0 refl ) ; trace-xyyz = λ _ → tnext q (trace-xyyz TA0 refl )} where + TA0 : TA fa 0 (δ fa q i ) qd is TA0 = tra-phase1 (δ fa q i ) is tr p open RegularLanguage