# HG changeset patch # User Shinji KONO # Date 1541409213 -32400 # Node ID a9471b42573e1d5675ed1b4815a38b4d77f798da # Parent 2887577a3d6332f1ab126a4c4d2620c69083e93a ... diff -r 2887577a3d63 -r a9471b42573e agda/nfa.agda --- a/agda/nfa.agda Mon Nov 05 16:41:25 2018 +0900 +++ b/agda/nfa.agda Mon Nov 05 18:13:33 2018 +0900 @@ -7,7 +7,7 @@ open import Data.Maybe open import Relation.Nullary open import Data.Empty -open import Data.Bool using ( Bool ; true ; false ; _∧_ ) +open import Data.Bool using ( Bool ; true ; false ; _∧_ ; _∨_ ) open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import Relation.Nullary using (¬_; Dec; yes; no) @@ -38,16 +38,22 @@ record FiniteSet ( Q : Set ) { n : ℕ } : Set where field - fin : Fin n Q←F : Fin n → Q F←Q : Q → Fin n finiso→ : (q : Q) → Q←F ( F←Q q ) ≡ q finiso← : (f : Fin n ) → F←Q ( Q←F f ) ≡ f + lt0 : (n : ℕ) → n Data.Nat.≤ n + lt0 zero = z≤n + lt0 (suc n) = s≤s (lt0 n) + lt2 : {m n : ℕ} → m < n → m Data.Nat.≤ n + lt2 {zero} lt = z≤n + lt2 {suc m} {zero} () + lt2 {suc m} {suc n} (s≤s lt) = s≤s (lt2 lt) exists : ( Q → Bool ) → Bool - exists p = exists1 fin fin p where - exists1 : {m : ℕ} → Fin m → Fin n → ( Q → Bool ) → Bool - exists1 ( zero ) _ _ = false - exists1 ( suc f ) fn p = p (Q←F (Data.Fin.pred fn) ) ∧ exists1 f (Data.Fin.pred fn) p + exists p = exists1 n (lt0 n) p where + exists1 : (m : ℕ ) → m Data.Nat.≤ n → ( Q → Bool ) → Bool + exists1 zero _ _ = false + exists1 ( suc m ) m