Re: [tlaplus] AND operator

23 views
Skip to first unread message

Diep Chi Pham

unread,
Feb 10, 2021, 5:41:39 PM2/10/21
to tla...@googlegroups.com
Hi,

I think:  IF  x = .. /\ y = ..  THEN ...

Cheers,
DC

On Wed, Feb 10, 2021 at 9:31 PM Anshu ranjan <a.ranj...@gmail.com> wrote:
Hi, I have a beginner's question:
If I want to write the following clause:

IF x=true and y=true
THEN do z

How can write this in TLA+? Specifically how do I write the and operator?

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/407236e0-4a88-4ced-b3f2-629a252ddba9n%40googlegroups.com.

Anshu ranjan

unread,
Feb 10, 2021, 7:44:51 PM2/10/21
to tlaplus
Yeah I it was indeed just /\. 
What I was missing is an else statement.. So I added:  else TRUE, and it worked fine.

Freeman, Steve

unread,
Feb 11, 2021, 4:40:44 AM2/11/21
to tla...@googlegroups.com

If you use a font like FiraCode with ligatures for technical symbols like this, the code becomes more readable.

Martin

unread,
Feb 11, 2021, 4:55:39 AM2/11/21
to tla...@googlegroups.com
Hello,

Just a remark if you are designing your Next state relation: this is often
written as a disjunction of actions (which makes non-determinism possible). What
you might want to write could be along the lines of:

\/ (x /\ y /\ z' = 42)
\/ (x /\ ~y /\ z' = 11)
\/ (~x /\ z' = 23)

This amounts to stating "if x and y hold, then the next value of z is 42, if x
but not y holds, then the next value of z is 11; if x does not hold then the
next value of z is 23". In this example all cases are mutually exclusive but
that's not necessary (e.g. just remove the /\ y from the first line).

hope this helps! kind regards,
Martin


On 2/10/21 9:31 PM, Anshu ranjan wrote:
> Hi, I have a beginner's question:
> If I want to write the following clause:
>
> IF x=true and y=true
> THEN do z
>
> How can write this in TLA+? Specifically how do I write the and operator?
>
> --
> You received this message because you are subscribed to the Google Groups
> "tlaplus" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to tlaplus+u...@googlegroups.com
> <mailto:tlaplus+u...@googlegroups.com>.
> <https://groups.google.com/d/msgid/tlaplus/407236e0-4a88-4ced-b3f2-629a252ddba9n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Anshu ranjan

unread,
Feb 12, 2021, 1:07:38 PM2/12/21
to tlaplus
Thank you all for the help. I ended up using IF .. THEN .. ELSE TRUE, which seemed easiest.
Reply all
Reply to author
Forward
0 new messages