Skip to Content.
Sympa Menu

maude-help - Re: [Maude-help] question on rule writing

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Re: [Maude-help] question on rule writing


Chronological Thread 
  • From: Scott Christley <schristley AT mac.com>
  • To: Steven Eker <eker AT csl.sri.com>
  • Cc: maude-help AT cs.uiuc.edu
  • Subject: Re: [Maude-help] question on rule writing
  • Date: Mon, 07 Feb 2011 14:57:14 -0600
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/maude-help>
  • List-id: <maude-help.cs.uiuc.edu>


Thanks, I ended up changing the two conditional rules which use a contains()
operator that checks for existence, and yes I intend to use search to explore
alternative possibilities. After experimenting I answered the question
myself, it would appear that a general non-conditional rule does match.

If you are interested, here is the code I have. After loading the maude
file, do a rewrite:

rewrite altMucusModel .

you will get the result:

rewrite in MUCUS_MODEL : altMucusModel .
rewrites: 11 in 0ms cpu (0ms real) (11000000 rewrites/second)
result specification: spec(BKR(emptyStatement), MS(NM(variable(muc2-mRNA),
ODE(hillFunction(variable(muc2-gene)) linearFunction(variable(muc2-mRNA))))))

So the thing to note is ODE() which contains two terms. This is the result
that I want, one term from a [transcribe] rule and another term from a
[decay] rule.

If you look in the MAPPING system module, you will see the rules for
[transcribe] and [decay]. If you comment out the two conditional rules, then
uncomment the two non-conditional rules, this is the answer from the rewrite:

rewrite in MUCUS_MODEL : altMucusModel .
rewrites: 4 in 0ms cpu (0ms real) (4000000 rewrites/second)
result specification: spec(BKR(emptyStatement), MS(NM(variable(muc2-mRNA),
ODE(hillFunction(variable(muc2-gene))))
NM(variable(muc2-mRNA), ODE(linearFunction(variable(muc2-mRNA))))))

Which is not what I want, because it creates two separate ODE() sections, not
a combined one.

thanks
Scott

Attachment: biomodel.maude
Description: Binary data



On Feb 7, 2011, at 2:15 PM, Steven Eker wrote:

> WIthout the signature, it's hard to know what you are trying to do or what
> a
> given pattern will match. Always post complete modules.
>
> If you are just manipulating data in a functional way (instead of changing
> state with alternative possibilities that might have to be explored using
> search or model checking) you are much better off using equations - they
> are
> _much_ faster and allow common subexpression evaluation (with rules, common
> subexpressions might evaluate differently in each occurrence).
>
> Steven
>
> On Monday 07 February 2011 10:32:03 am Scott Christley wrote:
>> Hello,
>>
>> I'm writing some rules where I want to add items to a "list" of things. In
>> the case of when the "list" is empty then I want to create the list (kind
>> of like an initial condition or tail-end of recursion). Otherwise when
>> the list is already there then I just want to add to it. So I'm writing
>> two rules, one non-conditional rule for when the list is not there, and
>> another conditional rule for when the list is there. But I'm worried that
>> one rule (the non-conditional rule) is too general and always matches.
>>
>> For example I have these two rules, where I match a "foo" in the first
>> part, then I add "bar" to a list of results for "foo". The first
>> non-conditional rule creates the first "result" while the second
>> conditional rule adds "bar" to the existing list of results.
>>
>>
>> rl [test] : test( X foo, answers(Y) )
>> => test( X, answers(Y result(foo, bar)) ) .
>>
>>
>> crl [test] : test( X foo, answers(Y result(Z, W)) )
>> => test( X, answers(Y result(Z, add(W, bar))) )
>> if Z = foo .
>>
>>
>>
>> My concern is that it seems that the non-conditional rule will always
>> match. Is this true? Or will a conditional rule which matches always
>> override a more general rule?
>>
>> What is the correct way to write such rules? I can think of one change by
>> changing the non-conditional rule into a conditional rule that checks for
>> non-existence, something like this:
>>
>>
>> crl [test] : test( X foo, answers(Y) )
>> => test( X, answers(Y result(foo, bar)) ) .
>> if not(contains(foo, Y)) .
>>
>>
>> thanks
>> Scott
>>
>> _______________________________________________
>> Maude-help mailing list
>> Maude-help AT cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/maude-help
>>




Archive powered by MHonArc 2.6.16.

Top of Page