
A property test does not check an answer. It checks a rule. Instead of asserting that `sort([3, 1, 2])` gives `[1, 2, 3]`, you assert that for any list, the result is ordered, has the same length, and holds the same elements. The framework generates the lists, including the empty one and the one full of duplicates that nobody would have typed by hand.

Vary has this built into the test DSL. The keyword is `across`.

```vary
test "concatenation adds lengths" {
    across(a: Str, b: Str) {
        observe len(a + b) == len(a) + len(b)
    }
}
```

[Across the bridge](/articles/across-the-bridge/) covers the mechanics. This post is about how `across` fits with mutation testing and agents, and about vocabulary, since the same testing term often means different things in different tools.

## A weak property still passes

The weak spot in a property test is the property. A test that says `len(sort(xs)) == len(xs)` runs 100 generated inputs and passes. A `sort` that returns its input unchanged passes too. Generating more inputs does not make a weak claim stronger.

Mutation testing catches this. `vary mutate` makes small changes to your code, like flipping a comparison or swapping an operator, and reruns your tests against each change. If the changed program still passes, the tests did not notice. That is a surviving mutant, and it usually means a property is too loose.

The techniques answer different questions.

| Technique | What it answers | What it cannot tell you |
|-----------|-----------------|-------------------------|
| Example test | Does this specific input give this specific output? | Anything about inputs you did not write down |
| `across` property | Does this rule hold over many generated inputs? | Whether the rule is strong enough to catch a real bug |
| `vary mutate` | Would the suite notice if the code were wrong? | Whether the code does what the user wanted in the first place |
| Contracts and proofs | Does this hold for every call, or provably for all inputs in scope? | Behaviour the contract does not mention |

Each mutant is run against every generated input in every `across` block, so it has to get past far more than three hand-picked examples to survive.

## Why this suits agents

Property tests and mutation runs are tedious to write by hand, and an agent can write them in volume. It can read a function, propose the laws the function should obey, write the `across` blocks, run `vary mutate`, and treat the survivors as a to-do list. Each survivor names a specific change the suite missed, so the next step is concrete: tighten a property or add a case.

The payoff comes later. When an agent or a person edits the code next month, the generated inputs and the mutation score catch the regression, and nobody has to remember what the old behaviour was.

There is one trap. An agent that derives its properties from the implementation will encode the implementation's bugs as the specification. Properties should come from what the code is supposed to do: the requirements, the contract, the documented behaviour. Survivors help here too, because properties copied from the code tend to be the ones that let mutants through.

## One map of testing names

QuickCheck, Hypothesis, PIT, and Vary each use slightly different words for the same ideas. This table maps the common terms to Vary's.

| Common term | In Vary | Notes |
|-------------|---------|-------|
| Property test | `across(...) { observe ... }` inside a `test` block | A test that holds over generated inputs |
| Property | The `observe` lines inside an `across` block | The rule that must hold for every input |
| Assertion, oracle | `observe` | The point where the test decides pass or fail |
| Generator, strategy | The declared binding type, as in `x: Int` | Values are generated from the type, no registration step |
| Case, example, run | One iteration of an `across` block | Count set with `--across-cases`, default 100 |
| Seed | `--across-seed` | Same seed, same inputs, same failure |
| Counterexample | The failing input in the test output | Reported with the seed and iteration number |
| Shrinking | Minimizing a failing input before reporting | On by default, controlled with `--across-max-shrink` and `--no-across-shrink` |
| Mutant | A small deliberate change to your code | Produced by `vary mutate` |
| Killed mutant | A mutant that made a test or contract fail | Evidence the suite notices that kind of fault |
| Surviving mutant | A mutant that still passed every test | Evidence of a missing or weak check |
| Mutation score | Share of mutants killed | Measures the suite, not the code |
| Contract | `in {}`, `out (result) {}`, and invariants | Checked on every call, not only inside tests |
| Proof | `vary prove` | Establishes a property for all inputs in scope instead of sampling |

The [glossary](/docs/glossary/) has a shorter version of this table.

## Try it

Pick a function you trust and write the laws it should obey. Then run the mutation tool to see which changes those laws miss.

```bash
vary test .
vary mutate .
```

Identities, inverses, and ordering rules are good first properties. After that, the survivors show where to go next. For the full reference, see the [testing docs](/docs/test-dsl/) and the [mutation workflow](/docs/mutation/workflow/).
