[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlaplus] operator `\sim_x' as defined in erratum differs from TOPLAS



Thank you for your observation. However, looking back at the TOPLAS paper (in the version available from Leslie's home page), I do not see where it defines the relation \sim_x. In particular, equation (49) that you refer to defines the value of

  \sigma[[ \EE x : F ]]

without introducing an auxiliary relation \sim_x, so I think that your comparison is somewhat moot. It is still an interesting observation that for the definition of the flexible quantifier, it is enough to "squeeze and stretch" the original behavior sigma first and then change the values of the bound variable (but I believe this observation was known to Leslie and Martín when the TOPLAS paper was written).

In my paper on the TLA+ semantics [1], I define a relation \simeq_x by (adapting your notation)

sigma \simeq_x tau ==
    \E sigma', tau':
        /\ IsABehavior(sigma') /\ IsABehavior(tau')
        /\ Natural(sigma') = Natural(sigma)
        /\ Natural(tau') = Natural(tau)
        /\ sigma' =_x tau'

and I believe this definition is equivalent to the definition in the new errata sheet to the book; in particular, both are symmetric relations.

Best regards,
Stephan


[1] https://members.loria.fr/SMerz/papers/tla+logic2008.html


On 1 Nov 2016, at 08:52, Ioannis Filippidis <jfili...@xxxxxxxxx> wrote:

Dear Dr. Lamport, TLA+ Users Group,

The operator `\sim_x' appears to be defined differently in the book's errata (version of 28 Oct 2016)
than in the 1994 TOPLAS paper "The temporal logic of actions".

--------------------------------------- EXAMPLE ---------------------------------------

For example, in ZF, let

sigma == [
    n \in Nat |->
    IF n = 0
    THEN [ x |-> 1, y |-> "a" ]
    ELSE IF n = 1
    THEN [ x |-> 2, y |-> "a" ]
    ELSE [ x |-> 2, y |-> "b" ] ]

tau == [
    n \in Nat |->
    IF n = 0
    THEN [ x |-> 999, y |-> "a" ]
    ELSE [ x |-> 999, y |-> "b" ] ]

-----------------------------------------------------------------------------------------------

Using TOPLAS (with Natural defined as in the book, and using the notation
\sim_x to encapsulate the first two conjuncts from Eq.(49)):

sigma \sim_x tau ==
    \E rho:
        /\ IsABehavior(rho)
        /\ Natural(rho) = Natural(sigma)
        /\ rho =_x tau

Natural(sigma) = [
    0 |-> [ x |-> 1, y |-> "a" ],
    1 |-> [ x |-> 2, y |-> "a" ],
    2 |-> [ x |-> 2, y |-> "b" ] ]

PROPOSITION  Rho1 ==
    \A rho:
        /\ IsABehavior(rho)
        /\ rho =_x tau
      => rho[1]["y"] = "b"
PROOF SKETCH:
BY axiom about function equality,
DOMAIN tau = Nat,
DEF IsABehavior,
\A n \in Nat:  DOMAIN rho[n] = VarNames,
"y" \in VarNames,
DEF tau,
DEF =_x.

PROPOSITION  NaturalRho1 ==
    \A rho:
        /\ IsABehavior(rho)
        /\ rho =_x tau
       => Natural(rho)[1]["y"] = "b"
PROOF SKETCH:
BY Rho1,
DEF Natural,
DEF =_x,
DEF tau,
"a" # "b".

PROPOSITION  Unequal ==
    \A rho:
        /\ IsABehavior(rho)
        /\ rho =_x tau
       => Natural(rho) # Natural(sigma)
PROOF SKETCH:
BY NaturalRho1,
DEF Natural,
axiom about function equality.

THEOREM  ~ (sigma \sim_x \tau)
PROOF SKETCH:
BY Unequal, DEF \sim_x.

-----------------------------------------------------------------------------------------------

Using the erratum from 28 Oct 2016:

Overwrite(p, var, value) == [
    n \in Nat |->
    [ p[n] EXCEPT ![var] = value ] ]

sigma \sim_x tau ==
    \E value:
        Natural(Overwrite(sigma, "x", value)) =
        Natural(Overwrite(tau, "x", value))

PROPOSITION  Misc ==
/\ Overwrite(sigma, "x", 999) = [
        n \in Nat |->
        IF n = 0
        THEN [ x |-> 999, y |-> "a" ]
        ELSE IF n = 1
        THEN [ x |-> 999, y |-> "a" ]
        ELSE [ x |-> 999, y |-> "b" ] ]

/\ Overwrite(tau, "x", 999) = tau

/\ Natural(Overwrite(sigma, "x", 999)) = [
    0 |-> [ x |-> 999, y |-> "a" ],
    1 |-> [ x |-> 999, y |-> "b" ] ]

/\ Natural(Overwrite(tau, "x", 999)) = [
    0 |-> [ x |-> 999, y |-> "a" ],
    1 |-> [ x |-> 999, y |-> "b" ] ]

THEOREM  sigma \sim_x tau
PROOF SKETCH:
BY Misc, DEF \sim_x

================================================

The above example also demonstrates that the TOPLAS paper defines the
operator `\sim_x' to be noncommutative, whereas the erratum defines
a commutative operator.

If the above reasoning is correct, then should the erratum be
considered a revision, or should we continue to use the TOPLAS definition?

The TOPLAS definition seems closer to physical intuition.
It does not allow "squeezing" `sigma' too much to obtain `tau'.
If there are steps in `sigma' that change the unhidden variable `x',
then those steps are preserved as nonstuttering ones in `Natural(sigma)',
and so should appear as nonstuttering steps in both `rho' and `tau'.

This ensures that the "refined" behavior `tau' has at least as many nonstuttering
steps as the "coarser" behavior `sigma'. Otherwise (using the erratum),
`tau' could omit steps that in `sigma' change the unhidden `x',
even though those steps could represent visible behavior of other components.
Of course, a shorter `tau' can always be elongated by stuttering,
so this may leave the definition of temporal quantification unaffected.

Two weeks ago, I observed the difference between the earlier erratum (from Oct 2005)
and TOPLAS, and was working on proving it. In case they may be useful to someone,
I have attached the relevant TLA+ file, and a Python script that
applies this earlier definition to the TOPLAS example.

Best regards,
Ioannis Filippidis

--
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...@xxxxxxxxxxxxxxxx.
To post to this group, send email to tla...@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/tlaplus.
For more options, visit https://groups.google.com/d/optout.
<about_temporal_quantifiers.tla><unstutter.py>