coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gert Smolka <smolka AT ps.uni-saarland.de>
- To: Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Dependent typing puzzle, constructor injectivity
- Date: Sun, 14 Feb 2021 10:11:09 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=smolka AT ps.uni-saarland.de; spf=Pass smtp.mailfrom=smolka AT ps.uni-saarland.de; spf=None smtp.helo=postmaster AT triton.rz.uni-saarland.de
- Ironport-phdr: 9a23:TLE0ORJ3LBz3gbfqP9mcpTZWNBhigK39O0sv0rFitYgeI/vxwZ3uMQTl6Ol3ixeRBMOHsqMC1bad6vixEUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCe5bL9oLRi7ogrdutQKjYZmN6081gbHrnxUdupM2GhmP0iTnxHy5sex+J5s7SFdsO8/+sBDTKv3Yb02QaRXAzo6PW814tbrtQTYQguU+nQcSGQWnQFWDAXD8Rr3Q43+sir+tup6xSmaIcj7Rq06VDi+86tmTgLjhTwZPDAl7m7Yls1wjLpaoB2/oRx/35XUa5yROPZnY6/RYc8WSW9HU81MVSJOH5m8YpMPAeUdMuhXoJTzqVUArRWgBwaiB+ThxyRUhn/v2K02z+QhHR3E0QEmAtkAsG7UrNLwNKoKUO660rPIzSneZP1L3Df974zIchM7rvqRWr9was/RyU4rFwPGlFqdspTlPyiP2uQQtWib7vNsVfm1hGE9sQFxpiKgxsExhYXTm40a1EnJ+CNky4k6OdO2UlR0YcK4EJROrSGaMZN7Tt4iTWxsuCg31rMLtYOlcSUF1Zgq2RrSZviaf4WM/x7uWumcLClkiH57d7yzmQq+/VSgxODzS8S4zFZHoylYntTKq3sD1ATT59CaRvZz8UqtwzKC2gHJ5uxGO0w4i6rWJ4Ylz7M+jJYfrEDOEyzslEnojKKaaF8o9vWo5unjZLjtu4WSOJVuig7kN6Qjgsy/Dvo8MggJR2Wb5f681Lz//U3+RrVGlOc2k6jDvJDHI8Qbp7e1AxRP3Yk58Ra/Cy2p0NIFknUdMV1KZgqLj4nvO17QPPD1FeqzjlqjnTtxw/3LP6ftD5fXInTdkLrtZbN95FRdyAo3w9Bf/ZVUCrQZLfLoX0/xs9jYDhwjPAGv2+bnE89x1p4YWWKOG6OZK7ndvkWS5uIrOeaMYpIatCzgJPc7//Lul2M2mUcBfam12psacGy3HvN/I0mAfXXshsoBHnwRswolTO3qjUWCXiRJa3azWaI8/DA7B5i8AYfNXID+yICGiQy8B9V9Yn1MQgSHFm6tfIGZUd8NbjiTK4lviGpXe6KmTtoO2Auy/DT/zL5kJ6KA4SgfsZHq/MBuofDVlFQp/DVuC82b3yeBQjcnzSszWzYq0fUn8gRGwVCZ3P092qQATI0B17ZySg4/cKXk4al/AtH2VBjGe43RGk69BMigAHQqR9srx9YIbwBxFof7102R72+RG7YQ0oezKtk0/6bbhSejO9x813HAkrMzyUQgQ45UPGS8gqd5+07fCtyRyhnLp+ORba0ZmRX12iKb12PU5BNAS0htV6SARnkWfE/fq9i/6k6QF7I=
Dear Kenzi,
thanks for explaining the no-confusion homomorphism approach
from Equations to me (I should have known). It contrasts the
inversion/injectivity approach of Dominique in that it uses casts.
Gert
> On 13. Feb 2021, at 15:18, Kenji Maillard <chocobodralliam AT gmail.com> wrote:
>
> Dear Gert Smolka,
>
> I realised one minute after sending the previous mail that the ICFP'19
> paper of Sozeau and Mangin I mentioned before also explains how to create
> homogeneous no-confusion principles which saves you one application of UIP
> on nat in your example:
>
> Definition noConfusionHomK {x z} (t : K x z) : K x z -> Type :=
> match t in K _ z return K x z -> Type with
> | K1 _ => fun t' => match t' return Type with | K1 _ => unit | _ => False
> end
> | K2 _ y z a b =>
> fun t' => match t' in K _ z' return z = z' -> Type with
> | K1 _ => fun _ => False
> | K2 _ y' z' a' b' =>
> fun zz' => { yy' : y = y' &
> ((rew [fun y => K x y] yy' in a = a') *
> (rew [fun z => K y' z] zz' in rew [fun y => K
> y z] yy' in b = b'))%type }
> end eq_refl
> end.
>
> Lemma noConfusionHomK_impl {x z} (t t' : K x z) :
> t = t' -> noConfusionHomK t t'.
> Proof.
> intros ->; destruct t' as [|y z a b]; cbn.
> 1: easy.
> exists eq_refl; easy.
> Qed.
>
>
> From Coq.Logic Require Import Eqdep_dec.
>
> Fact K2_injective x y z a b a' b':
> K2 x y z a b = K2 x y z a' b' -> (a,b) = (a',b').
> Proof.
> intros h%(noConfusionHomK_impl _ _).
> destruct h as [yy' [aa' bb']].
> rewrite (UIP_refl_nat _ yy') in aa', bb'.
> rewrite <- aa', <- bb'.
> reflexivity.
> Qed.
>
>
> I don't see how it would be possible to get rid of the second use of UIP
> though...
>
> Best regards,
> Kenji Maillard
>
> Le 13/02/2021 à 14:21, Gert Smolka a écrit :
>> I could not let loose, this stuff is addictive.
>> Luckily I found a solution before it ruined my weekend.
>> See below.
>>
>> Anyway, I would be thankful for pointers where these
>> kinds of things are explained.
>>
>> Enjoy your weekend,
>> Gert
>>
>> Fact DPI_nat :
>> forall (p: nat -> Type) n a b, existT p n a = existT p n b -> a = b.
>> Proof.
>> (* Follows with Coq.Logic.Eqdep_dec.UIP_refl_nat *)
>> Admitted.
>>
>> Inductive K (x: nat) : nat -> Type :=
>> | K1: K x (S x)
>> | K2: forall y z, K x y -> K y z -> K x z.
>>
>> Fact K2_injective x y z a b a' b':
>> K2 x z y a b = K2 x z y a' b' -> (a,b) = (a',b').
>> Proof.
>> intros e.
>> pose (p y z := prod (K x z) (K z y)).
>> pose (q y := sigT (p y)).
>> apply (DPI_nat (p y) z).
>> apply (DPI_nat q y).
>> pose (f:= fun c: K x y =>
>> match c return sigT q with
>> | K1 _ => existT q y (existT (p y) z (a,b))
>> | K2 _ z y a b => existT q y (existT (p y) z (a,b))
>> end).
>> apply (f_equal f e).
>> Qed.
>>
>>
>>> On 13. Feb 2021, at 12:35, Gert Smolka <smolka AT ps.uni-saarland.de> wrote:
>>>
>>> I would like to prove
>>>
>>> Inductive K (x: nat) : nat -> Type :=
>>> | K1: K x (S x)
>>> | K2: forall y z, K x y -> K y z -> K x z.
>>>
>>> Fact K2_injective x y z a b a' b':
>>> K2 x y z a b = K2 x y z a' b' -> (a,b) = (a',b').
>>>
>>> by hand in a way that is similar to the proof generated
>>> by the dependent elimination tactic of the Equations package.
>>> Does someone have a hand proof bringing across the essential ideas?
>>>
>>> Thanks in advance,
>>> Gert
>>>
>>> PS. I have a simple proof exploiting the "semantic” fact (K x y -> x < y),
>>> but so far I failed in finding a "regular” proof using only routine
>>> techniques.
>>>
- [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/13/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/13/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Kenji Maillard, 02/13/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Dominique Larchey-Wendling, 02/13/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Dominique Larchey-Wendling, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Dominique Larchey-Wendling, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Dominique Larchey-Wendling, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/14/2021
- Message not available
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/14/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Gert Smolka, 02/13/2021
- Re: [Coq-Club] Dependent typing puzzle, constructor injectivity, Jeremy Dawson, 02/14/2021
Archive powered by MHonArc 2.6.19+.