Hello, writing a formal specification in a language such as TLA+ is different from writing a program. In particular, efficiency is (in principle) not a concern. From what I understand, you want to maintain a set of records such that when inserting a record, you overwrite any existing record with the same key. One way to define such an insert operation is (* Insert record rcd in set S but overwrite any existing record in S with the same key *) InsertWithUpdate(S, rcd) == (S \ {r \in S : r.key = rcd.key}) \union {rcd} A similar operation can be defined on sequences, but it is a little more cumbersome and will have to be recursive. The easiest way to denote the function with the empty domain in TLA+ is to write << >>. Remember that sequences are functions, too. Hope this helps, 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+unsubscribe@xxxxxxxxxxxxxxxx. To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/B12DF474-2921-44E2-99F6-F6169D0461E5%40gmail.com. |