Skip to content

Instantly share code, notes, and snippets.

@nkaretnikov
Created May 21, 2015 01:41
Show Gist options
  • Save nkaretnikov/6659b009954259333344 to your computer and use it in GitHub Desktop.
Save nkaretnikov/6659b009954259333344 to your computer and use it in GitHub Desktop.
natlist
Inductive natlist : Type :=
| nnil : natlist
| ncons : nat -> natlist -> natlist.
Check natlist_ind.
(* ===> (modulo a little variable renaming for clarity)
natlist_ind :
forall P : natlist -> Prop,
P nnil ->
(forall (n : nat) (l : natlist), P l -> P (ncons n l)) ->
forall n : natlist, P n *)
Inductive natlist1 : Type :=
| nnil1 : natlist1
| nsnoc1 : natlist1 -> nat -> natlist1.
(** Now what will the induction principle look like? *)
(* Expected: forall P : natlist1 -> Prop,
P nnill1 ->
(forall (l : natlist1) (n : nat), P l -> P (nsnoc1 l n)) ->
forall n : natlist1, P n
*)
Check natlist1_ind.
(* natlist1_ind *)
(* : forall P : natlist1 -> Prop, *)
(* P nnil1 -> *)
(* (forall n : natlist1, P n -> forall n0 : nat, P (nsnoc1 n n0)) -> *)
(* forall n : natlist1, P n *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment