Last active
October 14, 2020 05:12
-
-
Save copumpkin/72aa6738b5dba8dc05969e2bc286a137 to your computer and use it in GitHub Desktop.
Revisions
-
copumpkin revised this gist
Oct 14, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ module FinVector-cons (T : Set) where data Nat : Set where zero : Nat suc : Nat → Nat -
copumpkin created this gist
Oct 14, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ data Nat : Set where zero : Nat suc : Nat → Nat data Fin : Nat → Set where zero : ∀ {n} → Fin (suc n) suc : ∀ {n} → Fin n → Fin (suc n) data _≡_ {A : Set} (x : A) : A → Set where refl : x ≡ x postulate funext : {A B : Set} → {f g : A → B} → (∀ x → f x ≡ g x) → f ≡ g B : Nat → Set B n = Fin n → T cons : ∀ {n} (t : T) → B n → B (suc n) cons x xs zero = x cons x xs (suc z) = xs z head : ∀ {n} → B (suc n) → T head xs = xs zero tail : ∀ {n} → B (suc n) → B n tail xs n = xs (suc n) cons-ok : ∀ {n} → (b : B (suc n)) → ∀ n → cons (head b) (tail b) n ≡ b n cons-ok b zero = refl cons-ok b (suc n) = refl cons-ok-ext : ∀ {n} → (b : B (suc n)) → cons (head b) (tail b) ≡ b cons-ok-ext b = funext (cons-ok b)