# The second engine

By dhilipsiva. Prose: CC BY 4.0.

Canonical: https://dhilipsiva.dev/rights-nobody-has-to-earn/second-engine/

The constitution's rules were translated, statement by statement, into the input language of clingo 5.8.2, a separate answer set solver: 9,575 clingo statements. The cases below were replayed through it, 129 cases and 1,673 queries, each answer compared with the verdict its pin records. Every answer agrees with the verdict its pin records.

## Where it stops

> It is a cross-check within this project, not an independent reproduction: a misreading shared by both engines would pass both.

From the method's section “What has been checked, and where each check stops”.

## What the translation keeps

- Constants become quoted strings, and `$variables` become clingo variables.
- `event { eats() }` becomes the constant "event:eats".
- `~atom` is negation as failure, `~($a = $b)` is `!=`, and `($a = $b)` is `=`.
- A disjunction inside a rule body becomes one rule per disjunct.
- `entitled(every person, event { P() })` becomes a rule from `person`.
- `:accept` statements are asserted, as Nibli keeps them.
- Each query is answered against the stable model of everything asserted before it, which for a stratified program is the perfect model Nibli computes.

## What the comparison leaves out

- `admits` and `derived_only` declarations are dropped, because clingo refuses no input, so a statement Nibli refuses is never asserted.
- `:refuse`, `:accept-scoped` and `:require` statements are skipped, so refusals, scoped loadability and shell checks are not compared.
- Contradiction scans are not compared.
- Only cases on the live source run; a counterfactual case edits the source.

## The cases replayed

| Case | Queries | Answers that differ |
|---|---|---|
| `book-1/01-the-child-with-nobody` | 60 | 0 |
| `book-1/01-the-child-with-nobody (pins merged from 02-who-counts)` | 29 | 0 |
| `book-1/03-what-you-are-owed` | 83 | 0 |
| `book-1/04-whether-it-arrived` | 20 | 0 |
| `book-1/23-the-shield` | 59 | 0 |
| `book-1/25-a-prisoner-is-a-person` | 36 | 0 |
| `book-1/26-where-people-are-put` | 73 | 0 |
| `book-1/27-the-one-thing-taken` | 41 | 0 |
| `book-1/source/delivery-receipt` | 36 | 0 |
| `book-1/source/rights-floor` | 81 | 0 |
| `book-1/source/universal-standing` | 32 | 0 |
| `custody/adjudication` | 25 | 0 |
| `custody/authority-lapse` | 12 | 0 |
| `custody/closed-conclusions` | 0 | 0 |
| `custody/execution` | 50 | 0 |
| `custody/filing-subject-binding` | 5 | 0 |
| `custody/intake-missing-CustodyIntakeAccessScope` | 4 | 0 |
| `custody/intake-missing-CustodyIntakeCaseScope` | 4 | 0 |
| `custody/intake-missing-CustodyIntakeEpochScope` | 4 | 0 |
| `custody/intake-missing-CustodyIntakeProtectionScope` | 4 | 0 |
| `custody/intake-missing-CustodyIntakeReconciliationScope` | 4 | 0 |
| `custody/intake-missing-CustodyIntakeSubjectScope` | 4 | 0 |
| `custody/intake-missing-CustodyIntakeWindowScope` | 4 | 0 |
| `custody/merits-conflicting-proof` | 2 | 0 |
| `custody/merits-disqualified-at-decision` | 2 | 0 |
| `custody/merits-missing-CustodyAdmissibilityScope` | 5 | 0 |
| `custody/merits-missing-CustodyConductScope` | 5 | 0 |
| `custody/merits-missing-CustodyDefencesScope` | 5 | 0 |
| `custody/merits-missing-CustodyEvidenceScope` | 5 | 0 |
| `custody/merits-missing-CustodyFinalityScope` | 5 | 0 |
| `custody/merits-missing-CustodyIncidentScope` | 5 | 0 |
| `custody/merits-missing-CustodyOffenceScope` | 5 | 0 |
| `custody/merits-missing-CustodyPriorLawScope` | 5 | 0 |
| `custody/merits-missing-CustodyProcedureScope` | 5 | 0 |
| `custody/merits-missing-CustodyProofScope` | 5 | 0 |
| `custody/merits-missing-CustodyProsecutorScope` | 5 | 0 |
| `custody/merits-missing-CustodySentenceScope` | 5 | 0 |
| `custody/merits-missing-CustodySubjectScope` | 5 | 0 |
| `custody/merits-missing-CustodyVictimScope` | 5 | 0 |
| `custody/merits-no-authority` | 2 | 0 |
| `custody/merits-prosecutor-reviewer` | 2 | 0 |
| `custody/merits-self-review` | 2 | 0 |
| `custody/merits-subject-reviewer` | 2 | 0 |
| `custody/merits-victim-reviewer` | 2 | 0 |
| `custody/placement-absent-place` | 4 | 0 |
| `custody/placement-conflicting-place` | 4 | 0 |
| `custody/placement-missing-CustodyPlacementAlternativeScope` | 5 | 0 |
| `custody/placement-missing-CustodyPlacementAvailabilityScope` | 5 | 0 |
| `custody/placement-missing-CustodyPlacementEpochScope` | 5 | 0 |
| `custody/placement-missing-CustodyPlacementLeaseScope` | 5 | 0 |
| `custody/placement-missing-CustodyPlacementNecessityScope` | 5 | 0 |
| `custody/placement-missing-CustodyPlacementPlaceScope` | 5 | 0 |
| `custody/placement-missing-CustodyPlacementProcedureScope` | 5 | 0 |
| `custody/placement-missing-CustodyPlacementWindowScope` | 5 | 0 |
| `custody/placement-nonsevere-in-highsec` | 4 | 0 |
| `custody/placement-self-review` | 4 | 0 |
| `custody/placement-severe-at-home` | 4 | 0 |
| `custody/placement-uncredentialed` | 4 | 0 |
| `custody/placement-unknown-kind` | 4 | 0 |
| `custody/positive-isolation-findings` | 44 | 0 |
| `custody/raw-flags` | 11 | 0 |
| `custody/relief-BarOnRepeatedProceedings` | 6 | 0 |
| `custody/relief-ConvictionQuashedWithoutRetrial` | 6 | 0 |
| `custody/relief-CourtJurisdictionOrIndependenceDefect` | 6 | 0 |
| `custody/relief-DefenceOfOthersEstablished` | 6 | 0 |
| `custody/relief-DuressEstablished` | 6 | 0 |
| `custody/relief-FinalAcquittal` | 6 | 0 |
| `custody/relief-IdentityOrOffenceNotProved` | 6 | 0 |
| `custody/relief-IncapacityOrAbsentRequiredElementEstablished` | 6 | 0 |
| `custody/relief-NecessityEstablished` | 6 | 0 |
| `custody/relief-SelfDefenceEstablished` | 6 | 0 |
| `custody/relief-SentenceSatisfied` | 6 | 0 |
| `custody/relief-binding-conflict` | 2 | 0 |
| `custody/relief-binding-future-order` | 2 | 0 |
| `custody/relief-binding-no-authority` | 2 | 0 |
| `custody/relief-binding-no-procedure` | 2 | 0 |
| `custody/relief-binding-wrong-case` | 2 | 0 |
| `custody/relief-binding-wrong-evidence` | 2 | 0 |
| `custody/relief-binding-wrong-incident` | 2 | 0 |
| `custody/relief-binding-wrong-offence` | 2 | 0 |
| `custody/relief-binding-wrong-subject` | 2 | 0 |
| `custody/relief-party-prosecutor-actor` | 2 | 0 |
| `custody/relief-party-prosecutor-reviewer` | 2 | 0 |
| `custody/relief-party-self-review-actor` | 2 | 0 |
| `custody/relief-party-self-review-reviewer` | 2 | 0 |
| `custody/relief-party-subject-actor` | 2 | 0 |
| `custody/relief-party-subject-reviewer` | 2 | 0 |
| `custody/relief-party-trial-adjudicator-actor` | 2 | 0 |
| `custody/relief-party-trial-adjudicator-reviewer` | 2 | 0 |
| `custody/relief-party-trial-reviewer-actor` | 2 | 0 |
| `custody/relief-party-trial-reviewer-reviewer` | 2 | 0 |
| `custody/relief-party-victim-actor` | 2 | 0 |
| `custody/relief-party-victim-reviewer` | 2 | 0 |
| `custody/severity-boundary` | 221 | 0 |
| `delivery/no-receipt-no-arrival` | 13 | 0 |
| `delivery/provider-cannot-witness-itself` | 3 | 0 |
| `delivery/received-outside-custody` | 10 | 0 |
| `placement/confined-notsevere-family-home` | 14 | 0 |
| `placement/confined-notsevere-family-nohome` | 15 | 0 |
| `placement/confined-notsevere-nofamily-home` | 14 | 0 |
| `placement/confined-notsevere-nofamily-nohome` | 15 | 0 |
| `placement/confined-severe-family-home` | 14 | 0 |
| `placement/confined-severe-family-nohome` | 14 | 0 |
| `placement/confined-severe-nofamily-home` | 14 | 0 |
| `placement/confined-severe-nofamily-nohome` | 14 | 0 |
| `placement/free-notsevere-family-home` | 14 | 0 |
| `placement/free-notsevere-family-nohome` | 14 | 0 |
| `placement/free-notsevere-nofamily-home` | 14 | 0 |
| `placement/free-notsevere-nofamily-nohome` | 14 | 0 |
| `placement/free-severe-family-home` | 14 | 0 |
| `placement/free-severe-family-nohome` | 14 | 0 |
| `placement/free-severe-nofamily-home` | 14 | 0 |
| `placement/free-severe-nofamily-nohome` | 14 | 0 |
| `placement/independent-shelter-control` | 4 | 0 |
| `placement/registered-notsevere-family-home` | 14 | 0 |
| `placement/registered-notsevere-family-nohome` | 14 | 0 |
| `placement/registered-notsevere-nofamily-home` | 14 | 0 |
| `placement/registered-notsevere-nofamily-nohome` | 14 | 0 |
| `placement/registered-severe-family-home` | 14 | 0 |
| `placement/registered-severe-family-nohome` | 14 | 0 |
| `placement/registered-severe-nofamily-home` | 14 | 0 |
| `placement/registered-severe-nofamily-nohome` | 14 | 0 |
| `placement/standing-omitted` | 1 | 0 |
| `stress/agency-and-contractor-blame` | 16 | 0 |
| `stress/captured-appointments` | 8 | 0 |
| `stress/core-read-expansively` | 15 | 0 |
| `stress/election-cannot-be-held` | 22 | 0 |
| `stress/manipulated-urgency` | 15 | 0 |
| `stress/never-recorded-person` | 22 | 0 |

[The report](https://github.com/dhilipsiva/rights-nobody-has-to-earn/blob/main/book-1/source/measurements/second-engine-report.md) · [The translator](https://github.com/dhilipsiva/rights-nobody-has-to-earn/blob/main/tools/second_engine.py)
