Skip to content

Instantly share code, notes, and snippets.

Created September 12, 2012 06:42
Show Gist options
  • Save anonymous/bd1191653b04bc59aa44 to your computer and use it in GitHub Desktop.
Save anonymous/bd1191653b04bc59aa44 to your computer and use it in GitHub Desktop.
Inductive odd : nat -> Prop :=
| odd_1 : odd 1
| odd_S n : even (n ) -> odd (n+1)
with even : nat -> Prop :=
| even_S n : odd n -> even (n+1).
Fixpoint oddmembers (l : natlist) : natlist :=
match l with
| nil => []
| O :: t => oddmembers(t)
| S n :: t => match S n with
| odd => S n :: oddmembers(t)
end
end.
Example test_oddmembers: oddmembers [0,1,0,2,3,0,0] = [1,3].
Proof. intros. simpl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment