coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Junyoung Clare Jang <jjc9310 AT gmail.com>
- To: dominique.larchey-wendling AT loria.fr
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Is there a measure for these functions?
- Date: Mon, 3 Aug 2020 17:48:36 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jjc9310 AT gmail.com; spf=Pass smtp.mailfrom=jjc9310 AT gmail.com; spf=None smtp.helo=postmaster AT mail-yb1-f175.google.com
- Ironport-phdr: 9a23:utJW0R2VoDZeocfosmDT+DRfVm0co7zxezQtwd8ZseIUKvad9pjvdHbS+e9qxAeQG9mCtbQb1qGO6ejJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVhTexe7F/IRW5oQnNqMUdnJdvJLs2xhbVuHVDZv5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnMURGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LptRRT1iikIKiQ5/XnYhcx+jq1VoByvqR9izYDKfI6YL+Bxcr/HcN4AWWZNQsRcWipcCY28dYsPCO8BMP5coYngoVsPrRy+BRSqBOPg1zRFmHv20rcg0+s/DArI2BYvH9QBsH/Jq9j1NqUSXvyxwaTG0DnPc+hb2Tj46IfScxAhpeuAUq53ccrU0EQiER7OgVqMp4L/JTyVyvgNvHaB7+pmTe+ii2wqph1xrzSz2MshjpXEi4YLxlzZ6Sl0wps5K9OkREJnYtOpEpVdujyVOYV2Qs4vXW9mtiYnxrMIuJO2cjUGxZI6zBDcc/yKa5aE7g7nWeqLIjp1hGhpdKyiixu260Ss1+/xW8my3V1XtCRKiMPMuWoI1xHL6siIVP99/kC51DaKzQ/T6+VELVk0lKXANpIt27AwmocRvEnDBCP2l0L2jKiZdkUg5Oek8fjoYrLjppOENo90jB/xMrg2l8ChHeg1NhICUmub9OimyrHv4En0TK9XgvA0kqTVqJXaKt4apq69DQ9VyIEj6xOnAjek0tQXgX0KIVxYdB6blIXpNFTOL+r5Dfe7mVijjDBrx/XeMr37HprNNmTDkKvmfbtl90FczxMzwclD6JJQF7EOO+n+WlTxtdzdFh82KRa4w+fhCNVn14MRQ3iDAqGDMPCajVjd6uUqIu+NfZIY/jL0MfMl6u+rknI/lVsce6aB2ZwNaXn+EO41DV+eZC/On9EQFnoMsUIVSOXwhRWgWDhcLyKwXaltvWhjII2jBIbHAIuqherSj2+AApRKazUeWRi3GnDyetDcAqpeWGepOsZk1wc8e/2hRosmj0/8sQb7z/92JLOR9HRH6NTs09964+CVnhY3p2QtXpatllqVRmQxpVsmAjo/3aRxu0t4kw7R3q1xgvgeHttWtaoQDlUKcKXExuk/MOjcHxrbd47QGlmjS9SiRzo2S4Bpzg==
Hi,
Thank you for the answer. However, I think the problem is more subtle. In the recursive call
substTy (substSub s n s'') d'' t'''
t''' comes from the first argument, so it's not necessarily smaller than t' (the third argument).
I cannot do anything just with first or third argument as this recursive call uses substSub s n s'' as the first argument where s'' is a subterm of the third, and t''' as the third that is a subterm of the first.
I tried to combine those two, but the first argument is not just s'' but substSub s n s'', so I need some facts that involves substSub.
Even if I can use something like that in my measure, all such sizes I have tried give me less than or equal to, not just less than...
And thank you for the suggestion. Unfortunately, my actual case is more complex, so I cannot use just a list for a sub(stitution). Maybe it's better to have used a list at list for this simplified version.
Best,
Clare Jang
2020년 8월 3일 (월) 오후 4:20, Dominique Larchey-Wendling <dominique.larchey-wendling AT loria.fr>님이 작성:
Hi,To me the only non-structural case seems to bethe call on the match on the nth sub-term of oursnoc list sub-structure. Its size is smaller though.It is actually a real sub-term but convincing Coqthat it is so could be very hard indeed.In such a case, I do not see why a measure basedon the linear size would not work, in each Fixpoint onthe third argument. May be you struggle trying todefine mutual Fixpoints based on measures ?Also if I may (and if possible), I would suggest thatyou implement your type Ty so that snoc lists areactual list as in egInductive Ty : Set :=
| TUnit : Ty
| TBox : Ty -> Ty
| TUnbox : nat -> nat -> list Ty -> TyDefinition Sub := list Ty.Hence you could use the List library onyour type instead of having to recreate one. A snocnotation could help if you want to see the list reversed.You would switch mutual inductives with nested inductivesand would have to design a suitable recursor but oncedone, you will find it easy to work with.Best,DominiqueDe: "Junyoung Clare Jang" <jjc9310 AT gmail.com>
À: "coq-club" <coq-club AT inria.fr>
Envoyé: Lundi 3 Août 2020 21:22:22
Objet: [Coq-Club] Is there a measure for these functions?Dear All,While I am trying to prove some properties of my language, the following functions come up.
Inductive Sub : Set :=
| NullS : Sub
| SnocS : Sub -> Ty -> Sub
with Ty : Set :=
| TUnit : Ty
| TBox : Ty -> Ty
| TUnbox : nat -> nat -> Sub -> Ty
.
Fixpoint nth (s : Sub) (x : nat) : Ty :=
match s with
| NullS => TUnit
| SnocS s' t' =>
match x with
| O => t'
| S x' => nth s' x'
end
end
.
Fixpoint substSub (s : Sub) (n : nat) (s' : Sub) : Sub :=
match s' with
| NullS => NullS
| SnocS s'' t'' => SnocS (substSub s n s'') (substTy s n t'')
end
with substTy (s : Sub) (n : nat) (t' : Ty) : Ty :=
match t' with
| TUnit => TUnit
| TBox t'' => TBox (substTy s n t'')
| TUnbox x'' d'' s'' =>
if eq_dec d'' n
then
match nth s x'' with
| TBox t''' => substTy (substSub s n s'') d'' t'''
| t''' => TUnit
end
else
TUnbox x'' d'' (substSub s n s'')
end
.(I simplified the actual version a little)However, substSub and substTy are clearly not structurally recursive, so I tried several measures in order to define them, but none of those worked. I also attempted to find a looping example, and that was also unsuccessful. Do these functions terminate? I will appreciate any helps to show these functions are terminating or non-terminating...Thanks,Clare Jang
--
Best,
Junyoung Clare Jang
- [Coq-Club] Is there a measure for these functions?, Junyoung Clare Jang, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, Dominique Larchey-Wendling, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, Junyoung Clare Jang, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, Junyoung Clare Jang, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, Junyoung Clare Jang, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, jonikelee AT gmail.com, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, jonikelee AT gmail.com, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, jonikelee AT gmail.com, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, Junyoung Clare Jang, 08/03/2020
- Re: [Coq-Club] Is there a measure for these functions?, jonikelee AT gmail.com, 08/03/2020
- <Possible follow-up(s)>
- Re: [Coq-Club] Is there a measure for these functions?, Dominique Larchey-Wendling, 08/11/2020
- Re: [Coq-Club] Is there a measure for these functions?, Dominique Larchey-Wendling, 08/12/2020
- Re: [Coq-Club] Is there a measure for these functions?, Dominique Larchey-Wendling, 08/03/2020
Archive powered by MHonArc 2.6.19+.