# Re: [tlaplus] Defining Cardinality with TLA

That is what I needed to see as I am new to all this, with no idea where to start.

On Friday, April 26, 2024 at 4:39:07 PM UTC+12 Stephan Merz wrote:
P.S.: Proofs of these theorems checked by TLAPS are given in https://github.com/tlaplus/tlapm/blob/main/library/FiniteSetTheorems_proofs.tla.

On 26 Apr 2024, at 06:37, Stephan Merz <Stepha...@xxxxxxxxx> wrote:

As Markus pointed out, cardinality of finite sets is defined in a standard module of TLA+. A collection of lemmas about finite sets and cardinality, useful for actually reasoning about these notions, is available at https://github.com/tlaplus/tlapm/blob/main/library/FiniteSetTheorems.tla (included in the distribution of TLAPS).

Stephan

On 26 Apr 2024, at 02:22, marta zhango <marta...@xxxxxxxxx> wrote:

Is the line

IN  CS[S]

part of the definition of cardinality ?

On Friday, April 26, 2024 at 11:55:57 AM UTC+12 Markus Kuppe wrote:
https://github.com/tlaplus/tlaplus/blob/03c7bf4f35ccf1217ac2c53e5bf60d1220c8b0d8/tlatools/org.lamport.tlatools/src/tla2sany/StandardModules/FiniteSets.tla#L21-L27

> On Apr 25, 2024, at 4:53 PM, marta zhango <marta...@xxxxxxxxx> wrote:
>
> Have thought something like this too
>
> Cardinality(set) == (+ e \in DOMAIN set: IF set[e] THEN 1 ELSE 0)
>
> On Friday, April 26, 2024 at 9:17:00 AM UTC+12 marta zhango wrote:
> Like this for instance ?
>
> Cardinality (S) = |S| == Count ( e \in S )
>
>
> On Friday, April 26, 2024 at 8:36:13 AM UTC+12 marta zhango wrote:
> How can I define the cardinality of a set as the number of elements in a set S
> using the notation |S| using TLA.

--
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.