Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] the type of natural numbers

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] the type of natural numbers


chronological Thread 
  • From: Venanzio Capretta <venanzio AT site.uottawa.ca>
  • To: BruinBear123 AT aol.com
  • Cc: coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club] the type of natural numbers
  • Date: Wed, 27 Jul 2005 10:47:45 -0400
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

Hi Bill,
  you asked about Church numerals in Coq:

> How can you use Coq to show that...
> 
> (forall C: U0). C => (C => C) => C
> 
> can be seen as a representation of the type of natural numbers?

Here it is, with conversion functions to and from nat:

--------------------------------------------------
Definition Nat := forall X:Type, X -> (X->X) -> X.

Fixpoint nN (n:nat): Nat :=
match n with
  O => fun X x f => x
| (S n') => fun X x f => f (nN n' X x f)
end.

Definition Nn: Nat -> nat :=
fun N => N nat 0 S.
--------------------------------------------------

You cannot actually prove that this is an isomorphism.
In one direction it is easy by induction on nat:

------------------------------
Lemma id_nat_Nat:
  forall n:nat, Nn (nN n) = n.
Proof.
induction n.
trivial.
unfold Nn; simpl.
unfold Nn in IHn.
rewrite IHn.
trivial.
Qed.
-------------------------------

But the viceversa:

Lemma id_Nat_nat:
  forall N:Nat, nN (Nn N) = N.

is not provable.
You must at least formulate it extensionally:

Lemma id_Nat_nat:
  forall (N:Nat)(X:Type)(x:X)(f:X->X), nN (Nn N) X x f = N X x f.

But even like this I cannot prove it.
I suspect you need impredicativity to prove it. Does anyone know?

Cheers,
  Venanzio


-- 
Venanzio Capretta
Department of Mathematics and Statistics/
School of Information Technology and Engeneering
University of Ottawa, Canada
http://www.science.uottawa.ca/~vcapr396/






Archive powered by MhonArc 2.6.16.

Top of Page