Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/lexlean-revision
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15c667bd36604c94c28e39502edec3fcad38e0ce
9fd01c31e40bb29577833825f902fafcceedb49a
Binary file modified Rule30-Core.pdf
Binary file not shown.
Binary file modified Rule30-Observations.pdf
Binary file not shown.
Binary file modified Rule30-Paper.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Rule30PrizeKit/lean/lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:v4.32.1
leanprover/lean4:v4.32.2
2 changes: 1 addition & 1 deletion lexlean-stdlib/lexlean.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ entrypoints = ["src/Buffer.lex.tex", "src/Host.lex.tex", "src/Sha256.lex.tex", "
build_root = ".lexlean"
lockfile = "lexlean.lock"
lean_workspace = "."
lean_toolchain = "leanprover/lean4:v4.32.1"
lean_toolchain = "leanprover/lean4:v4.32.2"

[[lexicon_source]]
package = "lexlean.std.nat"
Expand Down
10 changes: 5 additions & 5 deletions pdf-manifest.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"documents": {
"Core": {
"pdf_sha256": "0412d2a3bd4a1f856877b4576fa9d3c74cf20110254b3e8c08e88f9c513ef5c6",
"pdf_sha256": "c0d3552b926faeb1b74cbe6d36d407059a31e073a3907226751a780971c372f2",
"tex_sha256": "a7cd1807077baa1d1ca34015faf500a24477991859427f4db646e5f230fe54e2"
},
"Observations": {
"pdf_sha256": "4c3af528e93971b79c6ff12a31ac92ce502e40fe6c35656036156256a4739af6",
"pdf_sha256": "2a984eee66578dc5dd22049b2dbb0c5d5de652afacd227530771499bf2bc4d62",
"tex_sha256": "056820f37ac40133e341f46ad6c81125e35981150a1cc86f2063faad3f26fbd4"
},
"Paper": {
"pdf_sha256": "28247b25fc3192f97ca2454315ae49530d4fb91cf7d363cb4cfee14c8e6291a6",
"pdf_sha256": "b4e861207713fc915b1f3e7cf8e981951a95cd73cd8968f1d11a6df84e7d00dc",
"tex_sha256": "000f988561d9621f9ba2f9a99aba971670864367ebd336e6fbad0e1f71da01cb"
}
},
"generated_at_utc": "2026-11-11T21:48:32.936749+00:00",
"source_digest": "9290b3cca596a4281b852998983ea680eb6706ed332321ae9034b400112ea3e4"
"generated_at_utc": "2026-11-14T10:01:11.420998+00:00",
"source_digest": "f97eb4afb83521401b5665cd9e9eaba18116700500fd6e3924de66a18cca0ea8"
}
120 changes: 120 additions & 0 deletions rule30-api/ENVIRONMENT_MEMORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Bounded environmental memory

`EnvironmentMemoryCommand.step` is a native LexLean Host entry for a bounded,
local environmental-memory inspection. It acquires a file from an exact local
Git commit, retains the observation, reopens and validates the store, and returns
relevant source context alongside the caller's unchanged `Research.Task`.

This is a usable acquisition/retrieval interface, not autonomous Engine learning,
GitHub crawling, or an integration with the unpublished source inspector.

## Run

Build the production root with the project's qualified compiler and unchanged
acceptance policy:

```
lexlean production build --project rule30-api/lexlean.toml \
--request rule30-api/production/environment-memory-request.json
```

Use the generated `rule30_environment_memory` executable from that certified
bundle. It takes exactly two arguments: an existing private state directory and
a request JSON file. Run from the repository root for the example's `.` source:

```
mkdir -m 700 /tmp/r30-memory-example
rule30_environment_memory /tmp/r30-memory-example \
rule30-api/examples/environment-inspection.json
```

The example selects the public main snapshot's Host abstraction and searches for
`Request`. Its task target is explicitly an unverified interface fixture. Replace
the entire `task` with a real caller-owned task before using the returned context
in research. The command does not resolve, inspect, or prove that task's goal.

For a later process, keep the same state directory and change `operation` to
`query`. The local source need not exist for a query. Keep all eight request keys;
`local_repository` and `path` can be empty strings for a query. Change `query` to
another nonempty, case-sensitive byte substring (at most 128 bytes). An unrelated
query or a different exact revision returns no observations, not stale context.

## Versioned interface

Input `r30/environment-inspection/1` has exactly these keys: `spec`, `operation`
(`ingest` or `query`), `local_repository`, `repository`, `revision`, `path`,
`query`, and `task`. The existing `ResearchInput.task` decoder admits the task;
all its fields, including every contextual-sequent field, are returned unchanged.

Output `r30/environment-context/1` contains `task`, `observations`, and the fixed
trust label `observed-sources-not-proof`. Each observation has the claimed GitHub
`repository` label, exact `revision`, `path`, locally resolved Git `blob`, raw
`content`, SHA-256 `digest`, and `acquisition: local-git-object`.

The source owner/repository label is a claim supplied by the caller. The command
does not authenticate GitHub ownership or prove that the commit is published
there. Local acquisition establishes a commit/path/blob relation through fixed
Git commands and checks content length before retention. On disk, even matching
digests and acquisition labels are untrusted records, not authentication receipts.

The later source inspector can consume the observations as search hints for the
same supplied task. It must inspect any proposed declaration against its owned
snapshot and exact goal, then use the existing kernel/axiom gates. This command
constructs neither `Research.ResultKind.inspected` nor `checked`, changes no
registered claim, and never executes text or instructions from observations.

## Bounds and ownership

- One ingestion acquires one SHA-1 Git commit/path, at most 4 KiB of content.
SHA-256-format Git repositories are explicitly unsupported in this increment.
- Fixed Git invocations resolve `COMMIT^{commit}:PATH`, read the resolved object's
size, then read exactly that blob. No shell, textconv, filters, hooks, replace
objects, lazy fetch, credential prompts, or network protocol is enabled.
- Each of the three Git jobs has a 10-second allowance and bounded poll count.
- At most 32 observations are retained. Duplicate keys/content are idempotent;
changed revisions remain separate; conflicting content for an existing
repository/revision/path is refused. A full store is refused, never evicted.
- Both serialized stores and readback are limited to 1 MiB, including escaped
JSON. Requests are limited to 64 KiB. Retrieval returns at most eight records.
- The caller owns a dedicated private state directory and source repository.
There must be no competing writer or adversarial filesystem mutation. The
existing Host lock blocks on contention; this interface does not claim a
bounded lock-acquisition timeout. Do not share the state directory with
unrelated tools or place symlinks at its fixed filenames.
- `store.lock`, `git-output`, `git-errors`, `observations.pending`, and
`observations.json` are reserved in that directory. Source data never selects
paths or executable arguments outside the validated source identity.

## Persistence and failures

A writer locks the directory's store lock, validates any prior store, writes a
canonical pending file, renames it over the store, then reads and validates the
exact bytes again. Only successful readback produces context output with exit 0.
A malformed prior store is never overwritten. Interrupted/failed pending writes
must not be called learned memory. Keep the private directory after an uncertain
rename/readback or child-cleanup error and inspect it before retrying.

This provides process-restart persistence, not a power-loss durability guarantee:
Host does not expose fsync. Host reads are preceded by size checks for caller
files; those checks rely on the private-path/no-adversarial-mutation assumption.

## Acceptance

Use the generated executable, not a handwritten substitute, to check:

1. Ingest the pinned example, compare returned blob with local Git resolution,
digest with acquired bytes, and every task/sequent field with the input.
2. End that process. Query in a new process; obtain the same observation.
3. Repeat ingestion; retain exactly one record. Change query or revision; obtain
no old context. Ingest a changed fixture commit; retain both revisions.
4. Reject malformed JSON, duplicate or unknown fields, forged content digests,
conflicting immutable keys, excessive content/store budgets, and path escape.
5. Attempt writes with an obstructed pending or destination path. Require failure
and no successful learned/context output; preserve the prior valid store.
6. Ingest a fixture containing hostile instructions; return it only as observed
data. Exercise worst-case JSON escapes and reopen the result.

Kernel traces cover core retrieval, idempotence, revision separation, malformed
records, round-trip readback, escaped-size budget and unchanged exact task. Native
acceptance and the full repository gate must be reported separately; neither a
parse/link check nor a fixed-kernel test-only manifest is main's acceptance.
12 changes: 6 additions & 6 deletions rule30-api/engine.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
spec = "lexlean/lock/2"
language = "1.2"
compiler_semantics = "601e9f4a1824bb6aacf7c3c2243d4b33aaa315abdebd5ceaf920d178e196019e"
project_config_sha256 = "e657308b6f36bd0a461676b914b7ca80da508a2dd954f09ddc1265a353e814aa"
lean_toolchain = "leanprover/lean4:v4.32.1"
compiler_semantics = "59f64efe727898bcf6a337630c38eb4ea7ffc08cd83a49a0ea669c61c3b23587"
project_config_sha256 = "72f454b45ba782d5184178d9c55a9fa22b75f7ef0b858a2337831e7bca083a4e"
lean_toolchain = "leanprover/lean4:v4.32.2"

[[workspace_file]]
path = "lake-manifest.json"
Expand All @@ -14,7 +14,7 @@ sha256 = "45706f664f0356324c1969af458df9fb89e9b6c72ab31565f81689a8e36a862c"

[[workspace_file]]
path = "lean-toolchain"
sha256 = "8e3538e0ab5f81a3ee04927d8838c8c674e0e112838b4b3ce87ec218143276af"
sha256 = "2bdc48adfa58d0017e538a0ad117c5d73d35deec879978f909406a80c8037273"

[[package]]
id = "lexlean.core"
Expand Down Expand Up @@ -72,6 +72,6 @@ version = "1.0.0"
kind = "path"
source = "lexlean-stdlib"
module_prefix = "LexLeanStd"
tree_sha256 = "c762d97c09459088fa875b4649e3922a44ee44725d68d7d9302462afaabf0125"
manifest_sha256 = "1d89879a58a3e4a76b64730a65b73386842ff7e66beb3dece7a5b148320c61e7"
tree_sha256 = "7726865b469cbc3a44a9e29e7b370ae65daf9b8535bc05e5cb69cf9adc379011"
manifest_sha256 = "fffe191f20f243117d6f07dd7b237f78000a9fb4b8ea0e2bd43dc2cb1e2c9a5a"
imports = []
2 changes: 1 addition & 1 deletion rule30-api/engine.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ entrypoints = ["src/Api.lex.tex", "src/Discovery.lex.tex", "src/Engine.lex.tex",
build_root = ".lexlean"
lockfile = "engine.lock"
lean_workspace = "."
lean_toolchain = "leanprover/lean4:v4.32.1"
lean_toolchain = "leanprover/lean4:v4.32.2"

[[lexicon_source]]
package = "lexlean.std.bool"
Expand Down
28 changes: 28 additions & 0 deletions rule30-api/examples/environment-inspection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"spec": "r30/environment-inspection/1",
"operation": "ingest",
"local_repository": ".",
"repository": "afflom/rule30",
"revision": "e3be477fded263029479127363f7fb6a3597e7d4",
"path": "lexlean-stdlib/src/Host.lex.tex",
"query": "Request",
"task": {
"id": "memory-interface-example",
"purpose": "prove",
"intent": "prove",
"status": "ready",
"component": "deduction",
"sources": [],
"schema": "Host request constructors",
"sequent": {
"origin": "InterfaceExample.goal",
"theorem": "InterfaceExample.goal",
"premise": 0,
"telescope": "",
"target": "UNVERIFIED INTERFACE FIXTURE: replace with the exact task target",
"kind": "closed"
},
"age": 0,
"weight": 1
}
}
2 changes: 1 addition & 1 deletion rule30-api/lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:v4.32.1
leanprover/lean4:v4.32.2
12 changes: 6 additions & 6 deletions rule30-api/lexlean.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
spec = "lexlean/lock/2"
language = "1.2"
compiler_semantics = "601e9f4a1824bb6aacf7c3c2243d4b33aaa315abdebd5ceaf920d178e196019e"
project_config_sha256 = "6ceb296fae3095cf9f42d6c53a9eeeee55cf9df8e6e1eba87fd6248553fd000d"
lean_toolchain = "leanprover/lean4:v4.32.1"
compiler_semantics = "59f64efe727898bcf6a337630c38eb4ea7ffc08cd83a49a0ea669c61c3b23587"
project_config_sha256 = "163e328801aa738fabc9a0fb01059000b9bf81d003e2ffa0473fc96869fcda70"
lean_toolchain = "leanprover/lean4:v4.32.2"

[[workspace_file]]
path = "lake-manifest.json"
Expand All @@ -14,7 +14,7 @@ sha256 = "45706f664f0356324c1969af458df9fb89e9b6c72ab31565f81689a8e36a862c"

[[workspace_file]]
path = "lean-toolchain"
sha256 = "8e3538e0ab5f81a3ee04927d8838c8c674e0e112838b4b3ce87ec218143276af"
sha256 = "2bdc48adfa58d0017e538a0ad117c5d73d35deec879978f909406a80c8037273"

[[package]]
id = "lexlean.core"
Expand Down Expand Up @@ -82,6 +82,6 @@ version = "1.0.0"
kind = "path"
source = "lexlean-stdlib"
module_prefix = "LexLeanStd"
tree_sha256 = "c762d97c09459088fa875b4649e3922a44ee44725d68d7d9302462afaabf0125"
manifest_sha256 = "1d89879a58a3e4a76b64730a65b73386842ff7e66beb3dece7a5b148320c61e7"
tree_sha256 = "7726865b469cbc3a44a9e29e7b370ae65daf9b8535bc05e5cb69cf9adc379011"
manifest_sha256 = "fffe191f20f243117d6f07dd7b237f78000a9fb4b8ea0e2bd43dc2cb1e2c9a5a"
imports = []
Loading
Loading