Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] how to state a hypothesis with the help of another hypothesis

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] how to state a hypothesis with the help of another hypothesis


chronological Thread 
  • From: Adam Chlipala <adam AT chlipala.net>
  • To: Hai WAN <wan.whyhigh AT gmail.com>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] how to state a hypothesis with the help of another hypothesis
  • Date: Sat, 06 Nov 2010 13:06:09 -0400

Hai WAN wrote:
Variable V : Set.
Variable D : V->Set.
Definition States := forall v:V, D v.

Variable t : V.
Hypothesis t_nat :
  D t = nat.

Hypothesis t_full :
  forall n:nat, exists s:States, s t = n.
(***********************)
Of course, I get an error message saying that (s t) is of type (D t), while n is of type nat.
I already have hypothesis t_nat stating "D t = nat". How to define t_full with the help of t_nat?

There are two main options.  First, you can use a cast:

Hypothesis t_full :
forall n:nat, exists s:States, match t_nat in _ = T return T with refl_equal => s t end = n.

Second, you can use an alternate notion of equality, e.g., [JMeq]:

Require Import JMeq.
Hypothesis t_full :
  forall n:nat, exists s:States, JMeq (s t) n.

I prefer the former approach, wherever it doesn't lead to too much inconvenience. The main issues here are discussed in Chapter 9 of CPDT (http://adam.chlipala.net/cpdt/).



Archive powered by MhonArc 2.6.16.

Top of Page