The following code:
expect x <~ categorical([0.5, 0.5]):
x
generates
(summate x4
from 0
to size
(array x3 of size(x1):
x1[x3]
* (x1 = [1/2, 1/2]
x2 = summate x0 from 0 to size(x1): x1[x0]
if 0/1 < x2: nat2prob(x3) else: 0/1)):
(array x3 of size(x1):
x1[x3]
* (x1 = [1/2, 1/2]
x2 = summate x0 from 0 to size(x1): x1[x0]
if 0/1 < x2: nat2prob(x3) else: 0/1))
[x4])
/ x2
which is incorrect because:
Name not in scope: x1
4| (array x3 of size(x1):