coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?
Chronological Thread
- From: Eduardo León <abc.deaf.xyz AT gmail.com>
- To: Adam Chlipala <adamc AT csail.mit.edu>, Kristopher Micinski <krismicinski AT gmail.com>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?
- Date: Sat, 29 Dec 2012 15:56:49 -0500
Do you mean the `hd` function for taking the head of a length-indexed list guaranteed to contain at least one element? I understand why the auxiliary function trick works, but it looks to me like a hack, in the sense that `hd' Nil` has no obvious interpretation - it solely exists for the purpose of being discarded as a possibility in `hd`.
I have noticed that, when you make an Inductive definition `a`, in addition to `a` itself, you get three additional definitions, which serve as "induction principles": `a_rect`, `a_ind`, and `a_rec`. This is of course very clever, and I suppose this is what actually makes things like the `match` construct and the `induction` tactic work.
I want `match` to be similarly clever. Obviously, when I `match blargh with | blerg => ...`, I expect `blargh = blergh` in that branch. Furthermore, it is actually true. So why do I not have an access to an instance of the type `blargh = blergh`? Maybe there is a technical reason why this is not possible... I would like to know!
On Sat, Dec 29, 2012 at 2:51 PM, Adam Chlipala <adamc AT csail.mit.edu> wrote:
On 12/29/2012 02:37 PM, abc.deaf.xyz AT gmail.com wrote:I actually treat the example of dependently typed predecessor at length in Chapter 6 of CPDT <http://adam.chlipala.net/cpdt/>. The version you're looking for is one among several that the chapter works its way through.
I want to write it as follows:
Theorem nope n (p : n = O) (q : n <> O) : False.
contradict q.
exact p.
Qed.
Definition pred2 n (q : n <> O) :=
match n with
| S n => n
| O =>
let p := _ in
match nope n p q with end
end.
My problem is... what do I fill in the hole in the let clause?
--
Eduardo León
- [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?, abc.deaf.xyz, 12/29/2012
- Re: [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?, Adam Chlipala, 12/29/2012
- Re: [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?, Eduardo León, 12/29/2012
- Re: [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?, Kristopher Micinski, 12/29/2012
- Re: [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?, Matthieu Sozeau, 12/30/2012
- Re: [Coq-Club] Inside a branch of a match block, how do I use the assertion that the matched expression is equal to the branch's data constructor expression?, Adam Chlipala, 12/29/2012
Archive powered by MHonArc 2.6.18.