From 45eaf2936530e0601f74a56890beaf555a39ec19 Mon Sep 17 00:00:00 2001 From: Alexander Flom Date: Thu, 12 Nov 2026 15:09:51 +0000 Subject: [PATCH] Implement owned inspection, portfolio recovery and claim publication Co-Authored-By: Claude --- .github/lexlean-revision | 2 +- AGENTS.md | 21 +- Rule30-Core.pdf | Bin 58973 -> 58973 bytes Rule30-Observations.pdf | Bin 273782 -> 273782 bytes Rule30-Paper.pdf | Bin 969094 -> 969094 bytes pdf-manifest.json | 10 +- rule30-api/README.md | 79 ++++- rule30-api/lexlean.lock | 4 +- rule30-api/lexlean.toml | 6 +- rule30-api/model/dependencies.toml | 2 +- rule30-api/model/standards.toml | 2 +- rule30-api/src/CandidateUniverses.lex.tex | 81 +++++ .../src/CandidateUniversesTraces.lex.tex | 43 +++ rule30-api/src/PublicationFrontier.lex.tex | 74 +++++ rule30-api/src/PublicationPlan.lex.tex | 201 ++++++++++++ rule30-api/src/PublicationRecord.lex.tex | 65 ++++ rule30-api/src/PublicationSource.lex.tex | 74 +++++ rule30-api/src/ResearchAutonomy.lex.tex | 146 +++++++++ rule30-api/src/ResearchAutonomyInput.lex.tex | 36 +++ rule30-api/src/ResearchAutonomyTraces.lex.tex | 94 ++++++ rule30-api/src/ResearchCatalog.lex.tex | 19 +- rule30-api/src/ResearchCohortCommand.lex.tex | 89 +++++- rule30-api/src/ResearchExecution.lex.tex | 4 +- rule30-api/src/ResearchInspection.lex.tex | 227 +++++++++++++ .../src/ResearchInspectionBinding.lex.tex | 122 +++++++ .../ResearchInspectionBindingTraces.lex.tex | 46 +++ .../src/ResearchInspectionTraces.lex.tex | 56 ++++ rule30-api/src/ResearchPortfolio.lex.tex | 210 ++++++++++++ rule30-api/src/ResearchPortfolioInput.lex.tex | 69 ++++ .../src/ResearchPortfolioTraces.lex.tex | 139 ++++++++ rule30-api/src/ResearchPublication.lex.tex | 270 ++++++++++++++++ .../src/ResearchPublicationTraces.lex.tex | 177 +++++++++++ rule30-api/src/ResearchRecovery.lex.tex | 300 ++++++++++++++++++ rule30-api/src/ResearchRecoveryTraces.lex.tex | 106 +++++++ rule30-api/src/ResearchTraces.lex.tex | 2 +- rule30-api/src/Standards.lex.tex | 4 +- rule30-lexlean/Core.pdf | Bin 58973 -> 58973 bytes rule30-lexlean/lexlean.lock | 2 +- rule30-lexlean/pdf/Core.pdf | Bin 58973 -> 58973 bytes rule30-paper/Observations.pdf | Bin 273782 -> 273782 bytes rule30-paper/Paper.pdf | Bin 969094 -> 969094 bytes rule30-paper/lexlean.lock | 2 +- rule30-paper/pdf/Observations.pdf | Bin 273782 -> 273782 bytes rule30-paper/pdf/Paper.pdf | Bin 969094 -> 969094 bytes 44 files changed, 2745 insertions(+), 39 deletions(-) create mode 100644 rule30-api/src/CandidateUniverses.lex.tex create mode 100644 rule30-api/src/CandidateUniversesTraces.lex.tex create mode 100644 rule30-api/src/PublicationFrontier.lex.tex create mode 100644 rule30-api/src/PublicationPlan.lex.tex create mode 100644 rule30-api/src/PublicationRecord.lex.tex create mode 100644 rule30-api/src/PublicationSource.lex.tex create mode 100644 rule30-api/src/ResearchAutonomy.lex.tex create mode 100644 rule30-api/src/ResearchAutonomyInput.lex.tex create mode 100644 rule30-api/src/ResearchAutonomyTraces.lex.tex create mode 100644 rule30-api/src/ResearchInspection.lex.tex create mode 100644 rule30-api/src/ResearchInspectionBinding.lex.tex create mode 100644 rule30-api/src/ResearchInspectionBindingTraces.lex.tex create mode 100644 rule30-api/src/ResearchInspectionTraces.lex.tex create mode 100644 rule30-api/src/ResearchPortfolio.lex.tex create mode 100644 rule30-api/src/ResearchPortfolioInput.lex.tex create mode 100644 rule30-api/src/ResearchPortfolioTraces.lex.tex create mode 100644 rule30-api/src/ResearchPublication.lex.tex create mode 100644 rule30-api/src/ResearchPublicationTraces.lex.tex create mode 100644 rule30-api/src/ResearchRecovery.lex.tex create mode 100644 rule30-api/src/ResearchRecoveryTraces.lex.tex diff --git a/.github/lexlean-revision b/.github/lexlean-revision index f165d70..9292a24 100644 --- a/.github/lexlean-revision +++ b/.github/lexlean-revision @@ -1 +1 @@ -15c667bd36604c94c28e39502edec3fcad38e0ce +eadeff7cfe5c8e127b26543da04bfc2352d89047 diff --git a/AGENTS.md b/AGENTS.md index da1d03d..66935f9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -156,7 +156,14 @@ Its only events are host replies and cancellation. `ResearchRecord` captures the exact inputs and report reads; `ResearchEvidence` retains both the library commit and canonical proof record under verified Git references before workspace removal. Only then can the session return a checked answer. A stored record itself confers -no proof authority. Failed archival or cleanup retains the workspace. Stopped or +no proof authority. +`ResearchAutonomy` composes owned inspection, bounded portfolio dispatch, recovery +and batch claim publication. `lexlean inspect` is supplied by the v0.5 development +fork in upstream PR #482 (stacked on #439). Inspection data replaces caller goal +arenas but never acts as a proof receipt. Publication re-verifies retained source, +registers its generated host theorem through the repository API, and uses the +unchanged commit/push hooks and an exact source-revision lease. A bounded run +finishing does not mean every task was proved or published. Failed archival or cleanup retains the workspace. Stopped or signalled tools also retain it: direct-child cleanup does not establish that all descendants have terminated. Exact name matching alone does not establish the identity of an arbitrary imported environment. @@ -175,9 +182,10 @@ uncertain execution retains the library and stops the cohort. Its `r30/research-cohort-result/1` report preserves individual outcomes, and exit 0 requires all checked results and no cancellation. Cohort execution is bounded reuse, not durable recovery or automatic strategy selection. -Source inspection, strategy scheduling, durable failure diagnostics, recovery, -and claim publication still need completion; these modules do not replace the -legacy engine yet. Add every new application or library module and its modeled +The autonomous command connects inspection, bounded scheduling, recovery and +publication for supplied tasks. It does not generate a complete research strategy, +resume uncertain stored processes, or replace the legacy scheduled engine yet. +Add every new application or library module and its modeled features to `ResearchCatalog`, and add behavioral evidence for the capability; a module-count theorem alone does not establish feature completeness. @@ -417,6 +425,11 @@ State the missing executable connection and its acceptance condition explicitly. - Before another costly run after a failure, identify the failing obligation, distinguish proof failure from resource failure, and make one evidence-based correction. Preserve every existing obligation when partitioning proofs. +- Semantic `axioms` annotations are exact sets, not upper bounds. Audit new and + changed declarations against Lean's actual dependencies before the full gate; + do not copy an annotation from a neighboring definition. Check the whole + changed declaration set together so unused or missing annotations do not + produce a succession of late policy failures. - When several behavioral proofs evaluate the same expensive serialized fixture, establish its decoding once and reuse that checked equality. Keep the actual wire-decoding obligation and each behavioral statement; do not substitute an diff --git a/Rule30-Core.pdf b/Rule30-Core.pdf index 03313fd47766d7acb4a7a2dc8dac989f188f850a..07f8713278bd27d3cd42497e2e19c10028677389 100644 GIT binary patch delta 124 zcmcb6hWYLp<_)uNsu&p=7?>FtM`?2D`{t*(B$lKqXt-Dz85o%v8X7_+H}Ah$!s+bn s=;r3+f&f=Z0KxcYH0)%G&Zy_aWOTwaJ5sgA*5t;+2iL-02ucpasU7T delta 124 zcmcb6hWYLp<_)uNsu&s>nphZGMrm^C`{t*(B$lKqXt-Dz85o%v0s%yF^ZuJ9oX&2B t#wG^NhNiA2X66=-Cax~7u4X0{7OrLnZpLQj2F`X0HiVRHE_?i(2>=D%BLV;b diff --git a/Rule30-Observations.pdf b/Rule30-Observations.pdf index b87ec2dd9c77a6f7cbd45dc36e9e2a99cafb1872..58d4c52aa9fb3050f8c0211c6cee4ce2aef16377 100644 GIT binary patch delta 118 zcmex%OW@lrfrb{w7N!>FEi6$Y>_$cg24;rF(-TEl#9*B5bs{V~c%02F%nghj-HZ(l lj4e$Z&CJX#fh<>ZCqoxwBXa{&Gdl$vLQ1w*Dzg0L1^{r19qs@C delta 118 zcmex%OW@lrfrb{w7N!>FEi6$Y?1n~$CKg8K(-TEl#9*B5bs{V~c$`fw4INFKO>I24)5pQJP%( zzWFIGi6yBD8ZK5w21aIvhK5kd?feV)MA;n;Obi^&oehkfEX|CJEiIg!+$>yNER79} X%}pGk^q6m0M-*`B(bPf-Z~eL^P( delta 152 zcmZphY~425x}k-!g{g(Pg{6hHg{_6Xg`^>~CsP0b diff --git a/pdf-manifest.json b/pdf-manifest.json index d76af08..31ca498 100644 --- a/pdf-manifest.json +++ b/pdf-manifest.json @@ -1,18 +1,18 @@ { "documents": { "Core": { - "pdf_sha256": "0412d2a3bd4a1f856877b4576fa9d3c74cf20110254b3e8c08e88f9c513ef5c6", + "pdf_sha256": "4096cc4d659f31be9cd86bdb962639e8ae7f67b2fb1d10b3456a84ff41f36c06", "tex_sha256": "a7cd1807077baa1d1ca34015faf500a24477991859427f4db646e5f230fe54e2" }, "Observations": { - "pdf_sha256": "4c3af528e93971b79c6ff12a31ac92ce502e40fe6c35656036156256a4739af6", + "pdf_sha256": "98c0f20646a1c0c2153355c5fda10dcaf4c26fe98fec37d86d9416f7e14d17e2", "tex_sha256": "056820f37ac40133e341f46ad6c81125e35981150a1cc86f2063faad3f26fbd4" }, "Paper": { - "pdf_sha256": "28247b25fc3192f97ca2454315ae49530d4fb91cf7d363cb4cfee14c8e6291a6", + "pdf_sha256": "a60f48e7c14ec6ab0e5aa17ae9cc4e848f5c5c61a612339acf1091666f355247", "tex_sha256": "000f988561d9621f9ba2f9a99aba971670864367ebd336e6fbad0e1f71da01cb" } }, - "generated_at_utc": "2026-11-11T21:48:32.936749+00:00", - "source_digest": "9290b3cca596a4281b852998983ea680eb6706ed332321ae9034b400112ea3e4" + "generated_at_utc": "2026-11-12T20:06:19.560839+00:00", + "source_digest": "a0895002261a43f4ad4af9368d22ad039c69ae02739db0d827297b94a3348578" } diff --git a/rule30-api/README.md b/rule30-api/README.md index 168f7bc..2f393e7 100644 --- a/rule30-api/README.md +++ b/rule30-api/README.md @@ -25,8 +25,8 @@ gate verifies these modules with the rest of the application. `production/research-request.json` exports `Research.routeDead`, `Research.step` and `ResearchCatalog.initial` through the pinned compiler. These pure library roots do not replace the running Python engine. Native Host drivers now execute -individual attempts and shared-library cohorts through `ResearchCommand` and -`ResearchCohortCommand`. Owned candidate verification binds kernel replay and +individual attempts, shared-library portfolios, and journaled autonomy through +`ResearchCommand` and `ResearchCohortCommand`. Owned candidate verification binds kernel replay and axiom audit to the exact goal; the controller's receipt matching checks applicability, not mathematical truth. Legacy audit classifications and universally closed hypothesis schemas are @@ -39,9 +39,61 @@ successful, normally exited owned exchange acknowledges the transition. Duplicate successors, stale predecessors, cancellation and uncertain process outcomes cannot acknowledge a commit. `ResearchJournalTraces` checks these boundaries. A journal acknowledgement is neither a perpetual lease nor proof -authority: enclosing recovery still needs fresh workspaces and quarantine limits, -and claim publication still needs source integration, verification and register -updates. Inspection and autonomous portfolio execution remain unfinished. +authority. `ResearchRecovery` allocates fresh generations with bounded quarantine; +`ResearchPublication` owns source integration, fresh verification, register updates +and revision-conditional publication. `ResearchAutonomy` connects their lifecycles. + +`ResearchPortfolio` connects the existing scheduler to owned sessions. The native +`ResearchCohortCommand` also accepts `r30/research-portfolio/1`, with a `base`, +`tasks` and `budget` (at most 64). The base uses +`r30/research-portfolio-base/1` and the attempt configuration fields except +`arena` and `proof`. Tasks use the existing ready-task schema and have distinct +IDs. Owned local kernel inspection replaces caller-supplied goal arenas before +dispatch. Unsupported inspected types block only the affected tasks. After each +outcome the scheduler selects the next task; local constructive +synthesis supplies its candidate. One owned library serves the run, with tracked +sources rechecked between attempts. Unsupported synthesis blocks that executor; +it does not refute or exhaust the goal. Budget completion and cancellation clear +unstarted selections. Uncertain execution retains ownership and stops dispatch. +The result schema is `r30/research-portfolio-result/1`; `completed` means the +bounded run ended, not that every task was proved or published. Each result +retains its individual proof status and evidence identity; `tasks` reports the +remaining task statuses. This command runs supplied ready tasks. Automatic +generation of a complete research strategy is a separate capability. + +The same native command accepts `r30/research-autonomy/1`, containing `portfolio`, +`record_path` and `max_quarantined` (at most 8). Recovery reads the durable journal +through owned Git processes, reserves the next generation with compare-and-swap, +and assigns fresh workspace and log paths. Earlier active generations enter +quarantine; recovery never signals a stored PID or reuses an uncertain workspace. +The generation is sealed only after the portfolio and publication have released +their resources. + +Checked portfolio results enter one publication batch. Each archive must match +its canonical evidence identity, complete request and exact library revision. +The controller renames the retained LexLean source to an evidence-addressed +module, inserts its source path into the sorted, duplicate-free paper entrypoints, +then owns a new compiler snapshot and full verification. It registers +the attested generated host theorem through the existing `bin/r30 module add` +and `theorem add` operations. A closed proof may update its still-open matching +frontier claim; a premise proof publishes a supporting lemma and leaves the +parent claim open. These existing repository API operations remain dependencies +of the LexLean-authored controller; no new Python runtime is introduced. + +All proofs in a batch share one publication workspace, one unchanged pre-commit +gate and one push against the exact source predecessor. The commit is retained +locally under an evidence-and-commit-addressed reference before pushing. Repeating +retention preserves the same commit without overwriting a different attempt. +A failed or uncertain effect retains the workspace; +only a successful remote acknowledgment permits normal publication cleanup. +`r30/research-autonomy-result/1` distinguishes attempt `results`, remaining +`tasks`, `published_evidence`, `published_commit`, and the `generation_record`. +An empty publication list is not a solved claim. The current bounded constructive +search does not establish that Rule 30 Problem 1 can be solved automatically. +Publication refuses statements the existing theorem API cannot express and retains +their evidence and workspace. Recovery starts a fresh generation and quarantines +uncertain previous work; it does not assume stored process identifiers are live. +No remote model is used by these stages. `ResearchArchitecture.lex.tex` exposes the autonomous pipeline directly to PrismPM's architecture, security and quality projection: nine components, @@ -67,7 +119,18 @@ Each expensive native-binding closed-goal case has its own proof unit. Verification lifecycle, policy, process and metadata traces use batches of at most eight theorems, preserving their original obligations and axiom policy. CI retains the pinned compiler's native timing and memory telemetry on success -and failure, without changing the gate, resource limits or process width. +and failure, without changing proof acceptance or process width. The API allows +at most 32 MiB of child output: the 30-root autonomous extraction measured +21,298,345 bytes, exceeding the prior 16 MiB allowance. The complete 30-root +program, crate and certificate bundle measures 104,325,479 bytes, so its aggregate +source budget is 128 MiB. All proof, replay and axiom checks remain enforced. +The pinned compiler partitions large preservation certificates at complete +declaration-command boundaries. Every part is elaborated and replayed under the +unchanged child timeout, and the original certificate's axiom audit covers the +imported chain. Parts live outside original certificate module prefixes so +`leanchecker` does not select them all again during the final replay. This +addresses the combined controller's measured timeout; it does not provide +cross-revision proof caching or reduce the proof obligations.

Centerline

Every arrow a theorem.

@@ -703,8 +766,8 @@ where this repository uses it or why it does not. ``` bin/r30 api sync # regenerate every module, register, schema, feature, CONFORMANCE.md and the logo; lock bin/r30 api check # refuse drift (run by the tests and the gate) -bin/r30 api production # export the production roots to certified Rust and replay the bundle (about a minute) +bin/r30 api production # export the production roots to certified Rust and replay the bundle bin/r30 api production --targets # the compiler's target descriptors -bin/r30 verify api # lexlean verify of the API modules (about five minutes; Convert.lex.tex decides 28 conversions, Rule30Core.lex.tex the first rows) +bin/r30 verify api # lexlean verify of the API modules; cost depends on the selected proof closure bin/r30 view render [--out DIR] # the current view (the site, statements.json, explainer.json, rule30.svg, the PDFs) ``` diff --git a/rule30-api/lexlean.lock b/rule30-api/lexlean.lock index dc1b39e..e91b587 100644 --- a/rule30-api/lexlean.lock +++ b/rule30-api/lexlean.lock @@ -1,7 +1,7 @@ spec = "lexlean/lock/2" language = "1.2" -compiler_semantics = "601e9f4a1824bb6aacf7c3c2243d4b33aaa315abdebd5ceaf920d178e196019e" -project_config_sha256 = "6ceb296fae3095cf9f42d6c53a9eeeee55cf9df8e6e1eba87fd6248553fd000d" +compiler_semantics = "2e4c0ddd6084eba8fa99f04ab0235bfc5775dbc0455216b6ec51abe8ce8d9750" +project_config_sha256 = "3aab69e83aaa43aee298ada2603049770fd5ba35d441dde63a941209cecdd225" lean_toolchain = "leanprover/lean4:v4.32.1" [[workspace_file]] diff --git a/rule30-api/lexlean.toml b/rule30-api/lexlean.toml index 2670335..3ebdfea 100644 --- a/rule30-api/lexlean.toml +++ b/rule30-api/lexlean.toml @@ -3,7 +3,7 @@ name = "rule30-api" language = "1.2" module_prefix = "Rule30Api" source_roots = ["src", "stdlib"] -entrypoints = ["src/Api.lex.tex", "src/Application.lex.tex", "src/Architecture.lex.tex", "src/ArtifactIdentity.lex.tex", "src/ArtifactIdentityTraces.lex.tex", "src/Audit.lex.tex", "src/BindingFixture.lex.tex", "src/CandidateBinding.lex.tex", "src/CandidateBindingTraces.lex.tex", "src/CandidateSource.lex.tex", "src/CandidateSourceChecks0.lex.tex", "src/CandidateSourceChecks1.lex.tex", "src/CandidateSourceChecks2.lex.tex", "src/CandidateSourceChecks3.lex.tex", "src/CandidateSourceTraces.lex.tex", "src/ClosedBindingFixture.lex.tex", "src/ClosedGoalChecks0.lex.tex", "src/ClosedGoalChecks1.lex.tex", "src/ClosedGoalChecks2.lex.tex", "src/ClosedGoalChecks3.lex.tex", "src/ClosedGoalChecks4.lex.tex", "src/ClosedGoalChecks5.lex.tex", "src/ClosedGoalTraces.lex.tex", "src/CompilerSnapshot.lex.tex", "src/CompilerSnapshotTraces.lex.tex", "src/Convert.lex.tex", "src/CoreBinding.lex.tex", "src/CoreBindingTraces.lex.tex", "src/CoreNotation.lex.tex", "src/CoreNotationTraces.lex.tex", "src/Discovery.lex.tex", "src/Engine.lex.tex", "src/Host.lex.tex", "src/Hypotheses.lex.tex", "src/Json.lex.tex", "src/JsonCanonical.lex.tex", "src/JsonCanonicalTraces.lex.tex", "src/JsonTraces.lex.tex", "src/Observer.lex.tex", "src/Presentation.lex.tex", "src/R30.lex.tex", "src/R30Traces.lex.tex", "src/R30TracesClaims.lex.tex", "src/R30TracesForms.lex.tex", "src/R30TracesRegister.lex.tex", "src/Register.lex.tex", "src/Research.lex.tex", "src/ResearchArchitecture.lex.tex", "src/ResearchCandidate.lex.tex", "src/ResearchCandidateTraces.lex.tex", "src/ResearchCatalog.lex.tex", "src/ResearchCohort.lex.tex", "src/ResearchCohortChecks0.lex.tex", "src/ResearchCohortChecks1.lex.tex", "src/ResearchCohortChecks2.lex.tex", "src/ResearchCohortCommand.lex.tex", "src/ResearchCohortInput.lex.tex", "src/ResearchCohortTraces.lex.tex", "src/ResearchCommand.lex.tex", "src/ResearchCommandTraces.lex.tex", "src/ResearchEvidence.lex.tex", "src/ResearchEvidenceTraces.lex.tex", "src/ResearchExecution.lex.tex", "src/ResearchExecutionTraces.lex.tex", "src/ResearchFactory.lex.tex", "src/ResearchFactoryTraces.lex.tex", "src/ResearchInput.lex.tex", "src/ResearchInputTraces.lex.tex", "src/ResearchJournal.lex.tex", "src/ResearchJournalTraces.lex.tex", "src/ResearchProject.lex.tex", "src/ResearchProjectTraces.lex.tex", "src/ResearchProof.lex.tex", "src/ResearchProofTraces.lex.tex", "src/ResearchRecord.lex.tex", "src/ResearchRunner.lex.tex", "src/ResearchRunnerTraces.lex.tex", "src/ResearchSession.lex.tex", "src/ResearchSessionTraces.lex.tex", "src/ResearchTraces.lex.tex", "src/ResearchVerification.lex.tex", "src/ResearchVerificationChecks0.lex.tex", "src/ResearchVerificationChecks1.lex.tex", "src/ResearchVerificationChecks2.lex.tex", "src/ResearchVerificationChecks3.lex.tex", "src/ResearchVerificationChecks4.lex.tex", "src/ResearchVerificationChecks5.lex.tex", "src/ResearchVerificationChecks6.lex.tex", "src/ResearchVerificationTraces.lex.tex", "src/ResearchWorkspace.lex.tex", "src/ResearchWorkspaceTraces.lex.tex", "src/Rule30Core.lex.tex", "src/Sequences.lex.tex", "src/Standards.lex.tex", "src/Toml.lex.tex", "src/VerificationCommandFixtures.lex.tex", "src/VerificationHashData.lex.tex", "src/VerificationHashFixtures.lex.tex", "src/VerificationHashSteps0.lex.tex", "src/VerificationHashSteps1.lex.tex", "src/VerificationHashSteps2.lex.tex", "src/VerificationHashSteps3.lex.tex", "src/VerificationHashSteps4.lex.tex", "src/VerificationHashSteps5.lex.tex", "src/VerificationIdentityTraces.lex.tex", "src/VerificationJsonData.lex.tex", "src/VerificationJsonFixtures.lex.tex", "src/VerificationJsonSteps0.lex.tex", "src/VerificationJsonSteps1.lex.tex", "src/VerificationJsonSteps10.lex.tex", "src/VerificationJsonSteps11.lex.tex", "src/VerificationJsonSteps2.lex.tex", "src/VerificationJsonSteps3.lex.tex", "src/VerificationJsonSteps4.lex.tex", "src/VerificationJsonSteps5.lex.tex", "src/VerificationJsonSteps6.lex.tex", "src/VerificationJsonSteps7.lex.tex", "src/VerificationJsonSteps8.lex.tex", "src/VerificationJsonSteps9.lex.tex", "src/VerificationMetadataChecks0.lex.tex", "src/VerificationMetadataChecks1.lex.tex", "src/VerificationMetadataTraces.lex.tex", "src/VerificationPolicyChecks0.lex.tex", "src/VerificationPolicyTraces.lex.tex", "src/VerificationProcessChecks0.lex.tex", "src/VerificationProcessTraces.lex.tex", "src/VerificationReport.lex.tex", "src/VerificationReportTraces.lex.tex", "src/VerificationUtf8Fixtures.lex.tex", "src/VerificationUtf8Steps0.lex.tex", "src/VerificationUtf8Steps1.lex.tex", "src/VerificationUtf8Steps2.lex.tex", "src/VerificationUtf8Steps3.lex.tex", "src/VerificationUtf8Steps4.lex.tex", "src/VerificationUtf8Steps5.lex.tex", "src/VerificationUtf8Steps6.lex.tex", "src/VerificationUtf8Steps7.lex.tex", "src/VerificationUtf8Steps8.lex.tex", "src/VerificationUtf8Steps9.lex.tex"] +entrypoints = ["src/Api.lex.tex", "src/Application.lex.tex", "src/Architecture.lex.tex", "src/ArtifactIdentity.lex.tex", "src/ArtifactIdentityTraces.lex.tex", "src/Audit.lex.tex", "src/BindingFixture.lex.tex", "src/CandidateBinding.lex.tex", "src/CandidateBindingTraces.lex.tex", "src/CandidateSource.lex.tex", "src/CandidateSourceChecks0.lex.tex", "src/CandidateSourceChecks1.lex.tex", "src/CandidateSourceChecks2.lex.tex", "src/CandidateSourceChecks3.lex.tex", "src/CandidateSourceTraces.lex.tex", "src/CandidateUniverses.lex.tex", "src/CandidateUniversesTraces.lex.tex", "src/ClosedBindingFixture.lex.tex", "src/ClosedGoalChecks0.lex.tex", "src/ClosedGoalChecks1.lex.tex", "src/ClosedGoalChecks2.lex.tex", "src/ClosedGoalChecks3.lex.tex", "src/ClosedGoalChecks4.lex.tex", "src/ClosedGoalChecks5.lex.tex", "src/ClosedGoalTraces.lex.tex", "src/CompilerSnapshot.lex.tex", "src/CompilerSnapshotTraces.lex.tex", "src/Convert.lex.tex", "src/CoreBinding.lex.tex", "src/CoreBindingTraces.lex.tex", "src/CoreNotation.lex.tex", "src/CoreNotationTraces.lex.tex", "src/Discovery.lex.tex", "src/Engine.lex.tex", "src/Host.lex.tex", "src/Hypotheses.lex.tex", "src/Json.lex.tex", "src/JsonCanonical.lex.tex", "src/JsonCanonicalTraces.lex.tex", "src/JsonTraces.lex.tex", "src/Observer.lex.tex", "src/Presentation.lex.tex", "src/PublicationFrontier.lex.tex", "src/PublicationPlan.lex.tex", "src/PublicationRecord.lex.tex", "src/PublicationSource.lex.tex", "src/R30.lex.tex", "src/R30Traces.lex.tex", "src/R30TracesClaims.lex.tex", "src/R30TracesForms.lex.tex", "src/R30TracesRegister.lex.tex", "src/Register.lex.tex", "src/Research.lex.tex", "src/ResearchArchitecture.lex.tex", "src/ResearchAutonomy.lex.tex", "src/ResearchAutonomyInput.lex.tex", "src/ResearchAutonomyTraces.lex.tex", "src/ResearchCandidate.lex.tex", "src/ResearchCandidateTraces.lex.tex", "src/ResearchCatalog.lex.tex", "src/ResearchCohort.lex.tex", "src/ResearchCohortChecks0.lex.tex", "src/ResearchCohortChecks1.lex.tex", "src/ResearchCohortChecks2.lex.tex", "src/ResearchCohortCommand.lex.tex", "src/ResearchCohortInput.lex.tex", "src/ResearchCohortTraces.lex.tex", "src/ResearchCommand.lex.tex", "src/ResearchCommandTraces.lex.tex", "src/ResearchEvidence.lex.tex", "src/ResearchEvidenceTraces.lex.tex", "src/ResearchExecution.lex.tex", "src/ResearchExecutionTraces.lex.tex", "src/ResearchFactory.lex.tex", "src/ResearchFactoryTraces.lex.tex", "src/ResearchInput.lex.tex", "src/ResearchInputTraces.lex.tex", "src/ResearchInspection.lex.tex", "src/ResearchInspectionBinding.lex.tex", "src/ResearchInspectionBindingTraces.lex.tex", "src/ResearchInspectionTraces.lex.tex", "src/ResearchJournal.lex.tex", "src/ResearchJournalTraces.lex.tex", "src/ResearchPortfolio.lex.tex", "src/ResearchPortfolioInput.lex.tex", "src/ResearchPortfolioTraces.lex.tex", "src/ResearchProject.lex.tex", "src/ResearchProjectTraces.lex.tex", "src/ResearchProof.lex.tex", "src/ResearchProofTraces.lex.tex", "src/ResearchPublication.lex.tex", "src/ResearchPublicationTraces.lex.tex", "src/ResearchRecord.lex.tex", "src/ResearchRecovery.lex.tex", "src/ResearchRecoveryTraces.lex.tex", "src/ResearchRunner.lex.tex", "src/ResearchRunnerTraces.lex.tex", "src/ResearchSession.lex.tex", "src/ResearchSessionTraces.lex.tex", "src/ResearchTraces.lex.tex", "src/ResearchVerification.lex.tex", "src/ResearchVerificationChecks0.lex.tex", "src/ResearchVerificationChecks1.lex.tex", "src/ResearchVerificationChecks2.lex.tex", "src/ResearchVerificationChecks3.lex.tex", "src/ResearchVerificationChecks4.lex.tex", "src/ResearchVerificationChecks5.lex.tex", "src/ResearchVerificationChecks6.lex.tex", "src/ResearchVerificationTraces.lex.tex", "src/ResearchWorkspace.lex.tex", "src/ResearchWorkspaceTraces.lex.tex", "src/Rule30Core.lex.tex", "src/Sequences.lex.tex", "src/Standards.lex.tex", "src/Toml.lex.tex", "src/VerificationCommandFixtures.lex.tex", "src/VerificationHashData.lex.tex", "src/VerificationHashFixtures.lex.tex", "src/VerificationHashSteps0.lex.tex", "src/VerificationHashSteps1.lex.tex", "src/VerificationHashSteps2.lex.tex", "src/VerificationHashSteps3.lex.tex", "src/VerificationHashSteps4.lex.tex", "src/VerificationHashSteps5.lex.tex", "src/VerificationIdentityTraces.lex.tex", "src/VerificationJsonData.lex.tex", "src/VerificationJsonFixtures.lex.tex", "src/VerificationJsonSteps0.lex.tex", "src/VerificationJsonSteps1.lex.tex", "src/VerificationJsonSteps10.lex.tex", "src/VerificationJsonSteps11.lex.tex", "src/VerificationJsonSteps2.lex.tex", "src/VerificationJsonSteps3.lex.tex", "src/VerificationJsonSteps4.lex.tex", "src/VerificationJsonSteps5.lex.tex", "src/VerificationJsonSteps6.lex.tex", "src/VerificationJsonSteps7.lex.tex", "src/VerificationJsonSteps8.lex.tex", "src/VerificationJsonSteps9.lex.tex", "src/VerificationMetadataChecks0.lex.tex", "src/VerificationMetadataChecks1.lex.tex", "src/VerificationMetadataTraces.lex.tex", "src/VerificationPolicyChecks0.lex.tex", "src/VerificationPolicyTraces.lex.tex", "src/VerificationProcessChecks0.lex.tex", "src/VerificationProcessTraces.lex.tex", "src/VerificationReport.lex.tex", "src/VerificationReportTraces.lex.tex", "src/VerificationUtf8Fixtures.lex.tex", "src/VerificationUtf8Steps0.lex.tex", "src/VerificationUtf8Steps1.lex.tex", "src/VerificationUtf8Steps2.lex.tex", "src/VerificationUtf8Steps3.lex.tex", "src/VerificationUtf8Steps4.lex.tex", "src/VerificationUtf8Steps5.lex.tex", "src/VerificationUtf8Steps6.lex.tex", "src/VerificationUtf8Steps7.lex.tex", "src/VerificationUtf8Steps8.lex.tex", "src/VerificationUtf8Steps9.lex.tex"] build_root = ".lexlean" lockfile = "lexlean.lock" lean_workspace = "." @@ -40,7 +40,7 @@ path = "lexlean-stdlib" [limits] max_file_bytes = 16777216 -max_total_source_bytes = 100663296 +max_total_source_bytes = 134217728 max_primitive_atoms = 2000000 max_token_lattice_edges = 4000000 max_parse_states = 4000000 @@ -48,5 +48,5 @@ max_ir_nodes = 2000000 max_scope_depth = 1024 max_import_depth = 128 max_diagnostics = 256 -max_child_output_bytes = 16777216 +max_child_output_bytes = 33554432 child_timeout_ms = 600000 diff --git a/rule30-api/model/dependencies.toml b/rule30-api/model/dependencies.toml index 60cab0a..6c0d60e 100644 --- a/rule30-api/model/dependencies.toml +++ b/rule30-api/model/dependencies.toml @@ -4,7 +4,7 @@ spec = "prismpm/dependencies/1" id = "lexlean" version = "0.4.0" language = "1.2" -revision = "601e9f4a1824bb6aacf7c3c2243d4b33aaa315abdebd5ceaf920d178e196019e" +revision = "2e4c0ddd6084eba8fa99f04ab0235bfc5775dbc0455216b6ec51abe8ce8d9750" source = "pinned-binary" role = "compiler" path = ".local/bin/lexlean" diff --git a/rule30-api/model/standards.toml b/rule30-api/model/standards.toml index 3c8412f..60aae07 100644 --- a/rule30-api/model/standards.toml +++ b/rule30-api/model/standards.toml @@ -261,7 +261,7 @@ release_scope = true id = "lexlean" name = "UOR-Foundation/LexLean (closed-lexicon LaTeX to Lean 4)" authority = "https://github.com/UOR-Foundation/LexLean" -version = "0.4.0, language 1.2, compiler semantics 601e9f4a1824" +version = "0.4.0, language 1.2, compiler semantics 2e4c0ddd6084" scope = "The authoring surface: the paper, the register and these API modules are LexLean modules verified by lexlean; the production roots export to certified Rust." realized_by = ["Api", "Register", "Architecture", "Presentation", "Application", "Observer", "Convert", "Standards", "Rule30Core", "Sequences", "Discovery", "verify", "check", "api_sync", "api_check", "api_production"] conformance = "bin/r30 verify api; bin/r30 check api; bin/r30 api check" diff --git a/rule30-api/src/CandidateUniverses.lex.tex b/rule30-api/src/CandidateUniverses.lex.tex new file mode 100644 index 0000000..b56d0b3 --- /dev/null +++ b/rule30-api/src/CandidateUniverses.lex.tex @@ -0,0 +1,81 @@ +\begin{lexlean}{CandidateUniverses} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{CoreBinding} +\importmodule{CoreNotation} +\importmodule{ResearchInput} +\importmodule{Hypotheses} +\importmodule{Toml} +\importmodule{Json} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: unique, + parameters: [incoming : (List Bytes), collected : (List Bytes)], + result: (List Bytes), + body: (match incoming | List.nil => collected | List.cons head tail => (unique tail (if (Hypotheses::memberBytes head collected) then collected else (prim append collected (cons head (nil Bytes)) : (List Bytes))))), + axioms: [], + recursive_argument: incoming, + executable: true +} +definition{ + name: joined, + parameters: [left : (Option (List Bytes)), right : (Option (List Bytes))], + result: (Option (List Bytes)), + body: (match left | Option.none => (ctor Option.none [(List Bytes)]) | Option.some a => (match right | Option.none => (ctor Option.none [(List Bytes)]) | Option.some b => (ctor Option.some [(List Bytes)] (unique b a)))), + axioms: [], + executable: true +} +definition{ + name: level, + parameters: [value : Json::Value, fuel : Nat], + result: (Option (List Bytes)), + body: (match fuel | Nat.zero => (ctor Option.none [(List Bytes)]) | Nat.succ more => (if ((Toml::sameBytes (CoreBinding::kind value) 0x7a) && (CoreNotation::shape value (cons 0x6b (nil Bytes)))) then (ctor Option.some [(List Bytes)] (nil Bytes)) else (if (CoreNotation::shape value (cons 0x6b (cons 0x61 (nil Bytes)))) then (if (Toml::sameBytes (CoreBinding::kind value) 0x70) then (match (CoreBinding::get value 0x61) | Json::Value.string name => (if (0 (ctor Option.none [(List Bytes)]) | Json::Value.boolean flag => (ctor Option.none [(List Bytes)]) | Json::Value.number number => (ctor Option.none [(List Bytes)]) | Json::Value.array values => (ctor Option.none [(List Bytes)]) | Json::Value.object fields => (ctor Option.none [(List Bytes)])) else (if (Toml::sameBytes (CoreBinding::kind value) 0x73) then (level (CoreBinding::get value 0x61) more) else (if ((Toml::sameBytes (CoreBinding::kind value) 0x6d) || (Toml::sameBytes (CoreBinding::kind value) 0x69)) then (match (ResearchInput::array (CoreBinding::get value 0x61)) | Option.none => (ctor Option.none [(List Bytes)]) | Option.some values => (match values | List.nil => (ctor Option.none [(List Bytes)]) | List.cons left tail => (match tail | List.nil => (ctor Option.none [(List Bytes)]) | List.cons right rest => (match rest | List.nil => (joined (level left more) (level right more)) | List.cons extra others => (ctor Option.none [(List Bytes)]))))) else (ctor Option.none [(List Bytes)])))) else (ctor Option.none [(List Bytes)])))), + axioms: [], + recursive_argument: fuel, + executable: true +} +definition{ + name: levels, + parameters: [values : (List Json::Value), fuel : Nat], + result: (Option (List Bytes)), + body: (match values | List.nil => (ctor Option.some [(List Bytes)] (nil Bytes)) | List.cons head tail => (match fuel | Nat.zero => (ctor Option.none [(List Bytes)]) | Nat.succ more => (joined (level head 128) (levels tail more)))), + axioms: [], + recursive_argument: values, + executable: true +} +definition{ + name: node, + parameters: [value : Json::Value], + result: (Option (List Bytes)), + body: (if (Toml::sameBytes (CoreBinding::kind value) 0x73) then (if (CoreNotation::shape value (cons 0x6b (cons 0x6c (nil Bytes)))) then (level (CoreBinding::get value 0x6c) 128) else (ctor Option.none [(List Bytes)])) else (if (Toml::sameBytes (CoreBinding::kind value) 0x63) then (if (CoreNotation::shape value (cons 0x6b (cons 0x6e (cons 0x75 (nil Bytes))))) then (match (ResearchInput::array (CoreBinding::get value 0x75)) | Option.none => (ctor Option.none [(List Bytes)]) | Option.some values => (levels values 65536)) else (ctor Option.none [(List Bytes)])) else (ctor Option.some [(List Bytes)] (nil Bytes)))), + axioms: [], + executable: true +} +definition{ + name: collect, + parameters: [nodes : (List Json::Value), fuel : Nat], + result: (Option (List Bytes)), + body: (match nodes | List.nil => (ctor Option.some [(List Bytes)] (nil Bytes)) | List.cons head tail => (match fuel | Nat.zero => (ctor Option.none [(List Bytes)]) | Nat.succ more => (joined (node head) (collect tail more)))), + axioms: [], + recursive_argument: nodes, + executable: true +} +definition{ + name: parameters, + parameters: [goal : CoreBinding::Goal], + result: (Option (List Bytes)), + body: (collect (project goal nodes) 65536), + axioms: [], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "goal-derived-universe-parameters" (cons "structural-level-traversal" (cons "stable-duplicate-removal" (cons "reject-unresolved-universe-levels" (cons "bounded-parameter-collection" (nil String)))))), + axioms: [], + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/CandidateUniversesTraces.lex.tex b/rule30-api/src/CandidateUniversesTraces.lex.tex new file mode 100644 index 0000000..44c4729 --- /dev/null +++ b/rule30-api/src/CandidateUniversesTraces.lex.tex @@ -0,0 +1,43 @@ +\begin{lexlean}{CandidateUniversesTraces} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{CandidateUniverses} +\importmodule{Json} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: parameter, + parameters: [name : Bytes], + result: Json::Value, + body: (ctor Json::Value.object (cons (0x6b, (ctor Json::Value.string 0x70)) (cons (0x61, (ctor Json::Value.string name)) (nil (Bytes * Json::Value))))) +} +theorem{ + name: namedUniverseIsRetained, + parameters: [], + statement: ((CandidateUniverses::level (parameter 0x75) 128) = (ctor Option.some [(List Bytes)] (cons 0x75 (nil Bytes)))), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: exhaustedUniverseTraversalIsRefused, + parameters: [], + statement: ((CandidateUniverses::level (parameter 0x75) 0) = (ctor Option.none [(List Bytes)])), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: unnamedUniverseIsRefused, + parameters: [], + statement: ((CandidateUniverses::level (parameter 0x) 128) = (ctor Option.none [(List Bytes)])), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: repeatedUniversesPreserveFirstOccurrenceOrder, + parameters: [], + statement: ((CandidateUniverses::unique (cons 0x75 (cons 0x76 (cons 0x75 (nil Bytes)))) (cons 0x77 (nil Bytes))) = (cons 0x77 (cons 0x75 (cons 0x76 (nil Bytes))))), + proof: reflexivity{}, + axioms: [] +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/PublicationFrontier.lex.tex b/rule30-api/src/PublicationFrontier.lex.tex new file mode 100644 index 0000000..9e3f1d4 --- /dev/null +++ b/rule30-api/src/PublicationFrontier.lex.tex @@ -0,0 +1,74 @@ +\begin{lexlean}{PublicationFrontier} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{Research} +\importmodule{Toml} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: join, + parameters: [segments : (List Bytes)], + result: Bytes, + body: (match segments | List.nil => 0x | List.cons head tail => (prim append head (join tail) : Bytes)), + axioms: [], + recursive_argument: segments, + executable: true +} +definition{ + name: fieldIs, + parameters: [table : Toml::Table, key : Bytes, expected : Bytes], + result: Bool, + body: (match (Toml::field table key) | Option.none => false | Option.some value => (match value | Toml::Value.text segments => (Toml::sameBytes (join segments) expected) | Toml::Value.number number => false | Toml::Value.strings values => false)), + axioms: [], + executable: true +} +definition{ + name: selected, + parameters: [tables : (List Toml::Table), identity : Bytes], + result: (List Toml::Table), + body: (match tables | List.nil => (nil Toml::Table) | List.cons head tail => (if ((Toml::sameBytes (project head name) 0x636c61696d) && (fieldIs head 0x6964 identity)) then (cons head (selected tail identity)) else (selected tail identity))), + axioms: [], + recursive_argument: tables, + executable: true +} +definition{ + name: eligible, + parameters: [table : Toml::Table, task : Research::Task], + result: Bool, + body: ((fieldIs table 0x737461747573 0x6f70656e) && ((match (project task intent) | Research::Purpose.prove => true | Research::Purpose.refute => true | Research::Purpose.inspect => false | Research::Purpose.maintain => false) && (match (project (project task sequent) kind) | Research::GoalKind.closed => (fieldIs table 0x6c65616e (project (project task sequent) origin)) | Research::GoalKind.premise => true))), + axioms: [], + executable: true +} +definition{ + name: current, + parameters: [source : Bytes, task : Research::Task], + result: Bool, + body: (if ((prim length source : Nat) <=? 8388608) then (match (Toml::parse source) | Result.error problem => false | Result.ok tables => (match (selected tables (project task id)) | List.nil => false | List.cons head tail => (match tail | List.nil => (eligible head task) | List.cons duplicate rest => false))) else false), + axioms: [propext], + executable: true +} +definition{ + name: closesClaim, + parameters: [task : Research::Task], + result: Bool, + body: (match (project (project task sequent) kind) | Research::GoalKind.closed => true | Research::GoalKind.premise => false), + axioms: [], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Read the frontier from the owned exact-revision workspace before publication. Require one matching open claim and a prove or refute intent. A closed claim must still designate the inspected source proposition. A contextual premise contributes a supporting lemma without changing the enclosing claim status. Duplicate identifiers, non-open claims, malformed TOML and origin changes refuse publication.", + axioms: [], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "exact-open-frontier-admission" (cons "duplicate-claim-refusal" (cons "closed-origin-binding" (cons "premise-leaves-parent-open" (nil String))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/PublicationPlan.lex.tex b/rule30-api/src/PublicationPlan.lex.tex new file mode 100644 index 0000000..f1435e5 --- /dev/null +++ b/rule30-api/src/PublicationPlan.lex.tex @@ -0,0 +1,201 @@ +\begin{lexlean}{PublicationPlan} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{PublicationSource} +\importmodule{PublicationFrontier} +\importmodule{ResearchProject} +\importmodule{ResearchCandidate} +\importmodule{ResearchWorkspace} +\importmodule{ResearchExecution} +\importmodule{ResearchVerification} +\importmodule{Research} +\importmodule{VerificationReport} +\importmodule{Host} +\importmodule{Toml} +\importmodule{Hypotheses} +\importmodule{Json} +\importmodule{JsonCanonical} +\title{Boolean} +\begin{semanticmodule} +structure{ + name: Config, + type_parameters: [], + parameters: [], + fields: [{name: base, type: ResearchProject::Config}, {name: identity, type: Bytes}] +} +inductive{ + name: Operation, + type_parameters: [], + parameters: [], + constructors: [{name: archive, fields: []}, {name: update, fields: []}, {name: lock, fields: []}, {name: register, fields: []}, {name: theorem, fields: []}, {name: frontier, fields: []}, {name: sync, fields: []}, {name: stage, fields: []}, {name: commit, fields: []}, {name: head, fields: []}, {name: retain, fields: []}, {name: push, fields: []}] +} +definition{ + name: workspace, + parameters: [config : Config], + result: ResearchWorkspace::Config, + body: (project (project config base) workspace), + axioms: [], + executable: true +} +definition{ + name: root, + parameters: [config : Config], + result: String, + body: (ResearchWorkspace::path (workspace config)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: moduleName, + parameters: [config : Config], + result: String, + body: (Host::textOf (PublicationSource::moduleName (project config identity))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: theoremName, + parameters: [config : Config], + result: String, + body: (Host::textOf (PublicationSource::theoremName (project config identity))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: sourcePath, + parameters: [config : Config], + result: String, + body: (ResearchVerification::concat "src/" (ResearchVerification::concat (moduleName config) ".lex.tex")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: slug, + parameters: [config : Config], + result: String, + body: (ResearchVerification::concat "autonomous-" (Host::textOf (project config identity))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: reference, + parameters: [config : Config, commit : Bytes], + result: String, + body: (ResearchVerification::concat "refs/r30/publications/" (ResearchVerification::concat (Host::textOf (project config identity)) (ResearchVerification::concat "/" (Host::textOf commit)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: status, + parameters: [config : Config], + result: String, + body: (match (project (project (project (project config base) request) task) intent) | Research::Purpose.prove => "proved" | Research::Purpose.refute => "refuted" | Research::Purpose.inspect => "open" | Research::Purpose.maintain => "open"), + axioms: [], + executable: true +} +definition{ + name: arguments, + parameters: [config : Config, operation : Operation, commit : Bytes], + result: (List String), + body: (match operation | Operation.archive => (cons "cat-file" (cons "blob" (cons (ResearchVerification::concat "refs/r30/evidence/" (Host::textOf (project config identity))) (nil String)))) | Operation.update => (cons "update" (nil String)) | Operation.lock => (cons "--project=rule30-paper/lexlean.toml" (cons "lock" (nil String))) | Operation.register => (cons "module" (cons "add" (cons (ResearchVerification::concat "Rule30UOR." (moduleName config)) (cons "--build" (nil String))))) | Operation.theorem => (cons "theorem" (cons "add" (cons (theoremName config) (cons "--slug" (cons (slug config) (nil String)))))) | Operation.frontier => (cons "frontier" (cons "set" (cons "--status" (cons (status config) (cons "--lean" (cons (theoremName config) (cons "--lexeme" (cons (ResearchVerification::concat "r30.observation::" (slug config)) (cons "--note" (cons (ResearchVerification::concat "Autonomous kernel-checked evidence " (Host::textOf (project config identity))) (cons "--" (cons (Host::textOf (project (project (project (project config base) request) task) id)) (nil String))))))))))))) | Operation.sync => (cons "api" (cons "sync" (nil String))) | Operation.stage => (cons "add" (cons "-A" (cons "--" (nil String)))) | Operation.commit => (cons "-c" (cons "core.hooksPath=.githooks" (cons "commit" (cons "-m" (cons "Publish verified autonomous proof batch" (nil String)))))) | Operation.head => (cons "rev-parse" (cons "--verify" (cons "HEAD^{commit}" (nil String)))) | Operation.retain => (cons "update-ref" (cons (reference config commit) (cons (Host::textOf commit) (nil String)))) | Operation.push => (cons "-c" (cons "core.hooksPath=.githooks" (cons "push" (cons (ResearchVerification::concat "--force-with-lease=refs/heads/main:" (Host::textOf (project (workspace config) revision))) (cons "origin" (cons (ResearchVerification::concat (Host::textOf commit) ":refs/heads/main") (nil String)))))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: tool, + parameters: [operation : Operation], + result: ResearchExecution::Tool, + body: (match operation | Operation.archive => (ctor ResearchExecution::Tool.git) | Operation.update => (ctor ResearchExecution::Tool.lake) | Operation.lock => (ctor ResearchExecution::Tool.lexlean) | Operation.register => (ctor ResearchExecution::Tool.r30) | Operation.theorem => (ctor ResearchExecution::Tool.r30) | Operation.frontier => (ctor ResearchExecution::Tool.r30) | Operation.sync => (ctor ResearchExecution::Tool.r30) | Operation.stage => (ctor ResearchExecution::Tool.git) | Operation.commit => (ctor ResearchExecution::Tool.git) | Operation.head => (ctor ResearchExecution::Tool.git) | Operation.retain => (ctor ResearchExecution::Tool.git) | Operation.push => (ctor ResearchExecution::Tool.git)), + axioms: [], + executable: true +} +definition{ + name: directory, + parameters: [config : Config, operation : Operation], + result: String, + body: (match operation | Operation.archive => (root config) | Operation.update => (ResearchVerification::concat (root config) "/rule30-paper") | Operation.lock => (root config) | Operation.register => (root config) | Operation.theorem => (root config) | Operation.frontier => (root config) | Operation.sync => (root config) | Operation.stage => (root config) | Operation.commit => (root config) | Operation.head => (root config) | Operation.retain => (root config) | Operation.push => (root config)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: job, + parameters: [config : Config, operation : Operation, commit : Bytes], + result: ResearchExecution::Job, + body: (let owner : ResearchWorkspace::Config := (workspace config); (record ResearchExecution::Job {request := (project (project config base) request), tool := (tool operation), arguments := (arguments config operation commit), directory := (directory config operation), environment := (project owner environment), output := (project owner output), errors := (project owner errors), allowance := (project owner allowance), quantum := (project owner quantum), polls := (project owner polls)})), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: verificationConfig, + parameters: [config : Config], + result: ResearchVerification::Config, + body: (let owner : ResearchWorkspace::Config := (workspace config); (record ResearchVerification::Config {project := (ResearchVerification::concat (root config) "/rule30-paper/lexlean.toml"), moduleSource := (sourcePath config), directory := (root config), environment := (project owner environment), output := (project owner output), errors := (project owner errors), verifiedRoot := (ResearchVerification::concat (root config) "/rule30-paper/.lexlean/verified"), maxBytes := (project (project config base) maxBytes), allowance := (project owner allowance), quantum := (project owner quantum), polls := (project owner polls)})), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: context, + parameters: [config : Config], + result: ResearchCandidate::Context, + body: (record ResearchCandidate::Context {request := (project (project config base) request), config := (verificationConfig config), tools := (project (project config base) tools), module := (PublicationSource::append 0x52756c65333050617065722e (PublicationSource::moduleName (project config identity))), theorem := (PublicationSource::theoremName (project config identity)), maxDepth := (project (project config base) maxDepth), maxSteps := (project (project config base) maxSteps)}), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: generatedPath, + parameters: [config : Config, receipt : VerificationReport::Receipt], + result: String, + body: (ResearchVerification::concat (project (verificationConfig config) verifiedRoot) (ResearchVerification::concat "/" (ResearchVerification::concat (Host::textOf (project receipt attestation)) (ResearchVerification::concat "/modules/Rule30Paper/" (ResearchVerification::concat (moduleName config) ".lean"))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: hostPath, + parameters: [config : Config], + result: String, + body: (ResearchVerification::concat (root config) (ResearchVerification::concat "/rule30-core-lean/Rule30UOR/" (ResearchVerification::concat (moduleName config) ".lean"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: insertPath, + parameters: [path : Bytes, paths : (List Json::Value)], + result: (Option (List Json::Value)), + body: (match paths | List.nil => (ctor Option.some [(List Json::Value)] (cons (ctor Json::Value.string path) (nil Json::Value))) | List.cons head tail => (match head | Json::Value.string old => (if (Toml::sameBytes path old) then (ctor Option.some [(List Json::Value)] (cons head tail)) else (if (Hypotheses::lessBytes path old) then (ctor Option.some [(List Json::Value)] (cons (ctor Json::Value.string path) (cons head tail))) else (match (insertPath path tail) | Option.none => (ctor Option.none [(List Json::Value)]) | Option.some rest => (ctor Option.some [(List Json::Value)] (cons head rest))))) | Json::Value.null => (ctor Option.none [(List Json::Value)]) | Json::Value.boolean flag => (ctor Option.none [(List Json::Value)]) | Json::Value.number number => (ctor Option.none [(List Json::Value)]) | Json::Value.array values => (ctor Option.none [(List Json::Value)]) | Json::Value.object values => (ctor Option.none [(List Json::Value)]))), + axioms: [propext], + recursive_argument: paths, + executable: true +} +definition{ + name: entrypointAt, + parameters: [path : Bytes, manifest : Bytes, start : Nat, finish : Nat], + result: (Option Bytes), + body: (match (Json::parse (Toml::sliceOr manifest start ((prim subtract finish start : Nat) + 1)) 8388608 32) | Result.error problem => (ctor Option.none [Bytes]) | Result.ok value => (match value | Json::Value.array values => (match (insertPath path values) | Option.none => (ctor Option.none [Bytes]) | Option.some ordered => (match (JsonCanonical::encode (ctor Json::Value.array ordered) 8388608 16777216) | Option.none => (ctor Option.none [Bytes]) | Option.some encoded => (ctor Option.some [Bytes] (PublicationSource::append (Toml::sliceOr manifest 0 start) (PublicationSource::append encoded (Toml::sliceOr manifest (finish + 1) (prim subtract (prim length manifest : Nat) (finish + 1) : Nat))))))) | Json::Value.null => (ctor Option.none [Bytes]) | Json::Value.boolean flag => (ctor Option.none [Bytes]) | Json::Value.number number => (ctor Option.none [Bytes]) | Json::Value.string text => (ctor Option.none [Bytes]) | Json::Value.object values => (ctor Option.none [Bytes]))), + axioms: [propext], + executable: true +} +definition{ + name: entrypoint, + parameters: [config : Config, manifest : Bytes], + result: (Option Bytes), + body: (if ((prim length manifest : Nat) <=? 8388608) then (match (PublicationSource::find manifest 0x0a656e747279706f696e7473203d205b 0 8388608) | Option.none => (ctor Option.none [Bytes]) | Option.some position => (let start : Nat := (position + 15); (match (PublicationSource::find manifest 0x5d start 8388608) | Option.none => (ctor Option.none [Bytes]) | Option.some finish => (entrypointAt (PublicationSource::append 0x7372632f (PublicationSource::append (PublicationSource::moduleName (project config identity)) 0x2e6c65782e746578)) manifest start finish)))) else (ctor Option.none [Bytes])), + axioms: [propext], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "A fixed publication plan for an owned isolated repository. Reverify renamed LexLean source before using its attested generated Lean artifact. Register generated host modules and theorem lexemes through the existing r30 API; change frontier status only for a checked closed claim. Retain each commit at its own evidence-and-commit-addressed reference, making repeated retention idempotent without replacing a different publication commit. Commit through the unchanged hook and push only against the exact predecessor with a source-branch lease. No shell command strings, remote models or receipt-based shortcuts. This plan supplies jobs; only the enclosing publication lifecycle establishes their ordering, ownership and successful completion.", + axioms: [], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "fixed-local-publication-tools" (cons "generated-source-registration-api" (cons "unchanged-commit-and-push-hooks" (cons "exact-source-revision-lease" (nil String))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/PublicationRecord.lex.tex b/rule30-api/src/PublicationRecord.lex.tex new file mode 100644 index 0000000..6a921b9 --- /dev/null +++ b/rule30-api/src/PublicationRecord.lex.tex @@ -0,0 +1,65 @@ +\begin{lexlean}{PublicationRecord} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{PublicationSource} +\importmodule{ResearchRecord} +\importmodule{Research} +\importmodule{ResearchInput} +\importmodule{CoreBinding} +\importmodule{CoreNotation} +\importmodule{Json} +\importmodule{JsonCanonical} +\importmodule{Toml} +\importmodule{LexLeanStd.Sha256} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: sameDocument, + parameters: [left : Json::Value, right : Json::Value], + result: Bool, + body: (match (JsonCanonical::encode left 8388608 16777216) | Option.none => false | Option.some firstBytes => (match (JsonCanonical::encode right 8388608 16777216) | Option.none => false | Option.some secondBytes => (Toml::sameBytes firstBytes secondBytes))), + axioms: [propext], + executable: true +} +definition{ + name: matches, + parameters: [document : Json::Value, request : Research::Request, revision : Bytes], + result: Bool, + body: (if (CoreNotation::shape document (cons 0x73706563 (cons 0x72657175657374 (cons 0x7265766973696f6e (cons 0x70696e73 (cons 0x72656365697074 (cons 0x66696c6573 (cons 0x6c696e6b6564 (cons 0x6c657869636f6e (cons 0x636f6d6d616e64 (cons 0x6174746573746174696f6e (nil Bytes)))))))))))) then ((ResearchInput::stringIs (CoreBinding::get document 0x73706563) 0x7233302f72657365617263682d70726f6f662f31) && ((ResearchInput::stringIs (CoreBinding::get document 0x7265766973696f6e) revision) && (sameDocument (CoreBinding::get document 0x72657175657374) (ResearchRecord::request request)))) else false), + axioms: [propext], + executable: true +} +definition{ + name: source, + parameters: [document : Json::Value, request : Research::Request, revision : Bytes, identity : Bytes], + result: (Option Bytes), + body: (if (matches document request revision) then (match (ResearchInput::bytes (CoreBinding::get (CoreBinding::get document 0x66696c6573) 0x7372632f43616e6469646174652e6c65782e746578)) | Option.none => (ctor Option.none [Bytes]) | Option.some candidate => (PublicationSource::renamed candidate identity 8388608)) else (ctor Option.none [Bytes])), + axioms: [propext], + executable: true +} +definition{ + name: decode, + parameters: [data : Bytes, identity : Bytes, request : Research::Request, revision : Bytes], + result: (Option Bytes), + body: (if (((prim length identity : Nat) =? 64) && ((prim length data : Nat) <=? 8388608)) then (if (Toml::sameBytes (LexLeanStd.Sha256::sha256Hex data) identity) then (match (Json::parse data 8388608 512) | Result.error problem => (ctor Option.none [Bytes]) | Result.ok document => (match (JsonCanonical::file document 8388608 16777216) | Option.none => (ctor Option.none [Bytes]) | Option.some canonical => (if (Toml::sameBytes canonical data) then (source document request revision identity) else (ctor Option.none [Bytes])))) else (ctor Option.none [Bytes])) else (ctor Option.none [Bytes])), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Recover only unverified candidate source from exact canonical evidence bytes. Require the SHA-256 evidence identity, complete original request and pinned library revision; refuse noncanonical or oversized archives and malformed fixed source paths. Archived pins, receipts and reports are deliberately not promoted to authority. The renamed source must pass owned snapshot binding and kernel verification again before publication can proceed.", + axioms: [], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "canonical-archive-byte-identity" (cons "exact-original-request-replay" (cons "pinned-revision-replay" (cons "archive-cannot-confer-proof-authority" (nil String))))), + axioms: [], + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/PublicationSource.lex.tex b/rule30-api/src/PublicationSource.lex.tex new file mode 100644 index 0000000..328803d --- /dev/null +++ b/rule30-api/src/PublicationSource.lex.tex @@ -0,0 +1,74 @@ +\begin{lexlean}{PublicationSource} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchWorkspace} +\importmodule{Toml} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: append, + parameters: [left : Bytes, right : Bytes], + result: Bytes, + body: (prim append left right : Bytes), + executable: true +} +definition{ + name: moduleName, + parameters: [identity : Bytes], + result: Bytes, + body: (append 0x47656e65726174656450 identity), + executable: true +} +definition{ + name: theoremName, + parameters: [identity : Bytes], + result: Bytes, + body: (append 0x52756c653330554f522e (append (moduleName identity) 0x2e70726f6f66)), + executable: true +} +definition{ + name: at, + parameters: [data : Bytes, pattern : Bytes, position : Nat], + result: Bool, + body: (match (prim slice data position (prim length pattern : Nat) : (Option Bytes)) | Option.none => false | Option.some found => (Toml::sameBytes found pattern)), + executable: true +} +definition{ + name: find, + parameters: [data : Bytes, pattern : Bytes, position : Nat, fuel : Nat], + result: (Option Nat), + body: (match fuel | Nat.zero => (ctor Option.none [Nat]) | Nat.succ more => (if ((position + (prim length pattern : Nat)) <=? (prim length data : Nat)) then (if (at data pattern position) then (ctor Option.some [Nat] position) else (find data pattern (position + 1) more)) else (ctor Option.none [Nat]))), + recursive_argument: fuel, + executable: true +} +definition{ + name: replace, + parameters: [data : Bytes, pattern : Bytes, replacement : Bytes, fuel : Nat], + result: (Option Bytes), + body: (if (0 (ctor Option.none [Bytes]) | Option.some position => (let after : Nat := (position + (prim length pattern : Nat)); (ctor Option.some [Bytes] (append (Toml::sliceOr data 0 position) (append replacement (Toml::sliceOr data after (prim subtract (prim length data : Nat) after : Nat))))))) else (ctor Option.none [Bytes])), + executable: true +} +definition{ + name: renamed, + parameters: [source : Bytes, identity : Bytes, fuel : Nat], + result: (Option Bytes), + body: (let header : Bytes := 0x5c626567696e7b6c65786c65616e7d7b43616e6469646174657d; (if (((prim length identity : Nat) =? 64) && ((ResearchWorkspace::objectId identity) && ((at source header 0) && ((prim length source : Nat) <=? 8388608)))) then (match (replace source header (append 0x5c626567696e7b6c65786c65616e7d7b (append (moduleName identity) 0x7d)) fuel) | Option.none => (ctor Option.none [Bytes]) | Option.some headerChanged => (replace headerChanged 0x0a7468656f72656d2052756c65333043616e6469646174652e43616e6469646174652e70726f6f66 (append 0x0a7468656f72656d20 (theoremName identity)) fuel)) else (ctor Option.none [Bytes]))), + axioms: [propext], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Derive a distinct publication module and global theorem name from the canonical evidence identity. Rename only the fixed candidate module header and first theorem declaration marker. The result is unverified source: publication must own a new snapshot and full proof verification after renaming, bind the actual resulting type to the original request, and retain the original evidence. An archived receipt or successful text rewrite never establishes a published claim.", + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "evidence-addressed-publication-name" (cons "bounded-candidate-header-rewrite" (cons "rename-requires-owned-reverification" (nil String)))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchAutonomy.lex.tex b/rule30-api/src/ResearchAutonomy.lex.tex new file mode 100644 index 0000000..6f94bf6 --- /dev/null +++ b/rule30-api/src/ResearchAutonomy.lex.tex @@ -0,0 +1,146 @@ +\begin{lexlean}{ResearchAutonomy} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchPublication} +\importmodule{ResearchRecovery} +\importmodule{ResearchPortfolio} +\importmodule{ResearchPortfolioInput} +\importmodule{ResearchWorkspace} +\importmodule{ResearchSession} +\importmodule{Research} +\importmodule{LexLeanStd.Host} +\title{Boolean} +\begin{semanticmodule} +inductive{ + name: Phase, + type_parameters: [], + parameters: [], + constructors: [{name: recovering, fields: []}, {name: running, fields: []}, {name: publishing, fields: []}, {name: sealing, fields: []}, {name: ended, fields: []}, {name: blocked, fields: []}] +} +structure{ + name: State, + type_parameters: [], + parameters: [], + fields: [{name: publisher, type: (Option ResearchPublication::State)}, {name: publications, type: (List Bytes)}, {name: publishedCommit, type: Bytes}, {name: recovery, type: (Option ResearchRecovery::State)}, {name: portfolio, type: (Option ResearchPortfolio::State)}, {name: results, type: (List (Research::Answer * Bytes))}, {name: phase, type: Phase}, {name: cancelled, type: Bool}] +} +inductive{ + name: Event, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Event]}, {name: cancel, fields: []}] +} +inductive{ + name: Emission, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Request]}, {name: awaiting, fields: []}, {name: complete, fields: [(List (Research::Answer * Bytes)), Bytes]}, {name: cut, fields: []}, {name: blocked, fields: [String]}] +} +definition{ + name: blocked, + parameters: [state : State, reason : String], + result: (State * Emission), + body: ((record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (project state recovery), portfolio := (project state portfolio), results := (project state results), phase := (ctor Phase.blocked), cancelled := (project state cancelled)}), (ctor Emission.blocked reason)), + executable: true +} +definition{ + name: cut, + parameters: [state : State], + result: (State * Emission), + body: ((record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (project state recovery), portfolio := (project state portfolio), results := (project state results), phase := (ctor Phase.ended), cancelled := true}), (ctor Emission.cut)), + executable: true +} +definition{ + name: released, + parameters: [portfolio : ResearchPortfolio::State], + result: Bool, + body: ((match (project portfolio inspection) | Option.none => true | Option.some inspection => false) && ((match (project portfolio phase) | ResearchPortfolio::Phase.ended => true | ResearchPortfolio::Phase.inspecting => false | ResearchPortfolio::Phase.preparing => false | ResearchPortfolio::Phase.advancing => false | ResearchPortfolio::Phase.attempting => false | ResearchPortfolio::Phase.releasing => false | ResearchPortfolio::Phase.blocked => false) && ((match (project portfolio active) | Option.none => true | Option.some session => false) && (match (project portfolio owner) | Option.none => true | Option.some owner => ((not (project owner owned)) && (match (project owner phase) | ResearchWorkspace::Phase.ended => true | ResearchWorkspace::Phase.ready => false | ResearchWorkspace::Phase.checking => false | ResearchWorkspace::Phase.executing => false | ResearchWorkspace::Phase.reading => false | ResearchWorkspace::Phase.blocked => false)))))), + executable: true +} +definition{ + name: sealResult, + parameters: [state : State, result : (ResearchRecovery::State * ResearchRecovery::Emission)], + result: (State * Emission), + body: (let next : State := (record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (ctor Option.some [ResearchRecovery::State] (first result)), portfolio := (project state portfolio), results := (project state results), phase := (ctor Phase.sealing), cancelled := (project state cancelled)}); (match (second result) | ResearchRecovery::Emission.host request => (next, (ctor Emission.host request)) | ResearchRecovery::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchRecovery::Emission.sealed identity => ((record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project next publishedCommit), recovery := (project next recovery), portfolio := (project next portfolio), results := (project next results), phase := (ctor Phase.ended), cancelled := (project next cancelled)}), (ctor Emission.complete (project next results) identity)) | ResearchRecovery::Emission.cut => (cut next) | ResearchRecovery::Emission.blocked reason => (blocked next reason) | ResearchRecovery::Emission.ready input identity => (blocked next "unexpected second controller generation"))), + executable: true +} +definition{ + name: seal, + parameters: [state : State], + result: (State * Emission), + body: (match (project state recovery) | Option.none => (blocked state "missing controller generation") | Option.some recovery => (sealResult state (ResearchRecovery::step recovery (ctor ResearchRecovery::Event.seal)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: publicationResult, + parameters: [state : State, result : (ResearchPublication::State * ResearchPublication::Emission)], + result: (State * Emission), + body: (let next : State := (record State {publisher := (ctor Option.some [ResearchPublication::State] (first result)), publications := (if ((project (first result) published) && (ResearchWorkspace::objectId (project (first result) commit))) then (project (first result) identities) else (project state publications)), publishedCommit := (if ((project (first result) published) && (ResearchWorkspace::objectId (project (first result) commit))) then (project (first result) commit) else (project state publishedCommit)), recovery := (project state recovery), portfolio := (project state portfolio), results := (project state results), phase := (ctor Phase.publishing), cancelled := (project state cancelled)}); (match (second result) | ResearchPublication::Emission.host request => (next, (ctor Emission.host request)) | ResearchPublication::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchPublication::Emission.blocked reason => (blocked next reason) | ResearchPublication::Emission.complete identities commit => (if (ResearchPublication::released (first result)) then (seal (record State {publisher := (ctor Option.none [ResearchPublication::State]), publications := identities, publishedCommit := commit, recovery := (project next recovery), portfolio := (project next portfolio), results := (project next results), phase := (project next phase), cancelled := (project next cancelled)})) else (blocked next "publication completion still owns resources")))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: publish, + parameters: [state : State], + result: (State * Emission), + body: (if (project state cancelled) then (seal state) else (match (project state portfolio) | Option.none => (blocked state "missing completed portfolio") | Option.some portfolio => (match (ResearchPublication::beginBatch (project portfolio base) (project state results)) | Option.none => (seal state) | Option.some result => (publicationResult state result)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: portfolioResult, + parameters: [state : State, result : (ResearchPortfolio::State * ResearchPortfolio::Emission)], + result: (State * Emission), + body: (let next : State := (record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (project state recovery), portfolio := (ctor Option.some [ResearchPortfolio::State] (first result)), results := (project state results), phase := (ctor Phase.running), cancelled := ((project state cancelled) || (project (first result) cancelled))}); (match (second result) | ResearchPortfolio::Emission.host request => (next, (ctor Emission.host request)) | ResearchPortfolio::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchPortfolio::Emission.blocked reason => (blocked next reason) | ResearchPortfolio::Emission.complete research answers => (if (released (first result)) then (publish (record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project next publishedCommit), recovery := (project next recovery), portfolio := (project next portfolio), results := answers, phase := (project next phase), cancelled := (project next cancelled)})) else (blocked next "portfolio completion still owns resources")))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: recoveryResult, + parameters: [state : State, result : (ResearchRecovery::State * ResearchRecovery::Emission)], + result: (State * Emission), + body: (let next : State := (record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (ctor Option.some [ResearchRecovery::State] (first result)), portfolio := (project state portfolio), results := (project state results), phase := (ctor Phase.recovering), cancelled := (project state cancelled)}); (match (second result) | ResearchRecovery::Emission.host request => (next, (ctor Emission.host request)) | ResearchRecovery::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchRecovery::Emission.blocked reason => (blocked next reason) | ResearchRecovery::Emission.cut => (cut next) | ResearchRecovery::Emission.sealed identity => (blocked next "unexpected completed generation during recovery") | ResearchRecovery::Emission.ready input identity => (if (project next cancelled) then (seal next) else (portfolioResult next (ResearchPortfolio::begin (project input research) (project input base) (project input budget)))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: begin, + parameters: [config : ResearchRecovery::Config], + result: (State * Emission), + body: (recoveryResult (record State {publisher := (ctor Option.none [ResearchPublication::State]), publications := (nil Bytes), publishedCommit := 0x, recovery := (ctor Option.none [ResearchRecovery::State]), portfolio := (ctor Option.none [ResearchPortfolio::State]), results := (nil (Research::Answer * Bytes)), phase := (ctor Phase.recovering), cancelled := false}) (ResearchRecovery::begin config)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: host, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (project state phase) | Phase.recovering => (match (project state recovery) | Option.none => (blocked state "missing recovery owner") | Option.some recovery => (recoveryResult state (ResearchRecovery::step recovery (ctor ResearchRecovery::Event.host event)))) | Phase.running => (match (project state portfolio) | Option.none => (blocked state "missing portfolio owner") | Option.some portfolio => (portfolioResult state (ResearchPortfolio::step portfolio (ctor ResearchPortfolio::Event.host event)))) | Phase.publishing => (match (project state publisher) | Option.none => (blocked state "missing publication owner") | Option.some publisher => (publicationResult state (ResearchPublication::step publisher (ctor ResearchPublication::Event.host event)))) | Phase.sealing => (match (project state recovery) | Option.none => (blocked state "missing seal owner") | Option.some recovery => (sealResult state (ResearchRecovery::step recovery (ctor ResearchRecovery::Event.host event)))) | Phase.ended => (state, (ctor Emission.awaiting)) | Phase.blocked => (blocked state "autonomous run retains uncertain ownership")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: cancel, + parameters: [state : State], + result: (State * Emission), + body: (let next : State := (record State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (project state recovery), portfolio := (project state portfolio), results := (project state results), phase := (project state phase), cancelled := true}); (match (project state phase) | Phase.recovering => (match (project state recovery) | Option.none => (blocked next "missing recovery owner") | Option.some recovery => (recoveryResult next (ResearchRecovery::step recovery (ctor ResearchRecovery::Event.cancel)))) | Phase.running => (match (project state portfolio) | Option.none => (blocked next "missing portfolio owner") | Option.some portfolio => (portfolioResult next (ResearchPortfolio::step portfolio (ctor ResearchPortfolio::Event.cancel)))) | Phase.publishing => (match (project next publisher) | Option.none => (blocked next "missing publication owner") | Option.some publisher => (publicationResult next (ResearchPublication::step publisher (ctor ResearchPublication::Event.cancel)))) | Phase.sealing => (next, (ctor Emission.awaiting)) | Phase.ended => (next, (ctor Emission.awaiting)) | Phase.blocked => (blocked next "cancelled autonomous run retains uncertain ownership"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: step, + parameters: [state : State, event : Event], + result: (State * Emission), + body: (match event | Event.host reply => (host state reply) | Event.cancel => (cancel state)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "owned-proof-batch-before-generation-seal" (cons "single-gate-batch-publication" (cons "recovery-before-portfolio-dispatch" (cons "owned-portfolio-host-routing" (cons "no-unreleased-generation-seal" (cons "journal-acknowledgement-before-completion" (cons "uncertain-ownership-halts-autonomy" (cons "terminal-host-events-cannot-restart" (nil String))))))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchAutonomyInput.lex.tex b/rule30-api/src/ResearchAutonomyInput.lex.tex new file mode 100644 index 0000000..2963b2c --- /dev/null +++ b/rule30-api/src/ResearchAutonomyInput.lex.tex @@ -0,0 +1,36 @@ +\begin{lexlean}{ResearchAutonomyInput} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchRecovery} +\importmodule{ResearchPortfolioInput} +\importmodule{ResearchInput} +\importmodule{CoreNotation} +\importmodule{CoreBinding} +\importmodule{Json} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: config, + parameters: [value : Json::Value, environment : (List (String * String))], + result: (Option ResearchRecovery::Config), + body: (if ((CoreNotation::shape value (cons 0x73706563 (cons 0x706f7274666f6c696f (cons 0x7265636f72645f70617468 (cons 0x6d61785f71756172616e74696e6564 (nil Bytes)))))) && (ResearchInput::stringIs (CoreBinding::get value 0x73706563) 0x7233302f72657365617263682d6175746f6e6f6d792f31)) then (match (ResearchPortfolioInput::config (CoreBinding::get value 0x706f7274666f6c696f) environment) | Option.none => (ctor Option.none [ResearchRecovery::Config]) | Option.some portfolio => (match (ResearchInput::text (CoreBinding::get value 0x7265636f72645f70617468)) | Option.none => (ctor Option.none [ResearchRecovery::Config]) | Option.some recordPath => (match (Json::natural (CoreBinding::get value 0x6d61785f71756172616e74696e6564) 8) | Option.none => (ctor Option.none [ResearchRecovery::Config]) | Option.some maxQuarantined => (ctor Option.some [ResearchRecovery::Config] (record ResearchRecovery::Config {portfolio := portfolio, recordPath := recordPath, maxQuarantined := maxQuarantined}))))) else (ctor Option.none [ResearchRecovery::Config])), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: decode, + parameters: [data : Bytes, environment : (List (Bytes * Bytes))], + result: (Option ResearchRecovery::Config), + body: (match (Json::parse data 8388608 96) | Result.error error => (ctor Option.none [ResearchRecovery::Config]) | Result.ok value => (match (ResearchInput::environment environment) | Option.none => (ctor Option.none [ResearchRecovery::Config]) | Option.some admitted => (config value admitted))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "exact-versioned-autonomy-schema" (cons "bounded-quarantine-admission" (cons "proofless-portfolio-input" (cons "lossless-environment-decoding" (nil String))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchAutonomyTraces.lex.tex b/rule30-api/src/ResearchAutonomyTraces.lex.tex new file mode 100644 index 0000000..799dc73 --- /dev/null +++ b/rule30-api/src/ResearchAutonomyTraces.lex.tex @@ -0,0 +1,94 @@ +\begin{lexlean}{ResearchAutonomyTraces} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchPublication} +\importmodule{ResearchAutonomy} +\importmodule{ResearchRecovery} +\importmodule{ResearchPortfolio} +\importmodule{ResearchProject} +\importmodule{ResearchWorkspace} +\importmodule{ResearchSession} +\importmodule{Research} +\importmodule{LexLeanStd.Host} +\importmodule{ResearchInspection} +\title{Boolean} +\begin{semanticmodule} +theorem{ + name: runningPortfolioCannotSealGeneration, + parameters: [portfolio : ResearchPortfolio::State], + statement: ((ResearchAutonomy::released (record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project portfolio research), base := (project portfolio base), owner := (project portfolio owner), active := (project portfolio active), results := (project portfolio results), remaining := (project portfolio remaining), phase := (ctor ResearchPortfolio::Phase.attempting), cancelled := (project portfolio cancelled)})) = false), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: liveSessionCannotSealGeneration, + parameters: [portfolio : ResearchPortfolio::State, session : ResearchSession::State], + statement: ((ResearchAutonomy::released (record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project portfolio research), base := (project portfolio base), owner := (project portfolio owner), active := (ctor Option.some [ResearchSession::State] session), results := (project portfolio results), remaining := (project portfolio remaining), phase := (ctor ResearchPortfolio::Phase.ended), cancelled := (project portfolio cancelled)})) = false), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: ownedLibraryCannotSealGeneration, + parameters: [portfolio : ResearchPortfolio::State, owner : ResearchWorkspace::State], + statement: ((ResearchAutonomy::released (record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project portfolio research), base := (project portfolio base), owner := (ctor Option.some [ResearchWorkspace::State] (record ResearchWorkspace::State {config := (project owner config), operation := (project owner operation), phase := (project owner phase), execution := (project owner execution), owned := true, cancelled := (project owner cancelled), result := (project owner result), detail := (project owner detail)})), active := (ctor Option.none [ResearchSession::State]), results := (project portfolio results), remaining := (project portfolio remaining), phase := (ctor ResearchPortfolio::Phase.ended), cancelled := (project portfolio cancelled)})) = false), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: emptyEndedPortfolioHasNoOwnedResources, + parameters: [portfolio : ResearchPortfolio::State], + statement: ((ResearchAutonomy::released (record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project portfolio research), base := (project portfolio base), owner := (ctor Option.none [ResearchWorkspace::State]), active := (ctor Option.none [ResearchSession::State]), results := (project portfolio results), remaining := (project portfolio remaining), phase := (ctor ResearchPortfolio::Phase.ended), cancelled := (project portfolio cancelled)})) = true), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: uncertainPortfolioNeverSealsJournal, + parameters: [state : ResearchAutonomy::State, portfolio : ResearchPortfolio::State, reason : String], + statement: ((second (ResearchAutonomy::portfolioResult state (portfolio, (ctor ResearchPortfolio::Emission.blocked reason)))) = (ctor ResearchAutonomy::Emission.blocked reason)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: unreleasedCompletionCannotSealJournal, + parameters: [state : ResearchAutonomy::State, portfolio : ResearchPortfolio::State, research : Research::State, answers : (List (Research::Answer * Bytes))], + statement: ((second (ResearchAutonomy::portfolioResult state ((record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project portfolio research), base := (project portfolio base), owner := (project portfolio owner), active := (project portfolio active), results := (project portfolio results), remaining := (project portfolio remaining), phase := (ctor ResearchPortfolio::Phase.attempting), cancelled := (project portfolio cancelled)}), (ctor ResearchPortfolio::Emission.complete research answers)))) = (ctor ResearchAutonomy::Emission.blocked "portfolio completion still owns resources")), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: terminalAutonomyCannotDispatch, + parameters: [state : ResearchAutonomy::State, event : LexLeanStd.Host::Event], + statement: ((second (ResearchAutonomy::host (record ResearchAutonomy::State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (project state recovery), portfolio := (project state portfolio), results := (project state results), phase := (ctor ResearchAutonomy::Phase.ended), cancelled := (project state cancelled)}) event)) = (ctor ResearchAutonomy::Emission.awaiting)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: cancelDuringSealDrainsPendingReply, + parameters: [state : ResearchAutonomy::State], + statement: ((second (ResearchAutonomy::cancel (record ResearchAutonomy::State {publisher := (project state publisher), publications := (project state publications), publishedCommit := (project state publishedCommit), recovery := (project state recovery), portfolio := (project state portfolio), results := (project state results), phase := (ctor ResearchAutonomy::Phase.sealing), cancelled := (project state cancelled)}))) = (ctor ResearchAutonomy::Emission.awaiting)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: unpublishedCompletionCannotSealGeneration, + parameters: [state : ResearchAutonomy::State, publisher : ResearchPublication::State, identities : (List Bytes), commit : Bytes], + statement: ((second (ResearchAutonomy::publicationResult state ((record ResearchPublication::State {pending := (project publisher pending), identities := (project publisher identities), config := (project publisher config), owner := (project publisher owner), candidate := (project publisher candidate), execution := (project publisher execution), phase := (project publisher phase), operation := (project publisher operation), source := (project publisher source), receipt := (project publisher receipt), commit := (project publisher commit), cancelled := (project publisher cancelled), published := false}), (ctor ResearchPublication::Emission.complete identities commit)))) = (ctor ResearchAutonomy::Emission.blocked "publication completion still owns resources")), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: publicationFailureRemainsRecoverable, + parameters: [state : ResearchAutonomy::State, publisher : ResearchPublication::State, reason : String], + statement: ((project (first (ResearchAutonomy::publicationResult state (publisher, (ctor ResearchPublication::Emission.blocked reason)))) publisher) = (ctor Option.some [ResearchPublication::State] publisher)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: acknowledgedPushRemainsReportedAfterCleanupFailure, + parameters: [state : ResearchAutonomy::State, publisher : ResearchPublication::State, reason : String], + statement: ((project (first (ResearchAutonomy::publicationResult state ((record ResearchPublication::State {pending := (project publisher pending), identities := (project publisher identities), config := (project publisher config), owner := (project publisher owner), candidate := (project publisher candidate), execution := (project publisher execution), phase := (project publisher phase), operation := (project publisher operation), source := (project publisher source), receipt := (project publisher receipt), commit := 0x61616161616161616161616161616161616161616161616161616161616161616161616161616161, cancelled := (project publisher cancelled), published := true}), (ctor ResearchPublication::Emission.blocked reason)))) publishedCommit) = 0x61616161616161616161616161616161616161616161616161616161616161616161616161616161), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchCatalog.lex.tex b/rule30-api/src/ResearchCatalog.lex.tex index a9b8e16..3c0575c 100644 --- a/rule30-api/src/ResearchCatalog.lex.tex +++ b/rule30-api/src/ResearchCatalog.lex.tex @@ -38,6 +38,19 @@ \importmodule{ResearchCohortInput} \importmodule{ResearchCohortCommand} \importmodule{ResearchExecution} +\importmodule{ResearchPortfolio} +\importmodule{ResearchPortfolioInput} +\importmodule{CandidateUniverses} +\importmodule{PublicationFrontier} +\importmodule{PublicationPlan} +\importmodule{PublicationRecord} +\importmodule{PublicationSource} +\importmodule{ResearchAutonomy} +\importmodule{ResearchAutonomyInput} +\importmodule{ResearchInspection} +\importmodule{ResearchInspectionBinding} +\importmodule{ResearchPublication} +\importmodule{ResearchRecovery} \title{Boolean} \begin{semanticmodule} structure{ @@ -58,7 +71,7 @@ name: moduleScopes, parameters: [], result: (List Scope), - body: (prim append (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707330 "VerificationUtf8Steps0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707331 "VerificationUtf8Steps1") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707332 "VerificationUtf8Steps2") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707333 "VerificationUtf8Steps3") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707334 "VerificationUtf8Steps4") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707335 "VerificationUtf8Steps5") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707336 "VerificationUtf8Steps6") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707337 "VerificationUtf8Steps7") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707338 "VerificationUtf8Steps8") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707339 "VerificationUtf8Steps9") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e53746570733131 "VerificationJsonSteps11") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e53746570733130 "VerificationJsonSteps10") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707339 "VerificationJsonSteps9") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707338 "VerificationJsonSteps8") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707337 "VerificationJsonSteps7") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707336 "VerificationJsonSteps6") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707335 "VerificationJsonSteps5") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707334 "VerificationJsonSteps4") (cons (unitScope 0x6d6f64756c652f466f756e646174696f6e2e536563 "Foundation.Sec") (cons (unitScope 0x6d6f64756c652f5265736561726368417263686974656374757265 "ResearchArchitecture") (cons (unitScope 0x6d6f64756c652f52657365617263684a6f75726e616c547261636573 "ResearchJournalTraces") (cons (unitScope 0x6d6f64756c652f52657365617263684a6f75726e616c "ResearchJournal") (cons (unitScope 0x6d6f64756c652f5265736561726368466163746f7279 "ResearchFactory") (cons (unitScope 0x6d6f64756c652f5265736561726368466163746f7279547261636573 "ResearchFactoryTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707332 "VerificationHashSteps2") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707333 "VerificationHashSteps3") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707334 "VerificationHashSteps4") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707335 "VerificationHashSteps5") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4d65746164617461547261636573 "VerificationMetadataTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e50726f63657373547261636573 "VerificationProcessTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e506f6c696379547261636573 "VerificationPolicyTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4964656e74697479547261636573 "VerificationIdentityTraces") (nil Scope))))))))))))))))))))))))))))))))) (prim append (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4861736844617461 "VerificationHashData") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707330 "VerificationHashSteps0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707331 "VerificationHashSteps1") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436f6d6d616e64 "ResearchCohortCommand") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274496e707574 "ResearchCohortInput") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274547261636573 "ResearchCohortTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274 "ResearchCohort") (cons (unitScope 0x6d6f64756c652f5265736561726368496e707574 "ResearchInput") (cons (unitScope 0x6d6f64756c652f5265736561726368496e707574547261636573 "ResearchInputTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368436f6d6d616e64 "ResearchCommand") (cons (unitScope 0x6d6f64756c652f5265736561726368436f6d6d616e64547261636573 "ResearchCommandTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368576f726b7370616365 "ResearchWorkspace") (cons (unitScope 0x6d6f64756c652f5265736561726368576f726b7370616365547261636573 "ResearchWorkspaceTraces") (cons (unitScope 0x6d6f64756c652f526573656172636845766964656e6365 "ResearchEvidence") (cons (unitScope 0x6d6f64756c652f526573656172636845766964656e6365547261636573 "ResearchEvidenceTraces") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6a656374 "ResearchProject") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6a656374547261636573 "ResearchProjectTraces") (cons (unitScope 0x6d6f64756c652f52657365617263685265636f7264 "ResearchRecord") (cons (unitScope 0x6d6f64756c652f526573656172636853657373696f6e "ResearchSession") (cons (unitScope 0x6d6f64756c652f526573656172636853657373696f6e547261636573 "ResearchSessionTraces") (cons (unitScope 0x6d6f64756c652f436f72654e6f746174696f6e547261636573 "CoreNotationTraces") (cons (unitScope 0x6d6f64756c652f436f72654e6f746174696f6e "CoreNotation") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365 "CandidateSource") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365547261636573 "CandidateSourceTraces") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c547261636573 "ClosedGoalTraces") (cons (unitScope 0x6d6f64756c652f436c6f73656442696e64696e6746697874757265 "ClosedBindingFixture") (cons (unitScope 0x6d6f64756c652f436f6d70696c6572536e617073686f74 "CompilerSnapshot") (cons (unitScope 0x6d6f64756c652f436f6d70696c6572536e617073686f74547261636573 "CompilerSnapshotTraces") (cons (unitScope 0x6d6f64756c652f526573656172636843616e646964617465 "ResearchCandidate") (cons (unitScope 0x6d6f64756c652f526573656172636843616e646964617465547261636573 "ResearchCandidateTraces") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6f66547261636573 "ResearchProofTraces") (cons (unitScope 0x6d6f64756c652f43616e64696461746542696e64696e67547261636573 "CandidateBindingTraces") (nil Scope))))))))))))))))))))))))))))))))) (prim append (cons (unitScope 0x6d6f64756c652f42696e64696e6746697874757265 "BindingFixture") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6f66 "ResearchProof") (cons (unitScope 0x6d6f64756c652f43616e64696461746542696e64696e67 "CandidateBinding") (cons (unitScope 0x6d6f64756c652f41727469666163744964656e74697479547261636573 "ArtifactIdentityTraces") (cons (unitScope 0x6d6f64756c652f41727469666163744964656e74697479 "ArtifactIdentity") (cons (unitScope 0x6d6f64756c652f436f726542696e64696e67547261636573 "CoreBindingTraces") (cons (unitScope 0x6d6f64756c652f436f726542696e64696e67 "CoreBinding") (cons (unitScope 0x6d6f64756c652f4a736f6e43616e6f6e6963616c547261636573 "JsonCanonicalTraces") (cons (unitScope 0x6d6f64756c652f4a736f6e43616e6f6e6963616c "JsonCanonical") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e557466384669787475726573 "VerificationUtf8Fixtures") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e436f6d6d616e644669787475726573 "VerificationCommandFixtures") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e44617461 "VerificationJsonData") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707330 "VerificationJsonSteps0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707331 "VerificationJsonSteps1") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707332 "VerificationJsonSteps2") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707333 "VerificationJsonSteps3") (cons (unitScope 0x6d6f64756c652f417069 "Api") (cons (unitScope 0x6d6f64756c652f4170706c69636174696f6e "Application") (cons (unitScope 0x6d6f64756c652f417263686974656374757265 "Architecture") (cons (unitScope 0x6d6f64756c652f4175646974 "Audit") (cons (unitScope 0x6d6f64756c652f436f6e76657274 "Convert") (cons (unitScope 0x6d6f64756c652f446973636f76657279 "Discovery") (cons (unitScope 0x6d6f64756c652f456e67696e65 "Engine") (cons (unitScope 0x6d6f64756c652f486f7374 "Host") (cons (unitScope 0x6d6f64756c652f4879706f746865736573 "Hypotheses") (cons (unitScope 0x6d6f64756c652f4f62736572766572 "Observer") (cons (unitScope 0x6d6f64756c652f50726573656e746174696f6e "Presentation") (cons (unitScope 0x6d6f64756c652f523330 "R30") (cons (unitScope 0x6d6f64756c652f523330547261636573 "R30Traces") (cons (unitScope 0x6d6f64756c652f523330547261636573436c61696d73 "R30TracesClaims") (cons (unitScope 0x6d6f64756c652f523330547261636573466f726d73 "R30TracesForms") (cons (unitScope 0x6d6f64756c652f5233305472616365735265676973746572 "R30TracesRegister") (nil Scope))))))))))))))))))))))))))))))))) (prim append (cons (unitScope 0x6d6f64756c652f5265676973746572 "Register") (cons (unitScope 0x6d6f64756c652f5265736561726368 "Research") (cons (unitScope 0x6d6f64756c652f5265736561726368436174616c6f67 "ResearchCatalog") (cons (unitScope 0x6d6f64756c652f5265736561726368547261636573 "ResearchTraces") (cons (unitScope 0x6d6f64756c652f52756c653330436f7265 "Rule30Core") (cons (unitScope 0x6d6f64756c652f53657175656e636573 "Sequences") (cons (unitScope 0x6d6f64756c652f5374616e6461726473 "Standards") (cons (unitScope 0x6d6f64756c652f546f6d6c "Toml") (cons (unitScope 0x6d6f64756c652f466f756e646174696f6e2e41726368 "Foundation.Arch") (cons (unitScope 0x6d6f64756c652f466f756e646174696f6e2e5175616c "Foundation.Qual") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e427566666572 "LexLeanStd.Buffer") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e54657874 "LexLeanStd.Text") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e536861323536 "LexLeanStd.Sha256") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e486f7374 "LexLeanStd.Host") (cons (unitScope 0x6d6f64756c652f5265736561726368457865637574696f6e "ResearchExecution") (cons (unitScope 0x6d6f64756c652f5265736561726368457865637574696f6e547261636573 "ResearchExecutionTraces") (cons (unitScope 0x6d6f64756c652f526573656172636852756e6e6572 "ResearchRunner") (cons (unitScope 0x6d6f64756c652f526573656172636852756e6e6572547261636573 "ResearchRunnerTraces") (cons (unitScope 0x6d6f64756c652f4a736f6e "Json") (cons (unitScope 0x6d6f64756c652f4a736f6e547261636573 "JsonTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e5265706f7274 "VerificationReport") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e5265706f7274547261636573 "VerificationReportTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e "ResearchVerification") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e547261636573 "ResearchVerificationTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e4669787475726573 "VerificationJsonFixtures") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e486173684669787475726573 "VerificationHashFixtures") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7330 "ClosedGoalChecks0") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7331 "ClosedGoalChecks1") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7332 "ClosedGoalChecks2") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7333 "ClosedGoalChecks3") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436865636b7330 "ResearchCohortChecks0") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436865636b7331 "ResearchCohortChecks1") (nil Scope))))))))))))))))))))))))))))))))) (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436865636b7332 "ResearchCohortChecks2") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7330 "CandidateSourceChecks0") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7331 "CandidateSourceChecks1") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7332 "CandidateSourceChecks2") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7333 "CandidateSourceChecks3") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7330 "ResearchVerificationChecks0") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7331 "ResearchVerificationChecks1") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7332 "ResearchVerificationChecks2") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7333 "ResearchVerificationChecks3") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7334 "ResearchVerificationChecks4") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7335 "ResearchVerificationChecks5") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7336 "ResearchVerificationChecks6") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e506f6c696379436865636b7330 "VerificationPolicyChecks0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e50726f63657373436865636b7330 "VerificationProcessChecks0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4d65746164617461436865636b7330 "VerificationMetadataChecks0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4d65746164617461436865636b7331 "VerificationMetadataChecks1") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7334 "ClosedGoalChecks4") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7335 "ClosedGoalChecks5") (nil Scope))))))))))))))))))) : (List Scope)) : (List Scope)) : (List Scope)) : (List Scope)), + body: (prim append (cons (unitScope 0x6d6f64756c652f43616e646964617465556e69766572736573 "CandidateUniverses") (cons (unitScope 0x6d6f64756c652f43616e646964617465556e69766572736573547261636573 "CandidateUniversesTraces") (cons (unitScope 0x6d6f64756c652f5075626c69636174696f6e46726f6e74696572 "PublicationFrontier") (cons (unitScope 0x6d6f64756c652f5075626c69636174696f6e506c616e "PublicationPlan") (cons (unitScope 0x6d6f64756c652f5075626c69636174696f6e5265636f7264 "PublicationRecord") (cons (unitScope 0x6d6f64756c652f5075626c69636174696f6e536f75726365 "PublicationSource") (cons (unitScope 0x6d6f64756c652f52657365617263684175746f6e6f6d79 "ResearchAutonomy") (cons (unitScope 0x6d6f64756c652f52657365617263684175746f6e6f6d79496e707574 "ResearchAutonomyInput") (cons (unitScope 0x6d6f64756c652f52657365617263684175746f6e6f6d79547261636573 "ResearchAutonomyTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368496e7370656374696f6e "ResearchInspection") (cons (unitScope 0x6d6f64756c652f5265736561726368496e7370656374696f6e42696e64696e67 "ResearchInspectionBinding") (cons (unitScope 0x6d6f64756c652f5265736561726368496e7370656374696f6e42696e64696e67547261636573 "ResearchInspectionBindingTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368496e7370656374696f6e547261636573 "ResearchInspectionTraces") (cons (unitScope 0x6d6f64756c652f52657365617263685075626c69636174696f6e "ResearchPublication") (cons (unitScope 0x6d6f64756c652f52657365617263685075626c69636174696f6e547261636573 "ResearchPublicationTraces") (cons (unitScope 0x6d6f64756c652f52657365617263685265636f76657279 "ResearchRecovery") (cons (unitScope 0x6d6f64756c652f52657365617263685265636f76657279547261636573 "ResearchRecoveryTraces") (nil Scope)))))))))))))))))) (prim append (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707330 "VerificationUtf8Steps0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707331 "VerificationUtf8Steps1") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707332 "VerificationUtf8Steps2") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707333 "VerificationUtf8Steps3") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707334 "VerificationUtf8Steps4") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707335 "VerificationUtf8Steps5") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707336 "VerificationUtf8Steps6") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707337 "VerificationUtf8Steps7") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707338 "VerificationUtf8Steps8") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e55746638537465707339 "VerificationUtf8Steps9") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e53746570733131 "VerificationJsonSteps11") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e53746570733130 "VerificationJsonSteps10") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707339 "VerificationJsonSteps9") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707338 "VerificationJsonSteps8") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707337 "VerificationJsonSteps7") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707336 "VerificationJsonSteps6") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707335 "VerificationJsonSteps5") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707334 "VerificationJsonSteps4") (cons (unitScope 0x6d6f64756c652f466f756e646174696f6e2e536563 "Foundation.Sec") (cons (unitScope 0x6d6f64756c652f5265736561726368417263686974656374757265 "ResearchArchitecture") (cons (unitScope 0x6d6f64756c652f52657365617263684a6f75726e616c547261636573 "ResearchJournalTraces") (cons (unitScope 0x6d6f64756c652f52657365617263684a6f75726e616c "ResearchJournal") (cons (unitScope 0x6d6f64756c652f5265736561726368466163746f7279 "ResearchFactory") (cons (unitScope 0x6d6f64756c652f5265736561726368466163746f7279547261636573 "ResearchFactoryTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707332 "VerificationHashSteps2") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707333 "VerificationHashSteps3") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707334 "VerificationHashSteps4") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707335 "VerificationHashSteps5") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4d65746164617461547261636573 "VerificationMetadataTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e50726f63657373547261636573 "VerificationProcessTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e506f6c696379547261636573 "VerificationPolicyTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4964656e74697479547261636573 "VerificationIdentityTraces") (nil Scope))))))))))))))))))))))))))))))))) (prim append (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4861736844617461 "VerificationHashData") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707330 "VerificationHashSteps0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e48617368537465707331 "VerificationHashSteps1") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436f6d6d616e64 "ResearchCohortCommand") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274496e707574 "ResearchCohortInput") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274547261636573 "ResearchCohortTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274 "ResearchCohort") (cons (unitScope 0x6d6f64756c652f5265736561726368496e707574 "ResearchInput") (cons (unitScope 0x6d6f64756c652f5265736561726368496e707574547261636573 "ResearchInputTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368436f6d6d616e64 "ResearchCommand") (cons (unitScope 0x6d6f64756c652f5265736561726368436f6d6d616e64547261636573 "ResearchCommandTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368576f726b7370616365 "ResearchWorkspace") (cons (unitScope 0x6d6f64756c652f5265736561726368576f726b7370616365547261636573 "ResearchWorkspaceTraces") (cons (unitScope 0x6d6f64756c652f526573656172636845766964656e6365 "ResearchEvidence") (cons (unitScope 0x6d6f64756c652f526573656172636845766964656e6365547261636573 "ResearchEvidenceTraces") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6a656374 "ResearchProject") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6a656374547261636573 "ResearchProjectTraces") (cons (unitScope 0x6d6f64756c652f52657365617263685265636f7264 "ResearchRecord") (cons (unitScope 0x6d6f64756c652f526573656172636853657373696f6e "ResearchSession") (cons (unitScope 0x6d6f64756c652f526573656172636853657373696f6e547261636573 "ResearchSessionTraces") (cons (unitScope 0x6d6f64756c652f436f72654e6f746174696f6e547261636573 "CoreNotationTraces") (cons (unitScope 0x6d6f64756c652f436f72654e6f746174696f6e "CoreNotation") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365 "CandidateSource") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365547261636573 "CandidateSourceTraces") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c547261636573 "ClosedGoalTraces") (cons (unitScope 0x6d6f64756c652f436c6f73656442696e64696e6746697874757265 "ClosedBindingFixture") (cons (unitScope 0x6d6f64756c652f436f6d70696c6572536e617073686f74 "CompilerSnapshot") (cons (unitScope 0x6d6f64756c652f436f6d70696c6572536e617073686f74547261636573 "CompilerSnapshotTraces") (cons (unitScope 0x6d6f64756c652f526573656172636843616e646964617465 "ResearchCandidate") (cons (unitScope 0x6d6f64756c652f526573656172636843616e646964617465547261636573 "ResearchCandidateTraces") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6f66547261636573 "ResearchProofTraces") (cons (unitScope 0x6d6f64756c652f43616e64696461746542696e64696e67547261636573 "CandidateBindingTraces") (nil Scope))))))))))))))))))))))))))))))))) (prim append (cons (unitScope 0x6d6f64756c652f42696e64696e6746697874757265 "BindingFixture") (cons (unitScope 0x6d6f64756c652f526573656172636850726f6f66 "ResearchProof") (cons (unitScope 0x6d6f64756c652f43616e64696461746542696e64696e67 "CandidateBinding") (cons (unitScope 0x6d6f64756c652f41727469666163744964656e74697479547261636573 "ArtifactIdentityTraces") (cons (unitScope 0x6d6f64756c652f41727469666163744964656e74697479 "ArtifactIdentity") (cons (unitScope 0x6d6f64756c652f436f726542696e64696e67547261636573 "CoreBindingTraces") (cons (unitScope 0x6d6f64756c652f436f726542696e64696e67 "CoreBinding") (cons (unitScope 0x6d6f64756c652f4a736f6e43616e6f6e6963616c547261636573 "JsonCanonicalTraces") (cons (unitScope 0x6d6f64756c652f4a736f6e43616e6f6e6963616c "JsonCanonical") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e557466384669787475726573 "VerificationUtf8Fixtures") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e436f6d6d616e644669787475726573 "VerificationCommandFixtures") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e44617461 "VerificationJsonData") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707330 "VerificationJsonSteps0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707331 "VerificationJsonSteps1") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707332 "VerificationJsonSteps2") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e537465707333 "VerificationJsonSteps3") (cons (unitScope 0x6d6f64756c652f417069 "Api") (cons (unitScope 0x6d6f64756c652f4170706c69636174696f6e "Application") (cons (unitScope 0x6d6f64756c652f417263686974656374757265 "Architecture") (cons (unitScope 0x6d6f64756c652f4175646974 "Audit") (cons (unitScope 0x6d6f64756c652f436f6e76657274 "Convert") (cons (unitScope 0x6d6f64756c652f446973636f76657279 "Discovery") (cons (unitScope 0x6d6f64756c652f456e67696e65 "Engine") (cons (unitScope 0x6d6f64756c652f486f7374 "Host") (cons (unitScope 0x6d6f64756c652f4879706f746865736573 "Hypotheses") (cons (unitScope 0x6d6f64756c652f4f62736572766572 "Observer") (cons (unitScope 0x6d6f64756c652f50726573656e746174696f6e "Presentation") (cons (unitScope 0x6d6f64756c652f523330 "R30") (cons (unitScope 0x6d6f64756c652f523330547261636573 "R30Traces") (cons (unitScope 0x6d6f64756c652f523330547261636573436c61696d73 "R30TracesClaims") (cons (unitScope 0x6d6f64756c652f523330547261636573466f726d73 "R30TracesForms") (cons (unitScope 0x6d6f64756c652f5233305472616365735265676973746572 "R30TracesRegister") (nil Scope))))))))))))))))))))))))))))))))) (prim append (cons (unitScope 0x6d6f64756c652f5265676973746572 "Register") (cons (unitScope 0x6d6f64756c652f5265736561726368 "Research") (cons (unitScope 0x6d6f64756c652f5265736561726368436174616c6f67 "ResearchCatalog") (cons (unitScope 0x6d6f64756c652f5265736561726368547261636573 "ResearchTraces") (cons (unitScope 0x6d6f64756c652f52756c653330436f7265 "Rule30Core") (cons (unitScope 0x6d6f64756c652f53657175656e636573 "Sequences") (cons (unitScope 0x6d6f64756c652f5374616e6461726473 "Standards") (cons (unitScope 0x6d6f64756c652f546f6d6c "Toml") (cons (unitScope 0x6d6f64756c652f466f756e646174696f6e2e41726368 "Foundation.Arch") (cons (unitScope 0x6d6f64756c652f466f756e646174696f6e2e5175616c "Foundation.Qual") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e427566666572 "LexLeanStd.Buffer") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e54657874 "LexLeanStd.Text") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e536861323536 "LexLeanStd.Sha256") (cons (unitScope 0x6d6f64756c652f4c65784c65616e5374642e486f7374 "LexLeanStd.Host") (cons (unitScope 0x6d6f64756c652f5265736561726368457865637574696f6e "ResearchExecution") (cons (unitScope 0x6d6f64756c652f5265736561726368457865637574696f6e547261636573 "ResearchExecutionTraces") (cons (unitScope 0x6d6f64756c652f526573656172636852756e6e6572 "ResearchRunner") (cons (unitScope 0x6d6f64756c652f526573656172636852756e6e6572547261636573 "ResearchRunnerTraces") (cons (unitScope 0x6d6f64756c652f4a736f6e "Json") (cons (unitScope 0x6d6f64756c652f4a736f6e547261636573 "JsonTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e5265706f7274 "VerificationReport") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e5265706f7274547261636573 "VerificationReportTraces") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e "ResearchVerification") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e547261636573 "ResearchVerificationTraces") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4a736f6e4669787475726573 "VerificationJsonFixtures") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e486173684669787475726573 "VerificationHashFixtures") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7330 "ClosedGoalChecks0") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7331 "ClosedGoalChecks1") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7332 "ClosedGoalChecks2") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7333 "ClosedGoalChecks3") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436865636b7330 "ResearchCohortChecks0") (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436865636b7331 "ResearchCohortChecks1") (nil Scope))))))))))))))))))))))))))))))))) (cons (unitScope 0x6d6f64756c652f5265736561726368436f686f7274436865636b7332 "ResearchCohortChecks2") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7330 "CandidateSourceChecks0") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7331 "CandidateSourceChecks1") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7332 "CandidateSourceChecks2") (cons (unitScope 0x6d6f64756c652f43616e646964617465536f75726365436865636b7333 "CandidateSourceChecks3") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7330 "ResearchVerificationChecks0") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7331 "ResearchVerificationChecks1") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7332 "ResearchVerificationChecks2") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7333 "ResearchVerificationChecks3") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7334 "ResearchVerificationChecks4") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7335 "ResearchVerificationChecks5") (cons (unitScope 0x6d6f64756c652f5265736561726368566572696669636174696f6e436865636b7336 "ResearchVerificationChecks6") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e506f6c696379436865636b7330 "VerificationPolicyChecks0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e50726f63657373436865636b7330 "VerificationProcessChecks0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4d65746164617461436865636b7330 "VerificationMetadataChecks0") (cons (unitScope 0x6d6f64756c652f566572696669636174696f6e4d65746164617461436865636b7331 "VerificationMetadataChecks1") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7334 "ClosedGoalChecks4") (cons (unitScope 0x6d6f64756c652f436c6f736564476f616c436865636b7335 "ClosedGoalChecks5") (cons (unitScope 0x6d6f64756c652f5265736561726368506f7274666f6c696f "ResearchPortfolio") (cons (unitScope 0x6d6f64756c652f5265736561726368506f7274666f6c696f496e707574 "ResearchPortfolioInput") (cons (unitScope 0x6d6f64756c652f5265736561726368506f7274666f6c696f547261636573 "ResearchPortfolioTraces") (nil Scope)))))))))))))))))))))) : (List Scope)) : (List Scope)) : (List Scope)) : (List Scope)) : (List Scope)), axioms: [] } @@ -66,7 +79,7 @@ name: facetScopes, parameters: [], result: (List Scope), - body: (cons (record Scope {id := 0x72657365617263682d617263686974656374757265, module := "ResearchArchitecture", features := (ResearchArchitecture::features)}) (cons (record Scope {id := 0x72657365617263682d6a6f75726e616c, module := "ResearchJournal", features := (ResearchJournal::features)}) (cons (record Scope {id := 0x72657365617263682d666163746f7279, module := "ResearchFactory", features := (ResearchFactory::features)}) (cons (record Scope {id := 0x5265736561726368436f686f7274436f6d6d616e64, module := "ResearchCohortCommand", features := (ResearchCohortCommand::features)}) (cons (record Scope {id := 0x5265736561726368436f686f7274496e707574, module := "ResearchCohortInput", features := (ResearchCohortInput::features)}) (cons (record Scope {id := 0x72657365617263682d636f686f7274, module := "ResearchCohort", features := (ResearchCohort::features)}) (cons (record Scope {id := 0x72657365617263682d696e707574, module := "ResearchInput", features := (ResearchInput::features)}) (cons (record Scope {id := 0x72657365617263682d636f6d6d616e64, module := "ResearchCommand", features := (ResearchCommand::features)}) (cons (record Scope {id := 0x72657365617263682d657865637574696f6e, module := "ResearchExecution", features := (ResearchExecution::features)}) (cons (record Scope {id := 0x72657365617263682d776f726b7370616365, module := "ResearchWorkspace", features := (ResearchWorkspace::features)}) (cons (record Scope {id := 0x72657365617263682d65766964656e6365, module := "ResearchEvidence", features := (ResearchEvidence::features)}) (cons (record Scope {id := 0x72657365617263682d70726f6a656374, module := "ResearchProject", features := (ResearchProject::features)}) (cons (record Scope {id := 0x72657365617263682d7265636f7264, module := "ResearchRecord", features := (ResearchRecord::features)}) (cons (record Scope {id := 0x72657365617263682d73657373696f6e, module := "ResearchSession", features := (ResearchSession::features)}) (cons (record Scope {id := 0x636f72652d6e6f746174696f6e, module := "CoreNotation", features := (CoreNotation::features)}) (cons (record Scope {id := 0x63616e6469646174652d736f75726365, module := "CandidateSource", features := (CandidateSource::features)}) (cons (record Scope {id := 0x726567697374657265642d636c6f7365642d676f616c73, module := "ResearchCatalog", features := (cons "registered-closed-proposition-goals" (cons "canonical-prize-goal" (cons "block-goal-redirection" (nil String))))}) (cons (record Scope {id := 0x636f6d70696c65722d736e617073686f74, module := "CompilerSnapshot", features := (CompilerSnapshot::features)}) (cons (record Scope {id := 0x72657365617263682d63616e646964617465, module := "ResearchCandidate", features := (ResearchCandidate::features)}) (cons (record Scope {id := 0x70726f6f662d766572696669636174696f6e, module := "ResearchProof", features := (ResearchProof::features)}) (cons (record Scope {id := 0x63616e6469646174652d62696e64696e67, module := "CandidateBinding", features := (CandidateBinding::features)}) (cons (record Scope {id := 0x61727469666163742d6964656e74697479, module := "ArtifactIdentity", features := (ArtifactIdentity::features)}) (cons (record Scope {id := 0x636f72652d62696e64696e67, module := "CoreBinding", features := (CoreBinding::features)}) (cons (record Scope {id := 0x63616e6f6e6963616c2d6a736f6e, module := "JsonCanonical", features := (JsonCanonical::features)}) (cons (record Scope {id := 0x617069, module := "Api", features := (Architecture::commandNames (Api::commands))}) + body: (prim append (cons (record Scope {id := 0x43616e646964617465556e69766572736573, module := "CandidateUniverses", features := (CandidateUniverses::features)}) (cons (record Scope {id := 0x5075626c69636174696f6e46726f6e74696572, module := "PublicationFrontier", features := (PublicationFrontier::features)}) (cons (record Scope {id := 0x5075626c69636174696f6e506c616e, module := "PublicationPlan", features := (PublicationPlan::features)}) (cons (record Scope {id := 0x5075626c69636174696f6e5265636f7264, module := "PublicationRecord", features := (PublicationRecord::features)}) (cons (record Scope {id := 0x5075626c69636174696f6e536f75726365, module := "PublicationSource", features := (PublicationSource::features)}) (cons (record Scope {id := 0x52657365617263684175746f6e6f6d79, module := "ResearchAutonomy", features := (ResearchAutonomy::features)}) (cons (record Scope {id := 0x52657365617263684175746f6e6f6d79496e707574, module := "ResearchAutonomyInput", features := (ResearchAutonomyInput::features)}) (cons (record Scope {id := 0x5265736561726368496e7370656374696f6e, module := "ResearchInspection", features := (ResearchInspection::features)}) (cons (record Scope {id := 0x5265736561726368496e7370656374696f6e42696e64696e67, module := "ResearchInspectionBinding", features := (ResearchInspectionBinding::features)}) (cons (record Scope {id := 0x52657365617263685075626c69636174696f6e, module := "ResearchPublication", features := (ResearchPublication::features)}) (cons (record Scope {id := 0x52657365617263685265636f76657279, module := "ResearchRecovery", features := (ResearchRecovery::features)}) (nil Scope)))))))))))) (cons (record Scope {id := 0x5265736561726368506f7274666f6c696f496e707574, module := "ResearchPortfolioInput", features := (ResearchPortfolioInput::features)}) (cons (record Scope {id := 0x5265736561726368506f7274666f6c696f, module := "ResearchPortfolio", features := (ResearchPortfolio::features)}) (cons (record Scope {id := 0x72657365617263682d617263686974656374757265, module := "ResearchArchitecture", features := (ResearchArchitecture::features)}) (cons (record Scope {id := 0x72657365617263682d6a6f75726e616c, module := "ResearchJournal", features := (ResearchJournal::features)}) (cons (record Scope {id := 0x72657365617263682d666163746f7279, module := "ResearchFactory", features := (ResearchFactory::features)}) (cons (record Scope {id := 0x5265736561726368436f686f7274436f6d6d616e64, module := "ResearchCohortCommand", features := (ResearchCohortCommand::features)}) (cons (record Scope {id := 0x5265736561726368436f686f7274496e707574, module := "ResearchCohortInput", features := (ResearchCohortInput::features)}) (cons (record Scope {id := 0x72657365617263682d636f686f7274, module := "ResearchCohort", features := (ResearchCohort::features)}) (cons (record Scope {id := 0x72657365617263682d696e707574, module := "ResearchInput", features := (ResearchInput::features)}) (cons (record Scope {id := 0x72657365617263682d636f6d6d616e64, module := "ResearchCommand", features := (ResearchCommand::features)}) (cons (record Scope {id := 0x72657365617263682d657865637574696f6e, module := "ResearchExecution", features := (ResearchExecution::features)}) (cons (record Scope {id := 0x72657365617263682d776f726b7370616365, module := "ResearchWorkspace", features := (ResearchWorkspace::features)}) (cons (record Scope {id := 0x72657365617263682d65766964656e6365, module := "ResearchEvidence", features := (ResearchEvidence::features)}) (cons (record Scope {id := 0x72657365617263682d70726f6a656374, module := "ResearchProject", features := (ResearchProject::features)}) (cons (record Scope {id := 0x72657365617263682d7265636f7264, module := "ResearchRecord", features := (ResearchRecord::features)}) (cons (record Scope {id := 0x72657365617263682d73657373696f6e, module := "ResearchSession", features := (ResearchSession::features)}) (cons (record Scope {id := 0x636f72652d6e6f746174696f6e, module := "CoreNotation", features := (CoreNotation::features)}) (cons (record Scope {id := 0x63616e6469646174652d736f75726365, module := "CandidateSource", features := (CandidateSource::features)}) (cons (record Scope {id := 0x726567697374657265642d636c6f7365642d676f616c73, module := "ResearchCatalog", features := (cons "registered-closed-proposition-goals" (cons "canonical-prize-goal" (cons "block-goal-redirection" (nil String))))}) (cons (record Scope {id := 0x636f6d70696c65722d736e617073686f74, module := "CompilerSnapshot", features := (CompilerSnapshot::features)}) (cons (record Scope {id := 0x72657365617263682d63616e646964617465, module := "ResearchCandidate", features := (ResearchCandidate::features)}) (cons (record Scope {id := 0x70726f6f662d766572696669636174696f6e, module := "ResearchProof", features := (ResearchProof::features)}) (cons (record Scope {id := 0x63616e6469646174652d62696e64696e67, module := "CandidateBinding", features := (CandidateBinding::features)}) (cons (record Scope {id := 0x61727469666163742d6964656e74697479, module := "ArtifactIdentity", features := (ArtifactIdentity::features)}) (cons (record Scope {id := 0x636f72652d62696e64696e67, module := "CoreBinding", features := (CoreBinding::features)}) (cons (record Scope {id := 0x63616e6f6e6963616c2d6a736f6e, module := "JsonCanonical", features := (JsonCanonical::features)}) (cons (record Scope {id := 0x617069, module := "Api", features := (Architecture::commandNames (Api::commands))}) (cons (record Scope {id := 0x636c61696d73, module := "Register", features := (Register::idsOf (Register::claims))}) (cons (record Scope {id := 0x7374616b65686f6c64657273, module := "Architecture", features := (Architecture::stakeholderIds (Architecture::stakeholders))}) (cons (record Scope {id := 0x636f6e6365726e73, module := "Architecture", features := (Architecture::concernIds (Architecture::concerns))}) @@ -85,7 +98,7 @@ (cons (record Scope {id := 0x706f7274666f6c696f, module := "Engine", features := (Engine::strategyIdsOf (Engine::portfolio))}) (cons (record Scope {id := 0x7265616c697a657273, module := "Standards", features := (Standards::declaredIds)}) (cons (record Scope {id := 0x7374646c6962, module := "Research", features := (cons "Foundation.Arch" (cons "Foundation.Qual" (cons "LexLeanStd.Buffer" (cons "LexLeanStd.Text" (cons "LexLeanStd.Sha256" (cons "LexLeanStd.Host" (nil String)))))))}) - (cons (record Scope {id := 0x6a736f6e, module := "Json", features := (Json::features)}) (cons (record Scope {id := 0x766572696669636174696f6e2d7265706f727473, module := "VerificationReport", features := (VerificationReport::features)}) (cons (record Scope {id := 0x766572696669636174696f6e2d657865637574696f6e, module := "ResearchVerification", features := (ResearchVerification::features)}) (nil Scope))))))))))))))))))))))))))))))))))))))))))))))), + (cons (record Scope {id := 0x6a736f6e, module := "Json", features := (Json::features)}) (cons (record Scope {id := 0x766572696669636174696f6e2d7265706f727473, module := "VerificationReport", features := (VerificationReport::features)}) (cons (record Scope {id := 0x766572696669636174696f6e2d657865637574696f6e, module := "ResearchVerification", features := (ResearchVerification::features)}) (nil Scope))))))))))))))))))))))))))))))))))))))))))))))))) : (List Scope)), axioms: [] } diff --git a/rule30-api/src/ResearchCohortCommand.lex.tex b/rule30-api/src/ResearchCohortCommand.lex.tex index 1cb6a36..96f5483 100644 --- a/rule30-api/src/ResearchCohortCommand.lex.tex +++ b/rule30-api/src/ResearchCohortCommand.lex.tex @@ -6,8 +6,16 @@ \importmodule{Research} \importmodule{ResearchCohort} \importmodule{ResearchCohortInput} +\importmodule{ResearchPortfolio} +\importmodule{ResearchPortfolioInput} +\importmodule{ResearchAutonomy} +\importmodule{ResearchAutonomyInput} +\importmodule{ResearchRecovery} +\importmodule{ResearchInput} +\importmodule{ResearchProject} \importmodule{ResearchCommand} \importmodule{ResearchRecord} +\importmodule{CandidateSource} \importmodule{ResearchSession} \importmodule{ResearchWorkspace} \importmodule{Json} @@ -19,13 +27,13 @@ name: State, type_parameters: [], parameters: [], - constructors: [{name: reading, fields: [(List (Bytes * Bytes))]}, {name: active, fields: [ResearchCohort::State]}, {name: ended, fields: [(Option ResearchCohort::State)]}] + constructors: [{name: reading, fields: [(List (Bytes * Bytes))]}, {name: active, fields: [ResearchCohort::State]}, {name: ended, fields: [(Option ResearchCohort::State)]}, {name: portfolio, fields: [ResearchPortfolio::State]}, {name: portfolioEnded, fields: [ResearchPortfolio::State]}, {name: autonomy, fields: [ResearchAutonomy::State]}, {name: autonomyEnded, fields: [ResearchAutonomy::State]}] } definition{ name: usage, parameters: [], result: Bytes, - body: 0x75736167653a207233302d72657365617263682d636f686f727420524551554553542e6a736f6e0a0a52756e20757020746f203634206c6f63616c6c792076657269666965642063616e64696461746520617474656d7074732073686172696e67206f6e65207072657061726564206c6962726172792e0a496e7075743a207233302f72657365617263682d636f686f72742f31207769746820666972737420616e6420726573742066756c6c20617474656d70742072657175657374732e0a417474656d707473206d757374207368617265206c6962726172792c20746f6f6c732c20656e7669726f6e6d656e7420616e6420776f726b7370616365206c6f6720636f6e66696775726174696f6e2c0a776974682064697374696e63742073657269616c732e205065722d617474656d707420726573756c74732072657461696e2074686569722070726f6f66207374617475732e0a, + body: 0x75736167653a207233302d72657365617263682d636f686f727420524551554553542e6a736f6e0a0a52756e20757020746f203634206c6f63616c6c792076657269666965642063616e64696461746520617474656d7074732073686172696e67206f6e65207072657061726564206c6962726172792e0a496e7075743a207233302f72657365617263682d636f686f72742f31207769746820666972737420616e6420726573742066756c6c20617474656d70742072657175657374732e0a417474656d707473206d757374207368617265206c6962726172792c20746f6f6c732c20656e7669726f6e6d656e7420616e6420776f726b7370616365206c6f6720636f6e66696775726174696f6e2c0a776974682064697374696e63742073657269616c732e205065722d617474656d707420726573756c74732072657461696e2074686569722070726f6f66207374617475732e0a416c736f2061636365707473207233302f72657365617263682d706f7274666f6c696f2f313a206261736520636f6e66696775726174696f6e2c20757020746f203634207461736b732c20616e6420616e20617474656d7074206275646765742e2054686520706f7274666f6c696f2073656c65637473207461736b732061646170746976656c7920616e6420636f6e73747275637473206c6f63616c2070726f706f73616c7320776974686f75742070726f6f66207465726d732e20526573756c74732061726520617474656d7074732c206e6f7420636c61696d207075626c69636174696f6e2e0a, executable: true } definition{ @@ -84,11 +92,84 @@ axioms: [Quot.sound, propext], executable: true } +definition{ + name: taskStates, + parameters: [tasks : (List Research::Task)], + result: (List Json::Value), + body: (match tasks | List.nil => (nil Json::Value) | List.cons head tail => (cons (ctor Json::Value.object (cons (0x6964, (ctor Json::Value.string (project head id))) (cons (0x737461747573, (ResearchRecord::status (project head status))) (cons (0x6f726967696e, (ctor Json::Value.string (project (project head sequent) origin))) (cons (0x696e74656e74, (ResearchRecord::purpose (project head intent))) (nil (Bytes * Json::Value))))))) (taskStates tail))), + axioms: [], + recursive_argument: tasks, + executable: true +} +definition{ + name: autonomyTasks, + parameters: [autonomy : ResearchAutonomy::State], + result: (List Json::Value), + body: (match (project autonomy portfolio) | Option.none => (nil Json::Value) | Option.some portfolio => (taskStates (project (project portfolio research) tasks))), + axioms: [], + executable: true +} +definition{ + name: finishPortfolio, + parameters: [portfolio : ResearchPortfolio::State, exitStatus : UInt8, status : Bytes, reason : Bytes], + result: (State * LexLeanStd.Host::Request), + body: ((ctor State.portfolioEnded portfolio), (match (JsonCanonical::file (ctor Json::Value.object (cons (0x73706563, (ctor Json::Value.string 0x7233302f72657365617263682d706f7274666f6c696f2d726573756c742f31)) (cons (0x737461747573, (ctor Json::Value.string status)) (cons (0x726561736f6e, (ctor Json::Value.string reason)) (cons (0x726573756c7473, (ctor Json::Value.array (results (project portfolio results)))) (cons (0x7265636f766572795f776f726b7370616365, (ctor Json::Value.string (match (project portfolio owner) | Option.none => 0x | Option.some owner => (if (project owner owned) then (prim utf8_encode (ResearchWorkspace::path (project owner config)) : Bytes) else 0x)))) (cons (0x7461736b73, (ctor Json::Value.array (taskStates (project (project portfolio research) tasks)))) (nil (Bytes * Json::Value))))))))) 8388608 16777216) | Option.some data => (ctor LexLeanStd.Host::Request.exit exitStatus data 0x) | Option.none => (ctor LexLeanStd.Host::Request.exit (70 : UInt8) 0x 0x706f7274666f6c696f20726573756c74206578636565647320656e636f64696e67206c696d6974735c6e))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: advancePortfolio, + parameters: [result : (ResearchPortfolio::State * ResearchPortfolio::Emission)], + result: (State * LexLeanStd.Host::Request), + body: (match (second result) | ResearchPortfolio::Emission.host request => ((ctor State.portfolio (first result)), request) | ResearchPortfolio::Emission.awaiting => (finishPortfolio (first result) (70 : UInt8) 0x6661696c6564 0x706f7274666f6c696f20686173206e6f206f75747374616e64696e6720686f73742072657175657374) | ResearchPortfolio::Emission.blocked reason => (finishPortfolio (first result) (1 : UInt8) 0x626c6f636b6564 (prim utf8_encode reason : Bytes)) | ResearchPortfolio::Emission.complete research answers => (finishPortfolio (first result) (if (project (first result) cancelled) then (1 : UInt8) else (0 : UInt8)) (if (project (first result) cancelled) then 0x637574 else 0x636f6d706c65746564) 0x)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: autonomyRecoveryPath, + parameters: [autonomy : ResearchAutonomy::State], + result: Bytes, + body: (match (project autonomy recovery) | Option.none => 0x | Option.some recovery => (prim utf8_encode (ResearchWorkspace::path (project (project (ResearchRecovery::resumed recovery) base) workspace)) : Bytes)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: finishAutonomy, + parameters: [autonomy : ResearchAutonomy::State, exitStatus : UInt8, status : Bytes, reason : Bytes, identity : Bytes], + result: (State * LexLeanStd.Host::Request), + body: ((ctor State.autonomyEnded autonomy), (match (JsonCanonical::file (ctor Json::Value.object (cons (0x73706563, (ctor Json::Value.string 0x7233302f72657365617263682d6175746f6e6f6d792d726573756c742f31)) (cons (0x737461747573, (ctor Json::Value.string status)) (cons (0x726561736f6e, (ctor Json::Value.string reason)) (cons (0x67656e65726174696f6e5f7265636f7264, (ctor Json::Value.string identity)) (cons (0x726573756c7473, (ctor Json::Value.array (results (project autonomy results)))) (cons (0x7265636f766572795f776f726b7370616365, (ctor Json::Value.string (if (ResearchInput::stringIs (ctor Json::Value.string status) 0x626c6f636b6564) then (autonomyRecoveryPath autonomy) else 0x))) (cons (0x7461736b73, (ctor Json::Value.array (autonomyTasks autonomy))) (cons (0x7075626c69736865645f65766964656e6365, (ctor Json::Value.array (CandidateSource::strings (project autonomy publications)))) (cons (0x7075626c69736865645f636f6d6d6974, (ctor Json::Value.string (project autonomy publishedCommit))) (nil (Bytes * Json::Value)))))))))))) 8388608 16777216) | Option.some data => (ctor LexLeanStd.Host::Request.exit exitStatus data 0x) | Option.none => (ctor LexLeanStd.Host::Request.exit (70 : UInt8) 0x 0x6175746f6e6f6d7920726573756c74206578636565647320656e636f64696e67206c696d6974730a))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: advanceAutonomy, + parameters: [result : (ResearchAutonomy::State * ResearchAutonomy::Emission)], + result: (State * LexLeanStd.Host::Request), + body: (match (second result) | ResearchAutonomy::Emission.host request => ((ctor State.autonomy (first result)), request) | ResearchAutonomy::Emission.awaiting => (finishAutonomy (first result) (70 : UInt8) 0x626c6f636b6564 0x6175746f6e6f6d7920686173206e6f206f75747374616e64696e6720686f73742072657175657374 0x) | ResearchAutonomy::Emission.blocked reason => (finishAutonomy (first result) (1 : UInt8) 0x626c6f636b6564 (prim utf8_encode reason : Bytes) 0x) | ResearchAutonomy::Emission.cut => (finishAutonomy (first result) (1 : UInt8) 0x637574 0x 0x) | ResearchAutonomy::Emission.complete answers identity => (finishAutonomy (first result) (if (project (first result) cancelled) then (1 : UInt8) else (0 : UInt8)) (if (project (first result) cancelled) then 0x637574 else 0x636f6d706c65746564) 0x identity)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: readAutonomy, + parameters: [data : Bytes, env : (List (Bytes * Bytes))], + result: (State * LexLeanStd.Host::Request), + body: (match (ResearchAutonomyInput::decode data env) | Option.none => (error (ctor Option.none [ResearchCohort::State]) (2 : UInt8) 0x696e76616c696420636f686f72742c20706f7274666f6c696f206f72207265636f766572792072657175657374) | Option.some config => (advanceAutonomy (ResearchAutonomy::begin config))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: readPortfolio, + parameters: [data : Bytes, env : (List (Bytes * Bytes))], + result: (State * LexLeanStd.Host::Request), + body: (match (ResearchPortfolioInput::decode data env) | Option.none => (readAutonomy data env) | Option.some config => (advancePortfolio (ResearchPortfolio::begin (project config research) (project config base) (project config budget)))), + axioms: [Quot.sound, propext], + executable: true +} definition{ name: readResult, parameters: [env : (List (Bytes * Bytes)), event : LexLeanStd.Host::Event], result: (State * LexLeanStd.Host::Request), - body: (match (Host::asRead event) | Option.none => (error (ctor Option.none [ResearchCohort::State]) (70 : UInt8) 0x657870656374656420617474656d707420726571756573742072656164) | Option.some response => (match response | Result.error failure => (error (ctor Option.none [ResearchCohort::State]) (1 : UInt8) (project failure message)) | Result.ok data => (match (ResearchCohortInput::decode data env) | Option.none => (error (ctor Option.none [ResearchCohort::State]) (2 : UInt8) 0x617474656d70742072657175657374206f7220656e7669726f6e6d656e74206973206f757473696465207468652061646d697474656420736368656d6120616e6420626f756e6473) | Option.some config => (advanceCohort (ResearchCohort::begin config))))), + body: (match (Host::asRead event) | Option.none => (error (ctor Option.none [ResearchCohort::State]) (70 : UInt8) 0x657870656374656420617474656d707420726571756573742072656164) | Option.some response => (match response | Result.error failure => (error (ctor Option.none [ResearchCohort::State]) (1 : UInt8) (project failure message)) | Result.ok data => (match (ResearchCohortInput::decode data env) | Option.none => (readPortfolio data env) | Option.some config => (advanceCohort (ResearchCohort::begin config))))), axioms: [Quot.sound, propext], executable: true } @@ -112,7 +193,7 @@ name: step, parameters: [state : (Option State), event : LexLeanStd.Host::Event], result: (State * LexLeanStd.Host::Request), - body: (match state | Option.none => (match (Host::asStart event) | Option.none => (error (ctor Option.none [ResearchCohort::State]) (70 : UInt8) 0x6578706563746564206e617469766520686f7374207374617274) | Option.some initialStart => (start initialStart)) | Option.some active => (match active | State.reading env => (readResult env event) | State.active session => (advanceCohort (ResearchCohort::step session (ctor ResearchCohort::Event.host event))) | State.ended session => (error session (70 : UInt8) 0x636f6d706c6574656420726573656172636820636f6d6d616e642063616e6e6f742072657374617274))), + body: (match state | Option.none => (match (Host::asStart event) | Option.none => (error (ctor Option.none [ResearchCohort::State]) (70 : UInt8) 0x6578706563746564206e617469766520686f7374207374617274) | Option.some initialStart => (start initialStart)) | Option.some active => (match active | State.reading env => (readResult env event) | State.active session => (advanceCohort (ResearchCohort::step session (ctor ResearchCohort::Event.host event))) | State.autonomy autonomy => (advanceAutonomy (ResearchAutonomy::step autonomy (ctor ResearchAutonomy::Event.host event))) | State.autonomyEnded autonomy => (finishAutonomy autonomy (70 : UInt8) 0x626c6f636b6564 0x7465726d696e616c206175746f6e6f6d792063616e6e6f742072657374617274 0x) | State.portfolio portfolio => (advancePortfolio (ResearchPortfolio::step portfolio (ctor ResearchPortfolio::Event.host event))) | State.portfolioEnded portfolio => (finishPortfolio portfolio (70 : UInt8) 0x6661696c6564 0x7465726d696e616c20706f7274666f6c696f2063616e6e6f742072657374617274) | State.ended session => (error session (70 : UInt8) 0x636f6d706c6574656420726573656172636820636f6d6d616e642063616e6e6f742072657374617274))), axioms: [Quot.sound, propext], executable: true, production: {effects: [allocation, files, overflow, process, recursion], targets: [rust-std]} diff --git a/rule30-api/src/ResearchExecution.lex.tex b/rule30-api/src/ResearchExecution.lex.tex index ad0a148..5867de1 100644 --- a/rule30-api/src/ResearchExecution.lex.tex +++ b/rule30-api/src/ResearchExecution.lex.tex @@ -17,14 +17,14 @@ name: Tool, type_parameters: [], parameters: [], - constructors: [{name: lean, fields: []}, {name: lake, fields: []}, {name: lexlean, fields: []}, {name: checker, fields: []}, {name: git, fields: []}, {name: prismpm, fields: []}] + constructors: [{name: lean, fields: []}, {name: lake, fields: []}, {name: lexlean, fields: []}, {name: checker, fields: []}, {name: git, fields: []}, {name: prismpm, fields: []}, {name: r30, fields: []}] } definition{ name: program, parameters: [tool : Tool], result: String, - body: (match tool | Tool.lean => "lean" | Tool.lake => "lake" | Tool.lexlean => "lexlean" | Tool.checker => "leanchecker" | Tool.git => "git" | Tool.prismpm => "prismpm"), + body: (match tool | Tool.lean => "lean" | Tool.lake => "lake" | Tool.lexlean => "lexlean" | Tool.checker => "leanchecker" | Tool.git => "git" | Tool.prismpm => "prismpm" | Tool.r30 => "./bin/r30"), executable: true } diff --git a/rule30-api/src/ResearchInspection.lex.tex b/rule30-api/src/ResearchInspection.lex.tex new file mode 100644 index 0000000..cbbe6b1 --- /dev/null +++ b/rule30-api/src/ResearchInspection.lex.tex @@ -0,0 +1,227 @@ +\begin{lexlean}{ResearchInspection} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchProject} +\importmodule{ResearchWorkspace} +\importmodule{ResearchExecution} +\importmodule{ResearchCandidate} +\importmodule{ResearchVerification} +\importmodule{ResearchInput} +\importmodule{CandidateSource} +\importmodule{Research} +\importmodule{CoreBinding} +\importmodule{CoreNotation} +\importmodule{Json} +\importmodule{JsonCanonical} +\importmodule{Hypotheses} +\importmodule{Toml} +\importmodule{Host} +\importmodule{LexLeanStd.Host} +\title{Boolean} +\begin{semanticmodule} +structure{ + name: Config, + type_parameters: [], + parameters: [], + fields: [{name: base, type: ResearchProject::Config}, {name: imports, type: (List Bytes)}, {name: declarations, type: (List Bytes)}, {name: maxNodes, type: Nat}, {name: maxDepth, type: Nat}] +} +inductive{ + name: Phase, + type_parameters: [], + parameters: [], + constructors: [{name: writing, fields: []}, {name: running, fields: []}, {name: reading, fields: []}, {name: checking, fields: []}, {name: ended, fields: []}, {name: blocked, fields: []}] +} +structure{ + name: State, + type_parameters: [], + parameters: [], + fields: [{name: config, type: Config}, {name: owner, type: ResearchWorkspace::State}, {name: execution, type: (Option ResearchExecution::State)}, {name: phase, type: Phase}, {name: cancelled, type: Bool}, {name: report, type: (Option Json::Value)}] +} +inductive{ + name: Event, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Event]}, {name: cancel, fields: []}] +} +inductive{ + name: Emission, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Request]}, {name: awaiting, fields: []}, {name: complete, fields: [Json::Value]}, {name: failed, fields: [String]}, {name: cut, fields: []}, {name: blocked, fields: [String]}] +} +definition{ + name: workspace, + parameters: [config : Config], + result: ResearchWorkspace::Config, + body: (project (project config base) workspace), + axioms: [], + executable: true +} +definition{ + name: path, + parameters: [config : Config, suffix : String], + result: String, + body: (ResearchVerification::concat (ResearchWorkspace::path (workspace config)) suffix), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: manifest, + parameters: [], + result: Bytes, + body: 0x73706563203d20226c65786c65616e2f70726f6a6563742f31220a6e616d65203d202272756c6533302d6f776e65642d696e7370656374696f6e220a6c616e6775616765203d2022312e32220a6d6f64756c655f707265666978203d202252756c653330496e7370656374696f6e220a736f757263655f726f6f7473203d205b2272756c6533302d6170692f737263225d0a656e747279706f696e7473203d205b2272756c6533302d6170692f7372632f4170692e6c65782e746578225d0a6275696c645f726f6f74203d20222e7233302d696e7370656374696f6e2d6275696c64220a6c6f636b66696c65203d20222e7233302d696e7370656374696f6e2e6c6f636b220a6c65616e5f776f726b7370616365203d202272756c6533302d636f72652d6c65616e220a6c65616e5f746f6f6c636861696e203d20226c65616e70726f7665722f6c65616e343a76342e33322e31220a0a5b5b6c657869636f6e5f736f757263655d5d0a7061636b616765203d20226c65786c65616e2e7374642e626f6f6c220a6b696e64203d20226275696c74696e220a0a5b6c696d6974735d0a6d61785f66696c655f6279746573203d20383338383630380a6d61785f746f74616c5f736f757263655f6279746573203d2031363737373231360a6d61785f7072696d69746976655f61746f6d73203d20323030303030300a6d61785f746f6b656e5f6c6174746963655f6564676573203d20343030303030300a6d61785f70617273655f737461746573203d20343030303030300a6d61785f69725f6e6f646573203d20323030303030300a6d61785f73636f70655f6465707468203d20313032340a6d61785f696d706f72745f6465707468203d203132380a6d61785f646961676e6f7374696373203d203235360a6d61785f6368696c645f6f75747075745f6279746573203d20383338383630380a6368696c645f74696d656f75745f6d73203d203630303030300a, + executable: true +} +definition{ + name: flags, + parameters: [flag : String, values : (List Bytes)], + result: (List String), + body: (match values | List.nil => (nil String) | List.cons head tail => (cons flag (cons (Host::textOf head) (flags flag tail)))), + axioms: [Quot.sound, propext], + recursive_argument: values, + executable: true +} +definition{ + name: arguments, + parameters: [config : Config], + result: (List String), + body: (prim append (cons "--project" (cons (path config "/.r30-inspection.toml") (cons "inspect" (cons "--out" (cons (path config "/.r30-inspection.json") (cons "--max-nodes" (cons (Host::textOf (Hypotheses::decimal (project config maxNodes))) (cons "--max-depth" (cons (Host::textOf (Hypotheses::decimal (project config maxDepth))) (nil String)))))))))) (prim append (flags "--import" (project config imports)) (flags "--declaration" (project config declarations)) : (List String)) : (List String)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: job, + parameters: [config : Config], + result: ResearchExecution::Job, + body: (let base : ResearchWorkspace::Config := (workspace config); (record ResearchExecution::Job {request := (project (project config base) request), tool := (ctor ResearchExecution::Tool.lexlean), arguments := (arguments config), directory := (ResearchWorkspace::path base), environment := (project base environment), output := (project base output), errors := (project base errors), allowance := (project base allowance), quantum := (project base quantum), polls := (project base polls)})), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: request, + parameters: [config : Config], + result: Json::Value, + body: (ctor Json::Value.object (cons (0x696d706f727473, (ctor Json::Value.array (CandidateSource::strings (project config imports)))) (cons (0x6465636c61726174696f6e73, (ctor Json::Value.array (CandidateSource::strings (project config declarations)))) (cons (0x6d61785f6e6f646573, (CoreBinding::number (project config maxNodes))) (cons (0x6d61785f6465707468, (CoreBinding::number (project config maxDepth))) (nil (Bytes * Json::Value))))))), + axioms: [], + executable: true +} +definition{ + name: sameJson, + parameters: [left : Json::Value, right : Json::Value], + result: Bool, + body: (match (JsonCanonical::encode left 8388608 16777216) | Option.none => false | Option.some a => (match (JsonCanonical::encode right 8388608 16777216) | Option.none => false | Option.some b => (Toml::sameBytes a b))), + axioms: [propext], + executable: true +} +definition{ + name: matches, + parameters: [config : Config, value : Json::Value], + result: Bool, + body: ((CoreNotation::shape value (cons 0x73706563 (cons 0x6c65616e (cons 0x6465636c61726174696f6e73 (cons 0x72657175657374 (cons 0x726571756573745f6964 (cons 0x636f6d70696c65725f73656d616e746963735f6964 (cons 0x616461707465725f736861323536 (cons 0x6c65786c65616e5f736861323536 (cons 0x6c65616e5f736861323536 (cons 0x6c616b655f736861323536 (cons 0x70726f63657373 (nil Bytes))))))))))))) && ((ResearchInput::stringIs (CoreBinding::get value 0x73706563) 0x6c65786c65616e2f6b65726e656c2d696e7370656374696f6e2f31) && ((ResearchInput::stringIs (CoreBinding::get value 0x636f6d70696c65725f73656d616e746963735f6964) (project (project (project (project config base) request) snapshot) compiler)) && ((sameJson (CoreBinding::get value 0x72657175657374) (request config)) && ((ResearchInput::stringIs (CoreBinding::get value 0x6c65786c65616e5f736861323536) (project (project (project config base) tools) lexlean)) && ((ResearchInput::stringIs (CoreBinding::get value 0x6c65616e5f736861323536) (project (project (project config base) tools) lean)) && ((ResearchInput::stringIs (CoreBinding::get value 0x6c616b655f736861323536) (project (project (project config base) tools) lake)) && ((ResearchInput::stringIs (CoreBinding::get (CoreBinding::get value 0x6c65616e) 0x76657273696f6e) 0x342e33322e31) && ((ResearchInput::stringIs (CoreBinding::get (CoreBinding::get value 0x6c65616e) 0x67697468617368) 0x66303534363035616561346238343035353263636132653732353538306266666431653162373034) && ((match (Json::natural (CoreBinding::get (CoreBinding::get value 0x70726f63657373) 0x657869745f636f6465) 255) | Option.none => false | Option.some code => (code =? 0)) && (match (ResearchInput::array (CoreBinding::get value 0x6465636c61726174696f6e73)) | Option.none => false | Option.some rows => ((prim length rows : Nat) =? (prim length (project config declarations) : Nat))))))))))))), + axioms: [propext], + executable: true +} +definition{ + name: finish, + parameters: [state : State, emission : Emission], + result: (State * Emission), + body: ((record State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (ctor Phase.ended), cancelled := (project state cancelled), report := (project state report)}), emission), + axioms: [], + executable: true +} +definition{ + name: blocked, + parameters: [state : State, reason : String], + result: (State * Emission), + body: ((record State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (ctor Phase.blocked), cancelled := (project state cancelled), report := (project state report)}), (ctor Emission.blocked reason)), + axioms: [], + executable: true +} +definition{ + name: completed, + parameters: [state : State, completion : ResearchExecution::Completion], + result: (State * Emission), + body: (if ((ResearchExecution::resumeAllowed completion) && (ResearchWorkspace::exitedNormally completion)) then (if (project state cancelled) then (finish state (ctor Emission.cut)) else (match (project completion kind) | ResearchExecution::EndKind.succeeded => (match (project state phase) | Phase.running => ((record State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (ctor Phase.reading), cancelled := (project state cancelled), report := (project state report)}), (ctor Emission.host (ctor LexLeanStd.Host::Request.read (path (project state config) "/.r30-inspection.json")))) | Phase.checking => (match (project state report) | Option.none => (blocked state "missing owned inspection report") | Option.some report => (finish state (ctor Emission.complete report))) | Phase.writing => (blocked state "unexpected inspection process completion") | Phase.reading => (blocked state "unexpected inspection process completion") | Phase.ended => (blocked state "unexpected inspection process completion") | Phase.blocked => (blocked state "unexpected inspection process completion")) | ResearchExecution::EndKind.failed => (finish state (ctor Emission.failed "inspection or library recheck failed")) | ResearchExecution::EndKind.unavailable => (finish state (ctor Emission.failed "inspection tool unavailable")) | ResearchExecution::EndKind.cut => (finish state (ctor Emission.cut)) | ResearchExecution::EndKind.protocol => (blocked state "inspection protocol failure") | ResearchExecution::EndKind.cleanupFailed => (blocked state "inspection cleanup failed") | ResearchExecution::EndKind.refused => (blocked state "inspection refused"))) else (blocked state "inspection process outcome uncertain; retain library owner")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: executionResult, + parameters: [state : State, result : (ResearchExecution::State * ResearchExecution::Emission)], + result: (State * Emission), + body: (let next : State := (record State {config := (project state config), owner := (project state owner), execution := (ctor Option.some [ResearchExecution::State] (first result)), phase := (project state phase), cancelled := (project state cancelled), report := (project state report)}); (match (second result) | ResearchExecution::Emission.host hostRequest => (next, (ctor Emission.host hostRequest)) | ResearchExecution::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchExecution::Emission.complete completion => (completed next completion))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: launch, + parameters: [state : State, checking : Bool], + result: (State * Emission), + body: (executionResult (record State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (if checking then (ctor Phase.checking) else (ctor Phase.running)), cancelled := (project state cancelled), report := (project state report)}) (ResearchExecution::begin (if checking then (ResearchWorkspace::job (workspace (project state config)) (ctor ResearchWorkspace::Operation.clean)) else (job (project state config))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: written, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match event | LexLeanStd.Host::Event.finished response => (if (project state cancelled) then (finish state (ctor Emission.cut)) else (match response | Result.ok ignored => (launch state false) | Result.error problem => (finish state (ctor Emission.failed "inspection manifest write failed")))) | LexLeanStd.Host::Event.start info => (blocked state "unexpected inspection write reply") | LexLeanStd.Host::Event.read response => (blocked state "unexpected inspection write reply") | LexLeanStd.Host::Event.listed response => (blocked state "unexpected inspection write reply") | LexLeanStd.Host::Event.stat response => (blocked state "unexpected inspection write reply") | LexLeanStd.Host::Event.canonical response => (blocked state "unexpected inspection write reply") | LexLeanStd.Host::Event.spawned response => (blocked state "unexpected inspection write reply") | LexLeanStd.Host::Event.waited response => (blocked state "unexpected inspection write reply")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: read, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (Host::asRead event) | Option.none => (blocked state "unexpected inspection read reply") | Option.some response => (if (project state cancelled) then (finish state (ctor Emission.cut)) else (match response | Result.error problem => (finish state (ctor Emission.failed "inspection report read failed")) | Result.ok bytes => (match (Json::parse bytes 8388608 512) | Result.error problem => (finish state (ctor Emission.failed "inspection report malformed")) | Result.ok value => (if (matches (project state config) value) then (launch (record State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (project state phase), cancelled := (project state cancelled), report := (ctor Option.some [Json::Value] value)}) true) else (finish state (ctor Emission.failed "inspection report identity mismatch"))))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: host, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (project state phase) | Phase.writing => (written state event) | Phase.reading => (read state event) | Phase.running => (match (project state execution) | Option.none => (blocked state "missing inspection execution owner") | Option.some execution => (executionResult state (ResearchExecution::step execution event))) | Phase.checking => (match (project state execution) | Option.none => (blocked state "missing inspection execution owner") | Option.some execution => (executionResult state (ResearchExecution::step execution event))) | Phase.ended => (state, (ctor Emission.awaiting)) | Phase.blocked => (blocked state "inspection retains uncertain ownership")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: cancel, + parameters: [state : State], + result: (State * Emission), + body: (let next : State := (record State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (project state phase), cancelled := true, report := (project state report)}); (match (project state phase) | Phase.writing => (next, (ctor Emission.awaiting)) | Phase.reading => (next, (ctor Emission.awaiting)) | Phase.ended => (next, (ctor Emission.awaiting)) | Phase.running => (match (project state execution) | Option.none => (blocked next "missing inspection execution owner") | Option.some execution => (executionResult next (ResearchExecution::cancel execution))) | Phase.checking => (match (project state execution) | Option.none => (blocked next "missing inspection execution owner") | Option.some execution => (executionResult next (ResearchExecution::cancel execution))) | Phase.blocked => (blocked next "cancelled inspection retains uncertain ownership"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: beginPrepared, + parameters: [config : Config, owner : ResearchWorkspace::State], + result: (State * Emission), + body: (let state : State := (record State {config := config, owner := owner, execution := (ctor Option.none [ResearchExecution::State]), phase := (ctor Phase.writing), cancelled := false, report := (ctor Option.none [Json::Value])}); (if ((ResearchProject::preparedFor (project config base) owner) && ((0 (host state reply) | Event.cancel => (cancel state)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Inspect declarations only inside the exact owned prepared library. Write an inspection manifest, own the pinned local compiler invocation and report read, bind its complete request, compiler and tool identities, then recheck tracked library sources before returning data. The enclosing owner retains and releases the borrowed workspace. Cancellation drains pending replies; uncertain execution retains ownership and blocks reuse. Inspection data is neither a proof receipt nor publication authority.", + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "owned-prepared-library-inspection" (cons "complete-query-and-tool-pins" (cons "bounded-structural-kernel-report" (cons "tracked-library-recheck-before-return" (cons "drained-cancellation" (cons "uncertain-inspection-retains-owner" (cons "no-inspection-proof-promotion" (nil String)))))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchInspectionBinding.lex.tex b/rule30-api/src/ResearchInspectionBinding.lex.tex new file mode 100644 index 0000000..75b4741 --- /dev/null +++ b/rule30-api/src/ResearchInspectionBinding.lex.tex @@ -0,0 +1,122 @@ +\begin{lexlean}{ResearchInspectionBinding} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{Research} +\importmodule{CandidateBinding} +\importmodule{CoreBinding} +\importmodule{CoreNotation} +\importmodule{ResearchInput} +\importmodule{Hypotheses} +\importmodule{Toml} +\importmodule{Json} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: row, + parameters: [names : (List Json::Value), rows : (List Json::Value), wanted : Bytes], + result: (Option Json::Value), + body: (match names | List.nil => (ctor Option.none [Json::Value]) | List.cons head tail => (match rows | List.nil => (ctor Option.none [Json::Value]) | List.cons value rest => (if (ResearchInput::stringIs head wanted) then (ctor Option.some [Json::Value] value) else (row tail rest wanted)))), + axioms: [], + recursive_argument: names, + executable: true +} +definition{ + name: find, + parameters: [report : Json::Value, wanted : Bytes], + result: (Option Json::Value), + body: (match (ResearchInput::array (CoreBinding::get (CoreBinding::get report 0x72657175657374) 0x6465636c61726174696f6e73)) | Option.none => (ctor Option.none [Json::Value]) | Option.some names => (match (ResearchInput::array (CoreBinding::get report 0x6465636c61726174696f6e73)) | Option.none => (ctor Option.none [Json::Value]) | Option.some rows => (row names rows wanted))), + axioms: [], + executable: true +} +definition{ + name: source, + parameters: [report : Json::Value, origin : Bytes], + result: (Option CoreBinding::Goal), + body: (match (find report origin) | Option.none => (ctor Option.none [CoreBinding::Goal]) | Option.some value => (let native : Json::Value := (CoreBinding::get value 0x6e6174697665); (if (ResearchInput::stringIs (CoreBinding::get native 0x737461747573) 0x617661696c61626c65) then (CandidateBinding::goal native) else (ctor Option.none [CoreBinding::Goal])))), + axioms: [], + executable: true +} +definition{ + name: closedProposition, + parameters: [goal : CoreBinding::Goal], + result: Bool, + body: (match (prim index (project goal nodes) (project goal root) : (Option Json::Value)) | Option.none => false | Option.some value => ((CoreNotation::shape value (cons 0x6b (cons 0x6c (nil Bytes)))) && ((Toml::sameBytes (CoreBinding::kind value) 0x73) && ((CoreNotation::shape (CoreBinding::get value 0x6c) (cons 0x6b (nil Bytes))) && (Toml::sameBytes (CoreBinding::kind (CoreBinding::get value 0x6c)) 0x7a))))), + axioms: [], + executable: true +} +definition{ + name: withoutAuthority, + parameters: [original : Research::Task], + result: Research::Task, + body: (record Research::Task {id := (project original id), purpose := (project original purpose), intent := (project original intent), status := (ctor Research::Status.blocked), component := (project original component), sources := (project original sources), schema := (project original schema), sequent := (record Research::Sequent {origin := (project (project original sequent) origin), theorem := (project (project original sequent) theorem), premise := (project (project original sequent) premise), telescope := 0x, target := 0x, kind := (project (project original sequent) kind)}), age := (project original age), weight := (project original weight)}), + axioms: [], + executable: true +} +definition{ + name: withGoal, + parameters: [original : Research::Task, telescope : Bytes, target : Bytes], + result: Research::Task, + body: (let origin : Bytes := (project (project original sequent) origin); (record Research::Task {id := (project original id), purpose := (project original purpose), intent := (project original intent), status := (ctor Research::Status.ready), component := (project original component), sources := (if (Hypotheses::memberBytes origin (project original sources)) then (project original sources) else (cons origin (project original sources))), schema := (project original schema), sequent := (record Research::Sequent {origin := origin, theorem := origin, premise := (project (project original sequent) premise), telescope := telescope, target := target, kind := (project (project original sequent) kind)}), age := (project original age), weight := (project original weight)})), + axioms: [], + executable: true +} +definition{ + name: bindGoal, + parameters: [original : Research::Task, inspected : CoreBinding::Goal], + result: Research::Task, + body: (match (project (project original sequent) kind) | Research::GoalKind.closed => (if ((closedProposition inspected) && ((project (project original sequent) premise) =? 0)) then (match (CoreBinding::encodeGoal (CoreBinding::namedGoal (project (project original sequent) origin)) 8388608 16777216) | Option.none => (withoutAuthority original) | Option.some target => (withGoal original 0x target)) else (withoutAuthority original)) | Research::GoalKind.premise => (match (CoreBinding::premise inspected (project (project original sequent) premise) 8388608 16777216) | Option.none => (withoutAuthority original) | Option.some selected => (match (CoreBinding::encodeGoal inspected 8388608 16777216) | Option.none => (withoutAuthority original) | Option.some telescope => (match (CoreBinding::encodeGoal selected 8388608 16777216) | Option.none => (withoutAuthority original) | Option.some target => (withGoal original telescope target))))), + axioms: [propext], + executable: true +} +definition{ + name: monomorphic, + parameters: [report : Json::Value, origin : Bytes], + result: Bool, + body: (match (find report origin) | Option.none => false | Option.some inspectedRow => (match (ResearchInput::array (CoreBinding::get (CoreBinding::get inspectedRow 0x6e6174697665) 0x6c6576656c73)) | Option.none => false | Option.some levels => ((prim length levels : Nat) =? 0))), + axioms: [], + executable: true +} +definition{ + name: bind, + parameters: [original : Research::Task, report : Json::Value], + result: Research::Task, + body: (match (source report (project (project original sequent) origin)) | Option.none => (withoutAuthority original) | Option.some inspected => (match (project (project original sequent) kind) | Research::GoalKind.premise => (bindGoal original inspected) | Research::GoalKind.closed => (if (monomorphic report (project (project original sequent) origin)) then (bindGoal original inspected) else (withoutAuthority original)))), + axioms: [propext], + executable: true +} +definition{ + name: tasks, + parameters: [originals : (List Research::Task), report : Json::Value], + result: (List Research::Task), + body: (match originals | List.nil => (nil Research::Task) | List.cons head tail => (cons (bind head report) (tasks tail report))), + axioms: [propext], + recursive_argument: originals, + executable: true +} +definition{ + name: origins, + parameters: [originals : (List Research::Task), found : (List Bytes)], + result: (List Bytes), + body: (match originals | List.nil => found | List.cons head tail => (let origin : Bytes := (project (project head sequent) origin); (origins tail (if (Hypotheses::memberBytes origin found) then found else (prim append found (cons origin (nil Bytes)) : (List Bytes)))))), + axioms: [], + recursive_argument: originals, + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Replace caller-supplied goal arenas with types from an owned inspection report. Closed claims require a kernel type of Prop; contextual tasks select and close their premise from the inspected source telescope. A missing or unrepresentable inspection blocks that task and clears its unchecked target, while other tasks remain eligible. This conversion must consume ResearchInspection completion inside the owner; accepting a caller-provided JSON report would not establish source authority.", + axioms: [], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "inspected-origin-goal-binding" (cons "closed-proposition-type-check" (cons "inspected-premise-telescope" (cons "discard-caller-supplied-goal-arena" (cons "unsupported-inspection-blocks-only-affected-task" (nil String)))))), + axioms: [], + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchInspectionBindingTraces.lex.tex b/rule30-api/src/ResearchInspectionBindingTraces.lex.tex new file mode 100644 index 0000000..3cea5da --- /dev/null +++ b/rule30-api/src/ResearchInspectionBindingTraces.lex.tex @@ -0,0 +1,46 @@ +\begin{lexlean}{ResearchInspectionBindingTraces} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchInspectionBinding} +\importmodule{Research} +\importmodule{CoreBinding} +\importmodule{Json} +\title{Boolean} +\begin{semanticmodule} +theorem{ + name: absentInspectionCannotDispatchTask, + parameters: [original : Research::Task], + statement: ((project (ResearchInspectionBinding::bind original (ctor Json::Value.null)) status) = (ctor Research::Status.blocked)), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: absentInspectionDiscardsUnownedGoal, + parameters: [original : Research::Task], + statement: ((project (project (ResearchInspectionBinding::bind original (ctor Json::Value.null)) sequent) target) = 0x), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: missingNativeParametersCannotEstablishClosedness, + parameters: [], + statement: ((ResearchInspectionBinding::monomorphic (ctor Json::Value.null) 0x54727565) = false), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: kernelPropCanBeRecognized, + parameters: [], + statement: ((ResearchInspectionBinding::closedProposition (record CoreBinding::Goal {nodes := (cons (ctor Json::Value.object (cons (0x6b, (ctor Json::Value.string 0x73)) (cons (0x6c, (ctor Json::Value.object (cons (0x6b, (ctor Json::Value.string 0x7a)) (nil (Bytes * Json::Value))))) (nil (Bytes * Json::Value))))) (nil Json::Value)), root := 0})) = true), + proof: decide{}, + axioms: [] +} +theorem{ + name: dataTypeCannotBeTreatedAsClosedProposition, + parameters: [], + statement: ((ResearchInspectionBinding::closedProposition (CoreBinding::namedGoal 0x4e6174)) = false), + proof: decide{}, + axioms: [] +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchInspectionTraces.lex.tex b/rule30-api/src/ResearchInspectionTraces.lex.tex new file mode 100644 index 0000000..5eb38e9 --- /dev/null +++ b/rule30-api/src/ResearchInspectionTraces.lex.tex @@ -0,0 +1,56 @@ +\begin{lexlean}{ResearchInspectionTraces} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchInspection} +\importmodule{ResearchWorkspace} +\importmodule{ResearchExecution} +\importmodule{ResearchProject} +\importmodule{Research} +\importmodule{Json} +\importmodule{LexLeanStd.Host} +\title{Boolean} +\begin{semanticmodule} +theorem{ + name: terminalInspectionCannotRestart, + parameters: [state : ResearchInspection::State, event : LexLeanStd.Host::Event], + statement: ((ResearchInspection::step (record ResearchInspection::State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (ctor ResearchInspection::Phase.ended), cancelled := (project state cancelled), report := (project state report)}) (ctor ResearchInspection::Event.host event)) = ((record ResearchInspection::State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (ctor ResearchInspection::Phase.ended), cancelled := (project state cancelled), report := (project state report)}), (ctor ResearchInspection::Emission.awaiting))), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: malformedReportCannotEstablishInspectedOrigin, + parameters: [config : ResearchInspection::Config], + statement: ((ResearchInspection::matches config (ctor Json::Value.null)) = false), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: cancelledReadCannotCompleteInspection, + parameters: [state : ResearchInspection::State, bytes : Bytes], + statement: ((second (ResearchInspection::read (record ResearchInspection::State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (project state phase), cancelled := true, report := (project state report)}) (ctor LexLeanStd.Host::Event.read (ctor Result.ok [Bytes, LexLeanStd.Host::Failure] bytes)))) = (ctor ResearchInspection::Emission.cut)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: cancelledManifestWriteCannotLaunchTool, + parameters: [state : ResearchInspection::State, ignored : Unit], + statement: ((second (ResearchInspection::written (record ResearchInspection::State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (project state phase), cancelled := true, report := (project state report)}) (ctor LexLeanStd.Host::Event.finished (ctor Result.ok [Unit, LexLeanStd.Host::Failure] ignored)))) = (ctor ResearchInspection::Emission.cut)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: writeCancellationWaitsForOwnedReply, + parameters: [state : ResearchInspection::State], + statement: ((second (ResearchInspection::cancel (record ResearchInspection::State {config := (project state config), owner := (project state owner), execution := (project state execution), phase := (ctor ResearchInspection::Phase.writing), cancelled := (project state cancelled), report := (project state report)}))) = (ctor ResearchInspection::Emission.awaiting)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: unownedLibraryCannotLaunchInspector, + parameters: [config : ResearchInspection::Config, owner : ResearchWorkspace::State], + statement: ((second (ResearchInspection::beginPrepared config (record ResearchWorkspace::State {config := (project owner config), operation := (project owner operation), phase := (project owner phase), execution := (project owner execution), owned := false, cancelled := (project owner cancelled), result := (project owner result), detail := (project owner detail)}))) = (ctor ResearchInspection::Emission.failed "inspection requires the exact owned prepared library and bounded query")), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchPortfolio.lex.tex b/rule30-api/src/ResearchPortfolio.lex.tex new file mode 100644 index 0000000..6bde087 --- /dev/null +++ b/rule30-api/src/ResearchPortfolio.lex.tex @@ -0,0 +1,210 @@ +\begin{lexlean}{ResearchPortfolio} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{Research} +\importmodule{ResearchProject} +\importmodule{ResearchWorkspace} +\importmodule{ResearchSession} +\importmodule{ResearchExecution} +\importmodule{ResearchFactory} +\importmodule{CandidateSource} +\importmodule{CandidateUniverses} +\importmodule{ResearchInspection} +\importmodule{ResearchInspectionBinding} +\importmodule{CoreBinding} +\importmodule{LexLeanStd.Host} +\title{Boolean} +\begin{semanticmodule} +inductive{ + name: Phase, + type_parameters: [], + parameters: [], + constructors: [{name: inspecting, fields: []}, {name: preparing, fields: []}, {name: advancing, fields: []}, {name: attempting, fields: []}, {name: releasing, fields: []}, {name: ended, fields: []}, {name: blocked, fields: []}] +} +structure{ + name: State, + type_parameters: [], + parameters: [], + fields: [{name: inspection, type: (Option ResearchInspection::State)}, {name: inspected, type: Bool}, {name: research, type: Research::State}, {name: base, type: ResearchProject::Config}, {name: owner, type: (Option ResearchWorkspace::State)}, {name: active, type: (Option ResearchSession::State)}, {name: results, type: (List (Research::Answer * Bytes))}, {name: remaining, type: Nat}, {name: phase, type: Phase}, {name: cancelled, type: Bool}] +} +inductive{ + name: Event, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Event]}, {name: cancel, fields: []}] +} +inductive{ + name: Emission, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Request]}, {name: awaiting, fields: []}, {name: complete, fields: [Research::State, (List (Research::Answer * Bytes))]}, {name: blocked, fields: [String]}] +} +definition{ + name: phase, + parameters: [state : State, next : Phase], + result: State, + body: (record State {inspection := (project state inspection), inspected := (project state inspected), research := (project state research), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := next, cancelled := (project state cancelled)}), + executable: true +} +definition{ + name: blocked, + parameters: [state : State, reason : String], + result: (State * Emission), + body: ((phase state (ctor Phase.blocked)), (ctor Emission.blocked reason)), + executable: true +} +definition{ + name: suspended, + parameters: [research : Research::State], + result: Research::State, + body: (match (project research pending) | Option.none => research | Option.some request => (record Research::State {snapshot := (project research snapshot), components := (project research components), tasks := (Research::releaseStale (project research tasks) (project (project request task) id)), pending := (ctor Option.none [Research::Request]), next := (project research next), history := (project research history)})), + executable: true +} +definition{ + name: finish, + parameters: [state : State], + result: (State * Emission), + body: (let research : Research::State := (suspended (project state research)); ((record State {inspection := (project state inspection), inspected := (project state inspected), research := research, base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (ctor Phase.ended), cancelled := (project state cancelled)}), (ctor Emission.complete research (project state results)))), + executable: true +} +definition{ + name: markCancelled, + parameters: [state : State], + result: State, + body: (record State {inspection := (project state inspection), inspected := (project state inspected), research := (project state research), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (project state phase), cancelled := true}), + executable: true +} +definition{ + name: advanceLater, + parameters: [state : State], + result: (State * Emission), + body: ((phase state (ctor Phase.advancing)), (ctor Emission.host (ctor LexLeanStd.Host::Request.wait (nil Nat) 0))), + executable: true +} +definition{ + name: proposal, + parameters: [base : ResearchProject::Config, request : Research::Request], + result: (Option ResearchProject::Config), + body: (match (CandidateSource::synthesize request (project base maxBytes) (project base maxDepth) (project base maxSteps)) | Option.none => (ctor Option.none [ResearchProject::Config]) | Option.some candidate => (match (CandidateUniverses::parameters (first candidate)) | Option.none => (ctor Option.none [ResearchProject::Config]) | Option.some universes => (ctor Option.some [ResearchProject::Config] (record ResearchProject::Config {request := request, workspace := (project base workspace), tools := (project base tools), arena := (first candidate), proof := (second candidate), imports := (project base imports), levels := universes, axioms := (project base axioms), maxBytes := (project base maxBytes), maxDepth := (project base maxDepth), maxSteps := (project base maxSteps)})))), + axioms: [propext], + executable: true +} +definition{ + name: inspectionResult, + parameters: [state : State, result : (ResearchInspection::State * ResearchInspection::Emission)], + result: (State * Emission), + body: (let next : State := (record State {inspection := (ctor Option.some [ResearchInspection::State] (first result)), inspected := (project state inspected), research := (project state research), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (ctor Phase.inspecting), cancelled := (project state cancelled)}); (match (second result) | ResearchInspection::Emission.host request => (next, (ctor Emission.host request)) | ResearchInspection::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchInspection::Emission.complete report => (advanceLater (record State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := true, research := (record Research::State {snapshot := (project (project next research) snapshot), components := (project (project next research) components), tasks := (ResearchInspectionBinding::tasks (project (project next research) tasks) report), pending := (ctor Option.none [Research::Request]), next := (project (project next research) next), history := (project (project next research) history)}), base := (project next base), owner := (project next owner), active := (project next active), results := (project next results), remaining := (project next remaining), phase := (project next phase), cancelled := (project next cancelled)})) | ResearchInspection::Emission.cut => (advanceLater (record State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := (project next inspected), research := (project next research), base := (project next base), owner := (project next owner), active := (project next active), results := (project next results), remaining := (project next remaining), phase := (project next phase), cancelled := true})) | ResearchInspection::Emission.failed reason => (blocked next reason) | ResearchInspection::Emission.blocked reason => (blocked next reason))), + axioms: [propext], + executable: true +} +definition{ + name: inspectPrepared, + parameters: [state : State], + result: (State * Emission), + body: (if (project state cancelled) then (advanceLater state) else (if (project state inspected) then (advanceLater state) else (match (project state owner) | Option.none => (blocked state "inspection requires a prepared portfolio owner") | Option.some owner => (match (project (project state research) tasks) | List.nil => (advanceLater state) | List.cons head tail => (inspectionResult state (ResearchInspection::beginPrepared (record ResearchInspection::Config {base := (project state base), imports := (project (project state base) imports), declarations := (ResearchInspectionBinding::origins (project (project state research) tasks) (nil Bytes)), maxNodes := 65536, maxDepth := 128}) owner)))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: ownerResult, + parameters: [state : State, result : (ResearchWorkspace::State * ResearchWorkspace::Emission)], + result: (State * Emission), + body: (let next : State := (record State {inspection := (project state inspection), inspected := (project state inspected), research := (project state research), base := (project state base), owner := (ctor Option.some [ResearchWorkspace::State] (first result)), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (project state phase), cancelled := (project state cancelled)}); (match (second result) | ResearchWorkspace::Emission.host request => (next, (ctor Emission.host request)) | ResearchWorkspace::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchWorkspace::Emission.ready path => (inspectPrepared next) | ResearchWorkspace::Emission.complete kind => (match kind | ResearchExecution::EndKind.succeeded => (finish next) | ResearchExecution::EndKind.cut => (finish (markCancelled next)) | ResearchExecution::EndKind.failed => (blocked next (project (first result) detail)) | ResearchExecution::EndKind.unavailable => (blocked next "portfolio library unavailable") | ResearchExecution::EndKind.protocol => (blocked next "portfolio library protocol failure") | ResearchExecution::EndKind.cleanupFailed => (blocked next "portfolio library cleanup uncertain") | ResearchExecution::EndKind.refused => (blocked next "portfolio library refused")) | ResearchWorkspace::Emission.blocked reason => (blocked next reason) | ResearchWorkspace::Emission.refused => (blocked next "portfolio owner refused operation"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: release, + parameters: [state : State], + result: (State * Emission), + body: (match (project state owner) | Option.none => (finish state) | Option.some owner => (ownerResult (phase state (ctor Phase.releasing)) (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.release)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: recheck, + parameters: [state : State], + result: (State * Emission), + body: (if (project state cancelled) then (advanceLater state) else (match (project state owner) | Option.none => (blocked state "portfolio lost library owner") | Option.some owner => (ownerResult (phase state (ctor Phase.preparing)) (ResearchWorkspace::launch owner (ctor ResearchWorkspace::Operation.finalize))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: receive, + parameters: [state : State, answer : Research::Answer, evidence : Bytes], + result: State, + body: (record State {inspection := (project state inspection), inspected := (project state inspected), research := (first (Research::receive (project state research) answer)), base := (project state base), owner := (project state owner), active := (ctor Option.none [ResearchSession::State]), results := (prim append (project state results) (cons (answer, evidence) (nil (Research::Answer * Bytes))) : (List (Research::Answer * Bytes))), remaining := (project state remaining), phase := (project state phase), cancelled := (project state cancelled)}), + executable: true +} +definition{ + name: attemptResult, + parameters: [state : State, result : (ResearchSession::State * ResearchSession::Emission)], + result: (State * Emission), + body: (let next : State := (record State {inspection := (project state inspection), inspected := (project state inspected), research := (project state research), base := (project state base), owner := (project state owner), active := (ctor Option.some [ResearchSession::State] (first result)), results := (project state results), remaining := (project state remaining), phase := (ctor Phase.attempting), cancelled := (project state cancelled)}); (match (second result) | ResearchSession::Emission.host request => (next, (ctor Emission.host request)) | ResearchSession::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchSession::Emission.blocked reason => (blocked next reason) | ResearchSession::Emission.complete answer evidence => (recheck (receive next answer evidence)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: attempt, + parameters: [state : State, request : Research::Request], + result: (State * Emission), + body: (let next : State := (record State {inspection := (project state inspection), inspected := (project state inspected), research := (project state research), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (prim subtract (project state remaining) 1 : Nat), phase := (project state phase), cancelled := (project state cancelled)}); (match (proposal (project state base) request) | Option.none => (advanceLater (receive next (record Research::Answer {request := request, result := (ctor Research::ResultKind.unavailable)}) 0x)) | Option.some candidate => (match (project state owner) | Option.none => (blocked next "portfolio has no library owner") | Option.some owner => (match (ResearchFactory::libraryAction candidate (ctor Option.some [ResearchWorkspace::State] owner)) | ResearchFactory::LibraryAction.reuse => (attemptResult next (ResearchSession::beginPrepared candidate owner)) | ResearchFactory::LibraryAction.build => (blocked next "portfolio cannot rebuild an owned library") | ResearchFactory::LibraryAction.idle => (blocked next "portfolio has no attempt") | ResearchFactory::LibraryAction.blocked => (blocked next "portfolio owner closure changed"))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: advance, + parameters: [state : State], + result: (State * Emission), + body: (if ((project state cancelled) || ((project state remaining) =? 0)) then (release state) else (let next : State := (record State {inspection := (project state inspection), inspected := (project state inspected), research := (first (Research::dispatch (project state research))), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (project state phase), cancelled := (project state cancelled)}); (match (project (project next research) pending) | Option.none => (release next) | Option.some request => (attempt next request)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: host, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (project state phase) | Phase.inspecting => (match (project state inspection) | Option.none => (blocked state "portfolio missing inspection owner") | Option.some inspection => (inspectionResult state (ResearchInspection::step inspection (ctor ResearchInspection::Event.host event)))) | Phase.preparing => (match (project state owner) | Option.none => (blocked state "portfolio missing preparing owner") | Option.some owner => (ownerResult state (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.host event)))) | Phase.releasing => (match (project state owner) | Option.none => (blocked state "portfolio missing releasing owner") | Option.some owner => (ownerResult state (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.host event)))) | Phase.attempting => (match (project state active) | Option.none => (blocked state "portfolio missing session") | Option.some active => (attemptResult state (ResearchSession::step active (ctor ResearchSession::Event.host event)))) | Phase.advancing => (match (ResearchExecution::asWaited event) | Option.none => (blocked state "portfolio expected continuation") | Option.some response => (match response | Result.error failure => (blocked state "portfolio continuation failed") | Result.ok reply => (match (project reply finished) | List.nil => (advance state) | List.cons child tail => (blocked state "portfolio received unowned child")))) | Phase.ended => (finish state) | Phase.blocked => (blocked state "portfolio retained for recovery")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: cancel, + parameters: [state : State], + result: (State * Emission), + body: (let next : State := (markCancelled state); (match (project state phase) | Phase.inspecting => (match (project state inspection) | Option.none => (blocked next "portfolio missing inspection owner") | Option.some inspection => (inspectionResult next (ResearchInspection::step inspection (ctor ResearchInspection::Event.cancel)))) | Phase.preparing => (match (project state owner) | Option.none => (blocked next "portfolio missing preparing owner") | Option.some owner => (ownerResult next (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.cancel)))) | Phase.attempting => (match (project state active) | Option.none => (blocked next "portfolio missing session") | Option.some active => (attemptResult next (ResearchSession::step active (ctor ResearchSession::Event.cancel)))) | Phase.advancing => (next, (ctor Emission.awaiting)) | Phase.releasing => (next, (ctor Emission.awaiting)) | Phase.ended => (finish next) | Phase.blocked => (blocked next "portfolio retains uncertain work"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: begin, + parameters: [research : Research::State, base : ResearchProject::Config, budget : Nat], + result: (State * Emission), + body: (let state : State := (record State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := research, base := base, owner := (ctor Option.none [ResearchWorkspace::State]), active := (ctor Option.none [ResearchSession::State]), results := (nil (Research::Answer * Bytes)), remaining := budget, phase := (ctor Phase.preparing), cancelled := false}); (if ((budget <=? 64) && ((Research::sameSnapshot (project research snapshot) (project (project (project base workspace) request) snapshot)) && (ResearchWorkspace::valid (project base workspace)))) then (if (budget =? 0) then (finish state) else (match (project research pending) | Option.some request => (blocked state "portfolio cannot adopt outstanding work") | Option.none => (ownerResult state (ResearchWorkspace::begin (project base workspace))))) else (blocked state "portfolio configuration or budget invalid"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: step, + parameters: [state : State, event : Event], + result: (State * Emission), + body: (match event | Event.host response => (host state response) | Event.cancel => (cancel state)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Own a bounded adaptive portfolio over the existing research scheduler. Inspect requested origins in the owned exact library before dispatch, replace supplied goal arenas with kernel types, and isolate unsupported inspections to their tasks. Select each next task after the preceding owned session outcome, construct local proof proposals without supplied proof terms, derive universe parameters from each goal, and borrow one exact ready library. Unsupported synthesis blocks that executor without declaring a refutation. Retain per-attempt evidence, recheck the library between attempts, and drain cancellation before release. Only host replies and cancellation enter after begin. This executor owns inspection and constructive synthesis; ResearchAutonomy passes retained checked results to its separate owned batch-publication stage.", + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "owned-inspection-before-dispatch" (cons "goal-derived-universe-parameters" (cons "adaptive-existing-scheduler" (cons "local-construction-without-proof-input" (cons "one-owned-library" (cons "bounded-attempt-budget" (cons "owned-session-outcomes" (cons "uncertain-work-retains-owner" (cons "suspension-releases-unstarted-selection" (nil String)))))))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchPortfolioInput.lex.tex b/rule30-api/src/ResearchPortfolioInput.lex.tex new file mode 100644 index 0000000..bb5242e --- /dev/null +++ b/rule30-api/src/ResearchPortfolioInput.lex.tex @@ -0,0 +1,69 @@ +\begin{lexlean}{ResearchPortfolioInput} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchPortfolio} +\importmodule{ResearchInput} +\importmodule{ResearchProject} +\importmodule{Research} +\importmodule{CoreNotation} +\importmodule{CoreBinding} +\importmodule{Json} +\importmodule{Toml} +\importmodule{Hypotheses} +\title{Boolean} +\begin{semanticmodule} +structure{ + name: Config, + type_parameters: [], + parameters: [], + fields: [{name: research, type: Research::State}, {name: base, type: ResearchProject::Config}, {name: budget, type: Nat}] +} +definition{ + name: template, + parameters: [value : Json::Value, environment : (List (String * String))], + result: (Option ResearchProject::Config), + body: (if ((CoreNotation::shape value (cons 0x73706563 (cons 0x72657175657374 (cons 0x7265706f7369746f7279 (cons 0x7265766973696f6e (cons 0x6f7574707574 (cons 0x6572726f7273 (cons 0x746f6f6c73 (cons 0x696d706f727473 (cons 0x6c6576656c73 (cons 0x6178696f6d73 (cons 0x626f756e6473 (nil Bytes))))))))))))) && (ResearchInput::stringIs (CoreBinding::get value 0x73706563) 0x7233302f72657365617263682d706f7274666f6c696f2d626173652f31)) then (ResearchInput::suppliedConfig (ctor Json::Value.object (cons (0x73706563, (ctor Json::Value.string 0x7233302f72657365617263682d617474656d70742f31)) (cons (0x72657175657374, (CoreBinding::get value 0x72657175657374)) (cons (0x7265706f7369746f7279, (CoreBinding::get value 0x7265706f7369746f7279)) (cons (0x7265766973696f6e, (CoreBinding::get value 0x7265766973696f6e)) (cons (0x6f7574707574, (CoreBinding::get value 0x6f7574707574)) (cons (0x6572726f7273, (CoreBinding::get value 0x6572726f7273)) (cons (0x746f6f6c73, (CoreBinding::get value 0x746f6f6c73)) (cons (0x696d706f727473, (CoreBinding::get value 0x696d706f727473)) (cons (0x6c6576656c73, (CoreBinding::get value 0x6c6576656c73)) (cons (0x6178696f6d73, (CoreBinding::get value 0x6178696f6d73)) (cons (0x626f756e6473, (CoreBinding::get value 0x626f756e6473)) (cons (0x6172656e61, (ctor Json::Value.object (cons (0x6e6f646573, (ctor Json::Value.array (nil Json::Value))) (cons (0x726f6f74, (ctor Json::Value.number 0x30)) (nil (Bytes * Json::Value)))))) (cons (0x70726f6f66, (ctor Json::Value.number 0x30)) (nil (Bytes * Json::Value)))))))))))))))) environment) else (ctor Option.none [ResearchProject::Config])), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: tasks, + parameters: [values : (List Json::Value), seen : (List Bytes)], + result: (Option (List Research::Task)), + body: (match values | List.nil => (ctor Option.some [(List Research::Task)] (nil Research::Task)) | List.cons head tail => (match (ResearchInput::task head) | Option.none => (ctor Option.none [(List Research::Task)]) | Option.some task => (if (Hypotheses::memberBytes (project task id) seen) then (ctor Option.none [(List Research::Task)]) else (match (tasks tail (cons (project task id) seen)) | Option.none => (ctor Option.none [(List Research::Task)]) | Option.some rest => (ctor Option.some [(List Research::Task)] (cons task rest)))))), + axioms: [Quot.sound, propext], + recursive_argument: values, + executable: true +} +definition{ + name: components, + parameters: [], + result: (List Research::Component), + body: (cons (record Research::Component {id := "deduction", dependencies := (cons "kernel" (nil String)), concern := "proof", available := true}) (cons (record Research::Component {id := "kernel", dependencies := (cons "library" (nil String)), concern := "verification", available := true}) (cons (record Research::Component {id := "library", dependencies := (nil String), concern := "identity", available := true}) (nil Research::Component)))), + executable: true +} +definition{ + name: config, + parameters: [value : Json::Value, environment : (List (String * String))], + result: (Option Config), + body: (if ((CoreNotation::shape value (cons 0x73706563 (cons 0x62617365 (cons 0x7461736b73 (cons 0x627564676574 (nil Bytes)))))) && (ResearchInput::stringIs (CoreBinding::get value 0x73706563) 0x7233302f72657365617263682d706f7274666f6c696f2f31)) then (match (template (CoreBinding::get value 0x62617365) environment) | Option.none => (ctor Option.none [Config]) | Option.some base => (match (Json::natural (CoreBinding::get value 0x627564676574) 64) | Option.none => (ctor Option.none [Config]) | Option.some budget => (match (ResearchInput::array (CoreBinding::get value 0x7461736b73)) | Option.none => (ctor Option.none [Config]) | Option.some values => (if ((prim length values : Nat) <=? 64) then (match (tasks values (nil Bytes)) | Option.none => (ctor Option.none [Config]) | Option.some selected => (ctor Option.some [Config] (record Config {research := (record Research::State {snapshot := (project (project base request) snapshot), components := (components), tasks := selected, pending := (ctor Option.none [Research::Request]), next := (project (project base request) serial), history := (nil Research::Answer)}), base := base, budget := budget}))) else (ctor Option.none [Config]))))) else (ctor Option.none [Config])), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: decode, + parameters: [data : Bytes, environment : (List (Bytes * Bytes))], + result: (Option Config), + body: (match (Json::parse data 8388608 96) | Result.error problem => (ctor Option.none [Config]) | Result.ok value => (match (ResearchInput::environment environment) | Option.none => (ctor Option.none [Config]) | Option.some admitted => (config value admitted))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "bounded-portfolio-tasks" (cons "distinct-task-identities" (cons "no-proof-term-input" (cons "exact-schema-admission" (nil String))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchPortfolioTraces.lex.tex b/rule30-api/src/ResearchPortfolioTraces.lex.tex new file mode 100644 index 0000000..868cdd0 --- /dev/null +++ b/rule30-api/src/ResearchPortfolioTraces.lex.tex @@ -0,0 +1,139 @@ +\begin{lexlean}{ResearchPortfolioTraces} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchPortfolio} +\importmodule{ResearchPortfolioInput} +\importmodule{ResearchCohortCommand} +\importmodule{Research} +\importmodule{ResearchProject} +\importmodule{ResearchWorkspace} +\importmodule{ResearchSession} +\importmodule{ResearchExecution} +\importmodule{LexLeanStd.Host} +\importmodule{CoreBinding} +\importmodule{Json} +\importmodule{ResearchInputTraces} +\importmodule{ResearchInspection} +\title{Boolean} +\begin{semanticmodule} +theorem{ + name: oversizedBudgetDispatchesNothing, + parameters: [research : Research::State, base : ResearchProject::Config], + statement: ((second (ResearchPortfolio::begin research base 65)) = (ctor ResearchPortfolio::Emission.blocked "portfolio configuration or budget invalid")), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: cancelledContinuationWaitsForOwnedReply, + parameters: [state : ResearchPortfolio::State], + statement: ((second (ResearchPortfolio::cancel (record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project state research), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (ctor ResearchPortfolio::Phase.advancing), cancelled := (project state cancelled)}))) = (ctor ResearchPortfolio::Emission.awaiting)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: cancelledContinuationMarksCancellation, + parameters: [state : ResearchPortfolio::State], + statement: ((project (first (ResearchPortfolio::cancel (record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project state research), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (ctor ResearchPortfolio::Phase.advancing), cancelled := (project state cancelled)}))) cancelled) = true), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: blockedPortfolioCannotDispatch, + parameters: [state : ResearchPortfolio::State, event : LexLeanStd.Host::Event], + statement: ((second (ResearchPortfolio::host (record ResearchPortfolio::State {inspection := (ctor Option.none [ResearchInspection::State]), inspected := false, research := (project state research), base := (project state base), owner := (project state owner), active := (project state active), results := (project state results), remaining := (project state remaining), phase := (ctor ResearchPortfolio::Phase.blocked), cancelled := (project state cancelled)}) event)) = (ctor ResearchPortfolio::Emission.blocked "portfolio retained for recovery")), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: libraryTimeoutMarksPortfolioCancelled, + parameters: [state : ResearchPortfolio::State, owner : ResearchWorkspace::State], + statement: ((project (first (ResearchPortfolio::ownerResult state (owner, (ctor ResearchWorkspace::Emission.complete (ctor ResearchExecution::EndKind.cut))))) cancelled) = true), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: uncertainSessionRetainsOwner, + parameters: [state : ResearchPortfolio::State, session : ResearchSession::State, reason : String], + statement: ((project (first (ResearchPortfolio::attemptResult state (session, (ctor ResearchSession::Emission.blocked reason)))) owner) = (project state owner)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: suppliedProofCannotChoosePortfolioCandidate, + parameters: [base : ResearchProject::Config, request : Research::Request, arena : CoreBinding::Goal, proof : Nat], + statement: ((ResearchPortfolio::proposal (record ResearchProject::Config {request := (project base request), workspace := (project base workspace), tools := (project base tools), arena := arena, proof := proof, imports := (project base imports), levels := (project base levels), axioms := (project base axioms), maxBytes := (project base maxBytes), maxDepth := (project base maxDepth), maxSteps := (project base maxSteps)}) request) = (ResearchPortfolio::proposal base request)), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: suspensionClearsUnstartedSelection, + parameters: [research : Research::State, request : Research::Request], + statement: ((project (ResearchPortfolio::suspended (record Research::State {snapshot := (project research snapshot), components := (project research components), tasks := (project research tasks), pending := (ctor Option.some [Research::Request] request), next := (project research next), history := (project research history)})) pending) = (ctor Option.none [Research::Request])), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: terminalPortfolioCommandCannotRestart, + parameters: [state : ResearchPortfolio::State, event : LexLeanStd.Host::Event], + statement: ((ResearchCohortCommand::step (ctor Option.some [ResearchCohortCommand::State] (ctor ResearchCohortCommand::State.portfolioEnded state)) event) = (ResearchCohortCommand::finishPortfolio state (70 : UInt8) 0x6661696c6564 0x7465726d696e616c20706f7274666f6c696f2063616e6e6f742072657374617274)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +definition{ + name: baseDocument, + parameters: [], + result: Json::Value, + body: (ctor Json::Value.object (cons (0x73706563, (ctor Json::Value.string 0x7233302f72657365617263682d706f7274666f6c696f2d626173652f31)) (cons (0x72657175657374, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x72657175657374)) (cons (0x7265706f7369746f7279, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x7265706f7369746f7279)) (cons (0x7265766973696f6e, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x7265766973696f6e)) (cons (0x6f7574707574, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x6f7574707574)) (cons (0x6572726f7273, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x6572726f7273)) (cons (0x746f6f6c73, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x746f6f6c73)) (cons (0x696d706f727473, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x696d706f727473)) (cons (0x6c6576656c73, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x6c6576656c73)) (cons (0x6178696f6d73, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x6178696f6d73)) (cons (0x626f756e6473, (CoreBinding::get (ResearchInputTraces::fixtureDocument) 0x626f756e6473)) (nil (Bytes * Json::Value)))))))))))))), + axioms: [propext] +} +definition{ + name: document, + parameters: [], + result: Json::Value, + body: (ctor Json::Value.object (cons (0x73706563, (ctor Json::Value.string 0x7233302f72657365617263682d706f7274666f6c696f2f31)) (cons (0x62617365, (baseDocument)) (cons (0x7461736b73, (ctor Json::Value.array (cons (CoreBinding::get (ResearchInputTraces::requestDocument) 0x7461736b) (nil Json::Value)))) (cons (0x627564676574, (ctor Json::Value.number 0x31)) (nil (Bytes * Json::Value))))))), + axioms: [propext] +} +definition{ + name: admitted, + parameters: [value : Json::Value], + result: Bool, + body: (match (ResearchPortfolioInput::config value (nil (String * String))) | Option.none => false | Option.some config => true), + axioms: [Quot.sound, propext] +} +theorem{ + name: admitsPortfolioWithoutProofTerms, + parameters: [], + statement: ((admitted (document)) = true), + proof: decide{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: rejectsOversizedPortfolioBudget, + parameters: [], + statement: ((admitted (ResearchInputTraces::put (document) 0x627564676574 (ctor Json::Value.number 0x3635))) = false), + proof: decide{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: rejectsDuplicateTaskIdentity, + parameters: [], + statement: ((admitted (ResearchInputTraces::put (document) 0x7461736b73 (ctor Json::Value.array (cons (CoreBinding::get (ResearchInputTraces::requestDocument) 0x7461736b) (cons (CoreBinding::get (ResearchInputTraces::requestDocument) 0x7461736b) (nil Json::Value)))))) = false), + proof: decide{}, + axioms: [Quot.sound, propext] +} +definition{ + name: proofBearingDocument, + parameters: [], + result: Json::Value, + body: (match (document) | Json::Value.object fields => (ctor Json::Value.object (cons (0x70726f6f66, (ctor Json::Value.number 0x31)) fields)) | Json::Value.null => (document) | Json::Value.boolean value => (document) | Json::Value.number value => (document) | Json::Value.string value => (document) | Json::Value.array value => (document)), + axioms: [propext] +} +theorem{ + name: rejectsSmuggledProofTerm, + parameters: [], + statement: ((admitted (proofBearingDocument)) = false), + proof: decide{}, + axioms: [Quot.sound, propext] +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchPublication.lex.tex b/rule30-api/src/ResearchPublication.lex.tex new file mode 100644 index 0000000..33c898f --- /dev/null +++ b/rule30-api/src/ResearchPublication.lex.tex @@ -0,0 +1,270 @@ +\begin{lexlean}{ResearchPublication} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{PublicationPlan} +\importmodule{PublicationRecord} +\importmodule{PublicationFrontier} +\importmodule{ResearchProject} +\importmodule{ResearchCandidate} +\importmodule{ResearchWorkspace} +\importmodule{ResearchExecution} +\importmodule{ResearchVerification} +\importmodule{ResearchProof} +\importmodule{ResearchEvidence} +\importmodule{Research} +\importmodule{VerificationReport} +\importmodule{Host} +\importmodule{Toml} +\importmodule{LexLeanStd.Host} +\title{Boolean} +\begin{semanticmodule} +inductive{ + name: Phase, + type_parameters: [], + parameters: [], + constructors: [{name: preparing, fields: []}, {name: advancing, fields: []}, {name: executing, fields: []}, {name: readArchive, fields: []}, {name: readFrontier, fields: []}, {name: readManifest, fields: []}, {name: writeManifest, fields: []}, {name: writeSource, fields: []}, {name: verifying, fields: []}, {name: readGenerated, fields: []}, {name: writeGenerated, fields: []}, {name: readHead, fields: []}, {name: releasing, fields: []}, {name: ended, fields: []}, {name: blocked, fields: []}] +} +structure{ + name: State, + type_parameters: [], + parameters: [], + fields: [{name: pending, type: (List (Research::Answer * Bytes))}, {name: identities, type: (List Bytes)}, {name: config, type: PublicationPlan::Config}, {name: owner, type: (Option ResearchWorkspace::State)}, {name: candidate, type: (Option ResearchCandidate::State)}, {name: execution, type: (Option ResearchExecution::State)}, {name: phase, type: Phase}, {name: operation, type: PublicationPlan::Operation}, {name: source, type: Bytes}, {name: receipt, type: (Option VerificationReport::Receipt)}, {name: commit, type: Bytes}, {name: cancelled, type: Bool}, {name: published, type: Bool}] +} +inductive{ + name: Event, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Event]}, {name: cancel, fields: []}] +} +inductive{ + name: Emission, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Request]}, {name: awaiting, fields: []}, {name: complete, fields: [(List Bytes), Bytes]}, {name: blocked, fields: [String]}] +} +definition{ + name: blocked, + parameters: [state : State, reason : String], + result: (State * Emission), + body: ((record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (ctor Phase.blocked), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}), (ctor Emission.blocked reason)), + axioms: [], + executable: true +} +definition{ + name: read, + parameters: [state : State, phase : Phase, path : String], + result: (State * Emission), + body: ((record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (ctor Option.none [ResearchExecution::State]), phase := phase, operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}), (ctor Emission.host (ctor LexLeanStd.Host::Request.read path))), + axioms: [], + executable: true +} +definition{ + name: write, + parameters: [state : State, phase : Phase, path : String, data : Bytes], + result: (State * Emission), + body: ((record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (ctor Option.none [ResearchExecution::State]), phase := phase, operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}), (ctor Emission.host (ctor LexLeanStd.Host::Request.write path data))), + axioms: [], + executable: true +} +definition{ + name: launch, + parameters: [state : State, operation : PublicationPlan::Operation], + result: (State * Emission), + body: (let result : (ResearchExecution::State * ResearchExecution::Emission) := (ResearchExecution::begin (PublicationPlan::job (project state config) operation (project state commit))); (let next : State := (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (ctor Option.some [ResearchExecution::State] (first result)), phase := (ctor Phase.executing), operation := operation, source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}); (match (second result) | ResearchExecution::Emission.host request => (next, (ctor Emission.host request)) | ResearchExecution::Emission.awaiting => (blocked next "publication job did not start") | ResearchExecution::Emission.complete completion => (blocked next "publication job refused")))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: ownerResult, + parameters: [state : State, result : (ResearchWorkspace::State * ResearchWorkspace::Emission)], + result: (State * Emission), + body: (let next : State := (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (ctor Option.some [ResearchWorkspace::State] (first result)), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}); (match (second result) | ResearchWorkspace::Emission.host request => (next, (ctor Emission.host request)) | ResearchWorkspace::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchWorkspace::Emission.ready path => (if (project next cancelled) then (blocked next "cancelled publication retains workspace") else (launch next (ctor PublicationPlan::Operation.archive))) | ResearchWorkspace::Emission.complete kind => (if ((project next published) && (not (project (first result) owned))) then (match kind | ResearchExecution::EndKind.succeeded => ((record State {pending := (project next pending), identities := (project next identities), config := (project next config), owner := (project next owner), candidate := (project next candidate), execution := (project next execution), phase := (ctor Phase.ended), operation := (project next operation), source := (project next source), receipt := (project next receipt), commit := (project next commit), cancelled := (project next cancelled), published := (project next published)}), (ctor Emission.complete (project next identities) (project next commit))) | ResearchExecution::EndKind.failed => (blocked next "publication cleanup not accepted") | ResearchExecution::EndKind.cut => (blocked next "publication cleanup not accepted") | ResearchExecution::EndKind.unavailable => (blocked next "publication cleanup not accepted") | ResearchExecution::EndKind.protocol => (blocked next "publication cleanup not accepted") | ResearchExecution::EndKind.cleanupFailed => (blocked next "publication cleanup not accepted") | ResearchExecution::EndKind.refused => (blocked next "publication cleanup not accepted")) else (blocked next "publication workspace ended before publication")) | ResearchWorkspace::Emission.blocked reason => (blocked next reason) | ResearchWorkspace::Emission.refused => (blocked next "publication workspace refused"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: release, + parameters: [state : State], + result: (State * Emission), + body: (match (project state owner) | Option.none => (blocked state "missing publication workspace owner") | Option.some owner => (ownerResult (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (ctor Phase.releasing), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}) (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.release)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: receiptOf, + parameters: [candidate : ResearchCandidate::State], + result: (Option VerificationReport::Receipt), + body: (match (project candidate phase) | ResearchCandidate::Phase.ended => (if (not (project candidate cancelled)) then (match (project candidate proof) | Option.none => (ctor Option.none [VerificationReport::Receipt]) | Option.some proof => (match (project (project proof verification) outcome) | Option.none => (ctor Option.none [VerificationReport::Receipt]) | Option.some outcome => (match outcome | ResearchVerification::Outcome.accepted receipt => (ctor Option.some [VerificationReport::Receipt] receipt) | ResearchVerification::Outcome.terminated completion => (ctor Option.none [VerificationReport::Receipt]) | ResearchVerification::Outcome.rejected reason => (ctor Option.none [VerificationReport::Receipt]) | ResearchVerification::Outcome.cancelled => (ctor Option.none [VerificationReport::Receipt])))) else (ctor Option.none [VerificationReport::Receipt])) | ResearchCandidate::Phase.running => (ctor Option.none [VerificationReport::Receipt]) | ResearchCandidate::Phase.reading => (ctor Option.none [VerificationReport::Receipt]) | ResearchCandidate::Phase.verifying => (ctor Option.none [VerificationReport::Receipt])), + axioms: [], + executable: true +} +definition{ + name: candidateResult, + parameters: [state : State, result : (ResearchCandidate::State * ResearchProof::Emission)], + result: (State * Emission), + body: (let next : State := (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (ctor Option.some [ResearchCandidate::State] (first result)), execution := (ctor Option.none [ResearchExecution::State]), phase := (ctor Phase.verifying), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}); (match (second result) | ResearchProof::Emission.host request => (next, (ctor Emission.host request)) | ResearchProof::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchProof::Emission.blocked completion => (blocked next "publication proof ownership uncertain") | ResearchProof::Emission.complete answer => (if (project next cancelled) then (blocked next "cancelled publication retains source") else (match (project answer result) | Research::ResultKind.checked sequent theorem axioms => (match (receiptOf (first result)) | Option.none => (blocked next "missing owned publication receipt") | Option.some receipt => (read (record State {pending := (project next pending), identities := (project next identities), config := (project next config), owner := (project next owner), candidate := (project next candidate), execution := (project next execution), phase := (project next phase), operation := (project next operation), source := (project next source), receipt := (ctor Option.some [VerificationReport::Receipt] receipt), commit := (project next commit), cancelled := (project next cancelled), published := (project next published)}) (ctor Phase.readGenerated) (PublicationPlan::generatedPath (project next config) receipt))) | Research::ResultKind.inspected sequent => (blocked next "renamed source did not establish the claim") | Research::ResultKind.maintained sources evidence => (blocked next "renamed source did not establish the claim") | Research::ResultKind.failed reason => (blocked next "renamed source did not establish the claim") | Research::ResultKind.cut => (blocked next "renamed source did not establish the claim") | Research::ResultKind.unavailable => (blocked next "renamed source did not establish the claim"))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: plan, + parameters: [base : ResearchProject::Config, answer : Research::Answer, identity : Bytes], + result: PublicationPlan::Config, + body: (record PublicationPlan::Config {base := (record ResearchProject::Config {request := (project answer request), workspace := (project base workspace), tools := (project base tools), arena := (project base arena), proof := (project base proof), imports := (project base imports), levels := (project base levels), axioms := (project base axioms), maxBytes := (project base maxBytes), maxDepth := (project base maxDepth), maxSteps := (project base maxSteps)}), identity := identity}), + axioms: [], + executable: true +} +definition{ + name: eligibleAnswer, + parameters: [answer : Research::Answer, identity : Bytes], + result: Bool, + body: ((VerificationReport::digest identity) && (match (project answer result) | Research::ResultKind.checked sequent theorem axioms => true | Research::ResultKind.inspected sequent => false | Research::ResultKind.maintained sources evidence => false | Research::ResultKind.failed reason => false | Research::ResultKind.cut => false | Research::ResultKind.unavailable => false)), + axioms: [propext], + executable: true +} +definition{ + name: pendingProofs, + parameters: [answers : (List (Research::Answer * Bytes))], + result: (List (Research::Answer * Bytes)), + body: (match answers | List.nil => (nil (Research::Answer * Bytes)) | List.cons head tail => (if (eligibleAnswer (first head) (second head)) then (cons head (pendingProofs tail)) else (pendingProofs tail))), + axioms: [propext], + recursive_argument: answers, + executable: true +} +definition{ + name: advanceLater, + parameters: [state : State], + result: (State * Emission), + body: ((record State {pending := (project state pending), identities := (prim append (project state identities) (cons (project (project state config) identity) (nil Bytes)) : (List Bytes)), config := (project state config), owner := (project state owner), candidate := (ctor Option.none [ResearchCandidate::State]), execution := (ctor Option.none [ResearchExecution::State]), phase := (ctor Phase.advancing), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}), (ctor Emission.host (ctor LexLeanStd.Host::Request.wait (nil Nat) 0))), + axioms: [], + executable: true +} +definition{ + name: advance, + parameters: [state : State], + result: (State * Emission), + body: (if (project state cancelled) then (blocked state "cancelled proof batch retains owned changes") else (match (project state pending) | List.nil => (launch state (ctor PublicationPlan::Operation.stage)) | List.cons head tail => (launch (record State {pending := tail, identities := (project state identities), config := (plan (project (project state config) base) (first head) (second head)), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := 0x, receipt := (ctor Option.none [VerificationReport::Receipt]), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}) (ctor PublicationPlan::Operation.archive)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: succeeded, + parameters: [state : State], + result: (State * Emission), + body: (match (project state operation) | PublicationPlan::Operation.archive => (read state (ctor Phase.readArchive) (project (PublicationPlan::workspace (project state config)) output)) | PublicationPlan::Operation.update => (launch state (ctor PublicationPlan::Operation.lock)) | PublicationPlan::Operation.lock => (candidateResult state (ResearchCandidate::begin (PublicationPlan::context (project state config)))) | PublicationPlan::Operation.register => (launch state (ctor PublicationPlan::Operation.theorem)) | PublicationPlan::Operation.theorem => (if (PublicationFrontier::closesClaim (project (project (project (project state config) base) request) task)) then (launch state (ctor PublicationPlan::Operation.frontier)) else (launch state (ctor PublicationPlan::Operation.sync))) | PublicationPlan::Operation.frontier => (launch state (ctor PublicationPlan::Operation.sync)) | PublicationPlan::Operation.sync => (advanceLater state) | PublicationPlan::Operation.stage => (launch state (ctor PublicationPlan::Operation.commit)) | PublicationPlan::Operation.commit => (launch state (ctor PublicationPlan::Operation.head)) | PublicationPlan::Operation.head => (read state (ctor Phase.readHead) (project (PublicationPlan::workspace (project state config)) output)) | PublicationPlan::Operation.retain => (launch state (ctor PublicationPlan::Operation.push)) | PublicationPlan::Operation.push => (release (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (ctor Option.none [ResearchExecution::State]), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := true}))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: completed, + parameters: [state : State, completion : ResearchExecution::Completion], + result: (State * Emission), + body: (if ((ResearchExecution::resumeAllowed completion) && (ResearchWorkspace::exitedNormally completion)) then (match (project completion kind) | ResearchExecution::EndKind.succeeded => (if (project state cancelled) then (match (project state operation) | PublicationPlan::Operation.push => (succeeded state) | PublicationPlan::Operation.archive => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.update => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.lock => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.register => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.theorem => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.frontier => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.sync => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.stage => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.commit => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.head => (blocked state "publication cancelled; retain owned changes") | PublicationPlan::Operation.retain => (blocked state "publication cancelled; retain owned changes")) else (succeeded state)) | ResearchExecution::EndKind.failed => (blocked state "publication job failed or stopped; retain recovery state") | ResearchExecution::EndKind.cut => (blocked state "publication job failed or stopped; retain recovery state") | ResearchExecution::EndKind.unavailable => (blocked state "publication job failed or stopped; retain recovery state") | ResearchExecution::EndKind.protocol => (blocked state "publication job failed or stopped; retain recovery state") | ResearchExecution::EndKind.cleanupFailed => (blocked state "publication job failed or stopped; retain recovery state") | ResearchExecution::EndKind.refused => (blocked state "publication job failed or stopped; retain recovery state")) else (blocked state "publication outcome uncertain; retain all ownership")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: executionResult, + parameters: [state : State, result : (ResearchExecution::State * ResearchExecution::Emission)], + result: (State * Emission), + body: (let next : State := (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (ctor Option.some [ResearchExecution::State] (first result)), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}); (match (second result) | ResearchExecution::Emission.host request => (next, (ctor Emission.host request)) | ResearchExecution::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchExecution::Emission.complete completion => (completed next completion))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: readBytes, + parameters: [state : State, bytes : Bytes], + result: (State * Emission), + body: (match (project state phase) | Phase.advancing => (blocked state "unexpected publication read") | Phase.preparing => (blocked state "unexpected publication read") | Phase.executing => (blocked state "unexpected publication read") | Phase.readArchive => (match (PublicationRecord::decode bytes (project (project state config) identity) (project (project (project state config) base) request) (project (PublicationPlan::workspace (project state config)) revision)) | Option.none => (blocked state "evidence archive identity, request or revision mismatch") | Option.some source => (read (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := source, receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}) (ctor Phase.readFrontier) (ResearchVerification::concat (PublicationPlan::root (project state config)) "/frontier.toml"))) | Phase.readFrontier => (if (PublicationFrontier::current bytes (project (project (project (project state config) base) request) task)) then (read state (ctor Phase.readManifest) (ResearchVerification::concat (PublicationPlan::root (project state config)) "/rule30-paper/lexlean.toml")) else (blocked state "publication frontier is stale, closed or ambiguous")) | Phase.readManifest => (match (PublicationPlan::entrypoint (project state config) bytes) | Option.none => (blocked state "paper manifest cannot admit generated source") | Option.some updated => (write state (ctor Phase.writeManifest) (ResearchVerification::concat (PublicationPlan::root (project state config)) "/rule30-paper/lexlean.toml") updated)) | Phase.writeManifest => (blocked state "unexpected publication read") | Phase.writeSource => (blocked state "unexpected publication read") | Phase.verifying => (blocked state "unexpected publication read") | Phase.readGenerated => (if ((0 (blocked state "unexpected publication read") | Phase.readHead => (let commit : Bytes := (Toml::sliceOr bytes 0 (prim subtract (prim length bytes : Nat) 1 : Nat)); (if ((ResearchWorkspace::objectId commit) && (Toml::sameBytes bytes (prim append commit 0x0a : Bytes))) then (launch (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := commit, cancelled := (project state cancelled), published := (project state published)}) (ctor PublicationPlan::Operation.retain)) else (blocked state "invalid publication commit identity"))) | Phase.releasing => (blocked state "unexpected publication read") | Phase.ended => (blocked state "unexpected publication read") | Phase.blocked => (blocked state "unexpected publication read")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: readResult, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (ResearchVerification::readResponse event) | Option.none => (blocked state "unexpected publication read response") | Option.some result => (if (project state cancelled) then (blocked state "cancelled publication read drained; retain changes") else (match result | Result.error problem => (blocked state "publication read failed") | Result.ok bytes => (readBytes state bytes)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: written, + parameters: [state : State], + result: (State * Emission), + body: (match (project state phase) | Phase.advancing => (blocked state "unexpected publication write") | Phase.preparing => (blocked state "unexpected publication write") | Phase.executing => (blocked state "unexpected publication write") | Phase.readArchive => (blocked state "unexpected publication write") | Phase.readFrontier => (blocked state "unexpected publication write") | Phase.readManifest => (blocked state "unexpected publication write") | Phase.writeManifest => (write state (ctor Phase.writeSource) (ResearchVerification::concat (PublicationPlan::root (project state config)) (ResearchVerification::concat "/rule30-paper/" (PublicationPlan::sourcePath (project state config)))) (project state source)) | Phase.writeSource => (launch state (ctor PublicationPlan::Operation.update)) | Phase.verifying => (blocked state "unexpected publication write") | Phase.readGenerated => (blocked state "unexpected publication write") | Phase.writeGenerated => (launch state (ctor PublicationPlan::Operation.register)) | Phase.readHead => (blocked state "unexpected publication write") | Phase.releasing => (blocked state "unexpected publication write") | Phase.ended => (blocked state "unexpected publication write") | Phase.blocked => (blocked state "unexpected publication write")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: writeResult, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (ResearchExecution::asFinished event) | Option.none => (blocked state "unexpected publication write response") | Option.some result => (if (project state cancelled) then (blocked state "cancelled publication write drained; retain changes") else (match result | Result.error problem => (blocked state "publication write failed") | Result.ok ignored => (written state)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: host, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (project state phase) | Phase.advancing => (match (ResearchExecution::asWaited event) | Option.none => (blocked state "unexpected publication continuation") | Option.some response => (match response | Result.error failure => (blocked state "publication continuation failed") | Result.ok waited => (match (project waited finished) | List.nil => (advance state) | List.cons child tail => (blocked state "publication continuation returned unowned child")))) | Phase.preparing => (match (project state owner) | Option.none => (blocked state "publication lost workspace owner") | Option.some owner => (ownerResult state (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.host event)))) | Phase.executing => (match (project state execution) | Option.none => (blocked state "publication lost job owner") | Option.some execution => (executionResult state (ResearchExecution::step execution event))) | Phase.readArchive => (readResult state event) | Phase.readFrontier => (readResult state event) | Phase.readManifest => (readResult state event) | Phase.writeManifest => (writeResult state event) | Phase.writeSource => (writeResult state event) | Phase.verifying => (match (project state candidate) | Option.none => (blocked state "publication lost proof owner") | Option.some candidate => (candidateResult state (ResearchCandidate::host candidate event))) | Phase.readGenerated => (readResult state event) | Phase.writeGenerated => (writeResult state event) | Phase.readHead => (readResult state event) | Phase.releasing => (match (project state owner) | Option.none => (blocked state "publication lost workspace owner") | Option.some owner => (ownerResult state (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.host event)))) | Phase.ended => (state, (ctor Emission.awaiting)) | Phase.blocked => (blocked state "publication retained for recovery")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: cancel, + parameters: [state : State], + result: (State * Emission), + body: (let next : State := (record State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := true, published := (project state published)}); (match (project state phase) | Phase.advancing => (next, (ctor Emission.awaiting)) | Phase.preparing => (match (project next owner) | Option.none => (blocked next "publication lost workspace owner") | Option.some owner => (ownerResult next (ResearchWorkspace::step owner (ctor ResearchWorkspace::Event.cancel)))) | Phase.executing => (match (project next execution) | Option.none => (blocked next "publication lost job owner") | Option.some execution => (executionResult next (ResearchExecution::cancel execution))) | Phase.readArchive => (next, (ctor Emission.awaiting)) | Phase.readFrontier => (next, (ctor Emission.awaiting)) | Phase.readManifest => (next, (ctor Emission.awaiting)) | Phase.writeManifest => (next, (ctor Emission.awaiting)) | Phase.writeSource => (next, (ctor Emission.awaiting)) | Phase.verifying => (match (project next candidate) | Option.none => (blocked next "publication lost proof owner") | Option.some candidate => (candidateResult next (ResearchCandidate::cancel candidate))) | Phase.readGenerated => (next, (ctor Emission.awaiting)) | Phase.writeGenerated => (next, (ctor Emission.awaiting)) | Phase.readHead => (next, (ctor Emission.awaiting)) | Phase.releasing => (next, (ctor Emission.awaiting)) | Phase.ended => (state, (ctor Emission.awaiting)) | Phase.blocked => (blocked next "publication retained for recovery"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: begin, + parameters: [config : PublicationPlan::Config], + result: (State * Emission), + body: (let state : State := (record State {pending := (nil (Research::Answer * Bytes)), identities := (nil Bytes), config := config, owner := (ctor Option.none [ResearchWorkspace::State]), candidate := (ctor Option.none [ResearchCandidate::State]), execution := (ctor Option.none [ResearchExecution::State]), phase := (ctor Phase.preparing), operation := (ctor PublicationPlan::Operation.archive), source := 0x, receipt := (ctor Option.none [VerificationReport::Receipt]), commit := 0x, cancelled := false, published := false}); (if ((VerificationReport::digest (project config identity)) && ((ResearchCandidate::valid (PublicationPlan::context config)) && (Research::sameSnapshot (project (project (project config base) request) snapshot) (project (project (PublicationPlan::workspace config) request) snapshot)))) then (ownerResult state (ResearchWorkspace::begin (PublicationPlan::workspace config))) else (blocked state "invalid publication configuration"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: beginBatch, + parameters: [base : ResearchProject::Config, answers : (List (Research::Answer * Bytes))], + result: (Option (State * Emission)), + body: (if ((prim length answers : Nat) <=? 64) then (match (pendingProofs answers) | List.nil => (ctor Option.none [(State * Emission)]) | List.cons head tail => (let result : (State * Emission) := (begin (plan base (first head) (second head))); (let state : State := (first result); (ctor Option.some [(State * Emission)] ((record State {pending := tail, identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}), (second result)))))) else (ctor Option.none [(State * Emission)])), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: step, + parameters: [state : State, event : Event], + result: (State * Emission), + body: (match event | Event.host response => (host state response) | Event.cancel => (cancel state)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: released, + parameters: [state : State], + result: Bool, + body: ((project state published) && ((ResearchWorkspace::objectId (project state commit)) && ((match (project state phase) | Phase.preparing => false | Phase.advancing => false | Phase.executing => false | Phase.readArchive => false | Phase.readFrontier => false | Phase.readManifest => false | Phase.writeManifest => false | Phase.writeSource => false | Phase.verifying => false | Phase.readGenerated => false | Phase.writeGenerated => false | Phase.readHead => false | Phase.releasing => false | Phase.ended => true | Phase.blocked => false) && ((match (project state execution) | Option.none => true | Option.some execution => false) && ((match (project state candidate) | Option.none => true | Option.some candidate => false) && (match (project state owner) | Option.none => false | Option.some owner => (not (project owner owned)))))))), + axioms: [propext], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Own a bounded proof batch in one isolated worktree, one unchanged commit gate and one revision-conditional push. Own archive replay, fresh renamed-source verification, generated host proof registration, theorem publication, frontier mutation, unchanged pre-commit validation, retained commit identity and source-revision compare-and-swap push. Only host replies and cancellation enter this lifecycle. An archived receipt cannot skip verification. Supporting premises never close the parent claim. Every uncertain or failed effect retains its workspace and pending ownership; successful remote acknowledgment is required before published becomes true and cleanup may finish. Cancellation drains outstanding reads, writes and child processes; cancellation concurrent with acknowledged publication preserves that fact.", + axioms: [], + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "owned-evidence-archive-replay" (cons "fresh-renamed-source-verification" (cons "single-workspace-proof-batch" (cons "one-commit-gate-per-batch" (cons "source-conditional-publication" (cons "publication-acknowledgement-before-cleanup" (cons "uncertain-effects-retain-ownership" (cons "cancel-drains-pending-effects" (nil String))))))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchPublicationTraces.lex.tex b/rule30-api/src/ResearchPublicationTraces.lex.tex new file mode 100644 index 0000000..803b162 --- /dev/null +++ b/rule30-api/src/ResearchPublicationTraces.lex.tex @@ -0,0 +1,177 @@ +\begin{lexlean}{ResearchPublicationTraces} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchProject} +\importmodule{ResearchPublication} +\importmodule{PublicationSource} +\importmodule{PublicationPlan} +\importmodule{PublicationRecord} +\importmodule{PublicationFrontier} +\importmodule{Research} +\importmodule{ResearchWorkspace} +\importmodule{ResearchExecution} +\importmodule{ResearchCandidate} +\importmodule{VerificationReport} +\importmodule{Json} +\importmodule{LexLeanStd.Host} +\importmodule{Host} +\importmodule{Toml} +\importmodule{ResearchVerification} +\title{Boolean} +\begin{semanticmodule} +theorem{ + name: missingIdentityCannotReplayArchive, + parameters: [data : Bytes, request : Research::Request, revision : Bytes], + statement: ((PublicationRecord::decode data 0x request revision) = (ctor Option.none [Bytes])), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: absentArchiveCannotSupplySource, + parameters: [request : Research::Request, revision : Bytes, identity : Bytes], + statement: ((PublicationRecord::source (ctor Json::Value.null) request revision identity) = (ctor Option.none [Bytes])), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: missingIdentityCannotRenameSource, + parameters: [source : Bytes, fuel : Nat], + statement: ((PublicationSource::renamed source 0x fuel) = (ctor Option.none [Bytes])), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: emptyFrontierCannotPublishClaim, + parameters: [task : Research::Task], + statement: ((PublicationFrontier::current 0x task) = false), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: emptyBatchNeedsNoPublisher, + parameters: [base : ResearchProject::Config], + statement: ((ResearchPublication::beginBatch base (nil (Research::Answer * Bytes))) = (ctor Option.none [(ResearchPublication::State * ResearchPublication::Emission)])), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: terminalPublicationCannotRestart, + parameters: [state : ResearchPublication::State, event : LexLeanStd.Host::Event], + statement: ((second (ResearchPublication::host (record ResearchPublication::State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (ctor ResearchPublication::Phase.ended), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}) event)) = (ctor ResearchPublication::Emission.awaiting)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: cancelledArchiveReadCannotStartVerification, + parameters: [state : ResearchPublication::State, bytes : Bytes], + statement: ((second (ResearchPublication::readResult (record ResearchPublication::State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := true, published := (project state published)}) (ctor LexLeanStd.Host::Event.read (ctor Result.ok [Bytes, LexLeanStd.Host::Failure] bytes)))) = (ctor ResearchPublication::Emission.blocked "cancelled publication read drained; retain changes")), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: cancelledSourceWriteCannotStartTool, + parameters: [state : ResearchPublication::State, ignored : Unit], + statement: ((second (ResearchPublication::writeResult (record ResearchPublication::State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := true, published := (project state published)}) (ctor LexLeanStd.Host::Event.finished (ctor Result.ok [Unit, LexLeanStd.Host::Failure] ignored)))) = (ctor ResearchPublication::Emission.blocked "cancelled publication write drained; retain changes")), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: batchContinuationDoesNotCommitPerProof, + parameters: [state : ResearchPublication::State], + statement: ((second (ResearchPublication::succeeded (record ResearchPublication::State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (ctor PublicationPlan::Operation.sync), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := (project state published)}))) = (ctor ResearchPublication::Emission.host (ctor LexLeanStd.Host::Request.wait (nil Nat) 0))), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: unacknowledgedPublicationCannotSeal, + parameters: [state : ResearchPublication::State], + statement: ((ResearchPublication::released (record ResearchPublication::State {pending := (project state pending), identities := (project state identities), config := (project state config), owner := (project state owner), candidate := (project state candidate), execution := (project state execution), phase := (project state phase), operation := (project state operation), source := (project state source), receipt := (project state receipt), commit := (project state commit), cancelled := (project state cancelled), published := false})) = false), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: blockedPublicationRetainsWorkspace, + parameters: [state : ResearchPublication::State, reason : String], + statement: ((project (first (ResearchPublication::blocked state reason)) owner) = (project state owner)), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: blockedPublicationRetainsPendingProofs, + parameters: [state : ResearchPublication::State, reason : String], + statement: ((project (first (ResearchPublication::blocked state reason)) pending) = (project state pending)), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: publicationRenamePreservesCandidateBody, + parameters: [], + statement: ((PublicationSource::renamed 0x5c626567696e7b6c65786c65616e7d7b43616e6469646174657d0a5c626567696e7b636f72656d6f64756c657d0a696d706f727473205b22496e6974225d0a7468656f72656d2052756c65333043616e6469646174652e43616e6469646174652e70726f6f66203a204030203a3d2040310a 0x61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 1024) = (ctor Option.some [Bytes] 0x5c626567696e7b6c65786c65616e7d7b47656e65726174656450616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161617d0a5c626567696e7b636f72656d6f64756c657d0a696d706f727473205b22496e6974225d0a7468656f72656d2052756c653330554f522e47656e65726174656450616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161612e70726f6f66203a204030203a3d2040310a)), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: uniqueOpenClaimMatchesInspectedOrigin, + parameters: [task : Research::Task], + statement: ((PublicationFrontier::current 0x5b5b636c61696d5d5d0a6964203d2022616c706861220a737461747573203d20226f70656e220a6c65616e203d202250726f70220a (record Research::Task {id := 0x616c706861, purpose := (project task purpose), intent := (ctor Research::Purpose.prove), status := (project task status), component := (project task component), sources := (project task sources), schema := (project task schema), sequent := (record Research::Sequent {origin := 0x50726f70, theorem := (project (project task sequent) theorem), premise := (project (project task sequent) premise), telescope := (project (project task sequent) telescope), target := (project (project task sequent) target), kind := (ctor Research::GoalKind.closed)}), age := (project task age), weight := (project task weight)})) = true), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: closedClaimRejectsChangedOrigin, + parameters: [task : Research::Task], + statement: ((PublicationFrontier::current 0x5b5b636c61696d5d5d0a6964203d2022616c706861220a737461747573203d20226f70656e220a6c65616e203d202250726f70220a (record Research::Task {id := 0x616c706861, purpose := (project task purpose), intent := (ctor Research::Purpose.prove), status := (project task status), component := (project task component), sources := (project task sources), schema := (project task schema), sequent := (record Research::Sequent {origin := 0x4f74686572, theorem := (project (project task sequent) theorem), premise := (project (project task sequent) premise), telescope := (project (project task sequent) telescope), target := (project (project task sequent) target), kind := (ctor Research::GoalKind.closed)}), age := (project task age), weight := (project task weight)})) = false), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: alreadyProvedClaimCannotBeRepublished, + parameters: [task : Research::Task], + statement: ((PublicationFrontier::current 0x5b5b636c61696d5d5d0a6964203d2022616c706861220a737461747573203d202270726f766564220a6c65616e203d202250726f70220a (record Research::Task {id := 0x616c706861, purpose := (project task purpose), intent := (ctor Research::Purpose.prove), status := (project task status), component := (project task component), sources := (project task sources), schema := (project task schema), sequent := (record Research::Sequent {origin := 0x50726f70, theorem := (project (project task sequent) theorem), premise := (project (project task sequent) premise), telescope := (project (project task sequent) telescope), target := (project (project task sequent) target), kind := (ctor Research::GoalKind.closed)}), age := (project task age), weight := (project task weight)})) = false), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: duplicateClaimIdentityRefusesPublication, + parameters: [task : Research::Task], + statement: ((PublicationFrontier::current 0x5b5b636c61696d5d5d0a6964203d2022616c706861220a737461747573203d20226f70656e220a6c65616e203d202250726f70220a5b5b636c61696d5d5d0a6964203d2022616c706861220a737461747573203d20226f70656e220a6c65616e203d202250726f70220a (record Research::Task {id := 0x616c706861, purpose := (project task purpose), intent := (ctor Research::Purpose.prove), status := (project task status), component := (project task component), sources := (project task sources), schema := (project task schema), sequent := (record Research::Sequent {origin := 0x50726f70, theorem := (project (project task sequent) theorem), premise := (project (project task sequent) premise), telescope := (project (project task sequent) telescope), target := (project (project task sequent) target), kind := (ctor Research::GoalKind.closed)}), age := (project task age), weight := (project task weight)})) = false), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: premiseProofLeavesParentClaimOpen, + parameters: [task : Research::Task], + statement: ((PublicationFrontier::closesClaim (record Research::Task {id := 0x616c706861, purpose := (project task purpose), intent := (ctor Research::Purpose.prove), status := (project task status), component := (project task component), sources := (project task sources), schema := (project task schema), sequent := (record Research::Sequent {origin := 0x50726f70, theorem := (project (project task sequent) theorem), premise := (project (project task sequent) premise), telescope := (project (project task sequent) telescope), target := (project (project task sequent) target), kind := (ctor Research::GoalKind.premise)}), age := (project task age), weight := (project task weight)})) = false), + proof: reflexivity{}, + axioms: [] +} +theorem{ + name: retentionIsCommitAddressed, + parameters: [config : PublicationPlan::Config, commit : Bytes], + statement: ((PublicationPlan::arguments config (ctor PublicationPlan::Operation.retain) commit) = (cons "update-ref" (cons (PublicationPlan::reference config commit) (cons (Host::textOf commit) (nil String))))), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: generatedEntrypointPreservesSortedOrder, + parameters: [], + statement: ((PublicationPlan::insertPath 0x7372632f47656e65726174656450302e6c65782e746578 (cons (ctor Json::Value.string 0x7372632f46726f6e746965722e6c65782e746578) (cons (ctor Json::Value.string 0x7372632f4f62736572766174696f6e732e6c65782e746578) (nil Json::Value)))) = (ctor Option.some [(List Json::Value)] (cons (ctor Json::Value.string 0x7372632f46726f6e746965722e6c65782e746578) (cons (ctor Json::Value.string 0x7372632f47656e65726174656450302e6c65782e746578) (cons (ctor Json::Value.string 0x7372632f4f62736572766174696f6e732e6c65782e746578) (nil Json::Value)))))), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: existingEntrypointIsNotDuplicated, + parameters: [], + statement: ((PublicationPlan::insertPath 0x7372632f46726f6e746965722e6c65782e746578 (cons (ctor Json::Value.string 0x7372632f46726f6e746965722e6c65782e746578) (cons (ctor Json::Value.string 0x7372632f4f62736572766174696f6e732e6c65782e746578) (nil Json::Value)))) = (ctor Option.some [(List Json::Value)] (cons (ctor Json::Value.string 0x7372632f46726f6e746965722e6c65782e746578) (cons (ctor Json::Value.string 0x7372632f4f62736572766174696f6e732e6c65782e746578) (nil Json::Value))))), + proof: reflexivity{}, + axioms: [propext] +} +theorem{ + name: pushNamesTheRetainedCommit, + parameters: [config : PublicationPlan::Config, commit : Bytes], + statement: ((PublicationPlan::arguments config (ctor PublicationPlan::Operation.push) commit) = (cons "-c" (cons "core.hooksPath=.githooks" (cons "push" (cons (ResearchVerification::concat "--force-with-lease=refs/heads/main:" (Host::textOf (project (PublicationPlan::workspace config) revision))) (cons "origin" (cons (ResearchVerification::concat (Host::textOf commit) ":refs/heads/main") (nil String)))))))), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchRecovery.lex.tex b/rule30-api/src/ResearchRecovery.lex.tex new file mode 100644 index 0000000..6e1dbb0 --- /dev/null +++ b/rule30-api/src/ResearchRecovery.lex.tex @@ -0,0 +1,300 @@ +\begin{lexlean}{ResearchRecovery} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchPortfolioInput} +\importmodule{ResearchPortfolio} +\importmodule{ResearchProject} +\importmodule{ResearchWorkspace} +\importmodule{ResearchEvidence} +\importmodule{ResearchExecution} +\importmodule{ResearchJournal} +\importmodule{ResearchVerification} +\importmodule{ResearchInput} +\importmodule{Research} +\importmodule{CoreBinding} +\importmodule{CoreNotation} +\importmodule{Json} +\importmodule{Toml} +\importmodule{Hypotheses} +\importmodule{Host} +\importmodule{LexLeanStd.Host} +\title{Boolean} +\begin{semanticmodule} +structure{ + name: Config, + type_parameters: [], + parameters: [], + fields: [{name: portfolio, type: ResearchPortfolioInput::Config}, {name: recordPath, type: String}, {name: maxQuarantined, type: Nat}] +} +inductive{ + name: Operation, + type_parameters: [], + parameters: [], + constructors: [{name: identity, fields: []}, {name: record, fields: []}] +} +inductive{ + name: Phase, + type_parameters: [], + parameters: [], + constructors: [{name: executing, fields: []}, {name: readingIdentity, fields: []}, {name: readingRecord, fields: []}, {name: journaling, fields: []}, {name: ready, fields: []}, {name: sealing, fields: []}, {name: ended, fields: []}, {name: blocked, fields: []}] +} +structure{ + name: State, + type_parameters: [], + parameters: [], + fields: [{name: config, type: Config}, {name: execution, type: (Option ResearchExecution::State)}, {name: journal, type: (Option ResearchJournal::State)}, {name: operation, type: Operation}, {name: phase, type: Phase}, {name: expected, type: Bytes}, {name: generation, type: Nat}, {name: quarantined, type: (List Nat)}, {name: cancelled, type: Bool}] +} +inductive{ + name: Event, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Event]}, {name: cancel, fields: []}, {name: seal, fields: []}] +} +inductive{ + name: Emission, + type_parameters: [], + parameters: [], + constructors: [{name: host, fields: [LexLeanStd.Host::Request]}, {name: awaiting, fields: []}, {name: ready, fields: [ResearchPortfolioInput::Config, Bytes]}, {name: sealed, fields: [Bytes]}, {name: cut, fields: []}, {name: blocked, fields: [String]}] +} +definition{ + name: key, + parameters: [], + result: Bytes, + body: 0x62653136636361356531343432383761336161643631393539373263663139376239323430613836383437616663656233626264663561643331346566306463, + executable: true +} +definition{ + name: blocked, + parameters: [state : State, reason : String], + result: (State * Emission), + body: ((record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (ctor Phase.blocked), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}), (ctor Emission.blocked reason)), + executable: true +} +definition{ + name: cut, + parameters: [state : State], + result: (State * Emission), + body: ((record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (ctor Phase.ended), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}), (ctor Emission.cut)), + executable: true +} +definition{ + name: workspace, + parameters: [config : Config], + result: ResearchWorkspace::Config, + body: (project (project (project config portfolio) base) workspace), + executable: true +} +definition{ + name: storage, + parameters: [config : Config], + result: ResearchEvidence::Config, + body: (let base : ResearchWorkspace::Config := (workspace config); (record ResearchEvidence::Config {request := (project base request), repository := (Host::textOf (project base repository)), recordPath := (project config recordPath), environment := (project base environment), output := (project base output), errors := (project base errors), maxBytes := 8388608, maxSteps := 16777216, allowance := (project base allowance), quantum := (project base quantum), polls := (project base polls), revision := (project base revision)})), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: journalConfig, + parameters: [state : State], + result: ResearchJournal::Config, + body: (record ResearchJournal::Config {storage := (storage (project state config)), key := (key), expected := (project state expected)}), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: resequenced, + parameters: [request : Research::Request, serial : Nat], + result: Research::Request, + body: (record Research::Request {serial := serial, snapshot := (project request snapshot), task := (project request task)}), + executable: true +} +definition{ + name: generationLog, + parameters: [path : String, generation : Nat], + result: String, + body: (ResearchVerification::concat path (ResearchVerification::concat ".generation-" (Host::textOf (Hypotheses::decimal generation)))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: resumed, + parameters: [state : State], + result: ResearchPortfolioInput::Config, + body: (let input : ResearchPortfolioInput::Config := (project (project state config) portfolio); (let base : ResearchProject::Config := (project input base); (let owner : ResearchWorkspace::Config := (project base workspace); (let serial : Nat := (prim multiply (project state generation) 128 : Nat); (let research : Research::State := (project input research); (record ResearchPortfolioInput::Config {research := (record Research::State {snapshot := (project research snapshot), components := (project research components), tasks := (project research tasks), pending := (ctor Option.none [Research::Request]), next := (serial + 1), history := (nil Research::Answer)}), base := (record ResearchProject::Config {request := (resequenced (project base request) serial), workspace := (record ResearchWorkspace::Config {request := (resequenced (project owner request) serial), repository := (project owner repository), revision := (project owner revision), environment := (project owner environment), output := (generationLog (project owner output) (project state generation)), errors := (generationLog (project owner errors) (project state generation)), allowance := (project owner allowance), quantum := (project owner quantum), polls := (project owner polls)}), tools := (project base tools), arena := (project base arena), proof := (project base proof), imports := (project base imports), levels := (project base levels), axioms := (project base axioms), maxBytes := (project base maxBytes), maxDepth := (project base maxDepth), maxSteps := (project base maxSteps)}), budget := (project input budget)})))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: numbers, + parameters: [values : (List Nat)], + result: (List Json::Value), + body: (match values | List.nil => (nil Json::Value) | List.cons head tail => (cons (CoreBinding::number head) (numbers tail))), + recursive_argument: values, + executable: true +} +definition{ + name: intent, + parameters: [state : State, sealed : Bool], + result: Json::Value, + body: (ctor Json::Value.object (cons (0x7265706f7369746f7279, (ctor Json::Value.string (project (workspace (project state config)) repository))) (cons (0x73706563, (ctor Json::Value.string 0x7233302f636f6e74726f6c6c65722d67656e65726174696f6e2f31)) (cons (0x67656e65726174696f6e, (CoreBinding::number (project state generation))) (cons (0x737461747573, (ctor Json::Value.string (if sealed then 0x66696e6973686564 else 0x616374697665))) (cons (0x71756172616e74696e6564, (ctor Json::Value.array (numbers (project state quarantined)))) (nil (Bytes * Json::Value)))))))), + executable: true +} +definition{ + name: quarantines, + parameters: [values : (List Json::Value), previous : Nat, generation : Nat], + result: (Option (List Nat)), + body: (match values | List.nil => (ctor Option.some [(List Nat)] (nil Nat)) | List.cons head tail => (match (Json::natural head 1000000000000) | Option.none => (ctor Option.none [(List Nat)]) | Option.some serial => (if ((previous (ctor Option.none [(List Nat)]) | Option.some rest => (ctor Option.some [(List Nat)] (cons serial rest))) else (ctor Option.none [(List Nat)])))), + recursive_argument: values, + executable: true +} +definition{ + name: envelopeIdentities, + parameters: [value : Json::Value], + result: Bool, + body: (match (CoreBinding::get value 0x7265766973696f6e) | Json::Value.string revision => ((ResearchWorkspace::objectId revision) && (match (CoreBinding::get value 0x7072656465636573736f72) | Json::Value.string predecessor => (((prim length predecessor : Nat) =? 0) || (ResearchWorkspace::objectId predecessor)) | Json::Value.null => false | Json::Value.boolean flag => false | Json::Value.number number => false | Json::Value.array items => false | Json::Value.object fields => false)) | Json::Value.null => false | Json::Value.boolean flag => false | Json::Value.number number => false | Json::Value.array items => false | Json::Value.object fields => false), + axioms: [propext], + executable: true +} +definition{ + name: ledger, + parameters: [value : Json::Value], + result: (Option (Nat * (List Nat))), + body: (if ((envelopeIdentities value) && ((CoreNotation::shape value (cons 0x73706563 (cons 0x6b6579 (cons 0x7072656465636573736f72 (cons 0x7265766973696f6e (cons 0x696e74656e74 (nil Bytes))))))) && ((ResearchInput::stringIs (CoreBinding::get value 0x73706563) 0x7233302f72657365617263682d6a6f75726e616c2f31) && (ResearchInput::stringIs (CoreBinding::get value 0x6b6579) (key))))) then (let recordedIntent : Json::Value := (CoreBinding::get value 0x696e74656e74); (if ((CoreNotation::shape recordedIntent (cons 0x7265706f7369746f7279 (cons 0x73706563 (cons 0x67656e65726174696f6e (cons 0x737461747573 (cons 0x71756172616e74696e6564 (nil Bytes))))))) && ((ResearchInput::stringIs (CoreBinding::get recordedIntent 0x73706563) 0x7233302f636f6e74726f6c6c65722d67656e65726174696f6e2f31) && ((ResearchInput::stringIs (CoreBinding::get recordedIntent 0x737461747573) 0x616374697665) || (ResearchInput::stringIs (CoreBinding::get recordedIntent 0x737461747573) 0x66696e6973686564)))) then (match (Json::natural (CoreBinding::get recordedIntent 0x67656e65726174696f6e) 999999999999) | Option.none => (ctor Option.none [(Nat * (List Nat))]) | Option.some generation => (if (0 (ctor Option.none [(Nat * (List Nat))]) | Option.some values => (if ((prim length values : Nat) <=? 8) then (match (quarantines values 0 generation) | Option.none => (ctor Option.none [(Nat * (List Nat))]) | Option.some previous => (ctor Option.some [(Nat * (List Nat))] ((generation + 1), (if (ResearchInput::stringIs (CoreBinding::get recordedIntent 0x737461747573) 0x616374697665) then (prim append previous (cons generation (nil Nat)) : (List Nat)) else previous)))) else (ctor Option.none [(Nat * (List Nat))]))) else (ctor Option.none [(Nat * (List Nat))]))) else (ctor Option.none [(Nat * (List Nat))]))) else (ctor Option.none [(Nat * (List Nat))])), + axioms: [propext], + executable: true +} +definition{ + name: journalResult, + parameters: [state : State, result : (ResearchJournal::State * ResearchJournal::Emission)], + result: (State * Emission), + body: (let next : State := (record State {config := (project state config), execution := (project state execution), journal := (ctor Option.some [ResearchJournal::State] (first result)), operation := (project state operation), phase := (project state phase), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}); (match (second result) | ResearchJournal::Emission.host request => (next, (ctor Emission.host request)) | ResearchJournal::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchJournal::Emission.failed reason => (blocked next reason) | ResearchJournal::Emission.blocked reason => (blocked next reason) | ResearchJournal::Emission.cut => (cut next) | ResearchJournal::Emission.committed identity => (if (project next cancelled) then (cut next) else (match (project next phase) | Phase.sealing => ((record State {config := (project next config), execution := (project next execution), journal := (project next journal), operation := (project next operation), phase := (ctor Phase.ended), expected := identity, generation := (project next generation), quarantined := (project next quarantined), cancelled := (project next cancelled)}), (ctor Emission.sealed identity)) | Phase.journaling => ((record State {config := (project next config), execution := (project next execution), journal := (project next journal), operation := (project next operation), phase := (ctor Phase.ready), expected := identity, generation := (project next generation), quarantined := (project next quarantined), cancelled := (project next cancelled)}), (ctor Emission.ready (resumed next) identity)) | Phase.executing => (blocked next "unexpected journal acknowledgement") | Phase.readingIdentity => (blocked next "unexpected journal acknowledgement") | Phase.readingRecord => (blocked next "unexpected journal acknowledgement") | Phase.ready => (blocked next "duplicate journal acknowledgement") | Phase.ended => (blocked next "late journal acknowledgement") | Phase.blocked => (blocked next "blocked journal acknowledgement"))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: acquire, + parameters: [state : State], + result: (State * Emission), + body: (if (project state cancelled) then (cut state) else (if ((prim length (project state quarantined) : Nat) <=? (project (project state config) maxQuarantined)) then (journalResult (record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (ctor Phase.journaling), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}) (ResearchJournal::begin (journalConfig state) (intent state false))) else (blocked state "quarantine budget exhausted; uncertain work remains retained"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: arguments, + parameters: [state : State], + result: (List String), + body: (match (project state operation) | Operation.identity => (cons "rev-parse" (cons "--verify" (cons "--quiet" (cons (ResearchJournal::reference (journalConfig state)) (nil String))))) | Operation.record => (cons "cat-file" (cons "blob" (cons (Host::textOf (project state expected)) (nil String))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: job, + parameters: [state : State], + result: ResearchExecution::Job, + body: (let config : ResearchEvidence::Config := (storage (project state config)); (record ResearchExecution::Job {request := (project config request), tool := (ctor ResearchExecution::Tool.git), arguments := (arguments state), directory := (project config repository), environment := (project config environment), output := (project config output), errors := (project config errors), allowance := (project config allowance), quantum := (project config quantum), polls := (project config polls)})), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: launch, + parameters: [state : State, operation : Operation], + result: (State * Emission), + body: (let next : State := (record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := operation, phase := (ctor Phase.executing), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}); (let result : (ResearchExecution::State * ResearchExecution::Emission) := (ResearchExecution::begin (job next)); (let owned : State := (record State {config := (project next config), execution := (ctor Option.some [ResearchExecution::State] (first result)), journal := (project next journal), operation := (project next operation), phase := (project next phase), expected := (project next expected), generation := (project next generation), quarantined := (project next quarantined), cancelled := (project next cancelled)}); (match (second result) | ResearchExecution::Emission.host request => (owned, (ctor Emission.host request)) | ResearchExecution::Emission.awaiting => (owned, (ctor Emission.awaiting)) | ResearchExecution::Emission.complete completion => (blocked owned "recovery lookup could not start"))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: completed, + parameters: [state : State, completion : ResearchExecution::Completion], + result: (State * Emission), + body: (if ((ResearchExecution::resumeAllowed completion) && (ResearchWorkspace::exitedNormally completion)) then (if (project state cancelled) then (cut state) else (match (project completion kind) | ResearchExecution::EndKind.succeeded => ((record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (match (project state operation) | Operation.identity => (ctor Phase.readingIdentity) | Operation.record => (ctor Phase.readingRecord)), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}), (ctor Emission.host (ctor LexLeanStd.Host::Request.read (project completion output)))) | ResearchExecution::EndKind.failed => (if ((match (project state operation) | Operation.identity => true | Operation.record => false) && (match (project completion code) | Option.none => false | Option.some code => (prim equal code (1 : Int32) : Bool))) then (acquire state) else (blocked state "recovery lookup failed")) | ResearchExecution::EndKind.cut => (cut state) | ResearchExecution::EndKind.unavailable => (blocked state "recovery lookup unavailable") | ResearchExecution::EndKind.protocol => (blocked state "recovery lookup protocol failure") | ResearchExecution::EndKind.cleanupFailed => (blocked state "recovery cleanup uncertain") | ResearchExecution::EndKind.refused => (blocked state "recovery lookup refused"))) else (blocked state "recovery lookup outcome uncertain")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: executionResult, + parameters: [state : State, result : (ResearchExecution::State * ResearchExecution::Emission)], + result: (State * Emission), + body: (let next : State := (record State {config := (project state config), execution := (ctor Option.some [ResearchExecution::State] (first result)), journal := (project state journal), operation := (project state operation), phase := (project state phase), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}); (match (second result) | ResearchExecution::Emission.host request => (next, (ctor Emission.host request)) | ResearchExecution::Emission.awaiting => (next, (ctor Emission.awaiting)) | ResearchExecution::Emission.complete completion => (completed next completion))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: readIdentity, + parameters: [state : State, data : Bytes], + result: (State * Emission), + body: (let size : Nat := (prim length data : Nat); (if ((size =? 41) || (size =? 65)) then (let identity : Bytes := (Toml::sliceOr data 0 (prim subtract size 1 : Nat)); (if ((ResearchWorkspace::objectId identity) && (Toml::byteIs data (prim subtract size 1 : Nat) (10 : UInt8))) then (launch (record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (project state phase), expected := identity, generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}) (ctor Operation.record)) else (blocked state "invalid controller journal identity"))) else (blocked state "invalid controller journal identity"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: readRecord, + parameters: [state : State, data : Bytes], + result: (State * Emission), + body: (match (Json::parse data 8388608 64) | Result.error error => (blocked state "invalid controller journal JSON") | Result.ok value => (if (ResearchInput::stringIs (CoreBinding::get (CoreBinding::get value 0x696e74656e74) 0x7265706f7369746f7279) (project (workspace (project state config)) repository)) then (match (ledger value) | Option.none => (blocked state "invalid controller generation") | Option.some generationData => (acquire (record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (project state phase), expected := (project state expected), generation := (first generationData), quarantined := (second generationData), cancelled := (project state cancelled)}))) else (blocked state "controller journal belongs to another repository path"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: read, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (Host::asRead event) | Option.none => (blocked state "unexpected recovery read event") | Option.some response => (if (project state cancelled) then (cut state) else (match response | Result.error error => (blocked state "recovery record read failed") | Result.ok data => (match (project state phase) | Phase.readingIdentity => (readIdentity state data) | Phase.readingRecord => (readRecord state data) | Phase.executing => (blocked state "unexpected recovery read") | Phase.journaling => (blocked state "unexpected recovery read") | Phase.ready => (blocked state "unexpected recovery read") | Phase.sealing => (blocked state "unexpected recovery read") | Phase.ended => (blocked state "unexpected recovery read") | Phase.blocked => (blocked state "unexpected recovery read"))))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: host, + parameters: [state : State, event : LexLeanStd.Host::Event], + result: (State * Emission), + body: (match (project state phase) | Phase.executing => (match (project state execution) | Option.none => (blocked state "missing recovery execution owner") | Option.some active => (executionResult state (ResearchExecution::step active event))) | Phase.readingIdentity => (read state event) | Phase.readingRecord => (read state event) | Phase.journaling => (match (project state journal) | Option.none => (blocked state "missing recovery journal owner") | Option.some active => (journalResult state (ResearchJournal::step active (ctor ResearchJournal::Event.host event)))) | Phase.sealing => (match (project state journal) | Option.none => (blocked state "missing recovery seal owner") | Option.some active => (journalResult state (ResearchJournal::step active (ctor ResearchJournal::Event.host event)))) | Phase.ready => (blocked state "recovery ready state has no pending host reply") | Phase.ended => (state, (ctor Emission.awaiting)) | Phase.blocked => (blocked state "recovery retains uncertain work")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: seal, + parameters: [state : State], + result: (State * Emission), + body: (match (project state phase) | Phase.ready => (if (project state cancelled) then (cut state) else (journalResult (record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (ctor Phase.sealing), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := (project state cancelled)}) (ResearchJournal::begin (journalConfig state) (intent state true)))) | Phase.executing => (blocked state "cannot seal active recovery lookup") | Phase.readingIdentity => (blocked state "cannot seal pending recovery read") | Phase.readingRecord => (blocked state "cannot seal pending recovery read") | Phase.journaling => (blocked state "cannot seal unacknowledged generation") | Phase.sealing => (state, (ctor Emission.awaiting)) | Phase.ended => (state, (ctor Emission.awaiting)) | Phase.blocked => (blocked state "cannot seal uncertain generation")), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: cancel, + parameters: [state : State], + result: (State * Emission), + body: (let next : State := (record State {config := (project state config), execution := (project state execution), journal := (project state journal), operation := (project state operation), phase := (project state phase), expected := (project state expected), generation := (project state generation), quarantined := (project state quarantined), cancelled := true}); (match (project state phase) | Phase.executing => (match (project state execution) | Option.none => (blocked next "missing recovery owner during cancellation") | Option.some active => (executionResult next (ResearchExecution::cancel active))) | Phase.journaling => (match (project state journal) | Option.none => (blocked next "missing recovery journal during cancellation") | Option.some active => (journalResult next (ResearchJournal::step active (ctor ResearchJournal::Event.cancel)))) | Phase.sealing => (match (project state journal) | Option.none => (blocked next "missing recovery seal during cancellation") | Option.some active => (journalResult next (ResearchJournal::step active (ctor ResearchJournal::Event.cancel)))) | Phase.readingIdentity => (next, (ctor Emission.awaiting)) | Phase.readingRecord => (next, (ctor Emission.awaiting)) | Phase.ready => (cut next) | Phase.ended => (next, (ctor Emission.awaiting)) | Phase.blocked => (blocked next "cancelled uncertain recovery remains retained"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: begin, + parameters: [config : Config], + result: (State * Emission), + body: (let state : State := (record State {config := config, execution := (ctor Option.none [ResearchExecution::State]), journal := (ctor Option.none [ResearchJournal::State]), operation := (ctor Operation.identity), phase := (ctor Phase.executing), expected := 0x, generation := 1, quarantined := (nil Nat), cancelled := false}); (if (((project config maxQuarantined) <=? 8) && ((ResearchWorkspace::valid (workspace config)) && (ResearchEvidence::valid (first (ResearchEvidence::begin (storage config) (ctor Json::Value.null)))))) then (launch state (ctor Operation.identity)) else (blocked state "invalid recovery configuration"))), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: step, + parameters: [state : State, event : Event], + result: (State * Emission), + body: (match event | Event.host reply => (host state reply) | Event.cancel => (cancel state) | Event.seal => (seal state)), + axioms: [Quot.sound, propext], + executable: true +} +definition{ + name: contract, + parameters: [], + result: String, + body: "Allocate a monotone controller generation by an owned exact-predecessor journal exchange before dispatch. Read the current journal through owned Git processes, reserve fresh workspace and candidate serials, and retain earlier active generations in a bounded quarantine. Never resume an uncertain workspace or signal a stored PID. A sealed generation records that the enclosing owner has completed cleanup; its event is internal, not a public receipt input. Records do not establish proof acceptance. Generations isolate workspace ownership rather than confer an exclusive publication lease. Publication must revalidate its exact source snapshot and exchange the source branch against that predecessor; a stale source revision cannot publish. This component never reclaims uncertain resources or promotes stored results.", + executable: true +} +definition{ + name: features, + parameters: [], + result: (List String), + body: (cons "owned-journal-lookup" (cons "exact-predecessor-generation-reservation" (cons "structural-journal-identity-validation" (cons "fresh-generation-workspace-serials" (cons "generation-specific-log-paths" (cons "repository-bound-restart" (cons "bounded-uncertain-generation-quarantine" (cons "no-stale-pid-signalling" (cons "cleanup-before-sealing" (cons "drain-cancellation-before-recovery-outcome" (nil String))))))))))), + executable: true +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchRecoveryTraces.lex.tex b/rule30-api/src/ResearchRecoveryTraces.lex.tex new file mode 100644 index 0000000..c658015 --- /dev/null +++ b/rule30-api/src/ResearchRecoveryTraces.lex.tex @@ -0,0 +1,106 @@ +\begin{lexlean}{ResearchRecoveryTraces} +\useglossary{lexlean.std.bool@1.2.0} +\useglossary{lexlean.std.nat@1.2.0} +\importmodule{ResearchRecovery} +\importmodule{ResearchJournal} +\importmodule{ResearchPortfolioInput} +\importmodule{ResearchProject} +\importmodule{ResearchWorkspace} +\importmodule{Research} +\importmodule{CoreBinding} +\importmodule{Json} +\importmodule{LexLeanStd.Host} +\importmodule{ResearchExecution} +\title{Boolean} +\begin{semanticmodule} +definition{ + name: document, + parameters: [generation : Nat, status : Bytes, quarantined : (List Nat)], + result: Json::Value, + body: (ctor Json::Value.object (cons (0x73706563, (ctor Json::Value.string 0x7233302f72657365617263682d6a6f75726e616c2f31)) (cons (0x6b6579, (ctor Json::Value.string (ResearchRecovery::key))) (cons (0x7072656465636573736f72, (ctor Json::Value.string 0x)) (cons (0x7265766973696f6e, (ctor Json::Value.string 0x61616161616161616161616161616161616161616161616161616161616161616161616161616161)) (cons (0x696e74656e74, (ctor Json::Value.object (cons (0x73706563, (ctor Json::Value.string 0x7233302f636f6e74726f6c6c65722d67656e65726174696f6e2f31)) (cons (0x67656e65726174696f6e, (CoreBinding::number generation)) (cons (0x737461747573, (ctor Json::Value.string status)) (cons (0x71756172616e74696e6564, (ctor Json::Value.array (ResearchRecovery::numbers quarantined))) (cons (0x7265706f7369746f7279, (ctor Json::Value.string 0x2f7265736561726368)) (nil (Bytes * Json::Value))))))))) (nil (Bytes * Json::Value)))))))) +} +theorem{ + name: interruptedGenerationAllocatesFreshWorkAndQuarantine, + parameters: [], + statement: ((ResearchRecovery::ledger (document 1 0x616374697665 (nil Nat))) = (ctor Option.some [(Nat * (List Nat))] (2, (cons 1 (nil Nat))))), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: finishedGenerationPreservesEarlierQuarantine, + parameters: [], + statement: ((ResearchRecovery::ledger (document 5 0x66696e6973686564 (cons 1 (cons 3 (nil Nat))))) = (ctor Option.some [(Nat * (List Nat))] (6, (cons 1 (cons 3 (nil Nat)))))), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: duplicateQuarantineEntriesAreRefused, + parameters: [], + statement: ((ResearchRecovery::ledger (document 5 0x616374697665 (cons 1 (cons 1 (nil Nat))))) = (ctor Option.none [(Nat * (List Nat))])), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: futureQuarantineGenerationIsRefused, + parameters: [], + statement: ((ResearchRecovery::ledger (document 5 0x616374697665 (cons 5 (nil Nat)))) = (ctor Option.none [(Nat * (List Nat))])), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: unknownLifecycleStatusIsRefused, + parameters: [], + statement: ((ResearchRecovery::ledger (document 5 0x70726f766564 (nil Nat))) = (ctor Option.none [(Nat * (List Nat))])), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: generationBoundPreventsSerialOverflow, + parameters: [], + statement: ((ResearchRecovery::ledger (document 1000000000000 0x66696e6973686564 (nil Nat))) = (ctor Option.none [(Nat * (List Nat))])), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: freshWorkspaceSerialComesFromOwnedGeneration, + parameters: [state : ResearchRecovery::State], + statement: ((project (project (project (project (ResearchRecovery::resumed state) base) workspace) request) serial) = (prim multiply (project state generation) 128 : Nat)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +theorem{ + name: attemptSerialStartsBeyondLibraryReservation, + parameters: [state : ResearchRecovery::State], + statement: ((project (project (ResearchRecovery::resumed state) research) next) = ((prim multiply (project state generation) 128 : Nat) + 1)), + proof: reflexivity{}, + axioms: [Quot.sound, propext] +} +definition{ + name: identities, + parameters: [predecessor : Json::Value, revision : Json::Value], + result: Json::Value, + body: (ctor Json::Value.object (cons (0x7072656465636573736f72, predecessor) (cons (0x7265766973696f6e, revision) (nil (Bytes * Json::Value))))) +} +theorem{ + name: nonStringPredecessorCannotAcquireGeneration, + parameters: [], + statement: ((ResearchRecovery::envelopeIdentities (identities (ctor Json::Value.null) (ctor Json::Value.string 0x61616161616161616161616161616161616161616161616161616161616161616161616161616161))) = false), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: malformedPinnedRevisionCannotAcquireGeneration, + parameters: [], + statement: ((ResearchRecovery::envelopeIdentities (identities (ctor Json::Value.string 0x) (ctor Json::Value.string 0x6d61696e))) = false), + proof: decide{}, + axioms: [propext] +} +theorem{ + name: malformedPredecessorCannotAcquireGeneration, + parameters: [], + statement: ((ResearchRecovery::envelopeIdentities (identities (ctor Json::Value.string 0x6e6f742d616e2d6f626a656374) (ctor Json::Value.string 0x61616161616161616161616161616161616161616161616161616161616161616161616161616161))) = false), + proof: decide{}, + axioms: [propext] +} +\end{semanticmodule} +\end{lexlean} diff --git a/rule30-api/src/ResearchTraces.lex.tex b/rule30-api/src/ResearchTraces.lex.tex index 8bc994a..7f206f3 100644 --- a/rule30-api/src/ResearchTraces.lex.tex +++ b/rule30-api/src/ResearchTraces.lex.tex @@ -345,7 +345,7 @@ theorem{ name: everyApplicationAndLibraryModuleGetsOneMaintenanceTask, parameters: [], - statement: ((prim length (ResearchCatalog::maintenanceTasks (ResearchCatalog::registeredScopes)) : Nat) = 146), + statement: ((prim length (ResearchCatalog::maintenanceTasks (ResearchCatalog::registeredScopes)) : Nat) = 166), proof: decide{} } definition{ diff --git a/rule30-api/src/Standards.lex.tex b/rule30-api/src/Standards.lex.tex index aec3e17..cfbea87 100644 --- a/rule30-api/src/Standards.lex.tex +++ b/rule30-api/src/Standards.lex.tex @@ -26,7 +26,7 @@ name: standards, parameters: [], result: (List Standard), - body: (cons (record Standard {id := "iso-42010", name := "ISO/IEC/IEEE 42010:2022, Architecture description", authority := "https://www.iso.org/standard/74393.html", version := "2022", scope := "Stakeholders, concerns, viewpoints and views of the proof effort on Foundation.Arch; every panel of the site is governed by a viewpoint.", realizedBy := (cons "Architecture" (cons "architecture-module" (cons "Presentation" (nil String)))), conformance := "bin/r30 verify api: everyConcernFramed, viewpointsFrameHeldConcerns, everyViewpointGovernsAView (Architecture), panelsGovernedByViewpoints (Presentation)", coverage := "implemented"}) (cons (record Standard {id := "iso-25010", name := "ISO/IEC 25010:2023, Product quality model", authority := "https://www.iso.org/standard/78176.html", version := "2023", scope := "What an optimal implementation is here: characteristics, subcharacteristics, requirements and measures with thresholds on Foundation.Qual, each measure naming the command that reports it.", realizedBy := (cons "Architecture" (cons "quality" (cons "architecture-module" (cons "api_check" (cons "check" (cons "choice_audit" (cons "frontier_check" (cons "gate" (cons "verify" (cons "view_render" (nil String))))))))))), conformance := "bin/r30 verify api: everyRequirementMeasured, everyMeasureCommandExists (Architecture), publicationWithinBudget (Application)", coverage := "implemented"}) (cons (record Standard {id := "wcag-2.2", name := "W3C WCAG 2.2, Web Content Accessibility Guidelines", authority := "https://www.w3.org/TR/WCAG22/", version := "2.2 (Recommendation, 2023-10-05)", scope := "The site at level AA: 4.5:1 text contrast in both themes, one visible focus ring, a skip link, reduced motion honoured, keyboard operation of every control and step.", realizedBy := (cons "site" (cons "picture" (cons "explainer" (cons "reduction-tree" (cons "register" (cons "open-leaves" (cons "paper" (cons "obligation" (cons "refutations" (cons "interface-sheets" (cons "modules" (cons "quality" (cons "sitemap" (cons "verify" (cons "standards" (cons "model" (cons "design" (cons "viz-triangle" (cons "viz-tower" (cons "viz-ledger" (cons "viz-rays" (cons "viz-defects" (cons "viz-dyadic" (cons "nav-primary" (cons "nav-breadcrumb" (cons "nav-stepper" (nil String))))))))))))))))))))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.AccessibilityTests (contrast measured from the stylesheet, landmarks, focus, motion, keyboard)", coverage := "implemented"}) (cons (record Standard {id := "wai-aria-1.2", name := "W3C WAI-ARIA 1.2 and the ARIA Authoring Practices Guide", authority := "https://www.w3.org/TR/wai-aria-1.2/", version := "1.2 (Recommendation, 2023-06-06); APG patterns", scope := "The navigation of the site: the primary navigation, the breadcrumb and the stepper follow the APG patterns (roles, aria-current, arrow keys), the status region is live.", realizedBy := (cons "site" (cons "nav-primary" (cons "nav-breadcrumb" (cons "nav-stepper" (nil String))))), conformance := "python3 -m unittest scripts.tests.test_r30.AccessibilityTests (role, aria-current, aria-pressed, role=status, arrow keys)", coverage := "implemented"}) (cons (record Standard {id := "html-living-standard", name := "WHATWG HTML Living Standard", authority := "https://html.spec.whatwg.org/multipage/", version := "living standard", scope := "The page's landmarks (header, nav, main, footer), the one-document site with its data in a JSON script element and its metadata in the head.", realizedBy := (cons "site" (cons "nav-primary" (cons "nav-breadcrumb" (cons "nav-stepper" (nil String))))), conformance := "python3 -m unittest scripts.tests.test_r30.AccessibilityTests.test_landmarks_focus_motion_and_keyboard", coverage := "implemented"}) (cons (record Standard {id := "svg-2", name := "W3C SVG 2", authority := "https://www.w3.org/TR/SVG2/", version := "2 (Candidate Recommendation, 2018-10-04)", scope := "The Rule 30 picture, the logo and the visualizations are SVG documents with a title and a description, crisp cells, colours from the page's tokens.", realizedBy := (cons "picture" (cons "logo" (cons "viz-triangle" (cons "viz-tower" (cons "viz-ledger" (cons "viz-rays" (cons "viz-defects" (cons "viz-dyadic" (nil String))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.SiteTests.test_rule30_rows_and_logo (parsed as SVG, no script)", coverage := "implemented"}) (cons (record Standard {id := "wai-aria-graphics-1.0", name := "W3C WAI-ARIA Graphics Module 1.0", authority := "https://www.w3.org/TR/graphics-aria-1.0/", version := "1.0 (Recommendation, 2018-10-02)", scope := "Every drawing carries role=img with aria-labelledby pointing at its title and description; the interactive visualizations use graphics-document and graphics-symbol.", realizedBy := (cons "picture" (cons "logo" (cons "viz-triangle" (cons "viz-tower" (cons "viz-ledger" (cons "viz-rays" (cons "viz-defects" (cons "viz-dyadic" (nil String))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.SiteTests.test_statements_picture_and_explainer_artifacts (role=img, aria-labelledby)", coverage := "implemented"}) (cons (record Standard {id := "schema-org", name := "schema.org vocabulary (JSON-LD)", authority := "https://schema.org/", version := "current release (https://schema.org/docs/releases.html)", scope := "A LearningResource for every pedagogical step of every journey, the paper as ScholarlyArticle, the repository as SoftwareSourceCode, the register as Dataset, embedded in the page and published as schema.json.", realizedBy := (cons "jsonld" (cons "site" (cons "paper-pdf" (cons "register-json" (cons "readme" (cons "prize-review" (cons "research-session" (cons "reading" (cons "stdlib-feedback" (cons "mathematics" (cons "first-visit" (nil String)))))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_schema_org_describes_every_step_the_paper_the_repository_and_the_register", coverage := "implemented"}) (cons (record Standard {id := "json-ld-1.1", name := "W3C JSON-LD 1.1", authority := "https://www.w3.org/TR/json-ld11/", version := "1.1 (Recommendation, 2020-07-16)", scope := "The serialization of the schema.org and PROV-O graphs: a @context, a @graph, ids under the published URL.", realizedBy := (cons "jsonld" (cons "provenance" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests (both documents parse and carry @context and @graph)", coverage := "implemented"}) (cons (record Standard {id := "prov-o", name := "W3C PROV-O, the PROV Ontology", authority := "https://www.w3.org/TR/prov-o/", version := "Recommendation, 2013-04-30", scope := "Provenance of every claim: a proved claim prov:wasDerivedFrom its Lean theorem and prov:wasAttributedTo the Lean kernel, attested by the paper's LexLean attestation and the module's kappa-label; the view prov:wasGeneratedBy the render of this commit under the view workflow.", realizedBy := (cons "provenance" (cons "view-workflow" (cons "view_render" (cons "frontier_check" (cons "kappa" (cons "verify" (nil String))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_provenance_derives_every_proved_claim_from_its_theorem", coverage := "implemented"}) (cons (record Standard {id := "json-schema-2020-12", name := "JSON Schema 2020-12", authority := "https://json-schema.org/draft/2020-12/schema", version := "2020-12", scope := "The closed schemas of register.json, the interface sheets, standards.json and the --json reports (rule30-api/schemas), validated by the tests and referenced from openapi.json.", realizedBy := (cons "register-json" (cons "standards" (cons "openapi" (cons "api_check" (cons "api_production" (cons "brief" (cons "chain" (cons "claim" (cons "deduce" (cons "discover" (cons "engine_prune" (cons "engine_status" (cons "engine_tick" (cons "frontier_list" (cons "interface" (cons "kappa" (cons "sequences" (cons "status" (nil String))))))))))))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.ResultSchemaTests; bin/r30 api check", coverage := "implemented"}) (cons (record Standard {id := "openapi-3.1", name := "OpenAPI Specification 3.1", authority := "https://spec.openapis.org/oas/v3.1.1", version := "3.1.1 (2024-10-24)", scope := "The r30 command surface as an API description: one path per command of the parser, its arguments as parameters, its responses from the result schemas, the same leaves as Api.lex.tex and the MCP tools.", realizedBy := (prim append (cons "openapi" (cons "status" (cons "brief" (cons "chain" (cons "api_sync" (cons "api_check" (cons "api_production" (cons "view_render" (cons "interface" (cons "claim" (cons "audit" (cons "gate" (cons "lexicon_search" (cons "lexicon_show" (cons "lexicon_packages" (cons "sig" (cons "mentions" (cons "theorem_preview" (cons "theorem_add" (cons "theorem_remove" (cons "define" (cons "check" (cons "unpublished" (cons "selfcheck" (cons "verify" (cons "probe" (cons "axioms" (cons "choice_audit" (cons "frontier_list" (cons "frontier_add" (cons "frontier_set" (cons "frontier_check" (cons "frontier_render" (cons "commit" (cons "module_list" (cons "module_add" (cons "module_build" (cons "consolidate" (cons "kappa" (cons "sequences" (nil String))))))))))))))))))))))))))))))))))))))))) (cons "discover" (cons "deduce" (cons "engine_tick" (cons "engine_status" (cons "engine_hypotheses" (cons "engine_prune" (cons "experiment_list" (cons "experiment_run" (nil String))))))))) : (List String)), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_openapi_describes_the_command_surface; bin/r30 api check (Api.lex.tex)", coverage := "implemented"}) (cons (record Standard {id := "gherkin", name := "Gherkin (Cucumber reference)", authority := "https://cucumber.io/docs/gherkin/reference/", version := "Gherkin reference (current)", scope := "One scenario per conformance id in features/suites, tagged with the id and its honesty level, generated with the registers.", realizedBy := (cons "api_sync" (cons "api_check" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.ConformanceTests; bin/r30 api check", coverage := "implemented"}) (cons (record Standard {id := "citation-cff", name := "Citation File Format 1.2.0", authority := "https://citation-file-format.github.io/", version := "1.2.0", scope := "CITATION.cff at the repository root (and copied into the view): the author, the title of the paper, the repository and the published view.", realizedBy := (cons "citation" (cons "readme" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_citation_file_names_the_author_the_title_and_the_repository", coverage := "implemented"}) (cons (record Standard {id := "spdx", name := "SPDX License Expressions (SPDX 2.3, ISO/IEC 5962:2021)", authority := "https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/", version := "2.3", scope := "License identifiers of the vendored sources: the repository is MIT (LICENSE at the root, `license: MIT` in CITATION.cff); the prism-stdlib register carries the SPDX expression of its vendored license files.", realizedBy := (cons "stdlib-package" (cons "citation" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_spdx_expressions_are_well_formed", coverage := "implemented"}) (cons (record Standard {id := "sitemap-protocol", name := "Sitemaps XML protocol 0.9", authority := "https://www.sitemaps.org/protocol.html", version := "0.9", scope := "sitemap.xml: the page and the deep link of every step of every journey; robots.txt names the sitemap.", realizedBy := (cons "sitemap" (cons "robots" (cons "site" (cons "prize-review" (cons "research-session" (cons "reading" (cons "stdlib-feedback" (cons "mathematics" (cons "first-visit" (nil String)))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_sitemap_lists_every_step_deep_link", coverage := "implemented"}) (cons (record Standard {id := "open-graph", name := "The Open Graph protocol", authority := "https://ogp.me/", version := "ogp.me (2014-10)", scope := "og:title, og:type, og:url, og:description and og:image in the page's head, injected with the JSON-LD at render.", realizedBy := (cons "site" (cons "logo" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_site_head_carries_json_ld_and_open_graph", coverage := "implemented"}) (cons (record Standard {id := "rfc-8785", name := "RFC 8785, JSON Canonicalization Scheme (JCS)", authority := "https://www.rfc-editor.org/rfc/rfc8785", version := "2020-06", scope := "The identity of the published JSON contracts (sha256-canonical-json in contracts.toml) and the canonical JSON of the LexLean attestations; uor-addr labels JSON under JCS.", realizedBy := (cons "register-json" (cons "statements" (cons "kappa" (nil String)))), conformance := "python3 -m unittest scripts.tests.test_kappa (the no-prefix rule on the JCS vector)", coverage := "implemented"}) (cons (record Standard {id := "rivest-csexp", name := "Rivest, S-Expressions (canonical form, section 4.3)", authority := "https://people.csail.mit.edu/rivest/Sexp.txt", version := "draft-rivest-sexp-00, 1997-05-04", scope := "The kappa-label of a research module: the SHA-256 of the canonical S-expression of the declarations the kernel replays, as UOR-Foundation/uor-addr mints labels; the key of the replay receipts. The same canonical form labels the sequences of the basis, (sequence ), their transforms and the relations the discovery engines find, (relation ).", realizedBy := (cons "kappa" (cons "provenance" (cons "sequences" (cons "discover" (cons "Sequences" (cons "Discovery" (nil String))))))), conformance := "python3 -m unittest scripts.tests.test_kappa; bin/r30 kappa ; bin/r30 api check (sequences)", coverage := "implemented"}) (cons (record Standard {id := "in-toto-statement-v1", name := "in-toto Attestation Framework, Statement v1", authority := "https://github.com/in-toto/attestation/blob/main/spec/v1/statement.md", version := "v1", scope := "attestations.intoto.json: a Statement whose subjects are the attested PDFs and the paper's sources with their SHA-256 digests and whose predicate is the paper's LexLean attestation.", realizedBy := (cons "attestations" (cons "pdf-manifest" (cons "verify" (cons "paper-pdf" (cons "observations-pdf" (cons "core-pdf" (nil String))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_in_toto_statement_subjects_are_the_attested_documents", coverage := "implemented"}) (cons (record Standard {id := "oci-distribution", name := "OCI Distribution Specification", authority := "https://github.com/opencontainers/distribution-spec/blob/main/spec.md", version := "1.1.0 (2024-02)", scope := "Planned: a kappa-registry serving the replay receipts and certified bundles by content address; today only the kappa-labels that would address them exist.", realizedBy := (cons "kappa" (nil String)), conformance := "bin/r30 kappa (the labels); no registry runs yet", coverage := "planned"}) (cons (record Standard {id := "iana-media-types", name := "IANA Media Types (RFC 6838)", authority := "https://www.iana.org/assignments/media-types/", version := "RFC 6838 (2013-01)", scope := "Every published artifact declares its media type in Presentation.lex.tex; the contracts register declares the vendor types of the JSON reports.", realizedBy := (prim append (cons "chain" (cons "register-json" (cons "register-text" (cons "frontier" (cons "interfaces" (cons "statements" (cons "explainer" (cons "picture" (cons "paper-pdf" (cons "observations-pdf" (cons "core-pdf" (cons "pdf-manifest" (cons "api-module" (cons "register-module" (cons "architecture-module" (cons "presentation-module" (cons "application-module" (cons "core-vectors" (cons "frontier-module" (cons "agents" (cons "round-workflow" (cons "strategy" (cons "readme" (cons "logo" (cons "standards" (cons "standards-module" (cons "openapi" (cons "sitemap" (cons "robots" (cons "provenance" (cons "jsonld" (cons "attestations" (cons "citation" (cons "observer-module" (cons "tokens" (cons "site" (cons "viz-core-js" (cons "viz-triangle-js" (cons "viz-tower-js" (cons "viz-ledger-js" (nil String))))))))))))))))))))))))))))))))))))))))) (cons "viz-rays-js" (cons "viz-defects-js" (cons "viz-dyadic-js" (nil String)))) : (List String)), conformance := "bin/r30 verify api: artifactPathsDistinct, panelsReadArtifacts (Presentation); python3 -m unittest scripts.tests.test_r30.StandardsTests", coverage := "implemented"}) (cons (record Standard {id := "lean-4", name := "Lean 4 (the kernel)", authority := "https://github.com/leanprover/lean4", version := "leanprover/lean4:v4.32.1", scope := "Every proved claim names a theorem the Lean kernel checked under propext and Quot.sound; the research modules are kernel-replayed with leanchecker.", realizedBy := (cons "Register" (cons "axioms" (cons "choice_audit" (cons "frontier_check" (cons "kappa" (cons "module_build" (nil String))))))), conformance := "bin/r30 frontier check; bin/r30 axioms ; bin/r30 choice-audit", coverage := "implemented"}) (cons (record Standard {id := "lexlean", name := "UOR-Foundation/LexLean (closed-lexicon LaTeX to Lean 4)", authority := "https://github.com/UOR-Foundation/LexLean", version := "0.4.0, language 1.2, compiler semantics 601e9f4a1824", scope := "The authoring surface: the paper, the register and these API modules are LexLean modules verified by lexlean; the production roots export to certified Rust.", realizedBy := (cons "Api" (cons "Register" (cons "Architecture" (cons "Presentation" (cons "Application" (cons "Observer" (cons "Convert" (cons "Standards" (cons "Rule30Core" (cons "Sequences" (cons "Discovery" (cons "verify" (cons "check" (cons "api_sync" (cons "api_check" (cons "api_production" (nil String))))))))))))))))), conformance := "bin/r30 verify api; bin/r30 check api; bin/r30 api check", coverage := "implemented"}) (nil Standard))))))))))))))))))))))))), + body: (cons (record Standard {id := "iso-42010", name := "ISO/IEC/IEEE 42010:2022, Architecture description", authority := "https://www.iso.org/standard/74393.html", version := "2022", scope := "Stakeholders, concerns, viewpoints and views of the proof effort on Foundation.Arch; every panel of the site is governed by a viewpoint.", realizedBy := (cons "Architecture" (cons "architecture-module" (cons "Presentation" (nil String)))), conformance := "bin/r30 verify api: everyConcernFramed, viewpointsFrameHeldConcerns, everyViewpointGovernsAView (Architecture), panelsGovernedByViewpoints (Presentation)", coverage := "implemented"}) (cons (record Standard {id := "iso-25010", name := "ISO/IEC 25010:2023, Product quality model", authority := "https://www.iso.org/standard/78176.html", version := "2023", scope := "What an optimal implementation is here: characteristics, subcharacteristics, requirements and measures with thresholds on Foundation.Qual, each measure naming the command that reports it.", realizedBy := (cons "Architecture" (cons "quality" (cons "architecture-module" (cons "api_check" (cons "check" (cons "choice_audit" (cons "frontier_check" (cons "gate" (cons "verify" (cons "view_render" (nil String))))))))))), conformance := "bin/r30 verify api: everyRequirementMeasured, everyMeasureCommandExists (Architecture), publicationWithinBudget (Application)", coverage := "implemented"}) (cons (record Standard {id := "wcag-2.2", name := "W3C WCAG 2.2, Web Content Accessibility Guidelines", authority := "https://www.w3.org/TR/WCAG22/", version := "2.2 (Recommendation, 2023-10-05)", scope := "The site at level AA: 4.5:1 text contrast in both themes, one visible focus ring, a skip link, reduced motion honoured, keyboard operation of every control and step.", realizedBy := (cons "site" (cons "picture" (cons "explainer" (cons "reduction-tree" (cons "register" (cons "open-leaves" (cons "paper" (cons "obligation" (cons "refutations" (cons "interface-sheets" (cons "modules" (cons "quality" (cons "sitemap" (cons "verify" (cons "standards" (cons "model" (cons "design" (cons "viz-triangle" (cons "viz-tower" (cons "viz-ledger" (cons "viz-rays" (cons "viz-defects" (cons "viz-dyadic" (cons "nav-primary" (cons "nav-breadcrumb" (cons "nav-stepper" (nil String))))))))))))))))))))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.AccessibilityTests (contrast measured from the stylesheet, landmarks, focus, motion, keyboard)", coverage := "implemented"}) (cons (record Standard {id := "wai-aria-1.2", name := "W3C WAI-ARIA 1.2 and the ARIA Authoring Practices Guide", authority := "https://www.w3.org/TR/wai-aria-1.2/", version := "1.2 (Recommendation, 2023-06-06); APG patterns", scope := "The navigation of the site: the primary navigation, the breadcrumb and the stepper follow the APG patterns (roles, aria-current, arrow keys), the status region is live.", realizedBy := (cons "site" (cons "nav-primary" (cons "nav-breadcrumb" (cons "nav-stepper" (nil String))))), conformance := "python3 -m unittest scripts.tests.test_r30.AccessibilityTests (role, aria-current, aria-pressed, role=status, arrow keys)", coverage := "implemented"}) (cons (record Standard {id := "html-living-standard", name := "WHATWG HTML Living Standard", authority := "https://html.spec.whatwg.org/multipage/", version := "living standard", scope := "The page's landmarks (header, nav, main, footer), the one-document site with its data in a JSON script element and its metadata in the head.", realizedBy := (cons "site" (cons "nav-primary" (cons "nav-breadcrumb" (cons "nav-stepper" (nil String))))), conformance := "python3 -m unittest scripts.tests.test_r30.AccessibilityTests.test_landmarks_focus_motion_and_keyboard", coverage := "implemented"}) (cons (record Standard {id := "svg-2", name := "W3C SVG 2", authority := "https://www.w3.org/TR/SVG2/", version := "2 (Candidate Recommendation, 2018-10-04)", scope := "The Rule 30 picture, the logo and the visualizations are SVG documents with a title and a description, crisp cells, colours from the page's tokens.", realizedBy := (cons "picture" (cons "logo" (cons "viz-triangle" (cons "viz-tower" (cons "viz-ledger" (cons "viz-rays" (cons "viz-defects" (cons "viz-dyadic" (nil String))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.SiteTests.test_rule30_rows_and_logo (parsed as SVG, no script)", coverage := "implemented"}) (cons (record Standard {id := "wai-aria-graphics-1.0", name := "W3C WAI-ARIA Graphics Module 1.0", authority := "https://www.w3.org/TR/graphics-aria-1.0/", version := "1.0 (Recommendation, 2018-10-02)", scope := "Every drawing carries role=img with aria-labelledby pointing at its title and description; the interactive visualizations use graphics-document and graphics-symbol.", realizedBy := (cons "picture" (cons "logo" (cons "viz-triangle" (cons "viz-tower" (cons "viz-ledger" (cons "viz-rays" (cons "viz-defects" (cons "viz-dyadic" (nil String))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.SiteTests.test_statements_picture_and_explainer_artifacts (role=img, aria-labelledby)", coverage := "implemented"}) (cons (record Standard {id := "schema-org", name := "schema.org vocabulary (JSON-LD)", authority := "https://schema.org/", version := "current release (https://schema.org/docs/releases.html)", scope := "A LearningResource for every pedagogical step of every journey, the paper as ScholarlyArticle, the repository as SoftwareSourceCode, the register as Dataset, embedded in the page and published as schema.json.", realizedBy := (cons "jsonld" (cons "site" (cons "paper-pdf" (cons "register-json" (cons "readme" (cons "prize-review" (cons "research-session" (cons "reading" (cons "stdlib-feedback" (cons "mathematics" (cons "first-visit" (nil String)))))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_schema_org_describes_every_step_the_paper_the_repository_and_the_register", coverage := "implemented"}) (cons (record Standard {id := "json-ld-1.1", name := "W3C JSON-LD 1.1", authority := "https://www.w3.org/TR/json-ld11/", version := "1.1 (Recommendation, 2020-07-16)", scope := "The serialization of the schema.org and PROV-O graphs: a @context, a @graph, ids under the published URL.", realizedBy := (cons "jsonld" (cons "provenance" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests (both documents parse and carry @context and @graph)", coverage := "implemented"}) (cons (record Standard {id := "prov-o", name := "W3C PROV-O, the PROV Ontology", authority := "https://www.w3.org/TR/prov-o/", version := "Recommendation, 2013-04-30", scope := "Provenance of every claim: a proved claim prov:wasDerivedFrom its Lean theorem and prov:wasAttributedTo the Lean kernel, attested by the paper's LexLean attestation and the module's kappa-label; the view prov:wasGeneratedBy the render of this commit under the view workflow.", realizedBy := (cons "provenance" (cons "view-workflow" (cons "view_render" (cons "frontier_check" (cons "kappa" (cons "verify" (nil String))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_provenance_derives_every_proved_claim_from_its_theorem", coverage := "implemented"}) (cons (record Standard {id := "json-schema-2020-12", name := "JSON Schema 2020-12", authority := "https://json-schema.org/draft/2020-12/schema", version := "2020-12", scope := "The closed schemas of register.json, the interface sheets, standards.json and the --json reports (rule30-api/schemas), validated by the tests and referenced from openapi.json.", realizedBy := (cons "register-json" (cons "standards" (cons "openapi" (cons "api_check" (cons "api_production" (cons "brief" (cons "chain" (cons "claim" (cons "deduce" (cons "discover" (cons "engine_prune" (cons "engine_status" (cons "engine_tick" (cons "frontier_list" (cons "interface" (cons "kappa" (cons "sequences" (cons "status" (nil String))))))))))))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.ResultSchemaTests; bin/r30 api check", coverage := "implemented"}) (cons (record Standard {id := "openapi-3.1", name := "OpenAPI Specification 3.1", authority := "https://spec.openapis.org/oas/v3.1.1", version := "3.1.1 (2024-10-24)", scope := "The r30 command surface as an API description: one path per command of the parser, its arguments as parameters, its responses from the result schemas, the same leaves as Api.lex.tex and the MCP tools.", realizedBy := (prim append (cons "openapi" (cons "status" (cons "brief" (cons "chain" (cons "api_sync" (cons "api_check" (cons "api_production" (cons "view_render" (cons "interface" (cons "claim" (cons "audit" (cons "gate" (cons "lexicon_search" (cons "lexicon_show" (cons "lexicon_packages" (cons "sig" (cons "mentions" (cons "theorem_preview" (cons "theorem_add" (cons "theorem_remove" (cons "define" (cons "check" (cons "unpublished" (cons "selfcheck" (cons "verify" (cons "probe" (cons "axioms" (cons "choice_audit" (cons "frontier_list" (cons "frontier_add" (cons "frontier_set" (cons "frontier_check" (cons "frontier_render" (cons "commit" (cons "module_list" (cons "module_add" (cons "module_build" (cons "consolidate" (cons "kappa" (cons "sequences" (nil String))))))))))))))))))))))))))))))))))))))))) (cons "discover" (cons "deduce" (cons "engine_tick" (cons "engine_status" (cons "engine_hypotheses" (cons "engine_prune" (cons "experiment_list" (cons "experiment_run" (nil String))))))))) : (List String)), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_openapi_describes_the_command_surface; bin/r30 api check (Api.lex.tex)", coverage := "implemented"}) (cons (record Standard {id := "gherkin", name := "Gherkin (Cucumber reference)", authority := "https://cucumber.io/docs/gherkin/reference/", version := "Gherkin reference (current)", scope := "One scenario per conformance id in features/suites, tagged with the id and its honesty level, generated with the registers.", realizedBy := (cons "api_sync" (cons "api_check" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.ConformanceTests; bin/r30 api check", coverage := "implemented"}) (cons (record Standard {id := "citation-cff", name := "Citation File Format 1.2.0", authority := "https://citation-file-format.github.io/", version := "1.2.0", scope := "CITATION.cff at the repository root (and copied into the view): the author, the title of the paper, the repository and the published view.", realizedBy := (cons "citation" (cons "readme" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_citation_file_names_the_author_the_title_and_the_repository", coverage := "implemented"}) (cons (record Standard {id := "spdx", name := "SPDX License Expressions (SPDX 2.3, ISO/IEC 5962:2021)", authority := "https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/", version := "2.3", scope := "License identifiers of the vendored sources: the repository is MIT (LICENSE at the root, `license: MIT` in CITATION.cff); the prism-stdlib register carries the SPDX expression of its vendored license files.", realizedBy := (cons "stdlib-package" (cons "citation" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_spdx_expressions_are_well_formed", coverage := "implemented"}) (cons (record Standard {id := "sitemap-protocol", name := "Sitemaps XML protocol 0.9", authority := "https://www.sitemaps.org/protocol.html", version := "0.9", scope := "sitemap.xml: the page and the deep link of every step of every journey; robots.txt names the sitemap.", realizedBy := (cons "sitemap" (cons "robots" (cons "site" (cons "prize-review" (cons "research-session" (cons "reading" (cons "stdlib-feedback" (cons "mathematics" (cons "first-visit" (nil String)))))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_sitemap_lists_every_step_deep_link", coverage := "implemented"}) (cons (record Standard {id := "open-graph", name := "The Open Graph protocol", authority := "https://ogp.me/", version := "ogp.me (2014-10)", scope := "og:title, og:type, og:url, og:description and og:image in the page's head, injected with the JSON-LD at render.", realizedBy := (cons "site" (cons "logo" (nil String))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_site_head_carries_json_ld_and_open_graph", coverage := "implemented"}) (cons (record Standard {id := "rfc-8785", name := "RFC 8785, JSON Canonicalization Scheme (JCS)", authority := "https://www.rfc-editor.org/rfc/rfc8785", version := "2020-06", scope := "The identity of the published JSON contracts (sha256-canonical-json in contracts.toml) and the canonical JSON of the LexLean attestations; uor-addr labels JSON under JCS.", realizedBy := (cons "register-json" (cons "statements" (cons "kappa" (nil String)))), conformance := "python3 -m unittest scripts.tests.test_kappa (the no-prefix rule on the JCS vector)", coverage := "implemented"}) (cons (record Standard {id := "rivest-csexp", name := "Rivest, S-Expressions (canonical form, section 4.3)", authority := "https://people.csail.mit.edu/rivest/Sexp.txt", version := "draft-rivest-sexp-00, 1997-05-04", scope := "The kappa-label of a research module: the SHA-256 of the canonical S-expression of the declarations the kernel replays, as UOR-Foundation/uor-addr mints labels; the key of the replay receipts. The same canonical form labels the sequences of the basis, (sequence ), their transforms and the relations the discovery engines find, (relation ).", realizedBy := (cons "kappa" (cons "provenance" (cons "sequences" (cons "discover" (cons "Sequences" (cons "Discovery" (nil String))))))), conformance := "python3 -m unittest scripts.tests.test_kappa; bin/r30 kappa ; bin/r30 api check (sequences)", coverage := "implemented"}) (cons (record Standard {id := "in-toto-statement-v1", name := "in-toto Attestation Framework, Statement v1", authority := "https://github.com/in-toto/attestation/blob/main/spec/v1/statement.md", version := "v1", scope := "attestations.intoto.json: a Statement whose subjects are the attested PDFs and the paper's sources with their SHA-256 digests and whose predicate is the paper's LexLean attestation.", realizedBy := (cons "attestations" (cons "pdf-manifest" (cons "verify" (cons "paper-pdf" (cons "observations-pdf" (cons "core-pdf" (nil String))))))), conformance := "python3 -m unittest scripts.tests.test_r30.StandardsTests.test_in_toto_statement_subjects_are_the_attested_documents", coverage := "implemented"}) (cons (record Standard {id := "oci-distribution", name := "OCI Distribution Specification", authority := "https://github.com/opencontainers/distribution-spec/blob/main/spec.md", version := "1.1.0 (2024-02)", scope := "Planned: a kappa-registry serving the replay receipts and certified bundles by content address; today only the kappa-labels that would address them exist.", realizedBy := (cons "kappa" (nil String)), conformance := "bin/r30 kappa (the labels); no registry runs yet", coverage := "planned"}) (cons (record Standard {id := "iana-media-types", name := "IANA Media Types (RFC 6838)", authority := "https://www.iana.org/assignments/media-types/", version := "RFC 6838 (2013-01)", scope := "Every published artifact declares its media type in Presentation.lex.tex; the contracts register declares the vendor types of the JSON reports.", realizedBy := (prim append (cons "chain" (cons "register-json" (cons "register-text" (cons "frontier" (cons "interfaces" (cons "statements" (cons "explainer" (cons "picture" (cons "paper-pdf" (cons "observations-pdf" (cons "core-pdf" (cons "pdf-manifest" (cons "api-module" (cons "register-module" (cons "architecture-module" (cons "presentation-module" (cons "application-module" (cons "core-vectors" (cons "frontier-module" (cons "agents" (cons "round-workflow" (cons "strategy" (cons "readme" (cons "logo" (cons "standards" (cons "standards-module" (cons "openapi" (cons "sitemap" (cons "robots" (cons "provenance" (cons "jsonld" (cons "attestations" (cons "citation" (cons "observer-module" (cons "tokens" (cons "site" (cons "viz-core-js" (cons "viz-triangle-js" (cons "viz-tower-js" (cons "viz-ledger-js" (nil String))))))))))))))))))))))))))))))))))))))))) (cons "viz-rays-js" (cons "viz-defects-js" (cons "viz-dyadic-js" (nil String)))) : (List String)), conformance := "bin/r30 verify api: artifactPathsDistinct, panelsReadArtifacts (Presentation); python3 -m unittest scripts.tests.test_r30.StandardsTests", coverage := "implemented"}) (cons (record Standard {id := "lean-4", name := "Lean 4 (the kernel)", authority := "https://github.com/leanprover/lean4", version := "leanprover/lean4:v4.32.1", scope := "Every proved claim names a theorem the Lean kernel checked under propext and Quot.sound; the research modules are kernel-replayed with leanchecker.", realizedBy := (cons "Register" (cons "axioms" (cons "choice_audit" (cons "frontier_check" (cons "kappa" (cons "module_build" (nil String))))))), conformance := "bin/r30 frontier check; bin/r30 axioms ; bin/r30 choice-audit", coverage := "implemented"}) (cons (record Standard {id := "lexlean", name := "UOR-Foundation/LexLean (closed-lexicon LaTeX to Lean 4)", authority := "https://github.com/UOR-Foundation/LexLean", version := "0.4.0, language 1.2, compiler semantics 2e4c0ddd6084", scope := "The authoring surface: the paper, the register and these API modules are LexLean modules verified by lexlean; the production roots export to certified Rust.", realizedBy := (cons "Api" (cons "Register" (cons "Architecture" (cons "Presentation" (cons "Application" (cons "Observer" (cons "Convert" (cons "Standards" (cons "Rule30Core" (cons "Sequences" (cons "Discovery" (cons "verify" (cons "check" (cons "api_sync" (cons "api_check" (cons "api_production" (nil String))))))))))))))))), conformance := "bin/r30 verify api; bin/r30 check api; bin/r30 api check", coverage := "implemented"}) (nil Standard))))))))))))))))))))))))), axioms: [] } @@ -281,7 +281,7 @@ theorem{ name: lexleanPinned, parameters: [], - statement: ((prim equal (standardVersion "lexlean" (standards)) "0.4.0, language 1.2, compiler semantics 601e9f4a1824" : Bool) = true), + statement: ((prim equal (standardVersion "lexlean" (standards)) "0.4.0, language 1.2, compiler semantics 2e4c0ddd6084" : Bool) = true), proof: decide{}, axioms: [] } diff --git a/rule30-lexlean/Core.pdf b/rule30-lexlean/Core.pdf index 03313fd47766d7acb4a7a2dc8dac989f188f850a..07f8713278bd27d3cd42497e2e19c10028677389 100644 GIT binary patch delta 124 zcmcb6hWYLp<_)uNsu&p=7?>FtM`?2D`{t*(B$lKqXt-Dz85o%v8X7_+H}Ah$!s+bn s=;r3+f&f=Z0KxcYH0)%G&Zy_aWOTwaJ5sgA*5t;+2iL-02ucpasU7T delta 124 zcmcb6hWYLp<_)uNsu&s>nphZGMrm^C`{t*(B$lKqXt-Dz85o%v0s%yF^ZuJ9oX&2B t#wG^NhNiA2X66=-Cax~7u4X0{7OrLnZpLQj2F`X0HiVRHE_?i(2>=D%BLV;b diff --git a/rule30-lexlean/lexlean.lock b/rule30-lexlean/lexlean.lock index 3fdf5c9..867bbef 100644 --- a/rule30-lexlean/lexlean.lock +++ b/rule30-lexlean/lexlean.lock @@ -1,6 +1,6 @@ spec = "lexlean/lock/2" language = "1.2" -compiler_semantics = "601e9f4a1824bb6aacf7c3c2243d4b33aaa315abdebd5ceaf920d178e196019e" +compiler_semantics = "2e4c0ddd6084eba8fa99f04ab0235bfc5775dbc0455216b6ec51abe8ce8d9750" project_config_sha256 = "19b484b35998550fc91a00820ee56382eaf79bbb39852dfb7d54e82018f0cd7b" lean_toolchain = "leanprover/lean4:v4.32.1" diff --git a/rule30-lexlean/pdf/Core.pdf b/rule30-lexlean/pdf/Core.pdf index 03313fd47766d7acb4a7a2dc8dac989f188f850a..07f8713278bd27d3cd42497e2e19c10028677389 100644 GIT binary patch delta 124 zcmcb6hWYLp<_)uNsu&p=7?>FtM`?2D`{t*(B$lKqXt-Dz85o%v8X7_+H}Ah$!s+bn s=;r3+f&f=Z0KxcYH0)%G&Zy_aWOTwaJ5sgA*5t;+2iL-02ucpasU7T delta 124 zcmcb6hWYLp<_)uNsu&s>nphZGMrm^C`{t*(B$lKqXt-Dz85o%v0s%yF^ZuJ9oX&2B t#wG^NhNiA2X66=-Cax~7u4X0{7OrLnZpLQj2F`X0HiVRHE_?i(2>=D%BLV;b diff --git a/rule30-paper/Observations.pdf b/rule30-paper/Observations.pdf index b87ec2dd9c77a6f7cbd45dc36e9e2a99cafb1872..58d4c52aa9fb3050f8c0211c6cee4ce2aef16377 100644 GIT binary patch delta 118 zcmex%OW@lrfrb{w7N!>FEi6$Y>_$cg24;rF(-TEl#9*B5bs{V~c%02F%nghj-HZ(l lj4e$Z&CJX#fh<>ZCqoxwBXa{&Gdl$vLQ1w*Dzg0L1^{r19qs@C delta 118 zcmex%OW@lrfrb{w7N!>FEi6$Y?1n~$CKg8K(-TEl#9*B5bs{V~c$`fw4INFKO>I24)5pQJP%( zzWFIGi6yBD8ZK5w21aIvhK5kd?feV)MA;n;Obi^&oehkfEX|CJEiIg!+$>yNER79} X%}pGk^q6m0M-*`B(bPf-Z~eL^P( delta 152 zcmZphY~425x}k-!g{g(Pg{6hHg{_6Xg`^>~CsP0b diff --git a/rule30-paper/lexlean.lock b/rule30-paper/lexlean.lock index 2cc0508..915cb6d 100644 --- a/rule30-paper/lexlean.lock +++ b/rule30-paper/lexlean.lock @@ -1,6 +1,6 @@ spec = "lexlean/lock/2" language = "1.2" -compiler_semantics = "601e9f4a1824bb6aacf7c3c2243d4b33aaa315abdebd5ceaf920d178e196019e" +compiler_semantics = "2e4c0ddd6084eba8fa99f04ab0235bfc5775dbc0455216b6ec51abe8ce8d9750" project_config_sha256 = "65f34bd573a071519ef77a8129d6aaba99072b7612e53043eac3033c4f4dfcbc" lean_toolchain = "leanprover/lean4:v4.32.1" diff --git a/rule30-paper/pdf/Observations.pdf b/rule30-paper/pdf/Observations.pdf index b87ec2dd9c77a6f7cbd45dc36e9e2a99cafb1872..58d4c52aa9fb3050f8c0211c6cee4ce2aef16377 100644 GIT binary patch delta 118 zcmex%OW@lrfrb{w7N!>FEi6$Y>_$cg24;rF(-TEl#9*B5bs{V~c%02F%nghj-HZ(l lj4e$Z&CJX#fh<>ZCqoxwBXa{&Gdl$vLQ1w*Dzg0L1^{r19qs@C delta 118 zcmex%OW@lrfrb{w7N!>FEi6$Y?1n~$CKg8K(-TEl#9*B5bs{V~c$`fw4INFKO>I24)5pQJP%( zzWFIGi6yBD8ZK5w21aIvhK5kd?feV)MA;n;Obi^&oehkfEX|CJEiIg!+$>yNER79} X%}pGk^q6m0M-*`B(bPf-Z~eL^P( delta 152 zcmZphY~425x}k-!g{g(Pg{6hHg{_6Xg`^>~CsP0b