coq-club AT inria.fr
Subject: The Coq mailing list
List archive
[Coq-Club] Help necessary on function of type that is defined by mutual induction
Chronological Thread
- From: Ilmārs Cīrulis <ilmars.cirulis AT gmail.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: [Coq-Club] Help necessary on function of type that is defined by mutual induction
- Date: Thu, 8 Oct 2015 19:52:15 +0300
- 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-f182.google.com
- Ironport-phdr: 9a23:WYQVwR3uLk24wc7rsmDT+DRfVm0co7zxezQtwd8ZsegeK/ad9pjvdHbS+e9qxAeQG96Lt7Qb1qGP6/yocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC04Loiqvro8GbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Loa/sIITqLgc79wDeEATWduD2dgrsbsrFzISRaFznoaSGQf1BRSSUCR5xbjG5z1ryHSt+xn2SDcM9egHp4uXjH3zqNu4wXzwAwGLSM98Xqf3s10iatBu1SqpgZix4/PSI6QPft6OKjaeIVJFiJ6Qs9NWnkZUcuHZIwVAr9cZes=
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?
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.