Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Compute a general recursive function on dependent types.

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Compute a general recursive function on dependent types.


Chronological Thread 
  • From: Shengyi Wang <txyyss AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Compute a general recursive function on dependent types.
  • Date: Sun, 19 Aug 2018 00:34:57 +0800
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=txyyss AT gmail.com; spf=Pass smtp.mailfrom=txyyss AT gmail.com; spf=None smtp.helo=postmaster AT mail-it0-f44.google.com
  • Ironport-phdr: 9a23:lunE7RfhuZ7nz5fnMU0qDhlglGMj4u6mDksu8pMizoh2WeGdxcu6Zx7h7PlgxGXEQZ/co6odzbaO7ea4ASQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTahYL5+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYeRWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZTAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hycdLzM2/2HZhMJzgqxGvhyuuwdyw4vIbIyPLvdyYr/RcNEcSGFcXshRTStBAoakYoUSD+oOI+BYr4b9plsPsBCxBROjBOXgyjRVgXL2waI70uQhEAHdxwwtBN0OsHHOo9X0MKceS/y6zK7NzTjaaf5dxDnz6I/Nch87oPGMW6p9ccvXyUk1FgPKlE+cqYL/Pz6Ty+8DsHCb4vJ+We6zj2MrsQJ8rzi1yssyl4XEiZgZx1/L+Ch/3Y07P8e3SFRhbt6hCJZQtz+VN49xQs46RmFnoic6yrkftZ66YCgG1I0rxxDQZvGIaYSI7RXjVOGeITd8mn1pYq6whxG38US4y+38UNe70EpSoyZbjtXBsmoB2h/T58SdVPdx40is1SyA2g3c8u1EJFo7lavfK54v2L4wkZ8TvFzfHi75mET3jLSWdl4/9+in7uToeLTmppuGO4BojQH+N7wimtajDuQgLggOQ2+b9Pyg273k5E31WalFjvkrkqbCq53aPsQapquhAwBPyIoj6hC/Dy2n0NsCh3UHIkhFK1q7iN3iPEiLK/TlB9++hU6tmXFl3aPoJLrkV67NI37MgbapQr975AYI1Boi3MtEz51RA7AFZvn0Xxmi55TjEhYlPlnskK7cA9Jn29ZGADPdMuqiKKrX9GSwyKcqKuiIapUSvW+kefcg7v/qy3Q+nA1EJPX77d4scHm9W89eDQCBe3O124UOFG4Lukw1S+m40ATfAw4WXG67WucH3h9+CI+iCt2eFIWkgbjE3TvjW5MKOiZJDVeDFXqufIKBCa8B

Dear Coq users,

Recently I defined a map of "sig" type from positive to positive. The map should satisfy a property: it always maps a value v to a value which is not greater than v. Formally the definition is:

Definition pos_map_prop (t: PM.tree positive) : Prop :=
  forall i j, PM.find i t = Some j -> j <= i.

Definition PosMap := {pm : PM.tree positive | pos_map_prop pm}.

Such a map can be viewed as a forest: each key in the map is a node. Each node points to a smaller value or itself.

Then I successfully defined a general recursive function "pm_trace_root" which traces back such a node along the pointers until to a self-pointing "root". The property of the map ensures the termination.

So far everything seems fine until I try to run the function in Coq. I defined a test_map which is essentially {1 -> 1, 2 -> 2}. I tested:

Compute (PM.find 2 (proj1_sig test_map)). 
===> Some 1

Compute (PM.find 1 (proj1_sig test_map)). 
===> Some 1

The function pm_trace_root works for 1:

Compute (pm_trace_root 1 test_map).
===> Some 1

But for 2, "Compute (pm_trace_root 2 test_map)." generates an output of 912 lines.

I doubt it is caused by the similar problem mentioned in Xavier Leroy's blog: http://gallium.inria.fr/blog/coq-eval/ 

But I'm not sure. Even it is for the same reason, I can not figure out which proof term caused this problem. I attached the code. Could anyone tell me how to debug this kind of things?

Thank you very much,

Shengyi Wang

Cell: +65-83509639

Attachment: dep_map.v
Description: Binary data




Archive powered by MHonArc 2.6.18.

Top of Page