{"title": "R5: Services: the service table, layers and provision",
 "producer":
 ["GENERATED by tools/Drivers/Semantics.lean (make gen-semantics); do not edit",
  "format: effect4-semantics-report v8",
  "command: make gen-semantics",
  "inputs: tools/ProofGraph/Registry.lean, tools/Tools/Semantics.lean, tools/Drivers/Semantics.lean, tools/Tools/SemanticsDisplay.lean, tools/Tools/SemanticsDocument.lean, tools/Tools/Document.lean, tools/Tools/Document/Json.lean, src/Effect4/Laws/Auto/Semantics.lean, Test/Counterexamples/REGISTER.md, docs/core/decisions.md, lean-toolchain"],
 "format": "effect4-document/1",
 "body":
 [{"lines":
   [[{"text":
      "Open, not triaged: lower_refines_build: the machine's build of a layer refines `build` (decisions row 147)"}],
    [{"text":
      "Open, not triaged: reference keys, Config, minted keys, and context validation at any runtime bridge (system map §8, R5)"}]],
   "kind": "items"},
  {"title": "Requirement R5: Services and layer provision",
   "kind": "part",
   "key": "about:req:R5",
   "body":
   [{"line":
     [{"text":
       "This page explains requirement R5 in Effect4. It covers what the requirement asks for service tables and layers, why static requirement grading matters, and how the property is checked."}],
     "kind": "para"},
    {"title": "What the requirement asks",
     "kind": "part",
     "key": "about:req:R5:what-it-asks",
     "body":
     [{"line":
       [{"text":
         "Requirement R5 demands that services are managed through static service tables in the application typing signature and discharged by layers ("},
        {"code": "docs/core/system-map.md"},
        {"text": " §8):"}],
       "kind": "para"},
      {"lines":
       [[{"text":
          "Service tables: service keys and types form an explicit static component of Σ_app."}],
        [{"text":
          "Value typing: constructed layer values must fit their declared service keys."}],
        [{"text":
          "Flat coeffect grading: requirement rows grade programs by the service keys they need for execution."}],
        [{"text":
          "Capability discharge: providing a layer discharges its output requirement keys."}]],
       "kind": "items"},
      {"line":
       [{"text":
         "A program with an unfilled service requirement must not execute at the top level."}],
       "kind": "para"}]},
    {"title": "Why it matters",
     "kind": "part",
     "key": "about:req:R5:why-it-matters",
     "body":
     [{"line":
       [{"text":
         "Enterprise applications structure dependencies using modular layers that construct database clients, loggers, and authentication handlers."}],
       "kind": "para"},
      {"line":
       [{"text":
         "If requirement rows were untracked, a program could fail at runtime with missing service defects deep inside execution."}],
       "kind": "para"},
      {"line":
       [{"text":
         "Grading a program by its requirement row lets the checker refuse a missing service before the run begins."}],
       "kind": "para"}]},
    {"title": "How it is checked",
     "kind": "part",
     "key": "about:req:R5:how-it-is-checked",
     "body":
     [{"line":
       [{"text":
         "The requirement is checked by proving layer construction, requirement discharge, and context algebra theorems:"}],
       "kind": "para"},
      {"lines":
       [[{"text":
          "Totality of layer building under satisfying contexts is stated by "},
         {"code": "build_total"},
         {"text": " ("},
         {"code": "src/Effect4/Laws/Program/BuildTotal.lean"},
         {"text": ")."}],
        [{"text": "Capability discharge under layer provision is stated by "},
         {"code": "provide_discharges"},
         {"text": " ("},
         {"code": "src/Effect4/Program/Provision.lean"},
         {"text": ")."}],
        [{"text": "Closure of layer composition is stated by "},
         {"code": "provide_closed"},
         {"text": " in the same file."}],
        [{"text": "Commutativity of row merging is stated by "},
         {"code": "merge_rows_comm"},
         {"text": " in the same file."}]],
       "kind": "items"},
      {"line":
       [{"text":
         "The plan on this page gives each theorem's status and the goals it rests on."}],
       "kind": "para"}]}]},
  {"nodes":
   [{"status": "modulo",
     "label": "unauthorized_calls_nothing",
     "key": "Test.Dogfood.Scenario.Routing.unauthorized_calls_nothing",
     "detail": ""},
    {"status": "modulo",
     "ref": "claim:recorded-call-tree-prefix",
     "label": "bound_in_tree",
     "key": "Effect4.Run.CallTree.bound_in_tree",
     "detail": ""},
    {"status": "goal",
     "ref": "open:Effect4.Run.CallTree.request_leads",
     "label": "request_leads",
     "key": "Effect4.Run.CallTree.request_leads",
     "detail": ""}],
   "kind": "graph",
   "key": "fig:open:R5",
   "edges":
   [["Test.Dogfood.Scenario.Routing.unauthorized_calls_nothing",
     "Effect4.Run.CallTree.bound_in_tree"],
    ["Effect4.Run.CallTree.bound_in_tree",
     "Effect4.Run.CallTree.request_leads"]],
   "caption":
   "The open part of R5: its planned goals and the theorems proved modulo them. An arrow goes from a node to a node its proof reaches first."},
  {"nodes":
   [{"status": "open",
     "ref": "concept:context-requirements",
     "label": "Context Requirements",
     "key": "context-requirements",
     "detail": "2 nodes, 1 open"},
    {"status": "open",
     "ref": "concept:translation-simulation",
     "label": "Translation & Simulation",
     "key": "translation-simulation",
     "detail": "14 nodes, 2 open"},
    {"status": "proved",
     "label": "No concept",
     "key": "none",
     "detail": "6 nodes"},
    {"status": "proved",
     "ref": "concept:initial-algebras-folds",
     "label": "Initial Algebras & Folds",
     "key": "initial-algebras-folds",
     "detail": "3 nodes"},
    {"status": "proved",
     "ref": "concept:reactive-scheduling",
     "label": "Reactive Scheduling",
     "key": "reactive-scheduling",
     "detail": "2 nodes"},
    {"status": "proved",
     "ref": "concept:host-session-protocol",
     "label": "Host Session Protocol",
     "key": "host-session-protocol",
     "detail": "1 nodes"}],
   "kind": "graph",
   "key": "fig:concepts:R5",
   "edges":
   [["context-requirements", "translation-simulation"],
    ["context-requirements", "none"],
    ["translation-simulation", "reactive-scheduling"],
    ["translation-simulation", "host-session-protocol"],
    ["translation-simulation", "none"],
    ["translation-simulation", "initial-algebras-folds"]],
   "caption":
   "R5 by concept: each concept its nodes are placed at, by tag or by module. An arrow goes where a node's proof reaches a node of another concept."},
  {"rows":
   [[[{"code": "build_total"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "satisfies_union"},
      {"text": ", "},
      {"code": "satisfies_weaken"},
      {"text": ", "},
      {"code": "satisfies_empty"}]],
    [[{"code": "expanded_refs_nil_of_wf"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "typeOfProgram_expandRefs"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "expanded_refs_nil_of_wf"}]],
    [[{"code": "tree_needs_token"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "unauthorized_calls_nothing"}],
     [{"status": "modulo"}],
     [{"code": "request_leads"}],
     [{"code": "tree_needs_token"},
      {"text": ", "},
      {"code": "bound_in_tree"},
      {"text": ", "},
      {"code": "checkInput_eq_none_iff"}]],
    [[{"code": "satisfies_union"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "satisfies_weaken"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "satisfies_empty"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "bound_in_tree"}],
     [{"status": "modulo"}],
     [{"code": "request_leads"}],
     [{"code": "denoteRowsB_straight"},
      {"text": ", "},
      {"code": "localWaitC_to_rowsB"},
      {"text": ", "},
      {"code": "request_leads"},
      {"text": ", "},
      {"code": "driveState_lift"},
      {"text": ", "},
      {"code": "evaluatePrim_producer"},
      {"text": ", "},
      {"code": "reached"}]],
    [[{"code": "checkInput_eq_none_iff"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "denoteRowsB_straight"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "localWaitC_to_rowsB"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "localRunC_compileBO"}]],
    [[{"code": "request_leads"}],
     [{"status": "goal"}],
     [{"code": "request_leads"}],
     [{"text": "—"}]],
    [[{"code": "driveState_lift"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "evaluatePrim_producer"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "reached"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "localRunC_compileBO"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "compilesBO_onExit"},
      {"text": ", "},
      {"code": "compilesBO_matchCause"},
      {"text": ", "},
      {"code": "compilesBO_catchIf"},
      {"text": ", "},
      {"code": "compilesBO_catchCause"},
      {"text": ", "},
      {"code": "compilesBO_select"},
      {"text": ", "},
      {"code": "compilesBO_bind"},
      {"text": ", "},
      {"code": "compilesBO_iterate"},
      {"text": ", "},
      {"code": "compilesBO_exit"},
      {"text": ", "},
      {"code": "compilesBO_suspend"},
      {"text": ", "},
      {"code": "denoteRowsB_straight"},
      {"text": ", "},
      {"code": "denoteRows_straight"}]],
    [[{"code": "compilesBO_onExit"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "compilesBO_matchCause"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "compilesBO_catchIf"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "compilesBO_catchCause"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "compilesBO_select"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "compilesBO_bind"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "compilesBO_iterate"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "compilesBO_exit"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "denoteRowsB_straight"}, {"text": ", "}, {"code": "at_append"}]],
    [[{"code": "compilesBO_suspend"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"code": "at_append"}]],
    [[{"code": "denoteRows_straight"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]],
    [[{"code": "at_append"}],
     [{"status": "proved"}],
     [{"text": "—"}],
     [{"text": "—"}]]],
   "kind": "table",
   "headers": ["Node", "Status", "Rests on", "Nearest nodes"]}]}
