coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Lorenzo Gheri <lor.gheri AT gmail.com>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] termination when branching with fmaps
- Date: Thu, 18 Feb 2021 18:32:20 +0000
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=lor.gheri AT gmail.com; spf=Pass smtp.mailfrom=lor.gheri AT gmail.com; spf=None smtp.helo=postmaster AT mail-io1-f46.google.com
- Ironport-phdr: 9a23:RU9aFBLQuN1t6puZYdmcpTZWNBhigK39O0sv0rFitYgRIvjxwZ3uMQTl6Ol3ixeRBMOHsqMC1Lad7PuocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmT6wbalwIRi5ognctMcbipZ+J6gszRfEvmFGcPlMy2NyIlKTkRf85sOu85Nm7i9dpfEv+dNeXKvjZ6g3QqBWAzogM2Au+c3krgLDQheV5nsdSWoZjBxFCBXY4R7gX5fxtiz6tvdh2CSfIMb7Q6w4VSik4qx2ThLjlSUJOCMj8GzPhcN+jKxVrhG8qRJh34HZe5uaOOZkc67HYd8WWWhMU8BMXCJBGIO8aI4PAvIHM+ZftYnyuV0OrBq5BQKxBe3vyiFHhmX33aYn1OkhFQbG3BY6E9IBsHTbss/1NKYJXOC6yanH1zTDb/dM1Tjh74jIdwksrPeRVr1/bcTf01MgFx/ZjlqOs4zlOSuY2vkJvmSF7+dtV+yihnA5pgxyoDWj2sYhhIbUio4LyV3J9Th1zYkxKNO4VEN1YcOoHZRMuy2HNoZ4TcMsTW52tCs817YIuoa7cTAUxJg7wxPTcf+KfoiS7h7+VeucIC10iX1kdb+5mh2861KvyvfmWcmxyFtKrjRKkt3Ltn0V0hzc8MmHSv9k8keg3jaDyhnf6u9LLE01j6bbJJkhwrk/lpoXr0vPBDP5mELzjKOOd0Uk/Pan6/j/b7n4upORM5V4hwL+P6g0h8CyAOU1PhIBUmWa4ei80afs/Uz9QLVElP02lazZvYjeJcQcvK61GQBV0oY95BalDjery9sYnXwdI1JEfBKLlZTmO1bLIPzgF/ewn0yskCt3x/DBJrDuHpLNLmHanLj9ebZ99lVTxREozdFf4pJUEqsOLOjyWk/3rtzYDwU2Pxa6w+b9W51B0dYVXnvKCauEOovTt0WJ76QhObqifogQ7RL6MfUj9fmmon80g15VKa2ux90YaH2iH9xpJkyYZTznhdJXQjRChRY3UOG/0A7KajVUfXvnB/thtAF+M5qvCML4fq7ogLGF233mTJhfZ2QDC1fVVHm0KcOLXPADbC/UKchkwGRdBOqRDrQ53BTrjzfUjr9uL+7a4Cod7Mux29185umVnhY3p2UtU5atllqVRmQxpVsmAics1fkm80N4w1aHl6N/hq4AGA==
Hi All,
I have defined the following datatype:
From mathcomp.ssreflect Require Import all_ssreflect.
From mathcomp Require Import finmap.
Open Scope fset.
Open Scope fmap.
From mathcomp Require Import finmap.
Open Scope fset.
Open Scope fmap.
Inductive fmap_tree :=
| fmap_leaf (n : nat)
| fmap_node (n : nat) (branching : {fmap nat -> fmap_tree}).
| fmap_leaf (n : nat)
| fmap_node (n : nat) (branching : {fmap nat -> fmap_tree}).
I would really like to keep this definition, namely to use finite maps (fmap from the math-comp libraries) instead of lists. I however run into problems when defining depth:
Definition maxn_f_codom {A:Type} (f: A -> nat) (br: {fmap nat -> A}):=
foldr maxn 0 (map (fun x=> match (br.[?x]) with
| None => 0
| Some T' => f T'
end)
(enum_fset (domf br)) ).
Fixpoint depth (T : fmap_tree) : nat :=
match T with
| fmap_leaf n => 0
| fmap_node n br => (maxn_f_codom depth br).+1
end.
foldr maxn 0 (map (fun x=> match (br.[?x]) with
| None => 0
| Some T' => f T'
end)
(enum_fset (domf br)) ).
Fixpoint depth (T : fmap_tree) : nat :=
match T with
| fmap_leaf n => 0
| fmap_node n br => (maxn_f_codom depth br).+1
end.
In particular the definition of maxn_f_codom above---which could as well be inlined in the depth definition---is accepted by Coq with no issues, but the Fixpoint for depth is ill-formed. I thought I could easily use enum_fset for turning the finite domain of the fmap into a list and then termination would have been guaranteed. I was being too naif! :)
Before I give up altogether and go back to branching with lists, is there any way for me to convince Coq that fmaps are OK as well?
Many thanks,
Lorenzo
- [Coq-Club] termination when branching with fmaps, Lorenzo Gheri, 02/18/2021
- Re: [Coq-Club] termination when branching with fmaps, Li-yao Xia, 02/18/2021
- Re: [Coq-Club] termination when branching with fmaps, Lorenzo Gheri, 02/19/2021
- Re: [Coq-Club] termination when branching with fmaps, Matthieu Sozeau, 02/19/2021
- Re: [Coq-Club] termination when branching with fmaps, Laurent Thery, 02/19/2021
- Re: [Coq-Club] termination when branching with fmaps, Lorenzo Gheri, 02/20/2021
- Re: [Coq-Club] termination when branching with fmaps, Laurent Thery, 02/19/2021
- Re: [Coq-Club] termination when branching with fmaps, Marcel Ullrich, 02/19/2021
- Re: [Coq-Club] termination when branching with fmaps, Matthieu Sozeau, 02/19/2021
- Re: [Coq-Club] termination when branching with fmaps, Lorenzo Gheri, 02/19/2021
- Re: [Coq-Club] termination when branching with fmaps, Li-yao Xia, 02/18/2021
Archive powered by MHonArc 2.6.19+.