What's wrong with this temporal formula?

83 views
Skip to first unread message

c.burge...@gmail.com

unread,
Apr 30, 2021, 8:39:23 AM4/30/21
to tlaplus
Hi again!

I have the following temporal formula:

y'= 0 \/ y ~0 -> y-1

Which I hope says that the next value of y is  zero or y-1 if y is not zero.

However, when I put this as a property in TLC, I get the error:

Was expecting ===== or more module body, encountered '~' in Properties at line 1 and token 'y'.

Obviously it's not happy with the ~ (equally unhappy with \lnot), but I'm not sure how to proceed from here!

c.burge...@gmail.com

unread,
Apr 30, 2021, 8:46:19 AM4/30/21
to tlaplus
Also tried stating it as :

y ~0 -> y'= y-1, same error

Stephan Merz

unread,
Apr 30, 2021, 8:48:03 AM4/30/21
to tla...@googlegroups.com
Hello,

1. "not equal" is written # in TLA+ (or /=), "~" is Boolean negation.

2. I believe "->" represents implication in your formula, but it is written "=>" in  TLA+.

3. The expressions on both sides of an implication should be Boolean, but the expression on the right-hand side is y-1.

4. The (action) formula corresponding to your informal statement can be written as

\/ y' = 0
\/ y # 0 /\ y' = y-1

A similar formula (but with a slightly different meaning) is

y' = IF y # 0 THEN y-1 ELSE 0

Stephan


--
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/f06df008-8efa-4942-bb93-a2ebbbfe7984n%40googlegroups.com.

c.burge...@gmail.com

unread,
Apr 30, 2021, 9:09:30 AM4/30/21
to tlaplus
Thanks, clearly it doesn't help when I get my logical syntaxes confused!

I now have:

(y=0 /\ y' = 0) \/ (y # 0 /\ y' = y-1)

But when I put this as a property in TLC, I get the error:

"The property ... is not correctly defined."

Stephan Merz

unread,
Apr 30, 2021, 9:17:44 AM4/30/21
to tla...@googlegroups.com
As I wrote, this is an action formula, not a temporal formula expected for properties. If you want to check that this action formula holds at all transitions, you can write

[][(y=0 /\ y' = 0) \/ (y # 0 /\ y' = y-1)]_y

(you may also use the tuple "vars" as the subscript if it includes y).

Stephan


Stephan Merz

unread,
Apr 30, 2021, 9:46:46 AM4/30/21
to tlaplus
P.S.: I realize that I was imprecise in my answer. If you want to check that your action formula holds at all transitions of a system whose variables are contained in the tuple vars, you should write

[][(y=0 /\ y' = 0) \/ (y # 0 /\ y' = y-1)]_vars

However, if you want to check that the formula is true for all transitions that change y, you should write

[][(y=0 /\ y' = 0) \/ (y # 0 /\ y' = y-1)]_y

Stephan

c.burge...@gmail.com

unread,
Apr 30, 2021, 10:04:12 AM4/30/21
to tlaplus
Thanks again! I'm afraid that my learning style is to dive straight in and ask questions when I mess up. You have been so helpful, I really appreciate it.
Reply all
Reply to author
Forward
0 new messages