Created
November 21, 2014 00:48
-
-
Save vituscze/6807d6529aed9e9f60e6 to your computer and use it in GitHub Desktop.
This file contains 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 characters
module Del where | |
open import Data.Nat | |
open import Relation.Binary.Core | |
data List : Set where | |
nil : List | |
_::_ : (x : ℕ) -> (xs : List) -> List | |
-- membership within a list | |
data _∈_ (x : ℕ) : List -> Set where | |
here : forall {xs} -> x ∈ (x :: xs) | |
there : forall {xs y} -> (mem : x ∈ xs) -> x ∈ (y :: xs) | |
-- delete | |
_\\_ : forall {x} (xs : List) -> (mem : x ∈ xs) -> List | |
_\\_ nil () | |
_\\_ (_ :: xs) here = xs | |
_\\_ (_ :: nil) (there ()) | |
_\\_ (x :: xs) (there p) = x :: (xs \\ p) | |
data Foo : List -> Set where | |
test : Foo nil | |
test2 : forall {x} (xs : List) -> (mem : x ∈ xs) -> Foo (xs \\ mem) | |
-- Extra proof. | |
foo : ∀ {xs} → xs ≡ nil → Foo xs → ℕ | |
foo p test = 0 | |
foo p (test2 ys mem) with ys \\ mem | |
foo p (test2 _ _) | nil = 1 | |
foo () (test2 _ _) | _ :: _ | |
foo-final : Foo nil → ℕ | |
foo-final = foo refl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment