Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Need help for manual induction scheme definition

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Need help for manual induction scheme definition


Chronological Thread 
  • From: Vincent Siles <vincent.siles AT ens-lyon.org>
  • To: Coq-Club Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Need help for manual induction scheme definition
  • Date: Tue, 24 Sep 2019 17:44:55 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=vincent.siles AT ens-lyon.org; spf=None smtp.mailfrom=SRS0=tghc=XT=ens-lyon.org=vincent.siles AT bounce.ens-lyon.org; spf=Pass smtp.helo=postmaster AT sonata.ens-lyon.org
  • Ironport-phdr: 9a23:7yUYwBF9CSyCozLk9Lfoo51GYnF86YWxBRYc798ds5kLTJ7zr86wAkXT6L1XgUPTWs2DsrQY0rGQ6PirCTNIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfL1/IA+4oAnNucUbgolvIbstxxXUpXdFZ/5Yzn5yK1KJmBb86Maw/Jp9/ClVpvks6c1OX7jkcqohVbBXAygoPG4z5M3wqBnMVhCP6WcGUmUXiRVHHQ7I5wznU5jrsyv6su192DSGPcDzULs5Vyiu47ttRRT1kyoMKSI3/3/LhcxxlKJboQyupxpjw47PfYqZMONycr7Bcd8GQGZMWNtaWS5cDYOmd4YAAOQBMuRYoYfzpFUAsAWwChW3Cez11jNFnGX70bEm3+kjFwzNwQwuH8gJsHTRtNj6O6YSUeapw6bWyzXDc+5d1yr86IjMbB8huuyHULVuccrQz0kgCx3KjlOMqYD/JDOV1+ANvHaA7+d7S+2vjXUnpxh1ojmvwccsjJPFhoUPylDL7Ch0xps+K96gSENjfNKpH4dcuzuYOoZ0WM8uXmBltScgxrEbt5O2fzAGxIo7yxPbcfCKcIiF7gj+WOuQIDp0nn1odba5ih2v60av0Pf8WdOx0FtSripKjN3MtncV2hzI7ciHTOFy/lu71jqVyQ/T7PpELVkwlavbLJ4hxKQ8lp0JsUTMBiP2mUP2g7GKdkg85+Sl5Pjrbq/kq5KeLYN4lwDzP6U0lsCiD+k1MRACX22B9uS90L3j81f5QLJPjvAuj6fXrI3UKdgDq66lDA9V0pos5g6+ADm4yNkXg38HLElcdBKDj4npPFfOLOr/DfeljFShiClrx/HAPrL9HJrNKGTDnK36fbZ8705T1hEzwMtE6JJTF7EBJu78VVHruNPGCB85KBW4w+LnCdV60IMSQ2WPArWWMK/Kq1+H+vovI/WQZI8SoDvyN/8l5+f3gXAlnV8dYLKm0IAMaHG4G/RmO1+WbWDtgtcHC2cKvxAxQPbkiF2YAnZvYCOZWLt5zTUmAsqNCZrJDtSmh6XE1yOmFLVXYHpHAxaCCyG7WZ+DXqIyaSSZL8l92gcFUbW6A9s/1BeluQnmjaFmKufP0iAertfnxd9zoerJmkdhpnRPE82B3jTVHClPlWQSSmpzhfgn+BEv+hK4yaF9xsdgO5lT6vdOCF5oLpnaxvBzTd30QUfFb9CPDlG8TYf/WG1jfpcK29YLJn1FNZC6lBmag3inBaRQk62MAtoz6K2OhyGgdfY48G7P0ewat3djR8JOMWO8gaslrlrZAJPPmEjfmqCxMKAN2yiL832MnzKD

Oh, for the record I'm using Coq 8.9.1 installed from opam.

Le mar. 24 sept. 2019 à 17:41, Vincent Siles <vincent.siles AT ens-lyon.org> a écrit :
Hi !
I'm facing an somehow complex inductive type, for which I have to write the induction scheme by hand. Here is a stripped down example of what I'm doing:

Require Import List.

Inductive t : Set :=
| Base : t
| Rec : list (option t) -> t -> t
.

Section All.
    Variables (T: Set) (P: T -> Prop).

    Fixpoint All (l : list T) : Prop :=
        match l with
        | nil => True
        | hd :: tl => P hd /\ All tl
        end.
End All.

Section Induc.
    Parameter P: t -> Prop.
    Parameter HBase : P Base.
    Parameter HRec: forall l x,
        All
          (option t)
          (fun x => match x with Some e => P e | None => True end)
          l ->
        P x ->
        P (Rec l x).

    Fixpoint induc (e : t) { struct e } : P e :=
        match e with
        | Base => HBase
        | Rec l x => HRec l x
                ((fix induc_rec l := match l with
                   | nil => I
                   | hd :: tl =>
                           conj (match hd with
                                 | Some e => induc e  (* error here *)
                                 | None => I
                                 end) (induc_rec tl)
                end) l) (induc x)
        end.
End Induc.

Coq complains that:
In environment
induc : forall e : t, P e
e : t
l : list (option t)
x : t
induc_rec : list (option t) -> True
l0 : list (option t)
hd : option t
tl : list (option t)
e0 : t
The term "induc e0" has type "P e0" while it is expected to have type
 "?P@{l0:=l; l:=l0; h0:=Some e0}" (cannot instantiate
"?P" because "e" is not in its scope: available arguments are
"induc" "e" "l" "x" "induc_rec" "l" "hd" "tl" "Some e").

I'm still investigating, but I think I need some external help on that one :D

Best regards,
V.



Archive powered by MHonArc 2.6.18.

Top of Page