Skip to Content.
Sympa Menu

coq-club - [Coq-Club] order in fixpoint

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] order in fixpoint


Chronological Thread 
  • From: <psperatto AT gmail.com>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: [Coq-Club] order in fixpoint
  • Date: Thu, 28 Mar 2019 19:51:35 -0300
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=psperatto AT gmail.com; spf=Pass smtp.mailfrom=psperatto AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt1-f175.google.com
  • Importance: normal
  • Ironport-phdr: 9a23:tq6l2RQmpOYGBRKPZAQv3BBG89psv+yvbD5Q0YIujvd0So/mwa69YRGN2/xhgRfzUJnB7Loc0qyK6vimCTBLuMjc+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAiqoQnLtcQbjoRuJrswxxbJv3BFZ/lYyWR0KFyJgh3y/N2w/Jlt8yRRv/Iu6ctNWrjkcqo7ULJVEi0oP3g668P3uxbDSxCP5mYHXWUNjhVIGQnF4wrkUZr3ryD3q/By2CiePc3xULA0RTGv5LplRRP0lCsKMSMy/WfKgcJyka1bugqsqR9wzIDKYI+bKfRwcaDHc9wGXmdORNpdWjZbD4+gc4cCDewMNvtYoYnnoFsOqAOzCA60BOP00j9HmGX20rcm0+Q9FgHLxwMgH9cUv3TVqNX5LrsdUeewzKTRyzjIcv1Y2TD46IfScxAhp+mBUqhuccXL0kkvCxnJgUmXqYzgOT6ey+cDs3CD4uZ+Se6ij3QrpgJxrzS128shi5XFipgIxl3G9Sh12Js5KN65RUJhYdOoDoFcuz+VOoZ3WM8uXn9ktDg8x7Ybo5C0ZjIKx44ixxPHa/yIbYyI4hX7WeaUOzh4hXZldKumhxau7ESs0+P8WtS23VtKtCZFnd7MtncC1xzX9MeLUOdy/kCk2TqX1gDT7P9LIVwsmKbFN5IsxqQ8m5kTvEjZAyP7mVn6gLWLekgm+uWk8+Hnba/npp+YOY90kAb+MqE2l8ynGuQ4KhYBX3KB9uSgyL3j+lb0QLpPjvIsk6nZtIrWKtgcpq68GwNVyJos6w6jDze619QVhWUILFVceB6ek4fpP0zOL+vjAPekg1WslS9ryOrcMr3gBJXNNHnDn637cbZz8U4PgDY0mJpU4IsRAbUcKtryXFXwvZrWFFVxZwez2qPsDMh3/oIYQ2OGRKGDZvD8q1iNs7Y3OPGBfoYJpDHVJP0s5vqohng8zwxONZK11IcaPSjrVs9tJF+UNCK104UxVFwStw97d9TEzViLUDpdfXG3Bvtu6TQyCYbgBoDGFNn03O6xmRyjF5gTXVhoT0iWGC6xJYqBUvYILimVJ505y2FWZf2aU4YkkCqWmkr6xr5gdLSG/yQZsdf6yIEw6bSMyFc98jt7C8nb2GaIHTl5

I have defined a set of queues of type A
and other functions as follows:

 

Inductive queue (A:Set):Set :=
| nilq  : queue A
| consq : A-> queue A-> queue A.

 

Fixpoint ins_back (A:Set)(a:A)(s:queue A):
(queue A):=
match s with
| nilq _ => consq _ a (nilq _)
| consq _ x y => consq _ x (ins_back _ a y)
end.

 

Theorem False_elim (A:Set)(f:False):A.
elim f.
Qed.

Fixpoint set_queue (A:Set)(s:queue A): Prop:=
match s with
| nilq _ => False
| consq _ x y => True
end.


Theorem eq_subst (A:Set)(x y :A)(P:A->Prop)
(e:(eq x y))(i:(P y)) : P x.
rewrite -> e.
exact i.
Qed.

 

Theorem not_eq_consq_nilq (A:Set)(x:A)
(y:queue A): not (eq (consq A x y)(nilq A)).
intro.
exact (eq_subst (queue A) (nilq A)
      (consq A x y)(set_queue A)
       (eq_sym H) I).
Qed.

 

I want to define a recursive function that
computes the last element on a non-empty
queue.

To this end I've defined:

 

Fixpoint last (A:Set)(s:queue A):
(not (eq s (nilq A))) -> A:=
match s with
| nilq _ => (fun p =>
(False_elim A (p (eq_refl _))))
| consq _ x (nilq _) => (fun p => x)
| consq _ x (consq _ x2 y) =>
(fun p => last _ (consq _ x2 y)
(not_eq_consq_nilq _ x2 y))
end.

 

I get the message:
Cannot guess decreasing argument of fix.

 

I don't understand how is defined the order
relation in Fixpoint definitions. The
recursive call is in a smaller argument.

 

Someone can help me ???

Regards,
Patricia

 




Avast logo

El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
www.avast.com





Archive powered by MHonArc 2.6.18.

Top of Page