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: Saulo Araujo <saulo2 AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Doubt about refine
  • Date: Tue, 9 Feb 2016 13:53:28 -0300
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=saulo2 AT gmail.com; spf=Pass smtp.mailfrom=saulo2 AT gmail.com; spf=None smtp.helo=postmaster AT mail-qg0-f46.google.com
  • Ironport-phdr: 9a23:fo4muhV/IfkJJ3mH1qePer//lovV8LGtZVwlr6E/grcLSJyIuqrYZheFt8tkgFKBZ4jH8fUM07OQ6PC/HzdYqsfb+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq8KVOF0D1WD1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GLdfFXEtN30/zMztrxjKCwWVtVUGVWBDqRNVBw+NxQvzQ5X2+n/hv/d533OyMsj/TLRyUjOnufQ4ACT0gTsKYmZquFrcjdZ92fpW

Hi,

I was able to finish the definition of the function get by following the suggestion of Guillaume. As it may be useful to someone that, like me, is starting to use dependent types in Coq,  I am sending the full definition of the function get:

Fixpoint get E n (s: Sequence E n) (ds: List Digit n): E.
Proof.
  refine(
    match s in Sequence _ n1 return n = n1 -> E with
    | SequenceLeaf e0 e1 => 
        match ds in List _ n2 return n = n2 -> n = 0 -> E with
        | ListLeaf D0 => fun _ _ => e0
        | ListLeaf D1 => fun _ _ => e1
        | _ => _
        end
        eq_refl
    | SequenceNode n1 s0 s1 => 
        match ds in List _ n2 return n = n2 -> n = S n1 -> E with
        | ListNode n2 D0 ds' => fun _ _ => get E n1 s0 _
        | ListNode n2 D1 ds' => fun _ _ => get E n1 s1 _
        | _ => _
        end
        eq_refl
    end
    eq_refl
  ).
  {
    congruence.
  }
  {
    congruence.
  }
  {
    congruence.
  }
  {
    congruence.
  }
Defined.

Sincerely,
​Saulo



Archive powered by MHonArc 2.6.18.

Top of Page