Surjective functions as records

41 views
Skip to first unread message

Siegfried Bublitz

unread,
Nov 5, 2023, 10:53:43 AM11/5/23
to tla...@googlegroups.com
Hi all,

I can filter a set of functions to contain just the surjective functions like this:

{m \in [1..2 -> 3..4] : \A j \in 3..4 : \E i \in DOMAIN m: m[i] = j}

yielding the expected result:

{<<3, 4>>, <<4, 3>>}


When I try the same filtering with surjective records:

{m \in [a: 3..4, b: 3..4] : \A j \in 3..4 : \E i \in DOMAIN m: m.i = j}

the following error message is displayed:


The `Evaluate Constant Expression� section�s evaluation failed.

Attempted to apply the operator overridden by the Java method
public static tlc2.value.impl.Value tlc2.module.TLC.PrintT(tlc2.value.impl.Value),
but it produced the following error:
Attempted to select nonexistent field "i" from the record
[a |-> 3, b |-> 3]
m.i


What is the reason for this different behaviours?

Advices are appreciated,

Siegfried Bublitz

Stephan Merz

unread,
Nov 5, 2023, 12:53:18 PM11/5/23
to tla...@googlegroups.com
I haven't tried this but the domain of your record is {"a", "b"}, so I'd try to write 

\E i \in DOMAIN m : m[i] = j

just as for functions. Remember that records *are* functions.

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/CAL%2B9cEp8ke8AcfpRHfrazmcOSuPcv6Ac5bvXGuvMVYRXR0mr3g%40mail.gmail.com.

Hillel Wayne

unread,
Nov 5, 2023, 7:36:03 PM11/5/23
to 'Alex Weisberger' via tlaplus
The reason it didn't work before is that m.i is syntax sugar for m["i"], not m[i].

H

Siegfried Bublitz

unread,
Nov 6, 2023, 1:53:44 AM11/6/23
to tla...@googlegroups.com
This works, thank you, Stephan + Hillel

Reply all
Reply to author
Forward
0 new messages