Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Doubt about refine

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Doubt about refine


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Doubt about refine
  • Date: Wed, 10 Feb 2016 19:50:57 -0500
  • Authentication-results: mail2-smtp-roc.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-f196.google.com
  • Ironport-phdr: 9a23:D9Vu+hK7lhZ/0Qw+5dmcpTZWNBhigK39O0sv0rFitYgUKfXxwZ3uMQTl6Ol3ixeRBMOAu60C0LGd6f6ocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC0ILsjKvopdX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD86Fpy8kVWqLjOq88ULZwDTI8Mmlz6te4mwPESF6t4X0VTmUflFJsDgnb4RfmFsPztS37ted51SSyMsj/TLRyUjOnufQ4ACT0gTsKYmZquFrcjdZ92fpW

There is another alternative. The type indexes can be omitted in favor of extra equality fields. Doing this enables the use of basic matches in the refine, as in the following rewriting of your example. No convoy patterns are needed. I don't know why this technique isn't mentioned more frequently.


Set Implicit Arguments.

Section Sequence.

Variable E: Set.

Inductive Sequence(n : nat) : Set :=
| SequenceLeaf: E -> E -> n=0 -> Sequence n
| SequenceNode: forall m, Sequence m -> Sequence m -> n = S m -> Sequence n.

Inductive List(n : nat) : Set :=
| ListLeaf: E -> n=0 -> List n
| ListNode: forall m, E -> List m -> n = S m -> List n.

End Sequence.

Inductive Digit :=
| D0
| D1.

Fixpoint get E n (t: Sequence E n) (ds: List Digit n): E.
Proof.
refine(
match t with
| SequenceLeaf e0 e1 e =>
match ds with
| ListLeaf D0 _ => e0
| ListLeaf D1 _ => e1
| @ListNode _ _ y _ _ e2 => _
end
| @SequenceNode _ _ x s0 s1 _ =>
match ds with
| ListLeaf _ e0 => _
| @ListNode _ _ y d ds' _ =>
match d with
| D0 => get E x s0 _
| D1 => get E x s1 _
end
end
end
).
all:congruence.
Defined.

-- Jonathan




Archive powered by MHonArc 2.6.18.

Top of Page