Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 7 additions & 3 deletions .github/workflows/m0-lexlean-reconcile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 360
env:
LEXLEAN_SOURCE_SHA: e0b74b81e6f49c83596a957d232c8383a5db1a25
LEXLEAN_SOURCE_SHA: cce7271be1d21db322ca57456ea1e973302d7c63
CARGO_INCREMENTAL: "0"
CARGO_NET_OFFLINE: "true"
CARGO_HOME: ${{ github.workspace }}/target/m0-locked-cargo-inputs
Expand All @@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: UOR-Foundation/LexLean
ref: e0b74b81e6f49c83596a957d232c8383a5db1a25
ref: cce7271be1d21db322ca57456ea1e973302d7c63
path: _m0/lexlean
fetch-depth: 1
persist-credentials: false
Expand Down Expand Up @@ -112,8 +112,10 @@ jobs:
exec > target/m0-reconciliation-diagnostics/generation-step.log 2>&1
just codegen
just fixtures-write
just golden-write "M0 issue #5: reconcile reviewed LexLean PR68 e0b74b81e6f49c83596a957d232c8383a5db1a25"
just golden-write "M0 issue #5: reconcile reviewed LexLean PR68 cce7271be1d21db322ca57456ea1e973302d7c63"
just stdlib-package-write
just bindings-package-write
just factory-write
stage="$(mktemp -d)"
cp -a stdlib/generated/package "$stage/stdlib"
(
Expand Down Expand Up @@ -145,6 +147,8 @@ jobs:
just stdlib-package-check
just check-fixtures
just package-release-crates-check
just bindings-package-check
bash prism-factory/check.sh
rm -r -- "$stage"

- name: Preserve an inert patch and its selected-source identity
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Agent Guidelines for PrismPM

- SPEC.md is normative; README prose is explanatory.
- No handwritten PrismPM `.lean` source or `lakefile.lean` may be committed. All PrismPM Lean code is generated from `.lex.tex` by LexLean. The only upstream-source exception is the exact 4-file compiler-authority closure in SPEC §9 and `LEXLEAN_AUTHORITY_SOURCES` (`language/preservation-1.2/modules/LexLeanTarget/{RustSemantics,RustSyntax,TargetSemantics,TargetSyntax}.lean`), admitted only from the pinned LexLean revision `e0b74b81e6f49c83596a957d232c8383a5db1a25` (the commit of the annotated `v0.4.0` tag and of the LexLean v0.4.0 release) through the registered package, complete dependency/tree checksums, matching clean package VCS provenance, and exact archive-member/tree byte equality. The extraction adapter and preservation library are `.lex.tex` notation in that package. This does not admit other vendored Lean or any PrismPM model, proof, or replacement application behavior.
- No handwritten PrismPM `.lean` source or `lakefile.lean` may be committed. All PrismPM Lean code is generated from `.lex.tex` by LexLean. The only upstream-source exception is the exact 4-file compiler-authority closure in SPEC §9 and `LEXLEAN_AUTHORITY_SOURCES` (`language/preservation-1.2/modules/LexLeanTarget/{RustSemantics,RustSyntax,TargetSemantics,TargetSyntax}.lean`), admitted only from the pinned LexLean revision `cce7271be1d21db322ca57456ea1e973302d7c63` (the commit of the annotated `v0.4.0` tag and of the LexLean v0.4.0 release) through the registered package, complete dependency/tree checksums, matching clean package VCS provenance, and exact archive-member/tree byte equality. The extraction adapter and preservation library are `.lex.tex` notation in that package. This does not admit other vendored Lean or any PrismPM model, proof, or replacement application behavior.
- Do not introduce placeholder URLs, wildcards in internal dependencies, unpinned toolchains, or unstaged modifications.
- Every public capability and diagnostic is registered in `model/*.toml` and covered by conformance fixtures.

18 changes: 18 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ bindings-package-check:
bindings-package-write:
cargo run --locked --package xtask -- bindings-package --write

# Re-export the certified factory bundle and its workflows with the pinned LexLean (README "Rebuilding").
factory-write:
#!/usr/bin/env bash
set -euo pipefail
target="${CARGO_TARGET_DIR:-$PWD/target}/lexlean"
cargo build --quiet --release --locked --manifest-path vendor/lexlean/Cargo.toml --bin lexlean --target-dir "$target"
lexlean="$target/release/lexlean"
result=$(cd prism-factory/model && "$lexlean" lock --check >&2 && "$lexlean" verify --all >&2 && "$lexlean" production build --request ../production-request.json | sed -n 's/.*; result \([0-9a-f]\{64\}\);.*/\1/p')
test -n "$result"
rm -rf prism-factory/certified
cp -r "prism-factory/model/.lexlean/production/$result" prism-factory/certified
rm -rf prism-factory/model/.lexlean
cargo build --quiet --release --locked --manifest-path prism-factory/host/Cargo.toml
host=prism-factory/host/target/release/prism-factory
"$host" workflow --name factory --write .github/workflows/factory.yml
"$host" workflow --name release --jobs prism-factory/jobs --write .github/workflows/release.yml
"$host" workflow --name cut --write .github/workflows/release-cut.yml

# Verify examples and standard library
verify-examples:
cargo run --package xtask -- verify-examples
Expand Down
2 changes: 1 addition & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ no absolute checkout path, hostname, locale text, random identifier, timestamp,
or traversal-order dependence.

The only imported Lean-source exception is the registered LexLean 0.4.0 package
at revision `e0b74b81e6f49c83596a957d232c8383a5db1a25`, the commit of the
at revision `cce7271be1d21db322ca57456ea1e973302d7c63`, the commit of the
annotated `v0.4.0` tag, from which the LexLean v0.4.0 release was cut.
Its exact 4-file compiler-authority closure is the following paths under
`vendor/lexlean/language/preservation-1.2/`:
Expand Down
2 changes: 1 addition & 1 deletion bindings/generated/prism_bindings_js/package.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/generated/prism_bindings_js/provenance.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"compiler_semantics":"1427f8b629013648a480454d67202788f2303f5396f1d7c70a7c350ddab6f694","effects":["allocation","overflow","recursion"],"exports":[{"function":0,"name":"run"}],"files":{"Cargo.toml":"98ab423f0774d8ee780133ab30a1da8158dd9a8dc264cb05397cab4301988866","src/lib.rs":"f80086330586e815c2e7e1523fba27c91b4c7fb2baf929f45b360ad365953103"},"name":"prism_bindings_js","profile":"rust-std","program":"a64e014c6f759855ad7d12d538b1ac9ab68dd40b8a8dd966176300496965036d","runtime":"4bb6ab6dc7e2fc1a587876290fac070f499170ff7609aee0fd924aa8fd7bcab7","sources":["096d0163ca943f11ee0e182348796fd8e0bfb361fd771354fdc222a03c296e6b"],"spec":"lexlean/rust-provenance/1","version":"0.1.0"}
{"compiler_semantics":"e1b2447a28c98f87a7782a4fd4786044db3fff53fd2a76dbd5e4071fd6a6721d","effects":["allocation","overflow","recursion"],"exports":[{"function":0,"name":"run"}],"files":{"Cargo.toml":"98ab423f0774d8ee780133ab30a1da8158dd9a8dc264cb05397cab4301988866","src/lib.rs":"39804006195aa255a20d3cd7bbfdbf793961d59554b761b4394a405ea2639598"},"name":"prism_bindings_js","profile":"rust-std","program":"a64e014c6f759855ad7d12d538b1ac9ab68dd40b8a8dd966176300496965036d","runtime":"72477f9e44fe54531b9c68f2b547db7300563373df9d8d29fa5632b8a9d7c14c","sources":["859d04492a8c20d9b57e181e8a91efb494fb66cefff9d98f1820adbc6cdcaec0"],"spec":"lexlean/rust-provenance/1","version":"0.1.0"}
130 changes: 96 additions & 34 deletions bindings/generated/prism_bindings_js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,23 @@ impl Str {
pub fn utf8_encode(&self) -> Bytes { tick(self.0.len() as u64); Bytes::lit(self.0.as_bytes()) }
pub fn split_exact(&self, delimiter: &Str, maximum: u32) -> Option<List<Str>> { if delimiter.0.is_empty() { return None; }; chars(&self.0); let mut fields: Vec<Str> = Vec::new(); for piece in self.0.split(&*delimiter.0) { fields.push(Str::lit(piece)); }; if fields.len() as u128 > u128::from(maximum) { return None; }; Some(List::onto(fields, List::nil())) }
pub fn join(texts: List<Str>, delimiter: &Str) -> Str { let mut out = String::new(); let mut first = true; let mut cursor = &texts; while let Repr::Cell(cell) = &cursor.0 { tick(1); if !first { chars(&delimiter.0); out.push_str(&delimiter.0); }; first = false; chars(&cell.head.0); out.push_str(&cell.head.0); cursor = &cell.tail; }; match &cursor.0 { Repr::Run { buffer, len } => { for text in buffer[..*len].iter().rev() { tick(1); if !first { chars(&delimiter.0); out.push_str(&delimiter.0); }; first = false; chars(&text.0); out.push_str(&text.0); } }, _ => { }, }; Str::lit(&out) }
pub fn parse_int(text: &Str) -> Option<Option<i64>> { match canonical_decimal(&text.0) { None => Some(None), Some(Some(n)) => match i64::try_from(n) { Ok(value) => Some(Some(value)), Err(_) => None, }, Some(None) => None, } }
pub fn format_u8(a: u8) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_u8(text: &Str) -> Option<u8> { match canonical_decimal(&text.0) { Some(Some(n)) => u8::try_from(n).ok(), _ => None, } }
pub fn format_u16(a: u16) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_u16(text: &Str) -> Option<u16> { match canonical_decimal(&text.0) { Some(Some(n)) => u16::try_from(n).ok(), _ => None, } }
pub fn format_u32(a: u32) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_u32(text: &Str) -> Option<u32> { match canonical_decimal(&text.0) { Some(Some(n)) => u32::try_from(n).ok(), _ => None, } }
pub fn format_u64(a: u64) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_u64(text: &Str) -> Option<u64> { match canonical_decimal(&text.0) { Some(Some(n)) => u64::try_from(n).ok(), _ => None, } }
pub fn format_i8(a: i8) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_i8(text: &Str) -> Option<i8> { match canonical_decimal(&text.0) { Some(Some(n)) => i8::try_from(n).ok(), _ => None, } }
pub fn format_i16(a: i16) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_i16(text: &Str) -> Option<i16> { match canonical_decimal(&text.0) { Some(Some(n)) => i16::try_from(n).ok(), _ => None, } }
pub fn format_i32(a: i32) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_i32(text: &Str) -> Option<i32> { match canonical_decimal(&text.0) { Some(Some(n)) => i32::try_from(n).ok(), _ => None, } }
pub fn format_i64(a: i64) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }
pub fn parse_i64(text: &Str) -> Option<i64> { match canonical_decimal(&text.0) { Some(Some(n)) => i64::try_from(n).ok(), _ => None, } }
}

#[derive(Clone)]
Expand Down Expand Up @@ -703,40 +720,6 @@ impl Key for Str {

pub fn canonical_decimal(text: &str) -> Option<Option<i128>> { let digits = match text.strip_prefix('-') { Some(rest) => rest, None => text, }; let mut canonical = !digits.is_empty() && (digits == "0" || !digits.starts_with('0')) && text != "-0"; for c in digits.chars() { tick(1); canonical = canonical && c.is_ascii_digit(); }; if !canonical { return None; }; Some(text.parse::<i128>().ok()) }

pub fn parse_int(text: Str) -> R<Option<i64>> { match canonical_decimal(&text.0) { None => Ok(None), Some(Some(n)) => match i64::try_from(n) { Ok(value) => Ok(Some(value)), Err(_) => Err(Overflow), }, Some(None) => Err(Overflow), } }

pub fn format_u8(a: u8) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_u8(text: Str) -> Option<u8> { match canonical_decimal(&text.0) { Some(Some(n)) => u8::try_from(n).ok(), _ => None, } }

pub fn format_u16(a: u16) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_u16(text: Str) -> Option<u16> { match canonical_decimal(&text.0) { Some(Some(n)) => u16::try_from(n).ok(), _ => None, } }

pub fn format_u32(a: u32) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_u32(text: Str) -> Option<u32> { match canonical_decimal(&text.0) { Some(Some(n)) => u32::try_from(n).ok(), _ => None, } }

pub fn format_u64(a: u64) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_u64(text: Str) -> Option<u64> { match canonical_decimal(&text.0) { Some(Some(n)) => u64::try_from(n).ok(), _ => None, } }

pub fn format_i8(a: i8) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_i8(text: Str) -> Option<i8> { match canonical_decimal(&text.0) { Some(Some(n)) => i8::try_from(n).ok(), _ => None, } }

pub fn format_i16(a: i16) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_i16(text: Str) -> Option<i16> { match canonical_decimal(&text.0) { Some(Some(n)) => i16::try_from(n).ok(), _ => None, } }

pub fn format_i32(a: i32) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_i32(text: Str) -> Option<i32> { match canonical_decimal(&text.0) { Some(Some(n)) => i32::try_from(n).ok(), _ => None, } }

pub fn format_i64(a: i64) -> Str { let text = a.to_string(); tick(text.len() as u64); Str::lit(&text) }

pub fn parse_i64(text: Str) -> Option<i64> { match canonical_decimal(&text.0) { Some(Some(n)) => i64::try_from(n).ok(), _ => None, } }

pub fn append_list<T: Clone>(p0: List<T>, p1: List<T>) -> List<T> {
List::append(p0, p1)
}
Expand Down Expand Up @@ -793,6 +776,85 @@ pub fn join(p0: List<Str>, p1: Str) -> Str {
Str::join(p0, &p1)
}

pub fn format_u8(p0: u8) -> Str {
Str::format_u8(p0)
}

pub fn parse_u8(p0: Str) -> Option<u8> {
Str::parse_u8(&p0)
}

pub fn format_u16(p0: u16) -> Str {
Str::format_u16(p0)
}

pub fn parse_u16(p0: Str) -> Option<u16> {
Str::parse_u16(&p0)
}

pub fn format_u32(p0: u32) -> Str {
Str::format_u32(p0)
}

pub fn parse_u32(p0: Str) -> Option<u32> {
Str::parse_u32(&p0)
}

pub fn format_u64(p0: u64) -> Str {
Str::format_u64(p0)
}

pub fn parse_u64(p0: Str) -> Option<u64> {
Str::parse_u64(&p0)
}

pub fn format_i8(p0: i8) -> Str {
Str::format_i8(p0)
}

pub fn parse_i8(p0: Str) -> Option<i8> {
Str::parse_i8(&p0)
}

pub fn format_i16(p0: i16) -> Str {
Str::format_i16(p0)
}

pub fn parse_i16(p0: Str) -> Option<i16> {
Str::parse_i16(&p0)
}

pub fn format_i32(p0: i32) -> Str {
Str::format_i32(p0)
}

pub fn parse_i32(p0: Str) -> Option<i32> {
Str::parse_i32(&p0)
}

pub fn format_i64(p0: i64) -> Str {
Str::format_i64(p0)
}

pub fn parse_i64(p0: Str) -> Option<i64> {
Str::parse_i64(&p0)
}

pub fn parse_int(p0: Str) -> R<Option<i64>> {
match Str::parse_int(&p0) {
Some(v0) => {
Ok(v0)
}
None => {
Err::<Option<i64>, Overflow>(Overflow)
}
}
}

pub fn format_int(p0: i64) -> Str {
Str::format_i64(p0)
}

#[derive(Clone)]
pub enum Adt0 {
C0(Str, Str, Str, Str, Str, Str, Str, List<Str>, List<Str>, bool, Str, Str, Str, Option<Str>, Option<Str>, Option<Str>, Str, Str, Str, Str, Str, Str, Str, List<Adt1>, Option<Str>, Option<Str>, Option<Str>),
Expand Down
2 changes: 1 addition & 1 deletion bindings/generated/prism_bindings_python/package.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/generated/prism_bindings_python/provenance.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"compiler_semantics":"1427f8b629013648a480454d67202788f2303f5396f1d7c70a7c350ddab6f694","effects":["allocation","overflow","recursion"],"exports":[{"function":0,"name":"run"}],"files":{"Cargo.toml":"685c22deab06866c3dc358115592c077b06d81d8c7c77103af1c2ba1b868423a","src/lib.rs":"1484465a0e22a4313b05a7b420effe6bacb058609b179def874df4f1792465d7"},"name":"prism_bindings_python","profile":"rust-std","program":"0c141b7d9fb43716ce72effd935116ca230e276f4eb5e17d26299b01cf2198c1","runtime":"4bb6ab6dc7e2fc1a587876290fac070f499170ff7609aee0fd924aa8fd7bcab7","sources":["096d0163ca943f11ee0e182348796fd8e0bfb361fd771354fdc222a03c296e6b"],"spec":"lexlean/rust-provenance/1","version":"0.1.0"}
{"compiler_semantics":"e1b2447a28c98f87a7782a4fd4786044db3fff53fd2a76dbd5e4071fd6a6721d","effects":["allocation","overflow","recursion"],"exports":[{"function":0,"name":"run"}],"files":{"Cargo.toml":"685c22deab06866c3dc358115592c077b06d81d8c7c77103af1c2ba1b868423a","src/lib.rs":"83336ede04693286a6beb3c8881333b03d377bafb0e0d4e53f8dc9f069138aff"},"name":"prism_bindings_python","profile":"rust-std","program":"0c141b7d9fb43716ce72effd935116ca230e276f4eb5e17d26299b01cf2198c1","runtime":"72477f9e44fe54531b9c68f2b547db7300563373df9d8d29fa5632b8a9d7c14c","sources":["859d04492a8c20d9b57e181e8a91efb494fb66cefff9d98f1820adbc6cdcaec0"],"spec":"lexlean/rust-provenance/1","version":"0.1.0"}
Loading
Loading