coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern
Chronological Thread
- From: Jonathan Leivent <jonikelee AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern
- Date: Thu, 8 Sep 2016 10:59:02 -0400
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f178.google.com
- Ironport-phdr: 9a23:2y8SVBV0VqxCh+CsSG/vl4oDvobV8LGtZVwlr6E/grcLSJyIuqrYZhGAt8tkgFKBZ4jH8fUM07OQ6PG5HzJaqsba+DBaKdoXBkdD0Z1X1yUbQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYnbr+tQt2asc272qiI9oHJZE0Q3XzmMOo0ck/9/V6Z9pFPx9AzcuBpklqBi0ALUtwe/XlvK1OXkkS0zeaL17knzR5tvek8/dVLS6TwcvdwZ7VZCDM7LzJ9v5Wz5lGQBTeIs3AbSyAdlgdCKwnD9hDzGJnr4QXgse8o+i6cNNH2RLZ8fTmj8aptVFe8iiABNj009GzaosN1haNf5hmmokoskMbvfIiJOa8mLevmdtQASD8ZUw==
On 09/08/2016 05:25 AM, Soegtrop, Michael wrote:
Dear Jonathan,
Here's a non-type-theorists view of what is happening: matches on equalitiesThanks for sharing your insights - it is not that easy to get deeper into Coq
can only reduce when the equality is exactly eq_refl because otherwise the
equality might be hypothetical - as in your nat = bool case. Even assuming
UIP, when there can only be one proof of the equality, there can also be no
proof of it.
after 40 years of using traditional programming languages having the semi
mathematical education of a physicist.
I've only got 38 years of traditional programming languages, and I switched my major from physics to comp-sci. But I think I feel your pain.
Let's see how this applies to my original case:
match plus_n_O 1 in (_ = y) return (t bool y) with
| eq_refl => cons bool false 0 (nil bool)
end : t bool (1 + 0)
The match term is:
Check (plus_n_O 1).
(* plus_n_O (S O) : @eq nat (S O) (Nat.add (S O) O) *)
If I understand you right, the match would reduce if this would be @eq nat x
x for some x.
Not quite...
Actually, I think there are three separate points here. One is that match doesn't determine the discriminee value from its type, regardless of how simple it is, even if the type of the discriminee indicates that there is only one possible value. Hence:
Variable u : unit.
Compute (match u with tt => 1 end).
is still a match, not 1.
The second point is: why doesn't plus_n_0 1 reduce to eq_refl. That's because it is opaque, as was mentioned.
The third point is: why can't one just directly replace any proof of @eq A x x with eq_refl, since it is the only constructor? That's because of the lack of a built-in UIP (or K) in Coq - and something similar occurs with type indexes on other types as well as eq. But, one can use Eqdep_dec.UIP_refl_nat in this case. However, Coq, doesn't allow one to rewrite in values, only in types. There is actually a rewrite tactic syntax "rewrite R in (value of H)", but I have never seen it work (see bugs 4075, 2911).
-- Jonathan
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, (continued)
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Soegtrop, Michael, 09/07/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Guillaume Melquiond, 09/07/2016
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Soegtrop, Michael, 09/07/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Guillaume Melquiond, 09/07/2016
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Soegtrop, Michael, 09/07/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Guillaume Melquiond, 09/07/2016
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Soegtrop, Michael, 09/07/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Jonathan Leivent, 09/07/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Gaetan Gilbert, 09/07/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Jonathan Leivent, 09/07/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Guillaume Melquiond, 09/07/2016
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Soegtrop, Michael, 09/08/2016
- Re: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Jonathan Leivent, 09/08/2016
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Soegtrop, Michael, 09/08/2016
- RE: [Coq-Club] Getting "computing" proof terms with dependent types / reduction of matches with single pattern, Soegtrop, Michael, 09/07/2016
Archive powered by MHonArc 2.6.18.