<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>I think we are in agreement now on this.<BR>
My original assertions were indeed wrong for <= and >=.<BR>
I'm not even sure they were correct for < and >.<BR>
 <BR>
 - Jay<BR><BR><BR>

<HR id=stopSpelling>
<BR>
> To: jayk123@hotmail.com<BR>> CC: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] small set comparisons understood, now just to understand the front end code.. <BR>> Date: Mon, 14 Apr 2008 13:10:05 -0700<BR>> From: mika@async.caltech.edu<BR>> <BR>> Sorry, I think the Green Book is completely unambiguous about this.<BR>> <BR>> a < b is the same as a <= b AND a # b for all a and b, no matter<BR>> the type (set, integer, or floating). That's what 2.6.11 says, and<BR>> it seems correct, because it implies that for sets, <= is the subset<BR>> relation, and < is the proper subset relation.<BR>> <BR>> Mika<BR>> <BR>> Jay writes:<BR>> >--_a67e670a-e4c4-4f68-a1a3-4f4661e52338_<BR>> >Content-Type: text/plain; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> > a < b "should be implemented as" (a & b) =3D=3D a=20<BR>> >=20<BR>> > I believe, and so on.=20<BR>> >I could be wrong. I only thought about it a few minutes.=20<BR>> >=20<BR>> > The current incorrect code is:=20<BR>> >PROCEDURE Set_compare (s: Size; op: Cmp) =3D BEGIN IF Force_pair (comm=<BR>> >ute :=3D TRUE) THEN op :=3D M3CG.SwappedCompare [op]; END; IF (s=<BR>> > <=3D Target.Integer.size) THEN cg.compare (Target.Word.cg_type, Targe=<BR>> >t.Integer.cg_type, op); ELSE cg.set_compare (AsBytes (s), op, Target.I=<BR>> >nteger.cg_type); END; SPop (2, "Set_eq"); SPush (Type.Int32); END=<BR>> > Set_compare;<BR>> >=20<BR>> >which generates simply, I think this was <=3D (jbe -- jump if below or equa=<BR>> >l):<BR>> >=20<BR>> >=20<BR>> > 0040119C: 56 push esi 0040119D: E8 AE FE FF FF =<BR>> > call _Main__m 004011A2: 83 C4 04 add esp,4<BR>> >=20<BR>> > ... end of previous line that just called m("foo")=20<BR>> >=20<BR>> > ; push a string to print=20<BR>> > 004011A5: 8D 35 2C 12 40 00 lea esi,ds:[40122Ch] 004011AB: 56 =<BR>> > push esi<BR>> >=20<BR>> > ; compare two sets=20<BR>> > ; one is constant 0x15; one is a global=20<BR>> > 004011AC: 83 3D 44 90 45 00 cmp dword ptr ds:[459044h],15h =<BR>> > 15<BR>> >=20<BR>> > ; spend a while converting the compare result to a boolean 004011B3: 0F =<BR>> >96 45 FC setbe byte ptr [ebp-4] 004011B7: 33 DB =<BR>> >xor ebx,ebx 004011B9: 8A 5D FC mov bl,byte ptr [=<BR>> ebp-4] 004011BC: 83 FB 00 cmp ebx,0 004011BF: 0F 94 45 =<BR>> >F8 sete byte ptr [ebp-8] 004011C3: 33 D2 xor =<BR>> > edx,edx 004011C5: 8A 55 F8 mov dl,byte ptr [ebp-8]<BR>> > ; and then push that boolean=20<BR>> > 004011C8: 52 push edx<BR>> > 004011C9: E8 6C FF FF FF call _Main__checkM<BR>> >oh, you are right, < needs to also be !=3D.<BR>> >I thought it was suspicious to have only two implementations of four operat=<BR>> >ions, but I did like the resulting efficiency. :)<BR>> >Hey, I was at least sure the current code was wrong.<BR>> >=20<BR>> > - Jay<BR>> ><BR>> ><BR>> ><BR>> >> To: jayk123@hotmail.com> Subject: Re: [M3devel] small set comparisons und=<BR>> >erstood, now just to understand the front end code.. > Date: Mon, 14 Apr 20=<BR>> >08 10:16:01 -0700> From: mika@async.caltech.edu> > Jay writes:> >--_6435b74=<BR>> >a-d943-44c2-9091-ab0408dc7ed0_> >Content-Type: text/plain; charset=3D"iso-8=<BR>> >859-1"> >Content-Transfer-Encoding: quoted-printable> >> >> >currently set =<BR>> ><,>,<=3D3D,>=3D3D are implemented merely as> >integer <,>,<=3D3D,>=3D3D> >=<BR>> >=3D20> >This is wrong.> >=3D20> >I believe it should be:> >=3D20> >a < b =<BR>> >=3D3D> (a & b) =3D3D=3D3D a> >a <=3D3D b =3D3D> (a & b) =3D3D=3D3D a (same =<BR>> >as <=3D3D)> >a > b =3D3D> (a & b) =3D3D=3D3D b> >a >=3D3D b =3D3D> (a & b) =<BR>> >=3D3D=3D3D b (same as >)> > You don't actually mean logical implication by =<BR>> >your arrows do you,> but equivalence, where the objects to the left of the =<BR>> >arrow refer> to the abstract sets a and b and the objects to the right of t=<BR>> >he> arrow refer to bit-vector implementations (in C) of the same?> > Green =<BR>> >Book, page 57, section 2.6.1:> > "In all cases, x < y means (x <=3D y) AND =<BR>> >(x # y), and x > y means y < x."> > So in your syntax a > b would be ((a & =<BR>> >b) =3D=3D a) && (a !=3D b).> > Also, just above it, > > "The expression x >=<BR>> >=3D y is equivalent to y <=3D x."> > Why not define the operation "x >=3D y=<BR>> >" and then use the two statements> from the Green Book to generate the rest=<BR>> >?> > Mika=<BR>> ><BR>> >--_a67e670a-e4c4-4f68-a1a3-4f4661e52338_<BR>> >Content-Type: text/html; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> ><html><BR>> ><head><BR>> ><style><BR>> >.hmmessage P<BR>> >{<BR>> >margin:0px;<BR>> >padding:0px<BR>> >}<BR>> >body.hmmessage<BR>> >{<BR>> >FONT-SIZE: 10pt;<BR>> >FONT-FAMILY:Tahoma<BR>> >}<BR>> ></style><BR>> ></head><BR>> ><body class=3D'hmmessage'>&nbsp;a &lt; b "should be implemented as" (a &amp=<BR>> >; b) =3D=3D a <BR><BR>> >&nbsp;<BR><BR>> >&nbsp;I believe, and so on. <BR><BR>> >I could be wrong. I only thought about it a few minutes. <BR><BR>> >&nbsp;<BR><BR>> >&nbsp;The current incorrect code is: <BR><BR>> ><BR>PROCEDURE Set_compare (s: Size;&nbsp; op: Cmp) =3D<BR>&nbsp; BEGIN<BR>&=<BR>> >nbsp;&nbsp;&nbsp; IF Force_pair (commute :=3D TRUE) THEN<BR>&nbsp;&nbsp;&nb=<BR>> >sp;&nbsp;&nbsp; op :=3D M3CG.SwappedCompare [op];<BR>&nbsp;&nbsp;&nbsp; END=<BR>> >;<BR>&nbsp;&nbsp;&nbsp; IF (s &lt;=3D Target.Integer.size)<BR>&nbsp;&nbsp;&=<BR>> >nbsp;&nbsp;&nbsp; THEN cg.compare (Target.Word.cg_type, Target.Integer.cg_t=<BR>> >ype, op);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE cg.set_compare (AsBytes (s=<BR>> >), op, Target.Integer.cg_type);<BR>&nbsp;&nbsp;&nbsp; END;<BR>&nbsp;&nbsp;&=<BR>> >nbsp; SPop (2, "Set_eq");<BR>&nbsp;&nbsp;&nbsp; SPush (Type.Int32);<BR>&nbs=<BR>> >p; END Set_compare;<BR><BR><BR>> >&nbsp;<BR><BR>> >which generates simply, I think this was &lt;=3D (jbe -- jump if below or e=<BR>> >qual):<BR><BR>> >&nbsp;<BR><BR>> >&nbsp;<BR><BR>> >&nbsp; 0040119C: 56&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=<BR>> >bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=<BR>> >&nbsp;&nbsp; esi<BR>&nbsp; 0040119D: E8 AE FE FF FF&nbsp;&nbsp;&nbsp;&nbsp;=<BR>> > call&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _Main__m<BR>&nbsp; 004011A2=<BR>> >: 83 C4 04&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; add&=<BR>> >nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; esp,4<BR><BR>> >&nbsp;<BR><BR>> >&nbsp;... end of previous line that just called m("foo") <BR><BR>> >&nbsp;<BR><BR>> >&nbsp;; push a string to print <BR><BR>> >&nbsp; 004011A5: 8D 35 2C 12 40 00&nbsp; lea&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=<BR>> >nbsp;&nbsp;&nbsp; esi,ds:[40122Ch]<BR>&nbsp; 004011AB: 56&nbsp;&nbsp;&nbsp;=<BR>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=<BR>> >sp; push&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; esi<BR><BR>> >&nbsp;<BR><BR>> >&nbsp;; compare two sets <BR><BR>> >&nbsp;; one is constant 0x15; one is a global <BR><BR>> >&nbsp; 004011AC: 83 3D 44 90 45 00&nbsp; cmp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=<BR>> >nbsp;&nbsp;&nbsp; dword ptr ds:[459044h],15h<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nb=<BR>> >sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15<BR><BR>> >&nbsp;<BR><BR>> >&nbsp;; spend a while converting the compare result to a boolean <BR>&nbsp;=<BR>> > 004011B3: 0F 96 45 FC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setbe&nbsp=<BR>> >;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte ptr [ebp-4]<BR>&nbsp; 004011B7: 33 DB&=<BR>> >nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=<BR>> >p; xor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ebx,ebx<BR>&nbsp; 00=<BR>> >4011B9: 8A 5D FC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=<BR>> >; mov&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bl,byte ptr [ebp-4]<B=<BR>> >R>&nbsp; 004011BC: 83 FB 00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=<BR>> >&nbsp;&nbsp; cmp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ebx,0<BR>&=<BR>> >nbsp; 004011BF: 0F 94 45 F8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sete&=<BR>> >nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte ptr [ebp-8]<BR>&nbsp; 004011=<BR>> >C3: 33 D2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=<BR>> >&nbsp;&nbsp; xor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edx,edx<BR=<BR>> >>&nbsp; 004011C5: 8A 55 F8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=<BR>> >nbsp;&nbsp; mov&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dl,byte ptr=<BR>> > [ebp-8]<BR><BR><BR>> >&nbsp;; and then push that boolean <BR><BR>> >&nbsp; 004011C8: 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=<BR>> >bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=<BR>> >&nbsp;&nbsp; edx<BR><BR>> >&nbsp; 004011C9: E8 6C FF FF FF&nbsp;&nbsp;&nbsp;&nbsp; call&nbsp;&nbsp;&nb=<BR>> >sp;&nbsp;&nbsp;&nbsp;&nbsp; _Main__checkM<BR><BR><BR><BR>> >oh, you are right, &lt; needs to also be !=3D.<BR><BR>> >I thought it was suspicious to have only two implementations of four operat=<BR>> >ions, but I did like the resulting efficiency. :)<BR><BR>> Hey, I was at least sure the current code was wrong.<BR><BR>> >&nbsp;<BR><BR>> >&nbsp;- Jay<BR><BR><BR><BR><BR>> ><BR>> ><HR id=3DstopSpelling><BR>> ><BR><BR>> >&gt; To: jayk123@hotmail.com<BR>&gt; Subject: Re: [M3devel] small set compa=<BR>> >risons understood, now just to understand the front end code.. <BR>&gt; Dat=<BR>> >e: Mon, 14 Apr 2008 10:16:01 -0700<BR>&gt; From: mika@async.caltech.edu<BR>=<BR>> >&gt; <BR>&gt; Jay writes:<BR>&gt; &gt;--_6435b74a-d943-44c2-9091-ab0408dc7e=<BR>> >d0_<BR>&gt; &gt;Content-Type: text/plain; charset=3D"iso-8859-1"<BR>&gt; &g=<BR>> >t;Content-Transfer-Encoding: quoted-printable<BR>&gt; &gt;<BR>&gt; &gt;<BR>=<BR>> >&gt; &gt;currently set &lt;,&gt;,&lt;=3D3D,&gt;=3D3D are implemented merely=<BR>> > as<BR>&gt; &gt;integer &lt;,&gt;,&lt;=3D3D,&gt;=3D3D<BR>&gt; &gt;=3D20<BR>=<BR>> >&gt; &gt;This is wrong.<BR>&gt; &gt;=3D20<BR>&gt; &gt;I believe it should b=<BR>> >e:<BR>&gt; &gt;=3D20<BR>&gt; &gt;a &lt; b =3D3D&gt; (a &amp; b) =3D3D=3D3D =<BR>> >a<BR>&gt; &gt;a &lt;=3D3D b =3D3D&gt; (a &amp; b) =3D3D=3D3D a (same as &lt=<BR>> >;=3D3D)<BR>&gt; &gt;a &gt; b =3D3D&gt; (a &amp; b) =3D3D=3D3D b<BR>&gt; &gt=<BR>> >;a &gt;=3D3D b =3D3D&gt; (a &amp; b) =3D3D=3D3D b (same as &gt;)<BR>&gt; <B=<BR>> >R>&gt; You don't actually mean logical implication by your arrows do you,<B=<BR>> >R>&gt; but equivalence, where the objects to the left of the arrow refer<BR=<BR>> >>&gt; to the abstract sets a and b and the objects to the right of the<BR>&=<BR>> >gt; arrow refer to bit-vector implementations (in C) of the same?<BR>&gt; <=<BR>> >BR>&gt; Green Book, page 57, section 2.6.1:<BR>&gt; <BR>&gt; "In all cases,=<BR>> > x &lt; y means (x &lt;=3D y) AND (x # y), and x &gt; y means y &lt; x."<BR=<BR>> >>&gt; <BR>&gt; So in your syntax a &gt; b would be ((a &amp; b) =3D=3D a) &=<BR>> >amp;&amp; (a !=3D b).<BR>&gt; <BR>&gt; Also, just above it, <BR>&gt; <BR>&g=<BR>> >t; "The expression x &gt;=3D y is equivalent to y &lt;=3D x."<BR>&gt; <BR>&=<BR>> >gt; Why not define the operation "x &gt;=3D y" and then use the two stateme=<BR>> >nts<BR>&gt; from the Green Book to generate the rest?<BR>&gt; <BR>&gt; Mika=<BR>> ><BR><BR></body><BR>> ></html>=<BR>> ><BR>> >--_a67e670a-e4c4-4f68-a1a3-4f4661e52338_--<BR><BR></body>
</html>