Subject: Ssreflect Users Discussion List
List archive
- From: (Emilio Jesús Gallego Arias)
- To: Florent Hivert <>
- Cc: "ssreflect\@msr-inria.inria.fr" <>
- Subject: Re: [ssreflect] trivIset and intersecting sets...
- Date: Fri, 12 Feb 2016 15:45:10 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:cv8PpRf5ztw6/0Rb2t0GF9U5lGMj4u6mDksu8pMizoh2WeGdxc6zZx7h7PlgxGXEQZ/co6odzbGG7Oa7ByddsN6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDtvcaNKFgZzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IeezAcq85Vb1VCig9eyBwvZWz9EqLcQzayH8bSGgQjlJoAhbI9g2yCrn1tTH3sPY7+CiEMNfqZbQuWHKs9fE4ZgXvjXIIPjo9/W7QosdqjeRWpgmkv1px2caUTYSUMPt5NoHQZkEBDUVIWsJcWCsJK5m9ZpBOXLlJBvpRs4So/whGlhC5HwT5Qbq3kjI=
- Organization: CRI ParisTech
Dear Florent,
Florent Hivert
<>
writes:
> Thanks a lot for your code. It is indeed shorter than mine. After, rereading
> it and reworking it I'm not sure to understand why ? Is there a specific
> trick
> you can pinpoint that made it shorter or simpler and that I can remember and
> reuse ? Or do you think, is it just that you know how to use ssreflect
> tactics
> better than me.
I'm glad if it was of any help. IMVHO I wouldn't worry about the code
size; for me the hardest thing is to find good definitions, so they are
general and fit every use.
I don't know what more to say about proof style, I really must thank
strongly more experienced colleagues for their kind guidance and help.
Following their advice, I just try to imitate the style in the
library. I also to try to read and understand all the proofs and
definitions there before attempting my own.
Regarding your particular proof, I tried to use lighter dependent types
when transcribing your specification to Coq, in particular, avoiding
sumbool seems to work well inside the ssr framework.
I'd dare to say that a "light dependent types in algorithms" design
pattern is followed in the libraries and (I believe) mentioned in some
papers.
IMO in the long run, subType(s) tend to be more convenient to use than
their counterparts encoded as "type-families".
Compare:
a) eq : forall (x y : T) : { x = y } + { x <> y}.
vs
b) eq_op : T -> T -> bool
eqP : [the usual type]
each approach has particular strong and weak points, but usually b) will
make your life easier in large proofs due to a more explicit "phase
separation". The cost to pay seems to be the bureaucracy of adding /eqP
to your proof scripts.
> For the sake of completeness, you missed the Hypothesis that the two
> intersecting block are in P in your cond_triv definition.
>
> Definition cond_triv P AB :=
> [&& (AB.1 \in P), (AB.2 \in P), (AB.1 != AB.2) & (AB.1 :&: AB.2 != set0)].
Indeed, thanks! Note that you can drop the parens:
[&& AB.1 \in P, AB.2 \in P, AB.1 != AB.2 & AB.1 :&: AB.2 != set0].
thanks to the [&& ...] notation.
I would be very convenient to have a predType instance for pairs, so we
could write:
[&& AB \in (P,P), AB.1 != AB.2 & AB.1 :&: AB.2 != set0].
However, I couldn't manage to do it. I tried a hack:
> Inductive dup T := Dup of T & T.
>
> Coercion dup_to_pair T (d : dup T) := let: Dup x1 x2 := d in (x1, x2).
>
> Variables (T : Type) (pT : predType T).
>
> Definition mem_dup (l : dup pT) (e : dup T) : bool :=
> (e.1 \in l.1) && (e.2 \in l.2).
But so far without success.
Best regards,
Emilio
- [ssreflect] Choice function in Set, Florent Hivert, 02/11/2016
- RE: [ssreflect] Choice function in Set, Georges Gonthier, 02/11/2016
- Re: [ssreflect] Choice function in Set, Florent Hivert, 02/11/2016
- Re: [ssreflect] trivIset and intersecting sets..., Florent Hivert, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Beta Ziliani, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Florent Hivert, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Florent Hivert, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Assia Mahboubi, 02/21/2016
- RE: [ssreflect] Choice function in Set, Georges Gonthier, 02/11/2016
Archive powered by MHonArc 2.6.18.