Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I give an alias to a type in coq

Tags:

alias

typedef

coq

Let's say I wanna to create a matrix of natural numbers in coq.

I have the built-in coq List, and to create a list of natural numbers, I just write list nat.

In order to create a 2-dimension list (i.e. a matrix), I need to write list (list nat).

My question is: instead of writing list (list nat), what should I do for coq to understand the word matrix exactly as if it was list (list nat)?


I tried Notation "matrix" := list (list nat), Notation "(matrix nat)" := (list (list nat)), etc., but nothing seems to work.

like image 670
Daniel Avatar asked Nov 04 '18 18:11

Daniel


1 Answers

You can just write a definition: Definition matrix := list (list nat). The definition should just work for the most part (eg, you can still write Definition foo : matrix := [nil], with ListNotations).

If you don't want a definition (especially because in proofs you may have to explicitly unfold the definition for some tactics), then you can use a notation. The correct syntax for that is Notation matrix := (list (list nat)).

like image 188
Tej Chajed Avatar answered Sep 16 '22 18:09

Tej Chajed