maude-help AT lists.siebelschool.illinois.edu
Subject: Maude-help mailing list
List archive
- From: Bartosz Zieliński <bartosz.zielinski AT uni.lodz.pl>
- To: "maude-help AT lists.cs.illinois.edu" <maude-help AT lists.cs.illinois.edu>, Marko Schuetz-Schmuck <MarkoSchuetz AT web.de>
- Subject: ODP: [[maude-help] ] extending message "format"
- Date: Wed, 9 Jun 2021 16:07:26 +0000
- Accept-language: pl-PL, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uni.lodz.pl; dmarc=pass action=none header.from=uni.lodz.pl; dkim=pass header.d=uni.lodz.pl; 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-SenderADCheck; bh=EQfeoA5RiqmhSk6VP90L/pCYzPJXvs++BV4svGt+z3E=; b=nVAD644NqreETFSBnyUPQQurUJE8RVIi909hLfXjo2yZdQ7PbZuY7a6yLM3A46OV6nUs7NV7+HZCJpdiIC+a2sfLJyqUES6dVee99WObsVxeDfXap+gGeaqoSuGfUsn/9SXkgeywtcbtK037UG6ygrKPrjDBYVJGI/yU239tU32OH6c9VwO7F+bkuZMbO9YbTmwsmxmfWvN6Jn22r+PrpvuBmUajRlaDrx2iT2QO4LdayJ0p/VzGwj8VeJeTLLvfLQLy4hAIywFqcZZSXzR7WNjBtN3DDq3U7e61wH7o/VuZQ85DTLVzpl8dSovoJl0gppMoFQlLVY9JGCHSdL2/6g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Umiafsu+PrHCd3UZACqv0whYuzfwvW94RX6VpLlJiz5iDqO0FeFBa+gGUacH3GQ9Ga2+k/ZW4wg8d1S1h24ZtWuJo40PnwjbmXD1RsKO26OmJm1s8ZxcARxs5WAJXWxMlnVbUscOAhj6WyUTYf9jfI3D0Gqxu//BaSsddmwXe3rJZ/eNy3LRzcig9RTU0sWytSj9svXdFBcIt8u7wScDMxGuCfPzbTYfK/tLpjuK44a/Ee86vXIayC12qhDbbEJNBfn6YVdFrpyBvbtz0XhoivX2aXZp7FZOmeakezaijYX+5GMuJUcHi3ZsejAqZpaz/eesqXp52q9NWGIOvKwGAA==
- Authentication-results: ppops.net; spf=pass smtp.mailfrom=bartosz.zielinski AT uni.lodz.pl; dkim=pass header.d=uni.lodz.pl header.s=selector1
- Authentication-results: lists.cs.illinois.edu; dkim=none (message not signed) header.d=none;lists.cs.illinois.edu; dmarc=none action=none header.from=uni.lodz.pl;
I believe this is a slight misunderstanding of how objects are supposed to work in Maude.
Messages to not return objects (you really shouldn't do the subsort
Order < Msg since messeges and objects are instances of common sort configuration.
Also Order should not be a sort but a class. To have objects you have to declare class and then you can construct objects with syntax < Oid : Class | Attributes >. Messages and objects are put in the commutative associative soup constructed with __ and you
have rewrite rules which take
messages and objects and return other messages and objects. Incidentally, Full Maude assumes that the first argument of the message is an Oid (object id). So a rule like
rl < X : Counter | val : Y > inc(X) => < X : Counter | val : Y + 1 > .
defines a message (method) of the Counter class which increases value of the attribute val of objects of this class, object identifiers correlate concrete objects identified with Oid's (like references in Java) with messages.
So the whole code below (including TRADE-ORDER) makes no sense.
I would rewrite TRADE-ORDER as (I did not test it) as
(omod TRADE-ORDER is
protecting STRING .
protecting NAT .
protecting STRING .
protecting NAT .
protecting QID.
sorts Symbol CustomerId .
sorts Symbol CustomerId .
subsort Qid < Oid .
class Order | amount : Int, product: Symbol, customer: CustomerId .
endom)
class Order | amount : Int, product: Symbol, customer: CustomerId .
endom)
and then you have order objects like
< 'A : Order | amount : 10, product : ...... >.
Best regards
Bartosz Zielinski
Od: Marko Schuetz-Schmuck
Wysłano: ¦roda, 09 Czerwiec 2021 17:24
Do: maude-help AT lists.cs.illinois.edu
Temat: [[maude-help] ] extending message "format"
Dear All,
I'm still very new to Maude. I ran into something that has me
puzzled. Say I define the module TRADE-ORDER:
(omod TRADE-ORDER is
protecting STRING .
protecting NAT .
sorts Order Symbol CustomerId .
subsort Order < Msg .
subsorts String < Symbol CustomerId .
msg buy_of_for_ : Nat Symbol CustomerId -> Order .
msg sell_of_for_ : Nat Symbol CustomerId -> Order .
endom)
and based on that I want to define a LIMIT-ORDER which is just a
TRADE-ORDER with a limit (of course I didn't want to duplicate the parts
of the message that are already in TRADE-ORDER). So I tried the
following (which would have some drawbacks even if it would work,
e.g. multiple nested "at"s):
(omod LIMIT-ORDER is
protecting TRADE-ORDER .
sort Limit-Order .
subsort Limit-Order < Order .
msg _at_ : Order Float -> Limit-Order .
endom)
I was expecting to be able to write
(red in LIMIT-ORDER : buy 5 of "T" for "C" at 1.2 .)
but that results in "incorrect command". I have since changed this to
objects and classes, but the syntax is not as plain as it would be with
the above.
Best regards,
Marko
I'm still very new to Maude. I ran into something that has me
puzzled. Say I define the module TRADE-ORDER:
(omod TRADE-ORDER is
protecting STRING .
protecting NAT .
sorts Order Symbol CustomerId .
subsort Order < Msg .
subsorts String < Symbol CustomerId .
msg buy_of_for_ : Nat Symbol CustomerId -> Order .
msg sell_of_for_ : Nat Symbol CustomerId -> Order .
endom)
and based on that I want to define a LIMIT-ORDER which is just a
TRADE-ORDER with a limit (of course I didn't want to duplicate the parts
of the message that are already in TRADE-ORDER). So I tried the
following (which would have some drawbacks even if it would work,
e.g. multiple nested "at"s):
(omod LIMIT-ORDER is
protecting TRADE-ORDER .
sort Limit-Order .
subsort Limit-Order < Order .
msg _at_ : Order Float -> Limit-Order .
endom)
I was expecting to be able to write
(red in LIMIT-ORDER : buy 5 of "T" for "C" at 1.2 .)
but that results in "incorrect command". I have since changed this to
objects and classes, but the syntax is not as plain as it would be with
the above.
Best regards,
Marko
- ODP: [[maude-help] ] extending message "format", Bartosz Zieliński, 06/09/2021
- Re: [[maude-help] ] extending message "format", Paco Durán, 06/09/2021
- Re: [[maude-help] ] extending message "format", Marko Schuetz-Schmuck, 06/11/2021
- Re: [[maude-help] ] extending message "format", Paco Durán, 06/09/2021
Archive powered by MHonArc 2.6.19.