diff --git a/packages/website/.prettierignore b/packages/website/.prettierignore
new file mode 100644
index 00000000..d858cd65
--- /dev/null
+++ b/packages/website/.prettierignore
@@ -0,0 +1,2 @@
+.docusaurus
+build
diff --git a/packages/website/docs/Features/Functions.mdx b/packages/website/docs/Features/Functions.mdx
index 5e09004c..5cba7c11 100644
--- a/packages/website/docs/Features/Functions.mdx
+++ b/packages/website/docs/Features/Functions.mdx
@@ -9,7 +9,7 @@ _The source of truth for this document is [this file of code](https://github.com
# Inventory distributions
-We provide starter distributions, computed symbolically.
+We provide starter distributions, computed symbolically.
## Normal distribution
@@ -19,6 +19,7 @@ and standard deviation.
### Validity
+
- `sd > 0`
## Uniform distribution
@@ -29,6 +30,7 @@ two given numbers.
### Validity
+
- `low < high`
## Lognormal distribution
@@ -44,13 +46,15 @@ this convinience as lognormal distributions are commonly used in practice.
-### Future feature:
+### Future feature:
+
Furthermore, it's also possible to create a lognormal from it's actual mean
and standard deviation, using `lognormalFromMeanAndStdDev`.
### Validity
+
- `sigma > 0`
- In `x to y` notation, `x < y`
@@ -61,6 +65,7 @@ The `beta(a, b)` function creates a beta distribution with parameters `a` and `b
### Validity
+
- `a > 0`
- `b > 0`
- Empirically, we have noticed that numerical instability arises when `a < 1` or `b < 1`
@@ -73,6 +78,7 @@ rate.
### Validity
+
- `rate > 0`
## Triangular distribution
@@ -81,17 +87,18 @@ The `triangular(a,b,c)` function creates a triangular distribution with lower
bound `a`, mode `b` and upper bound `c`.
### Validity
+
- `a < b < c`
## Scalar (constant dist)
-Squiggle, when the context is right, automatically casts a float to a constant distribution.
+Squiggle, when the context is right, automatically casts a float to a constant distribution.
# Operating on distributions
-Here are the ways we combine distributions.
+Here are the ways we combine distributions.
## Mixture of distributions
@@ -110,10 +117,12 @@ As well as mixed distributions:
-An alias of `mx` is `mixture`
+An alias of `mx` is `mixture`
### Validity
-Using javascript's variable arguments notation, consider `mx(...dists, weights)`:
+
+Using javascript's variable arguments notation, consider `mx(...dists, weights)`:
+
- `dists.length == weights.length`
## Addition (horizontal right shift)
@@ -124,7 +133,7 @@ Using javascript's variable arguments notation, consider `mx(...dists, weights)`
-## Multiplication (??)
+## Multiplication (??)
@@ -136,16 +145,17 @@ Using javascript's variable arguments notation, consider `mx(...dists, weights)`
-## Taking the base `e` and base `10` logarithm
+## Taking the base `e` and base `10` logarithm
### Validity
+
- See [the current discourse](https://github.com/quantified-uncertainty/squiggle/issues/304)
-# Standard functions on distributions
+# Standard functions on distributions
## Probability density function
@@ -155,6 +165,7 @@ given point x.
### Validity
+
- `x` must be a scalar
- `dist` must be a distribution
@@ -166,6 +177,7 @@ or all values lower than x. It is the inverse of `inv`.
### Validity
+
- `x` must be a scalar
- `dist` must be a distribution
@@ -177,6 +189,7 @@ lower than x is equal to prob. It is the inverse of `cdf`.
### Validity
+
- `prob` must be a scalar (please only put it in `(0,1)`)
- `dist` must be a distribution
@@ -194,19 +207,19 @@ The `sample(distribution)` samples a given distribution.
# Normalization
-Some distribution operations (like horizontal shift) return an unnormalized distriibution.
+Some distribution operations (like horizontal shift) return an unnormalized distriibution.
We provide a `normalize` function
-### Valdity
-- Input to `normalize` must be a dist
+### Valdity - Input to `normalize` must be a dist
-We provide a predicate `isNormalized`, for when we have simple control flow
+We provide a predicate `isNormalized`, for when we have simple control flow
-### Validity
+### Validity
+
- Input to `isNormalized` must be a dist
# Convert any distribution to a sample set distribution
@@ -221,3 +234,24 @@ And binary when you provide a number of samples (truncated)
+# `inspect`
+
+You may like to debug by right clicking your browser and using the _inspect_ functionality on the webpage, and viewing the _console_ tab. Then, wrap your squiggle output with `inspect` to log an internal representation.
+
+
+
+Save for a logging side effect, `inspect` does nothing to input and returns it.
+
+# Truncate
+
+You can cut off from the left
+
+
+
+You can cut off from the right
+
+
+
+You can cut off from both sides
+
+
diff --git a/packages/website/docs/Internal/Invariants.md b/packages/website/docs/Internal/Invariants.md
index 633c904b..85fd56be 100644
--- a/packages/website/docs/Internal/Invariants.md
+++ b/packages/website/docs/Internal/Invariants.md
@@ -7,7 +7,7 @@ author:
abstract: This document outlines some properties about algebraic combinations of distributions. It is meant to facilitate property tests for [Squiggle](https://squiggle-language.com/), an estimation language for forecasters. So far, we are focusing on the means, the standard deviation and the shape of the pdfs.
---
-Invariants to check with property tests.
+Invariants to check with property tests.
_This document right now is normative and aspirational, not a description of the testing that's currently done_.
@@ -122,16 +122,18 @@ TODO
TODO
-# `pdf`, `cdf`, and `inv`
+# `pdf`, `cdf`, and `inv`
-With $\forall dist, pdf := x \mapsto \texttt{pdf}(dist, x) \land cdf := x \mapsto \texttt{cdf}(dist, x) \land inv := p \mapsto \texttt{inv}(dist, p)$,
+With $\forall dist, pdf := x \mapsto \texttt{pdf}(dist, x) \land cdf := x \mapsto \texttt{cdf}(dist, x) \land inv := p \mapsto \texttt{inv}(dist, p)$,
## `cdf` and `inv` are inverses
+
$$
\forall x \in (0,1), cdf(inv(x)) = x \land \forall x \in \texttt{dom}(cdf), x = inv(cdf(x))
$$
## The codomain of `cdf` equals the open interval `(0,1)` equals the codomain of `pdf`
+
$$
\texttt{cod}(cdf) = (0,1) = \texttt{cod}(pdf)
$$