k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: Patrick Meredith <pmeredit AT gmail.com>
- To: "Moore, Brandon Michael" <bmmoore AT illinois.edu>
- Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
- Subject: Re: [K-user] ambiguity & seqstrict
- Date: Wed, 3 Oct 2012 11:08:29 -0500
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
Brandon,
You are, of course, right. Not sure what I was thinking!
-Patrick
--
-Patrick
On Wed, Oct 3, 2012 at 10:26 AM, Moore, Brandon Michael <bmmoore AT illinois.edu> wrote:
Hello Patrick
If you want a deterministic short-circuiting and, the constructor should only be strict in the first argument, as in imp.k:
BExp "and" BExp [left, strict(1)]
(though right associativity would shortcut better).
The evaluation rules for true and false already cover all cases we don't want to get stuck,
there's no need for strictness/freezers/heating/cooling to handle the second argument.
Brandon
________________________________________
From: k-user-bounces AT cs.uiuc.edu [k-user-bounces AT cs.uiuc.edu] on behalf of Patrick Meredith [pmeredit AT gmail.com]
Sent: Wednesday, October 03, 2012 8:15 AM
To: Robby Findler
You are definitely right, and don't worry, we often use a hole notation too.
My only thinking here is that we *do* want the ability to write a short circuiting and that will not evaluate that div/0. The fact that this should be nondeterministic bothers me. If this gets changed as Traian mentions, it seems that then we would need to write manual heating and cooling rules to make sure that and correctly short circuits.
-Patrick
On Wed, Oct 3, 2012 at 6:22 AM, Robby Findler <robby AT eecs.northwestern.edu<mailto:robby AT eecs.northwestern.edu>> wrote:
What would this mean from the standpoint of the rules that seqstrict
generates? (I understand the seqstrict annotation as a shorthand for
generating rules, but I'm not sure that's right.)
I thought it would generate a rule something like
A:KResult and B:BExp ~> everythingelse => A ~> (hole and B) ~> everythingelse
(apologies for my bad notation here "(hole and B)" is really something
with a freezer around it and some substitutions and I'm not sure how
to write "everythingelse" properly)
Such a rule should fire!
And indeed, if I just remove the 'and' shortcircuiting rule, then I do
see the heating rule fire.
Robby
On Tue, Oct 2, 2012 at 10:36 PM, Patrick Meredith <pmeredit AT gmail.com<mailto:pmeredit AT gmail.com>> wrote:> On Oct 2, 2012 10:27 PM, "Robby Findler" <robby AT eecs.northwestern.edu<mailto:robby AT eecs.northwestern.edu>>
> Actually, that is a good point, and I'm not sure. This is the behavior you
> would normally want, but I'm not sure why it is working. My best guess is
> that seqstrict always plugs the heated value back in (cool) before it heats
> the second value, deterministically, and that is where it is reducing your
> short circuit (which doesn't care about the sort of the second argument).
> This is what we'd want, so my guess is that is how it works. I haven't used
> seqstrict in any of my definitions. Someone more knowledgeable can probably
> confirm if I am correct.
>
> -Patrick
>
> wrote:>> On Tue, Oct 2, 2012 at 10:26 PM, Patrick Meredith <pmeredit AT gmail.com<mailto:pmeredit AT gmail.com>>
>>
>> But why should that preclude the heating/cooling from applying?
>>
>> Robby
>>
>> wrote:>> > On Oct 2, 2012 10:20 PM, "Robby Findler" <robby AT eecs.northwestern.edu<mailto:robby AT eecs.northwestern.edu>>
>> > One definite issue is bool is in your syntax, so false and _ can be
>> > applied
>> > before any heating or cooling ever occurs.
>> >
>> > -Patrick
>> >
>> > wrote:>> >> On Tue, Oct 2, 2012 at 10:16 PM, Patrick Meredith <pmeredit AT gmail.com<mailto:pmeredit AT gmail.com>>
>> >>
>> >> Yes, but the left is already a KResult so the heating (or is it
>> >> cooling?) rule should still fire. No?
>> >>
>> >> Robby
>> >>
>> >> wrote:>> >> > On Oct 2, 2012 7:12 PM, "Robby Findler" <robby AT eecs.northwestern.edu<mailto:robby AT eecs.northwestern.edu>>
>> >> > Hi Robby,
>> >> >
>> >> > Replace seqstrict with strict. Seqstrict is deterministic
>> >> > sequentially
>> >> > (left to right)
>> >> >
>> >> > -Patrick
>> >> >
>> >> >> k-user AT cs.uiuc.edu<mailto:k-user AT cs.uiuc.edu>>> >> > wrote:
>> >> >>
>> >> >> Hi all: I'm having trouble understanding a K program's behavior and
>> >> >> I
>> >> >> wondered if I could get some help.
>> >> >>
>> >> >> Here's the program:
>> >> >>
>> >> >> module IMP
>> >> >> syntax AExp ::= Int
>> >> >> | "(" AExp ")" [bracket]
>> >> >> | AExp "/" AExp [seqstrict, left]
>> >> >> syntax BExp ::= Bool
>> >> >> | "(" BExp ")" [bracket]
>> >> >> | AExp "<=" AExp [seqstrict]
>> >> >> > BExp "and" BExp [seqstrict]
>> >> >>
>> >> >> syntax KResult ::= Bool | Int
>> >> >>
>> >> >> rule <k> I1:Int / 0 ...</k> => <k> "div0" </k>
>> >> >> rule I1:Int <= I2:Int => I1 <=Int I2
>> >> >> rule true and B:BExp => B
>> >> >> rule false and _ => false
>> >> >> endmodule
>> >> >>
>> >> >>
>> >> >> and here's the IMP program I run:
>> >> >>
>> >> >> false and (1/0 <= 3)
>> >> >>
>> >> >> I would have expected it to produce two out comes ("div0" and false)
>> >> >> because of the seqstrict annotation on the "and" production in the
>> >> >> grammar.
>> >> >> Specifically, I thought I'd get a heating/cooling rule that would
>> >> >> apply
>> >> >> to
>> >> >> the program above that would move the (1/0 <= 3) _expression_ to the
>> >> >> front of
>> >> >> the K cell, and the the 1/0 would move to the front and then I'd get
>> >> >> the
>> >> >> div0 result. But instead I get this:
>> >> >>
>> >> >> $ ../k/bin/krun --do-search --maude-cmd search x.impSearch results:
>> >> >>
>> >> >> Solution 1, state 0:
>> >> >>
>> >> >> <k>
>> >> >> false
>> >> >> </k>
>> >> >>
>> >> >> I do see that if I remove the short-circuiting 'and' rule that I get
>> >> >> the
>> >> >> div0, but I cannot seem to get them both at once.
>> >> >>
>> >> >> tia,
>> >> >> Robby
>> >> >>
>> >> >> _______________________________________________
>> >> >> k-user mailing list
>> >> >> http://lists.cs.uiuc.edu/mailman/listinfo/k-user>> >> k-user AT cs.uiuc.edu<mailto:k-user AT cs.uiuc.edu>
>> >> >>
>> >> >
>> >> _______________________________________________
>> >> k-user mailing list
>> >> http://lists.cs.uiuc.edu/mailman/listinfo/k-user
--
-Patrick
-Patrick
- Re: [K-user] ambiguity & seqstrict, (continued)
- Re: [K-user] ambiguity & seqstrict, Rosu, Grigore, 10/03/2012
- Re: [K-user] ambiguity & seqstrict, Robby Findler, 10/03/2012
- Re: [K-user] ambiguity & seqstrict, Rosu, Grigore, 10/03/2012
- Re: [K-user] ambiguity & seqstrict, Robby Findler, 10/03/2012
- Re: [K-user] ambiguity & seqstrict, Robby Findler, 10/03/2012
- Re: [K-user] ambiguity & seqstrict, Rosu, Grigore, 10/03/2012
- Re: [K-user] ambiguity & seqstrict, Seyed H. HAERI (Hossein), 10/03/2012
Archive powered by MHonArc 2.6.16.