I've been hitting the following error in TLA+ toolbox for a few days now in various contexts:
"Attempted to compute the number of elements in the overridden value Nat.".
The following is the simplest module that I've come up with that will reproduce the issue. I've seen some mention of overridden values, but I can't see how I'm doing something in the spec to cause this issue.
Does anyone see the error, or can explain what I'm missing?
-------------------------------- MODULE foo --------------------------------
EXTENDS Naturals
VARIABLE Procs
Init == Procs = 1..5
Next == /\ Procs' = 1..5
Entries == [ i \in Procs |-> [ j \in {} |-> 0] ]
TypeOK == Entries \in [ Procs -> [ (SUBSET Nat) -> Nat ] ]
=============================================================================
When setting TypeOK to the invariant, I get the full error
Attempted to compute the number of elements in the overridden value Nat.
While working on the initial state:
Procs = 1..5
TLC cannot evaluate the set
Nat
, because it is infinite (see also the overridden moduleNaturals.tla
). ReplacingNat
with a finite set via the configuration file is one possible workaround.After doing so, it turns out that
TypeOK
isFALSE
, becauseDOMAIN Entries = Procs
, andProcs # SUBSET Nat
. In other words, the set[ (SUBSET Nat) -> Nat]
contains functions each of which has domain equal toSUBSET Nat
. Instead, what was probably intended is the set of functions with domain equal to some subset ofNat
. This is done below withTypeOKChanged
.and the configuration file
foo.cfg
:The output is
A proof involving the infinite set
Nat
can be pursued with the theorem prover TLAPS. See also Sec. 14.2.3 on pages 234--235 of the TLA+ book the section "Don't Reinvent Mathematics".