coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Cedric Auger <sedrikov AT gmail.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] mathematical function notation
- Date: Wed, 4 Nov 2015 15:26:16 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=sedrikov AT gmail.com; spf=Pass smtp.mailfrom=sedrikov AT gmail.com; spf=None smtp.helo=postmaster AT mail-ig0-f171.google.com
- Ironport-phdr: 9a23:McWBzBa7q7gVNzZ/Zc6Yfp3/LSx+4OfEezUN459isYplN5qZpcm8bnLW6fgltlLVR4KTs6sC0LqL9fu4EjFfqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh730oMWYPloArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZn9Ku4zSqUdBzA7OUg04tfqvF/NV0HHsnAbSyAdlgdCKwnD9hDzGJnr5HjUrO14jQKXMdf3RvgdRDuv9e8/UxLkkiYEMCAR/2Tei8g2h6Ve9kHy7ydjypLZNdnGfMF1ebnQKIsX
2015-11-04 5:17 GMT+01:00 Michael Shulman <shulman AT sandiego.edu>:
Is there any way to get Coq to display function applications using the
traditional mathematician's notation "f(x)", with parentheses around
the argument? I would be satisfied with a solution that only applied
to functions with a particular domain and codomain. Coq accepts this
notation, of course, since the parentheses just group the "x"
unnecessarily, but then it displays it as "f x" instead. I've tried
wrapping both the function and the arguments in dummy inductive types
so that I could define a Notation for the application, but in both
cases I had to declare a Coercion to get the input notation to work,
and apparently the Coercion then overrides the Notation for display as
well.
Context: I'm using Coq to teach an introductory logic class for
mathematicians. It would be nice if it used the same notation that
they'll see in their textbooks and everywhere else in mathematics.
Ironically, two-variable functions (or more) work fine, if I define
them uncurried (albeit with an extra space): the ordered pair (x,y)
always gets displayed with parentheses so that f applied to it looks
like "f (x,y)". But I can't figure out any trick for one-variable
functions.
Mike
I am not sure if this is relevant or not, but you could use some stuff like:
Inductive single (T : Type) := Single : T -> single T.
Inductive pair (T U : Type) := Pair : T -> U -> pair T U.
Inductive triple (T U V : Type) := Triple : T -> U -> V -> triple T U V.
And so on (or even define it recursively as a "tuple : forall n, n_types n -> Type").
And then have a (x) notation for single T type, (x, y) for pair T U type and so on.
Then using and defining "f : single A -> B" instead of "f : A -> B" might do the trick, if you do not fear to box/unbox values.
Then use notations to get "A ⟶ B" for "single A -> B", "A×B ⟶ C" for "pair A B -> C" and so on.
- [Coq-Club] mathematical function notation, Michael Shulman, 11/04/2015
- Re: [Coq-Club] mathematical function notation, Clément Pit--Claudel, 11/04/2015
- Re: [Coq-Club] mathematical function notation, Cedric Auger, 11/04/2015
- Message not available
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/04/2015
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/04/2015
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/04/2015
- Message not available
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/04/2015
- Re: [Coq-Club] mathematical function notation, Cedric Auger, 11/04/2015
- Re: [Coq-Club] mathematical function notation, Pierre-Marie Pédrot, 11/05/2015
- Message not available
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/05/2015
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/09/2015
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/05/2015
- Re: [Coq-Club] mathematical function notation, Cedric Auger, 11/04/2015
- Re: [Coq-Club] mathematical function notation, Michael Shulman, 11/04/2015
Archive powered by MHonArc 2.6.18.