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

Re: [tlaplus] Understanding CHOOSE



CHOOSE is definitely a confusing operator, many people have problems with it including myself. The idea is that CHOOSE always picks the same value, it does not represent arbitrary values.

If you're trying to say "sub can be any element of ClaimsData", then the "there exists" operator (existential quantification) is what you're looking for, i.e.

\E sub \in ClaimsData: SomePredicate(sub)

or something thereabout. If we are thinking in terms of predicates on the state space, this returns true for _every_ next state where sub is an element of ClaimsData and SomePredicate(sub) is true. Which path the algorithm takes during a single algorithm execution is the "random" part, but the specification should describe all possible paths with no randomness. 



On Wed, Jan 20, 2021 at 4:38 AM Park Lay <younesagma@xxxxxxxxx> wrote:
Hello,

I am new to TLA+ and I'm trying to understand the how does the keyword CHOOSE work in TLA+. I have already read the available documentation but I don't think I fully grasp how it works.

I have this in my module :

CHOOSE sub \in ClaimsData : TRUE such that ClaimsData <- {0..10}

Can you please help me understand what really is happening here ? What I'm trying to achieve is to pick a "random" value... but I know that this is not non-deterministic.. I'm really confused..

Thank you!

--
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/efa2ccc2-0fe0-49ad-b893-d7fd286193f0n%40googlegroups.com.


--
- Alex Weisberger, Senior Software Engineer: House Manage

--
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/CAC7YZZkjf4pZ9hYsHoNF7Uvn63eBC34wzix5Dyv983SU6zmJMg%40mail.gmail.com.