Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Question about mutual inductive definition with fixpoint

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Question about mutual inductive definition with fixpoint


Chronological Thread 
  • From: Ilmārs Cīrulis <ilmars.cirulis AT gmail.com>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Question about mutual inductive definition with fixpoint
  • Date: Mon, 15 Feb 2016 23:39:02 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=ilmars.cirulis AT gmail.com; spf=Pass smtp.mailfrom=ilmars.cirulis AT gmail.com; spf=None smtp.helo=postmaster AT mail-yk0-f172.google.com
  • Ironport-phdr: 9a23:gxcpsBNO/rd+ecw92XIl6mtUPXoX/o7sNwtQ0KIMzox0KPr9rarrMEGX3/hxlliBBdydsKIbzbaP+Pm9ASQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTokbzrsMSOO01hv3mUX/BbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv50IbaKvNa8/VPlTCCksG2Ez/szi8xfZB0Pb7XwFF24SjxBgAg7f7Ri8UI2n4QXgse8o+S2fltftBZs1Qymm7rwjHB7sjS4dLHgy8XvKjs1rpK1eqROl4Rd4xtiHM8muKPNic/aFLpshTm1bU5MJWg==

There is much smaller toy example. I have to apologise about not minimizing it previously.
 
 
Let's take a list, that should contain only zeroes.

Inductive list := nil | cons: nat -> list -> list.
Fixpoint no_zeroes (L: list) := match L with nil => True | cons n t => n <> O /\ no_zeroes t end.
 
How to merge both into mutually inductive definitions? Is it possible?
 
Something like
 
Inductive xlist :=
| nil
| cons: nat -> ∀ (L: xlist), no_zeroes L -> xlist
with
no_zeroes := ...




On Mon, Feb 15, 2016 at 7:09 PM, Ilmārs Cīrulis <ilmars.cirulis AT gmail.com> wrote:
Here it is:

Inductive list A: nat → Type :=
 | nil: list A 0
 | cons: ∀ n, A → list A n → list A (S n).

Definition Language (A B: Type) := A → nat.

Inductive Term A B (W: Language A B) :=
 | variable: nat → Term W
 | function_node: ∀ x, list (Term W) (W x) → Term W
 | binder_node: ∀ (b: B) (v: nat), Term W → Term W.

 
Here I want to add the following condition in this inductive definition (for binder_node case).
 
Fixpoint variable_is_free A B (W: Language A B) (T: Term W) (x: nat) :=
 match T with
 | variable _ v => True
 | function_node _ L => Forall L (λ t, variable_is_free t x)
 | binder_node _ v t => v <> x ∧ variable_is_free t x
 end.


It should be something similar to this:
 
Inductive Term A B (W: Language A B) :=
 | variable: nat → Term W
 | function_node: ∀ x, list (Term W) (W x) → Term W
 | binder_node: ∀ (b: B) (v: nat) (T: Term W), variable_is_free T v → Term W
with variable_is_free A B (W: Language A B) := ...
 

How can I do such thing? 





Archive powered by MHonArc 2.6.18.

Top of Page