Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Problems with dependent pattern matching

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Problems with dependent pattern matching


Chronological Thread 
  • From: Christian Kjær Larsen <christianden AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Problems with dependent pattern matching
  • Date: Tue, 2 May 2017 14:45:58 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=christianden AT gmail.com; spf=Pass smtp.mailfrom=christianden AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm0-f52.google.com
  • Ironport-phdr: 9a23:nTXyuxHziAUkJi+8H4eUhp1GYnF86YWxBRYc798ds5kLTJ7zpsywAkXT6L1XgUPTWs2DsrQf2raQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbQhFgDWwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOSA5/m/KicJ+gqxUrx29qBFk2YHYfJuYOeBicq7Tf94XQ3dKUMZLVyxGB4Oxd5UCD+obPeZZtIn9u1oOogG4BQa0Ae3vyDhPhmXu0qM8yeshCxrG0xImH9kTt3nbsNX1NL0TUeCu0KnIzC/Mb/VL1jjj7ojFaR8hofSWUrJxdcrd01UgFwTAjliJr4HuIj2b1uMIs2eB7upgU/qii28hqwFrozig3N0giofTho4NylDL7z55wIUrKt28TE53e9mkEIFftyycKoB4QdsiTnlqtSs10LEKpIC3cSgQxJkk2RLTcfyKf5aQ7h/gWuudOyp0iXJ4dL6lmhq//0etxvfyW8Wp1ltBszBLncPWtn8X0hze8siHReV5/kemwTuP0hrc6uBAIUwtm6vbLoItzqc+lpcTr0jPBCD2mELxjK+ZckUr5PKk5PjgYrXjvpOcNol0hR/iMqk2mMGyDv40PhUQU2Wb4+ix16Pv8Vf5TblUlvE2l7PWsJHeJcQVvK65BApV354/5Ba/FTem0c8YnWUGLF1ffhKIkpbmO1fVLfD3CPewmVWskDNxy//aOb3hB43BLmLfn7f5YbZ990lcxRIvwtBY/pJYE60OIPbuWkDqr9HYFR84Mwmsw+n9Etl914UeWXiOAqCDKq/Sv0WItaoTJLyHY5ZQszLgIdAk4eTvhDk3gwwzZ66siLAXcnGjAvVvJXK6Y/T2tfMIC3wHuEJqR+zwiUaeUDdVa3u0d6057zA/TomhCNGQFciWnLWd0XLjTdVtbWdcBwXUHA==

Hi,

I'm currently writing my bachelors thesis, and I'm hitting some problems with pattern matching on dependent
types, and I was wondering if you guys could help. It seems a bit difficult to work with in Coq.

I'm trying to formalise a small array language using intrinsically typed
syntax, de bruijn indices for binders and Adam Chlipalas heterogeneous list implementation from his book.

The idea is that I want to implement some fusion rules (like https://wiki.haskell.org/Fusion), and prove them correct using a semantics encoded in Coq.

The syntax is like this

Inductive exp G : ty -> Type :=
| evar : forall t, member t G -> exp G t
| etrue : exp G TBool
| efalse : exp G TBool
| econst : nat -> exp G TNat
| esucc : exp G TNat -> exp G TNat
| enil : forall t, exp G (TList t)
| econs : forall t, exp G t -> exp G (TList t) -> exp G (TList t)
| emap : forall t1 t2, exp (t1 :: G) t2 -> exp G (TList t1) -> exp G (TList t2)
| efilter : forall t1, exp (t1 :: G) TBool -> exp G (TList t1) -> exp G (TList t1).

And I have tried to define a fusion rule for (map f (map g) == map (f o g)) like this

Definition map_fusion t G (e : exp G t) :=
  match e in exp _ t return exp G t with
  | emap t2 t1 g em => match em in exp _ (TList t3) return exp G t with
                       | emap t3 t2 f eb => emap (compose f g) eb
                       | _ => e
                       end
  |  _ => e
end.

This does not work, because Coq does not know that the t2's are the
same. Do you have any tips for doing this style of dependent pattern
matching in Coq. I have tried to use the Program tactic, but I hit some
kind of bug. (https://coq.inria.fr/bugs/show_bug.cgi?id=5473).

I hope that my question makes sense, and that some of you will have the time to answer.

Cheers,

Christian Kjær Larsen
Student at the University of Copenhagen, Denmark.





Archive powered by MHonArc 2.6.18.

Top of Page