Subject: Ssreflect Users Discussion List
List archive
- From: (Emilio Jesús Gallego Arias)
- To: Nicolas Magaud <>
- Cc:
- Subject: Re: [ssreflect] Defining functions of fintypes
- Date: Wed, 27 Sep 2017 15:09:00 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=Pass
- Ironport-phdr: 9a23:u/AF9hHJiXYmZ+AhAdDElZ1GYnF86YWxBRYc798ds5kLTJ76rsSwAkXT6L1XgUPTWs2DsrQf1LqQ7viocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWapAQfERTnNAdzOv+9WsuL15z2hKiO/Mj1Yg5PgDOmKZZ7IxyroU2Fs8AZiJZuArs3ywDVuHIOdf4Alk1yIlfGkj7stp/2+4Rsu2R9vvMl9skIc6jh7b9wYrVcCDkpNCgc/szirliQHkO0+nIAXzBOwVJzCA/f4US/B8+pvw==
- Organization: X80 Heavy Industries
Dear Nicolas,
Nicolas Magaud
<>
writes:
> (* code I would like to write or something like that, i.e. with no
> lambda-abstractions *)
> Definition f' :=
> [fun (x,y) => 0 with (0,0) |-> 42,
> (0,1) |- 7,
> (0,2) |- 28,
> (1,0) |-> 2,
> (1,1) |- 8,
> (1,2) |- 70,
> (2,0) |-> 116,
> (2,1) |- 53,
> (2,2) |- 47].
In Coq 8.7 the "fun '(x,y) => E" is supported, however that won't work
with this notation; I am unsure what the problem is, likely Coq needs
more improvement as to correctly support this feature in the notation
syntax.
On the other hand, you write down the graph for such functions and
derive the finite function rather easily I think:
Definition Symb := 'I_3.
Definition f_graph : seq ((Symb * Symb) * nat) :=
map (fun '((x,y), n) => ((inord x, inord y),n))
[:: ((0,0) , 42)
; ((0,1) , 7)
; ((0,2) , 28)
; ((1,0) , 2)
; ((1,1) , 8)
; ((1,2) , 70)
; ((2,0) , 116)
; ((2,1) , 53)
; ((2,2) , 47) ].
Definition memq (T : eqType) U (d : U) x :=
fix memq (l : seq (T*U)) :=
if l is y :: ys then
if y.1 == x then y.2 else memq ys
else d.
Definition fun_f := [ffun x : Symb * Symb => memq 0 x f_graph].
Best,
Emilio
- [ssreflect] Defining functions of fintypes, Nicolas Magaud, 09/27/2017
- Re: [ssreflect] Defining functions of fintypes, Emilio Jesús Gallego Arias, 09/27/2017
- Re: [ssreflect] Defining functions of fintypes, Cyril, 09/27/2017
- Re: [ssreflect] Defining functions of fintypes, Assia Mahboubi, 09/27/2017
- Re: [ssreflect] Defining functions of fintypes, Nicolas Magaud, 09/28/2017
- Re: [ssreflect] Defining functions of fintypes, Yves Bertot, 09/28/2017
- Re: [ssreflect] Defining functions of fintypes, Cyril, 09/28/2017
- Re: [ssreflect] Defining functions of fintypes, Assia Mahboubi, 09/28/2017
- Re: [ssreflect] Defining functions of fintypes, Nicolas Magaud, 09/29/2017
- Re: [ssreflect] Defining functions of fintypes, Assia Mahboubi, 09/28/2017
- Re: [ssreflect] Defining functions of fintypes, Cyril, 09/28/2017
- Re: [ssreflect] Defining functions of fintypes, Yves Bertot, 09/28/2017
Archive powered by MHonArc 2.6.18.