Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] How to talk about a restricted set of an inductive?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] How to talk about a restricted set of an inductive?


Chronological Thread 
  • From: Rui Baptista <rpgcbaptista AT gmail.com>
  • To: Fabien Renaud <Fabien.Renaud AT inria.fr>
  • Cc: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] How to talk about a restricted set of an inductive?
  • Date: Thu, 3 Oct 2013 11:43:54 +0100

If you're willing to change "Base l: NList_ 0 l" to "Base: NList_ 0 nil", you can do it like so:

Goal forall A l n, @NList_ A n l -> length l = n.
Proof. induction 1. reflexivity. subst. reflexivity. Defined.


On Thu, Oct 3, 2013 at 11:01 AM, Fabien Renaud <Fabien.Renaud AT inria.fr> wrote:
Hello,

The subject of my question is not very clear but my problem yes:

For the illustration, suppose I have this (weird) inductive:

Inductive NList_ {A : Type} : nat -> list A -> Type :=
| Base l: NList_ 0 l
| Cons n l a: NList_ n l -> NList_ (S n) (a::l).

Now I want to start building NList_ such that the first argument is always the length of the list:

Definition NList {A : Type} (l : list A) := NList_ (length l) l.


Is there a way to state properties about NList_ created by NList like
forall l n, NList_ n l -> length l = n?

Thanks,
Fabien





Archive powered by MHonArc 2.6.18.

Top of Page