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

*From*: Stephan Merz <stephan.merz@xxxxxxxxx>*Date*: Mon, 23 Dec 2019 12:22:48 +0100*References*: <076e423b-fe5b-4046-a9c4-bb7077e80f01@googlegroups.com>

Hello, using the generic definitions Range(f) == { f[x] : x \in DOMAIN f } Min(S) == CHOOSE s \in S : \A t \in S : s <= t you can write Min(Range(f)) to denote the minimum value that a function f takes, and TLC will be able to evaluate that _expression_ as long as the domain of f is non-empty and finite. The generalization to find the N smallest values is left as an exercise to the reader. :-) Evaluating the above definitions takes quadratic time in the domain of the function. If your function has a somewhat big domain and if both domain and co-domain are ordered, it may be worthwhile to sort the array (function) first. 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/3C7DBF0C-D094-4360-97B0-C1BA42D07103%40gmail.com. |

**Follow-Ups**:**Re: [tlaplus] TLA+ minimum of function/sequence***From:*Thomas Gebert

**References**:**[tlaplus] TLA+ minimum of function/sequence***From:*Thomas Gebert

- Prev by Date:
**[tlaplus] TLA+ minimum of function/sequence** - Next by Date:
**Re: [tlaplus] TLA+ minimum of function/sequence** - Previous by thread:
**[tlaplus] TLA+ minimum of function/sequence** - Next by thread:
**Re: [tlaplus] TLA+ minimum of function/sequence** - Index(es):