{
  "name": "Relational algebra",
  "version": "1.0.0",
  "area": {
    "name": "Relational algebra",
    "slug": "relational-algebra",
    "group": "Computation",
    "kind": "relational",
    "summary": "Check query identities over explicit finite set semantics, and retain counterexamples to invalid rewrites.",
    "definitions": [
      {
        "term": "Set semantics",
        "definition": "Each value occurs at most once; duplicates and NULLs are absent."
      },
      {
        "term": "Relational identity",
        "definition": "Two query expressions with the same output on every admitted relation."
      },
      {
        "term": "Counterexample",
        "definition": "A concrete set assignment making the outputs differ."
      }
    ],
    "methodology": [
      "Enumerate every subset of the universe.",
      "Evaluate both expressions on every triple of sets.",
      "Compare the complete finite-domain outputs.",
      "Replay a concrete sample, including a differing output for a false identity."
    ],
    "complexity": "A universe of n values has 2ⁿ subsets; three relation inputs create 2³ⁿ assignments.",
    "common_error": "SQL bag semantics, NULL values, and outer joins can invalidate a rewrite valid for mathematical sets.",
    "next_question": "Add equijoin trees, bag multiplicities, NULL handling, and an explicit query-cost model.",
    "references": [
      "https://www.postgresql.org/docs/current/explicit-joins.html"
    ]
  },
  "records": [
    {
      "id": "KL-FCS-061",
      "version": "1.0.0",
      "domain": "Relational algebra",
      "kind": "relational",
      "title": "Intersection distributes over union",
      "problem": "Decide the proposed set identity over every triple of finite-universe relations.",
      "specification": {
        "universe_size": 3,
        "law": "intersection-distribution",
        "semantics": "Mathematical sets; unique values; no NULL or tuple multiplicity."
      },
      "claim": {
        "equivalent_on_domain": true
      },
      "witness": {
        "sample": {
          "A": [
            0,
            1
          ],
          "B": [
            1,
            2
          ],
          "C": [
            0
          ],
          "left": [
            0,
            1
          ],
          "right": [
            0,
            1
          ]
        }
      },
      "verification_scope": "Complete relation assignments · 512 triples",
      "explanation": "The finite universe makes every relation assignment enumerable. The sample output illustrates the identity or supplies a direct refutation.",
      "limitations": "Finite enumeration is bounded to this universe; these artifacts do not certify an SQL optimizer or measured execution speed.",
      "verification_status": "mechanically-checked",
      "review_status": "awaiting-independent-review",
      "provenance": {
        "origin": "Original Kenton Labs reference instance, authored with Codex assistance on 2026-10-11.",
        "external_dataset": null,
        "model_run": null
      },
      "references": [
        "https://www.postgresql.org/docs/current/explicit-joins.html"
      ],
      "license_status": "not-yet-selected",
      "dataset": {
        "family": "relational-algebra",
        "task": "Decide the proposed set identity over every triple of finite-universe relations.",
        "input_encoding": "Structured JSON; field meanings are stated in the specification.",
        "coverage": "Complete relation assignments · 512 triples",
        "acceptance": [
          "Enumerate every subset of the universe.",
          "Evaluate both expressions on every triple of sets.",
          "Compare the complete finite-domain outputs.",
          "Replay a concrete sample, including a differing output for a false identity."
        ],
        "generation": "Deterministic finite fixture; full enumeration or witness replay as stated.",
        "split_policy": "Reference corpus for exposition and reproduction; no train/test evaluation split is claimed."
      },
      "lesson": {
        "motivation": "Check query identities over explicit finite set semantics, and retain counterexamples to invalid rewrites.",
        "definitions": [
          {
            "term": "Set semantics",
            "definition": "Each value occurs at most once; duplicates and NULLs are absent."
          },
          {
            "term": "Relational identity",
            "definition": "Two query expressions with the same output on every admitted relation."
          },
          {
            "term": "Counterexample",
            "definition": "A concrete set assignment making the outputs differ."
          }
        ],
        "reasoning": [
          "Enumerate every subset of the universe.",
          "Evaluate both expressions on every triple of sets.",
          "Compare the complete finite-domain outputs.",
          "Replay a concrete sample, including a differing output for a false identity."
        ],
        "worked_example": "The finite universe makes every relation assignment enumerable. The sample output illustrates the identity or supplies a direct refutation.",
        "complexity": "A universe of n values has 2ⁿ subsets; three relation inputs create 2³ⁿ assignments.",
        "common_error": "SQL bag semantics, NULL values, and outer joins can invalidate a rewrite valid for mathematical sets.",
        "further_work": "Add equijoin trees, bag multiplicities, NULL handling, and an explicit query-cost model."
      },
      "related_ids": [
        "KL-FCS-062",
        "KL-FCS-063"
      ]
    },
    {
      "id": "KL-FCS-062",
      "version": "1.0.0",
      "domain": "Relational algebra",
      "kind": "relational",
      "title": "Subtract after a union",
      "problem": "Decide the proposed set identity over every triple of finite-universe relations.",
      "specification": {
        "universe_size": 4,
        "law": "difference-distribution",
        "semantics": "Mathematical sets; unique values; no NULL or tuple multiplicity."
      },
      "claim": {
        "equivalent_on_domain": true
      },
      "witness": {
        "sample": {
          "A": [
            0,
            1
          ],
          "B": [
            1,
            2
          ],
          "C": [
            1
          ],
          "left": [
            0,
            2
          ],
          "right": [
            0,
            2
          ]
        }
      },
      "verification_scope": "Complete relation assignments · 4096 triples",
      "explanation": "The finite universe makes every relation assignment enumerable. The sample output illustrates the identity or supplies a direct refutation.",
      "limitations": "Finite enumeration is bounded to this universe; these artifacts do not certify an SQL optimizer or measured execution speed.",
      "verification_status": "mechanically-checked",
      "review_status": "awaiting-independent-review",
      "provenance": {
        "origin": "Original Kenton Labs reference instance, authored with Codex assistance on 2026-10-11.",
        "external_dataset": null,
        "model_run": null
      },
      "references": [
        "https://www.postgresql.org/docs/current/explicit-joins.html"
      ],
      "license_status": "not-yet-selected",
      "dataset": {
        "family": "relational-algebra",
        "task": "Decide the proposed set identity over every triple of finite-universe relations.",
        "input_encoding": "Structured JSON; field meanings are stated in the specification.",
        "coverage": "Complete relation assignments · 4096 triples",
        "acceptance": [
          "Enumerate every subset of the universe.",
          "Evaluate both expressions on every triple of sets.",
          "Compare the complete finite-domain outputs.",
          "Replay a concrete sample, including a differing output for a false identity."
        ],
        "generation": "Deterministic finite fixture; full enumeration or witness replay as stated.",
        "split_policy": "Reference corpus for exposition and reproduction; no train/test evaluation split is claimed."
      },
      "lesson": {
        "motivation": "Check query identities over explicit finite set semantics, and retain counterexamples to invalid rewrites.",
        "definitions": [
          {
            "term": "Set semantics",
            "definition": "Each value occurs at most once; duplicates and NULLs are absent."
          },
          {
            "term": "Relational identity",
            "definition": "Two query expressions with the same output on every admitted relation."
          },
          {
            "term": "Counterexample",
            "definition": "A concrete set assignment making the outputs differ."
          }
        ],
        "reasoning": [
          "Enumerate every subset of the universe.",
          "Evaluate both expressions on every triple of sets.",
          "Compare the complete finite-domain outputs.",
          "Replay a concrete sample, including a differing output for a false identity."
        ],
        "worked_example": "The finite universe makes every relation assignment enumerable. The sample output illustrates the identity or supplies a direct refutation.",
        "complexity": "A universe of n values has 2ⁿ subsets; three relation inputs create 2³ⁿ assignments.",
        "common_error": "SQL bag semantics, NULL values, and outer joins can invalidate a rewrite valid for mathematical sets.",
        "further_work": "Add equijoin trees, bag multiplicities, NULL handling, and an explicit query-cost model."
      },
      "related_ids": [
        "KL-FCS-061",
        "KL-FCS-063"
      ]
    },
    {
      "id": "KL-FCS-063",
      "version": "1.0.0",
      "domain": "Relational algebra",
      "kind": "relational",
      "title": "Set difference is not commutative",
      "problem": "Decide the proposed set identity over every triple of finite-universe relations.",
      "specification": {
        "universe_size": 2,
        "law": "difference-commutativity",
        "semantics": "Mathematical sets; unique values; no NULL or tuple multiplicity."
      },
      "claim": {
        "equivalent_on_domain": false
      },
      "witness": {
        "sample": {
          "A": [
            0
          ],
          "B": [],
          "C": [],
          "left": [
            0
          ],
          "right": []
        }
      },
      "verification_scope": "Complete relation assignments · 64 triples",
      "explanation": "The finite universe makes every relation assignment enumerable. The sample output illustrates the identity or supplies a direct refutation.",
      "limitations": "Finite enumeration is bounded to this universe; these artifacts do not certify an SQL optimizer or measured execution speed.",
      "verification_status": "mechanically-checked",
      "review_status": "awaiting-independent-review",
      "provenance": {
        "origin": "Original Kenton Labs reference instance, authored with Codex assistance on 2026-10-11.",
        "external_dataset": null,
        "model_run": null
      },
      "references": [
        "https://www.postgresql.org/docs/current/explicit-joins.html"
      ],
      "license_status": "not-yet-selected",
      "dataset": {
        "family": "relational-algebra",
        "task": "Decide the proposed set identity over every triple of finite-universe relations.",
        "input_encoding": "Structured JSON; field meanings are stated in the specification.",
        "coverage": "Complete relation assignments · 64 triples",
        "acceptance": [
          "Enumerate every subset of the universe.",
          "Evaluate both expressions on every triple of sets.",
          "Compare the complete finite-domain outputs.",
          "Replay a concrete sample, including a differing output for a false identity."
        ],
        "generation": "Deterministic finite fixture; full enumeration or witness replay as stated.",
        "split_policy": "Reference corpus for exposition and reproduction; no train/test evaluation split is claimed."
      },
      "lesson": {
        "motivation": "Check query identities over explicit finite set semantics, and retain counterexamples to invalid rewrites.",
        "definitions": [
          {
            "term": "Set semantics",
            "definition": "Each value occurs at most once; duplicates and NULLs are absent."
          },
          {
            "term": "Relational identity",
            "definition": "Two query expressions with the same output on every admitted relation."
          },
          {
            "term": "Counterexample",
            "definition": "A concrete set assignment making the outputs differ."
          }
        ],
        "reasoning": [
          "Enumerate every subset of the universe.",
          "Evaluate both expressions on every triple of sets.",
          "Compare the complete finite-domain outputs.",
          "Replay a concrete sample, including a differing output for a false identity."
        ],
        "worked_example": "The finite universe makes every relation assignment enumerable. The sample output illustrates the identity or supplies a direct refutation.",
        "complexity": "A universe of n values has 2ⁿ subsets; three relation inputs create 2³ⁿ assignments.",
        "common_error": "SQL bag semantics, NULL values, and outer joins can invalidate a rewrite valid for mathematical sets.",
        "further_work": "Add equijoin trees, bag multiplicities, NULL handling, and an explicit query-cost model."
      },
      "related_ids": [
        "KL-FCS-061",
        "KL-FCS-062"
      ]
    }
  ],
  "verification": [
    {
      "id": "KL-FCS-061",
      "status": "mechanically-checked",
      "check_units": 512,
      "scope": "Complete relation assignments · 512 triples",
      "review_status": "awaiting-independent-review"
    },
    {
      "id": "KL-FCS-062",
      "status": "mechanically-checked",
      "check_units": 4096,
      "scope": "Complete relation assignments · 4096 triples",
      "review_status": "awaiting-independent-review"
    },
    {
      "id": "KL-FCS-063",
      "status": "mechanically-checked",
      "check_units": 64,
      "scope": "Complete relation assignments · 64 triples",
      "review_status": "awaiting-independent-review"
    }
  ]
}
