coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Help necessary on function of type that is defined by mutual induction
Chronological Thread
- From: Matthieu Sozeau <mattam AT mattam.org>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Help necessary on function of type that is defined by mutual induction
- Date: Fri, 09 Oct 2015 08:54:48 +0000
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mattam AT mattam.org; spf=Pass smtp.mailfrom=matthieu.sozeau AT gmail.com; spf=None smtp.helo=postmaster AT mail-wi0-f176.google.com
- Ironport-phdr: 9a23:jh8NeBeFVI3E1PpOIOKOvyRElGMj4u6mDksu8pMizoh2WeGdxc6/Zh7h7PlgxGXEQZ/co6odzbGG7+a9ASQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTrkb3qs7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cY6Lod8JsKWqLjOq88ULZwDTI8Mmlz6teh/U3IShLK7X8BWE0XlABJCk7L9kepcI32t37fv/Zh2CiXIIXNSqI5UCnqu6JiVAPhjQ8CPiIl+WSRjdZ/2vEI6Cm9rgByltaHKLqeM+BzK/vQ
Hi Ilmars,
you have to say "Next Obligation of term_fun" in mutually recursive cases.
The error should not be an anomaly though.
-- Matthieu
On Thu, Oct 8, 2015 at 8:18 PM Ilmārs Cīrulis <ilmars.cirulis AT gmail.com> wrote:
Go to https://sympa.inria.fr/sympa/sigrequest/coq-club, enter your email, then validate your unsubscription by clicking on confirmation link in the e-mail sent to you.Best wishes!On Thu, Oct 8, 2015 at 7:54 PM, Enjoys Math <enjoysmath AT gmail.com> wrote:How do I unregister for this mailing list?On Thu, Oct 8, 2015 at 9:52 AM, Ilmārs Cīrulis <ilmars.cirulis AT gmail.com> wrote:In short - It's language term evaluation, if meanings of Language terms are given (by Structure) and variable assignments are given too (by Assignment).(I'm using Coq 8.5p2 beta)Okay, here it goes (proof script).The last line 'Next Obligation' results in such error message:Require Import Utf8.
Set Implicit Arguments.
Inductive ilist A: nat -> Type :=
| Nil: ilist A 0
| Cons: forall n, A -> ilist A n -> ilist A (S n).
Fixpoint imap A B n (f: A -> B) (L: ilist A n): ilist B n.
Proof.
induction L. exact (Nil _). exact (Cons (f a) IHL).
Defined.
Fixpoint In A n x (L: ilist A n) :=
match L with
| Nil _ => True
| Cons a l => x = a \/ In x l
end.
Fixpoint Fun (A B: Type) n :=
match n with
| O => B
| S m => A → Fun A B m
end.
Definition Fun_application A B n (f: Fun A B n) (L: ilist A n): B.
Proof.
induction L.
exact f.
exact (IHL (f a)).
Defined.
Print Fun_application.
Definition function A n := Fun A A n.
Definition relation A n := Fun A bool n.
Definition function_application A n (f: function A n) (x: ilist A n) :=
Fun_application A f x.
Definition relation_application A n (f: relation A n) (x: ilist A n) :=
Fun_application bool f x.
Structure Language A B := {
function_arity: A → nat;
relation_arity: B → nat
}.
Structure Structure A B (L: Language A B) domain := {
function_interpretation: ∀ x, function domain (function_arity L x);
relation_interpretation: ∀ x, relation domain (relation_arity L x)
}.
Definition Assignment A := nat -> A.
Inductive Term A B (L: Language A B) :=
| variable: nat -> Term L
| function_node: forall x, parameters L (function_arity L x) -> Term L
with parameters A B (L: Language A B): nat -> Type :=
| p0: parameters L O
| pS: forall n, Term L -> parameters L n -> parameters L (S n).
Require Program.
Program Fixpoint interpretation A B domain (L: Language A B) (s: Structure L domain) (x: Assignment domain) (t: Term L) : domain :=
match t with
| variable _ x0 => x x0
| function_node x0 l => term_fun s x (function_interpretation s x0) l
end
with term_fun A B domain (L: Language A B) (s: Structure L domain) (x: Assignment domain) n (F: function domain n) (P: parameters L n): domain :=
match n with
| O => _
| S m => match P with
| p0 _ => _
| pS x0 l0 => term_fun s x (_ (interpretation s x x0)) l0
end
end.
Obligations.
Next Obligation.
exact F. Defined.
Obligations.
Next Obligation.
exact (F x1). Defined.
Obligations.
Next Obligation.
<< Anomaly: Could not find a solvable obligation.. Please report. >>What to do with this?What I want from this function, I will write later (probably it's necessary), because I'm in hurry.P.S. Is there some good tutorial for defining such functions?
- [Coq-Club] Help necessary on function of type that is defined by mutual induction, Ilmārs Cīrulis, 10/08/2015
- Re: [Coq-Club] Help necessary on function of type that is defined by mutual induction, Enjoys Math, 10/08/2015
- Re: [Coq-Club] Help necessary on function of type that is defined by mutual induction, Ilmārs Cīrulis, 10/08/2015
- Re: [Coq-Club] Help necessary on function of type that is defined by mutual induction, Matthieu Sozeau, 10/09/2015
- Re: [Coq-Club] Help necessary on function of type that is defined by mutual induction, Ilmārs Cīrulis, 10/08/2015
- Re: [Coq-Club] Help necessary on function of type that is defined by mutual induction, Enjoys Math, 10/08/2015
Archive powered by MHonArc 2.6.18.