coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Beta Ziliani <beta AT mpi-sws.org>
- To: Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Problems with dependently typed function
- Date: Fri, 22 Mar 2019 07:09:12 -0300
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=beta AT mpi-sws.org; spf=Pass smtp.mailfrom=beta AT mpi-sws.org; spf=None smtp.helo=postmaster AT jupiter.mpi-klsb.mpg.de
- Ironport-phdr: 9a23:ns2grhKM76Ks1kKc/tmcpTZWNBhigK39O0sv0rFitYgRLPzxwZ3uMQTl6Ol3ixeRBMOHsqoC1LOd6/CocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmSaxbalwIRmrogndqsobipZ+J6gszRfEvmFGcPlMy2NyIlKTkRf85sOu85Nm7i9dpfEv+dNeXKvjZ6g3QqBWAzogM2Au+c3krgLDQheV5nsdSWoZjBxFCBXY4R7gX5fxtiz6tvdh2CSfIMb7Q6w4VSik4qx2UxLjljsJOCAl/2HWksxwjbxUoBS9pxxk3oXYZJiZOOdicq/BeN8XQ3dKUMRMWCxbGo6zYIUPAOgBM+hWrIfzukUAogelCAa2GO/i0CVFimPq0aA41ekqDAHI3BYnH9ILqHnZscv6NLsIXuuoz6bIzDHDb/JM1jf76YjDbxcsruqSUrJsa8Xc0kwvFxvEjlmJsozkMSiV2v4Ks2iB4OptTOSigHMkpQFpujWj28khh43Tio4Izl3I7yZ0zYcvKdGlSEN3ecCoHIdUui2ANIZ7QtkuT3xptSs70LEKpJy2cSwMxZ863RDQceaHfJKN4h/7VOaePzN4hHV9dbK9mhay6UmgyvHiWcmuylpKqzJFktjVunAO0xzT8dOIRuF4/ke51jaDzR3c5f9cLUA1k6rUNYIhz6YtmpcdtUnPBDL6lUHsgKKVd0go4PWk5uT/brXjvJCcNot0ig/kMqQpn8yyGf83PRYSX2eB4um80aXj/UzgTLVRgPw2ibPVsJfAJcQUvqK5GRNa0p4/6xajCDeryMgXnX4eLF5cZB2Hi5XpNErVLfDjDfa/hkysny1xy/DHOL3hGJTNIWLZnLfvZ7Yuo3JbnSE01Jh0449eQuUKJ+u2UUvsvvTZCAU4Okq62bC0Js9609Y0VH6GSp2YNKLbt17AsugiP+CkYZcU/S3iML4i/fG43ixxokMUYaT8hchfU3u/BPkzZhzBOSO90OdEKn8Du08FdMKvjVSDVTBJYHPrBPA5/jB+E529S4DZSdL02eDT7GKABpRTI1t+JBWUC36xLNeBQ/ZJcz2JZMh7nW5cDOXze8oazRir8TTC5f9nI+7ToHBKt4/71cR4/avWjRB39jhvBYKYy27LQ2wmxm4=
Out of curiosity, Gaëtan, where did you get the name "commutative cut" for this? It's the first time I've heard of it.
Written from mobile. Excuse my limited communication.
On Fri, Mar 22, 2019, 5:28 AM Gaëtan Gilbert <gaetan.gilbert AT skyskimmer.net> wrote:
The variable x depends on t, so when you match on t if you want to use x
at a type depending on the branch you have to do a commutative cut
Definition liftVal t : tyDenote t -> exp t :=
match t with
| Nat => fun x => NatLit x
| Nat' => fun x => Nat'Lit x
| Bool => fun x => BoolLit x
end.
Gaëtan Gilbert
On 22/03/2019 09:17, Christian Kjær Larsen wrote:
> Hi,
>
> I have some GADT for expressions, and I want to lift values into
> expressions like this
>
> Inductive ty : Set :=
> | Nat : ty
> | Nat' : ty
> | Bool : ty.
>
> Definition tyDenote (t : ty) : Set :=
> match t with
> | Nat => nat
> | Nat' => nat
> | Bool => bool
> end.
>
> Inductive exp : ty -> Set :=
> | NatLit : nat -> exp Nat
> | Nat'Lit : nat -> exp Nat'
> | BoolLit : bool -> exp Bool.
>
> Definition liftVal t (x : tyDenote t) : exp t :=
> match t in ty return exp t with
> | Nat => NatLit x
> | Nat' => Nat'Lit x
> | Bool => BoolLit x
> end.
>
> But the last definition will not type check. Do any of you know how to
> write a function like this? One complication is probably that different
> object level types have the same denotation.
>
> Cheers,
> Christian
>
- [Coq-Club] Problems with dependently typed function, Christian Kjær Larsen, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Gaëtan Gilbert, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Beta Ziliani, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Jean-Francois Monin, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Stefan Monnier, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Jean-Francois Monin, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Beta Ziliani, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Sylvain Boulmé, 03/22/2019
- Re: [Coq-Club] Problems with dependently typed function, Gaëtan Gilbert, 03/22/2019
Archive powered by MHonArc 2.6.18.