coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Type error for user-defined induction principle for inductive type
Chronological Thread
- From: Jason Gross <jasongross9 AT gmail.com>
- To: coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Type error for user-defined induction principle for inductive type
- Date: Fri, 29 Jan 2021 19:56:37 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-io1-f49.google.com
- Ironport-phdr: 9a23:uQ1qzBXfdkduvNLRH7UYwy3IChLV8LGtZVwlr6E/grcLSJyIuqrYbBeOt8tkgFKBZ4jH8fUM07OQ7/mxHzdbqszc+DBaKdoQDkBD0Z1X1yUbQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYnbr+tQt2agMu4zf299IPOaAtUmjW9falyLBKrpgnNq8Uam4RvJrs1xxfTrHZFdetayX1oKFmOmxrw+tq88IRs/ihNuf8t7dJMXbn/c68lUbFWETMqPnwv6sb2rxfDVwyP5nUdUmUSjBVFBhXO4Q/5UJnsrCb0r/Jx1yaGM8L4S7A0Qimi4LxwSBD0kicHNiU2/3/Rh8dtka9UuhOhpxh4w47JfIGYMed1c63Bcd8GQ2dKQ8BcXDFDDIyhdYsCF+UOPehaoIf9qVUArgawCxewC+700DBEmmX70Lcm3+g9EwzL2hErEdIUsHTTqdX4LKMcXvquzKnPyzXIcvJY2S366IjTaRAqvPaBXbBqfsrKzkkvEQzFjk+XqYz+JDOY0v8As2ee7+V6VOKvj3QrpB12ojiq38ohjJTCiY0JxF7e7yp53Jo1KsOiSE59edOpEplduj2bOoZ5QM4vQn1ltTonxrAGvZO2eCsHxYooyRPdZfKKbouF7xb9WOiRPzp2hHJodK+xihqv8EWs1uLxW8+p21hJtipIisfAumwJ2hDJ6cWKSuFx8lqg1DuOzQze5eVJLEYpnqTBMZEh2KQ/lp8LvETDACD2nEL2gbeTdko+++io7/3rYrThppOBLoN0hA7zP6A0lsywBuQ4NQcOX2yF9uimyLLj+kj5TK1Ljv0wjKbZrIjXKdoHqqO9GQNY0YYu5wyiAzqn0dkUh3YKIVZddBKClYfpOlXOIP7iDfe4hlShiDVryOrdPr3mBJXNIWLDkLD6fbZm70NR0wUzzdVF6JJVDrENOu78Wkj0tNDAFB82LxS0w/r7CNV6zo4RRWWPAraAPKzOtV+I+/kgLvKXZI4VvTb9M+Iq6+TvjX8/g18dfLOm0YEZaHCiTbxaJBCSZmOpidMcGy9etQ0nCefulVeqUDhJZn/0UbhqtR8hD4fzL47YQYblr6aGxzzzSp9ffWdABUqLCmy5X4qBUvYILimVJ5kywXQ/SbG9Rtp5hlmVvwjgxu8/d7aGymgjrZvmkeNNyajLjxhrrG57Cs2c1yeGSGQmxjpZFQ9z57h2pAlG8nnG1KF5h/JCEtkKvqFGVw47MdjXyOkoUomvCDKERc+ATROdevvjATw1SYhskdoHYkI4GtL7yx6fjmylBLgak7HND5sxoPrR
Have not tried running the code, but try `match ls return All _ ls with` instead of `match ls with`. The error message that you got is saying "I don't know how to figure out what to apply "All" to to get "True"". Another way of phrasing this issue is that when you write "match ls with ..." it doesn't know whether you want the type of the branches to be in terms of `ls`, or to be in terms of the branch of the match.
Best,
Jason
On Fri, Jan 29, 2021 at 5:22 PM Jerome Hugues <jhugues AT andrew.cmu.edu> wrote:
Thanks for the suggestion
I tried this, but this still produces the same error on nil => I (see rewrite below)
The error changed to
The term "I" has type "True" while it is expected to have type
"All Ps ?l@{ls:=ls0; l0:=nil}".
which is a similar error message with different variable names due to the renaming
Fixpoint componentInstance_ind' (c : componentInstance) : Pc c :=
match c with
| component_instance n ls =>
component_case n ls
((fix subcomponentInstance_ind (ls : list subcomponentInstance) : All (Ps) (ls) :=
match ls with
| nil => I (* True *) (* All Ps nil *)
| subcomponent_instance _ c' :: ls' => (componentInstance_ind' c') /\
(subcomponentInstance_ind ls')
end)
ls)
end.
On 1/29/21, 5:14 PM, "coq-club-request AT inria.fr on behalf of Gaëtan Gilbert" <coq-club-request AT inria.fr on behalf of gaetan.gilbert AT skyskimmer.net> wrote:
Didn't check but I think
((fix subcomponentInstance_ind (lsi : list subcomponentInstance) : All (Ps) (ls) :=
should be ... : All Ps lsi, not ... : All Ps ls
Then I would just shadow ls to reduce typo possibilities
Gaëtan Gilbert
On 29/01/2021 22:58, Jerome Hugues wrote:
> ((fix subcomponentInstance_ind (lsi : list subcomponentInstance) : All (Ps) (ls) :=
>
- [Coq-Club] Type error for user-defined induction principle for inductive type, Jerome Hugues, 01/29/2021
- Re: [Coq-Club] Type error for user-defined induction principle for inductive type, Gaëtan Gilbert, 01/29/2021
- Re: [Coq-Club] Type error for user-defined induction principle for inductive type, Jerome Hugues, 01/29/2021
- Re: [Coq-Club] Type error for user-defined induction principle for inductive type, Jason Gross, 01/30/2021
- Re: [Coq-Club] Type error for user-defined induction principle for inductive type, Jerome Hugues, 01/30/2021
- Re: [Coq-Club] Type error for user-defined induction principle for inductive type, Jason Gross, 01/30/2021
- Re: [Coq-Club] Type error for user-defined induction principle for inductive type, Jerome Hugues, 01/29/2021
- Re: [Coq-Club] Type error for user-defined induction principle for inductive type, Gaëtan Gilbert, 01/29/2021
Archive powered by MHonArc 2.6.19+.