Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Dependent Type Problem

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Dependent Type Problem


Chronological Thread 
  • From: Gert Smolka <smolka AT ps.uni-saarland.de>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Dependent Type Problem
  • Date: Thu, 17 Dec 2015 19:10:39 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=smolka AT ps.uni-saarland.de; spf=None smtp.mailfrom=smolka AT ps.uni-saarland.de; spf=None smtp.helo=postmaster AT theia.rz.uni-saarland.de
  • Ironport-phdr: 9a23:qyVElhTOdmcP33B3ewzNfZ2WKtpsv+yvbD5Q0YIujvd0So/mwa64YxGN2/xhgRfzUJnB7Loc0qyN4/6mAjVLuM7f+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq8OVOFwD3WLjKZpJbzyI7izp/vEMhoVjLqtjgjDomVBvP9ps+GVzOFiIlAz97MrjtLRq8iBXpu5zv5UYCfayV+0CQLdZFDUrNXwurI2u7EGbDFjH2nxJeWIP2jFMHgKNuBr9R9L6tjbwnut7wiiTe8PsG+MaQzOnuohmUgOgsyIAMz0wuDXMj8t0j6tzuAnnuhp+hpXdaZuRPfxyOK/QK4BJDVFdV9pcAnQSSri3aJECWq9YZb5V

Suppose we have an isomorphism between nat and a type N with O' and S'. I
would expect that the recursor for nat can be pulled over to N. In fact, it
is not difficult to define a function

R : forall f : N -> Type, f O' -> (forall x, f x -> f (S' x)) -> forall x, f
x.

However, I cannot show the equation

R f A F O' = A

because a rewrite violates dependent type constraints.

I would much appreciate help from a dependent type expert. Do you think it
is possible to define R in such a way that the equation can be shown? Or is
it known that the equations of dependent recursors cannot be pulled over?
Coq code is below.

Gert

PS. It is not difficult to pull over a simply typed recursor (primitive
recursion) including the equations.

Section N.
Variables (N : Type) (O' : N) (S' : N -> N).

Fixpoint E (n : nat) : N :=
match n with
| O => O'
| S n' => S' (E n')
end.

Variables (P : N -> nat).
Variable EP : forall x, E (P x) = x.
Variable PE : forall n, P (E n) = n.

Lemma PO' :
P O' = 0.
Proof.
now rewrite <- (PE 0).
Qed.

Lemma fEP (f : N -> Type) x :
f (E (P x)) -> f x.
Proof.
intros A. now rewrite <- EP.
Defined.

Definition R (f : N -> Type) (A : f O') (F: forall x, f x -> f (S' x)) x :
f x
:= fEP f x (nat_rect (fun n => f (E n)) A (fun n B => F (E n) B) (P x)).

Lemma R0 f A F :
R f A F O' = A.
Proof.
unfold R. pattern (P O’). FAILS

End N.


Archive powered by MHonArc 2.6.18.

Top of Page