docs← Back to article

Markdown for LLMs

At least two of three

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# At least two of three

## Intention

I want to check a vote threshold in an explicitly complete finite body.

A threshold needs a declared completeness flag: the scenes check one of three, two of three, missing completeness, and a completion cycle.

## Incorrect form and why it stays silent

```text title="Incorrect form"
when count(collect p: Person where member(p)) == 3 and count(collect p: Person where member(p) and yes(p)) >= 2;
```

Without a completeness flag three known members are treated as the full body. The yes producer must finish before count: the aggregate reads a frozen layer.

## Correct form

```law
language "law.core" version "0.2";
package recipes.l.r07 version "0.1.0";
namespace "urn:recipe:l-calc:07";

entity Person;
relation member(p: Person);
relation ballot(p: Person);
relation yes(p: Person);
relation complete();
relation quorum();
rule Positive strict { for p: Person; when ballot(p); then yes(p); }
rule Quorum strict {
    when complete() and count(collect p: Person where member(p)) == 3
        and count(collect p: Person where member(p) and yes(p)) >= 2;
    then quorum();
}
```

## Frozen execution scene

| Facts and choice | Question | Answer |
|---|---|---|
| 1. one of three | `truth(quorum())` | `NEITHER` / `COMPUTED` |
| 2. two of three, completeness known | `truth(quorum())` | `TRUE_ONLY` / `COMPUTED` |
| 3. two known votes, completeness not declared | `truth(quorum())` | `NEITHER` / `COMPUTED` |
| 4. counterfactual: completeness check removed | `truth(quorum())` | `TRUE_ONLY` / `COMPUTED` |

```law
test "one of three" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert member(entity_ref("urn:recipe:l-calc:07:a")); assert member(entity_ref("urn:recipe:l-calc:07:b")); assert member(entity_ref("urn:recipe:l-calc:07:c")); assert ballot(entity_ref("urn:recipe:l-calc:07:a")); assert complete();
    }
    evaluate truth(quorum());
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
    
}
```

```law
test "two of three, completeness known" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert member(entity_ref("urn:recipe:l-calc:07:a")); assert member(entity_ref("urn:recipe:l-calc:07:b")); assert member(entity_ref("urn:recipe:l-calc:07:c")); assert ballot(entity_ref("urn:recipe:l-calc:07:a")); assert ballot(entity_ref("urn:recipe:l-calc:07:b")); assert complete();
    }
    evaluate truth(quorum());
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
    
}
```

```law
test "two known votes, completeness unclaimed" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert member(entity_ref("urn:recipe:l-calc:07:a")); assert member(entity_ref("urn:recipe:l-calc:07:b")); assert member(entity_ref("urn:recipe:l-calc:07:c")); assert ballot(entity_ref("urn:recipe:l-calc:07:a")); assert ballot(entity_ref("urn:recipe:l-calc:07:b"));
    }
    evaluate truth(quorum());
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
    
}
```

```law
test "completeness check removed" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert member(entity_ref("urn:recipe:l-calc:07:a")); assert member(entity_ref("urn:recipe:l-calc:07:b")); assert member(entity_ref("urn:recipe:l-calc:07:c")); assert ballot(entity_ref("urn:recipe:l-calc:07:a")); assert ballot(entity_ref("urn:recipe:l-calc:07:b"));
    }
    evaluate truth(quorum());
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
    
}
```



## Counterfactual

Mutation: `for p: Person; when ballot(p);` → `for p: Person; when ballot(p) and quorum();`; expected `LDC-E4102`. Additional counterfactuals are shown as separate table rows.

## Boundary

Threshold and full body are given as conditions; a different denominator or weighted votes needs a different rule.

## Pitfall

Without the completeness flag, known members are silently treated as the full body.