Mercurial > hg > Members > kono > Proof > automaton
diff automaton-in-agda/src/fin.agda @ 289:c9802aa2a8c9
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 28 Dec 2021 15:25:22 +0900 |
parents | e4b910112fdf |
children | 24bcce90da91 |
line wrap: on
line diff
--- a/automaton-in-agda/src/fin.agda Tue Dec 28 12:38:16 2021 +0900 +++ b/automaton-in-agda/src/fin.agda Tue Dec 28 15:25:22 2021 +0900 @@ -122,6 +122,13 @@ toℕ (fromℕ< (≤-trans lt (fin≤n y)) ) ≡⟨ toℕ-fromℕ< _ ⟩ toℕ x ∎ ) where open ≡-Reasoning +f<→< : {n : ℕ } → { x y : Fin n} → x Data.Fin.< y → toℕ x < toℕ y +f<→< {_} {zero} {suc y} (s≤s lt) = s≤s z≤n +f<→< {_} {suc x} {suc y} (s≤s lt) = s≤s (f<→< {_} {x} {y} lt) + +f≡→≡ : {n : ℕ } → { x y : Fin n} → x ≡ y → toℕ x ≡ toℕ y +f≡→≡ refl = refl + open import Data.List open import Relation.Binary.Definitions @@ -159,6 +166,11 @@ lseq : list-less qs ≡ ls ls< : (length ls ≡ length qs) ∨ (suc (length ls) ≡ length qs) +fin010 : {n m : ℕ } {x : Fin n} (c : suc (toℕ x) ≤ toℕ (fromℕ< {m} a<sa) ) → toℕ (fromℕ< (≤-trans c (fin≤n (fromℕ< a<sa)))) ≡ toℕ x +fin010 {_} {_} {x} c = begin + toℕ (fromℕ< (≤-trans c (fin≤n (fromℕ< a<sa)))) ≡⟨ toℕ-fromℕ< _ ⟩ + toℕ x ∎ where open ≡-Reasoning + fin-dup-in-list>n : {n : ℕ } → (qs : List (Fin n)) → (len> : length qs > n ) → FDup-in-list n qs fin-dup-in-list>n {zero} [] () fin-dup-in-list>n {zero} (() ∷ qs) lt @@ -173,18 +185,36 @@ → fin-phase2 (fin+1 i) qs ≡ true f1-phase2 (x ∷ qs) p (case1 q1) with <-fcmp (fromℕ< a<sa) x ... | tri< a ¬b ¬c = ⊥-elim ( nat-≤> a (subst (λ k → toℕ x < suc k ) (sym fin<asa) (fin≤n _ ))) - ... | tri≈ ¬a b ¬c = {!!} + f1-phase2 (x ∷ qs) p (case1 q1) | tri≈ ¬a b ¬c with <-fcmp (fin+1 i) x + ... | tri< a ¬b ¬c₁ = f1-phase2 qs p (case2 q1) + ... | tri≈ ¬a₁ b₁ ¬c₁ = refl + ... | tri> ¬a₁ ¬b c = f1-phase2 qs p (case2 q1) f1-phase2 (x ∷ qs) p (case1 q1) | tri> ¬a ¬b c with <-fcmp i (fromℕ< (≤-trans c (fin≤n (fromℕ< a<sa)))) | <-fcmp (fin+1 i) x ... | tri< a ¬b₁ ¬c | tri< a₁ ¬b₂ ¬c₁ = f1-phase2 qs p (case1 q1) - ... | tri< a ¬b₁ ¬c | tri≈ ¬a₁ b ¬c₁ = {!!} - ... | tri< a ¬b₁ ¬c | tri> ¬a₁ ¬b₂ c₁ = {!!} - ... | tri≈ ¬a₁ b ¬c | tri< a ¬b₁ ¬c₁ = {!!} + ... | tri< a ¬b₁ ¬c | tri≈ ¬a₁ b ¬c₁ = ⊥-elim ( ¬a₁ (subst₂ (λ j k → j < k) (sym fin+1-toℕ) (toℕ-fromℕ< _) a )) + ... | tri< a ¬b₁ ¬c | tri> ¬a₁ ¬b₂ c₁ = ⊥-elim ( ¬a₁ (subst₂ (λ j k → j < k) (sym fin+1-toℕ) (toℕ-fromℕ< _) a )) + ... | tri≈ ¬a₁ b ¬c | tri< a ¬b₁ ¬c₁ = ⊥-elim ( ¬a₁ (subst₂ (λ j k → j < k) fin+1-toℕ (sym (toℕ-fromℕ< _)) a )) ... | tri≈ ¬a₁ b ¬c | tri≈ ¬a₂ b₁ ¬c₁ = refl - ... | tri≈ ¬a₁ b ¬c | tri> ¬a₂ ¬b₁ c₁ = {!!} - ... | tri> ¬a₁ ¬b₁ c₁ | tri< a ¬b₂ ¬c = {!!} - ... | tri> ¬a₁ ¬b₁ c₁ | tri≈ ¬a₂ b ¬c = {!!} + ... | tri≈ ¬a₁ b ¬c | tri> ¬a₂ ¬b₁ c₁ = ⊥-elim ( ¬c (subst₂ (λ j k → j > k) fin+1-toℕ (sym (toℕ-fromℕ< _)) c₁ )) + ... | tri> ¬a₁ ¬b₁ c₁ | tri< a ¬b₂ ¬c = ⊥-elim ( ¬c (subst₂ (λ j k → j > k) (sym fin+1-toℕ) (toℕ-fromℕ< _) c₁ )) + ... | tri> ¬a₁ ¬b₁ c₁ | tri≈ ¬a₂ b ¬c = ⊥-elim ( ¬c (subst₂ (λ j k → j > k) (sym fin+1-toℕ) (toℕ-fromℕ< _) c₁ )) ... | tri> ¬a₁ ¬b₁ c₁ | tri> ¬a₂ ¬b₂ c₂ = f1-phase2 qs p (case1 q1) - f1-phase2 (x ∷ qs) p (case2 q2) = {!!} + f1-phase2 (x ∷ qs) p (case2 q1) with <-fcmp (fromℕ< a<sa) x + ... | tri< a ¬b ¬c = ⊥-elim ( nat-≤> a (subst (λ k → toℕ x < suc k ) (sym fin<asa) (fin≤n _ ))) + f1-phase2 (x ∷ qs) p (case2 q1) | tri≈ ¬a b ¬c with <-fcmp (fin+1 i) x + ... | tri< a ¬b ¬c₁ = ⊥-elim ( ¬-bool q1 refl ) + ... | tri≈ ¬a₁ b₁ ¬c₁ = refl + ... | tri> ¬a₁ ¬b c = ⊥-elim ( ¬-bool q1 refl ) + f1-phase2 (x ∷ qs) p (case2 q1) | tri> ¬a ¬b c with <-fcmp i (fromℕ< (≤-trans c (fin≤n (fromℕ< a<sa)))) | <-fcmp (fin+1 i) x + ... | tri< a ¬b₁ ¬c | tri< a₁ ¬b₂ ¬c₁ = f1-phase2 qs p (case2 q1) + ... | tri< a ¬b₁ ¬c | tri≈ ¬a₁ b ¬c₁ = ⊥-elim ( ¬a₁ (subst₂ (λ j k → j < k) (sym fin+1-toℕ) (toℕ-fromℕ< _) a )) + ... | tri< a ¬b₁ ¬c | tri> ¬a₁ ¬b₂ c₁ = ⊥-elim ( ¬a₁ (subst₂ (λ j k → j < k) (sym fin+1-toℕ) (toℕ-fromℕ< _) a )) + ... | tri≈ ¬a₁ b ¬c | tri< a ¬b₁ ¬c₁ = ⊥-elim ( ¬a₁ (subst₂ (λ j k → j < k) fin+1-toℕ (sym (toℕ-fromℕ< _)) a )) + ... | tri≈ ¬a₁ b ¬c | tri≈ ¬a₂ b₁ ¬c₁ = refl + ... | tri≈ ¬a₁ b ¬c | tri> ¬a₂ ¬b₁ c₁ = ⊥-elim ( ¬c (subst₂ (λ j k → j > k) fin+1-toℕ (sym (toℕ-fromℕ< _)) c₁ )) + ... | tri> ¬a₁ ¬b₁ c₁ | tri< a ¬b₂ ¬c = ⊥-elim ( ¬c (subst₂ (λ j k → j > k) (sym fin+1-toℕ) (toℕ-fromℕ< _) c₁ )) + ... | tri> ¬a₁ ¬b₁ c₁ | tri≈ ¬a₂ b ¬c = ⊥-elim ( ¬c (subst₂ (λ j k → j > k) (sym fin+1-toℕ) (toℕ-fromℕ< _) c₁ )) + ... | tri> ¬a₁ ¬b₁ c₁ | tri> ¬a₂ ¬b₂ c₂ = f1-phase2 qs p (case2 q1 ) f1-phase1 : (qs : List (Fin (suc n)) ) → fin-phase1 i (list-less qs) ≡ true → (fin-phase1 (fromℕ< a<sa) qs ≡ false ) ∨ (fin-phase2 (fromℕ< a<sa) qs ≡ false) → fin-phase1 (fin+1 i) qs ≡ true