coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason Hu <fdhzs2010 AT hotmail.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Proving transitiviy of simple type system
- Date: Mon, 2 Oct 2023 22:34:47 +0000
- Accept-language: en-US, en-CA
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rHfAaf+BFPPOCM7bcEu7ISTCajwmR4auxcd2ESyMtUw=; b=mhoqhBDxlcjdZSsVtLra1ZzGLMBC5VHqhe6NvRfiDljcRXQ0m3ScsZVl2FFqjHYXvgmQ8/Yw4FAPSMLfDEE2Eae5YfDO1LBPH1vZIR6rNyZKxLiqWValaZ8NVRfhKDDypjvUVNHcCEbq4y9nJTXSE2gMqLUt5DK4T+WZxDSbQAbOGOPcAVvQBoOiIe/dY+IK4/4r84WpYIadAKFNPtz8NFXoIHDwsbJ4EyxRTUN2yAstAkLrqEtosYNe49vMQJeVCQpeb/sQP7Nb/NvNHVNcQ6/DP/ybw390KUuqUJUXaTGIn2wczSZRonTVNiLAtNlgSEazXw8xXOuvR8GVYa1nqw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J48m+6K95ic0gf6uXVekGZ9+Sbfoz+NQvAD82aMjigH6C+8bwiMkhuqwOS/K8+aIXUF/VS4O7yH+mUDLagwHtgbZpFC5Yxtvgw+0BBeNJxyqJ50ZLEXANgV2mWAMMjIluXgvt6Nlu9VVfjZfktwNGfKF6IClpgNFE17+/9smCulC1qKI/MLz8dJLI0O5pGHnE9sMmUrTI9cNWVmzcND0evv+Q+TJjH3TGdxWWek8Vm5ZVhngjWwBjPNHjvxlCX13GRoO0vJgpCmPAI3kbMUEOnvUxUKjtGIjizgxJAytl7nJObuLQoadsYLCObKutcyadKEk1kbVS09YvJ2znIEt8w==
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=fdhzs2010 AT hotmail.com; spf=Pass smtp.mailfrom=fdhzs2010 AT hotmail.com; spf=Pass smtp.helo=postmaster AT NAM12-DM6-obe.outbound.protection.outlook.com
- Ironport-data: A9a23:oRHNVKJBnHRaJBLcFE+RH5AlxSXFcZb7ZxGr2PjKsXjdYENS0jEDz TEdDTqAaPqCNjb8etgnYYuy80tV6JKDnd83TQEd+CA2RRqmi+KVXIXDdh+Y0wC6d5CYEho/t 63yTvGacajYm1eF/k/F3oDJ9CU6j+fSLlbFILasEjhrQgN5QzsWhxtmmuoo6qZlmtHR7zml4 LsemOWBfgf+s9JIGjhMsfna8Es15K6aVA4w5zTSW9gb5DcyqFFOVPrzFYnpR1PkT49dGPKNR uqr5NlVKUuEl/uFIorNfofTKiXmcJaKVeS9oiY+t5yZv/R3jndaPpDXmxYrQRw/Zz2hx7idw TjW3HC6YV9B0qbkwIzxX/TEes3X0GIvFLLveBCCXcKvI0LuIlXvkqxILVgPAs4K4OYoHWhKx /o9N2VYBvyDr7reLLOTbMBJ355mAOy1eYQVtzdn0C3TCusgTdbbWaLW6NRE3TA2wMdTAfLZY MlfYj1qBPjCS0EXfAZNTshk2rr47pX8W2UwRFa9q6Y38XOJlFUp+LjqLN/ce9jMTsJQ9qqdj jucrjypXExHZLRzzxKvzS+Durf0xxn3XYkOSqHjqt87vgS6kzl75Bo+EAHTTeOCokW5QpdUL 1Ee0jE/qLA7sk2tVNj0GROiyENopTYZUttUVuE/tgeEz/OO5AKaADJcE24Hb8E6vsgrQzBsz kWOg97iGT1otvuSVG6Z8bCX6zi1PED5MFM/WMPNdiNdi/GLnW35pkunog9LQfLr3O7mUyr92 S6LpyUYjrAex5xDnaai8FyNx3rmqpHVR0Rn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e6s4wiXdgi2ooo2MNJgSRc2srTpTxf1j6sedRDh/CkZSJUF 2dSmozbvFC9ih8kciLspcqxV23DkJFoP4DoOzpPiCxht5sYWuDIvfRFhXUn+FPg9FCIOKEvk GtFkql+sCZC0bNO5VJIrG3VA6hMTxNRZXW+zk3Rvd7i9P4Fbz73Kerikxcn1dG5UuPYq1kFC i+gI8UsQXcrvMsnaAqegjqusMmhcd3UJ7r7WTWUlAvFhulRbpk2k6hT7cKGEUTUmCR/jsIe0 1lp15z8u5WbIWJw+q7/GgRfKjD+e8IU/HfqkLpamcGVmYuoG8c4ct3udJvvUfehETZUvvPiZ V7mLQ==
- Ironport-sdr: 651b4593_Yt4fe/ucnV1WHuXazpwFYfTGhUGCxMLEY4nlUbfeWDntibH XxaBk+2CaBvTKYWz+nzHFkmlX51OijLaYbS68kA==
What you claim is not true. There is a standard exercise of transitivity elimination (akin to cut elimination in proof theory) for many common systems with subtyping. This process is not necessarily obvious, nor known how to do for all systems, but many important systems do have it, e.g. F-sub. For your example, alpha <: alpha is indeed required, however, not T <: T for all T. That is, reflexivity is probable. Similarly, F-sub's transitivity is also probable. You can find many proofs by looking up POPLMark.
Thanks,
Jason Hu
From: coq-club-request AT inria.fr <coq-club-request AT inria.fr> on behalf of Lasse Blaauwbroek <lasse AT blaauwbroek.eu>
Sent: Monday, October 2, 2023 6:15:40 PM
To: coq-club AT inria.fr <coq-club AT inria.fr>
Subject: Re: [Coq-Club] Proving transitiviy of simple type system
Sent: Monday, October 2, 2023 6:15:40 PM
To: coq-club AT inria.fr <coq-club AT inria.fr>
Subject: Re: [Coq-Club] Proving transitiviy of simple type system
Although Jean-Marie's and Jason's generalizations both work here, I
believe that the crucial point is still that this subtyping relation is
trivial. As far as I know, for most sufficiently "interesting" subtyping
relations, transitivity and reflexivity are not provable without
axiomatizing them. That is, you have to add reflexivity and transitivity
constructors (unless you modify all other constructors such that
transitivity is "built-in", but that amounts to the same thing). For
example, as soon as you have type variables you will not be able to
prove "\alpha < \alpha" without the axiom.
I'd be curious to know what kind of type-system you have in mind where
this is not needed?
On 02-10-2023 23:43, Jean-Marie Madiot wrote:
> Hello Frédéric,
>
> One standard "Coq trick" that you may already know is to generalize
> the statement before performing the induction, typically by doing
> something like "revert t3 HSubR; induction HSubL" or "revert t1
> HSubL; induction HSubR" in your example.
>
> However typeSub is contravariant in one of its argument, which makes
> things more interesting: only generalizing for all "HSubL" or for all
> "HSubR" won't be enough, you need to be able to switch sides.
>
> Suppose that you have a coarser (hence non trivial) subtyping relation
> such as
>
> Inductive typeSub : type -> type -> Prop :=
> | SubTUnit : typeSub TUnit TUnit
> | SubTFunUnit : forall ti to, typeSub (TFun ti to) TUnit
> | SubTFun : forall ti1 to1 ti2 to2, typeSub ti2 ti1 -> typeSub to1 to2
> -> typeSub (TFun ti1 to1) (TFun ti2 to2).
>
> Infix "<" := typeSub.
>
> Then you can generalize on both sides in this way:
>
> Lemma trans_aux t1 t2 : t1 < t2 -> (forall x, x < t1 -> x < t2) /\
> (forall x, t2 < x -> t1 < x).
> Proof.
> intros HSub; induction HSub; split; intros x Hx; inversion Hx;
> subst; constructor; firstorder.
> Qed.
>
> Lemma trans: forall t1 t2 t3, t1 < t2 -> t2 < t3 -> t1 < t3.
> Proof.
> intros t1 t2 t3 HSubL.
> apply trans_aux, HSubL.
> Qed.
>
> Regards,
> Jean-Marie
>
> Le 02/10/2023 à 19:53, Frederic Fort a écrit :
>> Hello,
>>
>> I am trying to prove the some facts about the type system of a simple
>> Lambda calculus. However, I struggle to prove the transitivity of the
>> subtype relation.
>> I have seen in papers that certain people simply "axiomatize"
>> properties like transitivity and reflexivity by defining specific
>> rules for these properties.
>> However, I find this inelegant as this makes proofs in other places
>> more "cluttered" due to the additional constructors.
>> I have a few proofs that work fine. For transitivity however, I am
>> stuck.
>> I have tried all kinds of (dependent) induction approaches, but I am
>> generally stuck either because Coq requires me to prove that the unit
>> type is a subtype of a function type or because the induction
>> hypothesis doesn't take into account that subtyping of function input
>> types is in the "opposite direction".
>>
>> I suppose that there is some "Coq trick" that I am unfamiliar with
>> (maybe I have to define a custom induction scheme ?).
>> Or maybe it is actually impossible to prove transitivity like that.
>>
>> If somebody could show me what I am missing, I'd be grateful.
>>
>> Yours sincerely,
>> Frédéric Fort
>>
>> Here are my definitions:
>> Inductive expr :=
>> | Unt
>> | Var (n : nat)
>> | Lam (v : nat) (e : expr)
>> | App (f : expr) (arg : expr)
>> .
>> Inductive type :=
>> | TUnit
>> | TFun (tin tout : type)
>> .
>> Inductive typeSub : type -> type -> Prop :=
>> | SubTUnit : typeSub TUnit TUnit
>> | SubTFun : forall ti1 to1 ti2 to2, typeSub ti2 ti1 -> typeSub to1
>> to2 -> typeSub (TFun ti1 to1) (TFun ti2 to2)
>> .
>>
>> Lemma refl:
>> forall t, typeSub t t.
>> Proof.
>> intros.
>> induction t; constructor; auto.
>> Qed.
>>
>> Lemma sub_is_eq:
>> forall t1 t2, typeSub t1 t2 -> t1 = t2.
>> Proof.
>> intros.
>> induction H.
>> - reflexivity.
>> - rewrite IHtypeSub1. rewrite IHtypeSub2. reflexivity.
>> Qed.
>>
>> Lemma trans:
>> forall t1 t2 t3,
>> typeSub t1 t2 -> typeSub t2 t3 -> typeSub t1 t3.
>> Proof.
>> intros t1 t2 t3 HSubL HSubR.
>> Admitted.
believe that the crucial point is still that this subtyping relation is
trivial. As far as I know, for most sufficiently "interesting" subtyping
relations, transitivity and reflexivity are not provable without
axiomatizing them. That is, you have to add reflexivity and transitivity
constructors (unless you modify all other constructors such that
transitivity is "built-in", but that amounts to the same thing). For
example, as soon as you have type variables you will not be able to
prove "\alpha < \alpha" without the axiom.
I'd be curious to know what kind of type-system you have in mind where
this is not needed?
On 02-10-2023 23:43, Jean-Marie Madiot wrote:
> Hello Frédéric,
>
> One standard "Coq trick" that you may already know is to generalize
> the statement before performing the induction, typically by doing
> something like "revert t3 HSubR; induction HSubL" or "revert t1
> HSubL; induction HSubR" in your example.
>
> However typeSub is contravariant in one of its argument, which makes
> things more interesting: only generalizing for all "HSubL" or for all
> "HSubR" won't be enough, you need to be able to switch sides.
>
> Suppose that you have a coarser (hence non trivial) subtyping relation
> such as
>
> Inductive typeSub : type -> type -> Prop :=
> | SubTUnit : typeSub TUnit TUnit
> | SubTFunUnit : forall ti to, typeSub (TFun ti to) TUnit
> | SubTFun : forall ti1 to1 ti2 to2, typeSub ti2 ti1 -> typeSub to1 to2
> -> typeSub (TFun ti1 to1) (TFun ti2 to2).
>
> Infix "<" := typeSub.
>
> Then you can generalize on both sides in this way:
>
> Lemma trans_aux t1 t2 : t1 < t2 -> (forall x, x < t1 -> x < t2) /\
> (forall x, t2 < x -> t1 < x).
> Proof.
> intros HSub; induction HSub; split; intros x Hx; inversion Hx;
> subst; constructor; firstorder.
> Qed.
>
> Lemma trans: forall t1 t2 t3, t1 < t2 -> t2 < t3 -> t1 < t3.
> Proof.
> intros t1 t2 t3 HSubL.
> apply trans_aux, HSubL.
> Qed.
>
> Regards,
> Jean-Marie
>
> Le 02/10/2023 à 19:53, Frederic Fort a écrit :
>> Hello,
>>
>> I am trying to prove the some facts about the type system of a simple
>> Lambda calculus. However, I struggle to prove the transitivity of the
>> subtype relation.
>> I have seen in papers that certain people simply "axiomatize"
>> properties like transitivity and reflexivity by defining specific
>> rules for these properties.
>> However, I find this inelegant as this makes proofs in other places
>> more "cluttered" due to the additional constructors.
>> I have a few proofs that work fine. For transitivity however, I am
>> stuck.
>> I have tried all kinds of (dependent) induction approaches, but I am
>> generally stuck either because Coq requires me to prove that the unit
>> type is a subtype of a function type or because the induction
>> hypothesis doesn't take into account that subtyping of function input
>> types is in the "opposite direction".
>>
>> I suppose that there is some "Coq trick" that I am unfamiliar with
>> (maybe I have to define a custom induction scheme ?).
>> Or maybe it is actually impossible to prove transitivity like that.
>>
>> If somebody could show me what I am missing, I'd be grateful.
>>
>> Yours sincerely,
>> Frédéric Fort
>>
>> Here are my definitions:
>> Inductive expr :=
>> | Unt
>> | Var (n : nat)
>> | Lam (v : nat) (e : expr)
>> | App (f : expr) (arg : expr)
>> .
>> Inductive type :=
>> | TUnit
>> | TFun (tin tout : type)
>> .
>> Inductive typeSub : type -> type -> Prop :=
>> | SubTUnit : typeSub TUnit TUnit
>> | SubTFun : forall ti1 to1 ti2 to2, typeSub ti2 ti1 -> typeSub to1
>> to2 -> typeSub (TFun ti1 to1) (TFun ti2 to2)
>> .
>>
>> Lemma refl:
>> forall t, typeSub t t.
>> Proof.
>> intros.
>> induction t; constructor; auto.
>> Qed.
>>
>> Lemma sub_is_eq:
>> forall t1 t2, typeSub t1 t2 -> t1 = t2.
>> Proof.
>> intros.
>> induction H.
>> - reflexivity.
>> - rewrite IHtypeSub1. rewrite IHtypeSub2. reflexivity.
>> Qed.
>>
>> Lemma trans:
>> forall t1 t2 t3,
>> typeSub t1 t2 -> typeSub t2 t3 -> typeSub t1 t3.
>> Proof.
>> intros t1 t2 t3 HSubL HSubR.
>> Admitted.
- [Coq-Club] Proving transitiviy of simple type system, Frederic Fort, 10/02/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Jason Hu, 10/02/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Lasse Blaauwbroek, 10/02/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Frederic Fort, 10/02/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Jason Hu, 10/02/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Frederic Fort, 10/02/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Jean-Marie Madiot, 10/02/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Lasse Blaauwbroek, 10/03/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Jason Hu, 10/03/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Lasse Blaauwbroek, 10/03/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Jason Hu, 10/03/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Lasse Blaauwbroek, 10/03/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Thorsten Altenkirch, 10/03/2023
- Re: [Coq-Club] Proving transitiviy of simple type system, Xavier Leroy, 10/03/2023
Archive powered by MHonArc 2.6.19+.