From a077af367aea4aafb851fae426bffe0a1d20932d Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 27 Jul 2026 11:26:31 +0000 Subject: [PATCH 01/10] Document the Noir version update process Describes every place the targeted Noir version is referenced, the update procedure, and the testing steps that validate an update. --- docs/Updating Noir Version.md | 91 +++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 docs/Updating Noir Version.md diff --git a/docs/Updating Noir Version.md b/docs/Updating Noir Version.md new file mode 100644 index 00000000..45a8cfc9 --- /dev/null +++ b/docs/Updating Noir Version.md @@ -0,0 +1,91 @@ +# Updating the Targeted Noir Version + +Each version of Lampe targets exactly one version of the Noir compiler. The **single source of +truth** for that version is the `rev` field of the `noirc_driver` dependency in the top-level +[`Cargo.toml`](../Cargo.toml): the helper `read_noir_version()` in +[`scripts/utils.xsh`](../scripts/utils.xsh) reads it, and CI +([`scripts/check_noir_version_consistency.xsh`](../scripts/check_noir_version_consistency.xsh)) +asserts that everything else in the repository agrees with it. + +## Where the Noir version is referenced + +| Location | What it is | +| --- | --- | +| `Cargo.toml` | Six git dependencies on `noir-lang/noir` (`fm`, `nargo`, `nargo_toml`, `noirc_driver`, `noirc_errors`, `noirc_frontend`), all pinned to the same `rev`. | +| `Cargo.lock` | Locked copies of the above; regenerated by cargo. | +| `.github/workflows/ci-noir.yaml` | Checks out `noir-lang/noir` at the same `ref` to run Lampe over Noir's `test_programs`. | +| `stdlib/Nargo.toml` | The `version` field must match the Noir release (e.g. `1.0.0-beta.25`). This version is baked into the extracted package name (`std-`). Note this is Lampe's own wrapper manifest, and it is what *names* the extracted stdlib package — it has historically drifted from the actual pinned compiler rev (the tree pinned the beta.19 release commit while still naming the package `std-1.0.0-beta.14`), so make a point of setting it to the real release. | +| `stdlib/src/` | A vendored copy of `noir_stdlib/src` from the pinned rev. CI diffs it against a fresh checkout. | +| `stdlib/lampe/` | The extracted Lean stdlib. The version appears in the `std-/` directory name, `std-.lean`, the `lakefile.toml` package/lib names, and in every `import std-.…` / `namespace` in the handwritten theorem files under `stdlib/lampe/Stdlib/`. | +| `testing/*/lampe/**` | Committed extraction snapshots. Their generated `lakefile.toml` files require `std-`, and generated `Extracted/` code may change with the compiler. CI re-extracts each test project and fails if the result differs from the committed snapshot. | +| `src/` (the extractor) | Compiles against `noirc_frontend` internals, so compiler API changes between Noir releases must be ported here. | +| `Lampe/Lampe/Crypto/EmbeddedCurve.lean` | Hard-codes versioned extracted struct names (`«std-::embedded_curve_ops::EmbeddedCurvePoint»` / `…Scalar»`) so the crypto builtins line up with the extracted stdlib types. | +| `docker/ci/Dockerfile` | Builds `nargo` at the pinned rev. **No manual edit needed** — `scripts/ci/read_toolchain_versions.py` derives `NOIR_REV` (and the image tag) from `Cargo.toml`. | + +## Update procedure + +1. **Find the commit hash** for the target release: + + ```bash + git ls-remote https://github.com/noir-lang/noir refs/tags/v + ``` + +2. **Update `Cargo.toml`**: set the `rev` of all six `noir-lang/noir` dependencies to that hash. + +3. **Update `.github/workflows/ci-noir.yaml`**: set the `ref` of the `Checkout Noir Repo` step to + the same hash. + +4. **Port the extractor**: run `cargo build` and fix any compile errors caused by changes to the + `noirc_frontend` / `nargo` APIs between the two releases. This regenerates `Cargo.lock` as a + side effect (if version resolution conflicts appear between the new noir crates and old locked + versions, a full `cargo update` is the simplest fix). This step is where the real work usually + is; the rest is mechanical. Note that `cargo test` fixtures in `src/lib.rs` are written in + Noir, so *language*-level changes (removed methods, changed literal rules, etc.) can require + updating the fixtures themselves, not just the extractor. + +5. **Re-vendor the Noir stdlib**: + - Replace `stdlib/src/` with `noir_stdlib/src` from the pinned rev (see + `scripts/download_stdlib.xsh`). + - Set `version` in `stdlib/Nargo.toml` to the new release version. + +6. **Re-extract the Lean stdlib** (`stdlib/extract.xsh`, or manually: + `cargo build --release && cd stdlib && ../target/release/lampe --root ./ --target ./`; expect + this to run for several minutes). Then: + - Delete the old `stdlib/lampe/std-/` directory and `std-.lean`; + the extraction writes new ones named after the new version. + - Update `stdlib/lampe/lakefile.toml` (package name, default targets, lean_lib name) if the + extraction did not already rewrite them. + - Rename every `std-` reference in the handwritten theorem files under + `stdlib/lampe/Stdlib/` (imports and namespaces). + - Review the diff of the extracted code: stdlib functions added/changed/removed between the + Noir releases will need corresponding new or fixed theorems in `stdlib/lampe/Stdlib/`. + +7. **Re-extract the testing snapshots**: `./testing/test.xsh --update` (per test: + `./testing/test.xsh -t --update`). This refreshes the committed `lampe/` outputs, + including their `std-` dependency references. + +8. **If builtins changed**: new/removed compiler builtins surface as extractor errors or as new + `Lampe.Builtin.*` names in extracted code; implement them in `Lampe/Lampe/Builtin/` and hook + them up in the semantics before the Lean builds can succeed. + +## Testing the update + +Run these in order — each one gates the next: + +1. **Version consistency**: `./scripts/check_noir_version_consistency.xsh` — asserts all pins + match and that `stdlib/src` is byte-identical with `noir_stdlib/src` at the pinned rev. +2. **Extractor**: `cargo build && cargo test` — unit tests plus extraction golden tests must pass + against the new compiler. +3. **Lampe library**: `cd Lampe && lake exe cache get && lake build` — the semantics library + still proves. +4. **Extracted stdlib + theorems**: `cd stdlib/lampe && lake build` (CI equivalent: + `./stdlib/test.xsh`, which also checks the extraction is reproducible against the committed + tree). This is the main signal that the *semantics* still match: the handwritten theorems in + `Stdlib/` must still prove against the freshly extracted definitions. +5. **End-to-end tests**: `./testing/test.xsh` — re-extracts each project under `testing/`, + asserts the output matches the committed snapshot, and runs `lake build` on each (so the + example proofs still hold). +6. **Noir test programs** (CI: `ci-noir.yaml`, or locally + `./testing_noir/test.xsh --noir-path `): runs the extractor over the Noir + repository's `test_programs` to check the extractor handles the full language surface without + crashing. From 45257c9f581d48b6d6702997baed772d2b5a8fc8 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 27 Jul 2026 11:26:45 +0000 Subject: [PATCH 02/10] Target Noir 1.0.0-beta.25 in the extractor Bumps the pinned noir-lang/noir rev (previously the beta.19 release commit) to the v1.0.0-beta.25 tag and ports the extractor to the new noirc APIs: - DependencyId::Struct is now DependencyId::DataType. - Type::Constant carries a comptime Integer instead of a (FieldElement, Kind) pair, and Type::Array's element/size order flipped to Array(E, N). - HirLiteral::Integer holds a BigInt and HirLiteral::Str holds bytes. - Attributes::get_deprecated_note was replaced by get_deprecated, and SecondaryAttributeKind::Deprecated gained a deny flag. - QuotedType::Location and HirStatement::TraitAssociatedConstant are new; the latter also surfaces as placeholder globals which are now skipped. - activate_lsp_mode and report_all grew parameters; u1 is gone. - Builtin/foreign trait impl methods no longer have elaborated bodies, so a body forwarding to the intrinsic is synthesized instead. - Trait default methods materialize per impl with Self bound to itself; Self is now resolved to the impl's concrete type (and excluded from generic patterns) while generating an impl, and identity type-variable bindings no longer recurse forever. The in-crate Noir test fixtures are updated for language changes (as_slice -> as_vector, signed type-level constants need suffixed literals). --- .github/workflows/ci-noir.yaml | 2 +- Cargo.lock | 1501 +++++++++++++++----------------- Cargo.toml | 12 +- src/bin/main.rs | 1 + src/lean/builtin.rs | 1 - src/lean/generator.rs | 200 ++++- src/lib.rs | 4 +- src/noir/project.rs | 4 +- 8 files changed, 897 insertions(+), 828 deletions(-) diff --git a/.github/workflows/ci-noir.yaml b/.github/workflows/ci-noir.yaml index c53027ad..1dbce1c4 100644 --- a/.github/workflows/ci-noir.yaml +++ b/.github/workflows/ci-noir.yaml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@v6 with: repository: noir-lang/noir - ref: 74d6be658e1ad252f87943292ba09bdd4da80bd4 + ref: 75061fab15986eedee4e7d9104ff87dd9fa4ca10 path: noir - name: Ensure Test Programs Up To Date working-directory: noir/test_programs diff --git a/Cargo.lock b/Cargo.lock index ec99040e..95dd8b2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,15 +4,15 @@ version = 4 [[package]] name = "acir" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acir_field", "base64", "brillig", "flate2", - "noirc_span", - "num-bigint", + "msgpack_tagged", + "num-bigint 0.5.1", "num-traits", "num_enum", "rmp-serde", @@ -20,42 +20,44 @@ dependencies = [ "serde-big-array", "strum", "strum_macros", - "thiserror 1.0.69", + "thiserror", ] [[package]] name = "acir_field" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "ark-bn254", "ark-ff", - "ark-std", "cfg-if", "hex", - "num-bigint", + "msgpack_tagged", + "num-bigint 0.5.1", "serde", + "serde_bytes", ] [[package]] name = "acvm" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acir", "acvm_blackbox_solver", "brillig_vm", - "indexmap 2.13.0", + "indexmap 2.14.0", + "itertools 0.15.0", "rustc-hash", "serde", - "thiserror 1.0.69", + "thiserror", "tracing", ] [[package]] name = "acvm_blackbox_solver" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acir", "aes", @@ -66,8 +68,8 @@ dependencies = [ "keccak", "log", "p256", - "sha2 0.11.0-rc.5", - "thiserror 1.0.69", + "sha2 0.11.0", + "thiserror", ] [[package]] @@ -78,13 +80,13 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aes" -version = "0.8.4" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +checksum = "f8eb277bec05f56a0e0591f155a484cbd0f4f07ff2905051a48c72f004f7ed58" dependencies = [ - "cfg-if", "cipher", - "cpufeatures 0.2.17", + "cpubits", + "cpufeatures 0.3.0", ] [[package]] @@ -116,9 +118,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.21" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -131,15 +133,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] @@ -164,17 +166,11 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "anyhow" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" - [[package]] name = "ark-bn254" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +checksum = "6bc66f96ebe2a17a499475b4f94791d379817592ef494171586967ffdc6f95db" dependencies = [ "ark-ec", "ark-ff", @@ -183,9 +179,9 @@ dependencies = [ [[package]] name = "ark-ec" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +checksum = "8352a2b2aedf6ba2cc38f7520fc51191d518dde96175c729af19f2d059f191c4" dependencies = [ "ahash", "ark-ff", @@ -194,9 +190,9 @@ dependencies = [ "ark-std", "educe", "fnv", - "hashbrown 0.15.5", - "itertools 0.13.0", - "num-bigint", + "hashbrown 0.17.1", + "itertools 0.14.0", + "num-bigint 0.4.8", "num-integer", "num-traits", "zeroize", @@ -204,52 +200,49 @@ dependencies = [ [[package]] name = "ark-ff" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +checksum = "f7a806ac6c8307b929df4645776290a50ee2aac754ad09d8bdf73391309e43af" dependencies = [ "ark-ff-asm", "ark-ff-macros", "ark-serialize", "ark-std", - "arrayvec", "digest 0.10.7", "educe", - "itertools 0.13.0", - "num-bigint", + "num-bigint 0.4.8", "num-traits", - "paste", "zeroize", ] [[package]] name = "ark-ff-asm" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +checksum = "1479009684adc073dff49a1025d3a7065b317a9ead25aaaca38cdc70058ba8a2" dependencies = [ "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "ark-ff-macros" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +checksum = "4a0691ed21ef00ef89c1e9bda832eba493dda3ec2f8d892fb25b705f73f06bb8" dependencies = [ - "num-bigint", + "num-bigint 0.4.8", "num-traits", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "ark-grumpkin" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef677b59f5aff4123207c4dceb1c0ec8fdde2d4af7886f48be42ad864bfa0352" +checksum = "c2c969a12ceed8881e5c66277dabd3e7a5aa2c72c9370f3f42eca3f2dd33a21a" dependencies = [ "ark-bn254", "ark-ec", @@ -259,9 +252,9 @@ dependencies = [ [[package]] name = "ark-poly" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +checksum = "75f55af10b672002b8d953e230282c51206842e20e5791a94432219b4201de5c" dependencies = [ "ahash", "ark-ff", @@ -269,41 +262,40 @@ dependencies = [ "ark-std", "educe", "fnv", - "hashbrown 0.15.5", + "hashbrown 0.17.1", ] [[package]] name = "ark-serialize" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +checksum = "a74dd304fd536fb95d0a328e72be759209cc496a9da094c5bc56e5fea4f9e86b" dependencies = [ "ark-serialize-derive", "ark-std", - "arrayvec", "digest 0.10.7", - "num-bigint", + "num-bigint 0.4.8", ] [[package]] name = "ark-serialize-derive" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +checksum = "4f153690697a2b91e5e1251ff98411ee5371500a111a0fd317a70e588eb300f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "ark-std" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +checksum = "367c9c827ed431bff6868b7aa926e05b16eb46603cc8b6e768e4a5553fa1d155" dependencies = [ "num-traits", - "rand 0.8.5", + "rand 0.8.7", ] [[package]] @@ -314,26 +306,26 @@ checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" [[package]] name = "async-trait" -version = "0.1.89" +version = "0.1.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 3.0.3", ] [[package]] name = "autocfg" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "base16ct" @@ -353,19 +345,13 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" -[[package]] -name = "binary-merge" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597bb81c80a54b6a4381b23faba8d7774b144c94cbd1d6fe3f1329bd776554ab" - [[package]] name = "bit-set" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ - "bit-vec", + "bit-vec 0.8.0", ] [[package]] @@ -374,11 +360,20 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" -version = "2.11.0" +version = "2.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" [[package]] name = "bitmaps" @@ -391,25 +386,25 @@ dependencies = [ [[package]] name = "blake2" -version = "0.11.0-rc.5" +version = "0.11.0-rc.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52965399b470437fc7f4d4b51134668dbc96573fea6f1b83318a420e4605745" +checksum = "061f1a09225e328e1ffbb378d2d49923c0ca5fee19fb5ac1cc9c1e9d52b93690" dependencies = [ - "digest 0.11.1", + "digest 0.11.3", ] [[package]] name = "blake3" -version = "1.8.3" +version = "1.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2468ef7d57b3fb7e16b576e8377cdbde2320c60e1491e961d11da40fc4f02a2d" +checksum = "0aa83c34e62843d924f905e0f5c866eb1dd6545fc4d719e803d9ba6030371fce" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", - "cpufeatures 0.2.17", + "cpufeatures 0.3.0", ] [[package]] @@ -423,26 +418,26 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" dependencies = [ "hybrid-array", ] [[package]] name = "block-padding" -version = "0.3.3" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +checksum = "710f1dd022ef4e93f8a438b4ba958de7f64308434fa6a87104481645cc30068b" dependencies = [ - "generic-array", + "hybrid-array", ] [[package]] name = "bn254_blackbox_solver" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acir", "acvm_blackbox_solver", @@ -451,36 +446,50 @@ dependencies = [ "ark-ff", "ark-grumpkin", "hex", + "itertools 0.15.0", ] [[package]] name = "borsh" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" +checksum = "a88b7ea17d208c4193f2c1e6de3c35fe71f98c96982d5ced308bdcc749ff6e1f" dependencies = [ + "bytes", "cfg_aliases", ] [[package]] name = "brillig" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acir_field", + "itertools 0.15.0", + "msgpack_tagged", "serde", ] [[package]] name = "brillig_vm" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acir", "acvm_blackbox_solver", - "num-bigint", + "itertools 0.15.0", + "num-bigint 0.5.1", "num-traits", - "thiserror 1.0.69", + "thiserror", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", ] [[package]] @@ -495,30 +504,30 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.20.2" +version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" [[package]] name = "bytes" -version = "1.11.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "cbc" -version = "0.1.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +checksum = "ce2dc9ee5f88d11e0beb842c88b33c8a5cf0d1329c4b19494af42b07dbfe8896" dependencies = [ "cipher", ] [[package]] name = "cc" -version = "1.2.56" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9" dependencies = [ "find-msvc-tools", "shlex", @@ -532,15 +541,26 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] [[package]] name = "chrono" -version = "0.4.44" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", "js-sys", @@ -552,19 +572,19 @@ dependencies = [ [[package]] name = "cipher" -version = "0.4.4" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" dependencies = [ - "crypto-common 0.1.7", + "crypto-common 0.2.2", "inout", ] [[package]] name = "clap" -version = "4.5.60" +version = "4.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" +checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7" dependencies = [ "clap_builder", "clap_derive", @@ -572,9 +592,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.60" +version = "4.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" +checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b" dependencies = [ "anstream", "anstyle", @@ -584,33 +604,33 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.55" +version = "4.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", - "syn 2.0.117", + "syn 3.0.3", ] [[package]] name = "clap_lex" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "cmov" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0758edba32d61d1fd9f4d69491b47604b91ee2f7e6b33de7e54ca4ebe55dc3" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" [[package]] name = "codespan" -version = "0.11.1" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3362992a0d9f1dd7c3d0e89e0ab2bb540b7a95fea8cd798090e758fda2899b5e" +checksum = "583f52b0658b321b25fd6b209b6c76cf058f433071297de64e5980c3d9aad937" dependencies = [ "codespan-reporting", "serde", @@ -618,9 +638,9 @@ dependencies = [ [[package]] name = "codespan-reporting" -version = "0.11.1" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" dependencies = [ "serde", "termcolor", @@ -629,9 +649,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "const-oid" @@ -662,9 +682,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpubits" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef0c543070d296ea414df2dd7625d1b24866ce206709d8a4a424f28377f5861" +checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae" [[package]] name = "cpufeatures" @@ -695,9 +715,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -705,31 +725,31 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" [[package]] name = "crypto-bigint" -version = "0.7.1" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fde2467e74147f492aebb834985186b2c74761927b8b9b3bd303bcb2e72199d" +checksum = "1a52aa3fcda4e6302a9f48734f234d35d4721b96f8fe07d073f07ce9df4f0271" dependencies = [ "cpubits", "ctutils", - "getrandom 0.4.2", + "getrandom 0.4.3", "hybrid-array", "num-traits", - "rand_core 0.10.0", + "rand_core 0.10.1", "subtle", "zeroize", ] @@ -746,20 +766,20 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ - "getrandom 0.4.2", + "getrandom 0.4.3", "hybrid-array", - "rand_core 0.10.0", + "rand_core 0.10.1", ] [[package]] name = "ctutils" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1005a6d4446f5120ef475ad3d2af2b30c49c2c9c6904258e3bb30219bebed5e4" +checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" dependencies = [ "cmov", "subtle", @@ -767,9 +787,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" dependencies = [ "darling_core", "darling_macro", @@ -777,34 +797,33 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" dependencies = [ - "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "darling_macro" -version = "0.21.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "der" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fd89660b2dc699704064e59e9dba0147b903e85319429e131620d022be411b" +checksum = "a69dedd701da44b0536442edf09c81a64b0ab97a7a4a5e3d1971f00027cbc63d" dependencies = [ "const-oid", "pem-rfc7468", @@ -817,7 +836,6 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ - "powerfmt", "serde_core", ] @@ -844,13 +862,13 @@ dependencies = [ [[package]] name = "digest" -version = "0.11.1" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "285743a676ccb6b3e116bc14cc69319b957867930ae9c4822f8e0f54509d7243" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ - "block-buffer 0.12.0", + "block-buffer 0.12.1", "const-oid", - "crypto-common 0.2.1", + "crypto-common 0.2.2", "ctutils", ] @@ -877,13 +895,13 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] @@ -894,12 +912,12 @@ checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "ecdsa" -version = "0.17.0-rc.16" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91bbdd377139884fafcad8dc43a760a3e1e681aa26db910257fa6535b70e1829" +checksum = "c0681a4fc24c767085329728d8dfba959af91228aa4610cca4f8ce317ba46ae0" dependencies = [ "der", - "digest 0.11.1", + "digest 0.11.3", "elliptic-curve", "rfc6979", "signature", @@ -916,32 +934,31 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "either" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d" [[package]] name = "elliptic-curve" -version = "0.14.0-rc.29" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e84043d573efd4ac9d2d125817979a379204bf7e328b25a4a30487e8d100e618" +checksum = "9d65aa39b3a5c1c9c1b745c9a019234bb7a21b77abcb4f4d266d706e2d577d65" dependencies = [ "base16ct", "crypto-bigint", - "crypto-common 0.2.1", - "digest 0.11.1", + "crypto-common 0.2.2", + "digest 0.11.3", + "ff", + "group", "hybrid-array", - "once_cell", "pem-rfc7468", "pkcs8", - "rand_core 0.10.0", - "rustcrypto-ff", - "rustcrypto-group", + "rand_core 0.10.1", "sec1", "subtle", "zeroize", @@ -949,22 +966,22 @@ dependencies = [ [[package]] name = "enum-ordinalize" -version = "4.3.2" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +checksum = "07f808d588c10e464ea6f7d3eaed500049eff30aaac103460f61828c2d65b3eb" dependencies = [ "enum-ordinalize-derive", ] [[package]] name = "enum-ordinalize-derive" -version = "4.3.2" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" +checksum = "42e528e2d34ba8a67a1a650b86beae8ef69fc5fdb638016f386b973226590432" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] @@ -985,9 +1002,19 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "ff" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f686ab92a9fb0eaf188f6c6c87b89490baa6fdb0db4544ba4dc47f7942489f" +dependencies = [ + "rand_core 0.10.1", + "subtle", +] [[package]] name = "find-msvc-tools" @@ -1013,8 +1040,8 @@ dependencies = [ [[package]] name = "fm" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "codespan-reporting", "iter-extended", @@ -1054,27 +1081,27 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" [[package]] name = "futures-sink" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" +checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" [[package]] name = "futures-task" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" +checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" [[package]] name = "futures-util" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" dependencies = [ "futures-core", "futures-sink", @@ -1118,16 +1145,25 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", "libc", "r-efi 6.0.0", - "rand_core 0.10.0", - "wasip2", - "wasip3", + "rand_core 0.10.1", +] + +[[package]] +name = "group" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd1a1c7a5206c5b7a3f5a0d7ccd3ff85d0c8f5133d62a02680255b0004af5f4" +dependencies = [ + "ff", + "rand_core 0.10.1", + "subtle", ] [[package]] @@ -1142,21 +1178,17 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "allocator-api2", "foldhash", ] [[package]] name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" - -[[package]] -name = "heck" -version = "0.4.1" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "allocator-api2", +] [[package]] name = "heck" @@ -1172,18 +1204,18 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hmac" -version = "0.13.0-rc.5" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef451d73f36d8a3f93ad32c332ea01146c9650e1ec821a9b0e46c01277d544f8" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" dependencies = [ - "digest 0.11.1", + "digest 0.11.3", ] [[package]] name = "http" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" dependencies = [ "bytes", "itoa", @@ -1191,9 +1223,9 @@ dependencies = [ [[package]] name = "hybrid-array" -version = "0.4.8" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8655f91cd07f2b9d0c24137bd650fe69617773435ee5ec83022377777ce65ef1" +checksum = "818356c5132c1fede50f837ca96afbe78ff42413047f4abb886217845e1b6c8c" dependencies = [ "subtle", "typenum", @@ -1226,12 +1258,13 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" dependencies = [ "displaydoc", "potential_utf", + "utf8_iter", "yoke", "zerofrom", "zerovec", @@ -1239,9 +1272,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" dependencies = [ "displaydoc", "litemap", @@ -1252,9 +1285,9 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" dependencies = [ "icu_collections", "icu_normalizer_data", @@ -1266,15 +1299,15 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" [[package]] name = "icu_properties" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" dependencies = [ "icu_collections", "icu_locale_core", @@ -1286,15 +1319,15 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" [[package]] name = "icu_provider" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" dependencies = [ "displaydoc", "icu_locale_core", @@ -1305,12 +1338,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - [[package]] name = "ident_case" version = "1.0.1" @@ -1330,9 +1357,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" dependencies = [ "icu_normalizer", "icu_properties", @@ -1366,33 +1393,24 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.13.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "serde", "serde_core", ] [[package]] name = "inout" -version = "0.1.4" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +checksum = "4250ce6452e92010fdf7268ccc5d14faa80bb12fc741938534c58f16804e03c7" dependencies = [ "block-padding", - "generic-array", -] - -[[package]] -name = "inplace-vec-builder" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf64c2edc8226891a71f127587a2861b132d2b942310843814d5001d99a1d307" -dependencies = [ - "smallvec", + "hybrid-array", ] [[package]] @@ -1403,57 +1421,58 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "iter-extended" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" [[package]] name = "itertools" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] [[package]] name = "itertools" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" -version = "0.3.91" +version = "0.3.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" dependencies = [ - "once_cell", + "cfg-if", + "futures-util", "wasm-bindgen", ] [[package]] name = "jsonrpsee" -version = "0.25.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fba77a59c4c644fd48732367624d1bcf6f409f9c9a286fbc71d2f1fc0b2ea16" +checksum = "3f3f48dc3e6b8bd21e15436c1ddd0bc22a6a54e8ec46fedd6adf3425f396ec6a" dependencies = [ "jsonrpsee-core", ] [[package]] name = "jsonrpsee-core" -version = "0.25.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693c93cbb7db25f4108ed121304b671a36002c2db67dff2ee4391a688c738547" +checksum = "316c96719901f05d1137f19ba598b5fe9c9bc39f4335f67f6be8613921946480" dependencies = [ "async-trait", "futures-util", @@ -1462,7 +1481,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "thiserror 2.0.18", + "thiserror", "tokio", "tower", "tracing", @@ -1470,35 +1489,38 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.25.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66df7256371c45621b3b7d2fb23aea923d577616b9c0e9c0b950a6ea5c2be0ca" +checksum = "bc88ff4688e43cc3fa9883a8a95c6fa27aa2e76c96e610b737b6554d650d7fd5" dependencies = [ "http", "serde", "serde_json", - "thiserror 2.0.18", + "thiserror", ] [[package]] name = "k256" -version = "0.14.0-rc.8" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2c6c227649d5ec80eaae541f1736232641a0bcdb3062a52b34edb42054158" +checksum = "93f50113171a713f4a4231ef82eb26703607139b35dcb56241f0ceab2ae1f7d8" dependencies = [ "cpubits", "ecdsa", "elliptic-curve", - "sha2 0.11.0-rc.5", + "primeorder", + "sha2 0.11.0", "signature", + "wnaf", ] [[package]] name = "keccak" -version = "0.2.0-rc.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "882b69cb15b1f78b51342322a97ccd16f5123d1dc8a3da981a95244f488e8692" +checksum = "9e24a010dd405bd7ed803e5253182815b41bf2e6a80cc3bfc066658e03a198aa" dependencies = [ + "cfg-if", "cpufeatures 0.3.0", ] @@ -1519,34 +1541,22 @@ dependencies = [ "petgraph", "serde", "tempfile", - "thiserror 2.0.18", + "thiserror", "toml 0.9.12+spec-1.1.0", "walkdir", ] -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - [[package]] name = "libc" -version = "0.2.183" +version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" [[package]] name = "libredox" -version = "0.1.14" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" +checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652" dependencies = [ "libc", ] @@ -1559,21 +1569,37 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" [[package]] name = "log" -version = "0.4.29" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" [[package]] name = "memchr" -version = "2.8.0" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] [[package]] name = "miniz_oxide" @@ -1585,15 +1611,35 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "msgpack_tagged" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" +dependencies = [ + "msgpack_tagged_derive", + "rmp", + "rmp-serde", + "serde", + "smallvec", +] + +[[package]] +name = "msgpack_tagged_derive" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "nargo" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acvm", - "brillig", "fm", - "iter-extended", "jsonrpsee", "noir_greybox_fuzzer", "noirc_abi", @@ -1606,15 +1652,16 @@ dependencies = [ "serde", "serde_json", "tempfile", - "thiserror 1.0.69", + "thiserror", "tracing", + "url", "walkdir", ] [[package]] name = "nargo_toml" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "dirs", "fm", @@ -1624,26 +1671,28 @@ dependencies = [ "noirc_frontend", "semver", "serde", - "thiserror 1.0.69", - "toml 0.7.8", + "thiserror", + "toml 0.8.23", + "toml_edit 0.22.27", "tracing", "url", ] [[package]] name = "noir_greybox_fuzzer" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acvm", "build-data", "fm", + "itertools 0.15.0", "noirc_abi", "noirc_artifacts", "num-traits", "proptest", - "rand 0.9.2", - "rand_xorshift", + "rand 0.10.2", + "rand_xorshift 0.5.0", "rayon", "sha256", "termcolor", @@ -1652,29 +1701,30 @@ dependencies = [ [[package]] name = "noirc_abi" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acvm", "iter-extended", + "itertools 0.15.0", "noirc_printable_type", - "num-bigint", + "num-bigint 0.5.1", "num-traits", "serde", "serde_json", - "thiserror 1.0.69", - "toml 0.7.8", + "thiserror", + "toml 0.8.23", ] [[package]] name = "noirc_arena" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" [[package]] name = "noirc_artifacts" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acir", "acvm", @@ -1687,14 +1737,14 @@ dependencies = [ "noirc_printable_type", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "tracing", ] [[package]] name = "noirc_driver" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acvm", "build-data", @@ -1713,34 +1763,37 @@ dependencies = [ [[package]] name = "noirc_errors" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "codespan-reporting", "fm", "noirc_span", + "rangemap", "rustc-hash", "serde", ] [[package]] name = "noirc_evaluator" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acvm", + "bit-vec 0.9.1", "bn254_blackbox_solver", "cfg-if", "chrono", "fm", "im", - "indexmap 2.13.0", + "indexmap 2.14.0", "iter-extended", + "itertools 0.15.0", "noirc_artifacts", "noirc_errors", "noirc_frontend", "noirc_printable_type", - "num-bigint", + "num-bigint 0.5.1", "num-integer", "num-traits", "petgraph", @@ -1751,56 +1804,59 @@ dependencies = [ "serde_json", "serde_with", "smallvec", - "thiserror 1.0.69", + "thiserror", "tracing", - "vec-collections", ] [[package]] name = "noirc_frontend" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acvm", "bn254_blackbox_solver", "cfg-if", "fm", "im", + "indexmap 2.14.0", "iter-extended", + "itertools 0.15.0", "noirc_arena", "noirc_artifacts", "noirc_errors", "noirc_printable_type", - "num-bigint", + "num-bigint 0.5.1", "num-traits", "petgraph", "rangemap", "rustc-hash", "serde", "serde_json", + "siphasher", "small-ord-set", "smol_str", "strum", "strum_macros", - "thiserror 1.0.69", + "thiserror", "tracing", ] [[package]] name = "noirc_printable_type" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "acvm", "iter-extended", + "itertools 0.15.0", "serde", "serde_json", ] [[package]] name = "noirc_span" -version = "1.0.0-beta.19" -source = "git+https://github.com/noir-lang/noir?rev=74d6be658e1ad252f87943292ba09bdd4da80bd4#74d6be658e1ad252f87943292ba09bdd4da80bd4" +version = "1.0.0-beta.25" +source = "git+https://github.com/noir-lang/noir?rev=75061fab15986eedee4e7d9104ff87dd9fa4ca10#75061fab15986eedee4e7d9104ff87dd9fa4ca10" dependencies = [ "codespan", "serde", @@ -1808,9 +1864,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0" dependencies = [ "num-integer", "num-traits", @@ -1818,9 +1884,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-integer" @@ -1842,9 +1908,9 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" dependencies = [ "num_enum_derive", "rustversion", @@ -1852,21 +1918,21 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" @@ -1882,23 +1948,17 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "p256" -version = "0.14.0-rc.8" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f0a10fe314869359cb2901342b045f4e5a962ef9febc006f03d2a8c848fe4c" +checksum = "d2c9239b2dbc807adbbe147e8cf72ea7450c3a0aabe62cb8e75ff4ec22e1f72a" dependencies = [ "ecdsa", "elliptic-curve", "primefield", "primeorder", - "sha2 0.11.0-rc.5", + "sha2 0.11.0", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "pem-rfc7468" version = "1.0.0" @@ -1922,28 +1982,28 @@ checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" dependencies = [ "fixedbitset", "hashbrown 0.15.5", - "indexmap 2.13.0", + "indexmap 2.14.0", "serde", ] [[package]] name = "pin-project" -version = "1.1.11" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.11" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] @@ -1954,9 +2014,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkcs8" -version = "0.11.0-rc.11" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12922b6296c06eb741b02d7b5161e3aaa22864af38dfa025a1a3ba3f68c84577" +checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" dependencies = [ "der", "spki", @@ -1964,9 +2024,9 @@ dependencies = [ [[package]] name = "potential_utf" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" dependencies = [ "zerovec", ] @@ -1986,37 +2046,31 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn 2.0.117", -] - [[package]] name = "primefield" -version = "0.14.0-rc.8" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6543f5eec854fbf74ba5ef651fbdc9408919b47c3e1526623687135c16d12e9" +checksum = "c555a6e4eb7d4e158fcb028c835c3b8642206ddc279b5c6b202ef9a8bdb592f4" dependencies = [ "crypto-bigint", - "crypto-common 0.2.1", - "rand_core 0.10.0", - "rustcrypto-ff", + "crypto-common 0.2.2", + "ff", + "rand_core 0.10.1", "subtle", "zeroize", ] [[package]] name = "primeorder" -version = "0.14.0-rc.8" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "569d9ad6ef822bb0322c7e7d84e5e286244050bd5246cac4c013535ae91c2c90" +checksum = "5c9f42978c78a00e3d68f69fc03e57a234debae69da4020a4fb588fcdcd07b06" dependencies = [ "elliptic-curve", + "once_cell", + "primefield", + "serdect", + "wnaf", ] [[package]] @@ -2025,40 +2079,40 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ - "toml_edit 0.25.4+spec-1.1.0", + "toml_edit 0.25.13+spec-1.1.0", ] [[package]] name = "proc-macro2" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37566cb3fdacef14c0737f9546df7cfeadbfbc9fef10991038bf5015d0c80532" +checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744" dependencies = [ "bit-set", - "bit-vec", + "bit-vec 0.8.0", "bitflags", "num-traits", - "rand 0.9.2", + "rand 0.9.5", "rand_chacha 0.9.0", - "rand_xorshift", + "rand_xorshift 0.4.0", "regex-syntax", "unarray", ] [[package]] name = "quote" -version = "1.0.45" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -2077,9 +2131,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rand" -version = "0.8.5" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" dependencies = [ "rand_chacha 0.3.1", "rand_core 0.6.4", @@ -2087,14 +2141,25 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.5", ] +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -2132,9 +2197,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" [[package]] name = "rand_xorshift" @@ -2145,6 +2210,15 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand_xorshift" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "rand_xoshiro" version = "0.6.0" @@ -2162,9 +2236,9 @@ checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68" [[package]] name = "rayon" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" dependencies = [ "either", "rayon-core", @@ -2188,43 +2262,43 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.17", "libredox", - "thiserror 2.0.18", + "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +checksum = "216e8f773d7923bcba9ceb86a86c93cabb3903a11872fc3f138c49630e50b96d" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +checksum = "2c9283685feec7d69af75fb0e858d5e7378f33fe4fc699383b2916ab9273e03c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 3.0.3", ] [[package]] name = "regex-syntax" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "rfc6979" -version = "0.5.0-rc.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a3127ee32baec36af75b4107082d9bd823501ec14a4e016be4b6b37faa74ae" +checksum = "b4a459cddafb3fe76b31fd8f1108007566c40301feb64dc7b54656eb7388172b" dependencies = [ + "crypto-bigint", "hmac", - "subtle", ] [[package]] @@ -2248,9 +2322,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "8.11.0" +version = "8.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27" +checksum = "e9e7760e252aaba7b09f4be00e36476cf585bdb68a53552ac954cdf504ab4bc9" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -2259,32 +2333,33 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "8.11.0" +version = "8.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa" +checksum = "3bcfc4d6f53af43755f7a723e4b6b8794fcce052a178dd8c6c1dadc5f5343097" dependencies = [ + "mime_guess", "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.117", + "syn 2.0.119", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "8.11.0" +version = "8.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1" +checksum = "42ffa149f6aa81b58a5b3011d01a857c4ed12c7a732d2c51947a4c7c692185f0" dependencies = [ - "sha2 0.10.9", + "sha2 0.11.0", "walkdir", ] [[package]] name = "rustc-hash" -version = "2.1.1" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustc-stable-hash" @@ -2292,27 +2367,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "781442f29170c5c93b7185ad559492601acdc71d5bb0706f5868094f45cfcd08" -[[package]] -name = "rustcrypto-ff" -version = "0.14.0-rc.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5db129183b2c139d7d87d08be57cba626c715789db17aec65c8866bfd767d1f" -dependencies = [ - "rand_core 0.10.0", - "subtle", -] - -[[package]] -name = "rustcrypto-group" -version = "0.14.0-rc.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c4b1463f274a3ff6fb2f44da43e576cb9424367bd96f185ead87b52fe00523" -dependencies = [ - "rand_core 0.10.0", - "rustcrypto-ff", - "subtle", -] - [[package]] name = "rustix" version = "1.1.4" @@ -2328,9 +2382,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "safe-proc-macro2" @@ -2414,9 +2468,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46b9a5ab87780a3189a1d704766579517a04ad59de653b7aad7d38e8a15f7dc" +checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d" dependencies = [ "base16ct", "ctutils", @@ -2428,15 +2482,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" dependencies = [ "serde_core", "serde_derive", @@ -2451,31 +2505,41 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_bytes" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" +dependencies = [ + "serde", + "serde_core", +] + [[package]] name = "serde_core" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 3.0.3", ] [[package]] name = "serde_json" -version = "1.0.149" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" dependencies = [ "itoa", "memchr", @@ -2495,24 +2559,25 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.0.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ "serde_core", ] [[package]] name = "serde_with" -version = "3.17.0" +version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381b283ce7bc6b476d903296fb59d0d36633652b633b27f64db4fb46dcbfc3b9" +checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" dependencies = [ "base64", + "bs58", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.13.0", + "indexmap 2.14.0", "schemars 0.9.0", "schemars 1.2.1", "serde_core", @@ -2523,14 +2588,24 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.17.0" +version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6d4e30573c8cb306ed6ab1dca8423eec9a463ea0e155f45399455e0368b27e0" +checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", +] + +[[package]] +name = "serdect" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66cf8fedced2fcf12406bcb34223dffb92eaf34908ede12fed414c82b7f00b3e" +dependencies = [ + "base16ct", + "serde", ] [[package]] @@ -2546,13 +2621,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.11.0-rc.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5f3b1e2dc8aad28310d8410bd4d7e180eca65fca176c52ab00d364475d0024" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" dependencies = [ "cfg-if", - "cpufeatures 0.2.17", - "digest 0.11.1", + "cpufeatures 0.3.0", + "digest 0.11.3", ] [[package]] @@ -2569,25 +2644,31 @@ dependencies = [ [[package]] name = "shlex" -version = "1.3.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] name = "signature" -version = "3.0.0-rc.10" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f1880df446116126965eeec169136b2e0251dba37c6223bcc819569550edea3" +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" dependencies = [ - "digest 0.11.1", - "rand_core 0.10.0", + "digest 0.11.3", + "rand_core 0.10.1", ] [[package]] name = "simd-adler32" -version = "0.3.8" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "siphasher" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" [[package]] name = "sized-chunks" @@ -2616,9 +2697,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.1" +version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" dependencies = [ "serde", ] @@ -2633,17 +2714,11 @@ dependencies = [ "serde_core", ] -[[package]] -name = "sorted-iter" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bceb57dc07c92cdae60f5b27b3fa92ecaaa42fe36c55e22dbfb0b44893e0b1f7" - [[package]] name = "spki" -version = "0.8.0-rc.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8baeff88f34ed0691978ec34440140e1572b68c7dd4a495fd14a3dc1944daa80" +checksum = "1d9efca8738c78ee9484207732f728b1ef517bbb1833d6fc0879ca898a522f6f" dependencies = [ "base64ct", "der", @@ -2663,21 +2738,20 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.24.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", - "rustversion", - "syn 1.0.109", + "syn 2.0.119", ] [[package]] @@ -2699,9 +2773,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.117" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" dependencies = [ "proc-macro2", "quote", @@ -2716,7 +2801,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] @@ -2726,7 +2811,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.2", + "getrandom 0.4.3", "once_cell", "rustix", "windows-sys", @@ -2743,52 +2828,31 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.18" +version = "2.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" dependencies = [ - "thiserror-impl 2.0.18", + "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.69" +version = "2.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", + "syn 3.0.3", ] [[package]] name = "time" -version = "0.3.47" +version = "0.3.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +checksum = "3e1d5e639ff6bab73cb6885cc7e7b1de96c3f32c68ec55f3952614bec1092244" dependencies = [ "deranged", - "itoa", "num-conv", "powerfmt", "serde_core", @@ -2798,15 +2862,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" [[package]] name = "time-macros" -version = "0.2.27" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" dependencies = [ "num-conv", "time-core", @@ -2814,33 +2878,48 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" dependencies = [ "displaydoc", "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" -version = "1.50.0" +version = "1.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" dependencies = [ "pin-project-lite", ] [[package]] name = "toml" -version = "0.7.8" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", - "toml_edit 0.19.15", + "toml_edit 0.22.27", ] [[package]] @@ -2849,9 +2928,9 @@ version = "0.9.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" dependencies = [ - "indexmap 2.13.0", + "indexmap 2.14.0", "serde_core", - "serde_spanned 1.0.4", + "serde_spanned 1.1.1", "toml_datetime 0.7.5+spec-1.1.0", "toml_parser", "toml_writer", @@ -2878,52 +2957,59 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "1.0.0+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.13.0", + "indexmap 2.14.0", "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", - "winnow 0.5.40", + "toml_write", + "winnow 0.7.15", ] [[package]] name = "toml_edit" -version = "0.25.4+spec-1.1.0" +version = "0.25.13+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7193cbd0ce53dc966037f54351dbbcf0d5a642c7f0038c382ef9e677ce8c13f2" +checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b" dependencies = [ - "indexmap 2.13.0", - "toml_datetime 1.0.0+spec-1.1.0", + "indexmap 2.14.0", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", - "winnow 0.7.15", + "winnow 1.0.4", ] [[package]] name = "toml_parser" -version = "1.0.9+spec-1.1.0" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ - "winnow 0.7.15", + "winnow 1.0.4", ] +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + [[package]] name = "toml_writer" -version = "1.0.6+spec-1.1.0" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" +checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" [[package]] name = "tower" @@ -2966,7 +3052,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] @@ -2980,9 +3066,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.19.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" [[package]] name = "unarray" @@ -2990,6 +3076,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + [[package]] name = "unicode-ident" version = "1.0.24" @@ -2998,15 +3090,15 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-segmentation" -version = "1.12.0" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "unicode-width" -version = "0.1.14" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] name = "unicode-xid" @@ -3038,21 +3130,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "vec-collections" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9965c8f2ffed1dbcd16cafe18a009642f540fa22661c6cfd6309ddb02e4982" -dependencies = [ - "binary-merge", - "inplace-vec-builder", - "lazy_static", - "num-traits", - "serde", - "smallvec", - "sorted-iter", -] - [[package]] name = "version_check" version = "0.9.5" @@ -3077,27 +3154,18 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.2+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.114" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" dependencies = [ "cfg-if", "once_cell", @@ -3108,9 +3176,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.114" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3118,60 +3186,26 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.114" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.114" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" dependencies = [ "unicode-ident", ] -[[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap 2.13.0", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags", - "hashbrown 0.15.5", - "indexmap 2.13.0", - "semver", -] - [[package]] name = "winapi" version = "0.3.9" @@ -3224,7 +3258,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] @@ -3235,7 +3269,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] @@ -3273,121 +3307,50 @@ dependencies = [ [[package]] name = "winnow" -version = "0.5.40" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" dependencies = [ "memchr", ] [[package]] name = "winnow" -version = "0.7.15" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" dependencies = [ "memchr", ] [[package]] name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck 0.5.0", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck 0.5.0", - "indexmap 2.13.0", - "prettyplease", - "syn 2.0.117", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn 2.0.117", - "wit-bindgen-core", - "wit-bindgen-rust", -] +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags", - "indexmap 2.13.0", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" +name = "wnaf" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +checksum = "ab12e7090f27e2ffd9322651492942d50c2926094af30601e1964337db39daf1" dependencies = [ - "anyhow", - "id-arena", - "indexmap 2.13.0", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", + "ff", + "group", + "hybrid-array", ] [[package]] name = "writeable" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" [[package]] name = "yoke" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" dependencies = [ "stable_deref_trait", "yoke-derive", @@ -3396,82 +3359,68 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.42" +version = "0.8.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3" +checksum = "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.42" +version = "0.8.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f" +checksum = "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "zerofrom" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", "synstructure", ] [[package]] name = "zeroize" -version = "1.8.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" [[package]] name = "zerotrie" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" dependencies = [ "displaydoc", "yoke", @@ -3480,9 +3429,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" dependencies = [ "yoke", "zerofrom", @@ -3491,17 +3440,17 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 2.0.119", ] [[package]] name = "zmij" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 0e419165..573040de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,12 @@ license = "MIT" [dependencies] # When update noir version used in here please remember about changing the # `ci-noir` workflow and standard library to pull from the same version. -fm = { git = "https://github.com/noir-lang/noir", rev = "74d6be658e1ad252f87943292ba09bdd4da80bd4" } -nargo = { git = "https://github.com/noir-lang/noir", rev = "74d6be658e1ad252f87943292ba09bdd4da80bd4" } -nargo_toml = { git = "https://github.com/noir-lang/noir", rev = "74d6be658e1ad252f87943292ba09bdd4da80bd4" } -noirc_driver = { git = "https://github.com/noir-lang/noir", rev = "74d6be658e1ad252f87943292ba09bdd4da80bd4" } -noirc_errors = { git = "https://github.com/noir-lang/noir", rev = "74d6be658e1ad252f87943292ba09bdd4da80bd4" } -noirc_frontend = { git = "https://github.com/noir-lang/noir", rev = "74d6be658e1ad252f87943292ba09bdd4da80bd4" } +fm = { git = "https://github.com/noir-lang/noir", rev = "75061fab15986eedee4e7d9104ff87dd9fa4ca10" } +nargo = { git = "https://github.com/noir-lang/noir", rev = "75061fab15986eedee4e7d9104ff87dd9fa4ca10" } +nargo_toml = { git = "https://github.com/noir-lang/noir", rev = "75061fab15986eedee4e7d9104ff87dd9fa4ca10" } +noirc_driver = { git = "https://github.com/noir-lang/noir", rev = "75061fab15986eedee4e7d9104ff87dd9fa4ca10" } +noirc_errors = { git = "https://github.com/noir-lang/noir", rev = "75061fab15986eedee4e7d9104ff87dd9fa4ca10" } +noirc_frontend = { git = "https://github.com/noir-lang/noir", rev = "75061fab15986eedee4e7d9104ff87dd9fa4ca10" } # Left behind to enable easier local development when needed # fm = { path = "../noir/compiler/fm" } diff --git a/src/bin/main.rs b/src/bin/main.rs index 3a18cd8a..f2268063 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -217,6 +217,7 @@ fn extract_project( let report_errors = |diagnostics: &[CustomDiagnostic]| { noirc_errors::reporter::report_all( project.nargo_file_manager.as_file_map(), + &noirc_errors::function_locations::FunctionLocations::default(), diagnostics, false, false, diff --git a/src/lean/builtin.rs b/src/lean/builtin.rs index 19a04284..d59d3d5e 100644 --- a/src/lean/builtin.rs +++ b/src/lean/builtin.rs @@ -97,7 +97,6 @@ pub enum BuiltinType { const fn integer_bit_size_to_u8(s: IntegerBitSize) -> u8 { match s { - IntegerBitSize::One => 1, IntegerBitSize::Eight => 8, IntegerBitSize::Sixteen => 16, IntegerBitSize::ThirtyTwo => 32, diff --git a/src/lean/generator.rs b/src/lean/generator.rs index 3a38bf85..de27812b 100644 --- a/src/lean/generator.rs +++ b/src/lean/generator.rs @@ -15,9 +15,10 @@ use itertools::Itertools; use nargo::workspace::Workspace; use noirc_errors::Location; use noirc_frontend::{ - ast::{BinaryOpKind, FunctionKind, Ident, IntegerBitSize, UnaryOp}, + ast::{BinaryOpKind, FunctionKind, Ident, UnaryOp}, graph::CrateId, hir::{ + comptime::Integer as NoirInteger, def_map::{LocalModuleId, ModuleData, ModuleDefId}, type_check::generics::TraitGenerics, Context, @@ -181,6 +182,12 @@ pub struct LeanGenerator<'file_manager, 'parsed_files, 'workspace> { /// A supply of fresh names. name_supply: FreshNameSupply, + + /// The concrete `Self` type of the trait impl currently being generated, + /// if any. Trait default methods that are not overridden by an impl are + /// materialized with `Self` left abstract (bound to itself), so when + /// generating them under a concrete impl we resolve `Self` to this type. + current_impl_self_type: RefCell>, } /// Utility functions for the Lean generator. @@ -213,6 +220,7 @@ impl<'file_manager, 'parsed_files, 'workspace> known_files, resolved_crate_names: RefCell::new(HashMap::new()), name_supply: FreshNameSupply::new(), + current_impl_self_type: RefCell::new(None), } } @@ -262,7 +270,7 @@ impl LeanGenerator<'_, '_, '_> { if let Some(dep_id) = g.node_weight(node_idx) { matches!( *dep_id, - DependencyId::Struct(_) | DependencyId::Alias(_) | DependencyId::Trait(_) + DependencyId::DataType(_) | DependencyId::Alias(_) | DependencyId::Trait(_) ) } else { false @@ -307,7 +315,7 @@ impl LeanGenerator<'_, '_, '_> { let def_order = dep_weights .clone() .into_iter() - .position(|item| *item == DependencyId::Struct(id)); + .position(|item| *item == DependencyId::DataType(id)); self.name_supply.reset(); let struct_def = self.generate_struct_def(id); let name = quote_lean_keywords(&struct_def.name); @@ -386,7 +394,7 @@ impl LeanGenerator<'_, '_, '_> { .type_attributes(&id) .iter() .find_map(|attr| match &attr.kind { - SecondaryAttributeKind::Deprecated(msg) => Some(msg.clone()), + SecondaryAttributeKind::Deprecated(_, msg) => Some(msg.clone()), _ => None, }), ); @@ -444,7 +452,7 @@ impl LeanGenerator<'_, '_, '_> { expr: TypeExpr::builtin(BuiltinTag::Field, &[]), kind: Kind::Type, }, - NoirType::Array(count, typ) => Type::array( + NoirType::Array(typ, count) => Type::array( self.generate_lean_type_value(typ, bindings), self.generate_lean_type_value(count, bindings), ), @@ -491,14 +499,22 @@ impl LeanGenerator<'_, '_, '_> { if let Some(bindings) = bindings { bindings.get(&tv.id()).map_or_else( || self.generate_ty_var(tv, None), - |(_, kind, typ)| match kind { - NoirKind::Numeric(n) => match n.as_ref() { - NoirType::Constant(..) => { - self.generate_lean_type_value(n.as_ref(), Some(bindings)) - } + |(_, kind, typ)| { + // A variable bound to itself (as `Self` is in + // materialized trait default methods) must not + // recurse with the same bindings forever. + if type_is_variable_with_id(typ, tv.id()) { + return self.generate_lean_type_value(typ, None); + } + match kind { + NoirKind::Numeric(n) => match n.as_ref() { + NoirType::Constant(..) => { + self.generate_lean_type_value(n.as_ref(), Some(bindings)) + } + _ => self.generate_lean_type_value(typ, Some(bindings)), + }, _ => self.generate_lean_type_value(typ, Some(bindings)), - }, - _ => self.generate_lean_type_value(typ, Some(bindings)), + } }, ) } else { @@ -514,14 +530,25 @@ impl LeanGenerator<'_, '_, '_> { Some(sanitize_generic_name(&ng.name)), ) }, - |(_, kind, typ)| match kind { - NoirKind::Numeric(n) => match n.as_ref() { - NoirType::Constant(..) => { - self.generate_lean_type_value(n.as_ref(), Some(bindings)) - } + |(_, kind, typ)| { + // A variable bound to itself (as `Self` is in + // materialized trait default methods) must not + // recurse with the same bindings forever. + if type_is_variable_with_id(typ, ng.type_var.id()) { + return self.generate_ty_var( + &ng.type_var, + Some(sanitize_generic_name(&ng.name)), + ); + } + match kind { + NoirKind::Numeric(n) => match n.as_ref() { + NoirType::Constant(..) => { + self.generate_lean_type_value(n.as_ref(), Some(bindings)) + } + _ => self.generate_lean_type_value(typ, Some(bindings)), + }, _ => self.generate_lean_type_value(typ, Some(bindings)), - }, - _ => self.generate_lean_type_value(typ, Some(bindings)), + } }, ) } else { @@ -548,11 +575,21 @@ impl LeanGenerator<'_, '_, '_> { Type::immutable_reference(typ) } } - NoirType::Constant(felt, kind) => { - let felt_value = felt.to_string(); - let kind = self.expect_constant_numeric_kind(kind); + NoirType::Constant(value) => { + let (value, kind) = match value { + NoirInteger::Field(felt) => (felt.to_string(), Kind::Field), + NoirInteger::I8(v) => (v.to_string(), Kind::I(8)), + NoirInteger::I16(v) => (v.to_string(), Kind::I(16)), + NoirInteger::I32(v) => (v.to_string(), Kind::I(32)), + NoirInteger::I64(v) => (v.to_string(), Kind::I(64)), + NoirInteger::U8(v) => (v.to_string(), Kind::U(8)), + NoirInteger::U16(v) => (v.to_string(), Kind::U(16)), + NoirInteger::U32(v) => (v.to_string(), Kind::U(32)), + NoirInteger::U64(v) => (v.to_string(), Kind::U(64)), + NoirInteger::U128(v) => (v.to_string(), Kind::U(128)), + }; - Type::numeric_const(&felt_value, kind) + Type::numeric_const(&value, kind) } NoirType::InfixExpr(..) => { // Substitute any bound type variables and canonicalize the @@ -609,6 +646,7 @@ impl LeanGenerator<'_, '_, '_> { QuotedType::FunctionDefinition => "FunctionDefinition", QuotedType::Module => "Module", QuotedType::CtString => "CtString", + QuotedType::Location => "Location", } .to_string(), ); @@ -710,8 +748,17 @@ impl LeanGenerator<'_, '_, '_> { self.generate_lean_type_value(&b, None) } TypeBinding::Unbound(id, kind) => { - let kind = self.generate_kind(kind); let name = name.unwrap_or_else(|| format!("_tv{id:?}")); + // An abstract `Self` inside a trait impl (from a trait + // default method the impl did not override) resolves to the + // impl's concrete self type. + if name == "Self" { + let current_self = self.current_impl_self_type.borrow().clone(); + if let Some(self_ty) = current_self { + return self.generate_lean_type_value(&self_ty, None); + } + } + let kind = self.generate_kind(kind); Type::variable(name, kind) } } @@ -899,7 +946,6 @@ impl LeanGenerator<'_, '_, '_> { Box::new(NoirType::Unit), false, ), - NoirType::Integer(Signedness::Unsigned, IntegerBitSize::One), NoirType::Vector(Box::new(dummy_generic.clone())), NoirType::String(Box::new(dummy_generic.clone())), NoirType::Tuple(vec![dummy_generic; 0]), @@ -1078,7 +1124,8 @@ impl LeanGenerator<'_, '_, '_> { self.context .def_interner .function_attributes(id) - .get_deprecated_note(), + .get_deprecated() + .map(|(_, note)| note), ); let generics = self.gather_function_generic_patterns(function_meta); @@ -1304,6 +1351,11 @@ impl LeanGenerator<'_, '_, '_> { // If type patterns have the same name and kind, they are the same variable at // the definition site, so we can correctly unique them. data.iter() + .filter(|g| { + // Inside a trait impl, `Self` is fixed by the impl and so is + // never a generic pattern. + !(g.name.as_str() == "Self" && self.current_impl_self_type.borrow().is_some()) + }) .map(|g| self.generate_lean_type_pattern_from_resolved_generic(g)) .unique() .collect_vec() @@ -1449,7 +1501,11 @@ impl LeanGenerator<'_, '_, '_> { NoirType::NamedGeneric(ng) => match &*ng.type_var.borrow() { TypeBinding::Bound(tp) => self.gather_unbound_vars_patterns(tp, seen), TypeBinding::Unbound(id, _) => { - if seen.contains(id) { + // Inside a trait impl, `Self` is fixed by the impl and so + // is never a generic pattern. + let self_is_concrete = sanitize_generic_name(&ng.name) == "Self" + && self.current_impl_self_type.borrow().is_some(); + if seen.contains(id) || self_is_concrete { Vec::default() } else { seen.insert(*id); @@ -1536,6 +1592,12 @@ impl LeanGenerator<'_, '_, '_> { let statement = self.context.def_interner.statement(&global_data.let_statement); let def_info = self.context.def_interner.definition(global_data.definition_id); + // Trait associated constants surface as placeholder globals; they are + // extracted via their trait definitions instead. + if matches!(statement, HirStatement::TraitAssociatedConstant) { + return None; + } + let HirStatement::Let(binding) = statement else { eprintln!("Skipping global with invalid statement: {statement:?}"); return None; @@ -1635,11 +1697,15 @@ impl LeanGenerator<'_, '_, '_> { // the definition site, so we can correctly unique them. let generic_vars = self.gather_trait_impl_generics(impl_id, &trait_impl); + let previous_self_type = self + .current_impl_self_type + .replace(Some(trait_impl.typ.clone())); let methods = trait_impl .methods .iter() .map(|m| self.generate_trait_function_def(*m, &generic_vars)) .collect_vec(); + self.current_impl_self_type.replace(previous_self_type); TraitImplementation { name, @@ -1703,6 +1769,12 @@ impl LeanGenerator<'_, '_, '_> { patterns.into_iter().unique().collect_vec() } + /// Generates the definition of a trait impl method. + /// + /// # Panics + /// + /// - If the method has no elaborated body (e.g. it is a bodyless stub), + /// as every method in a trait impl is expected to have one. pub fn generate_trait_function_def( &self, id: FuncId, @@ -1730,12 +1802,47 @@ impl LeanGenerator<'_, '_, '_> { .filter(|g| !trait_generics.contains(g)) .unique() .collect_vec(); - let mut prologue = vec![]; - let body = self.generate_expr( - self.context.def_interner.function(&id).as_expr(), - &mut prologue, - ); - let body = wrap_in_block_if_needed(prologue, body); + // Methods marked `#[builtin]`/`#[foreign]` have no elaborated body, so + // we synthesize one that forwards to the builtin in question, exactly + // as if the method body were a call to the corresponding intrinsic. + let body = if matches!( + function_meta.kind, + FunctionKind::Builtin | FunctionKind::LowLevel + ) { + let func_kind = &self + .context + .def_interner + .function_attributes(&id) + .function + .as_ref() + .expect("Builtins must have attributes") + .0 + .kind; + let builtin_name = match func_kind { + FunctionAttributeKind::Builtin(b) => b.clone(), + FunctionAttributeKind::Foreign(f) => f.clone(), + _ => panic!("Unsupported function kind {func_kind:?} encountered for builtin"), + }; + let call = self.generate_builtin_call( + &builtin_name, + function_meta.parameters.0.iter().collect_vec(), + return_type.clone(), + ); + Expression::Block(Block { + statements: Vec::default(), + expression: Some(Box::new(call)), + }) + } else { + let mut prologue = vec![]; + let body_expr = self + .context + .def_interner + .function(&id) + .try_as_expr() + .unwrap_or_else(|| panic!("Trait impl method `{name}` has no elaborated body")); + let body = self.generate_expr(body_expr, &mut prologue); + wrap_in_block_if_needed(prologue, body) + }; FunctionDefinition { name, @@ -2892,12 +2999,8 @@ impl LeanGenerator<'_, '_, '_> { } }, HirLiteral::Bool(bool) => Expression::Literal(Literal::Bool(*bool)), - HirLiteral::Integer(signed_field) => { - let value = format!( - "{}{}", - if signed_field.is_negative() { "-" } else { "" }, - signed_field.absolute_value() - ); + HirLiteral::Integer(int) => { + let value = int.to_string(); let literal = NumericLiteral { value, @@ -2906,7 +3009,10 @@ impl LeanGenerator<'_, '_, '_> { Expression::Literal(Literal::Numeric(literal)) } - HirLiteral::Str(value) => Expression::Literal(Literal::String(value.clone())), + HirLiteral::Str(value) => Expression::Literal(Literal::String( + String::from_utf8(value.clone()) + .expect("Encountered non-UTF-8 string literal during compilation"), + )), HirLiteral::FmtStr(parts, vars, _) => { let template = Expression::Literal(Literal::String( parts.iter().map(ToString::to_string).join("{}"), @@ -3244,6 +3350,9 @@ impl LeanGenerator<'_, '_, '_> { panic!("Encountered comptime statement during compilation when none should exist") } HirStatement::Error => panic!("Encountered error statement during compilation"), + HirStatement::TraitAssociatedConstant => { + panic!("Encountered trait associated constant placeholder in function body") + } } } @@ -3848,6 +3957,17 @@ impl LeanGenerator<'_, '_, '_> { /// Replaces invalid characters within a generic name to create a recognizable /// but valid generic name. #[must_use] +/// Returns `true` if `typ` is a type variable (or named generic) whose +/// underlying variable is `id`, i.e. a binding of `id` to `typ` is an +/// identity binding. +fn type_is_variable_with_id(typ: &NoirType, id: TypeVariableId) -> bool { + match typ { + NoirType::TypeVariable(tv) => tv.id() == id, + NoirType::NamedGeneric(ng) => ng.type_var.id() == id, + _ => false, + } +} + pub fn sanitize_generic_name(name: &str) -> String { let name = name.strip_prefix("Self::").unwrap_or(name); name.replace("::", "_").replace(' ', "_").replace(['<', '>'], "") diff --git a/src/lib.rs b/src/lib.rs index 2b5cd6bd..9cc79835 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -248,7 +248,7 @@ fn use_globals() -> [Field; 2] { let slice_source = r" fn use_slice() -> Field { let s = [1,2,3]; - let t = s.as_slice(); + let t = s.as_vector(); t[0] } "; @@ -737,7 +737,7 @@ pub struct Foo {} impl HasConst for Foo { let N: u32 = 5; - let M: i32 = -7; + let M: i32 = -7i32; fn double_n() -> u32 { Self::N * 2 diff --git a/src/noir/project.rs b/src/noir/project.rs index 8a547e79..32dafe65 100644 --- a/src/noir/project.rs +++ b/src/noir/project.rs @@ -9,7 +9,7 @@ use nargo::{ workspace::Workspace, }; use noirc_driver::{check_crate, CompileOptions}; -use noirc_frontend::hir::ParsedFiles; +use noirc_frontend::hir::{LspMode, ParsedFiles}; use crate::{ lean::generator::LeanGenerator, @@ -65,7 +65,7 @@ impl<'file_manager, 'parsed_files> Project<'file_manager, 'parsed_files> { let (mut context, crate_id) = prepare_package(self.nargo_file_manager, self.nargo_parsed_files, package); // Enables reference tracking in the internal context. - context.activate_lsp_mode(); + context.activate_lsp_mode(LspMode::Full); // Perform compilation to check the code within it. let ((), warnings) = check_crate( From c261871cdfda82b55ed00a2ded1f1fdd41e3a402 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 27 Jul 2026 11:26:57 +0000 Subject: [PATCH 03/10] Re-vendor the Noir stdlib at 1.0.0-beta.25 Replaces stdlib/src with noir_stdlib/src from the pinned rev and bumps the package version that names the extracted std package. Notable upstream changes: collections/map.nr and collections/vec.nr are gone, integer.nr, internal/ and meta/location.nr are new, and slices have become vectors. --- stdlib/Nargo.toml | 2 +- stdlib/src/aes128.nr | 15 +- stdlib/src/append.nr | 46 +- stdlib/src/array/check_shuffle.nr | 34 +- stdlib/src/array/mod.nr | 133 +++-- stdlib/src/array/quicksort.nr | 59 +-- stdlib/src/cmp.nr | 457 +++++++++++----- stdlib/src/collections/bounded_vec.nr | 411 ++++++++++++--- stdlib/src/collections/map.nr | 716 -------------------------- stdlib/src/collections/mod.nr | 2 - stdlib/src/collections/umap.nr | 324 ++++++++---- stdlib/src/collections/vec.nr | 371 ------------- stdlib/src/compat.nr | 1 + stdlib/src/convert.nr | 139 ++++- stdlib/src/default.nr | 197 ++++++- stdlib/src/ecdsa_secp256k1.nr | 36 ++ stdlib/src/ecdsa_secp256r1.nr | 49 ++ stdlib/src/embedded_curve_ops.nr | 395 +++++++++++--- stdlib/src/field/bn254.nr | 4 + stdlib/src/field/mod.nr | 332 +++++++++--- stdlib/src/hash/mod.nr | 281 ++++++++-- stdlib/src/hash/poseidon2.nr | 166 +++--- stdlib/src/integer.nr | 193 +++++++ stdlib/src/internal/mod.nr | 12 + stdlib/src/lib.nr | 16 +- stdlib/src/meta/ctstring.nr | 51 +- stdlib/src/meta/expr.nr | 446 +--------------- stdlib/src/meta/function_def.nr | 61 +-- stdlib/src/meta/location.nr | 19 + stdlib/src/meta/mod.nr | 34 +- stdlib/src/meta/module.nr | 28 +- stdlib/src/meta/op.nr | 95 ++++ stdlib/src/meta/quoted.nr | 13 +- stdlib/src/meta/trait_constraint.nr | 8 +- stdlib/src/meta/trait_def.nr | 13 +- stdlib/src/meta/typ.nr | 13 +- stdlib/src/meta/type_def.nr | 44 +- stdlib/src/meta/typed_expr.nr | 6 + stdlib/src/meta/unresolved_type.nr | 39 +- stdlib/src/ops/arith.nr | 462 +++++++++++++---- stdlib/src/ops/bit.nr | 123 +++-- stdlib/src/option.nr | 153 +++++- stdlib/src/panic.nr | 12 + stdlib/src/prelude.nr | 1 - stdlib/src/primitive_docs.nr | 4 - stdlib/src/runtime.nr | 1 + stdlib/src/string.nr | 18 + stdlib/src/vector.nr | 36 +- 48 files changed, 3526 insertions(+), 2545 deletions(-) delete mode 100644 stdlib/src/collections/map.nr delete mode 100644 stdlib/src/collections/vec.nr create mode 100644 stdlib/src/integer.nr create mode 100644 stdlib/src/internal/mod.nr create mode 100644 stdlib/src/meta/location.nr diff --git a/stdlib/Nargo.toml b/stdlib/Nargo.toml index fb0dcc9b..abbbef36 100644 --- a/stdlib/Nargo.toml +++ b/stdlib/Nargo.toml @@ -2,5 +2,5 @@ name = "std" type = "lib" authors = [""] -version = "1.0.0-beta.14" +version = "1.0.0-beta.25" [dependencies] diff --git a/stdlib/src/aes128.nr b/stdlib/src/aes128.nr index d7d13120..02d50d64 100644 --- a/stdlib/src/aes128.nr +++ b/stdlib/src/aes128.nr @@ -1,5 +1,5 @@ // docs:start:aes128 -// Given a plaintext as an array of bytes, returns the corresponding aes128 ciphertext (CBC mode). Input padding is performed using PKCS#7, so that the output length is `input.len() + (16 - input.len() % 16)`. +/// Given a plaintext as an array of bytes, returns the corresponding aes128 ciphertext (CBC mode). Input padding is performed using PKCS#7, so that the output length is `input.len() + (16 - input.len() % 16)`. pub fn aes128_encrypt( input: [u8; N], iv: [u8; 16], @@ -21,3 +21,16 @@ pub fn aes128_encrypt( fn aes128_encrypt_padded_input(input: [u8; N], iv: [u8; 16], key: [u8; 16]) -> [u8; N] {} // docs:end:aes128 + +mod tests { + use super::aes128_encrypt; + + #[test] + fn encrypt() { + let input = "kevlovesrust".as_bytes(); + let iv = "0000000000000000".as_bytes(); + let key = "0000000000000000".as_bytes(); + let output = [244, 14, 126, 172, 171, 40, 208, 186, 173, 184, 226, 105, 238, 122, 205, 191]; + assert_eq(aes128_encrypt(input, iv, key), output); + } +} diff --git a/stdlib/src/append.nr b/stdlib/src/append.nr index 3b483fc9..cb8d69d8 100644 --- a/stdlib/src/append.nr +++ b/stdlib/src/append.nr @@ -1,11 +1,11 @@ -// Appends two values together, returning the result. -// -// An alternate name for this trait is `Monoid` if that is familiar. -// If not, it can be ignored. -// -// It is expected that for any implementation: -// - `T::empty().append(x) == x` -// - `x.append(T::empty()) == x` +/// Appends two values together, returning the result. +/// +/// An alternate name for this trait is `Monoid` if that is familiar. +/// If not, it can be ignored. +/// +/// It is expected that for any implementation: +/// - `T::empty().append(x) == x` +/// - `x.append(T::empty()) == x` // docs:start:append-trait pub trait Append { fn empty() -> Self; @@ -19,7 +19,7 @@ impl Append for [T] { } fn append(self, other: Self) -> Self { - // Slices have an existing append function which this will resolve to. + // Vectors have an existing append function which this will resolve to. self.append(other) } } @@ -33,3 +33,31 @@ impl Append for Quoted { quote { $self $other } } } + +mod tests { + use super::Append; + + #[test] + fn vector_empty() { + assert_eq(<[Field]>::empty(), @[]); + } + + #[test] + fn vector_append() { + assert_eq(Append::append(@[1, 2], [3, 4, 5]), @[1, 2, 3, 4, 5]); + } + + #[test] + fn quoted_append() { + comptime { + assert_eq(Append::append(quote { hello }, quote { world }), quote { hello world }) + } + } + + #[test] + fn quoted_empty() { + comptime { + assert_eq(::empty(), quote {}); + } + } +} diff --git a/stdlib/src/array/check_shuffle.nr b/stdlib/src/array/check_shuffle.nr index c3c87383..aa26c950 100644 --- a/stdlib/src/array/check_shuffle.nr +++ b/stdlib/src/array/check_shuffle.nr @@ -1,6 +1,6 @@ use crate::cmp::Eq; -unconstrained fn __get_shuffle_indices(lhs: [T; N], rhs: [T; N]) -> [u32; N] +unconstrained fn __get_shuffle_indices(lhs: &[T; N], rhs: &[T; N]) -> [u32; N] where T: Eq, { @@ -25,7 +25,7 @@ where shuffle_indices } -unconstrained fn __get_index(indices: [u32; N], idx: u32) -> u32 { +unconstrained fn __get_index(indices: &[u32; N], idx: u32) -> u32 { let mut result = 0; for i in 0..N { if (indices[i] == idx) { @@ -36,7 +36,7 @@ unconstrained fn __get_index(indices: [u32; N], idx: u32) -> u32 { result } -pub(crate) fn check_shuffle(lhs: [T; N], rhs: [T; N]) +pub(crate) fn check_shuffle(lhs: &[T; N], rhs: &[T; N]) where T: Eq, { @@ -46,7 +46,7 @@ where let shuffle_indices = __get_shuffle_indices(lhs, rhs); for i in 0..N { - let idx = __get_index(shuffle_indices, i); + let idx = __get_index(&shuffle_indices, i); assert_eq(shuffle_indices[idx], i); } for i in 0..N { @@ -77,28 +77,28 @@ mod test { fn test_shuffle() { let lhs: [Field; 5] = [0, 1, 2, 3, 4]; let rhs: [Field; 5] = [2, 0, 3, 1, 4]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test] fn test_shuffle_identity() { let lhs: [Field; 5] = [0, 1, 2, 3, 4]; let rhs: [Field; 5] = [0, 1, 2, 3, 4]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test(should_fail_with = "check_shuffle, lhs and rhs arrays do not contain equivalent values")] fn test_shuffle_fail() { let lhs: [Field; 5] = [0, 1, 2, 3, 4]; let rhs: [Field; 5] = [0, 1, 2, 3, 5]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test(should_fail_with = "check_shuffle, lhs and rhs arrays do not contain equivalent values")] fn test_shuffle_duplicates() { let lhs: [Field; 5] = [0, 1, 2, 3, 4]; let rhs: [Field; 5] = [0, 1, 2, 3, 3]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test] @@ -117,21 +117,21 @@ mod test { CompoundStruct { a: true, b: 9814, c: 0xeeffee0011001133 }, CompoundStruct { a: true, b: 5, c: 0xffffffffffffffff }, ]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test] fn test_shuffle_empty_array() { let lhs: [Field; 0] = []; let rhs: [Field; 0] = []; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test] fn test_shuffle_single_element() { let lhs: [Field; 1] = [42]; let rhs: [Field; 1] = [42]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } // arrays with duplicate values @@ -139,21 +139,21 @@ mod test { fn test_shuffle_with_duplicates() { let lhs: [Field; 4] = [1, 2, 1, 3]; let rhs: [Field; 4] = [1, 3, 1, 2]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test] fn test_shuffle_all_same_values() { let lhs: [Field; 5] = [42, 42, 42, 42, 42]; let rhs: [Field; 5] = [42, 42, 42, 42, 42]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test] fn test_shuffle_bool() { let lhs: [bool; 4] = [true, false, true, false]; let rhs: [bool; 4] = [false, true, false, true]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test] @@ -162,7 +162,7 @@ mod test { let struct2 = CompoundStruct { a: false, b: 0, c: 200 }; let lhs: [CompoundStruct; 4] = [struct1, struct2, struct1, struct2]; let rhs: [CompoundStruct; 4] = [struct2, struct1, struct2, struct1]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } #[test(should_fail_with = "check_shuffle, lhs and rhs arrays do not contain equivalent values")] @@ -173,7 +173,7 @@ mod test { CompoundStruct { a: true, b: 42, c: 100 }, CompoundStruct { a: false, b: 1, c: 200 }, // Different b field ]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } // test with negative field values @@ -181,6 +181,6 @@ mod test { fn test_shuffle_negative_values() { let lhs: [Field; 4] = [-1, -2, -3, -4]; let rhs: [Field; 4] = [-4, -3, -2, -1]; - check_shuffle(lhs, rhs); + check_shuffle(&lhs, &rhs); } } diff --git a/stdlib/src/array/mod.nr b/stdlib/src/array/mod.nr index 53379fd0..85860828 100644 --- a/stdlib/src/array/mod.nr +++ b/stdlib/src/array/mod.nr @@ -33,18 +33,6 @@ impl [T; N] { #[builtin(as_vector)] pub fn as_vector(self) -> [T] {} - /// Returns this array as a vector. - /// This method is deprecated in favor of `as_vector`. - /// - /// ```noir - /// let array = [1, 2]; - /// let vector = array.as_slice(); - /// assert_eq(vector, [1, 2].as_vector()); - /// ``` - #[builtin(as_vector)] - #[deprecated("This method has been renamed to `as_vector`")] - pub fn as_slice(self) -> [T] {} - /// Applies a function to each element of this array, returning a new array containing the mapped elements. /// /// Example: @@ -54,7 +42,7 @@ impl [T; N] { /// let b = a.map(|a| a * 2); /// assert_eq(b, [2, 4, 6]); /// ``` - pub fn map(self, f: fn[Env](T) -> U) -> [U; N] { + pub fn map(&self, f: fn[Env](T) -> U) -> [U; N] { let uninitialized = crate::mem::zeroed(); let mut ret = [uninitialized; N]; @@ -75,7 +63,7 @@ impl [T; N] { /// let b = a.mapi(|i, a| i + a * 2); /// assert_eq(b, [2, 5, 8]); /// ``` - pub fn mapi(self, f: fn[Env](u32, T) -> U) -> [U; N] { + pub fn mapi(&self, f: fn[Env](u32, T) -> U) -> [U; N] { let uninitialized = crate::mem::zeroed(); let mut ret = [uninitialized; N]; @@ -100,7 +88,7 @@ impl [T; N] { /// }); /// assert_eq(a, b); /// ``` - pub fn for_each(self, f: fn[Env](T) -> ()) { + pub fn for_each(&self, f: fn[Env](T) -> ()) { for i in 0..self.len() { f(self[i]); } @@ -118,7 +106,7 @@ impl [T; N] { /// }); /// assert_eq(a, b); /// ``` - pub fn for_eachi(self, f: fn[Env](u32, T) -> ()) { + pub fn for_eachi(&self, f: fn[Env](u32, T) -> ()) { for i in 0..self.len() { f(i, self[i]); } @@ -142,7 +130,7 @@ impl [T; N] { /// /// assert_eq(a3.fold(10, f), 10 - 1 - 2 - 3); /// ``` - pub fn fold(self, mut accumulator: U, f: fn[Env](U, T) -> U) -> U { + pub fn fold(&self, mut accumulator: U, f: fn[Env](U, T) -> U) -> U { for elem in self { accumulator = f(accumulator, elem); } @@ -162,7 +150,7 @@ impl [T; N] { /// assert(reduced == 10); /// } /// ``` - pub fn reduce(self, f: fn[Env](T, T) -> T) -> T { + pub fn reduce(&self, f: fn[Env](T, T) -> T) -> T { let mut accumulator = self[0]; for i in 1..self.len() { accumulator = f(accumulator, self[i]); @@ -181,7 +169,7 @@ impl [T; N] { /// assert(all); /// } /// ``` - pub fn all(self, predicate: fn[Env](T) -> bool) -> bool { + pub fn all(&self, predicate: fn[Env](T) -> bool) -> bool { let mut ret = true; for elem in self { ret &= predicate(elem); @@ -200,7 +188,7 @@ impl [T; N] { /// assert(any); /// } /// ``` - pub fn any(self, predicate: fn[Env](T) -> bool) -> bool { + pub fn any(&self, predicate: fn[Env](T) -> bool) -> bool { let mut ret = false; for elem in self { ret |= predicate(elem); @@ -220,7 +208,7 @@ impl [T; N] { /// assert(concatenated_arr == [1, 2, 3, 4, 6, 7, 8, 9, 10, 11]); /// } /// ``` - pub fn concat(self, array2: [T; M]) -> [T; N + M] { + pub fn concat(&self, array2: [T; M]) -> [T; N + M] { let mut result = [crate::mem::zeroed(); N + M]; for i in 0..N { result[i] = self[i]; @@ -250,7 +238,7 @@ where /// assert(sorted == [32, 42]); /// } /// ``` - pub fn sort(self) -> Self { + pub fn sort(&self) -> Self { self.sort_via(|a, b| a <= b) } } @@ -277,22 +265,26 @@ where /// assert(sorted_descending == [32, 42]); // does not verify /// } /// ``` - pub fn sort_via(self, ordering: fn[Env](T, T) -> bool) -> Self { - // Safety: `sorted` array is checked to be: - // a. a permutation of `input`'s elements - // b. satisfying the predicate `ordering` - let sorted = unsafe { quicksort::quicksort(self, ordering) }; - - if !is_unconstrained() { - for i in 0..N - 1 { - assert( - ordering(sorted[i], sorted[i + 1]), - "Array has not been sorted correctly according to `ordering`.", - ); + pub fn sort_via(&self, ordering: fn[Env](T, T) -> bool) -> Self { + if N != 0 { + // Safety: `sorted` array is checked to be: + // a. a permutation of `input`'s elements + // b. satisfying the predicate `ordering` + let sorted = unsafe { quicksort::quicksort(self, ordering) }; + + if !is_unconstrained() { + for i in 0..N - 1 { + assert( + ordering(sorted[i], sorted[i + 1]), + "Array has not been sorted correctly according to `ordering`.", + ); + } + check_shuffle::check_shuffle(self, &sorted); } - check_shuffle::check_shuffle(self, sorted); + sorted + } else { + *self } - sorted } } @@ -345,7 +337,7 @@ mod test { #[test] fn test_sort() { - let mut arr: [u32; 7] = [3, 6, 8, 10, 1, 2, 1]; + let arr: [u32; 7] = [3, 6, 8, 10, 1, 2, 1]; let sorted = arr.sort(); @@ -353,9 +345,23 @@ mod test { assert(sorted == expected); } + #[test] + fn test_sort_empty() { + let arr: [u32; 0] = []; + let sorted = arr.sort(); + assert(sorted == arr); + } + + #[test] + fn test_sort_via_empty() { + let arr: [u32; 0] = []; + let sorted = arr.sort_via(sort_u32); + assert(sorted == arr); + } + #[test] fn test_sort_100_values() { - let mut arr: [u32; 100] = [ + let arr: [u32; 100] = [ 42, 123, 87, 93, 48, 80, 50, 5, 104, 84, 70, 47, 119, 66, 71, 121, 3, 29, 42, 118, 2, 54, 89, 44, 81, 0, 26, 106, 68, 96, 84, 48, 95, 54, 45, 32, 89, 100, 109, 19, 37, 41, 19, 98, 53, 114, 107, 66, 6, 74, 13, 19, 105, 64, 123, 28, 44, 50, 89, 58, 123, 126, 21, @@ -383,7 +389,7 @@ mod test { #[test] fn test_sort_via() { - let mut arr: [u32; 7] = [3, 6, 8, 10, 1, 2, 1]; + let arr: [u32; 7] = [3, 6, 8, 10, 1, 2, 1]; let sorted = arr.sort_via(sort_u32); @@ -393,7 +399,7 @@ mod test { #[test] fn test_sort_via_100_values() { - let mut arr: [u32; 100] = [ + let arr: [u32; 100] = [ 42, 123, 87, 93, 48, 80, 50, 5, 104, 84, 70, 47, 119, 66, 71, 121, 3, 29, 42, 118, 2, 54, 89, 44, 81, 0, 26, 106, 68, 96, 84, 48, 95, 54, 45, 32, 89, 100, 109, 19, 37, 41, 19, 98, 53, 114, 107, 66, 6, 74, 13, 19, 105, 64, 123, 28, 44, 50, 89, 58, 123, 126, 21, @@ -499,4 +505,51 @@ mod test { let concatenated_arr = arr1.concat(arr2); assert_eq(concatenated_arr, []); } + + #[test] + fn test_fold() { + let array = [1, 2, 3]; + let sum_plus_10 = array.fold(10, |x, y| x + y); + assert_eq(sum_plus_10, 16); + } + + #[test] + fn test_reduce() { + let array = [1, 2, 3]; + let sum = array.reduce(|x, y| x + y); + assert_eq(sum, 6); + } + + #[test(should_fail_with = "Index out of bounds")] + fn test_reduce_failure_on_empty_array() { + let array: [Field; 0] = []; + let sum = array.reduce(|x, y| x + y); + assert_eq(sum, 6); + } + + #[test] + fn test_all() { + let array = [1, 2, 3]; + assert(array.all(|x| x >= 1)); + assert(!array.all(|x| x >= 2)); + } + + #[test] + fn test_any() { + let array = [1, 2, 3]; + assert(array.any(|x| x >= 3)); + assert(!array.any(|x| x >= 4)); + } + + #[test] + fn test_to_string() { + let str = [78_u8, 111, 105, 114].as_str_unchecked(); + assert_eq(str, "Noir"); + } + + #[test] + fn test_bytes_from_string() { + let bytes: [u8; 4] = crate::convert::From::from("Noir"); + assert_eq(bytes, [78_u8, 111, 105, 114]); + } } diff --git a/stdlib/src/array/quicksort.nr b/stdlib/src/array/quicksort.nr index 22f83500..8cf233e4 100644 --- a/stdlib/src/array/quicksort.nr +++ b/stdlib/src/array/quicksort.nr @@ -34,6 +34,7 @@ unconstrained fn quicksort_loop( break; } + // TODO: This causes an unnecessary clone on `stack` let (new_stack, (new_low, new_high)) = stack.pop_back(); stack = new_stack; @@ -50,10 +51,10 @@ unconstrained fn quicksort_loop( } pub unconstrained fn quicksort( - arr: [T; N], + arr: &[T; N], sortfn: unconstrained fn[Env](T, T) -> bool, ) -> [T; N] { - let mut arr: [T; N] = arr; + let mut arr: [T; N] = *arr; if arr.len() > 1 { quicksort_loop(&mut arr, 0, arr.len() - 1, sortfn); } @@ -83,7 +84,7 @@ mod test { fn test_empty_array() { let arr: [u32; 0] = []; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, arr); } @@ -91,7 +92,7 @@ mod test { fn test_single_element() { let arr: [u32; 1] = [42]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, arr); } @@ -99,7 +100,7 @@ mod test { fn test_two_elements_ascending() { let arr: [u32; 2] = [2, 1]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 2]); } @@ -107,7 +108,7 @@ mod test { fn test_two_elements_descending() { let arr: [u32; 2] = [1, 2]; // Safety: test - let result = unsafe { quicksort(arr, descending) }; + let result = unsafe { quicksort(&arr, descending) }; assert_eq(result, [2, 1]); } @@ -115,7 +116,7 @@ mod test { fn test_already_sorted_ascending() { let arr: [u32; 5] = [1, 2, 3, 4, 5]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 2, 3, 4, 5]); } @@ -127,7 +128,7 @@ mod test { } arr[0] = 2; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; arr[0] = 1; arr[1] = 2; assert_eq(result, arr); @@ -137,7 +138,7 @@ mod test { fn test_already_sorted_descending() { let arr: [u32; 5] = [5, 4, 3, 2, 1]; // Safety: test - let result = unsafe { quicksort(arr, descending) }; + let result = unsafe { quicksort(&arr, descending) }; assert_eq(result, [5, 4, 3, 2, 1]); } @@ -145,7 +146,7 @@ mod test { fn test_reverse_sorted_ascending() { let arr: [u32; 5] = [5, 4, 3, 2, 1]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 2, 3, 4, 5]); } @@ -153,7 +154,7 @@ mod test { fn test_reverse_sorted_descending() { let arr: [u32; 5] = [1, 2, 3, 4, 5]; // Safety: test - let result = unsafe { quicksort(arr, descending) }; + let result = unsafe { quicksort(&arr, descending) }; assert_eq(result, [5, 4, 3, 2, 1]); } @@ -161,7 +162,7 @@ mod test { fn test_random_array_ascending() { let arr: [u32; 8] = [3, 1, 4, 1, 5, 9, 2, 6]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 1, 2, 3, 4, 5, 6, 9]); } @@ -169,7 +170,7 @@ mod test { fn test_random_array_descending() { let arr: [u32; 8] = [3, 1, 4, 1, 5, 9, 2, 6]; // Safety: test - let result = unsafe { quicksort(arr, descending) }; + let result = unsafe { quicksort(&arr, descending) }; assert_eq(result, [9, 6, 5, 4, 3, 2, 1, 1]); } @@ -177,7 +178,7 @@ mod test { fn test_duplicate_elements() { let arr: [u32; 11] = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 1, 2, 3, 3, 4, 5, 5, 5, 6, 9]); } @@ -185,7 +186,7 @@ mod test { fn test_all_same_elements() { let arr: [u32; 5] = [42, 42, 42, 42, 42]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [42, 42, 42, 42, 42]); } @@ -193,7 +194,7 @@ mod test { fn test_large_array() { let arr: [u32; 10] = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); } @@ -201,7 +202,7 @@ mod test { fn test_negative_numbers() { let arr: [i32; 8] = [-3, 1, -4, 1, -5, 9, -2, 6]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [-5, -4, -3, -2, 1, 1, 6, 9]); } @@ -209,7 +210,7 @@ mod test { fn test_zero_values() { let arr: [u32; 6] = [0, 1, 0, 2, 0, 3]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [0, 0, 0, 1, 2, 3]); } @@ -217,7 +218,7 @@ mod test { fn test_edge_case_near_sorted() { let arr: [u32; 8] = [1, 2, 3, 5, 4, 6, 7, 8]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 2, 3, 4, 5, 6, 7, 8]); } @@ -225,7 +226,7 @@ mod test { fn test_edge_case_near_reverse_sorted() { let arr: [u32; 8] = [8, 7, 6, 4, 5, 3, 2, 1]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 2, 3, 4, 5, 6, 7, 8]); } @@ -241,7 +242,7 @@ mod test { let arr: [i32; 8] = [-3, 1, -4, 1, -5, 9, -2, 6]; // Safety: test - let result = unsafe { quicksort(arr, abs_compare) }; + let result = unsafe { quicksort(&arr, abs_compare) }; assert_eq(result, [1, 1, -2, -3, -4, -5, 6, 9]); } @@ -250,7 +251,7 @@ mod test { // sort by absolute value let arr: [i32; 11] = [-3, 1, -4, 1, -5, 5, -5, 5, 9, -2, 6]; // Safety: test - let result = unsafe { quicksort(arr, abs_compare) }; + let result = unsafe { quicksort(&arr, abs_compare) }; assert_eq(result, [1, 1, -2, -3, -4, -5, 5, -5, 5, 6, 9]); } @@ -258,7 +259,7 @@ mod test { fn test_maximum_values() { let arr: [u32; 4] = [2 ^ 32 - 1, 1, 0, 2 ^ 32 - 2]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [0, 1, 2 ^ 32 - 2, 2 ^ 32 - 1]); } @@ -266,7 +267,7 @@ mod test { fn test_alternating_pattern() { let arr: [u32; 9] = [1, 9, 2, 8, 3, 7, 4, 6, 5]; // Safety: test - let result = unsafe { quicksort(arr, ascending) }; + let result = unsafe { quicksort(&arr, ascending) }; assert_eq(result, [1, 2, 3, 4, 5, 6, 7, 8, 9]); } @@ -274,11 +275,11 @@ mod test { fn test_multiple_sorts_same_array() { let arr: [u32; 8] = [3, 1, 4, 1, 5, 9, 2, 6]; // Safety: test - let result1 = unsafe { quicksort(arr, ascending) }; + let result1 = unsafe { quicksort(&arr, ascending) }; // Safety: test - let result2 = unsafe { quicksort(arr, ascending) }; + let result2 = unsafe { quicksort(&arr, ascending) }; // Safety: test - let result3 = unsafe { quicksort(arr, ascending) }; + let result3 = unsafe { quicksort(&arr, ascending) }; assert_eq(result1, result2); assert_eq(result2, result3); @@ -289,11 +290,11 @@ mod test { fn test_descending_then_ascending() { let arr: [u32; 8] = [3, 1, 4, 1, 5, 9, 2, 6]; // Safety: test - let desc_result = unsafe { quicksort(arr, descending) }; + let desc_result = unsafe { quicksort(&arr, descending) }; assert_eq(desc_result, [9, 6, 5, 4, 3, 2, 1, 1]); // Safety: test - let asc_result: [u32; 8] = unsafe { quicksort(desc_result, ascending) }; + let asc_result: [u32; 8] = unsafe { quicksort(&desc_result, ascending) }; assert_eq(asc_result, [1, 1, 2, 3, 4, 5, 6, 9]); } } diff --git a/stdlib/src/cmp.nr b/stdlib/src/cmp.nr index fd45030c..a74583f4 100644 --- a/stdlib/src/cmp.nr +++ b/stdlib/src/cmp.nr @@ -1,5 +1,7 @@ +use crate::meta::ctstring::AsCtString; use crate::meta::derive_via; +/// Compare two values for equality #[derive_via(derive_eq)] // docs:start:eq-trait pub trait Eq { @@ -60,12 +62,6 @@ impl Eq for u8 { self == other } } -impl Eq for u1 { - fn eq(self, other: u1) -> bool { - self == other - } -} - impl Eq for i8 { fn eq(self, other: i8) -> bool { self == other @@ -134,53 +130,83 @@ impl Eq for str { } } -impl Eq for (A, B) -where - A: Eq, - B: Eq, -{ +comptime fn make_tuple_eq_body(n: u32) -> Quoted { + let mut body = f"self.0.eq(other.0)".as_ctstring(); + for i in 1u32..n { + body = body.append_fmtstr(f" & self.{i}.eq(other.{i})"); + } + f"{body}".quoted_contents() +} + +impl Eq for (A,) { + fn eq(self, other: (A,)) -> bool { + self.0 == other.0 + } +} + +impl Eq for (A, B) { fn eq(self, other: (A, B)) -> bool { - self.0.eq(other.0) & self.1.eq(other.1) + make_tuple_eq_body!(2u32) } } -impl Eq for (A, B, C) -where - A: Eq, - B: Eq, - C: Eq, -{ +impl Eq for (A, B, C) { fn eq(self, other: (A, B, C)) -> bool { - self.0.eq(other.0) & self.1.eq(other.1) & self.2.eq(other.2) + make_tuple_eq_body!(3u32) } } -impl Eq for (A, B, C, D) -where - A: Eq, - B: Eq, - C: Eq, - D: Eq, -{ +impl Eq for (A, B, C, D) { fn eq(self, other: (A, B, C, D)) -> bool { - self.0.eq(other.0) & self.1.eq(other.1) & self.2.eq(other.2) & self.3.eq(other.3) + make_tuple_eq_body!(4u32) } } -impl Eq for (A, B, C, D, E) -where - A: Eq, - B: Eq, - C: Eq, - D: Eq, - E: Eq, -{ +impl Eq for (A, B, C, D, E) { fn eq(self, other: (A, B, C, D, E)) -> bool { - self.0.eq(other.0) - & self.1.eq(other.1) - & self.2.eq(other.2) - & self.3.eq(other.3) - & self.4.eq(other.4) + make_tuple_eq_body!(5u32) + } +} + +impl Eq for (A, B, C, D, E, F) { + fn eq(self, other: (A, B, C, D, E, F)) -> bool { + make_tuple_eq_body!(6u32) + } +} + +impl Eq for (A, B, C, D, E, F, G) { + fn eq(self, other: (A, B, C, D, E, F, G)) -> bool { + make_tuple_eq_body!(7u32) + } +} + +impl Eq for (A, B, C, D, E, F, G, H) { + fn eq(self, other: (A, B, C, D, E, F, G, H)) -> bool { + make_tuple_eq_body!(8u32) + } +} + +impl Eq for (A, B, C, D, E, F, G, H, I) { + fn eq(self, other: (A, B, C, D, E, F, G, H, I)) -> bool { + make_tuple_eq_body!(9u32) + } +} + +impl Eq for (A, B, C, D, E, F, G, H, I, J) { + fn eq(self, other: (A, B, C, D, E, F, G, H, I, J)) -> bool { + make_tuple_eq_body!(10u32) + } +} + +impl Eq for (A, B, C, D, E, F, G, H, I, J, K) { + fn eq(self, other: (A, B, C, D, E, F, G, H, I, J, K)) -> bool { + make_tuple_eq_body!(11u32) + } +} + +impl Eq for (A, B, C, D, E, F, G, H, I, J, K, L) { + fn eq(self, other: (A, B, C, D, E, F, G, H, I, J, K, L)) -> bool { + make_tuple_eq_body!(12u32) } } @@ -192,6 +218,8 @@ impl Eq for Ordering { // Noir doesn't have enums yet so we emulate (Lt | Eq | Gt) with a struct // that has 3 public functions for constructing the struct. +/// A value with three states: `Ordering::less()`, `Ordering::equal()` or `Ordering::greater()`. +/// Most often used to encode the result of a comparison operation. pub struct Ordering { result: Field, } @@ -213,6 +241,8 @@ impl Ordering { } } +/// Compare one object to another, returning whether it is less-than, equal-to, +/// or greater-than the other object. #[derive_via(derive_ord)] // docs:start:ord-trait pub trait Ord { @@ -416,112 +446,108 @@ where } } -impl Ord for (A, B) -where - A: Ord, - B: Ord, -{ - fn cmp(self, other: (A, B)) -> Ordering { - let result = self.0.cmp(other.0); - - if result != Ordering::equal() { - result - } else { - self.1.cmp(other.1) - } +comptime fn make_tuple_ord_body(n: u32) -> Quoted { + let last = n - 1u32; + let mut body = if last == 1 { + f"let result = self.0.cmp(other.0);".as_ctstring() + } else { + f"let mut result = self.0.cmp(other.0);".as_ctstring() + }; + for i in 1u32..last { + body = body.append_fmtstr( + f" if result == Ordering::equal() {{ result = self.{i}.cmp(other.{i}); }}", + ); } + body = body.append_fmtstr( + f" if result != Ordering::equal() {{ result }} else {{ self.{last}.cmp(other.{last}) }}", + ); + f"{body}".quoted_contents() } -impl Ord for (A, B, C) -where - A: Ord, - B: Ord, - C: Ord, -{ - fn cmp(self, other: (A, B, C)) -> Ordering { - let mut result = self.0.cmp(other.0); - - if result == Ordering::equal() { - result = self.1.cmp(other.1); - } +impl Ord for (A,) { + fn cmp(self, other: (A,)) -> Ordering { + self.0.cmp(other.0) + } +} - if result == Ordering::equal() { - result = self.2.cmp(other.2); - } +impl Ord for (A, B) { + fn cmp(self, other: (A, B)) -> Ordering { + make_tuple_ord_body!(2u32) + } +} - result +impl Ord for (A, B, C) { + fn cmp(self, other: (A, B, C)) -> Ordering { + make_tuple_ord_body!(3u32) } } -impl Ord for (A, B, C, D) -where - A: Ord, - B: Ord, - C: Ord, - D: Ord, -{ +impl Ord for (A, B, C, D) { fn cmp(self, other: (A, B, C, D)) -> Ordering { - let mut result = self.0.cmp(other.0); - - if result == Ordering::equal() { - result = self.1.cmp(other.1); - } - - if result == Ordering::equal() { - result = self.2.cmp(other.2); - } + make_tuple_ord_body!(4u32) + } +} - if result == Ordering::equal() { - result = self.3.cmp(other.3); - } +impl Ord for (A, B, C, D, E) { + fn cmp(self, other: (A, B, C, D, E)) -> Ordering { + make_tuple_ord_body!(5u32) + } +} - result +impl Ord for (A, B, C, D, E, F) { + fn cmp(self, other: (A, B, C, D, E, F)) -> Ordering { + make_tuple_ord_body!(6u32) } } -impl Ord for (A, B, C, D, E) -where - A: Ord, - B: Ord, - C: Ord, - D: Ord, - E: Ord, -{ - fn cmp(self, other: (A, B, C, D, E)) -> Ordering { - let mut result = self.0.cmp(other.0); +impl Ord for (A, B, C, D, E, F, G) { + fn cmp(self, other: (A, B, C, D, E, F, G)) -> Ordering { + make_tuple_ord_body!(7u32) + } +} - if result == Ordering::equal() { - result = self.1.cmp(other.1); - } +impl Ord for (A, B, C, D, E, F, G, H) { + fn cmp(self, other: (A, B, C, D, E, F, G, H)) -> Ordering { + make_tuple_ord_body!(8u32) + } +} - if result == Ordering::equal() { - result = self.2.cmp(other.2); - } +impl Ord for (A, B, C, D, E, F, G, H, I) { + fn cmp(self, other: (A, B, C, D, E, F, G, H, I)) -> Ordering { + make_tuple_ord_body!(9u32) + } +} - if result == Ordering::equal() { - result = self.3.cmp(other.3); - } +impl Ord for (A, B, C, D, E, F, G, H, I, J) { + fn cmp(self, other: (A, B, C, D, E, F, G, H, I, J)) -> Ordering { + make_tuple_ord_body!(10u32) + } +} - if result == Ordering::equal() { - result = self.4.cmp(other.4); - } +impl Ord for (A, B, C, D, E, F, G, H, I, J, K) { + fn cmp(self, other: (A, B, C, D, E, F, G, H, I, J, K)) -> Ordering { + make_tuple_ord_body!(11u32) + } +} - result +impl Ord for (A, B, C, D, E, F, G, H, I, J, K, L) { + fn cmp(self, other: (A, B, C, D, E, F, G, H, I, J, K, L)) -> Ordering { + make_tuple_ord_body!(12u32) } } -// Compares and returns the maximum of two values. -// -// Returns the second argument if the comparison determines them to be equal. -// -// # Examples -// -// ``` -// use std::cmp; -// -// assert_eq(cmp::max(1, 2), 2); -// assert_eq(cmp::max(2, 2), 2); -// ``` +/// Compares and returns the maximum of two values. +/// +/// Returns the second argument if the comparison determines them to be equal. +/// +/// # Examples +/// +/// ``` +/// use std::cmp; +/// +/// assert_eq(cmp::max(1, 2), 2); +/// assert_eq(cmp::max(2, 2), 2); +/// ``` pub fn max(v1: T, v2: T) -> T where T: Ord, @@ -533,18 +559,18 @@ where } } -// Compares and returns the minimum of two values. -// -// Returns the first argument if the comparison determines them to be equal. -// -// # Examples -// -// ``` -// use std::cmp; -// -// assert_eq(cmp::min(1, 2), 1); -// assert_eq(cmp::min(2, 2), 2); -// ``` +/// Compares and returns the minimum of two values. +/// +/// Returns the first argument if the comparison determines them to be equal. +/// +/// # Examples +/// +/// ``` +/// use std::cmp; +/// +/// assert_eq(cmp::min(1, 2), 1); +/// assert_eq(cmp::min(2, 2), 2); +/// ``` pub fn min(v1: T, v2: T) -> T where T: Ord, @@ -557,7 +583,8 @@ where } mod cmp_tests { - use super::{Eq, max, min, Ord}; + use crate::meta::unquote; + use super::{Eq, max, min, Ord, Ordering}; #[test] fn sanity_check_min() { @@ -593,4 +620,160 @@ mod cmp_tests { == super::Ordering::less(), ); } + + #[test] + fn eq_unit() { + assert(().eq(())); + } + + #[test] + fn eq_bool() { + assert(false.eq(false)); + assert(!(false.eq(true))); + assert(!(true.eq(false))); + assert(true.eq(true)); + } + + #[test] + fn eq_integers() { + comptime { + for typ in @[ + quote { u8 }, + quote { i8 }, + quote { u16 }, + quote { i16 }, + quote { u32 }, + quote { i32 }, + quote { u64 }, + quote { i64 }, + quote { u128 }, + quote { Field }, + ] { + let one = f"1_{typ}".quoted_contents(); + let two = f"2_{typ}".quoted_contents(); + unquote!( + quote { + assert($one.eq($one)); + assert(!($one.eq($two))); + }, + ); + } + } + } + + #[test] + fn eq_tuples() { + comptime { + for i in 1..=12 { + let mut tuple1 = @[]; + let mut tuple2 = @[]; + for _ in 0..i - 1 { + tuple1 = tuple1.push_back(quote { 0 }); + tuple2 = tuple2.push_back(quote { 0 }); + } + tuple1 = tuple1.push_back(quote { 0 }); + tuple2 = tuple2.push_back(quote { 1 }); + let tuple1 = tuple1.join(quote { , }); + let tuple2 = tuple2.join(quote { , }); + let tuple1 = quote { ($tuple1,) }; + let tuple2 = quote { ($tuple2,) }; + unquote!( + quote { + assert($tuple1.eq($tuple1)); + assert(!($tuple1.eq($tuple2))); + }, + ) + } + } + } + + #[test] + fn cmp_unit() { + assert_eq(().cmp(()), Ordering::equal()); + } + + #[test] + fn cmp_bool() { + assert_eq(false.cmp(true), Ordering::less()); + assert_eq(false.cmp(false), Ordering::equal()); + assert_eq(true.cmp(true), Ordering::equal()); + assert_eq(true.cmp(false), Ordering::greater()); + } + + #[test] + fn cmp_integers() { + comptime { + for typ in @[ + quote { u8 }, + quote { i8 }, + quote { u16 }, + quote { i16 }, + quote { u32 }, + quote { i32 }, + quote { u64 }, + quote { i64 }, + quote { u128 }, + ] { + let one = f"1_{typ}".quoted_contents(); + let two = f"2_{typ}".quoted_contents(); + unquote!( + quote { + assert_eq($one.cmp($two), Ordering::less()); + assert_eq($one.cmp($one), Ordering::equal()); + assert_eq($two.cmp($one), Ordering::greater()); + }, + ); + } + } + } + + #[test] + fn cmp_tuples() { + comptime { + for i in 1..=12 { + let mut tuple1 = @[]; + let mut tuple2 = @[]; + for _ in 0..i - 1 { + tuple1 = tuple1.push_back(quote { 0_u8 }); + tuple2 = tuple2.push_back(quote { 0_u8 }); + } + tuple1 = tuple1.push_back(quote { 0_u8 }); + tuple2 = tuple2.push_back(quote { 1_u8 }); + let tuple1 = tuple1.join(quote { , }); + let tuple2 = tuple2.join(quote { , }); + let tuple1 = quote { ($tuple1,) }; + let tuple2 = quote { ($tuple2,) }; + unquote!( + quote { + assert_eq($tuple1.cmp($tuple1), Ordering::equal()); + assert_eq($tuple1.cmp($tuple2), Ordering::less()); + assert_eq($tuple2.cmp($tuple1), Ordering::greater()); + }, + ) + } + } + } + + #[test] + fn cmp_array() { + assert_eq([1_u8, 2, 3].cmp([1, 2, 3]), Ordering::equal()); + assert_eq([1_u8, 2, 3].cmp([1, 3, 2]), Ordering::less()); + assert_eq([1_u8, 3, 3].cmp([1, 2, 3]), Ordering::greater()); + } + + #[test] + fn cmp_vectors() { + // Equal lengths + assert_eq(@[1_u8, 2, 3].cmp(@[1, 2, 3]), Ordering::equal()); + assert_eq(@[1_u8, 3, 3].cmp(@[1, 2, 3]), Ordering::greater()); + assert_eq(@[1_u8, 2, 3].cmp(@[1, 3, 3]), Ordering::less()); + + // Different lengths + assert_eq(@[1_u8, 2].cmp(@[1, 2, 3]), Ordering::less()); + assert_eq(@[1_u8, 2, 3].cmp(@[1, 2]), Ordering::greater()); + assert_eq(@[10_u8, 0].cmp(@[9]), Ordering::greater()); + assert_eq(@[9_u8, 0].cmp(@[10]), Ordering::less()); + assert_eq(@[9_u8].cmp(@[10, 0]), Ordering::less()); + assert_eq(@[10_u8].cmp(@[9, 0]), Ordering::greater()); + } } diff --git a/stdlib/src/collections/bounded_vec.nr b/stdlib/src/collections/bounded_vec.nr index 3726480c..8f630254 100644 --- a/stdlib/src/collections/bounded_vec.nr +++ b/stdlib/src/collections/bounded_vec.nr @@ -40,7 +40,7 @@ impl BoundedVec { /// assert(empty_vector.len() == 0); /// ``` /// - /// Note that whenever calling `new` the maximum length of the vector should always be specified + /// Note that whenever calling `new` the maximum length of the vector should generally be specified /// via a type signature: /// /// ```noir @@ -60,10 +60,6 @@ impl BoundedVec { /// v3.push(5); /// } /// ``` - /// - /// This defaulting of `MaxLen` (and numeric generics in general) to zero may change in future noir versions - /// but for now make sure to use type annotations when using bounded vectors. Otherwise, you will receive a - /// constraint failure at runtime when the vec is pushed to. pub fn new() -> Self { let zeroed = crate::mem::zeroed(); BoundedVec { storage: [zeroed; MaxLen], len: 0 } @@ -83,7 +79,7 @@ impl BoundedVec { /// assert(first != last); /// } /// ``` - pub fn get(self, index: u32) -> T { + pub fn get(&self, index: u32) -> T { assert(index < self.len, "Attempted to read past end of BoundedVec"); self.get_unchecked(index) } @@ -107,7 +103,7 @@ impl BoundedVec { /// first + second + third /// } /// ``` - pub fn get_unchecked(self, index: u32) -> T { + pub fn get_unchecked(&self, index: u32) -> T { self.storage[index] } @@ -209,10 +205,62 @@ impl BoundedVec { /// let _ = v.pop(); /// assert(v.len() == 2); /// ``` - pub fn len(self) -> u32 { + pub fn len(&self) -> u32 { self.len } + /// Sets the length of the vector to any value between `0` and `MaxLen`. + /// + /// Increasing the length exposes elements that were written past the current + /// length (e.g. with `set_unchecked`); decreasing it discards trailing + /// elements. Note that this does not zero out any element of the backing storage, + /// so elements beyond the new length remain readable through `storage`. + /// + /// Example: + /// + /// ```noir + /// let mut v: BoundedVec = BoundedVec::from([1, 2, 3, 4, 5]); + /// + /// assert(v.len() == 5); + /// v.set_unchecked(5, 6); + /// v.set_unchecked(6, 7); + /// v.set_unchecked(7, 8); + /// v.set_len(8); + /// assert(v.len() == 8); + /// + /// // The length can also be reduced. + /// v.set_len(2); + /// assert(v.len() == 2); + /// ``` + pub fn set_len(&mut self, len: u32) { + assert(len <= MaxLen, "set_len out of bounds"); + self.len = len; + } + + /// Shortens the vector to `len`, keeping the first `len` elements. + /// + /// If `len` is greater than or equal to the current length, the vector is + /// left unchanged. Regardless of the current length, after this call the + /// vector is guaranteed to hold no more than `len` elements. + /// + /// Example: + /// + /// ```noir + /// let mut v: BoundedVec = BoundedVec::from([1, 2, 3, 4, 5]); + /// + /// v.truncate(3); + /// assert(v.len() == 3); + /// + /// // Truncating to a length greater than the current length is a no-op. + /// v.truncate(8); + /// assert(v.len() == 3); + /// ``` + pub fn truncate(&mut self, len: u32) { + if len < self.len() { + self.len = len; + } + } + /// Returns the maximum length of this vector. This is always /// equal to the `MaxLen` parameter this vector was initialized with. /// @@ -225,7 +273,7 @@ impl BoundedVec { /// v.push(10); /// assert(v.max_len() == 5); /// ``` - pub fn max_len(_self: BoundedVec) -> u32 { + pub fn max_len(_self: &BoundedVec) -> u32 { MaxLen } @@ -324,7 +372,10 @@ impl BoundedVec { self.storage[self.len + i] = vec.get_unchecked(i); } } else { - for i in 0..Len { + // Iterate to a static bound: the smaller of the two capacities, since we can + // neither read nor write past either. The source's actual length is dynamic. + let max = crate::cmp::min(Len, MaxLen); + for i in 0..max { if i < append_len { self.storage[self.len + i] = vec.get_unchecked(i); } @@ -372,10 +423,7 @@ impl BoundedVec { pub fn pop(&mut self) -> T { assert(self.len > 0, "cannot pop from an empty vector"); self.len -= 1; - - let elem = self.storage[self.len]; - self.storage[self.len] = crate::mem::zeroed(); - elem + self.storage[self.len] } /// Returns true if the given predicate returns true for any element @@ -419,7 +467,7 @@ impl BoundedVec { /// let expected = BoundedVec::from_array([2, 4, 6, 8]); /// assert_eq(result, expected); /// ``` - pub fn map(self, f: fn[Env](T) -> U) -> BoundedVec { + pub fn map(&self, f: fn[Env](T) -> U) -> BoundedVec { let mut ret = BoundedVec::new(); ret.len = self.len(); @@ -450,7 +498,7 @@ impl BoundedVec { /// let expected = BoundedVec::from_array([2, 5, 8, 11]); /// assert_eq(result, expected); /// ``` - pub fn mapi(self, f: fn[Env](u32, T) -> U) -> BoundedVec { + pub fn mapi(&self, f: fn[Env](u32, T) -> U) -> BoundedVec { let mut ret = BoundedVec::new(); ret.len = self.len(); @@ -481,7 +529,7 @@ impl BoundedVec { /// let expected = BoundedVec::from_array([2, 4, 6, 8]); /// assert_eq(result, expected); /// ``` - pub fn for_each(self, f: fn[Env](T) -> ()) { + pub fn for_each(&self, f: fn[Env](T) -> ()) { if is_unconstrained() { for i in 0..self.len() { f(self.get_unchecked(i)); @@ -507,7 +555,7 @@ impl BoundedVec { /// let expected = BoundedVec::from_array([2, 5, 8, 11]); /// assert_eq(result, expected); /// ``` - pub fn for_eachi(self, f: fn[Env](u32, T) -> ()) { + pub fn for_eachi(&self, f: fn[Env](u32, T) -> ()) { if is_unconstrained() { for i in 0..self.len() { f(i, self.get_unchecked(i)); @@ -524,10 +572,6 @@ impl BoundedVec { /// Creates a new BoundedVec from the given array and length. /// The given length must be less than or equal to the length of the array. /// - /// This function will zero out any elements at or past index `len` of `array`. - /// This incurs an extra runtime cost of O(MaxLen). If you are sure your array is - /// zeroed after that index, you can use [`from_parts_unchecked`][Self::from_parts_unchecked] to remove the extra loop. - /// /// Example: /// /// ```noir @@ -536,20 +580,6 @@ impl BoundedVec { /// ``` pub fn from_parts(mut array: [T; MaxLen], len: u32) -> Self { assert(len <= MaxLen); - let zeroed = crate::mem::zeroed(); - - if is_unconstrained() { - for i in len..MaxLen { - array[i] = zeroed; - } - } else { - for i in 0..MaxLen { - if i >= len { - array[i] = zeroed; - } - } - } - BoundedVec { storage: array, len } } @@ -576,6 +606,7 @@ impl BoundedVec { /// // fails because elements past the length are still checked in eq /// assert_eq(vec1, vec2); // fails /// ``` + #[deprecated("`BoundedVec::from_parts` no longer requires an extra loop, `BoundedVec::from_parts_unchecked` is no longer required")] pub fn from_parts_unchecked(array: [T; MaxLen], len: u32) -> Self { assert(len <= MaxLen); BoundedVec { storage: array, len } @@ -587,18 +618,47 @@ where T: Eq, { fn eq(self, other: BoundedVec) -> bool { - // TODO: https://github.com/noir-lang/noir/issues/4837 - // - // We make the assumption that the user has used the proper interface for working with `BoundedVec`s - // rather than directly manipulating the internal fields as this can result in an inconsistent internal state. if self.len == other.len { - self.storage == other.storage + if is_unconstrained() { + // safety: we are already in an unconstrained context + unsafe { + unconstrained_eq(self, other) + } + } else { + let mut eq = true; + for i in 0..MaxLen { + if i < self.len { + eq &= self.storage[i] == other.storage[i]; + } + } + eq + } } else { false } } } +/// Returns true if both BoundedVecs are equal. +/// Note: This assumes the lengths of both Vecs are already equal! +/// This function is broken out of `impl Eq for BoundedVec` to make use of `break` in unconstrained code. +unconstrained fn unconstrained_eq( + a: BoundedVec, + b: BoundedVec, +) -> bool +where + T: Eq, +{ + let mut eq = true; + for i in 0..a.len { + if a.storage[i] != b.storage[i] { + eq = false; + break; + } + } + eq +} + impl From<[T; Len]> for BoundedVec { fn from(array: [T; Len]) -> BoundedVec { BoundedVec::from_array(array) @@ -713,10 +773,120 @@ mod bounded_vec_tests { } } + mod set_len { + use crate::collections::bounded_vec::BoundedVec; + + #[test] + fn set_len_works_after_multiple_unchecked_sets() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3]); + vec.set_unchecked(3, 44); + vec.set_unchecked(4, 55); + vec.set_unchecked(5, 66); + // Index 6 is intentionally left untouched: it stays zeroed. + vec.set_len(8); + assert_eq(vec.len(), 8); + + // The explicitly written elements are exposed at their indices... + assert_eq(vec.get(3), 44); + assert_eq(vec.get(4), 55); + assert_eq(vec.get(5), 66); + // ...while the gap between the last write and the new length is zeroed. + assert_eq(vec.get(6), 0); + assert_eq(vec.get(7), 0); + + vec.extend_from_array([88, 99]); + assert_eq(vec.len(), 10); + } + + #[test] + fn set_len_can_reduce_the_length() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4, 5]); + vec.set_len(2); + assert_eq(vec.len(), 2); + // Reducing the length does not zero the backing storage, so the + // discarded elements remain readable through `storage`. + assert_eq(vec.storage()[2], 3); + assert_eq(vec.storage()[3], 4); + assert_eq(vec.storage()[4], 5); + } + + #[test(should_fail_with = "set_len out of bounds")] + fn panics_when_set_len_beyond_max_len() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3]); + vec.set_len(6); + } + } + + mod truncate { + use crate::collections::bounded_vec::BoundedVec; + + #[test] + fn truncate_shortens_to_len() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4, 5]); + vec.truncate(3); + assert_eq(vec.len(), 3); + assert_eq(vec.storage()[0], 1); + assert_eq(vec.storage()[1], 2); + assert_eq(vec.storage()[2], 3); + } + + #[test] + fn truncate_to_zero_empties_the_vec() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3]); + vec.truncate(0); + assert_eq(vec.len(), 0); + } + + #[test] + fn truncate_to_equal_len_is_noop() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3]); + vec.truncate(3); + assert_eq(vec.len(), 3); + } + + #[test] + fn truncate_to_greater_len_is_noop() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3]); + vec.truncate(8); + assert_eq(vec.len(), 3); + } + + #[test] + fn truncate_beyond_max_len_is_noop() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3]); + vec.truncate(100); + assert_eq(vec.len(), 3); + } + + #[test] + fn truncate_does_not_zero_remaining_storage() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4, 5]); + vec.truncate(2); + assert_eq(vec.len(), 2); + // Items beyond the new length are left untouched in the backing storage. + assert_eq(vec.storage()[2], 3); + assert_eq(vec.storage()[3], 4); + assert_eq(vec.storage()[4], 5); + } + + #[test] + fn truncate_then_push_continues_from_new_len() { + let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4, 5]); + vec.truncate(2); + vec.push(30); + assert_eq(vec.len(), 3); + assert_eq(vec.storage()[0], 1); + assert_eq(vec.storage()[1], 2); + assert_eq(vec.storage()[2], 30); + } + } + mod any { use crate::collections::bounded_vec::BoundedVec; + use crate::internal::test_unconstrained; #[test] + #[test_unconstrained] fn returns_false_if_predicate_not_satisfied() { let vec: BoundedVec = BoundedVec::from_array([false, false, false, false]); let result = vec.any(|value| value); @@ -725,6 +895,7 @@ mod bounded_vec_tests { } #[test] + #[test_unconstrained] fn returns_true_if_predicate_satisfied() { let vec: BoundedVec = BoundedVec::from_array([false, false, true, true]); let result = vec.any(|value| value); @@ -741,6 +912,7 @@ mod bounded_vec_tests { } #[test] + #[test_unconstrained] fn any_with_complex_predicates() { let vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4, 5]); @@ -764,8 +936,10 @@ mod bounded_vec_tests { mod map { use crate::collections::bounded_vec::BoundedVec; + use crate::internal::test_unconstrained; #[test] + #[test_unconstrained] fn applies_function_correctly() { // docs:start:bounded-vec-map-example let vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4]); @@ -825,8 +999,10 @@ mod bounded_vec_tests { mod mapi { use crate::collections::bounded_vec::BoundedVec; + use crate::internal::test_unconstrained; #[test] + #[test_unconstrained] fn applies_function_correctly() { // docs:start:bounded-vec-mapi-example let vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4]); @@ -868,6 +1044,7 @@ mod bounded_vec_tests { mod for_each { use crate::collections::bounded_vec::BoundedVec; + use crate::internal::test_unconstrained; // map in terms of for_each fn for_each_map( @@ -881,6 +1058,7 @@ mod bounded_vec_tests { } #[test] + #[test_unconstrained] fn smoke_test() { let mut acc = 0; let acc_ref = &mut acc; @@ -940,6 +1118,7 @@ mod bounded_vec_tests { mod for_eachi { use crate::collections::bounded_vec::BoundedVec; + use crate::internal::test_unconstrained; // mapi in terms of for_eachi fn for_eachi_mapi( @@ -953,6 +1132,7 @@ mod bounded_vec_tests { } #[test] + #[test_unconstrained] fn smoke_test() { let mut acc = 0; let acc_ref = &mut acc; @@ -1095,55 +1275,53 @@ mod bounded_vec_tests { #[test] fn empty_equality() { + let bounded_vec1: BoundedVec = BoundedVec::new(); + let bounded_vec2: BoundedVec = BoundedVec::new(); + + assert_eq(bounded_vec1, bounded_vec2); + } + + #[test] + fn equality() { let mut bounded_vec1: BoundedVec = BoundedVec::new(); let mut bounded_vec2: BoundedVec = BoundedVec::new(); - assert_eq(bounded_vec1, bounded_vec2); + bounded_vec1.push(1); + bounded_vec2.push(1); + assert(bounded_vec1 == bounded_vec2); } #[test] fn inequality() { let mut bounded_vec1: BoundedVec = BoundedVec::new(); let mut bounded_vec2: BoundedVec = BoundedVec::new(); + bounded_vec1.push(1); - bounded_vec2.push(2); + assert(bounded_vec1 != bounded_vec2); + bounded_vec2.push(2); assert(bounded_vec1 != bounded_vec2); } } mod from_parts { use crate::collections::bounded_vec::BoundedVec; + use crate::internal::test_unconstrained; #[test] + #[test_unconstrained] fn from_parts() { // docs:start:from-parts let vec: BoundedVec = BoundedVec::from_parts([1, 2, 3, 0], 3); assert_eq(vec.len(), 3); - // Any elements past the given length are zeroed out, so these + // Any elements past the given length are ignored, so these // two BoundedVecs will be completely equal let vec1: BoundedVec = BoundedVec::from_parts([1, 2, 3, 1], 3); let vec2: BoundedVec = BoundedVec::from_parts([1, 2, 3, 2], 3); assert_eq(vec1, vec2); // docs:end:from-parts } - - #[test] - fn from_parts_unchecked() { - // docs:start:from-parts-unchecked - let vec: BoundedVec = BoundedVec::from_parts_unchecked([1, 2, 3, 0], 3); - assert_eq(vec.len(), 3); - - // invalid use! - let vec1: BoundedVec = BoundedVec::from_parts_unchecked([1, 2, 3, 1], 3); - let vec2: BoundedVec = BoundedVec::from_parts_unchecked([1, 2, 3, 2], 3); - - // both vecs have length 3 so we'd expect them to be equal, but this - // fails because elements past the length are still checked in eq - assert(vec1 != vec2); - // docs:end:from-parts-unchecked - } } mod push_pop { @@ -1211,6 +1389,7 @@ mod bounded_vec_tests { mod extend { use crate::collections::bounded_vec::BoundedVec; + use crate::internal::test_unconstrained; #[test] fn extend_from_array() { @@ -1237,9 +1416,12 @@ mod bounded_vec_tests { } #[test] + #[test_unconstrained] fn extend_from_bounded_vec() { + // The source deliberately has a higher capacity, + // to make sure we are not trying to assign out-of-bounds. let mut vec1: BoundedVec = BoundedVec::new(); - let mut vec2: BoundedVec = BoundedVec::new(); + let mut vec2: BoundedVec = BoundedVec::new(); vec1.push(1); vec2.push(2); @@ -1253,6 +1435,109 @@ mod bounded_vec_tests { assert_eq(vec1.get(2), 3); } + #[test] + fn extend_from_bounded_vec_limit() { + // Capacity and contents chosen so the last item must be assigned to. + let mut vec1: BoundedVec = BoundedVec::new(); + let mut vec2: BoundedVec = BoundedVec::new(); + + vec1.push(1); + vec2.push(2); + + vec1.extend_from_bounded_vec(vec2); + + assert_eq(vec1.len(), 2); + assert_eq(vec1.get(0), 1); + assert_eq(vec1.get(1), 2); + } + + #[test] + fn extend_from_bounded_vec_full_and_empty() { + // Capacity and contents chosen so the last item must be assigned to. + let mut vec1: BoundedVec = BoundedVec::new(); + let vec2: BoundedVec = BoundedVec::new(); + + vec1.push(1); + vec1.push(2); + + vec1.extend_from_bounded_vec(vec2); + + assert_eq(vec1.len(), 2); + assert_eq(vec1.get(0), 1); + assert_eq(vec1.get(1), 2); + } + + #[test] + fn extend_from_bounded_vec_zero_len() { + let mut vec1: BoundedVec = BoundedVec::new(); + let vec2: BoundedVec = BoundedVec::new(); + + vec1.extend_from_bounded_vec(vec2); + + assert_eq(vec1.len(), 0); + } + + #[test] + fn extend_from_bounded_vec_last_zeroed() { + let mut vec1: BoundedVec = BoundedVec::new(); + let mut vec2: BoundedVec = BoundedVec::new(); + + vec1.push(1); + vec1.push(2); + vec2.push(3); + + vec1.extend_from_bounded_vec(vec2); + + assert_eq(vec1.len(), 3); + assert_eq(vec1.get_unchecked(3), 0); + } + + #[test] + fn extend_from_bounded_vec_empty_self() { + // self.len == 0 with Len > MaxLen: the source is clamped to + // MaxLen elements, filling the destination exactly to capacity. + let mut vec1: BoundedVec = BoundedVec::new(); + let vec2: BoundedVec = BoundedVec::from_array([1, 2, 3]); + + vec1.extend_from_bounded_vec(vec2); + + assert_eq(vec1.len(), 3); + assert_eq(vec1.get(0), 1); + assert_eq(vec1.get(1), 2); + assert_eq(vec1.get(2), 3); + } + + #[test] + #[test_unconstrained] + fn extend_from_bounded_vec_preserves_tail_storage() { + // The destination has meaningful (nonzero) storage past `len`. + // Extending must leave that tail untouched, identically in the + // constrained and unconstrained branches. + let mut dst: BoundedVec = BoundedVec::from_parts([10, 99, 123, 7], 1); + let src: BoundedVec = BoundedVec::from_parts([20, 0, 0, 0], 1); + + dst.extend_from_bounded_vec(src); + + assert_eq(dst.len(), 2); + assert_eq(dst.storage(), [10, 20, 123, 7]); + } + + #[test] + fn extend_from_bounded_vec_equal_capacity() { + // Len == MaxLen, fills to capacity. + let mut vec1: BoundedVec = BoundedVec::new(); + vec1.push(1); + let vec2: BoundedVec = BoundedVec::from_array([2, 3, 4]); + + vec1.extend_from_bounded_vec(vec2); + + assert_eq(vec1.len(), 4); + assert_eq(vec1.get(0), 1); + assert_eq(vec1.get(1), 2); + assert_eq(vec1.get(2), 3); + assert_eq(vec1.get(3), 4); + } + #[test(should_fail_with = "extend_from_array out of bounds")] fn extend_array_beyond_max_len() { let mut vec: BoundedVec = BoundedVec::new(); @@ -1317,8 +1602,8 @@ mod bounded_vec_tests { let mut vec: BoundedVec = BoundedVec::from_array([1, 2, 3]); let _ = vec.pop(); - // after pop, the last element should be zeroed - assert_eq(vec.storage(), [1, 2, 0]); + // after pop, the last element should be unmodified + assert_eq(vec.storage(), [1, 2, 3]); assert_eq(vec.len(), 2); } diff --git a/stdlib/src/collections/map.nr b/stdlib/src/collections/map.nr deleted file mode 100644 index f5c570af..00000000 --- a/stdlib/src/collections/map.nr +++ /dev/null @@ -1,716 +0,0 @@ -use crate::cmp::Eq; -use crate::collections::bounded_vec::BoundedVec; -use crate::default::Default; -use crate::hash::{BuildHasher, Hash}; -use crate::option::Option; - -// We use load factor alpha_max = 0.75. -// Upon exceeding it, assert will fail in order to inform the user -// about performance degradation, so that he can adjust the capacity. -global MAX_LOAD_FACTOR_NUMERATOR: u32 = 3; -global MAX_LOAD_FACTOR_DENOMINATOR: u32 = 4; - -/// `HashMap` is used to efficiently store and look up key-value pairs. -/// -/// `HashMap` is a bounded type which can store anywhere from zero to `MaxLen` total elements. -/// Note that due to hash collisions, the actual maximum number of elements stored by any particular -/// hashmap is likely lower than `MaxLen`. This is true even with cryptographic hash functions since -/// every hash value will be performed modulo `MaxLen`. -/// -/// Example: -/// -/// ```noir -/// // Create a mapping from Fields to u32s with a maximum length of 12 -/// // using a poseidon2 hasher -/// use std::hash::poseidon2::Poseidon2Hasher; -/// let mut map: HashMap> = HashMap::default(); -/// -/// map.insert(1, 2); -/// map.insert(3, 4); -/// -/// let two = map.get(1).unwrap(); -/// ``` -pub struct HashMap { - _table: [Slot; N], - - /// Amount of valid elements in the map. - _len: u32, - - _build_hasher: B, -} - -// Data unit in the HashMap table. -// In case Noir adds support for enums in the future, this -// should be refactored to have three states: -// 1. (key, value) -// 2. (empty) -// 3. (deleted) -struct Slot { - _key: K, - _value: V, - _is_present: bool, - _is_deleted: bool, -} - -impl Default for Slot { - fn default() -> Self { - Slot { - _key: crate::mem::zeroed(), - _value: crate::mem::zeroed(), - _is_present: false, - _is_deleted: false, - } - } -} - -impl Slot { - fn is_valid(self) -> bool { - !self._is_deleted & self._is_present - } - - fn is_available(self) -> bool { - self._is_deleted | !self._is_present - } - - fn set(&mut self, key: K, value: V) { - self._key = key; - self._value = value; - self._is_present = true; - self._is_deleted = false; - } - - // Shall not override `_key_value` with Option::none(), - // because we must be able to differentiate empty - // and deleted slots for lookup. - fn mark_deleted(&mut self) { - self._is_deleted = true; - } -} - -// While conducting lookup, we iterate attempt from 0 to N - 1 due to heuristic, -// that if we have went that far without finding desired, -// it is very unlikely to be after - performance will be heavily degraded. -impl HashMap { - /// Creates a hashmap with an existing `BuildHasher`. This can be used to ensure multiple - /// hashmaps are created with the same hasher instance. - /// - /// Example: - /// - /// ```noir - /// let my_hasher: BuildHasherDefault = Default::default(); - /// let hashmap: HashMap> = HashMap::with_hasher(my_hasher); - /// assert(hashmap.is_empty()); - /// ``` - // docs:start:with_hasher - pub fn with_hasher(_build_hasher: B) -> Self - where - B: BuildHasher, - { - // docs:end:with_hasher - let _table = [Slot::default(); N]; - let _len = 0; - Self { _table, _len, _build_hasher } - } - - /// Clears the hashmap, removing all key-value pairs from it. - /// - /// Example: - /// - /// ```noir - /// assert(!map.is_empty()); - /// map.clear(); - /// assert(map.is_empty()); - /// ``` - // docs:start:clear - pub fn clear(&mut self) { - // docs:end:clear - self._table = [Slot::default(); N]; - self._len = 0; - } - - /// Returns `true` if the hashmap contains the given key. Unlike [`get`][Self::get], this will not also return - /// the value associated with the key. - /// - /// Example: - /// - /// ```noir - /// if map.contains_key(7) { - /// let value = map.get(7); - /// assert(value.is_some()); - /// } else { - /// println("No value for key 7!"); - /// } - /// ``` - // docs:start:contains_key - pub fn contains_key(self, key: K) -> bool - where - K: Hash + Eq, - B: BuildHasher, - { - // docs:end:contains_key - self.get(key).is_some() - } - - /// Returns `true` if the length of the hash map is empty. - /// - /// Example: - /// - /// ```noir - /// assert(map.is_empty()); - /// - /// map.insert(1, 2); - /// assert(!map.is_empty()); - /// - /// map.remove(1); - /// assert(map.is_empty()); - /// ``` - // docs:start:is_empty - pub fn is_empty(self) -> bool { - // docs:end:is_empty - self._len == 0 - } - - /// Returns a vector of each key-value pair present in the hashmap. - /// - /// The length of the returned vector is always equal to the length of the hashmap. - /// - /// Example: - /// - /// ```noir - /// let entries = map.entries(); - /// - /// // The length of a hashmap may not be compile-time known, so we - /// // need to loop over its capacity instead - /// for i in 0..map.capacity() { - /// if i < entries.len() { - /// let (key, value) = entries.get(i); - /// println(f"{key} -> {value}"); - /// } - /// } - /// ``` - // docs:start:entries - pub fn entries(self) -> BoundedVec<(K, V), N> { - // docs:end:entries - let mut entries = BoundedVec::new(); - - for slot in self._table { - if slot.is_valid() { - // SAFETY: slot.is_valid() should ensure there is a valid key-value pairing here - entries.push((slot._key, slot._value)); - } - } - - let self_len = self._len; - let entries_len = entries.len(); - let msg = - f"Amount of valid elements should have been {self_len} times, but got {entries_len}."; - assert(entries.len() == self._len, msg); - - entries - } - - /// Returns a vector of each key present in the hashmap. - /// - /// The length of the returned vector is always equal to the length of the hashmap. - /// - /// Example: - /// - /// ```noir - /// let keys = map.keys(); - /// - /// for i in 0..keys.max_len() { - /// if i < keys.len() { - /// let key = keys.get_unchecked(i); - /// let value = map.get(key).unwrap_unchecked(); - /// println(f"{key} -> {value}"); - /// } - /// } - /// ``` - // docs:start:keys - pub fn keys(self) -> BoundedVec { - // docs:end:keys - let mut keys = BoundedVec::new(); - - for slot in self._table { - if slot.is_valid() { - keys.push(slot._key); - } - } - - let self_len = self._len; - let keys_len = keys.len(); - let msg = - f"Amount of valid elements should have been {self_len} times, but got {keys_len}."; - assert(keys.len() == self._len, msg); - - keys - } - - /// Returns a vector of each value present in the hashmap. - /// - /// The length of the returned vector is always equal to the length of the hashmap. - /// - /// Example: - /// - /// ```noir - /// let values = map.values(); - /// - /// for i in 0..values.max_len() { - /// if i < values.len() { - /// let value = values.get_unchecked(i); - /// println(f"Found value {value}"); - /// } - /// } - /// ``` - // docs:start:values - pub fn values(self) -> BoundedVec { - // docs:end:values - let mut values = BoundedVec::new(); - - for slot in self._table { - if slot.is_valid() { - values.push(slot._value); - } - } - - let self_len = self._len; - let values_len = values.len(); - let msg = - f"Amount of valid elements should have been {self_len} times, but got {values_len}."; - assert(values.len() == self._len, msg); - - values - } - - /// Iterates through each key-value pair of the HashMap, setting each key-value pair to the - /// result returned from the given function. - /// - /// Note that since keys can be mutated, the HashMap needs to be rebuilt as it is iterated - /// through. If this is not desired, use [`iter_values_mut`][Self::iter_values_mut] if only values need to be mutated, - /// or [`entries`][Self::entries] if neither keys nor values need to be mutated. - /// - /// The iteration order is left unspecified. As a result, if two keys are mutated to become - /// equal, which of the two values that will be present for the key in the resulting map is also unspecified. - /// - /// Example: - /// - /// ```noir - /// // Add 1 to each key in the map, and double the value associated with that key. - /// map.iter_mut(|k, v| (k + 1, v * 2)); - /// ``` - // docs:start:iter_mut - pub fn iter_mut(&mut self, f: fn(K, V) -> (K, V)) - where - K: Eq + Hash, - B: BuildHasher, - { - // docs:end:iter_mut - let mut entries = self.entries(); - let mut new_map = HashMap::with_hasher(self._build_hasher); - - for i in 0..N { - if i < self._len { - let entry = entries.get_unchecked(i); - let (key, value) = f(entry.0, entry.1); - new_map.insert(key, value); - } - } - - self._table = new_map._table; - self._len = new_map._len; - } - - /// Iterates through the HashMap, mutating each key to the result returned from - /// the given function. - /// - /// Note that since keys can be mutated, the HashMap needs to be rebuilt as it is iterated - /// through. If only iteration is desired and the keys are not intended to be mutated, - /// prefer using [`entries`][Self::entries] instead. - /// - /// The iteration order is left unspecified. As a result, if two keys are mutated to become - /// equal, which of the two values that will be present for the key in the resulting map is also unspecified. - /// - /// Example: - /// - /// ```noir - /// // Double each key, leaving the value associated with that key untouched - /// map.iter_keys_mut(|k| k * 2); - /// ``` - // docs:start:iter_keys_mut - pub fn iter_keys_mut(&mut self, f: fn(K) -> K) - where - K: Eq + Hash, - B: BuildHasher, - { - // docs:end:iter_keys_mut - let mut entries = self.entries(); - let mut new_map = HashMap::with_hasher(self._build_hasher); - - for i in 0..N { - if i < self._len { - let entry = entries.get_unchecked(i); - let (key, value) = (f(entry.0), entry.1); - new_map.insert(key, value); - } - } - - self._table = new_map._table; - self._len = new_map._len; - } - - /// Iterates through the HashMap, applying the given function to each value and mutating the - /// value to equal the result. This function is more efficient than [`iter_mut`][Self::iter_mut] and [`iter_keys_mut`][Self::iter_keys_mut] - /// because the keys are untouched and the underlying hashmap thus does not need to be reordered. - /// - /// Example: - /// - /// ```noir - /// // Halve each value - /// map.iter_values_mut(|v| v / 2); - /// ``` - // docs:start:iter_values_mut - pub fn iter_values_mut(&mut self, f: fn(V) -> V) { - // docs:end:iter_values_mut - for i in 0..N { - let mut slot = self._table[i]; - if slot.is_valid() { - slot._value = f(slot._value); - self._table[i] = slot; - } - } - } - - /// Retains only the key-value pairs for which the given function returns true. - /// Any key-value pairs for which the function returns false will be removed from the map. - /// - /// Example: - /// - /// ```noir - /// map.retain(|k, v| (k != 0) & (v != 0)); - /// ``` - // docs:start:retain - pub fn retain(&mut self, f: fn(K, V) -> bool) { - // docs:end:retain - for index in 0..N { - let mut slot = self._table[index]; - if slot.is_valid() { - if !f(slot._key, slot._value) { - slot.mark_deleted(); - self._len -= 1; - self._table[index] = slot; - } - } - } - } - - /// Returns the current length of this hash map. - /// - /// Example: - /// - /// ```noir - /// // This is equivalent to checking map.is_empty() - /// assert(map.len() == 0); - /// - /// map.insert(1, 2); - /// map.insert(3, 4); - /// map.insert(5, 6); - /// assert(map.len() == 3); - /// - /// // 3 was already present as a key in the hash map, so the length is unchanged - /// map.insert(3, 7); - /// assert(map.len() == 3); - /// - /// map.remove(1); - /// assert(map.len() == 2); - /// ``` - // docs:start:len - pub fn len(self) -> u32 { - // docs:end:len - self._len - } - - /// Returns the maximum capacity of this hashmap. This is always equal to the capacity - /// specified in the hashmap's type. - /// - /// Unlike hashmaps in general purpose programming languages, hashmaps in Noir have a - /// static capacity that does not increase as the map grows larger. Thus, this capacity - /// is also the maximum possible element count that can be inserted into the hashmap. - /// Due to hash collisions (modulo the hashmap length), it is likely the actual maximum - /// element count will be lower than the full capacity. - /// - /// Example: - /// - /// ```noir - /// let empty_map: HashMap> = HashMap::default(); - /// assert(empty_map.len() == 0); - /// assert(empty_map.capacity() == 42); - /// ``` - // docs:start:capacity - pub fn capacity(_self: Self) -> u32 { - // docs:end:capacity - N - } - - /// Retrieves a value from the hashmap, returning `Option::none()` if it was not found. - /// - /// Example: - /// - /// ```noir - /// fn get_example(map: HashMap>) { - /// let x = map.get(12); - /// - /// if x.is_some() { - /// assert(x.unwrap() == 42); - /// } - /// } - /// ``` - // docs:start:get - pub fn get(self, key: K) -> Option - where - K: Eq + Hash, - B: BuildHasher, - { - // docs:end:get - let mut result = Option::none(); - - let hash = self.hash(key); - let mut should_break = false; - - for attempt in 0..N { - if !should_break { - let index = self.quadratic_probe(hash, attempt as u32); - let slot = self._table[index]; - - // Not marked as deleted and has key-value. - if slot.is_valid() { - if slot._key == key { - result = Option::some(slot._value); - should_break = true; - } - } - } - } - - result - } - - /// Inserts a new key-value pair into the map. If the key was already in the map, its - /// previous value will be overridden with the newly provided one. - /// - /// Example: - /// - /// ```noir - /// let mut map: HashMap> = HashMap::default(); - /// map.insert(12, 42); - /// assert(map.len() == 1); - /// ``` - // docs:start:insert - pub fn insert(&mut self, key: K, value: V) - where - K: Eq + Hash, - B: BuildHasher, - { - // docs:end:insert - self.assert_load_factor(); - - let hash = self.hash(key); - let mut should_break = false; - - for attempt in 0..N { - if !should_break { - let index = self.quadratic_probe(hash, attempt as u32); - let mut slot = self._table[index]; - let mut insert = false; - - // Either marked as deleted or has unset key-value. - if slot.is_available() { - insert = true; - self._len += 1; - } else { - if slot._key == key { - insert = true; - } - } - - if insert { - slot.set(key, value); - self._table[index] = slot; - should_break = true; - } - } - } - } - - /// Removes the given key-value pair from the map. If the key was not already present - /// in the map, this does nothing. - /// - /// Example: - /// - /// ```noir - /// let mut map: HashMap> = HashMap::default(); - /// map.insert(12, 42); - /// assert(!map.is_empty()); - /// - /// map.remove(12); - /// assert(map.is_empty()); - /// - /// // If a key was not present in the map, remove does nothing - /// map.remove(12); - /// assert(map.is_empty()); - /// ``` - // docs:start:remove - pub fn remove(&mut self, key: K) - where - K: Eq + Hash, - B: BuildHasher, - { - // docs:end:remove - let hash = self.hash(key); - let mut should_break = false; - - for attempt in 0..N { - if !should_break { - let index = self.quadratic_probe(hash, attempt as u32); - let mut slot = self._table[index]; - - // Not marked as deleted and has key-value. - if slot.is_valid() { - if slot._key == key { - slot.mark_deleted(); - self._table[index] = slot; - self._len -= 1; - should_break = true; - } - } - } - } - } - - // Apply HashMap's hasher onto key to obtain pre-hash for probing. - fn hash(self, key: K) -> u32 - where - K: Hash, - B: BuildHasher, - { - let mut hasher = self._build_hasher.build_hasher(); - key.hash(&mut hasher); - hasher.finish() as u32 - } - - // Probing scheme: quadratic function. - // We use 0.5 constant near variadic attempt and attempt^2 monomials. - // This ensures good uniformity of distribution for table sizes - // equal to prime numbers or powers of two. - fn quadratic_probe(_self: Self, hash: u32, attempt: u32) -> u32 { - // use u64 to prevent overflow in attempt * attempt - let attempt_u64 = attempt as u64; - let offset = (attempt_u64 + attempt_u64 * attempt_u64) / 2; - ((hash as u64 + offset) % (N as u64)) as u32 - } - - // Amount of elements in the table in relation to available slots exceeds alpha_max. - // To avoid a comparatively more expensive division operation - // we conduct cross-multiplication instead. - // n / m >= MAX_LOAD_FACTOR_NUMERATOR / MAX_LOAD_FACTOR_DENOMINATOR - // n * MAX_LOAD_FACTOR_DENOMINATOR >= m * MAX_LOAD_FACTOR_NUMERATOR - fn assert_load_factor(self) { - let lhs = self._len * MAX_LOAD_FACTOR_DENOMINATOR; - let rhs = self._table.len() * MAX_LOAD_FACTOR_NUMERATOR; - let exceeded = lhs >= rhs; - assert(!exceeded, "Load factor is exceeded, consider increasing the capacity."); - } -} - -// Equality class on HashMap has to test that they have -// equal sets of key-value entries, -// thus one is a subset of the other and vice versa. -// docs:start:eq -impl Eq for HashMap -where - K: Eq + Hash, - V: Eq, - B: BuildHasher, -{ - /// Checks if two HashMaps are equal. - /// - /// Example: - /// - /// ```noir - /// let mut map1: HashMap> = HashMap::default(); - /// let mut map2: HashMap> = HashMap::default(); - /// - /// map1.insert(1, 2); - /// map1.insert(3, 4); - /// - /// map2.insert(3, 4); - /// map2.insert(1, 2); - /// - /// assert(map1 == map2); - /// ``` - fn eq(self, other: HashMap) -> bool { - // docs:end:eq - let mut equal = false; - - if self.len() == other.len() { - equal = true; - for slot in self._table { - // Not marked as deleted and has key-value. - if equal & slot.is_valid() { - let other_value = other.get(slot._key); - - if other_value.is_none() { - equal = false; - } else { - let other_value = other_value.unwrap_unchecked(); - if slot._value != other_value { - equal = false; - } - } - } - } - } - - equal - } -} - -// docs:start:default -impl Default for HashMap -where - B: BuildHasher + Default, -{ - /// Constructs an empty HashMap. - /// - /// Example: - /// - /// ```noir - /// let hashmap: HashMap> = HashMap::default(); - /// assert(hashmap.is_empty()); - /// ``` - fn default() -> Self { - // docs:end:default - let _build_hasher = B::default(); - let map: HashMap = HashMap::with_hasher(_build_hasher); - map - } -} - -mod test { - use crate::default::Default; - use crate::hash::BuildHasherDefault; - use crate::hash::poseidon2::Poseidon2Hasher; - use super::HashMap; - - #[test] - pub fn test_quadratic_probe_function() { - let map: HashMap> = - HashMap::default(); - - let hash1: u32 = 123; - let attempt1: u32 = 1000000; - - let result: u32 = map.quadratic_probe(hash1, attempt1); - // Ensure no overflow occurs when calculating the result - assert(result == 123, "Result should be within table bounds"); - } -} diff --git a/stdlib/src/collections/mod.nr b/stdlib/src/collections/mod.nr index d11e9f2f..a5a15e87 100644 --- a/stdlib/src/collections/mod.nr +++ b/stdlib/src/collections/mod.nr @@ -1,4 +1,2 @@ -pub mod vec; pub mod bounded_vec; -pub mod map; pub mod umap; diff --git a/stdlib/src/collections/umap.nr b/stdlib/src/collections/umap.nr index 4db0d1d1..0a45afe6 100644 --- a/stdlib/src/collections/umap.nr +++ b/stdlib/src/collections/umap.nr @@ -3,7 +3,7 @@ use crate::default::Default; use crate::hash::{BuildHasher, Hash}; use crate::option::Option; -// An unconstrained hash table with open addressing and quadratic probing. +// An unconstrained hash table with open addressing and linear probing. // Note that "unconstrained" here means that almost all operations on this // map are unconstrained and importantly are not constrained afterward either. // This map is meant to be used in unconstrained or comptime code where this @@ -45,14 +45,10 @@ impl Default for Slot { } impl Slot { - fn is_valid(self) -> bool { + fn is_valid(&self) -> bool { !self._is_deleted & self._is_present } - fn is_available(self) -> bool { - self._is_deleted | !self._is_present - } - fn set(&mut self, key: K, value: V) { self._key = key; self._value = value; @@ -72,7 +68,7 @@ impl Slot { // that if we have went that far without finding desired, // it is very unlikely to be after - performance will be heavily degraded. impl UHashMap { - // Creates a new instance of UHashMap with specified BuildHasher. + /// Creates a new instance of UHashMap with specified BuildHasher. // docs:start:with_hasher pub fn with_hasher(_build_hasher: B) -> Self where @@ -88,7 +84,7 @@ impl UHashMap { where B: BuildHasher, { - // docs:end:with_hasher + let capacity = if capacity == 0 { 1 } else { capacity }; let mut _table = [].as_vector(); for _ in 0..capacity { _table = _table.push_back(Slot::default()); @@ -97,41 +93,40 @@ impl UHashMap { Self { _table, _len, _build_hasher } } - // Clears the map, removing all key-value entries. + /// Clears the map, removing all key-value entries. // docs:start:clear - pub fn clear(&mut self) { + pub unconstrained fn clear(&mut self) { // docs:end:clear self._table = [Slot::default()].as_vector(); self._len = 0; } - // Returns true if the map contains a value for the specified key. + /// Returns true if the map contains a value for the specified key. // docs:start:contains_key - pub fn contains_key(self, key: K) -> bool + pub unconstrained fn contains_key(&self, key: K) -> bool where K: Hash + Eq, B: BuildHasher, { // docs:end:contains_key - // Safety: unconstrained context - unsafe { self.get(key) }.is_some() + self.get(key).is_some() } - // Returns true if the map contains no elements. + /// Returns true if the map contains no elements. // docs:start:is_empty - pub fn is_empty(self) -> bool { + pub unconstrained fn is_empty(&self) -> bool { // docs:end:is_empty self._len == 0 } - // Returns a BoundedVec of all valid entries in this UHashMap. - // The length of the returned vector will always match the length of this UHashMap. + /// Returns a vector of all valid entries in this UHashMap. + /// The length of the returned vector will always match the length of this UHashMap. // docs:start:entries - pub fn entries(self) -> [(K, V)] { + pub unconstrained fn entries(&self) -> [(K, V)] { // docs:end:entries let mut entries = [].as_vector(); - for slot in self._table { + for slot in &self._table { if slot.is_valid() { // SAFETY: slot.is_valid() should ensure there is a valid key-value pairing here entries = entries.push_back((slot._key, slot._value)); @@ -147,14 +142,14 @@ impl UHashMap { entries } - // Returns a BoundedVec containing all the keys within this UHashMap. - // The length of the returned vector will always match the length of this UHashMap. + /// Returns a vector containing all the keys within this UHashMap. + /// The length of the returned vector will always match the length of this UHashMap. // docs:start:keys - pub fn keys(self) -> [K] { + pub unconstrained fn keys(&self) -> [K] { // docs:end:keys let mut keys = [].as_vector(); - for slot in self._table { + for slot in &self._table { if slot.is_valid() { keys = keys.push_back(slot._key); } @@ -169,14 +164,14 @@ impl UHashMap { keys } - // Returns a BoundedVec containing all the values within this UHashMap. - // The length of the returned vector will always match the length of this UHashMap. + /// Returns a vector containing all the values within this UHashMap. + /// The length of the returned vector will always match the length of this UHashMap. // docs:start:values - pub fn values(self) -> [V] { + pub unconstrained fn values(&self) -> [V] { // docs:end:values let mut values = [].as_vector(); - for slot in self._table { + for slot in &self._table { if slot.is_valid() { values = values.push_back(slot._value); } @@ -191,7 +186,7 @@ impl UHashMap { values } - // For each key-value entry applies mutator function. + /// For each key-value entry applies mutator function. // docs:start:iter_mut pub unconstrained fn iter_mut(&mut self, f: fn(K, V) -> (K, V)) where @@ -199,19 +194,19 @@ impl UHashMap { B: BuildHasher, { // docs:end:iter_mut - let mut entries = self.entries(); + let entries = self.entries(); let mut new_map = UHashMap::with_hasher(self._build_hasher); for entry in entries { let (key, value) = f(entry.0, entry.1); - new_map.insert(key, value); + let _ = new_map.insert(key, value); } - self._table = new_map._table; self._len = new_map._len; + self._table = new_map._table; } - // For each key applies mutator function. + /// For each key applies mutator function. // docs:start:iter_keys_mut pub unconstrained fn iter_keys_mut(&mut self, f: fn(K) -> K) where @@ -219,21 +214,23 @@ impl UHashMap { B: BuildHasher, { // docs:end:iter_keys_mut - let mut entries = self.entries(); + let entries = self.entries(); let mut new_map = UHashMap::with_hasher(self._build_hasher); for entry in entries { let (key, value) = (f(entry.0), entry.1); - new_map.insert(key, value); + let _ = new_map.insert(key, value); } - self._table = new_map._table; self._len = new_map._len; + // The ownership pass being unsophisticated means we avoid a clone if we + // set the table after the len instead of before + self._table = new_map._table; } - // For each value applies mutator function. + /// For each value applies mutator function. // docs:start:iter_values_mut - pub fn iter_values_mut(&mut self, f: fn(V) -> V) { + pub unconstrained fn iter_values_mut(&mut self, f: fn(V) -> V) { // docs:end:iter_values_mut for i in 0..self._table.len() { let mut slot = self._table[i]; @@ -244,9 +241,9 @@ impl UHashMap { } } - // Retains only the elements specified by the predicate. + /// Retains only the elements specified by the predicate. // docs:start:retain - pub fn retain(&mut self, f: fn(K, V) -> bool) { + pub unconstrained fn retain(&mut self, f: fn(K, V) -> bool) { // docs:end:retain for index in 0..self._table.len() { let mut slot = self._table[index]; @@ -260,23 +257,23 @@ impl UHashMap { } } - // Amount of active key-value entries. + /// Amount of active key-value entries. // docs:start:len - pub fn len(self) -> u32 { + pub unconstrained fn len(&self) -> u32 { // docs:end:len self._len } - // Get the current capacity of the inner table. + /// Get the current capacity of the inner table. // docs:start:capacity - pub fn capacity(self: Self) -> u32 { + pub unconstrained fn capacity(&self) -> u32 { // docs:end:capacity self._table.len() } - // Get the value by key. If it does not exist, returns none(). + /// Get the value by key. If it does not exist, returns none(). // docs:start:get - pub unconstrained fn get(self, key: K) -> Option + pub unconstrained fn get(&self, key: K) -> Option where K: Eq + Hash, B: BuildHasher, @@ -302,9 +299,12 @@ impl UHashMap { result } - // Insert key-value entry. In case key was already present, value is overridden. + /// Insert key-value entry. In case key was already present, value is overridden. + /// + /// Returns true if the element was newly-inserted. In other words, this returns false + /// if the key already has a value in this map. // docs:start:insert - pub unconstrained fn insert(&mut self, key: K, value: V) + pub unconstrained fn insert(&mut self, key: K, value: V) -> bool where K: Eq + Hash, B: BuildHasher, @@ -313,28 +313,45 @@ impl UHashMap { self.try_resize(); let hash = self.hash(key); + let mut insert_index: u32 = 0; + let mut increment_length = false; + let mut found_deleted_candidate = false; for attempt in 0..self._table.len() { - let index = self.linear_probe(hash, attempt as u32); - let mut slot = self._table[index]; - let mut insert = false; + let index = self.linear_probe(hash, attempt); + let slot = self._table[index]; - // Either marked as deleted or has unset key-value. - if slot.is_available() { - insert = true; - self._len += 1; - } else { + if slot.is_valid() { if slot._key == key { - insert = true; + // Key exists: update in place without changing length. + insert_index = index; + break; } - } - - if insert { - slot.set(key, value); - self._table[index] = slot; + } else if slot._is_deleted { + // Deleted slot: remember as candidate but keep probing for existing key. + if !found_deleted_candidate { + insert_index = index; + found_deleted_candidate = true; + } + } else { + // Empty slot: key cannot exist beyond this point. + // Insert at a deleted slot, if we found one previously, or at the current slot. + if !found_deleted_candidate { + insert_index = index; + } + increment_length = true; break; } } + + let mut s = self._table[insert_index]; + s.set(key, value); + self._table[insert_index] = s; + + if increment_length { + self._len += 1; + } + increment_length } unconstrained fn try_resize(&mut self) @@ -347,13 +364,13 @@ impl UHashMap { let mut new_map = UHashMap::with_hasher_and_capacity(self._build_hasher, capacity); for entry in self.entries() { - new_map.insert(entry.0, entry.1); + let _ = new_map.insert(entry.0, entry.1); } *self = new_map; } } - // Removes a key-value entry. If key is not present, UHashMap remains unchanged. + /// Removes a key-value entry. If key is not present, UHashMap remains unchanged. // docs:start:remove pub unconstrained fn remove(&mut self, key: K) where @@ -379,23 +396,21 @@ impl UHashMap { } } - // Apply UHashMap's hasher onto key to obtain pre-hash for probing. - fn hash(self, key: K) -> u32 + /// Apply UHashMap's hasher onto key to obtain pre-hash for probing. + fn hash(&self, key: K) -> u32 where K: Hash, B: BuildHasher, { let mut hasher = self._build_hasher.build_hasher(); key.hash(&mut hasher); - hasher.finish() as u32 + hasher.finish_ref() as u32 } - // Probing scheme: quadratic function. - // We use 0.5 constant near variadic attempt and attempt^2 monomials. - // This ensures good uniformity of distribution for table sizes - // equal to prime numbers or powers of two. - fn linear_probe(self: Self, hash: u32, attempt: u32) -> u32 { - (hash + attempt) % self._table.len() + /// Probing scheme: linear probing. + /// Each attempt increments the index by one, wrapping around the table. + fn linear_probe(&self, hash: u32, attempt: u32) -> u32 { + ((hash as u64 + attempt as u64) % self._table.len() as u64) as u32 } } @@ -411,29 +426,38 @@ where { fn eq(self, other: UHashMap) -> bool { // docs:end:eq - let mut equal = false; - - if self.len() == other.len() { - equal = true; - for slot in self._table { - // Not marked as deleted and has key-value. - if equal & slot.is_valid() { - // Safety: unconstrained context - let other_value = unsafe { other.get(slot._key) }; - - if other_value.is_none() { - equal = false; - } else { - let other_value = other_value.unwrap_unchecked(); - if slot._value != other_value { - equal = false; + if crate::runtime::is_unconstrained() { + // Safety: Checked above to be in unconstrained context. + unsafe { + let mut equal = false; + + if self.len() == other.len() { + equal = true; + for slot in self._table { + // Not marked as deleted and has key-value. + if equal & slot.is_valid() { + // Safety: unconstrained context + let other_value = other.get(slot._key); + + if other_value.is_none() { + equal = false; + } else { + let other_value = other_value.unwrap_unchecked(); + if slot._value != other_value { + equal = false; + } + } } } } + + equal } + } else { + crate::panic::panic( + "Equality check on UHashMap is not supported in constrained context", + ) } - - equal } } @@ -447,3 +471,121 @@ where UHashMap::with_hasher(B::default()) } } + +mod test { + use crate::default::Default; + use crate::hash::BuildHasherDefault; + use crate::hash::Hasher; + use crate::hash::poseidon2::Poseidon2Hasher; + use crate::option::Option; + use super::UHashMap; + + #[test] + unconstrained fn test_general_usage() { + let mut map = UHashMap::>::with_hasher_and_capacity( + BuildHasherDefault:: {}, + 8, + ); + + assert(map.is_empty()); + assert(!map.contains_key(5)); + assert_eq(map.get(5), Option::none()); + + let _ = map.insert(5, 10); + assert(map.contains_key(5)); + assert_eq(map.get(5), Option::some(10)); + assert(!map.is_empty()); + + assert_eq(map.len(), 1); + + let _ = map.insert(8, 16); + + assert_eq(map.len(), 2); + + map.iter_mut(|k, v| (k * 2, v * 2)); + assert_eq(map.get(10), Option::some(20)); + assert_eq(map.get(16), Option::some(32)); + + map.iter_keys_mut(|k| k / 2); + assert_eq(map.get(5), Option::some(20)); + assert_eq(map.get(8), Option::some(32)); + + map.iter_values_mut(|v| v * 2); + assert_eq(map.get(5), Option::some(40)); + assert_eq(map.get(8), Option::some(64)); + + let mut another_map = UHashMap::>::with_hasher_and_capacity( + BuildHasherDefault:: {}, + 8, + ); + assert(map != another_map); + let _ = another_map.insert(5, 40); + assert(map != another_map); + let _ = another_map.insert(7, 63); + assert(map != another_map); + another_map.remove(7); + let _ = another_map.insert(8, 64); + assert_eq(map, another_map); + + map.retain(|k, v| { + assert((k == 5) | (k == 8)); + assert((v == 40) | (v == 64)); + k == 5 + }); + + assert_eq(map.len(), 1); + assert_eq(map.entries(), @[(5, 40)]); + + map.clear(); + assert(map.is_empty()); + assert_eq(map.len(), 0); + assert_eq(map.values().len(), 0); + assert_eq(map.keys().len(), 0); + assert_eq(map.entries().len(), 0); + } + + #[test] + unconstrained fn test_no_duplicate_keys_after_deletion_and_insertion() { + // The capacity and keys used here, with the Poseidon2Hasher, have the keys 5 and 8 end up in slot 0. + let mut map = UHashMap::>::with_hasher_and_capacity( + BuildHasherDefault:: {}, + 8, + ); + assert(map.insert(5, 5)); + assert(map.insert(8, 8)); + map.remove(5); + assert(!map.insert(8, 9)); + + assert_eq(map.entries(), @[(8, 9)]); + assert_eq(map.keys(), @[8]); + } + + #[test] + unconstrained fn test_with_hasher_and_capacity_zero() { + let mut m: UHashMap> = + UHashMap::with_hasher_and_capacity(BuildHasherDefault:: {}, 0); + let _ = m.insert(1, 1); // This used to produce an index out of bounds + } + + struct MaxHasher { + _v: Field, + } + impl Default for MaxHasher { + fn default() -> Self { + MaxHasher { _v: 0 } + } + } + impl Hasher for MaxHasher { + fn finish(self) -> Field { + 4294967295 // u32::MAX + } + fn write(&mut self, _input: Field) {} + } + + #[test] + unconstrained fn test_max_hash() { + let mut m: UHashMap> = UHashMap::default(); + let _ = m.insert(1, 1); + let _ = m.insert(2, 2); // This used to produce a math overflow + } +} diff --git a/stdlib/src/collections/vec.nr b/stdlib/src/collections/vec.nr deleted file mode 100644 index 6ce134fa..00000000 --- a/stdlib/src/collections/vec.nr +++ /dev/null @@ -1,371 +0,0 @@ -pub struct Vec { - pub(crate) vector: [T], -} -// A mutable vector type implemented as a wrapper around immutable vectors. -// A separate type is technically not needed but helps differentiate which operations are mutable. -impl Vec { - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn new() -> Self { - Self { vector: [].as_vector() } - } - - // Create a Vec containing each element from the given vector. - // Mutations to the resulting Vec will not affect the original vector. - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn from_vector(vector: [T]) -> Self { - Self { vector } - } - - /// Get an element from the vector at the given index. - /// Panics if the given index - /// points beyond the end of the vector. - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn get(self, index: u32) -> T { - self.vector[index] - } - - /// Write an element to the vector at the given index. - /// Panics if the given index points beyond the end of the vector (`self.len()`). - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn set(&mut self, index: u32, value: T) { - self.vector[index] = value; - } - - /// Push a new element to the end of the vector, returning a - /// new vector with a length one greater than the - /// original unmodified vector. - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn push(&mut self, elem: T) { - self.vector = self.vector.push_back(elem); - } - - /// Pop an element from the end of the given vector, returning - /// a new vector with a length of one less than the given vector, - /// as well as the popped element. - /// Panics if the given vector's length is zero. - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn pop(&mut self) -> T { - let (popped_vector, last_elem) = self.vector.pop_back(); - self.vector = popped_vector; - last_elem - } - - /// Insert an element at a specified index, shifting all elements - /// after it to the right - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn insert(&mut self, index: u32, elem: T) { - self.vector = self.vector.insert(index, elem); - } - - /// Remove an element at a specified index, shifting all elements - /// after it to the left, returning the removed element - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn remove(&mut self, index: u32) -> T { - let (new_vector, elem) = self.vector.remove(index); - self.vector = new_vector; - elem - } - - /// Returns the number of elements in the vector - #[deprecated("std::collections::vec::Vec is deprecated, use the built-in vector type instead")] - pub fn len(self) -> u32 { - self.vector.len() - } -} - -mod vec_tests { - mod new { - use crate::collections::vec::Vec; - - #[test] - fn creates_empty_vector() { - let vec: Vec = Vec::new(); - assert_eq(vec.len(), 0); - } - } - - mod from_vector { - use crate::collections::vec::Vec; - - #[test] - fn creates_vector_with_elements() { - let vector = [1, 2, 3, 4, 5].as_vector(); - let vec = Vec::from_vector(vector); - assert_eq(vec.len(), 5); - assert_eq(vec.vector, vector); - } - } - - mod get { - use crate::collections::vec::Vec; - - #[test] - fn retrieves_elements_correctly() { - let vec = Vec { vector: [10, 20, 30, 40, 50].as_vector() }; - - assert_eq(vec.get(0), 10); - assert_eq(vec.get(1), 20); - assert_eq(vec.get(2), 30); - assert_eq(vec.get(3), 40); - assert_eq(vec.get(4), 50); - } - - #[test(should_fail_with = "Index out of bounds")] - fn panics_on_out_of_bounds() { - let vec = Vec { vector: [1, 2, 3].as_vector() }; - let _ = vec.get(3); - } - } - - mod set { - use crate::collections::vec::Vec; - - #[test] - fn updates_values_properly() { - let mut vec = Vec { vector: [0, 0, 0, 0, 0].as_vector() }; - - vec.set(0, 42); - assert_eq(vec.vector, [42, 0, 0, 0, 0].as_vector()); - - vec.set(1, 43); - assert_eq(vec.vector, [42, 43, 0, 0, 0].as_vector()); - - vec.set(2, 44); - assert_eq(vec.vector, [42, 43, 44, 0, 0].as_vector()); - - vec.set(1, 10); - assert_eq(vec.vector, [42, 10, 44, 0, 0].as_vector()); - - vec.set(0, 0); - assert_eq(vec.vector, [0, 10, 44, 0, 0].as_vector()); - } - - #[test(should_fail_with = "Index out of bounds")] - fn panics_when_writing_elements_past_end_of_vec() { - let mut vec = Vec::new(); - vec.set(0, 42); - - let _ = vec.get(0); - } - } - - mod push { - use crate::collections::vec::Vec; - - #[test] - fn adds_element_to_end() { - let mut vec = Vec { vector: [1, 2, 3].as_vector() }; - let original_len = vec.len(); - - vec.push(4); - - assert_eq(vec.len(), original_len + 1); - assert_eq(vec.get(3), 4); - } - - #[test] - fn on_empty_vector() { - let mut vec = Vec::new(); - vec.push(42); - - assert_eq(vec.len(), 1); - assert_eq(vec.get(0), 42); - } - } - - mod pop { - use crate::collections::vec::Vec; - - #[test] - fn removes_last_element() { - let mut vec = Vec { vector: [1, 2, 3, 4, 5].as_vector() }; - let original_len = vec.len(); - - let popped = vec.pop(); - - assert_eq(popped, 5); - assert_eq(vec.len(), original_len - 1); - assert_eq(vec.get(3), 4); - } - - #[test(should_fail_with = "Index out of bounds")] - fn on_empty_vector_panics() { - let mut vec: Vec = Vec::new(); - let _ = vec.pop(); - } - } - - mod insert { - use crate::collections::vec::Vec; - - #[test] - fn at_beginning() { - let mut vec = Vec { vector: [1, 2, 3].as_vector() }; - vec.insert(0, 0); - - assert_eq(vec.len(), 4); - assert_eq(vec.get(0), 0); - assert_eq(vec.get(1), 1); - assert_eq(vec.get(2), 2); - assert_eq(vec.get(3), 3); - } - - #[test] - fn at_middle() { - let mut vec = Vec { vector: [1, 2, 4, 5].as_vector() }; - vec.insert(2, 3); - - assert_eq(vec.len(), 5); - assert_eq(vec.get(0), 1); - assert_eq(vec.get(1), 2); - assert_eq(vec.get(2), 3); - assert_eq(vec.get(3), 4); - assert_eq(vec.get(4), 5); - } - - #[test] - fn at_end() { - let mut vec = Vec { vector: [1, 2, 3].as_vector() }; - vec.insert(3, 4); - - assert_eq(vec.len(), 4); - assert_eq(vec.get(0), 1); - assert_eq(vec.get(1), 2); - assert_eq(vec.get(2), 3); - assert_eq(vec.get(3), 4); - } - - #[test(should_fail_with = "Index out of bounds")] - fn beyond_length_panics() { - let mut vec = Vec { vector: [1, 2, 3].as_vector() }; - vec.insert(4, 5); - } - } - - mod remove { - use crate::collections::vec::Vec; - - #[test] - fn from_beginning() { - let mut vec = Vec { vector: [0, 1, 2, 3, 4].as_vector() }; - let removed = vec.remove(0); - - assert_eq(removed, 0); - assert_eq(vec.len(), 4); - assert_eq(vec.get(0), 1); - assert_eq(vec.get(1), 2); - assert_eq(vec.get(2), 3); - assert_eq(vec.get(3), 4); - } - - #[test] - fn from_middle() { - let mut vec = Vec { vector: [1, 2, 3, 4, 5].as_vector() }; - let removed = vec.remove(2); - - assert_eq(removed, 3); - assert_eq(vec.len(), 4); - assert_eq(vec.get(0), 1); - assert_eq(vec.get(1), 2); - assert_eq(vec.get(2), 4); - assert_eq(vec.get(3), 5); - } - - #[test] - fn from_end() { - let mut vec = Vec { vector: [1, 2, 3, 4, 5].as_vector() }; - let removed = vec.remove(4); - - assert_eq(removed, 5); - assert_eq(vec.len(), 4); - assert_eq(vec.get(0), 1); - assert_eq(vec.get(1), 2); - assert_eq(vec.get(2), 3); - assert_eq(vec.get(3), 4); - } - - #[test(should_fail_with = "Index out of bounds")] - fn beyond_length_panics() { - let mut vec = Vec { vector: [1, 2, 3].as_vector() }; - let _ = vec.remove(3); - } - } - - mod len { - use crate::collections::vec::Vec; - - #[test] - fn returns_correct_length() { - let empty_vec: Vec = Vec::new(); - assert_eq(empty_vec.len(), 0); - - let single_vec = Vec { vector: [42].as_vector() }; - assert_eq(single_vec.len(), 1); - - let multi_vec = Vec { vector: [1, 2, 3, 4, 5].as_vector() }; - assert_eq(multi_vec.len(), 5); - } - } - - mod vec_integration { - use crate::collections::vec::Vec; - - #[test] - fn multiple_operations_chain_correctly() { - let mut vec = Vec::new(); - - // push several elements - vec.push(1); - vec.push(2); - vec.push(3); - assert_eq(vec.len(), 3); - assert_eq(vec.get(0), 1); - assert_eq(vec.get(1), 2); - assert_eq(vec.get(2), 3); - - // insert in middle - vec.insert(1, 10); - assert_eq(vec.len(), 4); - assert_eq(vec.get(0), 1); - assert_eq(vec.get(1), 10); - assert_eq(vec.get(2), 2); - assert_eq(vec.get(3), 3); - - // set elements - vec.set(0, 100); - vec.set(2, 200); - assert_eq(vec.get(0), 100); - assert_eq(vec.get(2), 200); - - // remove element - let removed = vec.remove(1); - assert_eq(removed, 10); - assert_eq(vec.len(), 3); - assert_eq(vec.get(0), 100); - assert_eq(vec.get(1), 200); - assert_eq(vec.get(2), 3); - - // pop element - let popped = vec.pop(); - assert_eq(popped, 3); - assert_eq(vec.len(), 2); - } - - #[test] - fn vector_with_custom_types() { - let mut vec = Vec { vector: [true, false, true].as_vector() }; - - assert_eq(vec.len(), 3); - assert_eq(vec.get(0), true); - assert_eq(vec.get(1), false); - assert_eq(vec.get(2), true); - - vec.set(1, true); - assert_eq(vec.get(1), true); - - vec.push(false); - assert_eq(vec.len(), 4); - assert_eq(vec.get(3), false); - } - } -} diff --git a/stdlib/src/compat.nr b/stdlib/src/compat.nr index 216f948f..4c651430 100644 --- a/stdlib/src/compat.nr +++ b/stdlib/src/compat.nr @@ -4,6 +4,7 @@ comptime global BN254_MODULUS_BE_BYTES: [u8] = [ ] .as_vector(); +/// True if the current field is bn254 pub fn is_bn254() -> bool { comptime { // We can't use the `Eq` trait here due to limitations on calling non-comptime functions diff --git a/stdlib/src/convert.nr b/stdlib/src/convert.nr index b89e9482..86513a69 100644 --- a/stdlib/src/convert.nr +++ b/stdlib/src/convert.nr @@ -1,3 +1,4 @@ +/// Create a new `Self` value from the given `T` value // docs:start:from-trait pub trait From { fn from(input: T) -> Self; @@ -10,6 +11,7 @@ impl From for T { } } +/// Convert a `Self` value into a `T` value // docs:start:into-trait pub trait Into { fn into(self) -> T; @@ -251,12 +253,12 @@ comptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted { impls = impls.push_back( quote { - impl AsPrimitive<$type1> for $type2 { - fn as_(self) -> $type1 { - $body + impl AsPrimitive<$type1> for $type2 { + fn as_(self) -> $type1 { + $body + } } - } - }, + }, ); } } @@ -298,3 +300,130 @@ comptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted { impls.join(quote {}) } + +mod tests { + use crate::meta::unquote; + use super::{From, Into}; + + #[test] + fn from_identity() { + let x: u32 = 42; + assert_eq(u32::from(x), 42); + } + + #[test] + fn from_unsigned_widening() { + comptime { + let pairs = @[ + (quote { u8 }, quote { u16 }), + (quote { u8 }, quote { u32 }), + (quote { u8 }, quote { u64 }), + (quote { u8 }, quote { u128 }), + (quote { u16 }, quote { u32 }), + (quote { u16 }, quote { u64 }), + (quote { u16 }, quote { u128 }), + (quote { u32 }, quote { u64 }), + (quote { u32 }, quote { u128 }), + (quote { u64 }, quote { u128 }), + ]; + for pair in pairs { + let source = pair.0; + let target = pair.1; + let src_zero = f"0_{source}".quoted_contents(); + let src_value = f"123_{source}".quoted_contents(); + let dst_zero = f"0_{target}".quoted_contents(); + let dst_value = f"123_{target}".quoted_contents(); + unquote!( + quote { + assert_eq($target::from($src_zero), $dst_zero); + assert_eq($target::from($src_value), $dst_value); + }, + ); + } + } + } + + #[test] + fn from_unsigned_to_field() { + comptime { + for source in @[ + quote { u8 }, + quote { u16 }, + quote { u32 }, + quote { u64 }, + quote { u128 }, + ] { + let src_zero = f"0_{source}".quoted_contents(); + let src_value = f"123_{source}".quoted_contents(); + unquote!( + quote { + assert_eq(Field::from($src_zero), 0); + assert_eq(Field::from($src_value), 123); + }, + ); + } + } + } + + #[test] + fn from_signed_widening() { + comptime { + let pairs = @[ + (quote { i8 }, quote { i16 }), + (quote { i8 }, quote { i32 }), + (quote { i8 }, quote { i64 }), + (quote { i16 }, quote { i32 }), + (quote { i16 }, quote { i64 }), + (quote { i32 }, quote { i64 }), + ]; + for pair in pairs { + let source = pair.0; + let target = pair.1; + let src_pos = f"42_{source}".quoted_contents(); + let dst_pos = f"42_{target}".quoted_contents(); + let src_neg = f"-42_{source}".quoted_contents(); + let dst_neg = f"-42_{target}".quoted_contents(); + unquote!( + quote { + assert_eq($target::from($src_pos), $dst_pos); + assert_eq($target::from($src_neg), $dst_neg); + }, + ); + } + } + } + + #[test] + fn from_bool() { + comptime { + for target in @[ + quote { u8 }, + quote { u16 }, + quote { u32 }, + quote { u64 }, + quote { u128 }, + quote { i8 }, + quote { i16 }, + quote { i32 }, + quote { i64 }, + quote { Field }, + ] { + let one = f"1_{target}".quoted_contents(); + let zero = f"0_{target}".quoted_contents(); + unquote!( + quote { + assert_eq($target::from(true), $one); + assert_eq($target::from(false), $zero); + }, + ); + } + } + } + + #[test] + fn into_widens_unsigned() { + let value: u8 = 7; + let widened: u32 = value.into(); + assert_eq(widened, 7); + } +} diff --git a/stdlib/src/default.nr b/stdlib/src/default.nr index 021606a7..97fa8e7b 100644 --- a/stdlib/src/default.nr +++ b/stdlib/src/default.nr @@ -1,5 +1,8 @@ use crate::meta::derive_via; +/// Return an implementation-defined default value for the given type. +/// This is most often a zeroed value or an empty container, but there +/// are no actual restrictions on what an implementation could return. #[derive_via(derive_default)] // docs:start:default-trait pub trait Default { @@ -21,11 +24,6 @@ impl Default for Field { } } -impl Default for u1 { - fn default() -> u1 { - 0 - } -} impl Default for u8 { fn default() -> u8 { 0 @@ -100,6 +98,15 @@ impl Default for [T] { } } +impl Default for (A,) +where + A: Default, +{ + fn default() -> (A,) { + (A::default(),) + } +} + impl Default for (A, B) where A: Default, @@ -145,3 +152,183 @@ where (A::default(), B::default(), C::default(), D::default(), E::default()) } } + +impl Default for (A, B, C, D, E, F) +where + A: Default, + B: Default, + C: Default, + D: Default, + E: Default, + F: Default, +{ + fn default() -> (A, B, C, D, E, F) { + (A::default(), B::default(), C::default(), D::default(), E::default(), F::default()) + } +} + +impl Default for (A, B, C, D, E, F, G) +where + A: Default, + B: Default, + C: Default, + D: Default, + E: Default, + F: Default, + G: Default, +{ + fn default() -> (A, B, C, D, E, F, G) { + ( + A::default(), B::default(), C::default(), D::default(), E::default(), F::default(), + G::default(), + ) + } +} + +impl Default for (A, B, C, D, E, F, G, H) +where + A: Default, + B: Default, + C: Default, + D: Default, + E: Default, + F: Default, + G: Default, + H: Default, +{ + fn default() -> (A, B, C, D, E, F, G, H) { + ( + A::default(), B::default(), C::default(), D::default(), E::default(), F::default(), + G::default(), H::default(), + ) + } +} + +impl Default for (A, B, C, D, E, F, G, H, I) +where + A: Default, + B: Default, + C: Default, + D: Default, + E: Default, + F: Default, + G: Default, + H: Default, + I: Default, +{ + fn default() -> (A, B, C, D, E, F, G, H, I) { + ( + A::default(), B::default(), C::default(), D::default(), E::default(), F::default(), + G::default(), H::default(), I::default(), + ) + } +} + +impl Default for (A, B, C, D, E, F, G, H, I, J) +where + A: Default, + B: Default, + C: Default, + D: Default, + E: Default, + F: Default, + G: Default, + H: Default, + I: Default, + J: Default, +{ + fn default() -> (A, B, C, D, E, F, G, H, I, J) { + ( + A::default(), B::default(), C::default(), D::default(), E::default(), F::default(), + G::default(), H::default(), I::default(), J::default(), + ) + } +} + +impl Default for (A, B, C, D, E, F, G, H, I, J, K) +where + A: Default, + B: Default, + C: Default, + D: Default, + E: Default, + F: Default, + G: Default, + H: Default, + I: Default, + J: Default, + K: Default, +{ + fn default() -> (A, B, C, D, E, F, G, H, I, J, K) { + ( + A::default(), B::default(), C::default(), D::default(), E::default(), F::default(), + G::default(), H::default(), I::default(), J::default(), K::default(), + ) + } +} + +impl Default for (A, B, C, D, E, F, G, H, I, J, K, L) +where + A: Default, + B: Default, + C: Default, + D: Default, + E: Default, + F: Default, + G: Default, + H: Default, + I: Default, + J: Default, + K: Default, + L: Default, +{ + fn default() -> (A, B, C, D, E, F, G, H, I, J, K, L) { + ( + A::default(), B::default(), C::default(), D::default(), E::default(), F::default(), + G::default(), H::default(), I::default(), J::default(), K::default(), L::default(), + ) + } +} + +mod tests { + use super::Default; + + #[test] + fn defaults() { + assert_eq(<()>::default(), ()); + assert_eq(bool::default(), false); + assert_eq(u8::default(), 0); + assert_eq(u16::default(), 0); + assert_eq(u32::default(), 0); + assert_eq(u64::default(), 0); + assert_eq(u128::default(), 0); + assert_eq(i8::default(), 0); + assert_eq(i16::default(), 0); + assert_eq(i32::default(), 0); + assert_eq(i64::default(), 0); + assert_eq(Field::default(), 0); + assert_eq(<[Field; 3]>::default(), [0; 3]); + assert_eq(<[Field]>::default(), @[]); + assert_eq(<(u8,)>::default(), (0,)); + assert_eq(<(u8, u8)>::default(), (0, 0)); + assert_eq(<(u8, u8, u8)>::default(), (0, 0, 0)); + assert_eq(<(u8, u8, u8, u8)>::default(), (0, 0, 0, 0)); + assert_eq(<(u8, u8, u8, u8, u8)>::default(), (0, 0, 0, 0, 0)); + assert_eq(<(u8, u8, u8, u8, u8, u8)>::default(), (0, 0, 0, 0, 0, 0)); + assert_eq(<(u8, u8, u8, u8, u8, u8, u8)>::default(), (0, 0, 0, 0, 0, 0, 0)); + assert_eq(<(u8, u8, u8, u8, u8, u8, u8, u8)>::default(), (0, 0, 0, 0, 0, 0, 0, 0)); + assert_eq(<(u8, u8, u8, u8, u8, u8, u8, u8, u8)>::default(), (0, 0, 0, 0, 0, 0, 0, 0, 0)); + assert_eq( + <(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8)>::default(), + (0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + ); + assert_eq( + <(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8)>::default(), + (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + ); + assert_eq( + <(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8)>::default(), + (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + ); + } +} diff --git a/stdlib/src/ecdsa_secp256k1.nr b/stdlib/src/ecdsa_secp256k1.nr index 38da8f4b..f4559cb6 100644 --- a/stdlib/src/ecdsa_secp256k1.nr +++ b/stdlib/src/ecdsa_secp256k1.nr @@ -33,3 +33,39 @@ fn _verify_signature( message_hash: [u8; 32], predicate: bool, ) -> bool {} + +mod tests { + #[test] + fn verify() { + let mut hashed_message: [u8; 32] = [ + 0x3a, 0x73, 0xf4, 0x12, 0x3a, 0x5c, 0xd2, 0x12, 0x1f, 0x21, 0xcd, 0x7e, 0x8d, 0x35, + 0x88, 0x35, 0x47, 0x69, 0x49, 0xd0, 0x35, 0xd9, 0xc2, 0xda, 0x68, 0x06, 0xb4, 0x63, + 0x3a, 0xc8, 0xc1, 0xe2, + ]; + let pub_key_x: [u8; 32] = [ + 0xa0, 0x43, 0x4d, 0x9e, 0x47, 0xf3, 0xc8, 0x62, 0x35, 0x47, 0x7c, 0x7b, 0x1a, 0xe6, + 0xae, 0x5d, 0x34, 0x42, 0xd4, 0x9b, 0x19, 0x43, 0xc2, 0xb7, 0x52, 0xa6, 0x8e, 0x2a, + 0x47, 0xe2, 0x47, 0xc7, + ]; + let pub_key_y: [u8; 32] = [ + 0x89, 0x3a, 0xba, 0x42, 0x54, 0x19, 0xbc, 0x27, 0xa3, 0xb6, 0xc7, 0xe6, 0x93, 0xa2, + 0x4c, 0x69, 0x6f, 0x79, 0x4c, 0x2e, 0xd8, 0x77, 0xa1, 0x59, 0x3c, 0xbe, 0xe5, 0x3b, + 0x03, 0x73, 0x68, 0xd7, + ]; + let signature: [u8; 64] = [ + 0xe5, 0x08, 0x1c, 0x80, 0xab, 0x42, 0x7d, 0xc3, 0x70, 0x34, 0x6f, 0x4a, 0x0e, 0x31, + 0xaa, 0x2b, 0xad, 0x8d, 0x97, 0x98, 0xc3, 0x80, 0x61, 0xdb, 0x9a, 0xe5, 0x5a, 0x4e, + 0x8d, 0xf4, 0x54, 0xfd, 0x28, 0x11, 0x98, 0x94, 0x34, 0x4e, 0x71, 0xb7, 0x87, 0x70, + 0xcc, 0x93, 0x1d, 0x61, 0xf4, 0x80, 0xec, 0xbb, 0x0b, 0x89, 0xd6, 0xeb, 0x69, 0x69, + 0x01, 0x61, 0xe4, 0x9a, 0x71, 0x5f, 0xcd, 0x55, + ]; + let valid_signature = + super::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); + + hashed_message[0] = 0; + let valid_signature = + super::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(!valid_signature); + } +} diff --git a/stdlib/src/ecdsa_secp256r1.nr b/stdlib/src/ecdsa_secp256r1.nr index 1661b896..2087a0c4 100644 --- a/stdlib/src/ecdsa_secp256r1.nr +++ b/stdlib/src/ecdsa_secp256r1.nr @@ -1,4 +1,20 @@ +/// Verifier for ECDSA Secp256r1 signatures. // docs:start:ecdsa_secp256r1 +/// Verifies a ECDSA signature over the secp256r1 curve. +/// - inputs: +/// - x coordinate of public key as 32 bytes +/// - y coordinate of public key as 32 bytes +/// - the signature, as a 64 bytes array +/// The signature internally will be represented as `(r, s)`, +/// where `r` and `s` are fixed-sized big endian scalar values. +/// As the `secp256r1` has a 256-bit modulus, we have a 64 byte signature +/// while `r` and `s` will both be 32 bytes. +/// We expect `s` to be normalized. This means given the curve's order, +/// `s` should be less than or equal to `order / 2`. +/// This is done to prevent malleability. +/// For more context regarding malleability you can reference BIP 0062. +/// - the hash of the message, as a vector of bytes +/// - output: false for failure and true for success pub fn verify_signature( public_key_x: [u8; 32], public_key_y: [u8; 32], @@ -18,3 +34,36 @@ fn _verify_signature( message_hash: [u8; 32], predicate: bool, ) -> bool {} + +mod tests { + #[test] + fn verify() { + let mut hashed_message: [u8; 32] = [ + 84, 112, 91, 163, 186, 175, 219, 223, 186, 140, 95, 154, 112, 247, 168, 155, 238, 152, + 217, 6, 181, 62, 49, 7, 77, 167, 186, 236, 220, 13, 169, 173, + ]; + + let pub_key_x: [u8; 32] = [ + 85, 15, 71, 16, 3, 243, 223, 151, 195, 223, 80, 106, 199, 151, 246, 114, 31, 177, 161, + 251, 123, 143, 111, 131, 210, 36, 73, 138, 101, 200, 142, 36, + ]; + let pub_key_y: [u8; 32] = [ + 19, 96, 147, 215, 1, 46, 80, 154, 115, 113, 92, 189, 11, 0, 163, 204, 15, 244, 181, 192, + 27, 63, 250, 25, 106, 177, 251, 50, 112, 54, 184, 230, + ]; + let signature: [u8; 64] = [ + 44, 112, 168, 208, 132, 182, 43, 252, 92, 224, 54, 65, 202, 249, 247, 42, 212, 218, 140, + 129, 191, 230, 236, 148, 135, 187, 94, 27, 239, 98, 161, 50, 24, 173, 158, 226, 158, + 175, 53, 31, 220, 80, 241, 82, 12, 66, 94, 155, 144, 138, 7, 39, 139, 67, 176, 236, 123, + 135, 39, 120, 193, 78, 7, 132, + ]; + let valid_signature = + super::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); + + hashed_message[0] = 0; + let valid_signature = + super::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(!valid_signature); + } +} diff --git a/stdlib/src/embedded_curve_ops.nr b/stdlib/src/embedded_curve_ops.nr index 55a769c1..c32225e2 100644 --- a/stdlib/src/embedded_curve_ops.nr +++ b/stdlib/src/embedded_curve_ops.nr @@ -4,14 +4,18 @@ use crate::ops::arith::{Add, Neg, Sub}; /// A point on the embedded elliptic curve /// By definition, the base field of the embedded curve is the scalar field of the proof system curve, i.e the Noir Field. -/// x and y denotes the Weierstrass coordinates of the point, if is_infinite is false. +/// x and y denotes the Weierstrass coordinates of the point. pub struct EmbeddedCurvePoint { pub x: Field, pub y: Field, - pub is_infinite: bool, } impl EmbeddedCurvePoint { + /// Create a new point using the provided (x, y) pair + pub fn new(x: Field, y: Field) -> Self { + EmbeddedCurvePoint { x, y } + } + /// Elliptic curve point doubling operation /// returns the doubled point of a point P, i.e P+P pub fn double(self) -> EmbeddedCurvePoint { @@ -20,7 +24,7 @@ impl EmbeddedCurvePoint { /// Returns the null element of the curve; 'the point at infinity' pub fn point_at_infinity() -> EmbeddedCurvePoint { - EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true } + EmbeddedCurvePoint { x: 0, y: 0 } } /// Returns the curve's generator point. @@ -29,9 +33,13 @@ impl EmbeddedCurvePoint { EmbeddedCurvePoint { x: 1, y: 17631683881184975370165255887551781615748388533673675138860, // sqrt(-16) - is_infinite: false, } } + + /// True if this point is the point at infinity + pub fn is_infinite(self) -> bool { + (self.x == 0) & (self.y == 0) + } } impl Add for EmbeddedCurvePoint { @@ -52,15 +60,14 @@ impl Neg for EmbeddedCurvePoint { /// Negates a point P, i.e returns -P, by negating the y coordinate. /// If the point is at infinity, then the result is also at infinity. fn neg(self) -> EmbeddedCurvePoint { - EmbeddedCurvePoint { x: self.x, y: -self.y, is_infinite: self.is_infinite } + EmbeddedCurvePoint { x: self.x, y: -self.y } } } impl Eq for EmbeddedCurvePoint { /// Checks whether two points are equal fn eq(self: Self, b: EmbeddedCurvePoint) -> bool { - (self.is_infinite & b.is_infinite) - | ((self.is_infinite == b.is_infinite) & (self.x == b.x) & (self.y == b.y)) + (self.x == b.x) & (self.y == b.y) } } @@ -69,12 +76,8 @@ impl Hash for EmbeddedCurvePoint { where H: crate::hash::Hasher, { - if self.is_infinite { - self.is_infinite.hash(state); - } else { - self.x.hash(state); - self.y.hash(state); - } + self.x.hash(state); + self.y.hash(state); } } @@ -87,30 +90,17 @@ pub struct EmbeddedCurveScalar { } impl EmbeddedCurveScalar { + /// Create a new scalar using the provided (lo, hi) pair pub fn new(lo: Field, hi: Field) -> Self { EmbeddedCurveScalar { lo, hi } } + /// Create a scalar from the given bn254 field value #[field(bn254)] pub fn from_field(scalar: Field) -> EmbeddedCurveScalar { let (a, b) = crate::field::bn254::decompose(scalar); EmbeddedCurveScalar { lo: a, hi: b } } - - //Bytes to scalar: take the first (after the specified offset) 16 bytes of the input as the lo value, and the next 16 bytes as the hi value - #[field(bn254)] - pub(crate) fn from_bytes(bytes: [u8; 64], offset: u32) -> EmbeddedCurveScalar { - let mut v = 1; - let mut lo = 0 as Field; - let mut hi = 0 as Field; - for i in 0..16 { - lo = lo + (bytes[offset + 31 - i] as Field) * v; - hi = hi + (bytes[offset + 15 - i] as Field) * v; - v = v * 256; - } - let sig_s = crate::embedded_curve_ops::EmbeddedCurveScalar { lo, hi }; - sig_s - } } impl Eq for EmbeddedCurveScalar { @@ -129,16 +119,15 @@ impl Hash for EmbeddedCurveScalar { } } -// Computes a multi scalar multiplication over the embedded curve. -// For bn254, We have Grumpkin and Baby JubJub. -// For bls12-381, we have JubJub and Bandersnatch. -// -// The embedded curve being used is decided by the -// underlying proof system. -// -// IMPORTANT: Prefer `multi_scalar_mul()` over repeated `embedded_curve_add()` -// for adding multiple points. This is significantly more efficient. -// For adding exactly 2 points, use `embedded_curve_add()` directly. +/// Computes a multi scalar multiplication over the embedded curve. +/// For bn254, We have Grumpkin. +/// +/// The embedded curve being used is decided by the +/// underlying proof system. +/// +/// IMPORTANT: Prefer `multi_scalar_mul()` over repeated `embedded_curve_add()` +/// for adding multiple points. This is significantly more efficient. +/// For adding exactly 2 points, use `embedded_curve_add()` directly. // docs:start:multi_scalar_mul pub fn multi_scalar_mul( points: [EmbeddedCurvePoint; N], @@ -149,13 +138,6 @@ pub fn multi_scalar_mul( multi_scalar_mul_array_return(points, scalars, true)[0] } -#[foreign(multi_scalar_mul)] -pub(crate) fn multi_scalar_mul_array_return( - points: [EmbeddedCurvePoint; N], - scalars: [EmbeddedCurveScalar; N], - predicate: bool, -) -> [EmbeddedCurvePoint; 1] {} - // docs:start:fixed_base_scalar_mul pub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint // docs:end:fixed_base_scalar_mul @@ -163,6 +145,13 @@ pub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint multi_scalar_mul([EmbeddedCurvePoint::generator()], [scalar]) } +#[foreign(multi_scalar_mul)] +pub(crate) fn multi_scalar_mul_array_return( + points: [EmbeddedCurvePoint; N], + scalars: [EmbeddedCurveScalar; N], + predicate: bool, +) -> [EmbeddedCurvePoint; 1] {} + /// Elliptic curve addition /// IMPORTANT: this function is expected to perform a full addition in order to handle all corner cases: /// - points on the curve @@ -175,18 +164,7 @@ pub fn embedded_curve_add( point2: EmbeddedCurvePoint, ) -> EmbeddedCurvePoint { // docs:end:embedded_curve_add - if crate::runtime::is_unconstrained() { - // avoid calling the black box function for trivial cases - if point1.is_infinite { - point2 - } else if point2.is_infinite { - point1 - } else { - embedded_curve_add_inner(point1, point2) - } - } else { - embedded_curve_add_inner(point1, point2) - } + embedded_curve_add_array_return(point1, point2, true)[0] } #[foreign(embedded_curve_add)] @@ -196,10 +174,301 @@ fn embedded_curve_add_array_return( _predicate: bool, ) -> [EmbeddedCurvePoint; 1] {} -/// EC addition wrapper for the foreign function -fn embedded_curve_add_inner( - point1: EmbeddedCurvePoint, - point2: EmbeddedCurvePoint, -) -> EmbeddedCurvePoint { - embedded_curve_add_array_return(point1, point2, true)[0] +mod tests { + // TODO: Allow imports from "super" + use crate::default::Default; + use crate::embedded_curve_ops::{ + embedded_curve_add, EmbeddedCurvePoint, EmbeddedCurveScalar, fixed_base_scalar_mul, + multi_scalar_mul, + }; + use crate::field::bn254::TWO_POW_128; + use crate::hash::Hash; + use crate::hash::Hasher; + use crate::hash::poseidon2::Poseidon2Hasher; + + fn hash_point(p: EmbeddedCurvePoint) -> Field { + let mut hasher: Poseidon2Hasher = Default::default(); + p.hash(&mut hasher); + hasher.finish() + } + + fn hash_scalar(s: EmbeddedCurveScalar) -> Field { + let mut hasher: Poseidon2Hasher = Default::default(); + s.hash(&mut hasher); + hasher.finish() + } + + #[test] + fn point_new_sets_coordinates() { + let p = EmbeddedCurvePoint::new(3, 5); + assert_eq(p.x, 3); + assert_eq(p.y, 5); + } + + #[test] + fn point_at_infinity_is_origin() { + let inf = EmbeddedCurvePoint::point_at_infinity(); + assert_eq(inf.x, 0); + assert_eq(inf.y, 0); + } + + #[test] + fn generator_has_documented_coordinates() { + let g = EmbeddedCurvePoint::generator(); + assert_eq(g.x, 1); + assert_eq(g.y, 17631683881184975370165255887551781615748388533673675138860); + } + + #[test] + fn is_infinite_only_true_for_origin() { + assert(EmbeddedCurvePoint::point_at_infinity().is_infinite()); + assert(!EmbeddedCurvePoint::generator().is_infinite()); + assert(!EmbeddedCurvePoint::new(1, 0).is_infinite()); + assert(!EmbeddedCurvePoint::new(0, 1).is_infinite()); + } + + #[test] + fn points_with_same_coords_are_equal() { + let p = EmbeddedCurvePoint::new(7, 11); + let q = EmbeddedCurvePoint::new(7, 11); + assert_eq(p, q); + } + + #[test] + fn points_with_different_coords_are_unequal() { + let p = EmbeddedCurvePoint::new(7, 11); + assert(p != EmbeddedCurvePoint::new(7, 12)); + assert(p != EmbeddedCurvePoint::new(8, 11)); + assert(p != EmbeddedCurvePoint::new(8, 12)); + } + + #[test] + fn neg_negates_y_coordinate() { + let g = EmbeddedCurvePoint::generator(); + let neg_g = -g; + assert_eq(neg_g.x, g.x); + assert_eq(neg_g.y, -g.y); + } + + #[test] + fn neg_is_involution() { + let g = EmbeddedCurvePoint::generator(); + assert_eq(--g, g); + } + + #[test] + fn add_with_point_at_infinity_is_identity() { + let g = EmbeddedCurvePoint::generator(); + let inf = EmbeddedCurvePoint::point_at_infinity(); + assert_eq(g + inf, g); + assert_eq(inf + g, g); + } + + #[test] + fn add_of_two_infinities_is_infinity() { + let inf = EmbeddedCurvePoint::point_at_infinity(); + assert((inf + inf).is_infinite()); + } + + #[test] + fn add_with_negation_is_point_at_infinity() { + let g = EmbeddedCurvePoint::generator(); + assert((g + (-g)).is_infinite()); + } + + #[test] + fn add_is_commutative() { + let g = EmbeddedCurvePoint::generator(); + let g2 = g.double(); + assert_eq(g + g2, g2 + g); + } + + #[test] + fn add_is_associative() { + let g = EmbeddedCurvePoint::generator(); + let g2 = g.double(); + let g3 = g + g2; + assert_eq((g + g2) + g3, g + (g2 + g3)); + } + + #[test] + fn sub_of_a_point_with_itself_is_infinity() { + let g = EmbeddedCurvePoint::generator(); + assert((g - g).is_infinite()); + } + + #[test] + fn sub_with_point_at_infinity_is_identity() { + let g = EmbeddedCurvePoint::generator(); + let inf = EmbeddedCurvePoint::point_at_infinity(); + assert_eq(g - inf, g); + } + + #[test] + fn sub_inverts_add() { + let g = EmbeddedCurvePoint::generator(); + let g2 = g.double(); + assert_eq((g + g2) - g2, g); + assert_eq((g + g2) - g, g2); + } + + #[test] + fn double_equals_self_plus_self() { + let g = EmbeddedCurvePoint::generator(); + assert_eq(g.double(), g + g); + } + + #[test] + fn double_of_point_at_infinity_is_infinity() { + assert(EmbeddedCurvePoint::point_at_infinity().double().is_infinite()); + } + + #[test] + fn embedded_curve_add_matches_add_operator() { + let g = EmbeddedCurvePoint::generator(); + let g2 = g.double(); + assert_eq(embedded_curve_add(g, g2), g + g2); + } + + #[test] + fn point_hash_is_consistent_for_equal_points() { + let p = EmbeddedCurvePoint::new(3, 5); + let q = EmbeddedCurvePoint::new(3, 5); + assert_eq(hash_point(p), hash_point(q)); + } + + #[test] + fn point_hash_differs_for_distinct_points() { + let p = EmbeddedCurvePoint::new(3, 5); + assert(hash_point(p) != hash_point(EmbeddedCurvePoint::new(3, 7))); + assert(hash_point(p) != hash_point(EmbeddedCurvePoint::new(4, 5))); + // Distinguishes (x, y) from (y, x) - order of writes matters. + assert(hash_point(p) != hash_point(EmbeddedCurvePoint::new(5, 3))); + } + + #[test] + fn scalar_new_sets_limbs() { + let s = EmbeddedCurveScalar::new(3, 5); + assert_eq(s.lo, 3); + assert_eq(s.hi, 5); + } + + #[test] + fn scalars_with_same_limbs_are_equal() { + let s = EmbeddedCurveScalar::new(7, 11); + let t = EmbeddedCurveScalar::new(7, 11); + assert_eq(s, t); + } + + #[test] + fn scalars_with_different_limbs_are_unequal() { + let s = EmbeddedCurveScalar::new(7, 11); + assert(s != EmbeddedCurveScalar::new(7, 12)); + assert(s != EmbeddedCurveScalar::new(8, 11)); + } + + #[test] + fn scalar_from_field_decomposes_zero() { + assert_eq(EmbeddedCurveScalar::from_field(0), EmbeddedCurveScalar::new(0, 0)); + } + + #[test] + fn scalar_from_field_decomposes_small_value() { + let s = EmbeddedCurveScalar::from_field(0x1234567890); + assert_eq(s, EmbeddedCurveScalar::new(0x1234567890, 0)); + } + + #[test] + fn scalar_from_field_decomposes_two_pow_128() { + let s = EmbeddedCurveScalar::from_field(TWO_POW_128); + assert_eq(s, EmbeddedCurveScalar::new(0, 1)); + } + + #[test] + fn scalar_hash_is_consistent_for_equal_scalars() { + let s = EmbeddedCurveScalar::new(7, 11); + let t = EmbeddedCurveScalar::new(7, 11); + assert_eq(hash_scalar(s), hash_scalar(t)); + } + + #[test] + fn scalar_hash_differs_for_distinct_scalars() { + let s = EmbeddedCurveScalar::new(7, 11); + assert(hash_scalar(s) != hash_scalar(EmbeddedCurveScalar::new(7, 12))); + assert(hash_scalar(s) != hash_scalar(EmbeddedCurveScalar::new(8, 11))); + // Distinguishes (lo, hi) from (hi, lo) - limb order matters. + assert(hash_scalar(s) != hash_scalar(EmbeddedCurveScalar::new(11, 7))); + } + + #[test] + fn msm_with_scalar_one_returns_point() { + let g = EmbeddedCurvePoint::generator(); + let one = EmbeddedCurveScalar::new(1, 0); + assert_eq(multi_scalar_mul([g], [one]), g); + } + + #[test] + fn msm_with_scalar_zero_returns_infinity() { + let g = EmbeddedCurvePoint::generator(); + let zero = EmbeddedCurveScalar::new(0, 0); + assert(multi_scalar_mul([g], [zero]).is_infinite()); + } + + #[test] + fn msm_with_scalar_two_doubles_point() { + let g = EmbeddedCurvePoint::generator(); + let two = EmbeddedCurveScalar::new(2, 0); + assert_eq(multi_scalar_mul([g], [two]), g.double()); + } + + #[test] + fn msm_sums_terms() { + let g = EmbeddedCurvePoint::generator(); + let one = EmbeddedCurveScalar::new(1, 0); + assert_eq(multi_scalar_mul([g, g], [one, one]), g.double()); + } + + #[test] + fn msm_with_opposite_terms_cancels() { + let g = EmbeddedCurvePoint::generator(); + let one = EmbeddedCurveScalar::new(1, 0); + assert(multi_scalar_mul([g, -g], [one, one]).is_infinite()); + } + + #[test] + fn msm_skips_point_at_infinity() { + let g = EmbeddedCurvePoint::generator(); + let inf = EmbeddedCurvePoint::point_at_infinity(); + let one = EmbeddedCurveScalar::new(1, 0); + assert_eq(multi_scalar_mul([inf, g], [one, one]), g); + } + + #[test] + fn msm_skips_zero_scalar() { + let g = EmbeddedCurvePoint::generator(); + let one = EmbeddedCurveScalar::new(1, 0); + let zero = EmbeddedCurveScalar::new(0, 0); + assert_eq(multi_scalar_mul([g, g], [zero, one]), g); + } + + #[test] + fn fixed_base_scalar_mul_with_one_returns_generator() { + let one = EmbeddedCurveScalar::new(1, 0); + assert_eq(fixed_base_scalar_mul(one), EmbeddedCurvePoint::generator()); + } + + #[test] + fn fixed_base_scalar_mul_with_zero_returns_infinity() { + let zero = EmbeddedCurveScalar::new(0, 0); + assert(fixed_base_scalar_mul(zero).is_infinite()); + } + + #[test] + fn fixed_base_scalar_mul_matches_msm_on_generator() { + let s = EmbeddedCurveScalar::new(2, 0); + assert_eq( + fixed_base_scalar_mul(s), + multi_scalar_mul([EmbeddedCurvePoint::generator()], [s]), + ); + } } diff --git a/stdlib/src/field/bn254.nr b/stdlib/src/field/bn254.nr index 9fcfb85b..45ba4ee1 100644 --- a/stdlib/src/field/bn254.nr +++ b/stdlib/src/field/bn254.nr @@ -120,6 +120,8 @@ pub fn lt(a: Field, b: Field) -> bool { mod tests { // TODO: Allow imports from "super" use crate::field::bn254::{assert_gt, decompose, gt, lt, lte_hint, PHI, PLO, TWO_POW_128}; + use crate::internal::test_unconstrained; + use super::assert_lt; #[test] fn check_decompose() { @@ -141,6 +143,7 @@ mod tests { } #[test] + #[test_unconstrained] fn check_gt() { assert(gt(1, 0)); assert(gt(0x100, 0)); @@ -193,6 +196,7 @@ mod tests { #[test] fn check_lt_comprehensive() { assert(lt(0, 1)); + assert_lt(0, 1); assert(!lt(1, 0)); assert(!lt(0, 0)); assert(!lt(42, 42)); diff --git a/stdlib/src/field/mod.nr b/stdlib/src/field/mod.nr index abf1d7e9..4a378297 100644 --- a/stdlib/src/field/mod.nr +++ b/stdlib/src/field/mod.nr @@ -17,7 +17,7 @@ impl Field { __assert_max_bit_size(self, BIT_SIZE); } - /// Decomposes `self` into its little endian bit decomposition as a `[u1; N]` array. + /// Decomposes `self` into its little endian bit decomposition as a `[bool; N]` array. /// This array will be zero padded should not all bits be necessary to represent `self`. /// /// # Failures @@ -27,7 +27,7 @@ impl Field { /// # Safety /// The bit decomposition returned is canonical and is guaranteed to not overflow the modulus. // docs:start:to_le_bits - pub fn to_le_bits(self: Self) -> [u1; N] { + pub fn to_le_bits(self: Self) -> [bool; N] { // docs:end:to_le_bits let bits = __to_le_bits(self); @@ -39,7 +39,7 @@ impl Field { for i in 0..N { if !ok { if (bits[N - 1 - i] != p[N - 1 - i]) { - assert(p[N - 1 - i] == 1); + assert(p[N - 1 - i]); ok = true; } } @@ -49,7 +49,7 @@ impl Field { bits } - /// Decomposes `self` into its big endian bit decomposition as a `[u1; N]` array. + /// Decomposes `self` into its big endian bit decomposition as a `[bool; N]` array. /// This array will be zero padded should not all bits be necessary to represent `self`. /// /// # Failures @@ -59,7 +59,7 @@ impl Field { /// # Safety /// The bit decomposition returned is canonical and is guaranteed to not overflow the modulus. // docs:start:to_be_bits - pub fn to_be_bits(self: Self) -> [u1; N] { + pub fn to_be_bits(self: Self) -> [bool; N] { // docs:end:to_be_bits let bits = __to_be_bits(self); @@ -71,7 +71,7 @@ impl Field { for i in 0..N { if !ok { if (bits[i] != p[i]) { - assert(p[i] == 1); + assert(p[i]); ok = true; } } @@ -180,7 +180,7 @@ impl Field { // using a bigger bit size impacts negatively the performance and should be done only if the exponent does not fit in 32 bits pub fn pow_32(self, exponent: Field) -> Field { let mut r: Field = 1; - let b: [u1; 32] = exponent.to_le_bits(); + let b: [bool; 32] = exponent.to_le_bits(); for i in 1..33 { r *= r; @@ -189,9 +189,9 @@ impl Field { r } - // Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x `elem` {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. - pub fn sgn0(self) -> u1 { - self as u1 + // Parity of (prime) Field element, i.e. sgn0(x mod p) = false if x `elem` {0, ..., p-1} is even, otherwise sgn0(x mod p) = true. + pub fn sgn0(self) -> bool { + (self as u8) % 2 == 1 } pub fn lt(self, another: Field) -> bool { @@ -204,7 +204,12 @@ impl Field { /// Convert a little endian byte array to a field element. /// If the provided byte array overflows the field modulus then the Field will silently wrap around. + /// + /// # Failures + /// `N` must be no greater than the number of bytes required to represent the field modulus + // docs:start:from_le_bytes pub fn from_le_bytes(bytes: [u8; N]) -> Field { + // docs:end:from_le_bytes static_assert( N <= modulus_le_bytes().len(), "N must be less than or equal to modulus_le_bytes().len()", @@ -221,7 +226,16 @@ impl Field { /// Convert a big endian byte array to a field element. /// If the provided byte array overflows the field modulus then the Field will silently wrap around. + /// + /// # Failures + /// `N` must be no greater than the number of bytes required to represent the field modulus + // docs:start:from_be_bytes pub fn from_be_bytes(bytes: [u8; N]) -> Field { + // docs:end:from_be_bytes + static_assert( + N <= modulus_be_bytes().len(), + "N must be less than or equal to modulus_be_bytes().len()", + ); let mut v = 1; let mut result = 0; @@ -231,6 +245,55 @@ impl Field { } result } + + /// Convert a little endian byte array to a field element, asserting that the input is a + /// canonical representation (strictly less than the field modulus). + /// + /// # Failures + /// Causes a constraint failure if `bytes` encodes a value greater than or equal to the + /// field modulus. + // docs:start:from_le_bytes_checked + pub fn from_le_bytes_checked(bytes: [u8; N]) -> Field { + // docs:end:from_le_bytes_checked + let p = modulus_le_bytes(); + let mut ok = N != p.len(); + for i in 0..N { + if !ok { + if bytes[N - 1 - i] != p[N - 1 - i] { + assert( + bytes[N - 1 - i] < p[N - 1 - i], + "input bytes are not a canonical field representation", + ); + ok = true; + } + } + } + assert(ok, "input bytes are not a canonical field representation"); + Field::from_le_bytes(bytes) + } + + /// Convert a big endian byte array to a field element, asserting that the input is a + /// canonical representation (strictly less than the field modulus). + /// + /// # Failures + /// Causes a constraint failure if `bytes` encodes a value greater than or equal to the + /// field modulus. + // docs:start:from_be_bytes_checked + pub fn from_be_bytes_checked(bytes: [u8; N]) -> Field { + // docs:end:from_be_bytes_checked + let p = modulus_be_bytes(); + let mut ok = N != p.len(); + for i in 0..N { + if !ok { + if bytes[i] != p[i] { + assert(bytes[i] < p[i], "input bytes are not a canonical field representation"); + ok = true; + } + } + } + assert(ok, "input bytes are not a canonical field representation"); + Field::from_be_bytes(bytes) + } } #[builtin(apply_range_constraint)] @@ -244,7 +307,7 @@ fn __to_le_radix(value: Field, radix: u32) -> [u8; N] {} #[builtin(to_be_radix)] fn __to_be_radix(value: Field, radix: u32) -> [u8; N] {} -/// Decomposes `self` into its little endian bit decomposition as a `[u1; N]` array. +/// Decomposes `self` into its little endian bit decomposition as a `[bool; N]` array. /// This array will be zero padded should not all bits be necessary to represent `self`. /// /// # Failures @@ -256,9 +319,9 @@ fn __to_be_radix(value: Field, radix: u32) -> [u8; N] {} /// (e.g. 254 for the BN254 field) allow for multiple bit decompositions. This is due to how the `Field` will /// wrap around due to overflow when verifying the decomposition. #[builtin(to_le_bits)] -fn __to_le_bits(value: Field) -> [u1; N] {} +fn __to_le_bits(value: Field) -> [bool; N] {} -/// Decomposes `self` into its big endian bit decomposition as a `[u1; N]` array. +/// Decomposes `self` into its big endian bit decomposition as a `[bool; N]` array. /// This array will be zero padded should not all bits be necessary to represent `self`. /// /// # Failures @@ -270,16 +333,16 @@ fn __to_le_bits(value: Field) -> [u1; N] {} /// (e.g. 254 for the BN254 field) allow for multiple bit decompositions. This is due to how the `Field` will /// wrap around due to overflow when verifying the decomposition. #[builtin(to_be_bits)] -fn __to_be_bits(value: Field) -> [u1; N] {} +fn __to_be_bits(value: Field) -> [bool; N] {} #[builtin(modulus_num_bits)] pub comptime fn modulus_num_bits() -> u64 {} #[builtin(modulus_be_bits)] -pub comptime fn modulus_be_bits() -> [u1] {} +pub comptime fn modulus_be_bits() -> [bool] {} #[builtin(modulus_le_bits)] -pub comptime fn modulus_le_bits() -> [u1] {} +pub comptime fn modulus_le_bits() -> [bool] {} #[builtin(modulus_be_bytes)] pub comptime fn modulus_be_bytes() -> [u8] {} @@ -295,22 +358,6 @@ pub(crate) unconstrained fn field_less_than(x: Field, y: Field) -> bool { __field_less_than(x, y) } -// Convert a 32 byte array to a field element by modding -pub fn bytes32_to_field(bytes32: [u8; 32]) -> Field { - // Convert it to a field element - let mut v = 1; - let mut high = 0 as Field; - let mut low = 0 as Field; - - for i in 0..16 { - high = high + (bytes32[15 - i] as Field) * v; - low = low + (bytes32[16 + 15 - i] as Field) * v; - v = v * 256; - } - // Abuse that a % p + b % p = (a + b) % p and that low < p - low + high * v -} - fn lt_fallback(x: Field, y: Field) -> bool { if is_unconstrained() { // Safety: unconstrained context @@ -347,8 +394,8 @@ mod tests { // docs:start:to_be_bits_example fn test_to_be_bits() { let field = 2; - let bits: [u1; 8] = field.to_be_bits(); - assert_eq(bits, [0, 0, 0, 0, 0, 0, 1, 0]); + let bits: [bool; 8] = field.to_be_bits(); + assert_eq(bits, [false, false, false, false, false, false, true, false]); } // docs:end:to_be_bits_example @@ -356,8 +403,8 @@ mod tests { // docs:start:to_le_bits_example fn test_to_le_bits() { let field = 2; - let bits: [u1; 8] = field.to_le_bits(); - assert_eq(bits, [0, 1, 0, 0, 0, 0, 0, 0]); + let bits: [bool; 8] = field.to_le_bits(); + assert_eq(bits, [false, true, false, false, false, false, false, false]); } // docs:end:to_le_bits_example @@ -480,6 +527,40 @@ mod tests { let _: [u8; 16] = 0x100000000000000000000000000000000.to_le_bytes(); } + #[test(should_fail_with = "Field failed to decompose into specified 0 limbs")] + unconstrained fn non_zero_field_to_le_bytes_zero_limbs() { + let _: [u8; 0] = 5.to_le_bytes(); + } + + #[test(should_fail_with = "Field failed to decompose into specified 0 limbs")] + unconstrained fn non_zero_field_to_be_bytes_zero_limbs() { + let _: [u8; 0] = 5.to_be_bytes(); + } + + #[test] + unconstrained fn zero_field_to_bytes_zero_limbs_unconstrained() { + assert_eq((0 as Field).to_le_bytes::<0>().len(), 0); + assert_eq((0 as Field).to_be_bytes::<0>().len(), 0); + assert_eq((0 as Field).to_le_bits::<0>().len(), 0); + assert_eq((0 as Field).to_be_bits::<0>().len(), 0); + } + + #[test] + fn zero_field_to_bytes_zero_limbs_constrained() { + assert_eq((0 as Field).to_le_bytes::<0>().len(), 0); + assert_eq((0 as Field).to_be_bytes::<0>().len(), 0); + assert_eq((0 as Field).to_le_bits::<0>().len(), 0); + assert_eq((0 as Field).to_be_bits::<0>().len(), 0); + } + + #[test] + fn zero_field_to_bytes_zero_limbs_comptime() { + let _: [u8; 0] = comptime { (0 as Field).to_le_bytes() }; + let _: [u8; 0] = comptime { (0 as Field).to_be_bytes() }; + let _: [bool; 0] = comptime { (0 as Field).to_le_bits() }; + let _: [bool; 0] = comptime { (0 as Field).to_be_bits() }; + } + #[test] unconstrained fn test_field_less_than() { assert(field_less_than(0, 1)); @@ -492,8 +573,8 @@ mod tests { unconstrained fn test_large_field_values_unconstrained() { let large_field = 0xffffffffffffffff; - let bits: [u1; 64] = large_field.to_le_bits(); - assert_eq(bits[0], 1); + let bits: [bool; 64] = large_field.to_le_bits(); + assert_eq(bits[0], true); let bytes: [u8; 8] = large_field.to_le_bytes(); assert_eq(Field::from_le_bytes::<8>(bytes), large_field); @@ -506,8 +587,8 @@ mod tests { fn test_large_field_values() { let large_val = 0xffffffffffffffff; - let bits: [u1; 64] = large_val.to_le_bits(); - assert_eq(bits[0], 1); + let bits: [bool; 64] = large_val.to_le_bits(); + assert_eq(bits[0], true); let bytes: [u8; 8] = large_val.to_le_bytes(); assert_eq(Field::from_le_bytes::<8>(bytes), large_val); @@ -518,18 +599,18 @@ mod tests { #[test] fn test_decomposition_edge_cases() { - let zero_bits: [u1; 8] = 0.to_le_bits(); - assert_eq(zero_bits, [0; 8]); + let zero_bits: [bool; 8] = 0.to_le_bits(); + assert_eq(zero_bits, [false; 8]); let zero_bytes: [u8; 8] = 0.to_le_bytes(); assert_eq(zero_bytes, [0; 8]); - let one_bits: [u1; 8] = 1.to_le_bits(); - let expected: [u1; 8] = [1, 0, 0, 0, 0, 0, 0, 0]; + let one_bits: [bool; 8] = 1.to_le_bits(); + let expected: [bool; 8] = [true, false, false, false, false, false, false, false]; assert_eq(one_bits, expected); - let pow2_bits: [u1; 8] = 4.to_le_bits(); - let expected: [u1; 8] = [0, 0, 1, 0, 0, 0, 0, 0]; + let pow2_bits: [bool; 8] = 4.to_le_bits(); + let expected: [bool; 8] = [false, false, true, false, false, false, false, false]; assert_eq(pow2_bits, expected); } @@ -550,22 +631,22 @@ mod tests { #[test] fn test_sgn0() { - assert_eq(0.sgn0(), 0); - assert_eq(2.sgn0(), 0); - assert_eq(4.sgn0(), 0); - assert_eq(100.sgn0(), 0); + assert_eq(0.sgn0(), false); + assert_eq(2.sgn0(), false); + assert_eq(4.sgn0(), false); + assert_eq(100.sgn0(), false); - assert_eq(1.sgn0(), 1); - assert_eq(3.sgn0(), 1); - assert_eq(5.sgn0(), 1); - assert_eq(101.sgn0(), 1); + assert_eq(1.sgn0(), true); + assert_eq(3.sgn0(), true); + assert_eq(5.sgn0(), true); + assert_eq(101.sgn0(), true); } #[test(should_fail_with = "Field failed to decompose into specified 8 limbs")] fn test_bit_decomposition_overflow() { // 8 bits can't represent large field values let large_val = 0x1000000000000000; - let _: [u1; 8] = large_val.to_le_bits(); + let _: [bool; 8] = large_val.to_le_bits(); } #[test(should_fail_with = "Field failed to decompose into specified 4 limbs")] @@ -657,9 +738,83 @@ mod tests { } } + #[test] + fn test_from_le_bytes_checked_accepts_modulus_minus_one() { + if crate::compat::is_bn254() { + let mut p_minus_1_bytes: [u8; 32] = modulus_le_bytes().as_array(); + assert(p_minus_1_bytes[0] > 0); + p_minus_1_bytes[0] -= 1; + let p_minus_1 = Field::from_le_bytes_checked::<32>(p_minus_1_bytes); + assert_eq(p_minus_1 + 1, 0); + } + } + + #[test(should_fail_with = "input bytes are not a canonical field representation")] + fn test_from_le_bytes_checked_rejects_modulus() { + if crate::compat::is_bn254() { + let _ = Field::from_le_bytes_checked::<32>(modulus_le_bytes().as_array()); + } else { + panic("input bytes are not a canonical field representation"); + } + } + + #[test(should_fail_with = "input bytes are not a canonical field representation")] + fn test_from_le_bytes_checked_rejects_modulus_plus_one() { + if crate::compat::is_bn254() { + let mut p_plus_1_bytes: [u8; 32] = modulus_le_bytes().as_array(); + assert(p_plus_1_bytes[0] < 255); + p_plus_1_bytes[0] += 1; + let _ = Field::from_le_bytes_checked::<32>(p_plus_1_bytes); + } else { + panic("input bytes are not a canonical field representation"); + } + } + + #[test] + fn test_from_be_bytes_checked_accepts_modulus_minus_one() { + if crate::compat::is_bn254() { + let mut p_minus_1_bytes: [u8; 32] = modulus_be_bytes().as_array(); + assert(p_minus_1_bytes[32 - 1] > 0); + p_minus_1_bytes[32 - 1] -= 1; + let p_minus_1 = Field::from_be_bytes_checked::<32>(p_minus_1_bytes); + assert_eq(p_minus_1 + 1, 0); + } + } + + #[test(should_fail_with = "input bytes are not a canonical field representation")] + fn test_from_be_bytes_checked_rejects_modulus() { + if crate::compat::is_bn254() { + let _ = Field::from_be_bytes_checked::<32>(modulus_be_bytes().as_array()); + } else { + panic("input bytes are not a canonical field representation"); + } + } + + #[test(should_fail_with = "input bytes are not a canonical field representation")] + fn test_from_be_bytes_checked_rejects_modulus_plus_one() { + if crate::compat::is_bn254() { + let mut p_plus_1_bytes: [u8; 32] = modulus_be_bytes().as_array(); + assert(p_plus_1_bytes[32 - 1] < 255); + p_plus_1_bytes[32 - 1] += 1; + let _ = Field::from_be_bytes_checked::<32>(p_plus_1_bytes); + } else { + panic("input bytes are not a canonical field representation"); + } + } + + #[test] + fn test_from_bytes_checked_small_n() { + // For N < modulus_bytes().len(), the input cannot overflow the modulus, so the checked + // variants behave identically to the unchecked ones. + let le_bytes: [u8; 8] = [3, 1, 0, 0, 0, 0, 0, 0]; + assert_eq(Field::from_le_bytes_checked::<8>(le_bytes), 259); + let be_bytes: [u8; 8] = [0, 0, 0, 0, 0, 0, 1, 3]; + assert_eq(Field::from_be_bytes_checked::<8>(be_bytes), 259); + } + /// Convert a little endian bit array to a field element. /// If the provided bit array overflows the field modulus then the Field will silently wrap around. - fn from_le_bits(bits: [u1; N]) -> Field { + fn from_le_bits(bits: [bool; N]) -> Field { static_assert( N <= modulus_le_bits().len(), "N must be less than or equal to modulus_le_bits().len()", @@ -676,7 +831,7 @@ mod tests { /// Convert a big endian bit array to a field element. /// If the provided bit array overflows the field modulus then the Field will silently wrap around. - fn from_be_bits(bits: [u1; N]) -> Field { + fn from_be_bits(bits: [bool; N]) -> Field { let mut v = 1; let mut result = 0; @@ -691,40 +846,40 @@ mod tests { fn test_to_from_be_bits_bn254_edge_cases() { if crate::compat::is_bn254() { // checking that decrementing this bit produces the expected 254 BE bits for (modulus - 1) - let mut p_minus_1_bits: [u1; 254] = modulus_be_bits().as_array(); - assert(p_minus_1_bits[254 - 1] > 0); - p_minus_1_bits[254 - 1] -= 1; + let mut p_minus_1_bits: [bool; 254] = modulus_be_bits().as_array(); + assert(p_minus_1_bits[254 - 1]); + p_minus_1_bits[254 - 1] = false; let p_minus_1 = from_be_bits::<254>(p_minus_1_bits); assert_eq(p_minus_1 + 1, 0); // checking that converting (modulus - 1) from and then to 254 BE bits produces the same bits - let p_minus_1_converted_bits: [u1; 254] = p_minus_1.to_be_bits(); + let p_minus_1_converted_bits: [bool; 254] = p_minus_1.to_be_bits(); assert_eq(p_minus_1_converted_bits, p_minus_1_bits); // checking that incrementing this bit produces 254 BE bits for (modulus + 4) - let mut p_plus_4_bits: [u1; 254] = modulus_be_bits().as_array(); - assert(p_plus_4_bits[254 - 3] < 1); - p_plus_4_bits[254 - 3] += 1; + let mut p_plus_4_bits: [bool; 254] = modulus_be_bits().as_array(); + assert(!p_plus_4_bits[254 - 3]); + p_plus_4_bits[254 - 3] = true; let p_plus_4 = from_be_bits::<254>(p_plus_4_bits); assert_eq(p_plus_4, 4); // checking that converting p_plus_4 to 254 BE bits produces the same // bit set to 1 as p_plus_4_bits and otherwise zeroes - let mut p_plus_4_converted_bits: [u1; 254] = p_plus_4.to_be_bits(); - assert_eq(p_plus_4_converted_bits[254 - 3], 1); - p_plus_4_converted_bits[254 - 3] = 0; - assert_eq(p_plus_4_converted_bits, [0; 254]); + let mut p_plus_4_converted_bits: [bool; 254] = p_plus_4.to_be_bits(); + assert(p_plus_4_converted_bits[254 - 3]); + p_plus_4_converted_bits[254 - 3] = false; + assert_eq(p_plus_4_converted_bits, [false; 254]); // checking that Field::from_be_bits::<254> on the Field modulus produces 0 assert_eq(modulus_be_bits().len(), 254); let p = from_be_bits::<254>(modulus_be_bits().as_array()); assert_eq(p, 0); - // checking that converting 0 to 254 BE bytes produces 254 zeroes - let p_bits: [u1; 254] = 0.to_be_bits(); - assert_eq(p_bits, [0; 254]); + // checking that converting 0 to 254 BE bits produces 254 false values + let p_bits: [bool; 254] = 0.to_be_bits(); + assert_eq(p_bits, [false; 254]); } } @@ -732,40 +887,47 @@ mod tests { fn test_to_from_le_bits_bn254_edge_cases() { if crate::compat::is_bn254() { // checking that decrementing this bit produces the expected 254 LE bits for (modulus - 1) - let mut p_minus_1_bits: [u1; 254] = modulus_le_bits().as_array(); - assert(p_minus_1_bits[0] > 0); - p_minus_1_bits[0] -= 1; + let mut p_minus_1_bits: [bool; 254] = modulus_le_bits().as_array(); + assert(p_minus_1_bits[0]); + p_minus_1_bits[0] = false; let p_minus_1 = from_le_bits::<254>(p_minus_1_bits); assert_eq(p_minus_1 + 1, 0); // checking that converting (modulus - 1) from and then to 254 BE bits produces the same bits - let p_minus_1_converted_bits: [u1; 254] = p_minus_1.to_le_bits(); + let p_minus_1_converted_bits: [bool; 254] = p_minus_1.to_le_bits(); assert_eq(p_minus_1_converted_bits, p_minus_1_bits); // checking that incrementing this bit produces 254 LE bits for (modulus + 4) - let mut p_plus_4_bits: [u1; 254] = modulus_le_bits().as_array(); - assert(p_plus_4_bits[2] < 1); - p_plus_4_bits[2] += 1; + let mut p_plus_4_bits: [bool; 254] = modulus_le_bits().as_array(); + assert(!p_plus_4_bits[2]); + p_plus_4_bits[2] = true; let p_plus_4 = from_le_bits::<254>(p_plus_4_bits); assert_eq(p_plus_4, 4); // checking that converting p_plus_4 to 254 LE bits produces the same // bit set to 1 as p_plus_4_bits and otherwise zeroes - let mut p_plus_4_converted_bits: [u1; 254] = p_plus_4.to_le_bits(); - assert_eq(p_plus_4_converted_bits[2], 1); - p_plus_4_converted_bits[2] = 0; - assert_eq(p_plus_4_converted_bits, [0; 254]); + let mut p_plus_4_converted_bits: [bool; 254] = p_plus_4.to_le_bits(); + assert(p_plus_4_converted_bits[2]); + p_plus_4_converted_bits[2] = false; + assert_eq(p_plus_4_converted_bits, [false; 254]); // checking that Field::from_le_bits::<254> on the Field modulus produces 0 assert_eq(modulus_le_bits().len(), 254); let p = from_le_bits::<254>(modulus_le_bits().as_array()); assert_eq(p, 0); - // checking that converting 0 to 254 LE bytes produces 254 zeroes - let p_bits: [u1; 254] = 0.to_le_bits(); - assert_eq(p_bits, [0; 254]); + // checking that converting 0 to 254 LE bits produces 254 false values + let p_bits: [bool; 254] = 0.to_le_bits(); + assert_eq(p_bits, [false; 254]); } } + + #[test(should_fail_with = "call to assert_max_bit_size")] + fn max_bit_size_too_large() { + let x: Field = 0x010000; + x.assert_max_bit_size::<16>(); + } + } diff --git a/stdlib/src/hash/mod.nr b/stdlib/src/hash/mod.nr index 64368739..ad236bad 100644 --- a/stdlib/src/hash/mod.nr +++ b/stdlib/src/hash/mod.nr @@ -6,6 +6,10 @@ use crate::embedded_curve_ops::{ EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul, multi_scalar_mul_array_return, }; use crate::meta::derive_via; +use crate::static_assert; + +/// The size of the state accepted by the backend in `poseidon2_permutation`. +global POSEIDON2_CONFIG_STATE_SIZE: u32 = poseidon2_config_state_size(); #[foreign(sha256_compression)] // docs:start:sha256_compression @@ -17,13 +21,6 @@ pub fn sha256_compression(input: [u32; 16], state: [u32; 8]) -> [u32; 8] {} pub fn keccakf1600(input: [u64; 25]) -> [u64; 25] {} // docs:end:keccakf1600 -pub mod keccak { - #[deprecated("This function has been moved to std::hash::keccakf1600")] - pub fn keccakf1600(input: [u64; 25]) -> [u64; 25] { - super::keccakf1600(input) - } -} - #[foreign(blake2s)] // docs:start:blake2s pub fn blake2s(input: [u8; N]) -> [u8; 32] @@ -61,8 +58,7 @@ pub fn pedersen_commitment_with_separator( ) -> EmbeddedCurvePoint { let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N]; for i in 0..N { - // we use the unsafe version because the multi_scalar_mul will constrain the scalars. - points[i] = from_field_unsafe(input[i]); + points[i] = EmbeddedCurveScalar::from_field(input[i]); } let generators = derive_generators("DEFAULT_DOMAIN_SEPARATOR".as_bytes(), separator); multi_scalar_mul(generators, points) @@ -85,7 +81,7 @@ pub fn pedersen_hash_with_separator(input: [Field; N], separator: u3 derive_generators("DEFAULT_DOMAIN_SEPARATOR".as_bytes(), separator); for i in 0..N { - scalars[i] = from_field_unsafe(input[i]); + scalars[i] = EmbeddedCurveScalar::from_field(input[i]); generators[i] = domain_generators[i]; } scalars[N] = EmbeddedCurveScalar { lo: N as Field, hi: 0 as Field }; @@ -114,35 +110,20 @@ fn __derive_generators( starting_index: u32, ) -> [EmbeddedCurvePoint; N] {} -#[field(bn254)] -// Decompose the input 'bn254 scalar' into two 128 bits limbs. -// It is called 'unsafe' because it does not assert the limbs are 128 bits -// Assuming the limbs are 128 bits: -// Assert the decomposition does not overflow the field size. -fn from_field_unsafe(scalar: Field) -> EmbeddedCurveScalar { - // Safety: xlo and xhi decomposition is checked below - let (xlo, xhi) = unsafe { crate::field::bn254::decompose_hint(scalar) }; - // Check that the decomposition is correct - assert_eq(scalar, xlo + crate::field::bn254::TWO_POW_128 * xhi); - // Check that the decomposition does not overflow the field size - let (a, b) = if xhi == crate::field::bn254::PHI { - (xlo, crate::field::bn254::PLO) - } else { - (xhi, crate::field::bn254::PHI) - }; - crate::field::bn254::assert_lt(a, b); - - EmbeddedCurveScalar { lo: xlo, hi: xhi } -} - -pub fn poseidon2_permutation(input: [Field; N], state_len: u32) -> [Field; N] { - assert_eq(input.len(), state_len); +pub fn poseidon2_permutation(input: [Field; N]) -> [Field; N] { + static_assert( + N == POSEIDON2_CONFIG_STATE_SIZE, + f"the input length must equal the state size in the Poseidon2 config; expected {POSEIDON2_CONFIG_STATE_SIZE}, got {N}", + ); poseidon2_permutation_internal(input) } #[foreign(poseidon2_permutation)] fn poseidon2_permutation_internal(input: [Field; N]) -> [Field; N] {} +#[foreign(poseidon2_config_state_size)] +comptime fn poseidon2_config_state_size() -> u32 {} + // Generic hashing support. // Partially ported and impacted by rust. @@ -175,6 +156,13 @@ comptime fn derive_hash(s: TypeDefinition) -> Quoted { pub trait Hasher { fn finish(self) -> Field; + /// Returns the hash value without consuming the hasher. + /// Override this for more efficient implementations that avoid copying. + /// TODO: deprecate finish() and replace it + fn finish_ref(&self) -> Field { + (*self).finish() + } + fn write(&mut self, input: Field); } @@ -216,15 +204,6 @@ impl Hash for Field { } } -impl Hash for u1 { - fn hash(self, state: &mut H) - where - H: Hasher, - { - H::write(state, self as Field); - } -} - impl Hash for u8 { fn hash(self, state: &mut H) where @@ -351,6 +330,18 @@ where } } +impl Hash for (A,) +where + A: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + } +} + impl Hash for (A, B) where A: Hash, @@ -419,6 +410,202 @@ where } } +impl Hash for (A, B, C, D, E, F) +where + A: Hash, + B: Hash, + C: Hash, + D: Hash, + E: Hash, + F: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + self.1.hash(state); + self.2.hash(state); + self.3.hash(state); + self.4.hash(state); + self.5.hash(state); + } +} + +impl Hash for (A, B, C, D, E, F, G) +where + A: Hash, + B: Hash, + C: Hash, + D: Hash, + E: Hash, + F: Hash, + G: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + self.1.hash(state); + self.2.hash(state); + self.3.hash(state); + self.4.hash(state); + self.5.hash(state); + self.6.hash(state); + } +} + +impl Hash for (A, B, C, D, E, F, G, H_) +where + A: Hash, + B: Hash, + C: Hash, + D: Hash, + E: Hash, + F: Hash, + G: Hash, + H_: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + self.1.hash(state); + self.2.hash(state); + self.3.hash(state); + self.4.hash(state); + self.5.hash(state); + self.6.hash(state); + self.7.hash(state); + } +} + +impl Hash for (A, B, C, D, E, F, G, H_, I) +where + A: Hash, + B: Hash, + C: Hash, + D: Hash, + E: Hash, + F: Hash, + G: Hash, + H_: Hash, + I: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + self.1.hash(state); + self.2.hash(state); + self.3.hash(state); + self.4.hash(state); + self.5.hash(state); + self.6.hash(state); + self.7.hash(state); + self.8.hash(state); + } +} + +impl Hash for (A, B, C, D, E, F, G, H_, I, J) +where + A: Hash, + B: Hash, + C: Hash, + D: Hash, + E: Hash, + F: Hash, + G: Hash, + H_: Hash, + I: Hash, + J: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + self.1.hash(state); + self.2.hash(state); + self.3.hash(state); + self.4.hash(state); + self.5.hash(state); + self.6.hash(state); + self.7.hash(state); + self.8.hash(state); + self.9.hash(state); + } +} + +impl Hash for (A, B, C, D, E, F, G, H_, I, J, K) +where + A: Hash, + B: Hash, + C: Hash, + D: Hash, + E: Hash, + F: Hash, + G: Hash, + H_: Hash, + I: Hash, + J: Hash, + K: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + self.1.hash(state); + self.2.hash(state); + self.3.hash(state); + self.4.hash(state); + self.5.hash(state); + self.6.hash(state); + self.7.hash(state); + self.8.hash(state); + self.9.hash(state); + self.10.hash(state); + } +} + +impl Hash for (A, B, C, D, E, F, G, H_, I, J, K, L) +where + A: Hash, + B: Hash, + C: Hash, + D: Hash, + E: Hash, + F: Hash, + G: Hash, + H_: Hash, + I: Hash, + J: Hash, + K: Hash, + L: Hash, +{ + fn hash(self, state: &mut H) + where + H: Hasher, + { + self.0.hash(state); + self.1.hash(state); + self.2.hash(state); + self.3.hash(state); + self.4.hash(state); + self.5.hash(state); + self.6.hash(state); + self.7.hash(state); + self.8.hash(state); + self.9.hash(state); + self.10.hash(state); + self.11.hash(state); + } +} + // Some test vectors for Pedersen hash and Pedersen Commitment. // They have been generated using the same functions so the tests are for now useless // but they will be useful when we switch to Noir implementation. @@ -433,7 +620,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x054aa86a73cb8a34525e5bbed6e43ba1198e860f5f3950268f71df4591bde402, y: 0x209dcfbf2cfb57f9f6046f44d71ac6faf87254afc7407c04eb621a6287cac126, - is_infinite: false, }, ); @@ -446,7 +632,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x2e2b3b191e49541fe468ec6877721d445dcaffe41728df0a0eafeb15e87b0753, y: 0x2ff4482400ad3a6228be17a2af33e2bcdf41be04795f9782bd96efe7e24f8778, - is_infinite: false, }, ); assert_eq( @@ -458,7 +643,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x1fee4e8cf8d2f527caa2684236b07c4b1bad7342c01b0f75e9a877a71827dc85, y: 0x2f9fedb9a090697ab69bf04c8bc15f7385b3e4b68c849c1536e5ae15ff138fd1, - is_infinite: false, }, ); assert_eq( @@ -470,7 +654,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x07ae3e202811e1fca39c2d81eabe6f79183978e6f12be0d3b8eda095b79bdbc9, y: 0x0afc6f892593db6fbba60f2da558517e279e0ae04f95758587760ba193145014, - is_infinite: false, }, ); assert_eq( @@ -482,7 +665,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x1754b12bd475a6984a1094b5109eeca9838f4f81ac89c5f0a41dbce53189bb29, y: 0x2da030e3cfcdc7ddad80eaf2599df6692cae0717d4e9f7bfbee8d073d5d278f7, - is_infinite: false, }, ); assert_eq( @@ -494,7 +676,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x190f6c0e97ad83e1e28da22a98aae156da083c5a4100e929b77e750d3106a697, y: 0x1f4b60f34ef91221a0b49756fa0705da93311a61af73d37a0c458877706616fb, - is_infinite: false, }, ); assert_eq( @@ -506,7 +687,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x015441e9d29491b06563fac16fc76abf7a9534c715421d0de85d20dbe2965939, y: 0x1d2575b0276f4e9087e6e07c2cb75aa1baafad127af4be5918ef8a2ef2fea8fc, - is_infinite: false, }, ); assert_eq( @@ -518,7 +698,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x1657737676968887fceb6dd516382ea13b3a2c557f509811cd86d5d1199bc443, y: 0x1f39f0cb569040105fa1e2f156521e8b8e08261e635a2b210bdc94e8d6d65f77, - is_infinite: false, }, ); assert_eq( @@ -530,7 +709,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x0a3ceae42d14914a432aa60ec7fded4af7dad7dd4acdbf2908452675ec67e06d, y: 0xfc19761eaaf621ad4aec9a8b2e84a4eceffdba78f60f8b9391b0bd9345a2f2, - is_infinite: false, }, ); assert_eq( @@ -542,7 +720,6 @@ fn assert_pedersen() { EmbeddedCurvePoint { x: 0x2fb3f8b3d41ddde007c8c3c62550f9a9380ee546fcc639ffbb3fd30c8d8de30c, y: 0x300783be23c446b11a4c0fabf6c91af148937cea15fcf5fb054abf7f752ee245, - is_infinite: false, }, ); } diff --git a/stdlib/src/hash/poseidon2.nr b/stdlib/src/hash/poseidon2.nr index 559236c2..f976066b 100644 --- a/stdlib/src/hash/poseidon2.nr +++ b/stdlib/src/hash/poseidon2.nr @@ -1,109 +1,109 @@ use crate::default::Default; -use crate::hash::Hasher; +use crate::hash::{Hasher, POSEIDON2_CONFIG_STATE_SIZE}; -comptime global RATE: u32 = 3; +// Sponge capacity in field elements: It must match the backend's Poseidon2 parameter. +global CAPACITY: u32 = 1; +global RATE: u32 = POSEIDON2_CONFIG_STATE_SIZE - CAPACITY; -pub(crate) struct Poseidon2 { - cache: [Field; 3], - state: [Field; 4], - cache_size: u32, - squeeze_mode: bool, // 0 => absorb, 1 => squeeze +pub(crate) struct Poseidon2Hasher { + _state: [Field], } -impl Poseidon2 { - #[no_predicates] - pub(crate) fn hash(input: [Field; N], message_size: u32) -> Field { - Poseidon2::hash_internal(input, message_size, message_size != N) +impl Hasher for Poseidon2Hasher { + fn finish(self) -> Field { + self.finish_ref() } - pub(crate) fn new(iv: Field) -> Poseidon2 { - let mut result = - Poseidon2 { cache: [0; 3], state: [0; 4], cache_size: 0, squeeze_mode: false }; - result.state[RATE] = iv; - result - } + fn finish_ref(&self) -> Field { + let input_length = self._state.len(); + let iv: Field = (input_length as Field) * 18446744073709551616; // iv = (self._state.len() << 64) + let mut state = [0; POSEIDON2_CONFIG_STATE_SIZE]; + state[RATE] = iv; - fn perform_duplex(&mut self) { - // add the cache into sponge state - for i in 0..RATE { - // We effectively zero-pad the cache by only adding to the state - // cache that is less than the specified `cache_size` - if i < self.cache_size { - self.state[i] += self.cache[i]; + // These for-loops can run for a dynamic number of iterations, however + // this is not an issue in practice as this code is only reachable within a `comptime` context + for i in 0..input_length / RATE { + for j in 0..RATE { + state[j] += self._state[i * RATE + j]; } + state = super::poseidon2_permutation(state); } - self.state = crate::hash::poseidon2_permutation_internal(self.state); - } - fn absorb(&mut self, input: Field) { - assert(!self.squeeze_mode); - if self.cache_size == RATE { - // If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache - self.perform_duplex(); - self.cache[0] = input; - self.cache_size = 1; - } else { - // If we're absorbing, and the cache is not full, add the input into the cache - self.cache[self.cache_size] = input; - self.cache_size += 1; + let absorbed = (input_length / RATE) * RATE; + for i in 0..input_length % RATE { + state[i] += self._state[absorbed + i]; } - } - fn squeeze(&mut self) -> Field { - assert(!self.squeeze_mode); - // If we're in absorb mode, apply sponge permutation to compress the cache. - self.perform_duplex(); - self.squeeze_mode = true; - - // Pop one item off the top of the permutation and return it. - self.state[0] + crate::hash::poseidon2_permutation(state)[0] } - fn hash_internal( - input: [Field; N], - in_len: u32, - is_variable_length: bool, - ) -> Field { - let two_pow_64 = 18446744073709551616; - let iv: Field = (in_len as Field) * two_pow_64; - let mut sponge = Poseidon2::new(iv); - for i in 0..input.len() { - if i < in_len { - sponge.absorb(input[i]); - } - } - - // In the case where the hash preimage is variable-length, we append `1` to the end of the input, to distinguish - // from fixed-length hashes. (the combination of this additional field element + the hash IV ensures - // fixed-length and variable-length hashes do not collide) - if is_variable_length { - sponge.absorb(1); - } - sponge.squeeze() + fn write(&mut self, input: Field) { + self._state = self._state.push_back(input); } } -pub(crate) struct Poseidon2Hasher { - _state: [Field], +impl Default for Poseidon2Hasher { + fn default() -> Self { + Poseidon2Hasher { _state: [].as_vector() } + } } -impl Hasher for Poseidon2Hasher { - fn finish(self) -> Field { - let iv: Field = (self._state.len() as Field) * 18446744073709551616; // iv = (self._state.len() << 64) - let mut sponge = Poseidon2::new(iv); - for i in 0..self._state.len() { - sponge.absorb(self._state[i]); - } - sponge.squeeze() +mod test { + use crate::hash::Hasher; + use super::Poseidon2Hasher; + + // Test the exact output of Poseidon2. This catches any change to the parameters. + #[test] + unconstrained fn finish_ref_matches_known_digest() { + let mut a = Poseidon2Hasher { _state: [].as_vector() }; + a.write(1); + a.write(2); + a.write(3); + a.write(4); + a.write(5); + assert(a.finish() == 0x2247be7014a54d17342a7ef677f58d28877780d203860396967f5d0a18d259db); } - fn write(&mut self, input: Field) { - self._state = self._state.push_back(input); + // The residual block absorbs the unabsorbed tail elements. If it instead + // re-absorbed the prefix, mutating the trailing `len % RATE` elements would + // leave the digest unchanged, producing a collision. + #[test] + unconstrained fn finish_ref_does_not_drop_tail_at_length_4() { + let mut a = Poseidon2Hasher { _state: [].as_vector() }; + a.write(1); + a.write(2); + a.write(3); + a.write(4); + let h_a = a.finish(); + + let mut b = Poseidon2Hasher { _state: [].as_vector() }; + b.write(1); + b.write(2); + b.write(3); + b.write(99999); + let h_b = b.finish(); + + assert(h_a != h_b); } -} -impl Default for Poseidon2Hasher { - fn default() -> Self { - Poseidon2Hasher { _state: [].as_vector() } + #[test] + unconstrained fn finish_ref_does_not_drop_tail_at_length_5() { + let mut a = Poseidon2Hasher { _state: [].as_vector() }; + a.write(1); + a.write(2); + a.write(3); + a.write(4); + a.write(5); + let h_a = a.finish(); + + let mut b = Poseidon2Hasher { _state: [].as_vector() }; + b.write(1); + b.write(2); + b.write(3); + b.write(77); + b.write(88); + let h_b = b.finish(); + + assert(h_a != h_b); } } diff --git a/stdlib/src/integer.nr b/stdlib/src/integer.nr new file mode 100644 index 00000000..c51c7b20 --- /dev/null +++ b/stdlib/src/integer.nr @@ -0,0 +1,193 @@ +impl u8 { + /// Returns the maximum value representable by `u8`: 255. + pub fn max_value() -> u8 { + 255 + } + + /// Returns the minimum value representable by `u8`: 0. + pub fn min_value() -> u8 { + 0 + } + + /// Returns the number of bits in `u8`: 8. + pub fn bits() -> u32 { + 8 + } +} + +impl u16 { + /// Returns the maximum value representable by `u16`: 65535. + pub fn max_value() -> u16 { + 65535 + } + + /// Returns the minimum value representable by `u16`: 0. + pub fn min_value() -> u16 { + 0 + } + + /// Returns the number of bits in `u16`: 16. + pub fn bits() -> u32 { + 16 + } +} + +impl u32 { + /// Returns the maximum value representable by `u32`: 4294967295. + pub fn max_value() -> u32 { + 4294967295 + } + + /// Returns the minimum value representable by `u32`: 0. + pub fn min_value() -> u32 { + 0 + } + + /// Returns the number of bits in `u32`: 32. + pub fn bits() -> u32 { + 32 + } +} + +impl u64 { + /// Returns the maximum value representable by `u64`: 18446744073709551615. + pub fn max_value() -> u64 { + 18446744073709551615 + } + + /// Returns the minimum value representable by `u64`: 0. + pub fn min_value() -> u64 { + 0 + } + + /// Returns the number of bits in `u64`: 64. + pub fn bits() -> u32 { + 64 + } +} + +impl i8 { + /// Returns the maximum value representable by `i8`: 127. + pub fn max_value() -> i8 { + 127 + } + + /// Returns the minimum value representable by `i8`: -128. + pub fn min_value() -> i8 { + -128 + } + + /// Returns the number of bits in `i8`: 8. + pub fn bits() -> u32 { + 8 + } +} + +impl i16 { + /// Returns the maximum value representable by `i16`: 32767. + pub fn max_value() -> i16 { + 32767 + } + + /// Returns the minimum value representable by `i16`: -32768. + pub fn min_value() -> i16 { + -32768 + } + + /// Returns the number of bits in `i16`: 16. + pub fn bits() -> u32 { + 16 + } +} + +impl i32 { + /// Returns the maximum value representable by `i32`: 2147483647. + pub fn max_value() -> i32 { + 2147483647 + } + + /// Returns the minimum value representable by `i32`: -2147483648. + pub fn min_value() -> i32 { + -2147483648 + } + + /// Returns the number of bits in `i32`: 32. + pub fn bits() -> u32 { + 32 + } +} + +impl i64 { + /// Returns the maximum value representable by `i64`: 9223372036854775807. + pub fn max_value() -> i64 { + 9223372036854775807 + } + + /// Returns the minimum value representable by `i64`: -9223372036854775808. + pub fn min_value() -> i64 { + -9223372036854775808 + } + + /// Returns the number of bits in `i64`: 64. + pub fn bits() -> u32 { + 64 + } +} + +mod tests { + #[test] + fn test_u8_limits() { + assert_eq(u8::max_value(), 255); + assert_eq(u8::min_value(), 0); + assert_eq(u8::bits(), 8); + } + + #[test] + fn test_u16_limits() { + assert_eq(u16::max_value(), 65535); + assert_eq(u16::min_value(), 0); + assert_eq(u16::bits(), 16); + } + + #[test] + fn test_u32_limits() { + assert_eq(u32::max_value(), 4294967295); + assert_eq(u32::min_value(), 0); + assert_eq(u32::bits(), 32); + } + + #[test] + fn test_u64_limits() { + assert_eq(u64::max_value(), 18446744073709551615); + assert_eq(u64::min_value(), 0); + assert_eq(u64::bits(), 64); + } + + #[test] + fn test_i8_limits() { + assert_eq(i8::max_value(), 127); + assert_eq(i8::min_value(), -128); + assert_eq(i8::bits(), 8); + } + + #[test] + fn test_i16_limits() { + assert_eq(i16::max_value(), 32767); + assert_eq(i16::min_value(), -32768); + assert_eq(i16::bits(), 16); + } + + #[test] + fn test_i32_limits() { + assert_eq(i32::max_value(), 2147483647); + assert_eq(i32::min_value(), -2147483648); + assert_eq(i32::bits(), 32); + } + + #[test] + fn test_i64_limits() { + assert_eq(i64::max_value(), 9223372036854775807); + assert_eq(i64::min_value(), -9223372036854775808); + assert_eq(i64::bits(), 64); + } +} diff --git a/stdlib/src/internal/mod.nr b/stdlib/src/internal/mod.nr new file mode 100644 index 00000000..324573cf --- /dev/null +++ b/stdlib/src/internal/mod.nr @@ -0,0 +1,12 @@ +/// Generates an unconstrained version of the given test function. +pub(crate) comptime fn test_unconstrained(f: FunctionDefinition) -> Quoted { + let name = f.name(); + let unconstrained_name = f"unconstrained_{name}".quoted_contents(); + let body = f.body(); + quote { + #[test] + unconstrained fn $unconstrained_name() { + $body + } + } +} diff --git a/stdlib/src/lib.nr b/stdlib/src/lib.nr index 817462bd..fa146267 100644 --- a/stdlib/src/lib.nr +++ b/stdlib/src/lib.nr @@ -23,7 +23,9 @@ pub mod mem; pub mod panic; pub mod hint; +mod integer; mod primitive_docs; +mod internal; // Oracle calls are required to be wrapped in an unconstrained function // Thus, the only argument to the `println` oracle is expected to always be an ident @@ -34,6 +36,7 @@ unconstrained fn print_unconstrained(with_newline: bool, input: T) { print_oracle(with_newline, input); } +/// Print the given input to stdout followed by a newline pub fn println(input: T) { // Safety: a print statement cannot be constrained unsafe { @@ -41,6 +44,7 @@ pub fn println(input: T) { } } +/// Print the given input to stdout pub fn print(input: T) { // Safety: a print statement cannot be constrained unsafe { @@ -98,15 +102,19 @@ fn verify_proof_internal( proof_type: u32, ) {} -// Asserts that the given value is known at compile-time. -// Useful for debugging for-loop bounds. +/// Asserts that the given value is known at compile-time. +/// Useful for debugging for-loop bounds. #[builtin(assert_constant)] pub fn assert_constant(x: T) {} -// Asserts that the given value is both true and known at compile-time. -// The message can be a string, a format string, or any value, as long as it is known at compile-time +/// Asserts that the given value is both true and known at compile-time. +/// The message can be a string, a format string, or any value, as long as it is known at compile-time #[builtin(static_assert)] pub fn static_assert(predicate: bool, message: T) {} +/// Force a field value to be a witness instead of a constant in the compiled output. +/// This is often only useful for debugging compiler optimizations. +/// +/// This has no effect in unconstrained or comptime code. #[builtin(as_witness)] pub fn as_witness(x: Field) {} diff --git a/stdlib/src/meta/ctstring.nr b/stdlib/src/meta/ctstring.nr index 181d58b7..ef3f0cf2 100644 --- a/stdlib/src/meta/ctstring.nr +++ b/stdlib/src/meta/ctstring.nr @@ -12,13 +12,13 @@ impl CtString { // docs:start:append_str pub comptime fn append_str(self, s: str) -> Self { // docs:end:append_str - f"{self}{s}".as_ctstring() + self.append(s.as_ctstring()) } // docs:start:append_fmtstr pub comptime fn append_fmtstr(self, s: fmtstr) -> Self { // docs:end:append_fmtstr - f"{self}{s}".as_ctstring() + self.append(s.as_ctstring()) } /// CtString cannot directly return a str since the size would not be known. @@ -36,9 +36,8 @@ impl Append for CtString { "".as_ctstring() } - comptime fn append(self, other: Self) -> Self { - f"{self}{other}".as_ctstring() - } + #[builtin(ctstring_append)] + comptime fn append(self, other: Self) -> Self {} } // docs:start:as-ctstring @@ -48,21 +47,18 @@ pub trait AsCtString { // docs:end:as-ctstring impl AsCtString for str { - comptime fn as_ctstring(self) -> CtString { - str_as_ctstring(self) - } + #[builtin(str_as_ctstring)] + comptime fn as_ctstring(self) -> CtString {} } impl AsCtString for fmtstr { - comptime fn as_ctstring(self) -> CtString { - fmtstr_as_ctstring(self) - } + #[builtin(fmtstr_as_ctstring)] + comptime fn as_ctstring(self) -> CtString {} } impl crate::cmp::Eq for CtString { - comptime fn eq(self, other: Self) -> bool { - ctstring_eq(self, other) - } + #[builtin(ctstring_eq)] + comptime fn eq(self, other: Self) -> bool {} } impl crate::hash::Hash for CtString { @@ -74,19 +70,11 @@ impl crate::hash::Hash for CtString { } } -#[builtin(str_as_ctstring)] -comptime fn str_as_ctstring(_s: str) -> CtString {} - -#[builtin(fmtstr_as_ctstring)] -comptime fn fmtstr_as_ctstring(_s: fmtstr) -> CtString {} - -#[builtin(ctstring_eq)] -comptime fn ctstring_eq(_first: CtString, _second: CtString) -> bool {} - #[builtin(ctstring_hash)] comptime fn ctstring_hash(_string: CtString) -> Field {} mod test { + use super::Append as _; use super::AsCtString; #[test] @@ -100,4 +88,21 @@ mod test { // docs:end:as_quoted_str_example } } + + #[test] + fn empty() { + comptime { + assert_eq(CtString::empty(), CtString::new()); + } + } + + #[test] + fn append() { + comptime { + let hello = "hello ".as_ctstring(); + let world = "world".as_ctstring(); + assert_eq(hello.append(world), "hello world".as_ctstring()); + } + } + } diff --git a/stdlib/src/meta/expr.nr b/stdlib/src/meta/expr.nr index 14917100..3fd08e83 100644 --- a/stdlib/src/meta/expr.nr +++ b/stdlib/src/meta/expr.nr @@ -108,11 +108,13 @@ impl Expr { pub comptime fn as_index(self) -> Option<(Expr, Expr)> {} // docs:end:as_index - /// If this expression is an integer literal, return the integer as a field - /// as well as whether the integer is negative (true) or not (false). + /// If this expression is an integer literal, return the integer as a field. + /// Note that negative integers of signed integer types will be encoded + /// as the equivalent negative field value such that e.g. `-1i8` will + /// return the `-1` field value rather than the two's complement encoding of `255`. #[builtin(expr_as_integer)] // docs:start:as_integer - pub comptime fn as_integer(self) -> Option<(Field, bool)> {} + pub comptime fn as_integer(self) -> Option {} // docs:end:as_integer /// If this expression is a lambda, returns the parameters, return type and body. @@ -158,13 +160,6 @@ impl Expr { pub comptime fn as_repeated_element_vector(self) -> Option<(Expr, Expr)> {} // docs:end:as_repeated_element_vector - /// If this expression is a repeated element vector `[elem; length]`, return - /// the repeated element and the length expressions. - /// This method is deprecated in favor of `as_repeated_element_vector` - #[builtin(expr_as_repeated_element_vector)] - #[deprecated("This method has been renamed to `as_repeated_element_vector`")] - pub comptime fn as_repeated_element_slice(self) -> Option<(Expr, Expr)> {} - /// If this expression is a vector literal `@[elem1, ..., elemN]`, /// return each element of the vector. #[builtin(expr_as_vector)] @@ -172,13 +167,6 @@ impl Expr { pub comptime fn as_vector(self) -> Option<[Expr]> {} // docs:end:as_vector - /// If this expression is a vector literal `@[elem1, ..., elemN]`, - /// return each element of the vector. - /// This method is deprecated in favor of `as_vector` - #[builtin(expr_as_vector)] - #[deprecated("This method has been renamed to `as_vector`")] - pub comptime fn as_slice(self) -> Option<[Expr]> {} - /// If this expression is a tuple `(field1, ..., fieldN)`, /// return each element of the tuple. #[builtin(expr_as_tuple)] @@ -233,49 +221,6 @@ impl Expr { pub comptime fn is_continue(self) -> bool {} // docs:end:is_continue - /// Applies a mapping function to this expression and to all of its sub-expressions. - /// `f` will be applied to each sub-expression first, then applied to the expression itself. - /// - /// This happens recursively for every expression within `self`. - /// - /// For example, calling `modify` on `(@[1], @[2, 3])` with an `f` that returns `Option::some` - /// for expressions that are integers, doubling them, would return `(@[2], @[4, 6])`. - // docs:start:modify - pub comptime fn modify(self, f: fn[Env](Expr) -> Option) -> Expr { - // docs:end:modify - let result = modify_array(self, f); - let result = result.or_else(|| modify_assert(self, f)); - let result = result.or_else(|| modify_assert_eq(self, f)); - let result = result.or_else(|| modify_assign(self, f)); - let result = result.or_else(|| modify_binary_op(self, f)); - let result = result.or_else(|| modify_block(self, f)); - let result = result.or_else(|| modify_cast(self, f)); - let result = result.or_else(|| modify_comptime(self, f)); - let result = result.or_else(|| modify_constructor(self, f)); - let result = result.or_else(|| modify_if(self, f)); - let result = result.or_else(|| modify_index(self, f)); - let result = result.or_else(|| modify_for(self, f)); - let result = result.or_else(|| modify_for_range(self, f)); - let result = result.or_else(|| modify_lambda(self, f)); - let result = result.or_else(|| modify_let(self, f)); - let result = result.or_else(|| modify_function_call(self, f)); - let result = result.or_else(|| modify_member_access(self, f)); - let result = result.or_else(|| modify_method_call(self, f)); - let result = result.or_else(|| modify_repeated_element_array(self, f)); - let result = result.or_else(|| modify_repeated_element_vector(self, f)); - let result = result.or_else(|| modify_vector(self, f)); - let result = result.or_else(|| modify_tuple(self, f)); - let result = result.or_else(|| modify_unary_op(self, f)); - let result = result.or_else(|| modify_unsafe(self, f)); - if result.is_some() { - let result = result.unwrap_unchecked(); - let modified = f(result); - modified.unwrap_or(result) - } else { - f(self).unwrap_or(self) - } - } - /// Returns this expression as a `Quoted` value. It's the same as `quote { $self }`. // docs:start:quoted pub comptime fn quoted(self) -> Quoted { @@ -297,384 +242,3 @@ impl Expr { pub comptime fn resolve(self, in_function: Option) -> TypedExpr {} // docs:end:resolve } - -comptime fn modify_array(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_array().map(|exprs| { - let exprs = modify_expressions(exprs, f); - new_array(exprs) - }) -} - -comptime fn modify_assert(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_assert().map(|(predicate, msg)| { - let predicate = predicate.modify(f); - let msg = msg.map(|msg| msg.modify(f)); - new_assert(predicate, msg) - }) -} - -comptime fn modify_assert_eq(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_assert_eq().map(|(lhs, rhs, msg)| { - let lhs = lhs.modify(f); - let rhs = rhs.modify(f); - let msg = msg.map(|msg| msg.modify(f)); - new_assert_eq(lhs, rhs, msg) - }) -} - -comptime fn modify_assign(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_assign().map(|expr| { - let (lhs, rhs) = expr; - let lhs = lhs.modify(f); - let rhs = rhs.modify(f); - new_assign(lhs, rhs) - }) -} - -comptime fn modify_binary_op(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_binary_op().map(|(lhs, op, rhs)| { - let lhs = lhs.modify(f); - let rhs = rhs.modify(f); - new_binary_op(lhs, op, rhs) - }) -} - -comptime fn modify_block(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_block().map(|exprs| { - let exprs = modify_expressions(exprs, f); - new_block(exprs) - }) -} - -comptime fn modify_cast(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_cast().map(|(expr, typ)| { - let expr = expr.modify(f); - new_cast(expr, typ) - }) -} - -comptime fn modify_comptime(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_comptime().map(|exprs| { - let exprs = exprs.map(|expr| expr.modify(f)); - new_comptime(exprs) - }) -} - -comptime fn modify_constructor(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_constructor().map(|(typ, fields)| { - let fields = fields.map(|(name, value)| (name, value.modify(f))); - new_constructor(typ, fields) - }) -} - -comptime fn modify_function_call( - expr: Expr, - f: fn[Env](Expr) -> Option, -) -> Option { - expr.as_function_call().map(|(function, arguments)| { - let function = function.modify(f); - let arguments = arguments.map(|arg| arg.modify(f)); - new_function_call(function, arguments) - }) -} - -comptime fn modify_if(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_if().map(|(condition, consequence, alternative)| { - let condition = condition.modify(f); - let consequence = consequence.modify(f); - let alternative = alternative.map(|alternative| alternative.modify(f)); - new_if(condition, consequence, alternative) - }) -} - -comptime fn modify_index(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_index().map(|(object, index)| { - let object = object.modify(f); - let index = index.modify(f); - new_index(object, index) - }) -} - -comptime fn modify_for(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_for().map(|(identifier, array, body)| { - let array = array.modify(f); - let body = body.modify(f); - new_for(identifier, array, body) - }) -} - -comptime fn modify_for_range(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_for_range().map(|(identifier, from, to, inclusive, body)| { - let from = from.modify(f); - let to = to.modify(f); - let body = body.modify(f); - new_for_range(identifier, from, to, inclusive, body) - }) -} - -comptime fn modify_lambda(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_lambda().map(|(params, return_type, body)| { - let params = params.map(|(name, typ)| (name.modify(f), typ)); - let body = body.modify(f); - new_lambda(params, return_type, body) - }) -} - -comptime fn modify_let(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_let().map(|(pattern, typ, expr)| { - let pattern = pattern.modify(f); - let expr = expr.modify(f); - new_let(pattern, typ, expr) - }) -} - -comptime fn modify_member_access( - expr: Expr, - f: fn[Env](Expr) -> Option, -) -> Option { - expr.as_member_access().map(|(object, name)| { - let object = object.modify(f); - new_member_access(object, name) - }) -} - -comptime fn modify_method_call(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_method_call().map(|(object, name, generics, arguments)| { - let object = object.modify(f); - let arguments = arguments.map(|arg| arg.modify(f)); - new_method_call(object, name, generics, arguments) - }) -} - -comptime fn modify_repeated_element_array( - expr: Expr, - f: fn[Env](Expr) -> Option, -) -> Option { - expr.as_repeated_element_array().map(|(expr, length)| { - let expr = expr.modify(f); - let length = length.modify(f); - new_repeated_element_array(expr, length) - }) -} - -comptime fn modify_repeated_element_vector( - expr: Expr, - f: fn[Env](Expr) -> Option, -) -> Option { - expr.as_repeated_element_vector().map(|(expr, length)| { - let expr = expr.modify(f); - let length = length.modify(f); - new_repeated_element_vector(expr, length) - }) -} - -comptime fn modify_vector(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_vector().map(|exprs| { - let exprs = modify_expressions(exprs, f); - new_vector(exprs) - }) -} - -comptime fn modify_tuple(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_tuple().map(|exprs| { - let exprs = modify_expressions(exprs, f); - new_tuple(exprs) - }) -} - -comptime fn modify_unary_op(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_unary_op().map(|(op, rhs)| { - let rhs = rhs.modify(f); - new_unary_op(op, rhs) - }) -} - -comptime fn modify_unsafe(expr: Expr, f: fn[Env](Expr) -> Option) -> Option { - expr.as_unsafe().map(|exprs| { - let exprs = exprs.map(|expr| expr.modify(f)); - new_unsafe(exprs) - }) -} - -comptime fn modify_expressions(exprs: [Expr], f: fn[Env](Expr) -> Option) -> [Expr] { - exprs.map(|expr| expr.modify(f)) -} - -comptime fn new_array(exprs: [Expr]) -> Expr { - let exprs = join_expressions(exprs, quote { , }); - quote { [$exprs]}.as_expr().unwrap() -} - -comptime fn new_assert(predicate: Expr, msg: Option) -> Expr { - if msg.is_some() { - let msg = msg.unwrap(); - quote { assert($predicate, $msg) }.as_expr().unwrap() - } else { - quote { assert($predicate) }.as_expr().unwrap() - } -} - -comptime fn new_assert_eq(lhs: Expr, rhs: Expr, msg: Option) -> Expr { - if msg.is_some() { - let msg = msg.unwrap(); - quote { assert_eq($lhs, $rhs, $msg) }.as_expr().unwrap() - } else { - quote { assert_eq($lhs, $rhs) }.as_expr().unwrap() - } -} - -comptime fn new_assign(lhs: Expr, rhs: Expr) -> Expr { - quote { $lhs = $rhs }.as_expr().unwrap() -} - -comptime fn new_binary_op(lhs: Expr, op: BinaryOp, rhs: Expr) -> Expr { - let op = op.quoted(); - quote { ($lhs) $op ($rhs) }.as_expr().unwrap() -} - -comptime fn new_block(exprs: [Expr]) -> Expr { - let exprs = join_expressions(exprs, quote { ; }); - quote { { $exprs }}.as_expr().unwrap() -} - -comptime fn new_cast(expr: Expr, typ: UnresolvedType) -> Expr { - quote { ($expr) as $typ }.as_expr().unwrap() -} - -comptime fn new_comptime(exprs: [Expr]) -> Expr { - let exprs = join_expressions(exprs, quote { ; }); - quote { comptime { $exprs }}.as_expr().unwrap() -} - -comptime fn new_constructor(typ: UnresolvedType, fields: [(Quoted, Expr)]) -> Expr { - let fields = fields.map(|(name, value)| quote { $name: $value }).join(quote { , }); - quote { $typ { $fields }}.as_expr().unwrap() -} - -comptime fn new_if(condition: Expr, consequence: Expr, alternative: Option) -> Expr { - if alternative.is_some() { - let alternative = alternative.unwrap(); - quote { if $condition { $consequence } else { $alternative }}.as_expr().unwrap() - } else { - quote { if $condition { $consequence } }.as_expr().unwrap() - } -} - -comptime fn new_for(identifier: Quoted, array: Expr, body: Expr) -> Expr { - quote { for $identifier in $array { $body } }.as_expr().unwrap() -} - -comptime fn new_for_range( - identifier: Quoted, - from: Expr, - to: Expr, - inclusive: bool, - body: Expr, -) -> Expr { - let dots = if inclusive { - quote { ..= } - } else { - quote { .. } - }; - quote { for $identifier in $from $dots $to { $body } }.as_expr().unwrap() -} - -comptime fn new_index(object: Expr, index: Expr) -> Expr { - quote { $object[$index] }.as_expr().unwrap() -} - -comptime fn new_lambda( - params: [(Expr, Option)], - return_type: Option, - body: Expr, -) -> Expr { - let params = params - .map(|(name, typ)| { - if typ.is_some() { - let typ = typ.unwrap(); - quote { $name: $typ } - } else { - quote { $name } - } - }) - .join(quote { , }); - - if return_type.is_some() { - let return_type = return_type.unwrap(); - quote { |$params| -> $return_type { $body } }.as_expr().unwrap() - } else { - quote { |$params| { $body } }.as_expr().unwrap() - } -} - -comptime fn new_let(pattern: Expr, typ: Option, expr: Expr) -> Expr { - if typ.is_some() { - let typ = typ.unwrap(); - quote { let $pattern : $typ = $expr; }.as_expr().unwrap() - } else { - quote { let $pattern = $expr; }.as_expr().unwrap() - } -} - -comptime fn new_member_access(object: Expr, name: Quoted) -> Expr { - quote { $object.$name }.as_expr().unwrap() -} - -comptime fn new_function_call(function: Expr, arguments: [Expr]) -> Expr { - let arguments = join_expressions(arguments, quote { , }); - - quote { $function($arguments) }.as_expr().unwrap() -} - -comptime fn new_method_call( - object: Expr, - name: Quoted, - generics: [UnresolvedType], - arguments: [Expr], -) -> Expr { - let arguments = join_expressions(arguments, quote { , }); - - if generics.len() == 0 { - quote { $object.$name($arguments) }.as_expr().unwrap() - } else { - let generics = generics.map(|generic| quote { $generic }).join(quote { , }); - quote { $object.$name::<$generics>($arguments) }.as_expr().unwrap() - } -} - -comptime fn new_repeated_element_array(expr: Expr, length: Expr) -> Expr { - quote { [$expr; $length] }.as_expr().unwrap() -} - -comptime fn new_repeated_element_vector(expr: Expr, length: Expr) -> Expr { - quote { @[$expr; $length] }.as_expr().unwrap() -} - -comptime fn new_vector(exprs: [Expr]) -> Expr { - let exprs = join_expressions(exprs, quote { , }); - quote { @[$exprs] }.as_expr().unwrap() -} - -comptime fn new_tuple(exprs: [Expr]) -> Expr { - let exprs = join_expressions(exprs, quote { , }); - quote { ($exprs) }.as_expr().unwrap() -} - -comptime fn new_unary_op(op: UnaryOp, rhs: Expr) -> Expr { - let op = op.quoted(); - quote { $op($rhs) }.as_expr().unwrap() -} - -comptime fn new_unsafe(exprs: [Expr]) -> Expr { - let exprs = join_expressions(exprs, quote { ; }); - quote { - // Safety: generated by macro - unsafe { $exprs } - } - .as_expr() - .unwrap() -} - -comptime fn join_expressions(exprs: [Expr], separator: Quoted) -> Quoted { - exprs.map(|expr| expr.quoted()).join(separator) -} diff --git a/stdlib/src/meta/function_def.nr b/stdlib/src/meta/function_def.nr index 9930b00d..39e1316f 100644 --- a/stdlib/src/meta/function_def.nr +++ b/stdlib/src/meta/function_def.nr @@ -1,9 +1,4 @@ impl FunctionDefinition { - #[builtin(function_def_add_attribute)] - // docs:start:add_attribute - pub comptime fn add_attribute(self, attribute: str) {} - // docs:end:add_attribute - #[builtin(function_def_as_typed_expr)] // docs:start:as_typed_expr pub comptime fn as_typed_expr(self) -> TypedExpr {} @@ -14,16 +9,36 @@ impl FunctionDefinition { pub comptime fn body(self) -> Expr {} // docs:end:body + #[builtin(function_def_disable)] + // docs:start:disable + pub comptime fn disable(self, error_message: CtString) {} + // docs:end:disable + #[builtin(function_def_has_named_attribute)] // docs:start:has_named_attribute pub comptime fn has_named_attribute(self, name: str) -> bool {} // docs:end:has_named_attribute + #[builtin(function_def_named_attribute_args)] + // docs:start:named_attribute_args + pub comptime fn named_attribute_args(self, name: str) -> [[Quoted]] {} + // docs:end:named_attribute_args + + #[builtin(function_def_has_builtin_attribute)] + // docs:start:has_builtin_attribute + pub comptime fn has_builtin_attribute(self, name: str) -> bool {} + // docs:end:has_builtin_attribute + #[builtin(function_def_is_unconstrained)] // docs:start:is_unconstrained pub comptime fn is_unconstrained(self) -> bool {} // docs:end:is_unconstrained + #[builtin(function_def_location)] + // docs:start:location + pub comptime fn location(self) -> Location {} + // docs:end:location + #[builtin(function_def_module)] // docs:start:module pub comptime fn module(self) -> Module {} @@ -44,34 +59,6 @@ impl FunctionDefinition { pub comptime fn return_type(self) -> Type {} // docs:end:return_type - #[builtin(function_def_set_body)] - // docs:start:set_body - pub comptime fn set_body(self, body: Expr) {} - // docs:end:set_body - - #[builtin(function_def_set_parameters)] - // docs:start:set_parameters - pub comptime fn set_parameters(self, parameters: [(Quoted, Type)]) {} - // docs:end:set_parameters - - #[builtin(function_def_set_return_type)] - // docs:start:set_return_type - pub comptime fn set_return_type(self, return_type: Type) {} - // docs:end:set_return_type - - #[builtin(function_def_set_return_public)] - // docs:start:set_return_public - pub comptime fn set_return_public(self, public: bool) {} - // docs:end:set_return_public - - #[builtin(function_def_set_return_data)] - pub comptime fn set_return_data(self) {} - - #[builtin(function_def_set_unconstrained)] - // docs:start:set_unconstrained - pub comptime fn set_unconstrained(self, value: bool) {} - // docs:end:set_unconstrained - #[builtin(function_def_visibility)] // docs:start:visibility pub comptime fn visibility(self) -> Quoted {} @@ -88,13 +75,9 @@ impl crate::hash::Hash for FunctionDefinition { } impl crate::cmp::Eq for FunctionDefinition { - comptime fn eq(self, other: Self) -> bool { - function_def_eq(self, other) - } + #[builtin(function_def_eq)] + comptime fn eq(self, other: Self) -> bool {} } -#[builtin(function_def_eq)] -comptime fn function_def_eq(_first: FunctionDefinition, _second: FunctionDefinition) -> bool {} - #[builtin(function_def_hash)] comptime fn function_def_hash(_function: FunctionDefinition) -> Field {} diff --git a/stdlib/src/meta/location.nr b/stdlib/src/meta/location.nr new file mode 100644 index 00000000..b3fb3387 --- /dev/null +++ b/stdlib/src/meta/location.nr @@ -0,0 +1,19 @@ +use crate::cmp::Eq; +use crate::hash::{Hash, Hasher}; + +impl Eq for Location { + #[builtin(location_eq)] + comptime fn eq(self, other: Self) -> bool {} +} + +impl Hash for Location { + comptime fn hash(self, state: &mut H) + where + H: Hasher, + { + state.write(location_hash(self)); + } +} + +#[builtin(location_hash)] +comptime fn location_hash(_loc: Location) -> Field {} diff --git a/stdlib/src/meta/mod.nr b/stdlib/src/meta/mod.nr index 05e7d2a2..997312b1 100644 --- a/stdlib/src/meta/mod.nr +++ b/stdlib/src/meta/mod.nr @@ -2,6 +2,7 @@ pub mod ctstring; pub mod expr; pub mod format_string; pub mod function_def; +pub mod location; pub mod module; pub mod op; pub mod trait_constraint; @@ -14,6 +15,7 @@ pub mod quoted; pub mod unresolved_type; use crate::default::Default; +use crate::option::Option; /// Calling unquote as a macro (via `unquote!(arg)`) will unquote /// its argument. Since this is the effect `!` already does, `unquote` @@ -30,6 +32,30 @@ pub comptime fn unquote(code: Quoted) -> Quoted { pub comptime fn type_of(x: T) -> Type {} // docs:end:type_of +/// Issues an error diagnostic at the given location with the given primary +/// message and an optional secondary message. Unlike a comptime panic, current +/// execution will continue allowing possibly multiple errors to be issued. +#[builtin(issue_error)] +// docs:start:error +pub comptime fn error( + _msg: fmtstr, + _secondary: Option>, + _location: Location, +) {} +// docs:end:error + +/// Issues a warning diagnostic at the given location with the given primary +/// message and an optional secondary message. Execution continues after this +/// function is called. +#[builtin(issue_warning)] +// docs:start:warn +pub comptime fn warn( + _msg: fmtstr, + _secondary: Option>, + _location: Location, +) {} +// docs:end:warn + // docs:start:derive_example // These are needed for the unconstrained hashmap we're using to store derive functions use crate::collections::umap::UHashMap; @@ -38,7 +64,7 @@ use crate::hash::poseidon2::Poseidon2Hasher; // A derive function is one that given a type definition can // create us a quoted trait impl from it. -pub type DeriveFunction = fn(TypeDefinition) -> Quoted; +pub comptime type DeriveFunction = fn(TypeDefinition) -> Quoted; // We'll keep a global HANDLERS map to keep track of the derive handler for each trait comptime mut global HANDLERS: UHashMap> = @@ -70,7 +96,7 @@ pub comptime fn derive(s: TypeDefinition, traits: [TraitDefinition]) -> Quoted { // docs:start:derive_via_signature pub comptime fn derive_via(t: TraitDefinition, f: DeriveFunction) { // docs:end:derive_via_signature - HANDLERS.insert(t, f); + assert(HANDLERS.insert(t, f), f"A derive_via function has already been registered for {t}"); } // docs:end:derive_via @@ -289,8 +315,8 @@ mod tests { #[test] fn concatenate_test() { comptime { - let result = concatenate(quote {foo}, quote {bar}); - assert_eq(result, quote {foobar}); + let result = concatenate(quote { foo }, quote { bar }); + assert_eq(result, quote { foobar }); let result = double_spaced(quote {foo bar 3}).as_quoted_str!(); assert_eq(result, "foo bar 3"); diff --git a/stdlib/src/meta/module.nr b/stdlib/src/meta/module.nr index b25d13f1..5dec2d7b 100644 --- a/stdlib/src/meta/module.nr +++ b/stdlib/src/meta/module.nr @@ -1,21 +1,31 @@ use crate::option::Option; impl Module { - #[builtin(module_add_item)] - // docs:start:add_item - pub comptime fn add_item(self, item: Quoted) {} - // docs:end:add_item - #[builtin(module_has_named_attribute)] // docs:start:has_named_attribute pub comptime fn has_named_attribute(self, name: str) -> bool {} // docs:end:has_named_attribute + #[builtin(module_named_attribute_args)] + // docs:start:named_attribute_args + pub comptime fn named_attribute_args(self, name: str) -> [[Quoted]] {} + // docs:end:named_attribute_args + + #[builtin(module_has_builtin_attribute)] + // docs:start:has_builtin_attribute + pub comptime fn has_builtin_attribute(self, name: str) -> bool {} + // docs:end:has_builtin_attribute + #[builtin(module_is_contract)] // docs:start:is_contract pub comptime fn is_contract(self) -> bool {} // docs:end:is_contract + #[builtin(module_location)] + // docs:start:location + pub comptime fn location(self) -> Location {} + // docs:end:location + #[builtin(module_functions)] // docs:start:functions pub comptime fn functions(self) -> [FunctionDefinition] {} @@ -52,13 +62,9 @@ impl crate::hash::Hash for Module { } impl crate::cmp::Eq for Module { - comptime fn eq(self, other: Self) -> bool { - module_eq(self, other) - } + #[builtin(module_eq)] + comptime fn eq(self, other: Self) -> bool {} } -#[builtin(module_eq)] -comptime fn module_eq(_first: Module, _second: Module) -> bool {} - #[builtin(module_hash)] comptime fn module_hash(_module: Module) -> Field {} diff --git a/stdlib/src/meta/op.nr b/stdlib/src/meta/op.nr index 7dc846e3..255cdaa7 100644 --- a/stdlib/src/meta/op.nr +++ b/stdlib/src/meta/op.nr @@ -222,3 +222,98 @@ impl BinaryOp { } } } + +mod tests { + use crate::meta::op::{BinaryOp, UnaryOp}; + + comptime fn unary_op(quoted: Quoted) -> UnaryOp { + let (op, _) = quoted.as_expr().unwrap().as_unary_op().unwrap(); + op + } + + comptime fn binary_op(quoted: Quoted) -> BinaryOp { + let (_, op, _) = quoted.as_expr().unwrap().as_binary_op().unwrap(); + op + } + + #[test] + fn unary_op_is_methods() { + comptime { + assert(unary_op(quote { -x }).is_minus()); + assert(unary_op(quote { !x }).is_not()); + assert(unary_op(quote { &mut x }).is_mutable_reference()); + assert(unary_op(quote { *x }).is_dereference()); + } + } + + #[test] + fn unary_op_quoted() { + comptime { + assert_eq(unary_op(quote { -x }).quoted(), quote { - }); + assert_eq(unary_op(quote { !x }).quoted(), quote { ! }); + assert_eq(unary_op(quote { &mut x }).quoted(), quote { &mut }); + assert_eq(unary_op(quote { *x }).quoted(), quote { * }); + } + } + + #[test] + fn unary_op_eq() { + comptime { + assert(unary_op(quote { -x }) == unary_op(quote { -x })); + assert(unary_op(quote { -x }) != unary_op(quote { !x })); + } + } + + #[test] + fn binary_op_is_methods() { + comptime { + assert(binary_op(quote { x + y }).is_add()); + assert(binary_op(quote { x - y }).is_subtract()); + assert(binary_op(quote { x * y }).is_multiply()); + assert(binary_op(quote { x / y }).is_divide()); + assert(binary_op(quote { x == y }).is_equal()); + assert(binary_op(quote { x != y }).is_not_equal()); + assert(binary_op(quote { x < y }).is_less_than()); + assert(binary_op(quote { x <= y }).is_less_than_or_equal()); + assert(binary_op(quote { x > y }).is_greater_than()); + assert(binary_op(quote { x >= y }).is_greater_than_or_equal()); + assert(binary_op(quote { x & y }).is_and()); + assert(binary_op(quote { x | y }).is_or()); + assert(binary_op(quote { x ^ y }).is_xor()); + assert(binary_op(quote { x >> y }).is_shift_right()); + assert(binary_op(quote { x << y }).is_shift_left()); + assert(binary_op(quote { x % y }).is_modulo()); + } + } + + #[test] + fn binary_op_quoted() { + comptime { + assert_eq(binary_op(quote { x + y }).quoted(), quote { + }); + assert_eq(binary_op(quote { x - y }).quoted(), quote { - }); + assert_eq(binary_op(quote { x * y }).quoted(), quote { * }); + assert_eq(binary_op(quote { x / y }).quoted(), quote { / }); + assert_eq(binary_op(quote { x == y }).quoted(), quote { == }); + assert_eq(binary_op(quote { x != y }).quoted(), quote { != }); + assert_eq(binary_op(quote { x < y }).quoted(), quote { < }); + assert_eq(binary_op(quote { x <= y }).quoted(), quote { <= }); + assert_eq(binary_op(quote { x > y }).quoted(), quote { > }); + assert_eq(binary_op(quote { x >= y }).quoted(), quote { >= }); + assert_eq(binary_op(quote { x & y }).quoted(), quote { & }); + assert_eq(binary_op(quote { x | y }).quoted(), quote { | }); + assert_eq(binary_op(quote { x ^ y }).quoted(), quote { ^ }); + assert_eq(binary_op(quote { x >> y }).quoted(), quote { >> }); + assert_eq(binary_op(quote { x << y }).quoted(), quote { << }); + assert_eq(binary_op(quote { x % y }).quoted(), quote { % }); + } + } + + #[test] + fn binary_op_eq() { + comptime { + assert(binary_op(quote { x + y }) == binary_op(quote { x + y })); + assert(binary_op(quote { x + y }) != binary_op(quote { x - y })); + } + } + +} diff --git a/stdlib/src/meta/quoted.nr b/stdlib/src/meta/quoted.nr index d67174d7..f7a978c9 100644 --- a/stdlib/src/meta/quoted.nr +++ b/stdlib/src/meta/quoted.nr @@ -22,6 +22,11 @@ impl Quoted { pub comptime fn as_type(self) -> Type {} // docs:end:as_type + #[builtin(quoted_location)] + // docs:start:location + pub comptime fn location(self) -> Option {} + // docs:end:location + #[builtin(quoted_tokens)] // docs:start:tokens pub comptime fn tokens(self) -> [Quoted] {} @@ -29,9 +34,8 @@ impl Quoted { } impl Eq for Quoted { - comptime fn eq(self, other: Quoted) -> bool { - quoted_eq(self, other) - } + #[builtin(quoted_eq)] + comptime fn eq(self, other: Quoted) -> bool {} } impl crate::hash::Hash for Quoted { @@ -43,8 +47,5 @@ impl crate::hash::Hash for Quoted { } } -#[builtin(quoted_eq)] -comptime fn quoted_eq(_first: Quoted, _second: Quoted) -> bool {} - #[builtin(quoted_hash)] comptime fn quoted_hash(_quoted: Quoted) -> Field {} diff --git a/stdlib/src/meta/trait_constraint.nr b/stdlib/src/meta/trait_constraint.nr index 2d9c6639..b4b2c8b4 100644 --- a/stdlib/src/meta/trait_constraint.nr +++ b/stdlib/src/meta/trait_constraint.nr @@ -2,9 +2,8 @@ use crate::cmp::Eq; use crate::hash::{Hash, Hasher}; impl Eq for TraitConstraint { - comptime fn eq(self, other: Self) -> bool { - constraint_eq(self, other) - } + #[builtin(trait_constraint_eq)] + comptime fn eq(self, other: Self) -> bool {} } impl Hash for TraitConstraint { @@ -16,8 +15,5 @@ impl Hash for TraitConstraint { } } -#[builtin(trait_constraint_eq)] -comptime fn constraint_eq(_first: TraitConstraint, _second: TraitConstraint) -> bool {} - #[builtin(trait_constraint_hash)] comptime fn constraint_hash(_constraint: TraitConstraint) -> Field {} diff --git a/stdlib/src/meta/trait_def.nr b/stdlib/src/meta/trait_def.nr index 75f74633..12927828 100644 --- a/stdlib/src/meta/trait_def.nr +++ b/stdlib/src/meta/trait_def.nr @@ -6,12 +6,16 @@ impl TraitDefinition { // docs:start:as_trait_constraint pub comptime fn as_trait_constraint(_self: Self) -> TraitConstraint {} // docs:end:as_trait_constraint + + #[builtin(trait_def_location)] + // docs:start:location + pub comptime fn location(self) -> Location {} + // docs:end:location } impl Eq for TraitDefinition { - comptime fn eq(self, other: Self) -> bool { - trait_def_eq(self, other) - } + #[builtin(trait_def_eq)] + comptime fn eq(self, other: Self) -> bool {} } impl Hash for TraitDefinition { @@ -23,8 +27,5 @@ impl Hash for TraitDefinition { } } -#[builtin(trait_def_eq)] -comptime fn trait_def_eq(_first: TraitDefinition, _second: TraitDefinition) -> bool {} - #[builtin(trait_def_hash)] comptime fn trait_def_hash(_def: TraitDefinition) -> Field {} diff --git a/stdlib/src/meta/typ.nr b/stdlib/src/meta/typ.nr index c8e12dd0..3bfdfa56 100644 --- a/stdlib/src/meta/typ.nr +++ b/stdlib/src/meta/typ.nr @@ -103,11 +103,6 @@ impl Type { pub comptime fn as_vector(self) -> Option {} // docs:end:as_vector - /// If this is a vector type, return the element type of the vector. - #[builtin(type_as_vector)] - #[deprecated("This method has been renamed to `as_vector`")] - pub comptime fn as_slice(self) -> Option {} - /// If this is a `str` type, returns the length `N` as a type. #[builtin(type_as_str)] // docs:start:as_str @@ -200,9 +195,8 @@ impl Eq for Type { /// Note that this is syntactic equality, this is not the same as whether two types will type check /// to be the same type. Unless type inference or generics are being used however, users should not /// typically have to worry about this distinction. - comptime fn eq(self, other: Self) -> bool { - type_eq(self, other) - } + #[builtin(type_eq)] + comptime fn eq(self, other: Self) -> bool {} } impl crate::hash::Hash for Type { @@ -214,8 +208,5 @@ impl crate::hash::Hash for Type { } } -#[builtin(type_eq)] -comptime fn type_eq(_first: Type, _second: Type) -> bool {} - #[builtin(type_hash)] comptime fn type_hash(_typ: Type) -> Field {} diff --git a/stdlib/src/meta/type_def.nr b/stdlib/src/meta/type_def.nr index 7f4faa5f..675d24be 100644 --- a/stdlib/src/meta/type_def.nr +++ b/stdlib/src/meta/type_def.nr @@ -1,15 +1,10 @@ use crate::option::Option; impl TypeDefinition { - #[builtin(type_def_add_attribute)] - // docs:start:add_attribute - pub comptime fn add_attribute(self, attribute: str) {} - // docs:end:add_attribute - - #[builtin(type_def_add_generic)] - // docs:start:add_generic - pub comptime fn add_generic(self, generic_name: str) -> Type {} - // docs:end:add_generic + #[builtin(type_def_add_abi)] + // docs:start:add_abi + pub comptime fn add_abi(self, abi_argument: CtString) {} + // docs:end:add_abi /// Return a syntactic version of this type definition as a type. /// For example, `type Foo { ... })` would return `Foo` when called with this method. @@ -34,6 +29,20 @@ impl TypeDefinition { pub comptime fn has_named_attribute(self, name: str) -> bool {} // docs:end:has_named_attribute + #[builtin(type_def_named_attribute_args)] + // docs:start:named_attribute_args + pub comptime fn named_attribute_args(self, name: str) -> [[Quoted]] {} + // docs:end:named_attribute_args + + #[builtin(type_def_has_builtin_attribute)] + // docs:start:has_builtin_attribute + pub comptime fn has_builtin_attribute(self, name: str) -> bool {} + // docs:end:has_builtin_attribute + #[builtin(type_def_location)] + // docs:start:location + pub comptime fn location(self) -> Location {} + // docs:end:location + /// Return (type, option) pairs of each generic in this type definition. /// If a generic is numeric, the second element of the pair will contain the numeric type. #[builtin(type_def_generics)] @@ -67,15 +76,6 @@ impl TypeDefinition { // docs:start:name pub comptime fn name(self) -> Quoted {} // docs:end:name - - /// Sets the fields of this type to the given fields vector. - /// All existing fields of the type will be overridden with the given fields. - /// Each element of the fields vector corresponds to the name and type of a field. - /// Each name is expected to be a single identifier. - #[builtin(type_def_set_fields)] - // docs:start:set_fields - pub comptime fn set_fields(self, new_fields: [(Quoted, Type, Quoted)]) {} - // docs:end:set_fields } impl crate::hash::Hash for TypeDefinition { @@ -88,13 +88,9 @@ impl crate::hash::Hash for TypeDefinition { } impl crate::cmp::Eq for TypeDefinition { - comptime fn eq(self, other: Self) -> bool { - type_def_eq(self, other) - } + #[builtin(type_def_eq)] + comptime fn eq(self, other: Self) -> bool {} } -#[builtin(type_def_eq)] -comptime fn type_def_eq(_first: TypeDefinition, _second: TypeDefinition) -> bool {} - #[builtin(type_def_hash)] comptime fn type_def_hash(_type: TypeDefinition) -> Field {} diff --git a/stdlib/src/meta/typed_expr.nr b/stdlib/src/meta/typed_expr.nr index c69139ea..7d2757d3 100644 --- a/stdlib/src/meta/typed_expr.nr +++ b/stdlib/src/meta/typed_expr.nr @@ -13,4 +13,10 @@ impl TypedExpr { // docs:start:get_type pub comptime fn get_type(self) -> Option {} // docs:end:get_type + + /// Returns the source location of this expression. + #[builtin(typed_expr_location)] + // docs:start:location + pub comptime fn location(self) -> Location {} + // docs:end:location } diff --git a/stdlib/src/meta/unresolved_type.nr b/stdlib/src/meta/unresolved_type.nr index 32e8aa42..c95cbfe8 100644 --- a/stdlib/src/meta/unresolved_type.nr +++ b/stdlib/src/meta/unresolved_type.nr @@ -1,40 +1,3 @@ //! Contains methods on the built-in `UnresolvedType` type for the syntax of types. -use crate::option::Option; - -impl UnresolvedType { - /// If this is a mutable reference type `&mut T`, returns the mutable type `T`. - #[builtin(unresolved_type_as_mutable_reference)] - // docs:start:as_mutable_reference - pub comptime fn as_mutable_reference(self) -> Option {} - // docs:end:as_mutable_reference - - /// If this is a vector `[T].as_vector()`, returns the element type `T`. - #[builtin(unresolved_type_as_vector)] - // docs:start:as_vector - pub comptime fn as_vector(self) -> Option {} - // docs:end:as_vector - - /// If this is a vector `[T].as_vector()`, returns the element type `T`. - #[builtin(unresolved_type_as_vector)] - #[deprecated("This method has been renamed to `as_vector`")] - pub comptime fn as_slice(self) -> Option {} - - /// Returns `true` if this type is `bool`. - #[builtin(unresolved_type_is_bool)] - // docs:start:is_bool - pub comptime fn is_bool(self) -> bool {} - // docs:end:is_bool - - /// Returns true if this type refers to the `Field` type. - #[builtin(unresolved_type_is_field)] - // docs:start:is_field - pub comptime fn is_field(self) -> bool {} - // docs:end:is_field - - /// Returns true if this type is the unit `()` type. - #[builtin(unresolved_type_is_unit)] - // docs:start:is_unit - pub comptime fn is_unit(self) -> bool {} - // docs:end:is_unit -} +impl UnresolvedType {} diff --git a/stdlib/src/ops/arith.nr b/stdlib/src/ops/arith.nr index 9a32f8bf..c63aef5b 100644 --- a/stdlib/src/ops/arith.nr +++ b/stdlib/src/ops/arith.nr @@ -37,12 +37,6 @@ impl Add for u8 { self + other } } -impl Add for u1 { - fn add(self, other: u1) -> u1 { - self + other - } -} - impl Add for i8 { fn add(self, other: i8) -> i8 { self + other @@ -101,12 +95,6 @@ impl Sub for u8 { self - other } } -impl Sub for u1 { - fn sub(self, other: u1) -> u1 { - self - other - } -} - impl Sub for i8 { fn sub(self, other: i8) -> i8 { self - other @@ -165,12 +153,6 @@ impl Mul for u8 { self * other } } -impl Mul for u1 { - fn mul(self, other: u1) -> u1 { - self * other - } -} - impl Mul for i8 { fn mul(self, other: i8) -> i8 { self * other @@ -229,12 +211,6 @@ impl Div for u8 { self / other } } -impl Div for u1 { - fn div(self, other: u1) -> u1 { - self / other - } -} - impl Div for i8 { fn div(self, other: i8) -> i8 { self / other @@ -287,12 +263,6 @@ impl Rem for u8 { self % other } } -impl Rem for u1 { - fn rem(self, other: u1) -> u1 { - self % other - } -} - impl Rem for i8 { fn rem(self, other: i8) -> i8 { self % other @@ -355,12 +325,6 @@ pub trait WrappingAdd { } // docs:end:wrapping-add-trait -impl WrappingAdd for u1 { - fn wrapping_add(self: u1, y: u1) -> u1 { - self ^ y - } -} - impl WrappingAdd for u8 { fn wrapping_add(self: u8, y: u8) -> u8 { wrapping_add_hlp(self, y) @@ -430,12 +394,6 @@ pub trait WrappingSub { } // docs:start:wrapping-sub-trait -impl WrappingSub for u1 { - fn wrapping_sub(self: u1, y: u1) -> u1 { - self ^ y - } -} - impl WrappingSub for u8 { fn wrapping_sub(self: u8, y: u8) -> u8 { wrapping_sub_hlp(self, y) as u8 @@ -502,12 +460,6 @@ pub trait WrappingMul { } // docs:start:wrapping-mul-trait -impl WrappingMul for u1 { - fn wrapping_mul(self: u1, y: u1) -> u1 { - self & y - } -} - impl WrappingMul for u8 { fn wrapping_mul(self: u8, y: u8) -> u8 { wrapping_mul_hlp(self, y) @@ -653,8 +605,8 @@ mod tests { assert_eq(10u8.div(3u8), 3u8); assert_eq(15.div(3), 5); - // rem - assert_eq(17.rem(5), 2); + // rem (Field doesn't implement Rem) + assert_eq(17u64.rem(5u64), 2u64); assert_eq(10u8.rem(3u8), 1u8); // neg @@ -674,51 +626,250 @@ mod tests { assert_eq(42.div(42), 1); assert_eq(1.div(1), 1); - // test remainder - assert_eq(42.rem(42), 0); - assert_eq(0.rem(42), 0); - assert_eq(1.rem(42), 1); + // test remainder (Field doesn't implement Rem) + assert_eq(42u32.rem(42u32), 0u32); + assert_eq(0u16.rem(42u16), 0u16); + assert_eq(1u64.rem(42u64), 1u64); } - #[test(should_fail)] - fn test_u8_sub_overflow_failure() { - let _ = 0u8.sub(1u8); - } + // Per-operator overflow corners. The signed `iN::MIN` corners pin down + // compiler-side overflow detection on the trait dispatch path: the + // trait impls are one-line delegations to the built-in operators and + // rely entirely on the compiler's lowering to emit the two's-complement + // overflow constraints. These tests trip CI on any future SSA pass + // that drops one of those constraints. + // + // Each case pins the exact runtime message via `should_fail_with`, so a + // regression that starts failing for the *wrong* reason (a divide by + // zero, or a panic in unrelated code) is caught too, rather than being + // accepted as "it failed somehow". The matcher is a case-insensitive + // substring, so the same string works under both ACIR and Brillig even + // though Brillig capitalizes the divide/remainder messages. + + mod add { + use crate::ops::arith::Add; + + // `MAX + 1` is one past the largest representable value, so the + // range check on the sum rejects it. For unsigned this is a wrap + // past `2^bits - 1`; for signed it steps out of `[MIN, MAX]`. + + #[test(should_fail_with = "attempt to add with overflow")] + fn u8_overflow() { + let _ = 255u8.add(1u8); + } - #[test(should_fail)] - fn test_u8_add_overflow_failure() { - let _ = 255u8.add(1u8); - } + #[test(should_fail_with = "attempt to add with overflow")] + fn u16_overflow() { + let _ = 65535u16.add(1u16); + } + + #[test(should_fail_with = "attempt to add with overflow")] + fn i8_overflow() { + let _ = 127i8.add(1i8); + } + + #[test(should_fail_with = "attempt to add with overflow")] + fn i16_overflow() { + let _ = 32767i16.add(1i16); + } + + #[test(should_fail_with = "attempt to add with overflow")] + fn i32_overflow() { + let _ = 2147483647i32.add(1i32); + } - #[test(should_fail)] - fn test_u8_mul_overflow_failure() { - let _ = 255u8.mul(2u8); + #[test(should_fail_with = "attempt to add with overflow")] + fn i64_overflow() { + let _ = 9223372036854775807i64.add(1i64); + } } - #[test(should_fail)] - fn test_u16_sub_overflow_failure() { - let _ = 0u16.sub(1u16); + mod sub { + use crate::ops::arith::Sub; + + // Subtraction underflows past the type's minimum: `0 - 1` for + // unsigned (a borrow below zero), and `MIN - 1` for signed (one step + // below the most-negative value). + + #[test(should_fail_with = "attempt to subtract with overflow")] + fn u8_overflow() { + let _ = 0u8.sub(1u8); + } + + #[test(should_fail_with = "attempt to subtract with overflow")] + fn u16_overflow() { + let _ = 0u16.sub(1u16); + } + + #[test(should_fail_with = "attempt to subtract with overflow")] + fn i8_overflow() { + let val: i8 = -128; + let _ = val.sub(1i8); + } + + #[test(should_fail_with = "attempt to subtract with overflow")] + fn i16_overflow() { + let val: i16 = -32768; + let _ = val.sub(1i16); + } + + #[test(should_fail_with = "attempt to subtract with overflow")] + fn i32_overflow() { + let val: i32 = -2147483648; + let _ = val.sub(1i32); + } + + #[test(should_fail_with = "attempt to subtract with overflow")] + fn i64_overflow() { + let val: i64 = -9223372036854775808; + let _ = val.sub(1i64); + } } - #[test(should_fail)] - fn test_u16_add_overflow_failure() { - let _ = 65535u16.add(1u16); + mod mul { + use crate::ops::arith::Mul; + + // Unsigned `MAX * 2` exceeds the maximum. The signed corner is + // `MIN * -1`: the true product is `-MIN == 2^(bits-1)`, exactly one + // past the signed maximum `2^(bits-1) - 1`, so it is unrepresentable. + // This is the same range asymmetry that makes negating MIN overflow. + + #[test(should_fail_with = "attempt to multiply with overflow")] + fn u8_overflow() { + let _ = 255u8.mul(2u8); + } + + #[test(should_fail_with = "attempt to multiply with overflow")] + fn u16_overflow() { + let _ = 65535u16.mul(2u16); + } + + #[test(should_fail_with = "attempt to multiply with overflow")] + fn i8_min_times_neg_one_overflow() { + let val: i8 = -128; + let _ = val.mul(-1i8); + } + + #[test(should_fail_with = "attempt to multiply with overflow")] + fn i16_min_times_neg_one_overflow() { + let val: i16 = -32768; + let _ = val.mul(-1i16); + } + + #[test(should_fail_with = "attempt to multiply with overflow")] + fn i32_min_times_neg_one_overflow() { + let val: i32 = -2147483648; + let _ = val.mul(-1i32); + } + + #[test(should_fail_with = "attempt to multiply with overflow")] + fn i64_min_times_neg_one_overflow() { + let val: i64 = -9223372036854775808; + let _ = val.mul(-1i64); + } } - #[test(should_fail)] - fn test_u16_mul_overflow_failure() { - let _ = 65535u16.mul(2u16); + mod div { + use crate::ops::arith::Div; + + // `MIN / -1` is the only division that overflows: the quotient is + // `-MIN == 2^(bits-1)`, one past the signed maximum. (Division by + // zero is a distinct error and is not what these cases exercise.) + + #[test(should_fail_with = "attempt to divide with overflow")] + fn i8_min_by_neg_one_overflow() { + let val: i8 = -128; + let _ = val.div(-1i8); + } + + #[test(should_fail_with = "attempt to divide with overflow")] + fn i16_min_by_neg_one_overflow() { + let val: i16 = -32768; + let _ = val.div(-1i16); + } + + #[test(should_fail_with = "attempt to divide with overflow")] + fn i32_min_by_neg_one_overflow() { + let val: i32 = -2147483648; + let _ = val.div(-1i32); + } + + #[test(should_fail_with = "attempt to divide with overflow")] + fn i64_min_by_neg_one_overflow() { + let val: i64 = -9223372036854775808; + let _ = val.div(-1i64); + } } - #[test(should_fail)] - fn test_signed_sub_overflow_failure() { - let val: i8 = -128; - let _ = val.sub(1i8); + mod rem { + use crate::ops::arith::Rem; + + // `MIN % -1` is mathematically 0, but it is computed via the same + // `MIN / -1` division that overflows, so the operation is rejected + // rather than silently yielding 0. This matches Rust, where + // `iN::MIN % -1` also overflows. + + #[test(should_fail_with = "attempt to calculate the remainder with overflow")] + fn i8_min_by_neg_one_overflow() { + let val: i8 = -128; + let _ = val.rem(-1i8); + } + + #[test(should_fail_with = "attempt to calculate the remainder with overflow")] + fn i16_min_by_neg_one_overflow() { + let val: i16 = -32768; + let _ = val.rem(-1i16); + } + + #[test(should_fail_with = "attempt to calculate the remainder with overflow")] + fn i32_min_by_neg_one_overflow() { + let val: i32 = -2147483648; + let _ = val.rem(-1i32); + } + + #[test(should_fail_with = "attempt to calculate the remainder with overflow")] + fn i64_min_by_neg_one_overflow() { + let val: i64 = -9223372036854775808; + let _ = val.rem(-1i64); + } } - #[test(should_fail)] - fn test_signed_overflow_failure() { - let _ = 127i8.add(1i8); + mod neg { + use crate::ops::arith::Neg; + + // Negating `MIN` overflows because the two's-complement range is + // asymmetric: `-MIN == 2^(bits-1)` has no representable positive + // counterpart (the maximum is only `2^(bits-1) - 1`). MIN is the + // unique value with this property, so it is the only negation that + // fails. The wording of the failure depends on the execution path: + // the comptime interpreter reports "attempt to negate with + // overflow", while ACIR/Brillig lower unary `-` to `0 - x` and so + // report "attempt to subtract with overflow". Both share + // "with overflow", which is what these cases assert on. + + #[test(should_fail_with = "with overflow")] + fn i8_min_overflow() { + let val: i8 = -128; + let _ = val.neg(); + } + + #[test(should_fail_with = "with overflow")] + fn i16_min_overflow() { + let val: i16 = -32768; + let _ = val.neg(); + } + + #[test(should_fail_with = "with overflow")] + fn i32_min_overflow() { + let val: i32 = -2147483648; + let _ = val.neg(); + } + + #[test(should_fail_with = "with overflow")] + fn i64_min_overflow() { + let val: i64 = -9223372036854775808; + let _ = val.neg(); + } } #[test] @@ -869,27 +1020,6 @@ mod tests { assert_eq(neg_two.wrapping_mul(two), neg_four); } - #[test] - fn test_u1_behavior() { - // u1 wrapping add is XOR - assert_eq(0u1.wrapping_add(0u1), 0u1); - assert_eq(0u1.wrapping_add(1u1), 1u1); - assert_eq(1u1.wrapping_add(0u1), 1u1); - assert_eq(1u1.wrapping_add(1u1), 0u1); - - // u1 wrapping sub is XOR - assert_eq(0u1.wrapping_sub(0u1), 0u1); - assert_eq(0u1.wrapping_sub(1u1), 1u1); - assert_eq(1u1.wrapping_sub(0u1), 1u1); - assert_eq(1u1.wrapping_sub(1u1), 0u1); - - // u1 wrapping mul is AND - assert_eq(0u1.wrapping_mul(0u1), 0u1); - assert_eq(0u1.wrapping_mul(1u1), 0u1); - assert_eq(1u1.wrapping_mul(0u1), 0u1); - assert_eq(1u1.wrapping_mul(1u1), 1u1); - } - // test wrapping operations is the same as the regular operations #[test] fn test_wrapping_vs_regular() { @@ -968,4 +1098,132 @@ mod tests { assert_eq(hi5, 0xffffffffffffffffu64); } } + + mod traits { + use crate::ops::arith::{ + Add, Div, Mul, Neg, Rem, Sub, WrappingAdd, WrappingMul, WrappingSub, + }; + + #[test] + fn add() { + assert_eq(1_u8.add(2), 3); + assert_eq(1_u16.add(2), 3); + assert_eq(1_u32.add(2), 3); + assert_eq(1_u64.add(2), 3); + assert_eq(1_u128.add(2), 3); + assert_eq(1_i8.add(2), 3); + assert_eq(1_i16.add(2), 3); + assert_eq(1_i32.add(2), 3); + assert_eq(1_i64.add(2), 3); + assert_eq(1_Field.add(2), 3); + } + + #[test] + fn sub() { + assert_eq(3_u8.sub(2), 1); + assert_eq(3_u16.sub(2), 1); + assert_eq(3_u32.sub(2), 1); + assert_eq(3_u64.sub(2), 1); + assert_eq(3_u128.sub(2), 1); + assert_eq(3_i8.sub(2), 1); + assert_eq(3_i16.sub(2), 1); + assert_eq(3_i32.sub(2), 1); + assert_eq(3_i64.sub(2), 1); + assert_eq(3_Field.sub(2), 1); + } + + #[test] + fn mul() { + assert_eq(3_u8.mul(2), 6); + assert_eq(3_u16.mul(2), 6); + assert_eq(3_u32.mul(2), 6); + assert_eq(3_u64.mul(2), 6); + assert_eq(3_u128.mul(2), 6); + assert_eq(3_i8.mul(2), 6); + assert_eq(3_i16.mul(2), 6); + assert_eq(3_i32.mul(2), 6); + assert_eq(3_i64.mul(2), 6); + assert_eq(3_Field.mul(2), 6); + } + + #[test] + fn div() { + assert_eq(6_u8.div(2), 3); + assert_eq(6_u16.div(2), 3); + assert_eq(6_u32.div(2), 3); + assert_eq(6_u64.div(2), 3); + assert_eq(6_u128.div(2), 3); + assert_eq(6_i8.div(2), 3); + assert_eq(6_i16.div(2), 3); + assert_eq(6_i32.div(2), 3); + assert_eq(6_i64.div(2), 3); + assert_eq(6_Field.div(2), 3); + } + + #[test] + fn rem() { + assert_eq(3_u8.rem(2), 1); + assert_eq(3_u16.rem(2), 1); + assert_eq(3_u32.rem(2), 1); + assert_eq(3_u64.rem(2), 1); + assert_eq(3_u128.rem(2), 1); + assert_eq(3_i8.rem(2), 1); + assert_eq(3_i16.rem(2), 1); + assert_eq(3_i32.rem(2), 1); + assert_eq(3_i64.rem(2), 1); + } + + #[test] + fn neg() { + assert_eq(3_i8.neg(), -3); + assert_eq(3_i16.neg(), -3); + assert_eq(3_i32.neg(), -3); + assert_eq(3_i64.neg(), -3); + } + + #[test] + fn wrapping_add() { + assert_eq(255_u8.wrapping_add(2), 1); + assert_eq(65535_u16.wrapping_add(2), 1); + assert_eq(4294967295_u32.wrapping_add(2), 1); + assert_eq(18446744073709551615_u64.wrapping_add(2), 1); + assert_eq(340282366920938463463374607431768211455_u128.wrapping_add(2), 1); + assert_eq(127_i8.wrapping_add(2), -127); + assert_eq(32767_i16.wrapping_add(2), -32767); + assert_eq(2147483647_i32.wrapping_add(2), -2147483647); + assert_eq(9223372036854775807_i64.wrapping_add(2), -9223372036854775807); + assert_eq(1_Field.wrapping_add(2), 3); + } + + #[test] + fn wrapping_sub() { + assert_eq(0_u8.wrapping_sub(1), 255); + assert_eq(0_u16.wrapping_sub(1), 65535); + assert_eq(0_u32.wrapping_sub(1), 4294967295); + assert_eq(0_u64.wrapping_sub(1), 18446744073709551615); + assert_eq(0_u128.wrapping_sub(1), 340282366920938463463374607431768211455); + assert_eq((-128_i8).wrapping_sub(1), 127); + assert_eq((-32768_i16).wrapping_sub(1), 32767); + assert_eq((-2147483648_i32).wrapping_sub(1), 2147483647); + assert_eq((-9223372036854775808_i64).wrapping_sub(1), 9223372036854775807); + assert_eq(3_Field.wrapping_sub(1), 2); + } + + #[test] + fn wrapping_mul() { + assert_eq(255_u8.wrapping_mul(2), 254); + assert_eq(65535_u16.wrapping_mul(2), 65534); + assert_eq(4294967295_u32.wrapping_mul(2), 4294967294); + assert_eq(18446744073709551615_u64.wrapping_mul(2), 18446744073709551614); + assert_eq( + 340282366920938463463374607431768211455_u128.wrapping_mul(2), + 340282366920938463463374607431768211454, + ); + assert_eq(127_i8.wrapping_mul(2), -2); + assert_eq(32767_i16.wrapping_mul(2), -2); + assert_eq(2147483647_i32.wrapping_mul(2), -2); + assert_eq(9223372036854775807_i64.wrapping_mul(2), -2); + assert_eq(2_Field.wrapping_mul(3), 6); + } + } } diff --git a/stdlib/src/ops/bit.nr b/stdlib/src/ops/bit.nr index d242a375..93cd6ecb 100644 --- a/stdlib/src/ops/bit.nr +++ b/stdlib/src/ops/bit.nr @@ -36,12 +36,6 @@ impl Not for u8 { !self } } -impl Not for u1 { - fn not(self) -> u1 { - !self - } -} - impl Not for i8 { fn not(self) -> i8 { !self @@ -101,12 +95,6 @@ impl BitOr for u8 { self | other } } -impl BitOr for u1 { - fn bitor(self, other: u1) -> u1 { - self | other - } -} - impl BitOr for i8 { fn bitor(self, other: i8) -> i8 { self | other @@ -165,12 +153,6 @@ impl BitAnd for u8 { self & other } } -impl BitAnd for u1 { - fn bitand(self, other: u1) -> u1 { - self & other - } -} - impl BitAnd for i8 { fn bitand(self, other: i8) -> i8 { self & other @@ -229,12 +211,6 @@ impl BitXor for u8 { self ^ other } } -impl BitXor for u1 { - fn bitxor(self, other: u1) -> u1 { - self ^ other - } -} - impl BitXor for i8 { fn bitxor(self, other: i8) -> i8 { self ^ other @@ -287,12 +263,6 @@ impl Shl for u8 { self << other } } -impl Shl for u1 { - fn shl(self, other: u1) -> u1 { - self << other - } -} - impl Shl for i8 { fn shl(self, other: i8) -> i8 { self << other @@ -345,12 +315,6 @@ impl Shr for u8 { self >> other } } -impl Shr for u1 { - fn shr(self, other: u1) -> u1 { - self >> other - } -} - impl Shr for i8 { fn shr(self, other: i8) -> i8 { self >> other @@ -371,3 +335,90 @@ impl Shr for i64 { self >> other } } + +mod tests { + use crate::ops::bit::{BitAnd, BitOr, BitXor, Not, Shl, Shr}; + + #[test] + fn not() { + assert_eq(false.not(), true); + assert_eq(true.not(), false); + assert_eq(0_u8.not(), 255); + assert_eq(0_u16.not(), 65535); + assert_eq(0_u32.not(), 4294967295); + assert_eq(0_u64.not(), 18446744073709551615); + assert_eq(0_u128.not(), 340282366920938463463374607431768211455); + assert_eq(0_i8.not(), -1); + assert_eq(0_i16.not(), -1); + assert_eq(0_i32.not(), -1); + assert_eq(0_i64.not(), -1); + } + + #[test] + fn bitor() { + assert_eq(true.bitor(false), true); + assert_eq(1_u8.bitor(2), 3); + assert_eq(1_u16.bitor(2), 3); + assert_eq(1_u32.bitor(2), 3); + assert_eq(1_u64.bitor(2), 3); + assert_eq(1_u128.bitor(2), 3); + assert_eq(1_i8.bitor(2), 3); + assert_eq(1_i16.bitor(2), 3); + assert_eq(1_i32.bitor(2), 3); + assert_eq(1_i64.bitor(2), 3); + } + + #[test] + fn bitand() { + assert_eq(true.bitand(false), false); + assert_eq(3_u8.bitand(5), 1); + assert_eq(3_u16.bitand(5), 1); + assert_eq(3_u32.bitand(5), 1); + assert_eq(3_u64.bitand(5), 1); + assert_eq(3_u128.bitand(5), 1); + assert_eq(3_i8.bitand(5), 1); + assert_eq(3_i16.bitand(5), 1); + assert_eq(3_i32.bitand(5), 1); + assert_eq(3_i64.bitand(5), 1); + } + + #[test] + fn bitxor() { + assert_eq(true.bitxor(false), true); + assert_eq(3_u8.bitxor(5), 6); + assert_eq(3_u16.bitxor(5), 6); + assert_eq(3_u32.bitxor(5), 6); + assert_eq(3_u64.bitxor(5), 6); + assert_eq(3_u128.bitxor(5), 6); + assert_eq(3_i8.bitxor(5), 6); + assert_eq(3_i16.bitxor(5), 6); + assert_eq(3_i32.bitxor(5), 6); + assert_eq(3_i64.bitxor(5), 6); + } + + #[test] + fn shl() { + assert_eq(1_u8.shl(1), 2); + assert_eq(1_u16.shl(1), 2); + assert_eq(1_u32.shl(1), 2); + assert_eq(1_u64.shl(1), 2); + assert_eq(1_u128.shl(1), 2); + assert_eq(1_i8.shl(1), 2); + assert_eq(1_i16.shl(1), 2); + assert_eq(1_i32.shl(1), 2); + assert_eq(1_i64.shl(1), 2); + } + + #[test] + fn shr() { + assert_eq(4_u8.shr(1), 2); + assert_eq(4_u16.shr(1), 2); + assert_eq(4_u32.shr(1), 2); + assert_eq(4_u64.shr(1), 2); + assert_eq(4_u128.shr(1), 2); + assert_eq(4_i8.shr(1), 2); + assert_eq(4_i16.shr(1), 2); + assert_eq(4_i32.shr(1), 2); + assert_eq(4_i64.shr(1), 2); + } +} diff --git a/stdlib/src/option.nr b/stdlib/src/option.nr index 0a62e412..d03ba63c 100644 --- a/stdlib/src/option.nr +++ b/stdlib/src/option.nr @@ -2,6 +2,8 @@ use crate::cmp::{Eq, Ord, Ordering}; use crate::default::Default; use crate::hash::{Hash, Hasher}; +/// Represents a value of type T or its absence. +/// Use `Option::some(value)` to construct a value or `Option::none()` to record the absence of one. pub struct Option { _is_some: bool, _value: T, @@ -19,12 +21,12 @@ impl Option { } /// True if this Option is None - pub fn is_none(self) -> bool { + pub fn is_none(&self) -> bool { !self._is_some } /// True if this Option is Some - pub fn is_some(self) -> bool { + pub fn is_some(&self) -> bool { self._is_some } @@ -230,3 +232,150 @@ where } } } + +mod tests { + use crate::cmp::Ord; + use crate::cmp::Ordering; + use crate::default::Default as _; + use super::Option; + + #[test] + fn some_and_none() { + assert(Option::::none().is_none()); + assert(!Option::::none().is_some()); + assert(Option::some(1).is_some()); + assert(!Option::some(1).is_none()); + } + + #[test] + fn unwrap_succeeds() { + assert_eq(Option::some(1).unwrap(), 1); + } + + #[test(should_fail)] + fn unwrap_fails() { + let _ = Option::::none().unwrap(); + } + + #[test] + fn unwrap_or() { + assert_eq(Option::some(1).unwrap_or(2), 1); + assert_eq(Option::none().unwrap_or(2), 2); + } + + #[test] + fn unwrap_or_else() { + assert_eq(Option::some(1).unwrap_or_else(|| 2), 1); + assert_eq(Option::none().unwrap_or_else(|| 2), 2); + } + + #[test] + fn expect_succeeds() { + assert_eq(Option::some(1).expect(f"Should be there"), 1); + } + + #[test(should_fail_with = "Should be there")] + fn expect_fails() { + let _ = Option::::none().expect(f"Should be there"); + } + + #[test] + fn map() { + assert(Option::::none().map(|x| x + 1).is_none()); + assert_eq(Option::some(1).map(|x| x + 1), Option::some(2)); + } + + #[test] + fn map_or() { + assert_eq(Option::::none().map_or(0, |x| x + 1), 0); + assert_eq(Option::some(1).map_or(0, |x| x + 1), 2); + } + + #[test] + fn map_or_else() { + assert_eq(Option::::none().map_or_else(|| 0, |x| x + 1), 0); + assert_eq(Option::some(1).map_or_else(|| 0, |x| x + 1), 2); + } + + #[test] + fn and() { + assert_eq(Option::::none().and(Option::none()), Option::none()); + assert_eq(Option::::none().and(Option::some(1)), Option::none()); + assert_eq(Option::some(1).and(Option::some(2)), Option::some(2)); + assert_eq(Option::some(1).and(Option::none()), Option::none()); + } + + #[test] + fn and_then() { + assert_eq(Option::::none().and_then(|_| Option::::none()), Option::none()); + assert_eq(Option::::none().and_then(|_| Option::some(1)), Option::none()); + assert_eq(Option::some(1).and_then(|x| Option::some(x + 1)), Option::some(2)); + assert_eq(Option::some(1).and_then(|_| Option::::none()), Option::none()); + } + + #[test] + fn or() { + assert_eq(Option::::none().or(Option::none()), Option::none()); + assert_eq(Option::::none().or(Option::some(1)), Option::some(1)); + assert_eq(Option::some(1).or(Option::some(2)), Option::some(1)); + assert_eq(Option::some(1).or(Option::none()), Option::some(1)); + } + + #[test] + fn or_else() { + assert_eq(Option::::none().or_else(|| Option::none()), Option::none()); + assert_eq(Option::::none().or_else(|| Option::some(1)), Option::some(1)); + assert_eq(Option::some(1).or_else(|| Option::some(2)), Option::some(1)); + assert_eq(Option::some(1).or_else(|| Option::none()), Option::some(1)); + } + + #[test] + fn xor() { + assert_eq(Option::::none().xor(Option::none()), Option::none()); + assert_eq(Option::::none().xor(Option::some(1)), Option::some(1)); + assert_eq(Option::some(1).xor(Option::some(2)), Option::none()); + assert_eq(Option::some(1).xor(Option::none()), Option::some(1)); + } + + #[test] + fn filter() { + assert_eq(Option::::none().filter(|_| true), Option::none()); + assert_eq(Option::some(1).filter(|x| x == 1), Option::some(1)); + assert_eq(Option::some(1).filter(|x| x == 2), Option::none()); + assert_eq(Option::some(1).filter(|x| x == 2), Option::none()); + } + + #[test] + fn flatten() { + assert_eq(Option::>::none().flatten(), Option::none()); + assert_eq(Option::some(Option::::none()).flatten(), Option::none()); + assert_eq(Option::some(Option::some(1)).flatten(), Option::some(1)); + } + + #[test] + fn default() { + assert_eq(Option::::default(), Option::none()); + } + + #[test] + fn eq() { + assert(Option::::none() == Option::none()); + assert(Option::::some(1) != Option::none()); + assert(Option::::none() != Option::some(1)); + assert(Option::::some(1) == Option::some(1)); + assert(Option::::some(1) != Option::some(2)); + } + + #[test] + fn cmp() { + let none = Option::::none(); + let one = Option::::some(1); + let two = Option::::some(2); + assert_eq(none.cmp(none), Ordering::equal()); + assert_eq(none.cmp(one), Ordering::less()); + assert_eq(one.cmp(none), Ordering::greater()); + assert_eq(one.cmp(one), Ordering::equal()); + assert_eq(one.cmp(two), Ordering::less()); + assert_eq(two.cmp(one), Ordering::greater()); + } +} diff --git a/stdlib/src/panic.nr b/stdlib/src/panic.nr index 46cbb7f8..3737f030 100644 --- a/stdlib/src/panic.nr +++ b/stdlib/src/panic.nr @@ -1,3 +1,6 @@ +/// Halt the program at runtime with the given error message. +/// +/// The provided error message must be either a `str` or a `fmtstr`. pub fn panic(message: T) -> U where T: StringLike, @@ -10,3 +13,12 @@ trait StringLike {} impl StringLike for str {} impl StringLike for fmtstr {} + +mod tests { + use crate::prelude::panic; + + #[test(should_fail_with = "OH NO")] + fn panics() { + panic("OH NO"); + } +} diff --git a/stdlib/src/prelude.nr b/stdlib/src/prelude.nr index 7aa60456..cc868cd1 100644 --- a/stdlib/src/prelude.nr +++ b/stdlib/src/prelude.nr @@ -1,7 +1,6 @@ pub use crate::{assert_constant, print, println}; pub use crate::cmp::{Eq, Ord}; pub use crate::collections::bounded_vec::BoundedVec; -pub use crate::collections::vec::Vec; pub use crate::convert::{From, Into}; pub use crate::default::Default; pub use crate::meta::{derive, derive_via}; diff --git a/stdlib/src/primitive_docs.nr b/stdlib/src/primitive_docs.nr index 92f87588..7c20afdb 100644 --- a/stdlib/src/primitive_docs.nr +++ b/stdlib/src/primitive_docs.nr @@ -14,10 +14,6 @@ mod primitive_array {} #['nargo_doc_primitive bool] mod primitive_bool {} -/// The 1-bit unsigned integer type. -#['nargo_doc_primitive u1] -mod primitive_u1 {} - /// The 8-bit unsigned integer type. #['nargo_doc_primitive u8] mod primitive_u8 {} diff --git a/stdlib/src/runtime.nr b/stdlib/src/runtime.nr index c075107c..1215797c 100644 --- a/stdlib/src/runtime.nr +++ b/stdlib/src/runtime.nr @@ -1,2 +1,3 @@ +/// True if executed in an unconstrained or comptime context, false otherwise. #[builtin(is_unconstrained)] pub fn is_unconstrained() -> bool {} diff --git a/stdlib/src/string.nr b/stdlib/src/string.nr index 13bbc35b..7037830b 100644 --- a/stdlib/src/string.nr +++ b/stdlib/src/string.nr @@ -16,3 +16,21 @@ impl From<[u8; N]> for str { bytes.as_str_unchecked() } } + +mod tests { + #[test] + fn as_bytes() { + assert_eq("Noir".as_bytes(), [78_u8, 111, 105, 114]); + } + + #[test] + fn as_bytes_vec() { + assert_eq("Noir".as_bytes_vec(), @[78_u8, 111, 105, 114]); + } + + #[test] + fn from_bytes() { + let str: str<4> = crate::convert::From::from([78_u8, 111, 105, 114]); + assert_eq(str, "Noir"); + } +} diff --git a/stdlib/src/vector.nr b/stdlib/src/vector.nr index 64ffed89..2923c5b7 100644 --- a/stdlib/src/vector.nr +++ b/stdlib/src/vector.nr @@ -47,6 +47,8 @@ impl [T] { self } + /// Converts this vector into an array of length N. + /// Panics if the length of this vector is not N. pub fn as_array(self) -> [T; N] { assert(self.len() == N); @@ -57,8 +59,8 @@ impl [T] { array } - // Apply a function to each element of the vector, returning a new vector - // containing the mapped elements. + /// Apply a function to each element of the vector, returning a new vector + /// containing the mapped elements. pub fn map(self, f: fn[Env](T) -> U) -> [U] { let mut ret = [].as_vector(); for elem in self { @@ -67,8 +69,8 @@ impl [T] { ret } - // Apply a function to each element of the vector with its index, returning a - // new vector containing the mapped elements. + /// Apply a function to each element of the vector with its index, returning a + /// new vector containing the mapped elements. pub fn mapi(self, f: fn[Env](u32, T) -> U) -> [U] { let mut ret = [].as_vector(); let mut index = 0; @@ -79,14 +81,14 @@ impl [T] { ret } - // Apply a function to each element of the vector + /// Apply a function to each element of the vector pub fn for_each(self, f: fn[Env](T) -> ()) { for elem in self { f(elem); } } - // Apply a function to each element of the vector with its index + /// Apply a function to each element of the vector with its index pub fn for_eachi(self, f: fn[Env](u32, T) -> ()) { let mut index = 0; for elem in self { @@ -95,9 +97,9 @@ impl [T] { } } - // Apply a function to each element of the vector and an accumulator value, - // returning the final accumulated value. This function is also sometimes - // called `foldl`, `fold_left`, `reduce`, or `inject`. + /// Apply a function to each element of the vector and an accumulator value, + /// returning the final accumulated value. This function is also sometimes + /// called `foldl`, `fold_left`, `reduce`, or `inject`. pub fn fold(self, mut accumulator: U, f: fn[Env](U, T) -> U) -> U { for elem in self { accumulator = f(accumulator, elem); @@ -105,9 +107,9 @@ impl [T] { accumulator } - // Apply a function to each element of the vector and an accumulator value, - // returning the final accumulated value. Unlike fold, reduce uses the first - // element of the given vector as its starting accumulator value. + /// Apply a function to each element of the vector and an accumulator value, + /// returning the final accumulated value. Unlike fold, reduce uses the first + /// element of the given vector as its starting accumulator value. pub fn reduce(self, f: fn[Env](T, T) -> T) -> T { let mut accumulator = self[0]; for i in 1..self.len() { @@ -116,8 +118,8 @@ impl [T] { accumulator } - // Returns a new vector containing only elements for which the given predicate - // returns true. + /// Returns a new vector containing only elements for which the given predicate + /// returns true. pub fn filter(self, predicate: fn[Env](T) -> bool) -> Self { let mut ret = [].as_vector(); for elem in self { @@ -128,7 +130,7 @@ impl [T] { ret } - // Flatten each element in the vector into one value, separated by `separator`. + /// Flatten each element in the vector into one value, separated by `separator`. pub fn join(self, separator: T) -> T where T: Append, @@ -146,7 +148,7 @@ impl [T] { ret } - // Returns true if all elements in the vector satisfy the predicate + /// Returns true if all elements in the vector satisfy the predicate pub fn all(self, predicate: fn[Env](T) -> bool) -> bool { let mut ret = true; for elem in self { @@ -155,7 +157,7 @@ impl [T] { ret } - // Returns true if any element in the vector satisfies the predicate + /// Returns true if any element in the vector satisfies the predicate pub fn any(self, predicate: fn[Env](T) -> bool) -> bool { let mut ret = false; for elem in self { From a8c0c36e85858082a68dddf9b2b5a271f354896a Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 27 Jul 2026 11:28:52 +0000 Subject: [PATCH 04/10] Support beta.25 extraction output in the Lampe library - The versioned stdlib struct names baked into the embedded curve builtins move to std-1.0.0-beta.25. - The new stdlib poseidon2_config_state_size foreign builtin is modeled as the constant 4, matching the width-4 (BN254) Poseidon2 configuration Lampe formalizes. - The eDSL gains a dedicated token for the unitEq builtin: beta.25's stdlib exercises Eq for the unit type, and the generic builtin call syntax cannot parse it because maximal munch tokenizes #_unitEq as the #_unit literal followed by Eq. --- Lampe/Lampe/Builtin/Crypto/Poseidon2.lean | 10 ++++++++++ Lampe/Lampe/Crypto/EmbeddedCurve.lean | 4 ++-- Lampe/Lampe/Syntax/Builders.lean | 12 ++++++++++++ Lampe/Lampe/Syntax/Rules.lean | 3 +++ Lampe/Tests/Pedersen.lean | 2 +- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Lampe/Lampe/Builtin/Crypto/Poseidon2.lean b/Lampe/Lampe/Builtin/Crypto/Poseidon2.lean index be110fe9..9cb94732 100644 --- a/Lampe/Lampe/Builtin/Crypto/Poseidon2.lean +++ b/Lampe/Lampe/Builtin/Crypto/Poseidon2.lean @@ -15,4 +15,14 @@ def poseidon2Permutation := newTotalPureBuiltin ⟨[.array .field (4 : U 32)], .array .field (4 : U 32)⟩ (fun h![state] => Crypto.Poseidon2.noirPermutation4 state) +/-- +Noir's `poseidon2_config_state_size` foreign builtin. + +Lampe models the width-4 (BN254) Poseidon2 configuration, so the state size is +the constant `4`. +-/ +def poseidon2ConfigStateSize := newTotalPureBuiltin + ⟨[], .u 32⟩ + (fun h![] => 4) + end Lampe.Builtin diff --git a/Lampe/Lampe/Crypto/EmbeddedCurve.lean b/Lampe/Lampe/Crypto/EmbeddedCurve.lean index c4f175df..3eeb83a4 100644 --- a/Lampe/Lampe/Crypto/EmbeddedCurve.lean +++ b/Lampe/Lampe/Crypto/EmbeddedCurve.lean @@ -21,12 +21,12 @@ comes from `Lampe.Crypto.MathlibBridge`. @[reducible] def pointTp : Tp := - .tuple (some "«std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint»") + .tuple (some "«std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint»") [.field, .field, .bool] @[reducible] def scalarTp : Tp := - .tuple (some "«std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar»") + .tuple (some "«std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar»") [.field, .field] @[reducible] diff --git a/Lampe/Lampe/Syntax/Builders.lean b/Lampe/Lampe/Syntax/Builders.lean index 5bf2bb26..98da8dde 100644 --- a/Lampe/Lampe/Syntax/Builders.lean +++ b/Lampe/Lampe/Syntax/Builders.lean @@ -226,9 +226,21 @@ partial def makeExpr [MonadDSL m] k emitBuiltin +-- The `#_unitEq` builtin has its own token (see Rules.lean), so it needs its +-- own call case. +| `(noir_expr|(#_unitEq returning $tp)( $args,* )) => + let emitBuiltin : m (TSyntax `term) := makeArgs args.getElems fun args => do + let argVals ← makeHListLit args + wrapInLet + (←``(Expr.callBuiltin _ $(←makeNoirType tp) $(←makeBuiltin "unitEq") $argVals)) + binder + k + emitBuiltin + -- Bare function refs | `(noir_expr|$ref:noir_funcref) => match ref with | `(noir_funcref|(#_ $_:ident returning $_)) + | `(noir_funcref|(#_unitEq returning $_)) | `(noir_funcref|(#_ projectRef $_ returning $_)) => throwError "Encountered builtin {ref} as bare function reference" diff --git a/Lampe/Lampe/Syntax/Rules.lean b/Lampe/Lampe/Syntax/Rules.lean index 73d095f6..8f032879 100644 --- a/Lampe/Lampe/Syntax/Rules.lean +++ b/Lampe/Lampe/Syntax/Rules.lean @@ -155,6 +155,9 @@ syntax "for" ppSpace noir_ident ppSpace "in" ppSpace noir_expr ppSpace ".." ppSp syntax "(" noir_ident ppSpace "as" ppSpace noir_type ")" : noir_funcref -- An identifier call ref. syntax "(" noir_lambda ")" : noir_funcref -- A lambda is callable. syntax "(" "#_" ident ppSpace "returning" ppSpace noir_type ")" : noir_funcref -- A builtin name is callable. +-- The `#_unit` literal token would otherwise eat the prefix of `#_unitEq` +-- under maximal munch, so the builtin gets its own token. +syntax "(" "#_unitEq" ppSpace "returning" ppSpace noir_type ")" : noir_funcref syntax "(" "#_" "projectRef" ppSpace num ppSpace "returning" ppSpace noir_type ")" : noir_funcref -- projectRef with field index. syntax "(" noir_ident "<" noir_gen_val,* ">" ppSpace "as" ppSpace noir_type ")" : noir_funcref -- A function reference is callable. syntax "(" "(" noir_type ppSpace "as" ppSpace noir_ident "<" noir_gen_val,* ">" ")" diff --git a/Lampe/Tests/Pedersen.lean b/Lampe/Tests/Pedersen.lean index c5c6b7fa..071fbe7c 100644 --- a/Lampe/Tests/Pedersen.lean +++ b/Lampe/Tests/Pedersen.lean @@ -9,7 +9,7 @@ Verifies the pure `pedersenCommitment` and `pedersenHash` functions forms guaranteed by the stdlib `_spec_canonical` theorems — against Aztec's published test vectors (from `assert_pedersen` in the Noir stdlib, extracted at -`stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Mod.lean` starting at +`stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Mod.lean` starting at line 251). Inputs are `[1, 2, ..., N]` as Fields, separator = N. Outputs are From 4fb06e87cd6896e74a4087aaef09787c995d051e Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 27 Jul 2026 11:28:52 +0000 Subject: [PATCH 05/10] Note that testing/ fixtures may need Noir language updates --- docs/Updating Noir Version.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/Updating Noir Version.md b/docs/Updating Noir Version.md index 45a8cfc9..256b18c0 100644 --- a/docs/Updating Noir Version.md +++ b/docs/Updating Noir Version.md @@ -39,9 +39,10 @@ asserts that everything else in the repository agrees with it. `noirc_frontend` / `nargo` APIs between the two releases. This regenerates `Cargo.lock` as a side effect (if version resolution conflicts appear between the new noir crates and old locked versions, a full `cargo update` is the simplest fix). This step is where the real work usually - is; the rest is mechanical. Note that `cargo test` fixtures in `src/lib.rs` are written in - Noir, so *language*-level changes (removed methods, changed literal rules, etc.) can require - updating the fixtures themselves, not just the extractor. + is; the rest is mechanical. Note that `cargo test` fixtures in `src/lib.rs` and the test + projects under `testing/` are written in Noir, so *language*-level changes (removed methods, + changed literal syntax, etc.) can require updating the fixtures themselves — including the + versions of any git dependencies they pin (e.g. `noir_base64`) — not just the extractor. 5. **Re-vendor the Noir stdlib**: - Replace `stdlib/src/` with `noir_stdlib/src` from the pinned rev (see From 2fe0d323b3ce26aa9da5de42f03cdaffc6dbc1c2 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 27 Jul 2026 16:43:36 +0000 Subject: [PATCH 06/10] Model beta.25's bool bit decomposition in Lampe Noir's bit decompositions now produce bool arrays instead of u1 arrays: - toLeBits/toBeBits/modulusLeBits/modulusBeBits move to .bool, with Bool.toDigit / Digit.toBool conversions (and roundtrip simp lemmas) in Lampe.Data.Digits. - The corresponding Hoare intro rules are restated accordingly. - Struct gains cross-member indexTpl/replaceTuple' simp lemmas, needed now that BoundedVec methods read and write through references. --- Lampe/Lampe/Builtin/Field.lean | 16 ++++++++-------- Lampe/Lampe/Builtin/Struct.lean | 14 ++++++++++++++ Lampe/Lampe/Data/Digits.lean | 18 ++++++++++++++++++ Lampe/Lampe/Hoare/Builtins.lean | 12 ++++++------ 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/Lampe/Lampe/Builtin/Field.lean b/Lampe/Lampe/Builtin/Field.lean index 9052c98b..0e2ef58f 100644 --- a/Lampe/Lampe/Builtin/Field.lean +++ b/Lampe/Lampe/Builtin/Field.lean @@ -133,16 +133,16 @@ Represents the builtin that returns the bit representation of the modulus of a f little-endian format. -/ def modulusLeBits : Builtin := newTotalPureBuiltin - ⟨[], (.vector (.u 1))⟩ - (fun {p} h![] => (RadixVec.toDigitsLE' 2 p.natVal).map BitVec.ofFin) + ⟨[], (.vector .bool)⟩ + (fun {p} h![] => (RadixVec.toDigitsLE' 2 p.natVal).map Digit.toBool) /-- Represents the builtin that returns the bit representation of the modulus of a field in big-endian format. -/ def modulusBeBits : Builtin := newTotalPureBuiltin - ⟨[], (.vector (.u 1))⟩ - (fun {p} h![] => (RadixVec.toDigitsBE' 2 p.natVal).map BitVec.ofFin) + ⟨[], (.vector .bool)⟩ + (fun {p} h![] => (RadixVec.toDigitsBE' 2 p.natVal).map Digit.toBool) /-- Represents the builtin that returns the byte representation of the modulus of a field in @@ -174,9 +174,9 @@ Represents the builtin that converts a field element to its bit representation i Fails if `f ≥ 2^s`. -/ def toLeBits : Builtin := newGenericBuiltin - (fun s => ([.field], .array (.u 1) s)) + (fun s => ([.field], .array .bool s)) fun _ h![f] output => - f = RadixVec.ofDigitsLE (r := 2) (output.map BitVec.toFin) + f = RadixVec.ofDigitsLE (r := 2) (output.map Bool.toDigit) /-- Represents the builtin that converts a field element to its bit representation in big-endian format. @@ -184,9 +184,9 @@ Represents the builtin that converts a field element to its bit representation i Fails if `f ≥ 2^s`. -/ def toBeBits : Builtin := newGenericBuiltin - (fun s => ([.field], .array (.u 1) s)) + (fun s => ([.field], .array .bool s)) fun _ h![f] output => - f = RadixVec.ofDigitsBE (r := 2) (output.map BitVec.toFin) + f = RadixVec.ofDigitsBE (r := 2) (output.map Bool.toDigit) /-- Represents the builtin that converts a field element to its radix representation in little-endian diff --git a/Lampe/Lampe/Builtin/Struct.lean b/Lampe/Lampe/Builtin/Struct.lean index d9489f5b..56be2afa 100644 --- a/Lampe/Lampe/Builtin/Struct.lean +++ b/Lampe/Lampe/Builtin/Struct.lean @@ -94,6 +94,20 @@ example (p : Prime) (s : Bool) (n d : U 32) : intro tpl rfl +/-- Indexing a later member is unaffected by replacing the head. -/ +@[simp] +theorem index_head_replaced_tpl_tail {tps : List Tp} {tp tp' : Tp} + (tpl : Tp.denoteArgs p (tp :: tps)) (v : Tp.denote p tp) (m : Member tp' tps) : + indexTpl (p := p) (replaceTuple' tpl Member.head v) (Member.tail m) = + indexTpl tpl (Member.tail m) := rfl + +/-- Indexing the head is unaffected by replacing a later member. -/ +@[simp] +theorem index_tail_replaced_tpl_head {tps : List Tp} {tp tp' : Tp} + (tpl : Tp.denoteArgs p (tp :: tps)) (m : Member tp' tps) (v : Tp.denote p tp') : + indexTpl (p := p) (replaceTuple' tpl (Member.tail m) v) Member.head = + indexTpl tpl Member.head := rfl + @[simp] theorem index_replaced_tpl : indexTpl (replaceTuple' tpl mem v') mem = v' := by diff --git a/Lampe/Lampe/Data/Digits.lean b/Lampe/Lampe/Data/Digits.lean index ca7be8a9..51bdf384 100644 --- a/Lampe/Lampe/Data/Digits.lean +++ b/Lampe/Lampe/Data/Digits.lean @@ -262,6 +262,24 @@ def toDigitsLE' (r : Radix) (n : Nat) : List (Digit r) := instance : OfNat Radix 2 where ofNat := ⟨2, by simp⟩ +/-- The binary digit corresponding to a boolean bit. -/ +def _root_.Bool.toDigit (b : Bool) : Digit 2 := if b then 1 else 0 + +/-- The boolean bit corresponding to a binary digit. -/ +def _root_.Lampe.Digit.toBool (d : Digit 2) : Bool := d = 1 + +@[simp] theorem _root_.Bool.toDigit_true : Bool.toDigit true = 1 := rfl +@[simp] theorem _root_.Bool.toDigit_false : Bool.toDigit false = 0 := rfl + +@[simp] theorem _root_.Lampe.Digit.toBool_toDigit (d : Digit 2) : d.toBool.toDigit = d := by + fin_cases d <;> rfl + +@[simp] theorem _root_.Bool.toBool_toDigit (b : Bool) : b.toDigit.toBool = b := by + cases b <;> rfl + +@[simp] theorem _root_.Bool.toDigit_val_eq_toNat (b : Bool) : b.toDigit.val = b.toNat := by + cases b <;> rfl + lemma ofDigitsBE_cons {r : Radix} {d : Nat} {x : Digit r} {xs : List.Vector (Digit r) d} : ofDigitsBE (r := r) (x ::ᵥ xs) = (x.val * r.val ^ d + ofDigitsBE xs) := by diff --git a/Lampe/Lampe/Hoare/Builtins.lean b/Lampe/Lampe/Hoare/Builtins.lean index 2bcafbce..ce86ee3b 100644 --- a/Lampe/Lampe/Hoare/Builtins.lean +++ b/Lampe/Lampe/Hoare/Builtins.lean @@ -586,21 +586,21 @@ theorem getLens_intro {lens : Lens (Tp.denote p) tp₁ tp₂} : -- Field theorem toLeBits_intro {f : Tp.denote p Tp.field} : - STHoare p Γ ⟦⟧ (.callBuiltin [Tp.field] ((Tp.u 1).array N) Builtin.toLeBits h![f]) - fun output => f = RadixVec.ofDigitsLE (r := 2) (output.map BitVec.toFin) := by + STHoare p Γ ⟦⟧ (.callBuiltin [Tp.field] (Tp.bool.array N) Builtin.toLeBits h![f]) + fun output => f = RadixVec.ofDigitsLE (r := 2) (output.map Bool.toDigit) := by apply STHoare.consequence case h_hoare => - apply genericBuiltin_intro (sgn := fun s => ([.field], .array (.u 1) s)) + apply genericBuiltin_intro (sgn := fun s => ([.field], .array .bool s)) · apply SLP.entails_self · intro apply SLP.entails_self theorem toBeBits_intro {f : Tp.denote p Tp.field} : - STHoare p Γ ⟦⟧ (.callBuiltin [Tp.field] ((Tp.u 1).array s) Builtin.toBeBits h![f]) - fun output => f = RadixVec.ofDigitsBE (r := 2) (output.map BitVec.toFin) := by + STHoare p Γ ⟦⟧ (.callBuiltin [Tp.field] (Tp.bool.array s) Builtin.toBeBits h![f]) + fun output => f = RadixVec.ofDigitsBE (r := 2) (output.map Bool.toDigit) := by apply STHoare.consequence case h_hoare => - apply genericBuiltin_intro (sgn := fun s => ([.field], .array (.u 1) s)) + apply genericBuiltin_intro (sgn := fun s => ([.field], .array .bool s)) · apply SLP.entails_self · intro apply SLP.entails_self From c4609cc2242d3b92208c1c96f0a144c56112c42d Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 27 Jul 2026 16:43:58 +0000 Subject: [PATCH 07/10] Re-extract the stdlib at beta.25 and repair its theorems Replaces the extracted std-1.0.0-beta.14 package with std-1.0.0-beta.25 and updates the handwritten theorem layer for the upstream changes: - u1 is gone: its Eq/arith/bit specs are deleted. - Bit decompositions return bool arrays: the to_le/be_bits, pow_32 and sgn0 proofs are converted (with Mathlib's lex List.LE' locally erased, since Bool is a LinearOrder and it would shadow the core list order the proofs use). bytes32_to_field was removed upstream, so its spec goes too. - Tuple Ord impls end in a value-if; the tuple3/4/5 proofs are restructured. - BoundedVec::get/get_unchecked/len take &self now: their specs are restated in the reference style. pop no longer zeroes the popped slot, from_parts lost its zeroing loop, from_parts_unchecked is deprecated (and excluded from the extracted env, so its spec is deleted), and extend_from_bounded_vec bounds its loop with cmp::min (covered by a new min_u32_spec). - The larger extracted env pushes some proofs over the default heartbeat/recursion limits; those files raise them explicitly. - Collections/Map is gone upstream. Known remaining work (previously masked by upstream build failures): Stdlib/Array/CheckShuffle.lean, Stdlib/Hash/Poseidon2.lean and Stdlib/Option.lean still fail against the beta.25 extraction (the same by-reference migration); tracked in PROOF_REPAIRS.md. --- stdlib/lampe/Stdlib.lean | 1 - stdlib/lampe/Stdlib/Aes128.lean | 6 +- stdlib/lampe/Stdlib/Append.lean | 4 +- stdlib/lampe/Stdlib/Array/CheckShuffle.lean | 10 +- stdlib/lampe/Stdlib/Array/Mod.lean | 42 +- stdlib/lampe/Stdlib/Cmp.lean | 218 ++-- .../Stdlib/Collections/BoundedVec/Core.lean | 20 +- .../BoundedVec/HigherOrderMap.lean | 30 +- .../Collections/BoundedVec/Methods.lean | 372 +++--- .../Stdlib/Collections/BoundedVec/Traits.lean | 4 +- stdlib/lampe/Stdlib/Collections/Map.lean | 6 - stdlib/lampe/Stdlib/Collections/Umap.lean | 4 +- stdlib/lampe/Stdlib/Compat.lean | 6 +- stdlib/lampe/Stdlib/Convert.lean | 46 +- stdlib/lampe/Stdlib/Default.lean | 27 +- stdlib/lampe/Stdlib/EcdsaSecp256K1.lean | 6 +- stdlib/lampe/Stdlib/EcdsaSecp256R1.lean | 6 +- stdlib/lampe/Stdlib/EmbeddedCurveOps.lean | 84 +- .../lampe/Stdlib/EmbeddedCurveOps/Bn254.lean | 4 +- stdlib/lampe/Stdlib/Field/Basic.lean | 6 +- stdlib/lampe/Stdlib/Field/Bn254.lean | 28 +- stdlib/lampe/Stdlib/Field/Mod.lean | 365 ++---- stdlib/lampe/Stdlib/Hash/Mod.lean | 68 +- stdlib/lampe/Stdlib/Hash/Pedersen.lean | 22 +- stdlib/lampe/Stdlib/Hash/Poseidon2.lean | 28 +- stdlib/lampe/Stdlib/Lib.lean | 8 +- stdlib/lampe/Stdlib/Ops/Arith.lean | 190 +-- stdlib/lampe/Stdlib/Ops/Bit.lean | 130 +- stdlib/lampe/Stdlib/Option.lean | 126 +- stdlib/lampe/Stdlib/Panic.lean | 6 +- stdlib/lampe/Stdlib/Stdlib.lean | 4 +- stdlib/lampe/Stdlib/String.lean | 12 +- stdlib/lampe/Stdlib/TraitMethods.lean | 30 +- stdlib/lampe/Stdlib/Vector.lean | 46 +- stdlib/lampe/lakefile.toml | 6 +- stdlib/lampe/std-1.0.0-beta.14.lean | 3 - stdlib/lampe/std-1.0.0-beta.14/Extracted.lean | 106 -- .../std-1.0.0-beta.14/Extracted/Aes128.lean | 27 - .../std-1.0.0-beta.14/Extracted/Append.lean | 22 - .../Extracted/Array/CheckShuffle.lean | 136 -- .../Extracted/Array/Mod.lean | 299 ----- .../Extracted/Array/Quicksort.lean | 285 ----- .../std-1.0.0-beta.14/Extracted/Cmp.lean | 453 ------- .../Extracted/Collections/BoundedVec.lean | 884 ------------- .../Extracted/Collections/Map.lean | 336 ----- .../Extracted/Collections/Mod.lean | 12 - .../Extracted/Collections/Umap.lean | 246 ---- .../Extracted/Collections/Vec.lean | 286 ----- .../std-1.0.0-beta.14/Extracted/Convert.lean | 882 ------------- .../std-1.0.0-beta.14/Extracted/Default.lean | 126 -- .../Extracted/EcdsaSecp256K1.lean | 16 - .../Extracted/EcdsaSecp256R1.lean | 16 - .../Extracted/EmbeddedCurveOps.lean | 124 -- .../Extracted/Field/Mod.lean | 548 -------- .../Extracted/GeneratedTypes.lean | 225 ---- .../std-1.0.0-beta.14/Extracted/Hash/Mod.lean | 279 ----- .../Extracted/Hash/Poseidon2.lean | 100 -- .../std-1.0.0-beta.14/Extracted/Hint.lean | 12 - .../std-1.0.0-beta.14/Extracted/Mem.lean | 12 - .../Extracted/Meta/Ctstring.lean | 28 - .../Extracted/Meta/Expr.lean | 12 - .../Extracted/Meta/FormatString.lean | 12 - .../Extracted/Meta/FunctionDef.lean | 12 - .../std-1.0.0-beta.14/Extracted/Meta/Mod.lean | 44 - .../Extracted/Meta/Module.lean | 12 - .../std-1.0.0-beta.14/Extracted/Meta/Op.lean | 118 -- .../Extracted/Meta/Quoted.lean | 12 - .../Extracted/Meta/TraitConstraint.lean | 12 - .../Extracted/Meta/TraitDef.lean | 12 - .../Extracted/Meta/TraitImpl.lean | 12 - .../std-1.0.0-beta.14/Extracted/Meta/Typ.lean | 12 - .../Extracted/Meta/TypeDef.lean | 12 - .../Extracted/Meta/TypedExpr.lean | 12 - .../Extracted/Meta/UnresolvedType.lean | 12 - .../Extracted/Ops/Arith.lean | 863 ------------- .../std-1.0.0-beta.14/Extracted/Ops/Bit.lean | 396 ------ .../std-1.0.0-beta.14/Extracted/Ops/Mod.lean | 12 - .../std-1.0.0-beta.14/Extracted/Option.lean | 194 --- .../std-1.0.0-beta.14/Extracted/Panic.lean | 23 - .../std-1.0.0-beta.14/Extracted/Prelude.lean | 12 - .../Extracted/PrimitiveDocs.lean | 12 - .../std-1.0.0-beta.14/Extracted/Runtime.lean | 12 - .../std-1.0.0-beta.14/Extracted/String.lean | 22 - .../std-1.0.0-beta.14/Extracted/Test.lean | 68 - stdlib/lampe/std-1.0.0-beta.25.lean | 3 + stdlib/lampe/std-1.0.0-beta.25/Extracted.lean | 108 ++ .../std-1.0.0-beta.25/Extracted/Aes128.lean | 36 + .../std-1.0.0-beta.25/Extracted/Append.lean | 40 + .../Extracted/Array/CheckShuffle.lean | 136 ++ .../Extracted/Array/Mod.lean | 361 ++++++ .../Extracted/Array/Quicksort.lean | 285 +++++ .../std-1.0.0-beta.25/Extracted/Cmp.lean | 838 +++++++++++++ .../Extracted/Collections/BoundedVec.lean | 1097 +++++++++++++++++ .../Extracted/Collections/Mod.lean | 12 + .../Extracted/Collections/Umap.lean | 208 ++++ .../Extracted/Compat.lean | 10 +- .../std-1.0.0-beta.25/Extracted/Convert.lean | 911 ++++++++++++++ .../std-1.0.0-beta.25/Extracted/Default.lean | 198 +++ .../Extracted/EcdsaSecp256K1.lean | 29 + .../Extracted/EcdsaSecp256R1.lean | 29 + .../Extracted/EmbeddedCurveOps.lean | 380 ++++++ .../Extracted/Field/Bn254.lean | 153 +-- .../Extracted/Field/Mod.lean | 654 ++++++++++ .../Extracted/GeneratedTypes.lean | 205 +++ .../std-1.0.0-beta.25/Extracted/Hash/Mod.lean | 367 ++++++ .../Extracted/Hash/Poseidon2.lean | 66 + .../std-1.0.0-beta.25/Extracted/Hint.lean | 12 + .../std-1.0.0-beta.25/Extracted/Integer.lean | 164 +++ .../Extracted/Internal/Mod.lean | 12 + .../Extracted/Lib.lean | 20 +- .../std-1.0.0-beta.25/Extracted/Mem.lean | 12 + .../Extracted/Meta/Ctstring.lean | 36 + .../Extracted/Meta/Expr.lean | 12 + .../Extracted/Meta/FormatString.lean | 12 + .../Extracted/Meta/FunctionDef.lean | 12 + .../Extracted/Meta/Location.lean | 12 + .../std-1.0.0-beta.25/Extracted/Meta/Mod.lean | 44 + .../Extracted/Meta/Module.lean | 12 + .../std-1.0.0-beta.25/Extracted/Meta/Op.lean | 142 +++ .../Extracted/Meta/Quoted.lean | 12 + .../Extracted/Meta/TraitConstraint.lean | 12 + .../Extracted/Meta/TraitDef.lean | 12 + .../Extracted/Meta/TraitImpl.lean | 12 + .../std-1.0.0-beta.25/Extracted/Meta/Typ.lean | 12 + .../Extracted/Meta/TypeDef.lean | 12 + .../Extracted/Meta/TypedExpr.lean | 12 + .../Extracted/Meta/UnresolvedType.lean | 12 + .../Extracted/Ops/Arith.lean | 1047 ++++++++++++++++ .../std-1.0.0-beta.25/Extracted/Ops/Bit.lean | 443 +++++++ .../std-1.0.0-beta.25/Extracted/Ops/Mod.lean | 12 + .../std-1.0.0-beta.25/Extracted/Option.lean | 334 +++++ .../std-1.0.0-beta.25/Extracted/Panic.lean | 28 + .../std-1.0.0-beta.25/Extracted/Prelude.lean | 12 + .../Extracted/PrimitiveDocs.lean | 12 + .../std-1.0.0-beta.25/Extracted/Runtime.lean | 12 + .../std-1.0.0-beta.25/Extracted/String.lean | 38 + .../std-1.0.0-beta.25/Extracted/Test.lean | 68 + .../Extracted/Vector.lean | 306 ++--- 138 files changed, 9613 insertions(+), 8777 deletions(-) delete mode 100644 stdlib/lampe/Stdlib/Collections/Map.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Aes128.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Append.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/CheckShuffle.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Mod.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Quicksort.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Cmp.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/BoundedVec.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Map.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Mod.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Umap.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Vec.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Convert.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Default.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256K1.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256R1.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/EmbeddedCurveOps.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Field/Mod.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/GeneratedTypes.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Mod.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Poseidon2.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Hint.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Mem.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Ctstring.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Expr.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FormatString.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FunctionDef.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Mod.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Module.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Op.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Quoted.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitConstraint.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitDef.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitImpl.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Typ.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypeDef.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypedExpr.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/UnresolvedType.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Arith.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Bit.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Mod.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Option.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Panic.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Prelude.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/PrimitiveDocs.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Runtime.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/String.lean delete mode 100644 stdlib/lampe/std-1.0.0-beta.14/Extracted/Test.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Aes128.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Append.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/CheckShuffle.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Mod.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Quicksort.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Cmp.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/BoundedVec.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Mod.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Umap.lean rename stdlib/lampe/{std-1.0.0-beta.14 => std-1.0.0-beta.25}/Extracted/Compat.lean (61%) create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Convert.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Default.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256K1.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256R1.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/EmbeddedCurveOps.lean rename stdlib/lampe/{std-1.0.0-beta.14 => std-1.0.0-beta.25}/Extracted/Field/Bn254.lean (50%) create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Field/Mod.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/GeneratedTypes.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Mod.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Poseidon2.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Hint.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Integer.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Internal/Mod.lean rename stdlib/lampe/{std-1.0.0-beta.14 => std-1.0.0-beta.25}/Extracted/Lib.lean (50%) create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Mem.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Ctstring.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Expr.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FormatString.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FunctionDef.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Location.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Mod.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Module.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Op.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Quoted.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitConstraint.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitDef.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitImpl.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Typ.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypeDef.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypedExpr.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/UnresolvedType.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Arith.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Bit.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Mod.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Option.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Panic.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Prelude.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/PrimitiveDocs.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Runtime.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/String.lean create mode 100644 stdlib/lampe/std-1.0.0-beta.25/Extracted/Test.lean rename stdlib/lampe/{std-1.0.0-beta.14 => std-1.0.0-beta.25}/Extracted/Vector.lean (71%) diff --git a/stdlib/lampe/Stdlib.lean b/stdlib/lampe/Stdlib.lean index 89b642e1..5dc0b554 100644 --- a/stdlib/lampe/Stdlib.lean +++ b/stdlib/lampe/Stdlib.lean @@ -8,7 +8,6 @@ import Stdlib.Collections.BoundedVec.Core import Stdlib.Collections.BoundedVec.HigherOrderMap import Stdlib.Collections.BoundedVec.Methods import Stdlib.Collections.BoundedVec.Traits -import Stdlib.Collections.Map import Stdlib.Collections.Umap import Stdlib.Compat import Stdlib.Convert diff --git a/stdlib/lampe/Stdlib/Aes128.lean b/stdlib/lampe/Stdlib/Aes128.lean index c4c96e24..0457f6ce 100644 --- a/stdlib/lampe/Stdlib/Aes128.lean +++ b/stdlib/lampe/Stdlib/Aes128.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Lampe.Crypto.Aes128 @@ -22,7 +22,7 @@ This file proves `aes128_encrypt` evaluates to namespace Lampe.Stdlib.Aes128 -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Crypto /-- Direct builtin spec: `aes128Encrypt` applied to an input, @@ -49,7 +49,7 @@ theorem aes128_encrypt_spec {p} {N : U 32} {key : Tp.denote p ((Tp.u 8).array (16 : U 32))} (hN : N.toNat + 16 < 2^32) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::aes128::aes128_encrypt».call h![N] h![input, iv, key]) + («std-1.0.0-beta.25::aes128::aes128_encrypt».call h![N] h![input, iv, key]) (fun r => r.toList = Crypto.Aes128.aes128CbcEncryptRaw key iv (Crypto.Aes128.pkcs7Pad input.toList)) := by set M : U 32 := (N.add 16).sub (N.umod 16) with hMdef diff --git a/stdlib/lampe/Stdlib/Append.lean b/stdlib/lampe/Stdlib/Append.lean index 4e3163b1..00cd3ba7 100644 --- a/stdlib/lampe/Stdlib/Append.lean +++ b/stdlib/lampe/Stdlib/Append.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.Vector @@ -6,7 +6,7 @@ import Stdlib.TraitMethods namespace Lampe.Stdlib.Append -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Stdlib set_option Lampe.pp.Expr true diff --git a/stdlib/lampe/Stdlib/Array/CheckShuffle.lean b/stdlib/lampe/Stdlib/Array/CheckShuffle.lean index 2ca6ac4a..b1ecaed2 100644 --- a/stdlib/lampe/Stdlib/Array/CheckShuffle.lean +++ b/stdlib/lampe/Stdlib/Array/CheckShuffle.lean @@ -1,10 +1,10 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.Cmp namespace Lampe.Stdlib.Array.CheckShuffle -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» lemma get_cast : ∀{M}{α} {l : List α}{h : M = List.length l} {i : Fin M}, l.get (h ▸ i) = l[i.val]'(by cases i; apply lt_of_lt_of_eq (by assumption) h) := by intros @@ -130,7 +130,7 @@ lemma List.perm_of_index_bijection assumption lemma get_index_spec: STHoare p env ⟦⟧ - («std-1.0.0-beta.14::array::check_shuffle::__get_index».call h![N] h![indices, idx]) + («std-1.0.0-beta.25::array::check_shuffle::__get_index».call h![N] h![indices, idx]) (fun r => True) := by enter_decl steps @@ -139,7 +139,7 @@ theorem check_shuffle_spec (t_eq : Cmp.Eq.hasImpl env T) (t_eq_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Eq.eq h![] T h![] h![] h![a, b]) fun r: Bool => ⟦r ↔ a = b⟧) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::array::check_shuffle::check_shuffle».call h![T, N] h![lhs, rhs]) + («std-1.0.0-beta.25::array::check_shuffle::check_shuffle».call h![T, N] h![lhs, rhs]) (fun _ => List.Perm lhs.toList rhs.toList) := by enter_decl steps @@ -233,7 +233,7 @@ Shows that the shuffle check cannot succeed with the given inputs. -/ example {t_eq : Cmp.Eq.hasImpl env (.u 8)} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::array::check_shuffle::check_shuffle».call h![.u 8, 3] h![⟨[1, 2, 3], by simp⟩, ⟨[1, 2, 2], by simp⟩]) + («std-1.0.0-beta.25::array::check_shuffle::check_shuffle».call h![.u 8, 3] h![⟨[1, 2, 3], by simp⟩, ⟨[1, 2, 2], by simp⟩]) (fun _ => False) := by steps [check_shuffle_spec] · simp_all diff --git a/stdlib/lampe/Stdlib/Array/Mod.lean b/stdlib/lampe/Stdlib/Array/Mod.lean index 12477a7e..f7560504 100644 --- a/stdlib/lampe/Stdlib/Array/Mod.lean +++ b/stdlib/lampe/Stdlib/Array/Mod.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Stdlib.Array.CheckShuffle import Stdlib.Convert import Stdlib.Tp @@ -9,7 +9,7 @@ import Lampe namespace Lampe.Stdlib.Array namespace Lampe.Stdlib.List -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» set_option Lampe.pp.Expr true set_option Lampe.pp.STHoare true @@ -21,7 +21,7 @@ theorem map_spec {p T N U Env l f fb} (fun r => inv (ip ++ [e]) (op ++ [r]))) : STHoare p env ((inv [] []) ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::map».call h![T, N, U, Env] h![l, f]) + («std-1.0.0-beta.25::array::map».call h![T, N, U, Env] h![l, f]) (fun r => inv l.toList r.toList ⋆ [λf ↦ fb]) := by enter_decl steps @@ -80,7 +80,7 @@ theorem map_spec {p T N U Env l f fb} theorem map_pure_spec {p T N U Env l f fb fEmb} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::map».call h![T, N, U, Env] h![l, f]) + («std-1.0.0-beta.25::array::map».call h![T, N, U, Env] h![l, f]) (fun r => r.toList = l.toList.map fEmb) := by steps [map_spec (inv := fun i o => o = i.map fEmb)] · simp @@ -94,7 +94,7 @@ theorem mapi_spec {p T N U Env l f fb} (fun r => inv (ip ++ [e]) (op ++ [r]))) : STHoare p env (inv [] [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::mapi».call h![T, N, U, Env] h![l, f]) + («std-1.0.0-beta.25::array::mapi».call h![T, N, U, Env] h![l, f]) (fun r => inv l.toList r.toList ⋆ [λf ↦ fb]) := by enter_decl steps @@ -160,7 +160,7 @@ theorem mapi_spec {p T N U Env l f fb} theorem mapi_pure_spec {p T N U Env l f fb fEmb} (inv_pure : ∀i x, (h : i < l.length) → STHoare p env ⟦⟧ (fb h![i, x]) (fun r => r = fEmb i x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::mapi».call h![T, N, U, Env] h![l, f]) + («std-1.0.0-beta.25::array::mapi».call h![T, N, U, Env] h![l, f]) (fun r => r.toList = l.toList.mapIdx fEmb) := by steps [mapi_spec (inv := fun i o => o = i.mapIdx fEmb)] · simp @@ -185,7 +185,7 @@ theorem for_each_spec {p T N Env l f fb} ((ip ++ [e]) <+: l.toList) → STHoare p env (inv ip) (fb h![e]) (fun _ => inv (ip ++ [e]))) : STHoare p env (inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::for_each».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::for_each».call h![T, N, Env] h![l, f]) (fun _ => inv l.toList ⋆ [λf ↦ fb]) := by enter_decl steps @@ -217,7 +217,7 @@ theorem for_eachi_spec {p T N Env l f fb} ((ip ++ [e] <+: l.toList) → STHoare p env (inv ip) (fb h![ip.length, e]) (fun _ => inv (ip ++ [e])))) : STHoare p env (inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::for_eachi».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::for_eachi».call h![T, N, Env] h![l, f]) (fun _ => inv l.toList ⋆ [λf ↦ fb]) := by enter_decl steps @@ -266,7 +266,7 @@ theorem fold_spec {p T N U Env l a f fb} (fun r => inv (ip ++ [e]) r))) : STHoare p env (inv [] a ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::fold».call h![T, N, U, Env] h![l, a, f]) + («std-1.0.0-beta.25::array::fold».call h![T, N, U, Env] h![l, a, f]) (fun r => (inv l.toList r) ⋆ [λf ↦ fb]) := by enter_decl steps @@ -307,7 +307,7 @@ theorem fold_spec {p T N U Env l a f fb} theorem fold_pure_spec {p T N U Env l a f fb fEmb} (inv_pure : ∀a x, STHoare p env ⟦⟧ (fb h![a, x]) (fun r => r = fEmb a x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::fold».call h![T, N, U, Env] h![l, a, f]) + («std-1.0.0-beta.25::array::fold».call h![T, N, U, Env] h![l, a, f]) (fun r => r = l.toList.foldl fEmb a ⋆ [λf ↦ fb]) := by steps [fold_spec (inv := fun xs v => v = xs.foldl fEmb a)] · rfl @@ -322,7 +322,7 @@ theorem reduce_spec {p T N Env l f fb} (fun r => inv (ip ++ [e]) r))) : STHoare p env (inv [] l[0] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::reduce».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::reduce».call h![T, N, Env] h![l, f]) (fun r => inv l.toList.tail r ⋆ [λf ↦ fb]) := by enter_decl steps @@ -378,7 +378,7 @@ theorem reduce_pure_spec {p T N Env l f fb fEmb} (l_len_gt : l.length > 0) (inv_pure : ∀a x, STHoare p env ⟦⟧ (fb h![a, x]) (fun r => r = fEmb a x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::reduce».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::reduce».call h![T, N, Env] h![l, f]) (fun r => r = l.toList.tail.foldl fEmb l[0] ⋆ [λf ↦ fb]) := by steps [reduce_spec (inv := fun xs v => v = xs.foldl fEmb l[0])] · rfl @@ -392,7 +392,7 @@ theorem all_spec {p T N Env l f fb} (fun r => inv (ip ++ [e]) (op ∧ r)))) : STHoare p env (inv [] true ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::all».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::all».call h![T, N, Env] h![l, f]) (fun r => inv l.toList r ⋆ [λf ↦ fb]) := by enter_decl steps @@ -433,7 +433,7 @@ theorem all_spec {p T N Env l f fb} theorem all_pure_spec {p T N Env l f fb fEmb} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::all».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::all».call h![T, N, Env] h![l, f]) (fun r => r = l.toList.all fEmb) := by steps [all_spec (inv := fun x r => r = x.all fEmb)] · simp @@ -451,7 +451,7 @@ theorem any_spec {p T N Env l f fb} (fun r => inv (ip ++ [e]) (op ∨ r)))) : STHoare p env (inv [] false ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::array::any».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::any».call h![T, N, Env] h![l, f]) (fun r => inv l.toList r ⋆ [λf ↦ fb]) := by enter_decl steps @@ -491,7 +491,7 @@ theorem any_spec {p T N Env l f fb} theorem any_pure_spec {p T N Env l f fb fEmb} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::any».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::any».call h![T, N, Env] h![l, f]) (fun r => r = l.toList.any fEmb) := by steps [any_spec (inv := fun x r => r = x.any fEmb)] · simp @@ -503,7 +503,7 @@ theorem any_pure_spec {p T N Env l f fb fEmb} rw [←List.any_eq] theorem concat_spec: STHoare p env ⟦⟧ - («std-1.0.0-beta.14::array::concat».call h![T, M, N] h![a₁, a₂]) + («std-1.0.0-beta.25::array::concat».call h![T, M, N] h![a₁, a₂]) (fun r => r.toList = a₁.toList ++ a₂.toList) := by enter_decl steps @@ -624,7 +624,7 @@ theorem sort_via_spec {p T N Env l f fb} {fEmb : T.denote p → T.denote p → Bool} (f_spec : ∀a b, STHoare p env ⟦⟧ (fb h![a, b]) (fun r => r = fEmb a b)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::sort_via».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::sort_via».call h![T, N, Env] h![l, f]) (fun r => List.OrderedBy (fEmb · · = true) r.toList ∧ List.Perm l.toList r.toList) := by enter_decl @@ -736,7 +736,7 @@ theorem sort_via_trans_spec {p T N Env l f fb} (fEmb_trans : Transitive (fEmb · · = true)) (f_spec : ∀a b, STHoare p env ⟦⟧ (fb h![a, b]) (fun r => r = fEmb a b)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::array::sort_via».call h![T, N, Env] h![l, f]) + («std-1.0.0-beta.25::array::sort_via».call h![T, N, Env] h![l, f]) (fun r => List.Pairwise (fEmb · · = true) r.toList ∧ List.Perm l.toList r.toList) := by steps [sort_via_spec (t_eq := t_eq) t_eq_spec f_spec] constructor @@ -771,7 +771,7 @@ theorem sort_spec {p T N l} (t_ord_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Ord.cmp h![] T h![] h![] h![a, b]) (fun r => r = Cmp.Ord.fromOrdering (t_ord_emb a b))) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::array::sort».call h![T, N] h![l]) + («std-1.0.0-beta.25::array::sort».call h![T, N] h![l]) (fun r => List.OrderedBy (Cmp.Ord.le_emb t_ord_emb · ·) r.toList ∧ List.Perm l.toList r.toList) := by enter_decl @@ -809,7 +809,7 @@ theorem sort_trans_spec {p T N l} (t_ord_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Ord.cmp h![] T h![] h![] h![a, b]) (fun r => r = Cmp.Ord.fromOrdering (t_ord_emb a b))) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::array::sort».call h![T, N] h![l]) + («std-1.0.0-beta.25::array::sort».call h![T, N] h![l]) (fun r => List.Pairwise (Cmp.Ord.le_emb t_ord_emb · ·) r.toList ∧ List.Perm l.toList r.toList) := by steps [sort_spec (t_eq := t_eq) t_eq_spec (t_ord := t_ord) t_ord_emb t_ord_spec] diff --git a/stdlib/lampe/Stdlib/Cmp.lean b/stdlib/lampe/Stdlib/Cmp.lean index b8946d5b..4bacea5a 100644 --- a/stdlib/lampe/Stdlib/Cmp.lean +++ b/stdlib/lampe/Stdlib/Cmp.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Mathlib.Order.Compare @@ -12,7 +12,7 @@ import Stdlib.Tuple namespace Lampe.Stdlib.Cmp -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Stdlib namespace Eq @@ -23,19 +23,19 @@ set_option Lampe.pp.STHoare true /-- A shorthand for a call to the `std::cmp::Eq::eq` method. -/ @[reducible] def eq {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::cmp::Eq».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::cmp::Eq».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::cmp::Eq».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::cmp::Eq».«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::cmp::Eq».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::cmp::Eq».«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::cmp::Eq».eq.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::cmp::Eq».eq.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::cmp::Eq».eq.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::cmp::Eq».eq generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::cmp::Eq».eq.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::cmp::Eq».eq generics Self associatedTypes fnGenerics /-- Asserts that the provided `tp` has an implementation of `std::cmp::Eq` in the environment. -/ @[reducible] -def hasImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.14::cmp::Eq».hasImpl env h![] tp +def hasImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.25::cmp::Eq».hasImpl env h![] tp theorem field_eq_spec {p a b} : STHoare p env ⟦⟧ @@ -85,14 +85,6 @@ theorem u8_eq_spec {p a b} steps simp_all -theorem u1_eq_spec {p a b} - : STHoare p env ⟦⟧ - (eq h![] (.u 1) h![] h![] h![a, b]) - fun r : Bool => ⟦r ↔ a = b⟧ := by - resolve_trait - steps - simp_all - theorem i8_eq_spec {p a b} : STHoare p env ⟦⟧ (eq h![] (.i 8) h![] h![] h![a, b]) @@ -245,7 +237,7 @@ theorem slice_eq_pure_spec {p T a b} simp_all theorem string_eq_pure_spec {p N a b} - {u8_eq : «std-1.0.0-beta.14::cmp::Eq».hasImpl env h![] (.u 8)} + {u8_eq : «std-1.0.0-beta.25::cmp::Eq».hasImpl env h![] (.u 8)} : STHoare p env ⟦⟧ (eq h![] (.str N) h![] h![] h![a, b]) (fun r : Bool => ⟦r ↔ a = b⟧) := by @@ -344,7 +336,7 @@ theorem tuple5_eq_pure_spec {p A B C D E self other} theorem ordering_eq_spec {p self other} : STHoare p env ⟦⟧ - (eq h![] («std-1.0.0-beta.14::cmp::Ordering».tp h![]) h![] h![] h![self, other]) + (eq h![] («std-1.0.0-beta.25::cmp::Ordering».tp h![]) h![] h![] h![self, other]) (fun r : Bool => ⟦r ↔ self = other⟧) := by resolve_trait steps @@ -360,20 +352,20 @@ namespace Ord set_option Lampe.pp.Expr true set_option Lampe.pp.STHoare true -abbrev NoirOrdering := «std-1.0.0-beta.14::cmp::Ordering».tp h![] +abbrev NoirOrdering := «std-1.0.0-beta.25::cmp::Ordering».tp h![] /-- A shorthand for a call to the `std::cmp::Ord::cmp` method. -/ @[reducible] def cmp {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::cmp::Ord».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::cmp::Ord».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::cmp::Ord».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::cmp::Ord».cmp.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::cmp::Ord».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::cmp::Ord».cmp.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::cmp::Ord».cmp.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::cmp::Ord».cmp.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::cmp::Ord».cmp.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::cmp::Ord».cmp generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::cmp::Ord».cmp.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::cmp::Ord».cmp generics Self associatedTypes fnGenerics /-- Convert a Lean ordering into a Noir `std::cmp::Ordering`. @@ -422,9 +414,9 @@ lemma fromOrdering_eq_eq_iff {p} {o} : @fromOrdering p o = fromOrdering .eq ↔ norm_num at hp /-- -Convert a Noir `std-1.0.0-beta.14::cmp::Ordering` into a Lean ordering. +Convert a Noir `std-1.0.0-beta.25::cmp::Ordering` into a Lean ordering. -We recommend converting user-provided `std-1.0.0-beta.14::cmp::Ordering`s from the user, and +We recommend converting user-provided `std-1.0.0-beta.25::cmp::Ordering`s from the user, and converting them within the theorem. Note that in order to ensure that `toOrdering` is total, we calculate the input field element that @@ -438,7 +430,7 @@ def toOrdering {p} : (NoirOrdering.denote p) → Ordering /-- Asserts that the provided `tp` has an implementation of `std::cmp::Ord` in the environment. -/ @[reducible] -def hasImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.14::cmp::Ord».hasImpl env h![] tp +def hasImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.25::cmp::Ord».hasImpl env h![] tp /-- A shorthand of the pure semantics for calling an embedded function implementing the ordering @@ -519,7 +511,7 @@ lemma ge_emb_trans {p T} (t_cmp_emb : Tp.comparator p T) (t_cmp_trans : Std.Tran theorem less_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Ordering::less».call h![] h![]) + («std-1.0.0-beta.25::cmp::Ordering::less».call h![] h![]) (fun r => r = fromOrdering .lt) := by enter_decl steps @@ -528,7 +520,7 @@ theorem less_spec {p} theorem equal_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Ordering::equal».call h![] h![]) + («std-1.0.0-beta.25::cmp::Ordering::equal».call h![] h![]) (fun r => r = fromOrdering .eq) := by enter_decl steps @@ -537,7 +529,7 @@ theorem equal_spec {p} theorem greater_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Ordering::greater».call h![] h![]) + («std-1.0.0-beta.25::cmp::Ordering::greater».call h![] h![]) (fun r => r = fromOrdering .gt) := by enter_decl steps @@ -1190,32 +1182,34 @@ theorem tuple3_ord_pure_spec {p A B C self other} steps [Eq.ordering_eq_spec, equal_spec] - step_as - ([result ↦ ⟨NoirOrdering, fromOrdering $ Tuple.compare currentCmp currentSelfInit currentOtherInit⟩]) - (fun _ => [result ↦ ⟨NoirOrdering, fromOrdering $ Tuple.compare (HList.snoc currentCmp C_ord_emb) - (Tuple.snoc currentSelfInit currentSelfTail.1) - (Tuple.snoc currentOtherInit currentOtherTail.1)⟩]) - - · apply STHoare.ite_intro - · intro - steps [C_ord_f] - simp_all only [true_iff, Lens.modify, Option.get_some, Builtin.indexTpl_head_proj, Builtin.indexTpl_tail_proj] - congr - rw [Tuple.compare_snoc_of_init_eq_eq] - rw [fromOrdering_eq_eq_iff] at * - assumption - · intro - steps - simp_all only [Bool.false_eq_true, false_iff] - rw [fromOrdering_eq_eq_iff] at * - - congr 2 - rw [Tuple.compare_snoc_of_init_ne_eq (ordA := C_ord_emb)] - assumption - - steps - subst_vars - rfl + -- The final component's comparison is a value-`if`: when the accumulated + -- ordering is not `equal` it is returned as-is, otherwise the result is the + -- comparison of the last components. + apply STHoare.ite_intro + · intro + steps + subst_vars + simp_all only [Bool.not_eq_true', Bool.false_eq_true, false_iff] + rw [fromOrdering_eq_eq_iff] at * + show fromOrdering (Tuple.compare currentCmp currentSelfInit currentOtherInit) + = fromOrdering (Tuple.compare (HList.snoc currentCmp C_ord_emb) + (Tuple.snoc currentSelfInit currentSelfTail.1) + (Tuple.snoc currentOtherInit currentOtherTail.1)) + congr 1 + rw [Tuple.compare_snoc_of_init_ne_eq (ordA := C_ord_emb)] + assumption + · intro + steps [C_ord_f] + subst_vars + simp_all only [Bool.not_eq_false', true_iff] + show fromOrdering (C_ord_emb currentSelfTail.1 currentOtherTail.1) + = fromOrdering (Tuple.compare (HList.snoc currentCmp C_ord_emb) + (Tuple.snoc currentSelfInit currentSelfTail.1) + (Tuple.snoc currentOtherInit currentOtherTail.1)) + congr 1 + rw [Tuple.compare_snoc_of_init_eq_eq] + rw [fromOrdering_eq_eq_iff] at * + assumption theorem tuple4_ord_pure_spec {p A B C D self other} {A_ord : hasImpl env A} @@ -1312,30 +1306,34 @@ theorem tuple4_ord_pure_spec {p A B C D self other} steps [Eq.ordering_eq_spec, equal_spec] - step_as - ([result ↦ ⟨NoirOrdering, fromOrdering $ Tuple.compare currentCmp currentSelfInit currentOtherInit⟩]) - (fun _ => [result ↦ ⟨NoirOrdering, fromOrdering $ Tuple.compare (HList.snoc currentCmp D_ord_emb) - (Tuple.snoc currentSelfInit currentSelfTail.1) - (Tuple.snoc currentOtherInit currentOtherTail.1)⟩]) - · apply STHoare.ite_intro - · intro - steps [D_ord_f] - simp_all only [true_iff, Lens.modify, Option.get_some, Builtin.indexTpl_head_proj, Builtin.indexTpl_tail_proj] - congr - rw [Tuple.compare_snoc_of_init_eq_eq] - rw [fromOrdering_eq_eq_iff] at * - assumption - · intro - steps - simp_all only [Bool.false_eq_true, false_iff] - rw [fromOrdering_eq_eq_iff] at * - congr 2 - rw [Tuple.compare_snoc_of_init_ne_eq (ordA := D_ord_emb)] - assumption - - steps - subst_vars - rfl + -- The final component's comparison is a value-`if`: when the accumulated + -- ordering is not `equal` it is returned as-is, otherwise the result is the + -- comparison of the last components. + apply STHoare.ite_intro + · intro + steps + subst_vars + simp_all only [Bool.not_eq_true', Bool.false_eq_true, false_iff] + rw [fromOrdering_eq_eq_iff] at * + show fromOrdering (Tuple.compare currentCmp currentSelfInit currentOtherInit) + = fromOrdering (Tuple.compare (HList.snoc currentCmp D_ord_emb) + (Tuple.snoc currentSelfInit currentSelfTail.1) + (Tuple.snoc currentOtherInit currentOtherTail.1)) + congr 1 + rw [Tuple.compare_snoc_of_init_ne_eq (ordA := D_ord_emb)] + assumption + · intro + steps [D_ord_f] + subst_vars + simp_all only [Bool.not_eq_false', true_iff] + show fromOrdering (D_ord_emb currentSelfTail.1 currentOtherTail.1) + = fromOrdering (Tuple.compare (HList.snoc currentCmp D_ord_emb) + (Tuple.snoc currentSelfInit currentSelfTail.1) + (Tuple.snoc currentOtherInit currentOtherTail.1)) + congr 1 + rw [Tuple.compare_snoc_of_init_eq_eq] + rw [fromOrdering_eq_eq_iff] at * + assumption set_option maxHeartbeats 350000 in theorem tuple5_ord_pure_spec {p A B C D E self other} @@ -1465,37 +1463,41 @@ theorem tuple5_ord_pure_spec {p A B C D E self other} steps [Eq.ordering_eq_spec, equal_spec] - step_as - ([result ↦ ⟨NoirOrdering, fromOrdering $ Tuple.compare currentCmp currentSelfInit currentOtherInit⟩]) - (fun _ => [result ↦ ⟨NoirOrdering, fromOrdering $ Tuple.compare (HList.snoc currentCmp E_ord_emb) - (Tuple.snoc currentSelfInit currentSelfTail.1) - (Tuple.snoc currentOtherInit currentOtherTail.1)⟩]) - · apply STHoare.ite_intro - · intro - steps [E_ord_f] - simp_all only [true_iff, Lens.modify, Option.get_some, Builtin.indexTpl_head_proj, Builtin.indexTpl_tail_proj] - congr - rw [Tuple.compare_snoc_of_init_eq_eq] - rw [fromOrdering_eq_eq_iff] at * - assumption - · intro - steps - simp_all only [Bool.false_eq_true, false_iff] - rw [fromOrdering_eq_eq_iff] at * - congr 2 - rw [Tuple.compare_snoc_of_init_ne_eq (ordA := E_ord_emb)] - assumption - - steps - subst_vars - rfl + -- The final component's comparison is a value-`if`: when the accumulated + -- ordering is not `equal` it is returned as-is, otherwise the result is the + -- comparison of the last components. + apply STHoare.ite_intro + · intro + steps + subst_vars + simp_all only [Bool.not_eq_true', Bool.false_eq_true, false_iff] + rw [fromOrdering_eq_eq_iff] at * + show fromOrdering (Tuple.compare currentCmp currentSelfInit currentOtherInit) + = fromOrdering (Tuple.compare (HList.snoc currentCmp E_ord_emb) + (Tuple.snoc currentSelfInit currentSelfTail.1) + (Tuple.snoc currentOtherInit currentOtherTail.1)) + congr 1 + rw [Tuple.compare_snoc_of_init_ne_eq (ordA := E_ord_emb)] + assumption + · intro + steps [E_ord_f] + subst_vars + simp_all only [Bool.not_eq_false', true_iff] + show fromOrdering (E_ord_emb currentSelfTail.1 currentOtherTail.1) + = fromOrdering (Tuple.compare (HList.snoc currentCmp E_ord_emb) + (Tuple.snoc currentSelfInit currentSelfTail.1) + (Tuple.snoc currentOtherInit currentOtherTail.1)) + congr 1 + rw [Tuple.compare_snoc_of_init_eq_eq] + rw [fromOrdering_eq_eq_iff] at * + assumption theorem max_pure_spec {p T v1 v2} {T_ord : hasImpl env T} {T_ord_emb : Tp.comparator p T} {T_ord_f : ∀a b, pureOrdSemantics env T_ord_emb a b} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::max».call h![T] h![v1, v2]) + («std-1.0.0-beta.25::cmp::max».call h![T] h![v1, v2]) (fun r => r = if T_ord_emb v1 v2 = .gt then v1 else v2) := by enter_decl step_as (⟦⟧) (fun r : Bool => r = (T_ord_emb v1 v2 = .gt)) @@ -1520,7 +1522,7 @@ theorem min_pure_spec {p T v1 v2} {T_ord_emb : Tp.comparator p T} {T_ord_f : ∀a b, pureOrdSemantics env T_ord_emb a b} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::min».call h![T] h![v1, v2]) + («std-1.0.0-beta.25::cmp::min».call h![T] h![v1, v2]) (fun r => r = if T_ord_emb v1 v2 = .gt then v2 else v1) := by enter_decl step_as (⟦⟧) (fun r : Bool => r = (T_ord_emb v1 v2 = .gt)) diff --git a/stdlib/lampe/Stdlib/Collections/BoundedVec/Core.lean b/stdlib/lampe/Stdlib/Collections/BoundedVec/Core.lean index 512644a0..c700c3a6 100644 --- a/stdlib/lampe/Stdlib/Collections/BoundedVec/Core.lean +++ b/stdlib/lampe/Stdlib/Collections/BoundedVec/Core.lean @@ -1,9 +1,9 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Collections.BoundedVec -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» /-! Core semantic interface for Noir `collections::bounded_vec::BoundedVec`. @@ -17,7 +17,7 @@ This file intentionally contains no Hoare triples and no "constructor-style" upd -/ abbrev bvTp (T : Tp) (MaxLen : U 32) : Tp := - «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec».tp h![T, MaxLen] + «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec».tp h![T, MaxLen] abbrev Repr (p : Prime) (T : Tp) (MaxLen : U 32) : Type := Tp.denote p (bvTp T MaxLen) @@ -372,6 +372,20 @@ lemma embed_eq_dropLast_of_pop_update {p T MaxLen} {v v' : Repr p T MaxLen} have hv : (len v').toNat = (len v - 1).toNat := by simp [hlen] rw [hv, htoNat_sub] +/-- Variant of `embed_eq_dropLast_of_pop_update` for beta.25's `pop`, which no +longer zeroes the popped slot: the storage is unchanged. -/ +lemma embed_eq_dropLast_of_pop_update' {p T MaxLen} {v v' : Repr p T MaxLen} + (hb : bounded v) (hnonempty : embed v ≠ []) + (hnonzero : (0 : U 32) < len v) + (hlen : len v' = len v - 1) + (hstorage : storage v' = storage v) : + embed v' = (embed v).dropLast := by + have htoNat_sub := toNat_len_sub_one (v := v) hnonzero + rw [embed_dropLast_eq_take_pred hb hnonempty] + simp only [embed, active, hstorage] + have hv : (len v').toNat = (len v - 1).toNat := by simp [hlen] + rw [hv, htoNat_sub] + section BVNat @[scoped simp] lemma u32_toNat_lt (x : U 32) : x.toNat < 2 ^ 32 := diff --git a/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean b/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean index fa17199c..83c67698 100644 --- a/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean +++ b/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean @@ -2,7 +2,7 @@ import Stdlib.Collections.BoundedVec.Methods namespace Lampe.Stdlib.Collections.BoundedVec -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» /-! Higher-order method specs for Noir `BoundedVec`: `map` and `mapi` (pure variants). @@ -12,7 +12,7 @@ This module is imported by `Stdlib.Collections.BoundedVec` as part of the public private theorem len_concrete_spec' {p T MaxLen self} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] h![self]) + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] h![self]) (fun r => r = len self) := by enter_decl steps @@ -21,7 +21,7 @@ private theorem len_concrete_spec' {p T MaxLen self} : private theorem get_unchecked_concrete_spec' {p T MaxLen self index} (hindex : index.toNat < MaxLen.toNat) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get_unchecked».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked».call h![T, MaxLen] h![self, index]) (fun r => r = (storage self)[index.toNat]'hindex) := by enter_decl @@ -143,13 +143,13 @@ private theorem mapLike_constrained_loop_effectful_spec expr!![ { let lenFn = - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::len» + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len» as λ(splice!(bvTp T MaxLen)) -> u32); let selfLen = (lenFn as λ(splice!(bvTp T MaxLen)) -> u32)(self); let cond = (#_uLt returning bool)(i, selfLen); if cond then { let getUncheckedFn = - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get_unchecked» + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked» as λ(splice!(bvTp T MaxLen), u32) -> T); let elem = (getUncheckedFn as λ(splice!(bvTp T MaxLen), u32) -> T)(self, i); let tmp = splice!(Expr.call Args Out f (mkArgs i elem)); @@ -337,7 +337,7 @@ theorem map_effectful_spec {p T MaxLen Out Env self f fb} (ip ++ [e] <+: embed self) → STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ++ [r]))) : STHoare p env (inv [] [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::map».call h![T, MaxLen, Out, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::map».call h![T, MaxLen, Out, Env] h![self, f]) (fun r => ⟦wellFormed r⟧ ⋆ inv (embed self) (embed r)) := by enter_decl @@ -392,7 +392,7 @@ theorem mapi_effectful_spec {p T MaxLen Out Env self f fb} i.toNat = ip.length → STHoare p env (inv ip op) (fb h![i, e]) (fun r => inv (ip ++ [e]) (op ++ [r]))) : STHoare p env (inv [] [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::mapi».call h![T, MaxLen, Out, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::mapi».call h![T, MaxLen, Out, Env] h![self, f]) (fun r => ⟦wellFormed r⟧ ⋆ inv (embed self) (embed r)) := by enter_decl @@ -444,7 +444,7 @@ theorem map_pure_spec {p T MaxLen Out Env self f fb fEmb} (hwf_self : wellFormed self) (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::map».call h![T, MaxLen, Out, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::map».call h![T, MaxLen, Out, Env] h![self, f]) (fun r => wellFormed r ∧ embed r = (embed self).map fEmb) := by -- Corollary of `map_effectful_spec` with the pure invariant `inv ip op := ⟦op = ip.map fEmb⟧`. @@ -482,7 +482,7 @@ theorem mapi_pure_spec {p T MaxLen Out Env self f fb fEmb} (hi : i.toNat < (embed self).length) → STHoare p env ⟦⟧ (fb h![i, a]) (fun r => r = fEmb i.toNat a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::mapi».call h![T, MaxLen, Out, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::mapi».call h![T, MaxLen, Out, Env] h![self, f]) (fun r => wellFormed r ∧ embed r = (embed self).mapIdx fEmb) := by -- Corollary of `mapi_effectful_spec` with the pure invariant `inv ip op := ⟦op = ip.mapIdx fEmb⟧`. @@ -532,7 +532,7 @@ theorem any_spec {p T MaxLen Env self f fb} STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ∨ r))) : STHoare p env (inv [] false ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::any».call h![T, MaxLen, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::any».call h![T, MaxLen, Env] h![self, f]) (fun r => inv (embed self) r ⋆ [λf ↦ fb]) := by enter_decl @@ -691,7 +691,7 @@ theorem any_pure_spec {p T MaxLen Env self f fb fEmb} (hwf_self : wellFormed self) (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::any».call h![T, MaxLen, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::any».call h![T, MaxLen, Env] h![self, f]) (fun r => r = (embed self).any fEmb) := by -- Specialize `any_spec` with a pure invariant `op = ip.any fEmb`. @@ -740,13 +740,13 @@ private theorem forEachLike_constrained_loop_spec expr!![ { let lenFn = - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::len» + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len» as λ(splice!(bvTp T MaxLen)) -> u32); let selfLen = (lenFn as λ(splice!(bvTp T MaxLen)) -> u32)(self); let cond = (#_uLt returning bool)(i, selfLen); if cond then { let getUncheckedFn = - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get_unchecked» + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked» as λ(splice!(bvTp T MaxLen), u32) -> T); let elem = (getUncheckedFn as λ(splice!(bvTp T MaxLen), u32) -> T)(self, i); splice!(Expr.call Args Tp.unit f (mkArgs i elem)); @@ -847,7 +847,7 @@ theorem for_each_spec {T Env p MaxLen self f fb} STHoare p env (Inv lp) (fb h![e]) (fun _ => Inv (lp ++ [e]))) : STHoare p env (Inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::for_each».call h![T, MaxLen, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::for_each».call h![T, MaxLen, Env] h![self, f]) (fun _ => Inv (embed self) ⋆ [λf ↦ fb]) := by enter_decl @@ -874,7 +874,7 @@ theorem for_eachi_spec {T Env p MaxLen self f fb} STHoare p env (inv ip) (fb h![ip.length, e]) (fun _ => inv (ip ++ [e]))) : STHoare p env (inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::for_eachi».call h![T, MaxLen, Env] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::for_eachi».call h![T, MaxLen, Env] h![self, f]) (fun _ => inv (embed self) ⋆ [λf ↦ fb]) := by enter_decl diff --git a/stdlib/lampe/Stdlib/Collections/BoundedVec/Methods.lean b/stdlib/lampe/Stdlib/Collections/BoundedVec/Methods.lean index cf851cb7..97e0a850 100644 --- a/stdlib/lampe/Stdlib/Collections/BoundedVec/Methods.lean +++ b/stdlib/lampe/Stdlib/Collections/BoundedVec/Methods.lean @@ -1,4 +1,5 @@ import Stdlib.Collections.BoundedVec.Core +import Stdlib.Cmp namespace Lampe @@ -25,7 +26,7 @@ end Lampe namespace Lampe.Stdlib.Collections.BoundedVec -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» /-! `collections::bounded_vec` @@ -111,54 +112,63 @@ private theorem SLP.singleton_entails_exists_star_lift exact ⟨v, st, ∅, by simp, by simp, hst, h, rfl⟩ private theorem get_unchecked_concrete_spec {p T MaxLen self index} + {selfRef : Ref (bvTp T MaxLen)} (hindex : index.toNat < MaxLen.toNat) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get_unchecked».call h![T, MaxLen] - h![self, index]) - (fun r => r = (storage self)[index.toNat]'hindex) := by + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked».call h![T, MaxLen] + h![selfRef, index]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + ⋆ ⟦r = (storage self)[index.toNat]'hindex⟧) := by enter_decl steps - simpa [storage] + simp_all [storage, List.Vector.get, List.Vector.getElem_def, BitVec.setWidth_eq] + try rfl private theorem get_concrete_spec {p T MaxLen self index} + {selfRef : Ref (bvTp T MaxLen)} (hbounded : bounded self) (hindex : index.toNat < (len self).toNat) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get».call h![T, MaxLen] - h![self, index]) - (fun r => r = (storage self)[index.toNat]'(lt_of_lt_of_le hindex hbounded)) := by + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get».call h![T, MaxLen] + h![selfRef, index]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + ⋆ ⟦r = (storage self)[index.toNat]'(lt_of_lt_of_le hindex hbounded)⟧) := by have hindex_max : index.toNat < MaxLen.toNat := lt_of_lt_of_le hindex hbounded enter_decl steps [get_unchecked_concrete_spec (p := p) (T := T) (MaxLen := MaxLen) (self := self) (index := index) (hindex := hindex_max)] - assumption + simp_all [storage] theorem get_unchecked_spec {p T MaxLen self index} + {selfRef : Ref (bvTp T MaxLen)} (hindex : index.toNat < MaxLen.toNat) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get_unchecked».call h![T, MaxLen] - h![self, index]) - (fun r => ∀ h : index.toNat < (embed self).length, r = (embed self)[index.toNat]'h) := by + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked».call h![T, MaxLen] + h![selfRef, index]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + ⋆ ⟦∀ h : index.toNat < (embed self).length, r = (embed self)[index.toNat]'h⟧) := by have hstorage : index.toNat < (storage self).toList.length := by simpa [storage, List.Vector.toList_length] using hindex exact STHoare.consequence_post (get_unchecked_concrete_spec (p := p) (T := T) (MaxLen := MaxLen) (self := self) (index := index) (hindex := hindex)) - fun r st ⟨hr, hst⟩ => ⟨fun hlt => by + fun r => SLP.star_mono_l (SLP.lift_mono fun hr hlt => by have hr_list : r = (storage self).toList[index.toNat]'hstorage := by simpa [List.Vector.getElem_def] using hr have hx_rhs : (embed self)[index.toNat]'hlt = (storage self).toList[index.toNat]'hstorage := by simpa using (embed_getElem_toList (self := self) (i := index.toNat) (hxs := hlt) (hstorage := hstorage)) - exact hr_list.trans hx_rhs.symm, hst⟩ + exact hr_list.trans hx_rhs.symm) theorem get_spec {p T MaxLen self index} + {selfRef : Ref (bvTp T MaxLen)} (hwf : wellFormed self) (hindex : index.toNat < (embed self).length) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get».call h![T, MaxLen] - h![self, index]) - (fun r => r = (embed self)[index.toNat]'hindex) := by + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get».call h![T, MaxLen] + h![selfRef, index]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + ⋆ ⟦r = (embed self)[index.toNat]'hindex⟧) := by have hb : bounded self := bounded_of_wellFormed hwf have hlen : (embed self).length = (len self).toNat := hwf have hindex_len : index.toNat < (len self).toNat := by @@ -169,26 +179,19 @@ theorem get_spec {p T MaxLen self index} have hx_rhs : (embed self)[index.toNat]'hindex = (storage self).toList[index.toNat]'hstorage := by simpa using (embed_getElem_toList (self := self) (i := index.toNat) (hxs := hindex) (hstorage := hstorage)) - have hprec : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get».call h![T, MaxLen] - h![self, index]) - (fun r => r = (storage self)[index.toNat]'hindex_max) := by - simpa using - (get_concrete_spec (p := p) (T := T) (MaxLen := MaxLen) (self := self) (index := index) - (hbounded := hb) (hindex := hindex_len)) - - exact STHoare.consequence_post hprec fun r st ⟨hr, hst⟩ => - ⟨by + exact STHoare.consequence_post + (get_concrete_spec (p := p) (T := T) (MaxLen := MaxLen) (self := self) (index := index) + (hbounded := hb) (hindex := hindex_len)) + fun r => SLP.star_mono_l (SLP.lift_mono fun hr => by have hr_list : r = (storage self).toList[index.toNat]'hstorage := by simpa [List.Vector.getElem_def] using hr - exact hr_list.trans hx_rhs.symm, hst⟩ + exact hr_list.trans hx_rhs.symm) private theorem set_unchecked_concrete_spec {p T MaxLen selfRef self index value} (hindex : index.toNat < MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::set_unchecked».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set_unchecked».call h![T, MaxLen] h![selfRef, index, value]) (fun _ => ∃∃ v', @@ -199,7 +202,7 @@ private theorem set_unchecked_concrete_spec {p T MaxLen selfRef self index value have hstate : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::set_unchecked».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set_unchecked».call h![T, MaxLen] h![selfRef, index, value]) (fun _ => [selfRef ↦ ⟨bvTp T MaxLen, vUpd⟩]) := by @@ -221,7 +224,7 @@ theorem set_unchecked_spec {p T MaxLen selfRef self index value} (hindex : index.toNat < MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::set_unchecked».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set_unchecked».call h![T, MaxLen] h![selfRef, index, value]) (fun _ => BV (MaxLen := MaxLen) selfRef ((embed self).set index.toNat value)) := by have hb : bounded self := bounded_of_wellFormed hwf @@ -242,7 +245,7 @@ private theorem set_concrete_spec {p T MaxLen selfRef self index value} (hindex : index.toNat < (len self).toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::set».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set».call h![T, MaxLen] h![selfRef, index, value]) (fun _ => ∃∃ v', @@ -268,7 +271,7 @@ theorem set_spec {p T MaxLen selfRef self index value} (hindex : index.toNat < (embed self).length) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::set».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set».call h![T, MaxLen] h![selfRef, index, value]) (fun _ => BV (MaxLen := MaxLen) selfRef ((embed self).set index.toNat value)) := by have hbounded : bounded self := bounded_of_wellFormed hwf @@ -300,7 +303,7 @@ private theorem push_concrete_spec {p T MaxLen selfRef self elem} (hpush : (len self).toNat < MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::push».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::push».call h![T, MaxLen] h![selfRef, elem]) (fun _ => ∃∃ v', @@ -314,21 +317,15 @@ private theorem push_concrete_spec {p T MaxLen selfRef self elem} have hstate : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::push».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::push».call h![T, MaxLen] h![selfRef, elem]) (fun _ => [selfRef ↦ ⟨bvTp T MaxLen, vUpd⟩]) := by enter_decl steps - apply (STHoare.letIn_intro - (Q := fun _ => - [selfRef ↦ ⟨bvTp T MaxLen, vStor⟩])) - · - steps_named - simp [vStor, storage, len] - · - intro _ - steps + congr 1 + simp [vUpd, vStor, storage, len, BitVec.natCast_eq_ofNat] + try rfl have hlen : len vUpd = len self + 1 := by unfold vUpd len; simp [Builtin.index_replaced_tpl] have hstorage : @@ -346,7 +343,7 @@ theorem push_spec {p T MaxLen selfRef self elem} (hspace : (embed self).length < MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::push».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::push».call h![T, MaxLen] h![selfRef, elem]) (fun _ => BV (MaxLen := MaxLen) selfRef (embed self ++ [elem])) := by have hbounded : bounded self := bounded_of_wellFormed hwf @@ -373,31 +370,34 @@ theorem push_spec {p T MaxLen selfRef self elem} (hb := hbounded) (hpush := hpush) (hlen := hlen') (hstorage := hstorage') exact ⟨hwf', hembed'⟩ -private theorem len_concrete_spec {p T MaxLen self} : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] h![self]) - (fun r => r = len self) := by +private theorem len_concrete_spec {p T MaxLen self} + {selfRef : Ref (bvTp T MaxLen)} : + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] + h![selfRef]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ ⟦r = len self⟧) := by enter_decl steps - simpa [len] + simp_all [len] theorem len_spec {p T MaxLen self} + {selfRef : Ref (bvTp T MaxLen)} (hwf : wellFormed self) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] h![self]) - (fun r => r.toNat = (embed self).length) := by + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] + h![selfRef]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ ⟦r.toNat = (embed self).length⟧) := by have hlen : (embed self).length = (len self).toNat := hwf exact STHoare.consequence_post (len_concrete_spec (p := p) (T := T) (MaxLen := MaxLen) (self := self)) - fun r st ⟨hr, hst⟩ => - ⟨by - have hrt : r.toNat = (len self).toNat := by - simpa using congrArg BitVec.toNat hr - exact hrt.trans hlen.symm, hst⟩ + fun r => SLP.star_mono_l (SLP.lift_mono fun hr => by + have hrt : r.toNat = (len self).toNat := by + simpa using congrArg BitVec.toNat hr + exact hrt.trans hlen.symm) theorem max_len_spec {p T MaxLen self} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::max_len».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::max_len».call h![T, MaxLen] h![self]) (fun r => r = MaxLen) := by enter_decl @@ -406,7 +406,7 @@ theorem max_len_spec {p T MaxLen self} : theorem storage_spec {p T MaxLen self} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::storage».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::storage».call h![T, MaxLen] h![self]) (fun r => r = storage self) := by enter_decl @@ -415,13 +415,13 @@ theorem storage_spec {p T MaxLen self} : theorem new_spec {p T MaxLen} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::new».call h![T, MaxLen] h![]) + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::new».call h![T, MaxLen] h![]) (fun r => wellFormed r ∧ len r = 0 ∧ embed r = []) := by enter_decl steps_named set r : Repr p T MaxLen := HList.toTuple p h![List.Vector.replicate (BitVec.toNat MaxLen) (Tp.zero p T), (↑0 : U 32)] - (some «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec».name) + (some «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec».name) have hlen0 : len r = 0 := rfl refine And.intro ?_ (And.intro ?_ ?_) · exact show wellFormed r by @@ -503,59 +503,30 @@ private theorem pop_concrete_spec {p T MaxLen selfRef self} (hlast : (len self - (1 : U 32)).toNat < MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::pop».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::pop».call h![T, MaxLen] h![selfRef]) (fun r => ∃∃ v', [selfRef ↦ ⟨bvTp T MaxLen, v'⟩] ⋆ ⟦len v' = len self - (1 : U 32) ∧ - storage v' = - (storage self).set ⟨(len self - (1 : U 32)).toNat, hlast⟩ (Tp.zero p T) ∧ + storage v' = storage self ∧ r = (storage self)[(len self - (1 : U 32)).toNat]'hlast⟧) := by enter_decl steps - apply (STHoare.letIn_intro - (Q := fun _ => - (∃∃ v', - [selfRef ↦ ⟨bvTp T MaxLen, v'⟩] ⋆ - ⟦len v' = len self - (1 : U 32) ∧ - storage v' = - (storage self).set ⟨(len self - (1 : U 32)).toNat, hlast⟩ (Tp.zero p T)⟧ : SLP (State p)))) - · - steps_named - cases self - simp [len, storage] - -- After `simp [len, storage]`, both conjuncts close by `rfl` - -- (simp has already normalized `↑1` to `1#32` via the `coe_one_u32'` simp lemma). - exact ⟨rfl, rfl⟩ - · - intro r - steps_named as [v, hproj] - have ha : - len v = len self - (1 : U 32) ∧ - storage v = - (storage self).set ⟨BitVec.toNat (len self - (1 : U 32)), hlast⟩ (Tp.zero p T) := by - simpa using (by - assumption : - len v = len self - (1 : U 32) ∧ - storage v = - (storage self).set ⟨BitVec.toNat (len self - (1 : U 32)), hlast⟩ (Tp.zero p T)) - rcases ha with ⟨hlen', hstorage'⟩ - refine ⟨?_, ?_, ?_⟩ - · simpa using hlen' - · simpa using hstorage' - · - simp [storage, len] - set i : Nat := (4294967295 + BitVec.toNat self.2.1) % 4294967296 - change List.Vector.get self.1 ⟨i, ?_⟩ = List.Vector.get self.1 ⟨i, ?_⟩ - exact vector_get_proof_irrel (v := self.1) (i := i) _ _ + cases self + refine ⟨?_, ?_, ?_⟩ + all_goals first + | rfl + | (simp_all [len, storage, List.Vector.get, List.Vector.getElem_def, + BitVec.setWidth_eq, BitVec.natCast_eq_ofNat] + try rfl) theorem pop_spec {p T MaxLen selfRef self} (hwf : wellFormed self) (hnonempty : embed self ≠ []) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::pop».call h![T, MaxLen] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::pop».call h![T, MaxLen] h![selfRef]) (fun r => ∃∃ v', @@ -574,35 +545,20 @@ theorem pop_spec {p T MaxLen selfRef self} simpa [bounded] using this have hwf' : wellFormed v' := wellFormed_of_bounded hb' have hembed' : embed v' = (embed self).dropLast := by - exact embed_eq_dropLast_of_pop_update (v := self) (v' := v') + exact embed_eq_dropLast_of_pop_update' (v := self) (v' := v') (hb := hbounded) (hnonempty := hnonempty) (hnonzero := hnonzero) - (hlen := hlen') (hlast := hlast) (hstorage := hstorage') + (hlen := hlen') (hstorage := hstorage') have hret' : r = (embed self).getLast hnonempty := by have hlastEq := embed_getLast_eq_storage_get (v := self) (hb := hbounded) (hnonempty := hnonempty) (hnonzero := hnonzero) (hlast := hlast) simp [hret, hlastEq] exact ⟨hwf', hembed', hret'⟩ -theorem from_parts_unchecked_spec {p T MaxLen array l} - (hb : l.toNat ≤ MaxLen.toNat) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::from_parts_unchecked».call - h![T, MaxLen] h![array, l]) - (fun r => wellFormed r ∧ embed r = List.take l.toNat array.toList) := by - have hble : l ≤ MaxLen := by - rw [BitVec.le_def]; simpa using hb - enter_decl - steps_named - constructor - · - exact wellFormed_of_bounded (by simpa [bounded, len] using hb) - · rfl - theorem extend_from_array_spec {p T MaxLen Len selfRef self array} (hspace : (len self).toNat + Len.toNat ≤ MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::extend_from_array».call + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::extend_from_array».call h![T, MaxLen, Len] h![selfRef, array]) (fun _ => ∃∃ v', @@ -657,7 +613,7 @@ theorem extend_from_array_spec {p T MaxLen Len selfRef self array} theorem from_array_spec {p T MaxLen Len array} (hbounded : Len.toNat ≤ MaxLen.toNat) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::from_array».call + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::from_array».call h![T, MaxLen, Len] h![array]) (fun r => wellFormed r ∧ embed r = array.toList) := by enter_decl @@ -691,7 +647,7 @@ theorem extend_from_vector_spec {p T MaxLen selfRef self slice} (hspace : (len self).toNat + slice.length ≤ MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::extend_from_vector».call + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::extend_from_vector».call h![T, MaxLen] h![selfRef, slice]) (fun _ => ∃∃ v', @@ -736,12 +692,71 @@ theorem extend_from_vector_spec {p T MaxLen selfRef self slice} (by simpa [len, BitVec.toNat_add_of_lt hsum_lt]) (by simpa [hcastLenNat] using (BitVec.le_def).1 hnew_le) +private theorem min_u32_spec {p} {a b : U 32} : + STHoare p env ⟦⟧ + («std-1.0.0-beta.25::cmp::min».call h![.u 32] h![a, b]) + (fun r => r.toNat = Nat.min a.toNat b.toNat) := by + have hcmp_gt_iff : (compareOfLessAndEq a b = Ordering.gt) ↔ b < a := by + unfold compareOfLessAndEq + constructor + · intro h + split at h + · simp_all + · split at h + · simp_all + · rename_i hnlt hne + rw [BitVec.lt_def] + rcases Nat.lt_trichotomy (BitVec.toNat a) (BitVec.toNat b) with hlt | heq | hgt + · exact absurd (by rw [BitVec.lt_def]; exact hlt) hnlt + · exact absurd (BitVec.eq_of_toNat_eq heq) hne + · exact hgt + · intro h + have hnlt : ¬ a < b := by + rw [BitVec.lt_def] at h ⊢ + omega + have hne : ¬ a = b := by + rintro rfl + rw [BitVec.lt_def] at h + omega + simp [hnlt, hne] + enter_decl + step_as (⟦⟧) (fun r : Bool => r = (compare a b = .gt)) + · steps [Lampe.Stdlib.Cmp.Ord.u32_ord_spec, Lampe.Stdlib.Cmp.Ord.greater_spec, + Lampe.Stdlib.Cmp.Eq.ordering_eq_spec] + generalize compare a b = t at * + cases t + case h₁.a.gt => simp_all + all_goals + simp_all only [reduceCtorEq, eq_iff_iff, iff_false] + by_contra h + apply Lampe.Stdlib.Cmp.Ord.fromOrdering_inj at h + simp at h + apply STHoare.ite_intro + · intro h + steps + have hba : b < a := by + have hgt : compare a b = Ordering.gt := by simp_all + exact hcmp_gt_iff.mp (by simpa [compare, instOrdBitVec] using hgt) + rw [BitVec.lt_def] at hba + simp_all [Nat.min_eq_right (Nat.le_of_lt hba)] + · intro h + steps + have hab : a ≤ b := by + have hng : ¬(compare a b = Ordering.gt) := by simp_all + have hnba : ¬(b < a) := fun hba => + hng (by simpa [compare, instOrdBitVec] using hcmp_gt_iff.mpr hba) + rw [BitVec.le_def] + rw [BitVec.lt_def] at hnba + omega + rw [BitVec.le_def] at hab + simp_all [Nat.min_eq_left hab] + theorem extend_from_bounded_vec_spec {p T MaxLen Len selfRef self vec} (hwfVec : wellFormed (p := p) (T := T) (MaxLen := Len) vec) (hspace : (len self).toNat + (len vec).toNat ≤ MaxLen.toNat) : STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::extend_from_bounded_vec».call + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::extend_from_bounded_vec».call h![T, MaxLen, Len] h![selfRef, vec]) (fun _ => ∃∃ v', @@ -772,7 +787,7 @@ theorem extend_from_bounded_vec_spec {p T MaxLen Len selfRef self vec} apply STHoare.ite_intro_of_false · simp · - steps + steps [min_u32_spec] loop_inv nat (fun i _ _ => ∃∃ v : Repr p T MaxLen, [selfRef ↦ ⟨bvTp T MaxLen, v⟩] ⋆ @@ -786,7 +801,8 @@ theorem extend_from_bounded_vec_spec {p T MaxLen Len selfRef self vec} steps all_goals rename_i hinv all_goals (have hlenV := hinv.1; have htakeV := hinv.2) - all_goals have hi32 : i < 2 ^ 32 := lt_two_pow_of_lt_maxLen (MaxLen := Len) hhi + all_goals have hiLen : i < BitVec.toNat (Len : U 32) := by simp_all [Nat.lt_min] + all_goals have hi32 : i < 2 ^ 32 := lt_two_pow_of_lt_maxLen (MaxLen := Len) hiLen -- ite: if i < append_len then { copy } else { skip } apply STHoare.ite_intro · -- true branch: i < append_len @@ -805,23 +821,17 @@ theorem extend_from_bounded_vec_spec {p T MaxLen Len selfRef self vec} (Nat.add_lt_add_left hltVec _) hspace steps [get_unchecked_spec (p := p) (T := T) (MaxLen := Len) (self := vec) - (index := BitVec.ofNatLT i - (lt_two_pow_of_lt_maxLen (MaxLen := Len) hhi)) + (index := BitVec.ofNatLT i hi32) (hindex := by - simpa [nat_mod_4294967296 hi32] using hhi)] - subst_vars - -- rename_i names inaccessible variables in declaration order - rename_i r1 r2 r3 r4 r5 r6 r7 - -- Try calling each to find the forall + simpa [nat_mod_4294967296 hi32] using hiLen)] simp [hmin_i, hmin_succ] at htakeV ⊢ have hiEmb : i < (embed vec).length := hlenVec ▸ hltVec - have helem := r3 (by + rename (∀ h : _ < (embed vec).length, _ = (embed vec)[_]'h) => helem_forall + have helem := helem_forall (by simpa [nat_mod_4294967296 hi32] using hiEmb) generalize_proofs at helem simp [nat_mod_4294967296 hi32] at helem - -- helem : = (embed vec)[i]'... - -- Rewrite the element value in the goal simp only [helem] extend_loop_step hlenV htakeV hi32 hiMax hMax_lt hiEmb · -- false branch: i >= append_len (skip) @@ -845,9 +855,12 @@ theorem extend_from_bounded_vec_spec {p T MaxLen Len selfRef self vec} have hlenVPost := hinvPost.1; have htakeVPost := hinvPost.2 constructor · simpa [len] using hlenVPost - · have htake_full : List.take (len vec).toNat (embed vec) = embed vec := by + · have hvec_le_min : + (len vec).toNat ≤ Nat.min (BitVec.toNat (Len : U 32)) (BitVec.toNat MaxLen) := + Nat.le_min.mpr ⟨hbVec, le_trans (Nat.le_add_left _ _) hspace⟩ + have htake_full : List.take (len vec).toNat (embed vec) = embed vec := by simp [hlenVec] - simpa [Nat.min_eq_right hbVec, htake_full] using htakeVPost + simp_all [Nat.min_eq_right, htake_full] · -- finalization: update len intro _ -- Use more names to capture all intermediate vars properly @@ -864,7 +877,7 @@ theorem extend_from_bounded_vec_spec {p T MaxLen Len selfRef self vec} theorem from_parts_spec {p T MaxLen arr l} (hb : l.toNat ≤ MaxLen.toNat) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::from_parts».call + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::from_parts».call h![T, MaxLen] h![arr, l]) (fun r => wellFormed r ∧ embed r = List.take l.toNat arr.toList) := by have hble : l ≤ MaxLen := by @@ -872,74 +885,11 @@ theorem from_parts_spec {p T MaxLen arr l} enter_decl steps all_goals (try exact ()) - apply (STHoare.letIn_intro - (Q := fun _ => - ∃∃ a : List.Vector (T.denote p) MaxLen.toNat, - [array ↦ ⟨Tp.array T MaxLen, a⟩] ⋆ - ⟦List.take l.toNat a.toList = List.take l.toNat arr.toList⟧)) - · - apply STHoare.ite_intro_of_false - · simp - · - steps - loop_inv nat (fun _ _ _ => - ∃∃ a : List.Vector (T.denote p) MaxLen.toNat, - [array ↦ ⟨Tp.array T MaxLen, a⟩] ⋆ - ⟦List.take l.toNat a.toList = List.take l.toNat arr.toList⟧) - · sl; simp - · simp - · intro i hlo hhi - apply (STHoare.letIn_intro - (Q := fun b => - ∃∃ a : List.Vector (T.denote p) MaxLen.toNat, - [array ↦ ⟨Tp.array T MaxLen, a⟩] ⋆ - ⟦List.take l.toNat a.toList = List.take l.toNat arr.toList ∧ - b = decide (l.toNat ≤ i)⟧)) - · apply Lampe.Steps.pull_exi - intro a - apply (STHoare.consequence - (H₁ := [array ↦ ⟨Tp.array T MaxLen, a⟩] ⋆ - ⟦List.take l.toNat a.toList = - List.take l.toNat arr.toList⟧) - (Q₁ := fun b => - [array ↦ ⟨Tp.array T MaxLen, a⟩] ⋆ - ⟦List.take l.toNat a.toList = - List.take l.toNat arr.toList ∧ - b = decide (l.toNat ≤ i)⟧)) - · exact SLP.entails_self - · intro b; sl; assumption - · steps [STHoare.genericTotalPureBuiltin_intro - (b := Builtin.uGeq) (h := rfl)] - simp_all only [ - BitVec.toNat_ofNatLT, BitVec.le_def, ge_iff_le] - simp - · intro b - apply STHoare.ite_intro - · intro hbTrue - steps - generalize_proofs - rename_i a hpre h_isSome u pf - rcases hpre with ⟨htake, hbdec⟩ - have hli : l.toNat ≤ i := - (decide_eq_true_iff).1 (hbdec ▸ hbTrue) - simp_all only [BitVec.toNat_ofNatLT, Lens.modify, Access.modify] - simp - have hdrop : - List.take l.toNat (a.toList.set i (Tp.zero p T)) = - List.take l.toNat a.toList := by - rw [List.take_set] - exact List.set_eq_of_length_le (by - simp [Nat.min_eq_left hb]; exact hli) - simpa [hdrop] using htake - · intro hbFalse - steps - generalize_proofs - rename_i a hpre u - exact hpre.1 - · steps; assumption - · intro _ - steps_named as [a, hinv] - exact ⟨wellFormed_of_bounded (by simpa [bounded, len] using hb), - by simpa using hinv⟩ + subst_vars + constructor + · exact wellFormed_of_bounded + (by simpa [bounded, len, Builtin.indexTpl, HList.toTuple] using hb) + · simp [embed, active, len, storage, Builtin.indexTpl, HList.toTuple] + try rfl end Lampe.Stdlib.Collections.BoundedVec diff --git a/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean b/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean index 7cc2f7df..3c3a135f 100644 --- a/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean +++ b/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean @@ -4,7 +4,7 @@ import Stdlib.Convert namespace Lampe.Stdlib.Collections.BoundedVec -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» /-! Trait-method specs for `BoundedVec`. @@ -14,7 +14,7 @@ the extracted stdlib. We provide a first version of their specs here; proofs are -/ theorem eq_trait_spec {p T MaxLen self other} - {t_eq : «std-1.0.0-beta.14::cmp::Eq».hasImpl env h![] T} + {t_eq : «std-1.0.0-beta.25::cmp::Eq».hasImpl env h![] T} {t_eq_f : ∀ a b, STHoare p env ⟦⟧ (Lampe.Stdlib.Cmp.Eq.eq h![] T h![] h![] h![a, b]) diff --git a/stdlib/lampe/Stdlib/Collections/Map.lean b/stdlib/lampe/Stdlib/Collections/Map.lean deleted file mode 100644 index e002de88..00000000 --- a/stdlib/lampe/Stdlib/Collections/Map.lean +++ /dev/null @@ -1,6 +0,0 @@ -import «std-1.0.0-beta.14».Extracted -import Lampe - -namespace Lampe.Stdlib.Collections.Map - -open «std-1.0.0-beta.14» diff --git a/stdlib/lampe/Stdlib/Collections/Umap.lean b/stdlib/lampe/Stdlib/Collections/Umap.lean index 5a72f59d..23f21cf8 100644 --- a/stdlib/lampe/Stdlib/Collections/Umap.lean +++ b/stdlib/lampe/Stdlib/Collections/Umap.lean @@ -1,6 +1,6 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Collections.Umap -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» diff --git a/stdlib/lampe/Stdlib/Compat.lean b/stdlib/lampe/Stdlib/Compat.lean index 8998660f..d18df730 100644 --- a/stdlib/lampe/Stdlib/Compat.lean +++ b/stdlib/lampe/Stdlib/Compat.lean @@ -1,16 +1,16 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Compat -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» set_option Lampe.pp.Expr true set_option Lampe.pp.STHoare true theorem is_bn254_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::compat::is_bn254».call h![] h![]) + («std-1.0.0-beta.25::compat::is_bn254».call h![] h![]) (fun r => r = true) := by enter_decl steps diff --git a/stdlib/lampe/Stdlib/Convert.lean b/stdlib/lampe/Stdlib/Convert.lean index e0d9380e..cae59e32 100644 --- a/stdlib/lampe/Stdlib/Convert.lean +++ b/stdlib/lampe/Stdlib/Convert.lean @@ -1,9 +1,9 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Convert -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» set_option Lampe.pp.Expr true set_option Lampe.pp.STHoare true @@ -11,62 +11,62 @@ set_option Lampe.pp.STHoare true /-- A shorthand for a call to the `std::convert::From::from` method. -/ @[reducible] def «from» {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::convert::From».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::convert::From».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::convert::From».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::convert::From».«from».«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::convert::From».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::convert::From».«from».«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::convert::From».«from».«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::convert::From».«from».«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::convert::From».«from».«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::convert::From».«from» generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::convert::From».«from».«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::convert::From».«from» generics Self associatedTypes fnGenerics /-- Asserts that the provided `tp` has an implementation of `std::convert::From` in the environment. -/ @[reducible] def hasFromImpl (env : Env) (source : Tp) (self : Tp) := - «std-1.0.0-beta.14::convert::From».hasImpl env h![source] self + «std-1.0.0-beta.25::convert::From».hasImpl env h![source] self /-- A shorthand for a call to the `std::convert::Into::into` method. -/ @[reducible] def into {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::convert::Into».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::convert::Into».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::convert::Into».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::convert::Into».into.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::convert::Into».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::convert::Into».into.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::convert::Into».into.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::convert::Into».into.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::convert::Into».into.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::convert::Into».into generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::convert::Into».into.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::convert::Into».into generics Self associatedTypes fnGenerics /-- Asserts that the provided `tp` has an implementation of `std::convert::Into` in the environment. -/ @[reducible] def hasIntoImpl (env : Env) (target : Tp) (self : Tp) := - «std-1.0.0-beta.14::convert::Into».hasImpl env h![target] self + «std-1.0.0-beta.25::convert::Into».hasImpl env h![target] self /-- A shorthand for a call to the `std::convert::AsPrimitive::as_` method. -/ @[reducible] def as_ {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::convert::AsPrimitive».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::convert::AsPrimitive».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::convert::AsPrimitive».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::convert::AsPrimitive».as_.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::convert::AsPrimitive».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::convert::AsPrimitive».as_.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::convert::AsPrimitive».as_.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::convert::AsPrimitive».as_.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::convert::AsPrimitive».as_.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::convert::AsPrimitive».as_ generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::convert::AsPrimitive».as_.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::convert::AsPrimitive».as_ generics Self associatedTypes fnGenerics /-- Asserts that the provided `tp` has an implementation of `std::convert::Into` in the environment. -/ @[reducible] def hasAsPrimitiveImpl (env : Env) (target : Tp) (self : Tp) := - «std-1.0.0-beta.14::convert::AsPrimitive».hasImpl env h![target] self + «std-1.0.0-beta.25::convert::AsPrimitive».hasImpl env h![target] self theorem from_T_for_T_spec {p T i} : STHoare p env ⟦⟧ diff --git a/stdlib/lampe/Stdlib/Default.lean b/stdlib/lampe/Stdlib/Default.lean index d20c9362..6d4c97be 100644 --- a/stdlib/lampe/Stdlib/Default.lean +++ b/stdlib/lampe/Stdlib/Default.lean @@ -1,11 +1,11 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.Tuple namespace Lampe.Stdlib.Default -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Stdlib set_option Lampe.pp.Expr true @@ -14,21 +14,21 @@ set_option Lampe.pp.STHoare true /-- A shorthand for a call to the `std::default::Default::default` method. -/ @[reducible] def default {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::default::Default».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::default::Default».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::default::Default».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::default::Default».default.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::default::Default».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::default::Default».default.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::default::Default».default.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::default::Default».default.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::default::Default».default.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::default::Default».default generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::default::Default».default.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::default::Default».default generics Self associatedTypes fnGenerics /-- Asserts that the provided `tp` has an implementation of `std::default::Default` in the environment. -/ @[reducible] -def hasDefaultImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.14::default::Default».hasImpl env h![] tp +def hasDefaultImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.25::default::Default».hasImpl env h![] tp theorem field_default_spec {p} : STHoare p env ⟦⟧ @@ -38,15 +38,6 @@ theorem field_default_spec {p} steps simp_all -theorem u1_default_spec {p} - : STHoare p env ⟦⟧ - (default h![] (.u 1) h![] h![] h![]) - (fun r => r = 0) := by - resolve_trait - steps - subst_vars - rfl - theorem u8_default_spec {p} : STHoare p env ⟦⟧ (default h![] (.u 8) h![] h![] h![]) diff --git a/stdlib/lampe/Stdlib/EcdsaSecp256K1.lean b/stdlib/lampe/Stdlib/EcdsaSecp256K1.lean index 3fb8e28c..5e88d41a 100644 --- a/stdlib/lampe/Stdlib/EcdsaSecp256K1.lean +++ b/stdlib/lampe/Stdlib/EcdsaSecp256K1.lean @@ -1,9 +1,9 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.EcdsaSecp256K1 -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» private theorem ecdsaSecp256K1_builtin_spec {p} {pkX pkY : Tp.denote p ((Tp.u 8).array (32 : U 32))} @@ -27,7 +27,7 @@ theorem verify_signature_spec {p} {sig : Tp.denote p ((Tp.u 8).array (64 : U 32))} {msg : Tp.denote p ((Tp.u 8).array (32 : U 32))} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ecdsa_secp256k1::verify_signature».call + («std-1.0.0-beta.25::ecdsa_secp256k1::verify_signature».call h![] h![pkX, pkY, sig, msg]) (fun r => r = Lampe.Crypto.Ecdsa.secp256k1Verify pkX pkY sig msg) := by enter_decl diff --git a/stdlib/lampe/Stdlib/EcdsaSecp256R1.lean b/stdlib/lampe/Stdlib/EcdsaSecp256R1.lean index 55eb5352..7d6b1b91 100644 --- a/stdlib/lampe/Stdlib/EcdsaSecp256R1.lean +++ b/stdlib/lampe/Stdlib/EcdsaSecp256R1.lean @@ -1,9 +1,9 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.EcdsaSecp256R1 -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» private theorem ecdsaSecp256R1_builtin_spec {p} {pkX pkY : Tp.denote p ((Tp.u 8).array (32 : U 32))} @@ -27,7 +27,7 @@ theorem verify_signature_spec {p} {sig : Tp.denote p ((Tp.u 8).array (64 : U 32))} {msg : Tp.denote p ((Tp.u 8).array (32 : U 32))} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ecdsa_secp256r1::verify_signature».call + («std-1.0.0-beta.25::ecdsa_secp256r1::verify_signature».call h![] h![pkX, pkY, sig, msg]) (fun r => r = Lampe.Crypto.Ecdsa.secp256r1Verify pkX pkY sig msg) := by enter_decl diff --git a/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean b/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean index 7d7db229..919cfedb 100644 --- a/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean +++ b/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean @@ -1,11 +1,11 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.Field.Bn254 import Stdlib.Hash.Mod namespace Lampe.Stdlib.EmbeddedCurveOps -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Crypto.EmbeddedCurve /-! @@ -44,7 +44,7 @@ namespace Point /-- A useful shorthand for the type of the embedded curve point. -/ @[reducible] -def type := «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint».tp h![] +def type := «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint».tp h![] /-- A useful shorthand for declaring the type of values of the embedded curve point. -/ @[reducible] @@ -148,7 +148,7 @@ namespace Scalar /-- A useful shorthand for the type of the embedded curve scalar. -/ @[reducible] -def type := «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar».tp h![] +def type := «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar».tp h![] /-- A useful shorthand for declaring the type of values of the embedded curve scalar. -/ @[reducible] @@ -242,7 +242,7 @@ end Scalar theorem point_at_infinity_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity».call + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity».call h![] h![]) (fun r => r = Point.infinity) := by enter_decl @@ -252,7 +252,7 @@ theorem point_at_infinity_spec {p} : theorem generator_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint::generator».call h![] h![]) + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::generator».call h![] h![]) (fun r => r = Point.generator) := by enter_decl steps @@ -261,7 +261,7 @@ theorem generator_spec {p} : theorem scalar_new_spec {p} {lo hi : Fp p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar::new».call + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::new».call h![] h![lo, hi]) (fun r => r = Scalar.mk lo hi) := by enter_decl @@ -271,7 +271,7 @@ theorem scalar_new_spec {p} {lo hi : Fp p} : private theorem point_neg_concrete_spec {p} {self : Point.denote p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::Neg».neg h![] Point.type h![] h![] h![self]) + («std-1.0.0-beta.25::ops::arith::Neg».neg h![] Point.type h![] h![] h![self]) (fun r => r = Point.neg self) := by resolve_trait steps @@ -284,7 +284,7 @@ theorem point_neg_spec {p} {self : Point.denote p} {P : (affineCurve p).Point} (hself : self = encodeCurvePoint P) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::Neg».neg h![] Point.type h![] h![] h![self]) + («std-1.0.0-beta.25::ops::arith::Neg».neg h![] Point.type h![] h![] h![self]) (fun r => r = encodeCurvePoint (-P)) := by have hEq : Point.neg self = encodeCurvePoint (-P) := by subst hself @@ -295,7 +295,7 @@ theorem point_neg_spec {p} {self : Point.denote p} private theorem point_eq_concrete_spec {p} {self other : Point.denote p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Eq».eq h![] Point.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Eq».eq h![] Point.type h![] h![] h![self, other]) (fun r => r = Point.eq self other) := by resolve_trait reduce_fn_body @@ -310,7 +310,7 @@ boolean reflects extensional equality (`Point.extEq`, i.e. equality modulo the canonical infinity representative). -/ theorem point_eq_spec {p} {self other : Point.denote p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Eq».eq h![] Point.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Eq».eq h![] Point.type h![] h![] h![self, other]) (fun r => r = true ↔ Point.extEq self other) := by steps [point_eq_concrete_spec] subst_vars @@ -339,7 +339,7 @@ theorem point_eq_spec {p} {self other : Point.denote p} : private theorem scalar_eq_concrete_spec {p} {self other : Scalar.denote p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Eq».eq h![] Scalar.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Eq».eq h![] Scalar.type h![] h![] h![self, other]) (fun r => r = Scalar.eq self other) := by resolve_trait reduce_fn_body @@ -355,7 +355,7 @@ semantic value-equality. -/ theorem scalar_eq_spec {p} {self other : Scalar.denote p} (hself : Scalar.Canonical self) (hother : Scalar.Canonical other) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Eq».eq h![] Scalar.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Eq».eq h![] Scalar.type h![] h![] h![self, other]) (fun r => r = true ↔ Scalar.valueNat self = Scalar.valueNat other) := by steps [scalar_eq_concrete_spec] subst_vars @@ -397,7 +397,7 @@ theorem embedded_curve_add_inner_spec {p} (curvePoint? point1).isSome ∧ (curvePoint? point2).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::embedded_curve_add_inner».call + («std-1.0.0-beta.25::embedded_curve_ops::embedded_curve_add_inner».call h![] h![point1, point2]) (fun r => r = encodeCurvePoint @@ -413,7 +413,7 @@ theorem embedded_curve_add_spec {p} (curvePoint? point1).isSome ∧ (curvePoint? point2).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::embedded_curve_add».call + («std-1.0.0-beta.25::embedded_curve_ops::embedded_curve_add».call h![] h![point1, point2]) (fun r => r = encodeCurvePoint @@ -431,7 +431,7 @@ private theorem point_add_concrete_spec {p} {self other : Point.denote p} (curvePoint? self).isSome ∧ (curvePoint? other).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::Add».add h![] Point.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::ops::arith::Add».add h![] Point.type h![] h![] h![self, other]) (fun r => r = encodeCurvePoint ((curvePoint? self).get hOnCurve.1 + @@ -448,7 +448,7 @@ theorem point_add_spec {p} {self other : Point.denote p} (hself : self = encodeCurvePoint P) (hother : other = encodeCurvePoint Q) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::Add».add h![] Point.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::ops::arith::Add».add h![] Point.type h![] h![] h![self, other]) (fun r => r = encodeCurvePoint (P + Q)) := by have hOnCurve : (curvePoint? self).isSome ∧ @@ -473,7 +473,7 @@ theorem point_add_spec {p} {self other : Point.denote p} private theorem point_double_concrete_spec {p} {self : Point.denote p} (hOnCurve : (curvePoint? self).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint::double».call h![] h![self]) + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::double».call h![] h![self]) (fun r => r = encodeCurvePoint ((curvePoint? self).get hOnCurve + @@ -488,7 +488,7 @@ theorem point_double_spec {p} {self : Point.denote p} {P : (affineCurve p).Point} (hself : self = encodeCurvePoint P) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint::double».call h![] h![self]) + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::double».call h![] h![self]) (fun r => r = encodeCurvePoint (P + P)) := by have hOnCurve : (curvePoint? self).isSome := by subst hself @@ -510,7 +510,7 @@ private theorem point_sub_concrete_spec {p} {self other : Point.denote p} (curvePoint? self).isSome ∧ (curvePoint? (Point.neg other)).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::Sub».sub h![] Point.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::ops::arith::Sub».sub h![] Point.type h![] h![] h![self, other]) (fun r => r = encodeCurvePoint ((curvePoint? self).get hOnCurve.1 + @@ -527,7 +527,7 @@ theorem point_sub_spec {p} {self other : Point.denote p} (hself : self = encodeCurvePoint P) (hother : other = encodeCurvePoint Q) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::Sub».sub h![] Point.type h![] h![] h![self, other]) + («std-1.0.0-beta.25::ops::arith::Sub».sub h![] Point.type h![] h![] h![self, other]) (fun r => r = encodeCurvePoint (P + (-Q))) := by have hOnCurve : (curvePoint? self).isSome ∧ @@ -559,12 +559,12 @@ theorem point_hash_infinite_spec {p H stateRef} (h_inf : Point.isInfinite self = true) (h_bool_write : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast .bool .field _ p (Point.isInfinite self)]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait reduce_fn_body @@ -580,17 +580,17 @@ theorem point_hash_finite_spec {p H stateRef} (h_fin : Point.isInfinite self = false) (h_x_write : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, Point.x self]) (fun _ => [stateRef ↦ ⟨H, state1⟩])) (h_y_write : STHoare p env [stateRef ↦ ⟨H, state1⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, Point.y self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait reduce_fn_body @@ -608,31 +608,31 @@ theorem point_hash_spec {p H stateRef} if Point.isInfinite self then STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast .bool .field _ p (Point.isInfinite self)]) (fun _ => [stateRef ↦ ⟨H, final⟩]) else ∃ state1, STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, Point.x self]) (fun _ => [stateRef ↦ ⟨H, state1⟩]) ∧ STHoare p env [stateRef ↦ ⟨H, state1⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, Point.y self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by by_cases h_inf : Point.isInfinite self = true · simp [h_inf] at h_write have h_bool_write : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast .bool .field _ p (Point.isInfinite self)]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by simpa [h_inf] using h_write @@ -679,7 +679,7 @@ precondition for free. -/ theorem scalar_from_field_spec {p} [Lampe.Crypto.Bn254.Prime p] {scalar : Fp p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar::from_field».call + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::from_field».call h![] h![scalar]) (fun r => ∃∃ lo hi, @@ -706,7 +706,7 @@ the investigation note immediately below this declaration. -/ theorem scalar_from_bytes_spec {p bytes offset} (hbound : offset.toNat + 31 < 64) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar::from_bytes».call + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::from_bytes».call h![] h![bytes, offset]) (fun r => r = @@ -766,7 +766,7 @@ theorem scalar_from_bytes_spec {p bytes offset} theorem scalar_from_bytes_some_spec {p bytes offset scalar} (hsome : Scalar.fromBytes? bytes offset = some scalar) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar::from_bytes».call + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::from_bytes».call h![] h![bytes, offset]) (fun r => r = scalar) := by have hvalid : Scalar.validOffset offset := by @@ -795,17 +795,17 @@ theorem scalar_hash_spec {p H stateRef} {h_hasher : Lampe.Stdlib.Hash.Hasher.hasImpl env H} (h_hi_write : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, Scalar.hi self]) (fun _ => [stateRef ↦ ⟨H, state1⟩])) (h_lo_write : STHoare p env [stateRef ↦ ⟨H, state1⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, Scalar.lo self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] Scalar.type h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] Scalar.type h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait reduce_fn_body @@ -858,7 +858,7 @@ private theorem multi_scalar_mul_concrete_spec {p N} {scalars : Tp.denote p (Scalar.type.array N)} (hOnCurve : ∀ i, (curvePoint? (points.get i)).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::multi_scalar_mul».call + («std-1.0.0-beta.25::embedded_curve_ops::multi_scalar_mul».call h![N] h![points, scalars]) (fun r => r = encodeCurvePoint @@ -960,7 +960,7 @@ theorem multi_scalar_mul_spec {p N} (h_enc : points.toList = Ps.toList.map encodeCurvePoint) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::multi_scalar_mul».call + («std-1.0.0-beta.25::embedded_curve_ops::multi_scalar_mul».call h![N] h![points, scalars]) (fun r => r = encodeCurvePoint @@ -985,7 +985,7 @@ theorem multi_scalar_mul_combined_spec {p N} (h_enc : points.toList = Ps.toList.map encodeCurvePoint) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::multi_scalar_mul».call + («std-1.0.0-beta.25::embedded_curve_ops::multi_scalar_mul».call h![N] h![points, scalars]) (fun r => (∀ i, Scalar.Canonical (scalars.get i)) ∧ @@ -1035,7 +1035,7 @@ private theorem fixed_base_scalar_mul_concrete_spec {p} (Point.generator : Point.denote p) = encodeCurvePoint Pgen) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::fixed_base_scalar_mul».call h![] h![scalar]) + («std-1.0.0-beta.25::embedded_curve_ops::fixed_base_scalar_mul».call h![] h![scalar]) (fun r => r = encodeCurvePoint (Scalar.valueNat scalar • Pgen)) := by @@ -1101,7 +1101,7 @@ theorem fixed_base_scalar_mul_spec {p} (Point.generator : Point.denote p) = encodeCurvePoint Pgen) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::fixed_base_scalar_mul».call h![] h![scalar]) + («std-1.0.0-beta.25::embedded_curve_ops::fixed_base_scalar_mul».call h![] h![scalar]) (fun r => r = encodeCurvePoint diff --git a/stdlib/lampe/Stdlib/EmbeddedCurveOps/Bn254.lean b/stdlib/lampe/Stdlib/EmbeddedCurveOps/Bn254.lean index 6e21b242..38812974 100644 --- a/stdlib/lampe/Stdlib/EmbeddedCurveOps/Bn254.lean +++ b/stdlib/lampe/Stdlib/EmbeddedCurveOps/Bn254.lean @@ -41,8 +41,8 @@ condition of the generic spec is discharged automatically by pinning to `Bn254.prime`. -/ theorem fixed_base_scalar_mul_bn254_spec {scalar : Lampe.Stdlib.EmbeddedCurveOps.Scalar.denote Bn254.prime} : - STHoare Bn254.prime «std-1.0.0-beta.14».env ⟦⟧ - («std-1.0.0-beta.14::embedded_curve_ops::fixed_base_scalar_mul».call h![] h![scalar]) + STHoare Bn254.prime «std-1.0.0-beta.25».env ⟦⟧ + («std-1.0.0-beta.25::embedded_curve_ops::fixed_base_scalar_mul».call h![] h![scalar]) (fun r => r = encodeCurvePoint (Scalar.valueNat scalar • generatorPoint)) := diff --git a/stdlib/lampe/Stdlib/Field/Basic.lean b/stdlib/lampe/Stdlib/Field/Basic.lean index 26ab55ed..ef49c664 100644 --- a/stdlib/lampe/Stdlib/Field/Basic.lean +++ b/stdlib/lampe/Stdlib/Field/Basic.lean @@ -1,15 +1,15 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Field -open «std-1.0.0-beta.14» (env) +open «std-1.0.0-beta.25» (env) -- idk where to put this one cuz i don't want to create circular dependency -- but bn254 depends on it as does mod theorem assert_max_bit_size_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::assert_max_bit_size».call h![BIT_SIZE] h![f]) + («std-1.0.0-beta.25::field::assert_max_bit_size».call h![BIT_SIZE] h![f]) (fun r => ∃∃ h : f.val < 2 ^ BIT_SIZE.toNat, r = ()) := by enter_decl steps diff --git a/stdlib/lampe/Stdlib/Field/Bn254.lean b/stdlib/lampe/Stdlib/Field/Bn254.lean index 08aa0a67..d5c3c8ad 100644 --- a/stdlib/lampe/Stdlib/Field/Bn254.lean +++ b/stdlib/lampe/Stdlib/Field/Bn254.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.Field.Basic @@ -19,14 +19,14 @@ namespace Lampe.Stdlib.Field.Bn254 open Lampe open Lampe.Crypto -open «std-1.0.0-beta.14» (env) +open «std-1.0.0-beta.25» (env) open Lampe (pow128) open Lampe.Crypto.Bn254 (plo phi pow128_lt_prime pow128_val val_add_one_of_lt limbs_gt_of_hi_gt sub_val_gt_pow128_of_lt) -abbrev PLO := «std-1.0.0-beta.14::field::bn254::PLO» -abbrev PHI := «std-1.0.0-beta.14::field::bn254::PHI» -abbrev TWO_POW_128 := «std-1.0.0-beta.14::field::bn254::TWO_POW_128» +abbrev PLO := «std-1.0.0-beta.25::field::bn254::PLO» +abbrev PHI := «std-1.0.0-beta.25::field::bn254::PHI» +abbrev TWO_POW_128 := «std-1.0.0-beta.25::field::bn254::TWO_POW_128» theorem plo_spec {p} : STHoare p env ⟦⟧ @@ -58,7 +58,7 @@ theorem two_pow_128_spec {p} : -- FIXME: steps requires this even tho it's an empty postcondition theorem lte_hint_intro {p a b} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::lte_hint».call h![] h![a, b]) + («std-1.0.0-beta.25::field::bn254::lte_hint».call h![] h![a, b]) (fun _ => ⟦⟧) := by enter_decl steps @@ -66,14 +66,14 @@ theorem lte_hint_intro {p a b} : -- FIXME: steps requires this even tho it's an empty postcondition theorem decompose_hint_intro {p x} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::decompose_hint».call h![] h![x]) + («std-1.0.0-beta.25::field::bn254::decompose_hint».call h![] h![x]) (fun _ => ⟦⟧) := by enter_decl steps theorem assert_gt_limbs_intro {p a b} [Prime.BitsGT p 129] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::assert_gt_limbs».call h![] h![a, b]) + («std-1.0.0-beta.25::field::bn254::assert_gt_limbs».call h![] h![a, b]) (fun _ => ⟦ (a.1.val < pow128 ∧ a.2.1.val < pow128 ∧ b.1.val < pow128 ∧ b.2.1.val < pow128) → a.1.val + pow128 * a.2.1.val > b.1.val + pow128 * b.2.1.val @@ -147,7 +147,7 @@ theorem assert_gt_limbs_intro {p a b} [Prime.BitsGT p 129] : theorem decompose_intro {p x} [Bn254.Prime p] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::decompose».call h![] h![x]) + («std-1.0.0-beta.25::field::bn254::decompose».call h![] h![x]) (fun r => ∃∃ xlo xhi, r = (xlo, xhi, ()) ∧ @@ -225,7 +225,7 @@ theorem decompose_intro {p x} [Bn254.Prime p] : theorem assert_gt_intro {p a b} [Bn254.Prime p] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::assert_gt».call h![] h![a, b]) + («std-1.0.0-beta.25::field::bn254::assert_gt».call h![] h![a, b]) (fun _ => a.val > b.val) := by enter_decl steps @@ -249,7 +249,7 @@ theorem assert_gt_intro {p a b} [Bn254.Prime p] : theorem assert_lt_intro {p a b} [Bn254.Prime p] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::assert_lt».call h![] h![a, b]) + («std-1.0.0-beta.25::field::bn254::assert_lt».call h![] h![a, b]) (fun _ => a.val < b.val) := by enter_decl steps [assert_gt_intro (p := p)] @@ -257,14 +257,14 @@ theorem assert_lt_intro {p a b} [Bn254.Prime p] : theorem field_less_than_intro {p x y} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::field_less_than».call h![] h![x, y]) + («std-1.0.0-beta.25::field::field_less_than».call h![] h![x, y]) (fun _ => ⟦⟧) := by enter_decl steps theorem gt_intro {p a b} [Bn254.Prime p] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::gt».call h![] h![a, b]) + («std-1.0.0-beta.25::field::bn254::gt».call h![] h![a, b]) (fun r => r = decide (a.val > b.val)) := by enter_decl steps @@ -297,7 +297,7 @@ theorem gt_intro {p a b} [Bn254.Prime p] : theorem lt_intro {p a b} [Bn254.Prime p] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bn254::lt».call h![] h![a, b]) + («std-1.0.0-beta.25::field::bn254::lt».call h![] h![a, b]) (fun r => r = decide (a.val < b.val)) := by enter_decl steps [gt_intro (p := p)] diff --git a/stdlib/lampe/Stdlib/Field/Mod.lean b/stdlib/lampe/Stdlib/Field/Mod.lean index 4b3a1d6b..e1ee3fc7 100644 --- a/stdlib/lampe/Stdlib/Field/Mod.lean +++ b/stdlib/lampe/Stdlib/Field/Mod.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Lampe.Data.Digits import Stdlib.Field.Basic @@ -8,29 +8,30 @@ import Stdlib.Ext namespace Lampe.Stdlib.Field -open «std-1.0.0-beta.14» (env) +-- `Bool` is a `LinearOrder`, so Mathlib's lex `List.LE'` instance would +-- otherwise take over `≤` on the bit lists these proofs track; the proofs are +-- stated against the core list order. +attribute [-instance] List.LE' -lemma bits_lt_of_lex_lt {data pdata : List (BitVec 1)} +open «std-1.0.0-beta.25» (env) + +lemma bits_lt_of_lex_lt {data pdata : List Bool} (hlen : data.length = pdata.length) (hlt : data < pdata) - (hpdata : pdata = List.map (fun (d : Digit 2) => BitVec.ofNatLT d.val d.prop) - (RadixVec.toDigitsBE' 2 p)) : - RadixVec.ofDigitsBE' (data.map (fun i => (i.toFin : Digit 2))) < p := by + (hpdata : pdata = List.map Digit.toBool (RadixVec.toDigitsBE' 2 p)) : + RadixVec.ofDigitsBE' (data.map Bool.toDigit) < p := by rw [←RadixVec.ofDigitsBE'_toDigitsBE' (r := 2) (n := p)] apply RadixVec.ofDigitsBE'_mono · simp [hlen, hpdata, List.length_map] · have hself : RadixVec.toDigitsBE' 2 p = - List.map (fun (i : BitVec 1) => (i.toFin : Digit 2)) - (List.map (fun (d : Digit 2) => BitVec.ofNatLT d.val d.prop) - (RadixVec.toDigitsBE' 2 p)) := by + List.map Bool.toDigit + (List.map Digit.toBool (RadixVec.toDigitsBE' 2 p)) := by rw [List.map_map, eq_comm] - convert List.map_id _ + rw [show Bool.toDigit ∘ Digit.toBool = id from funext Digit.toBool_toDigit] + exact List.map_id _ rw [hself] apply List.map_lt - · intro x y h - rw [BitVec.lt_def] at h - rw [Fin.lt_def] - exact h + · decide · rw [hpdata] at hlt exact hlt @@ -75,7 +76,7 @@ lemma ofDigitsBE'_lt_of_shorter_than_modulus {r : Radix} {data : List (Digit r)} theorem to_be_radix_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::to_be_radix».call h![N] h![f, 256]) + («std-1.0.0-beta.25::field::to_be_radix».call h![N] h![f, 256]) fun o => ∃∃ (v : List.Vector (Digit R256) N.toNat), o = v.map BitVec.ofFin ⋆ @@ -104,7 +105,7 @@ theorem to_be_radix_intro : theorem to_le_radix_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::to_le_radix».call h![N] h![f, 256]) + («std-1.0.0-beta.25::field::to_le_radix».call h![N] h![f, 256]) fun o => ∃∃ (v : List.Vector (Digit R256) N.toNat), o = v.reverse.map BitVec.ofFin ⋆ @@ -132,16 +133,16 @@ theorem to_le_radix_intro : theorem to_be_bits_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::to_be_bits».call h![N] h![f]) + («std-1.0.0-beta.25::field::to_be_bits».call h![N] h![f]) fun r => ∃∃(lt : f.val < (2 ^ N.toNat)), r = (RadixVec.toDigitsBE (d := N.toNat) (r := 2) - ⟨f.val, by simp_all [OfNat.ofNat]⟩ |>.map (BitVec.ofFin (w := 1))) := by + ⟨f.val, by simp_all [OfNat.ofNat]⟩ |>.map Digit.toBool) := by rcases N with ⟨⟨N,_⟩⟩ enter_decl steps · exact () step_as (⟦⟧) - (fun _ => RadixVec.ofDigitsBE' (bits.toList.map (fun i => (i.toFin : Digit 2))) < p.natVal) + (fun _ => RadixVec.ofDigitsBE' (bits.toList.map Bool.toDigit) < p.natVal) · apply STHoare.iteTrue_intro steps rename' p => pbits @@ -172,6 +173,7 @@ theorem to_be_bits_intro : rw [List.le_iff_lt_or_eq] at hle tauto steps + · exact () by_cases hi : bits[i] = pbits[i] · convert STHoare.iteFalse_intro _ · simp only [List.Vector.get, List.get_eq_getElem, decide_eq_false_iff_not, @@ -187,16 +189,19 @@ theorem to_be_bits_intro : · convert STHoare.iteTrue_intro _ · simp only [List.Vector.get, List.get_eq_getElem, decide_eq_true_eq, ne_eq] exact hi - · steps 7 - have hpbit : pbits[i] = 1 := by simp_all [Int.cast, IntCast.intCast] - have hbit : bits[i] = 0 := by have := U.cases_one bits[i]; simp_all - have bitle : bits[i] < pbits[i] := by simp [hpbit, hbit] - have : bits.take (i + 1) < pbits.take (i + 1) := - List.take_succ_lt_of_getElem_lt (by assumption) (by assumption) this bitle - steps - · exact List.le_of_lt this + · steps 6 + all_goals + have hpbit : pbits[i] = true := by simp_all + have hbit : bits[i] = false := by simp_all + have bitle : bits[i] < pbits[i] := by + simp only [hpbit, hbit] + exact Bool.false_lt_true + have htake : bits.take (i + 1) < pbits.take (i + 1) := + List.take_succ_lt_of_getElem_lt (by assumption) (by assumption) this bitle + · exact List.le_of_lt htake · congr - simp [this] + simp + exact htake steps rename decide _ = true => hlt have : bits.length = pbits.length := by simp_all @@ -247,21 +252,22 @@ theorem to_be_bits_intro : BitVec.toNat_ofFin, Fin.eta, RadixVec.toDigitsBE_ofDigitsBE, List.Vector.toList_map, List.map_map ] - convert List.map_id _ + rw [show Digit.toBool ∘ Bool.toDigit = id from funext Bool.toBool_toDigit] + exact List.map_id _ set_option maxHeartbeats 300000 theorem to_le_bits_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::to_le_bits».call h![N] h![f]) + («std-1.0.0-beta.25::field::to_le_bits».call h![N] h![f]) fun r => ∃∃(lt : f.val < (2 ^ N.toNat)), r = (RadixVec.toDigitsBE (d := N.toNat) (r := 2) - ⟨f.val, by simp_all [OfNat.ofNat]⟩ |>.map (BitVec.ofFin (w := 1)) |>.reverse) := by + ⟨f.val, by simp_all [OfNat.ofNat]⟩ |>.map Digit.toBool |>.reverse) := by rcases N with ⟨⟨N,_⟩⟩ enter_decl steps · exact () step_as (⟦⟧) (fun _ => - RadixVec.ofDigitsBE' (bits.toList.reverse.map (fun i => (i.toFin : Digit 2))) < p.natVal) + RadixVec.ofDigitsBE' (bits.toList.reverse.map Bool.toDigit) < p.natVal) · apply STHoare.iteTrue_intro steps rename' p => pbits @@ -295,6 +301,7 @@ theorem to_le_bits_intro : have hi_lt_bits : i < bits.reverse.length := by simp_all [List.length_reverse] have hi_lt_pbits : i < pbits.reverse.length := by simp_all [List.length_reverse] steps + · exact () have hi_lt : i < bits.length := by simp_all [List.length_reverse] have hlen_eq : bits.length = pbits.length := by simp_all have hlen32 : bits.length < 2^32 := by simp_all @@ -316,23 +323,25 @@ theorem to_le_bits_intro : · convert STHoare.iteTrue_intro _ · simp [List.Vector.get, hlen_eq] at hi ⊢ simp_all - · steps 9 - rename_i hassert - have hpbit : pbits[pbits.length - 1 - i] = 1 := by - simp only [beq_true, decide_eq_true_eq, List.get_eq_getElem] at hassert - convert hassert using 2 - rw [←hlen_eq] - exact hidx.symm - have hbit : bits[bits.length - 1 - i] = 0 := by - have := U.cases_one bits[bits.length - 1 - i] - simp_all - have hbit_lt : bits.reverse[i]'hi_lt_bits < pbits.reverse[i]'hi_lt_pbits := by - simp [hpbit, hbit] - have : bits.reverse.take (i + 1) < pbits.reverse.take (i + 1) := - List.take_succ_lt_of_getElem_lt hi_lt_bits hi_lt_pbits heq hbit_lt + · steps 8 + all_goals + rename_i hassert + have hpbit : pbits[pbits.length - 1 - i] = true := by + simp only [List.get_eq_getElem, beq_iff_eq] at hassert + convert hassert using 2 + rw [(show pbits.length - 1 - i = bits.length - 1 - i by rw [hlen_eq])] + exact hidx.symm + have hbit : bits[bits.length - 1 - i] = false := by + simp_all + have hbit_lt : bits.reverse[i]'hi_lt_bits < pbits.reverse[i]'hi_lt_pbits := by + simp [Bool.lt_iff, hpbit, hbit] + have htake : bits.reverse.take (i + 1) < pbits.reverse.take (i + 1) := + List.take_succ_lt_of_getElem_lt hi_lt_bits hi_lt_pbits heq hbit_lt steps - · exact List.le_of_lt this - · simp [this] + · exact List.le_of_lt htake + · congr + simp + exact htake steps rename decide _ = true => hlt_final have hlen : bits.length = pbits.length := by simp_all @@ -342,7 +351,7 @@ theorem to_le_bits_intro : have hlt_full : bits.reverse < pbits.reverse := List.lt_of_take_lt (by simp [hlen]) (by simp) hlt_final have hpbits_rev : pbits.reverse = - List.map (fun (d : Digit 2) => BitVec.ofNatLT d.val d.prop) + List.map Digit.toBool (RadixVec.toDigitsBE' 2 p.natVal) := by subst pbits simp [RadixVec.toDigitsLE', RadixVec.toDigitsBE', @@ -387,7 +396,7 @@ theorem to_le_bits_intro : subst_vars rename_i bits hbound set vDigits : List.Vector (Digit (2 : Radix)) N := - bits.reverse.map (fun b => (b.toFin : Digit 2)) with hvDigits + bits.reverse.map Bool.toDigit with hvDigits set vOfDigits := RadixVec.ofDigitsBE vDigits with hvOfDigits set vZMod := (↑↑vOfDigits : ZMod p.natVal).val with hvZMod -- TODO: here we should simply just unfold LE, @@ -409,14 +418,14 @@ theorem to_le_bits_intro : bits = (RadixVec.toDigitsBE (d := N) (r := 2) ⟨(↑↑vOfDigits : Fp p).val, hlt2N⟩ - |>.map (BitVec.ofFin (w := 1)) |>.reverse) := by - have hb_core : bits = (vDigits.map (BitVec.ofFin (w := 1))).reverse := by + |>.map Digit.toBool |>.reverse) := by + have hb_core : bits = (vDigits.map Digit.toBool).reverse := by apply List.Vector.eq - simp [vDigits, BitVec.ofFin_toFin_comp 1, List.Vector.toList_reverse] + simp [vDigits, List.Vector.toList_reverse, List.map_map, Function.comp_def] have hb_digits : (RadixVec.toDigitsBE (d := N) (r := 2) vOfDigits - |>.map (BitVec.ofFin (w := 1)) |>.reverse) = - (vDigits.map (BitVec.ofFin (w := 1))).reverse := by + |>.map Digit.toBool |>.reverse) = + (vDigits.map Digit.toBool).reverse := by simp only [hvOfDigits, RadixVec.toDigitsBE_ofDigitsBE] have hSubtype : (⟨(↑↑vOfDigits : Fp p).val, hlt2N⟩ : RadixVec 2 N) = vOfDigits := by @@ -429,7 +438,7 @@ theorem to_le_bits_intro : theorem to_be_bytes_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::to_be_bytes».call h![N] h![f]) + («std-1.0.0-beta.25::field::to_be_bytes».call h![N] h![f]) fun o => ∃∃(lt : f.val < (256 ^ N.toNat)), o = (RadixVec.toDigitsBE (d := N.toNat) @@ -578,7 +587,7 @@ theorem to_be_bytes_intro : set_option maxHeartbeats 500000 theorem to_le_bytes_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::to_le_bytes».call h![N] h![f]) + («std-1.0.0-beta.25::field::to_le_bytes».call h![N] h![f]) fun o => ∃∃(lt : f.val < (256 ^ N.toNat)), o = (RadixVec.toDigitsBE (d := N.toNat) @@ -744,7 +753,7 @@ theorem to_le_bytes_intro : set_option maxHeartbeats 2000000 theorem pow_32_intro {p self exponent} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::pow_32».call h![] h![self, exponent]) + («std-1.0.0-beta.25::field::pow_32».call h![] h![self, exponent]) (fun r => ∃∃ hlt : exponent.val < 2^32, r = self ^ exponent.val) := by enter_decl steps [to_le_bits_intro] @@ -752,16 +761,17 @@ theorem pow_32_intro {p self exponent} : rename_i hlt hb set digits := RadixVec.toDigitsBE (d := 32) (r := 2) ⟨exponent.val, hlt⟩ with hdigits - have hb_bits : b = (digits.map (BitVec.ofFin (w := 1))).reverse := by + have hb_bits : b = (digits.map Digit.toBool).reverse := by simpa [digits] using hb have hb_digits : - b.reverse.map (fun i => (i.toFin : Digit 2)) = digits := by - have hb_rev : b.reverse = digits.map (BitVec.ofFin (w := 1)) := by + b.reverse.map Bool.toDigit = digits := by + have hb_rev : b.reverse = digits.map Digit.toBool := by simpa [List.Vector.reverse_reverse] using congrArg List.Vector.reverse hb_bits rw [hb_rev] - exact map_toFin_ofFin_eq (digits := digits) + apply List.Vector.eq + simp [List.Vector.toList_map, List.map_map, Function.comp_def] have hb_digits_list : - b.toList.reverse.map (fun i => (i.toFin : Digit 2)) = digits.toList := by + b.toList.reverse.map Bool.toDigit = digits.toList := by simpa [List.Vector.toList_reverse] using congrArg List.Vector.toList hb_digits loop_inv nat fun i _ _ => @@ -779,9 +789,9 @@ theorem pow_32_intro {p self exponent} : have hi_lt_rev : i - 1 < b.toList.reverse.length := by simp [List.length_reverse, List.Vector.toList_length, hi_lt32] have hidx : - (b.toList.reverse[i - 1]'hi_lt_rev).toFin = + (b.toList.reverse[i - 1]'hi_lt_rev).toDigit = digits.toList[i - 1]'hi_lt := by - have hi_lt_mapped : i - 1 < (b.toList.reverse.map (fun i => (i.toFin : Digit 2))).length := by + have hi_lt_mapped : i - 1 < (b.toList.reverse.map Bool.toDigit).length := by rw [List.length_map]; exact hi_lt_rev rw [← List.getElem_map (h := hi_lt_mapped)] exact List.getElem_of_eq hb_digits_list _ @@ -817,11 +827,11 @@ theorem pow_32_intro {p self exponent} : have hpow2 : self ^ (a * 2) = self ^ a * self ^ a := by simpa [ha, pow_two] using (pow_mul self a 2) - have hbit_info (bit : U 1) + have hbit_info (bit : Bool) (hbit_rev : b.toList.reverse[i - 1]'hi_lt_rev = bit) : - (↑(BitVec.toNat (b[32 - i])) : Fp p) = - (↑(BitVec.toNat bit) : Fp p) ∧ - digits.toList[i - 1]'hi_lt = (bit.toFin : Digit 2) := by + ((if b[32 - i] then (1 : Fp p) else 0) = + (if bit then (1 : Fp p) else 0)) ∧ + digits.toList[i - 1]'hi_lt = bit.toDigit := by have hsub : 32 - 1 - (i - 1) = 32 - i := by omega have hbit_index : b.toList[32 - i]'hindex_lt = bit := by @@ -830,27 +840,27 @@ theorem pow_32_intro {p self exponent} : hsub ] using hbit_rev have hbit_nat : - (↑(BitVec.toNat (b[32 - i])) : Fp p) = (↑(BitVec.toNat bit) : Fp p) := by + (if b[32 - i] then (1 : Fp p) else 0) = (if bit then (1 : Fp p) else 0) := by simpa [List.Vector.toList_getElem] using - (congrArg (fun x => (↑x.toNat : Fp p)) hbit_index) - have hbit_digit : digits.toList[i - 1]'hi_lt = (bit.toFin : Digit 2) := by + (congrArg (fun x => (if x then (1 : Fp p) else 0)) hbit_index) + have hbit_digit : digits.toList[i - 1]'hi_lt = bit.toDigit := by have hbit_fin : - (b.toList.reverse[i - 1]'hi_lt_rev).toFin = bit.toFin := by - simpa using congrArg (fun x => (x.toFin : Digit 2)) hbit_rev + (b.toList.reverse[i - 1]'hi_lt_rev).toDigit = bit.toDigit := by + simpa using congrArg Bool.toDigit hbit_rev exact hidx.symm.trans hbit_fin exact ⟨hbit_nat, hbit_digit⟩ - by_cases hbit : b.toList.reverse[i - 1]'hi_lt_rev = 0 - · rcases hbit_info 0 hbit with ⟨hbit_nat, hbit_digit⟩ + by_cases hbit : b.toList.reverse[i - 1]'hi_lt_rev = false + · rcases hbit_info false hbit with ⟨hbit_nat, hbit_digit⟩ have hdigits_zero : RadixVec.ofDigitsBE' (digits.toList.take i) = RadixVec.ofDigitsBE' (digits.toList.take (i - 1)) * 2 := by simp [hdigits_take, hbit_digit] - have hb0 : (↑(BitVec.toNat b[32 - i]) : Fp p) = 0 := by + have hb0 : (if b[32 - i] then (1 : Fp p) else 0) = 0 := by simpa using hbit_nat calc - ↑(BitVec.toNat (List.Vector.get b idx)) * + (if List.Vector.get b idx then (1 : Fp p) else 0) * (self ^ a * self ^ a * self) + - (1 - ↑(BitVec.toNat (List.Vector.get b idx))) * + (1 - (if List.Vector.get b idx then (1 : Fp p) else 0)) * (self ^ a * self ^ a) = self ^ a * self ^ a := by rw [hb_index, hb0] @@ -860,10 +870,9 @@ theorem pow_32_intro {p self exponent} : exact hpow2 _ = self ^ RadixVec.ofDigitsBE' (digits.toList.take i) := by simp [ha, hdigits_zero] - · have hbit_rev : b.toList.reverse[i - 1]'hi_lt_rev = 1 := by - have := U.cases_one (b.toList.reverse[i - 1]'hi_lt_rev) - tauto - rcases hbit_info 1 hbit_rev with ⟨hbit_nat, hbit_digit⟩ + · have hbit_rev : b.toList.reverse[i - 1]'hi_lt_rev = true := by + simp_all + rcases hbit_info true hbit_rev with ⟨hbit_nat, hbit_digit⟩ have hdigits_one : RadixVec.ofDigitsBE' (digits.toList.take i) = RadixVec.ofDigitsBE' (digits.toList.take (i - 1)) * 2 + 1 := by @@ -871,12 +880,12 @@ theorem pow_32_intro {p self exponent} : exact Nat.mod_eq_of_lt (by decide) have hradix : (↑(2 : Radix) : Nat) = 2 := rfl simp [hdigits_take, hbit_digit, hmod1, hradix] - have hb1 : (↑(BitVec.toNat b[32 - i]) : Fp p) = 1 := by + have hb1 : (if b[32 - i] then (1 : Fp p) else 0) = 1 := by simpa using hbit_nat calc - ↑(BitVec.toNat (List.Vector.get b idx)) * + (if List.Vector.get b idx then (1 : Fp p) else 0) * (self ^ a * self ^ a * self) + - (1 - ↑(BitVec.toNat (List.Vector.get b idx))) * + (1 - (if List.Vector.get b idx then (1 : Fp p) else 0)) * (self ^ a * self ^ a) = self ^ a * self ^ a * self := by rw [hb_index, hb1] @@ -923,7 +932,7 @@ theorem pow_32_intro {p self exponent} : theorem lt_intro {p self another} [Lampe.Crypto.Bn254.Prime p] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::lt».call h![] h![self, another]) + («std-1.0.0-beta.25::field::lt».call h![] h![self, another]) (fun r => r = decide (self.val < another.val)) := by enter_decl steps [Lampe.Stdlib.Compat.is_bn254_spec] @@ -934,7 +943,7 @@ theorem lt_intro {p self another} [Lampe.Crypto.Bn254.Prime p] : theorem from_le_bytes_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::from_le_bytes».call h![N] h![bytes]) + («std-1.0.0-beta.25::field::from_le_bytes».call h![N] h![bytes]) fun output => output = Fp.ofBytesLE (P := p) bytes.toList := by rcases N with ⟨⟨N, hN⟩⟩ enter_decl @@ -962,7 +971,7 @@ theorem from_le_bytes_intro : theorem from_be_bytes_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::from_be_bytes».call h![N] h![bytes]) + («std-1.0.0-beta.25::field::from_be_bytes».call h![N] h![bytes]) fun output => output = Fp.ofBytesLE (P := p) bytes.toList.reverse := by rcases N with ⟨⟨N, hN⟩⟩ enter_decl @@ -992,179 +1001,9 @@ theorem from_be_bytes_intro : theorem sgn0_intro : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::sgn0».call h![] h![f]) - (fun r => r = @Builtin.CastTp.cast Tp.field (Tp.u 1) _ p f) := by + («std-1.0.0-beta.25::field::sgn0».call h![] h![f]) + (fun r => r = ((@Builtin.CastTp.cast Tp.field (Tp.u 8) _ p f) % 2 == 1)) := by enter_decl - simpa using - (Lampe.STHoare.cast_intro (p := p) (Γ := env) (tp := Tp.field) (tp' := Tp.u 1) (v := f)) - -private lemma ofBytesLE_split_eq_foldl {p} {bytes : List.Vector (BitVec 8) 32} : - (Fp.ofBytesLE (P := p) (bytes.toList.reverse.take 16) : Fp p) + - (Fp.ofBytesLE (P := p) (bytes.toList.reverse.drop 16 |>.take 16) : Fp p) * - (256 : Fp p) ^ 16 = - bytes.toList.zipIdx.foldl - (fun (acc : Fp p) (ib : BitVec 8 × ℕ) => - acc + (ib.1.toNat : Fp p) * (256 : Fp p) ^ (31 - ib.2)) - (0 : Fp p) := by - -- Both sides equal Fp.ofBytesLE(bytes.reverse) - -- Step 1: LHS = ofBytesLE(bytes.reverse) - suffices h : ∀ (l : List (BitVec 8)), l.length = 32 → - (Fp.ofBytesLE (P := p) (l.reverse.take 16) : Fp p) + - (Fp.ofBytesLE (P := p) (l.reverse.drop 16) : Fp p) * (256 : Fp p) ^ 16 = - l.zipIdx.foldl (fun (acc : Fp p) (ib : BitVec 8 × ℕ) => - acc + (ib.1.toNat : Fp p) * (256 : Fp p) ^ (31 - ib.2)) 0 by - have hlen : bytes.toList.length = 32 := by simp - have : (bytes.toList.reverse.drop 16).take 16 = bytes.toList.reverse.drop 16 := by - apply List.take_of_length_le; simp - rw [this] - exact h bytes.toList hlen - intro l hlen - -- Step 1: Combine LHS using ofLimbsLE'_append - simp only [Fp.ofBytesLE, List.map_take, List.map_drop] - set m := l.reverse.map BitVec.toNat - have hm_len : m.length = 32 := by simp [m, hlen] - -- ofLimbsLE'(take 16 m) + 256^16 * ofLimbsLE'(drop 16 m) = ofLimbsLE'(m) - have hcombine : RadixVec.ofLimbsLE' 256 (m.take 16) + 256 ^ 16 * RadixVec.ofLimbsLE' 256 (m.drop 16) = - RadixVec.ofLimbsLE' 256 m := by - have htl : (m.take 16).length = 16 := by simp [hm_len] - have hpow : (256 : ℕ) ^ 16 = 256 ^ (m.take 16).length := by rw [htl] - conv_lhs => rw [hpow] - rw [← RadixVec.ofLimbsLE'_append, List.take_append_drop] - -- Rewrite LHS to cast(ofLimbsLE'(m)) - have : (↑(RadixVec.ofLimbsLE' 256 (m.take 16)) : Fp p) + - ↑(RadixVec.ofLimbsLE' 256 (m.drop 16)) * (256 : Fp p) ^ 16 = - ↑(RadixVec.ofLimbsLE' 256 m) := by - push_cast [← hcombine]; ring - rw [this] - -- Step 2: ofLimbsLE' 256 m = ofLimbsBE' 256 (l.map toNat) - have : m = (l.map BitVec.toNat).reverse := by simp [m, List.map_reverse] - rw [this, RadixVec.ofLimbsLE', List.reverse_reverse] - -- Step 3: cast(ofLimbsBE' 256 (l.map toNat)) = foldl ... - -- First prove the Nat-level identity, then cast - suffices hnat : ∀ (xs : List ℕ) (n : ℕ), xs.length = n → - (RadixVec.ofLimbsBE' 256 xs : ℕ) = - xs.zipIdx.foldl (fun acc (ix : ℕ × ℕ) => acc + ix.1 * 256 ^ (n - 1 - ix.2)) 0 by - have hnat' := hnat (l.map BitVec.toNat) 32 (by simp [hlen]) - -- cast(ofLimbsBE'(map toNat l)) = cast(foldl ... (map toNat l).zipIdx) - rw [show (↑(RadixVec.ofLimbsBE' 256 (l.map BitVec.toNat)) : Fp p) = - ↑(((l.map BitVec.toNat).zipIdx.foldl (fun acc (ix : ℕ × ℕ) => acc + ix.1 * 256 ^ (31 - ix.2)) 0)) from by - exact_mod_cast congrArg _ hnat'] - -- Goal: cast(foldl over (map toNat l).zipIdx) = foldl over l.zipIdx - -- Relate the two foldls directly via induction - suffices hsuf2 : ∀ (xs : List (BitVec 8)) (init_n : ℕ) (init_fp : Fp p) (k : ℕ), - init_fp = ↑init_n → - (List.foldl (fun (acc : Fp p) (ib : BitVec 8 × ℕ) => - acc + ↑ib.1.toNat * (256 : Fp p) ^ (31 - ib.2)) init_fp (xs.zipIdx k) : Fp p) = - ↑(List.foldl (fun (acc : ℕ) (ix : ℕ × ℕ) => - acc + ix.1 * 256 ^ (31 - ix.2)) init_n ((xs.map BitVec.toNat).zipIdx k)) by - exact (hsuf2 l 0 0 0 (by simp)).symm - intro xs init_n init_fp k hinit - induction xs generalizing init_n init_fp k with - | nil => simp [hinit] - | cons x xs ih => - simp only [List.map, List.zipIdx_cons, List.foldl_cons] - apply ih - subst hinit - push_cast - ring - intro xs n hxs - induction xs generalizing n with - | nil => simp [RadixVec.ofLimbsBE'_nil] - | cons x xs ih => - cases n with - | zero => simp at hxs - | succ n => - simp only [List.length_cons, Nat.succ.injEq] at hxs - simp only [RadixVec.ofLimbsBE'_cons] - -- Goal uses zipIdx (value, index format): ix.1 = value, ix.2 = index - suffices hgen : ∀ (init k : ℕ) (ys : List ℕ), ys.length + k = n + 1 → - List.foldl (fun acc (ix : ℕ × ℕ) => acc + ix.1 * 256 ^ (n - ix.2)) - init (List.zipIdx ys k) = - init + RadixVec.ofLimbsBE' 256 ys by - simp only [List.zipIdx_cons, List.foldl_cons, Nat.sub_zero, zero_add] - rw [show n + 1 - 1 = n from by omega] - have hlen : xs.length + 1 = n + 1 := by omega - rw [hgen (x * 256 ^ n) 1 xs hlen, hxs] - intro init k ys hyk - induction ys generalizing init k with - | nil => simp [RadixVec.ofLimbsBE'_nil] - | cons y ys' ihy => - simp only [List.zipIdx_cons, List.foldl_cons, RadixVec.ofLimbsBE'_cons] - have hyk' : ys'.length + (k + 1) = n + 1 := by - simp only [List.length_cons] at hyk; omega - rw [ihy _ (k + 1) hyk'] - have hexp : n - k = ys'.length := by omega - rw [hexp]; ring - -set_option maxRecDepth 4096 in -theorem bytes32_to_field_spec {p bytes} : - STHoare p env ⟦⟧ - («std-1.0.0-beta.14::field::bytes32_to_field».call h![] h![bytes]) - (fun r => r = (bytes.toList.zipIdx.foldl - (fun (acc : Fp p) (ib : BitVec 8 × ℕ) => - acc + (ib.1.toNat : Fp p) * (256 : Fp p) ^ (31 - ib.2)) - (0 : Fp p))) := by - enter_decl - steps - loop_inv nat fun i _ _ => - [v ↦ ⟨.field, (256 ^ i : Fp p)⟩] ⋆ - [high ↦ ⟨.field, Fp.ofBytesLE (P := p) (bytes.toList.reverse.drop 16 |>.take i)⟩] ⋆ - [low ↦ ⟨.field, Fp.ofBytesLE (P := p) (bytes.toList.reverse.take i)⟩] - · -- base case - simp only [Fp.ofBytesLE, RadixVec.ofLimbsLE', Builtin.CastTp.cast] - sl - all_goals simp - · -- inductive step - intro i _ hhi - steps - · congr 1 - conv at hhi => rhs; whnf - simp [ - hhi, Fp.ofBytesLE, RadixVec.ofLimbsLE'_append, - List.take_add_one, List.Vector.toList_getElem] - rw [mul_comm] - ring_nf - have hmin := Nat.min_eq_left (Nat.le_of_lt hhi) - simp [RadixVec.ofLimbsLE', RadixVec.ofLimbsBE'_cons, RadixVec.ofLimbsBE'_nil] - have hmod : (15 + (4294967296 - i)) % 4294967296 = 15 - i := by - have hi15 : i ≤ 15 := Nat.le_of_lt_succ hhi - have h1 : 15 + (4294967296 - i) = (15 - i) + 4294967296 := by omega - rw [h1, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] - have hmod2 : 31 - (16 + i) = 15 - i := by omega - simp only [hmod, hmod2] - rw [show min i 16 = i from hmin] - · congr 1 - conv at hhi => rhs; whnf - simp [Fp.ofBytesLE, RadixVec.ofLimbsLE'_append, - List.take_add_one] - rw [mul_comm] - ring_nf - have hmin := Nat.min_eq_left (Nat.le_of_lt hhi) - simp [RadixVec.ofLimbsLE'] - have hmod : (31 + (4294967296 - i)) % 4294967296 = 31 - i := by - have hi16 : i < 16 := hhi - have h1 : 31 + (4294967296 - i) = (31 - i) + 4294967296 := by omega - rw [h1, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] - have hmin2 : min i 32 = i := by have := hhi; omega - simp only [hmod, hmin2] - congr 1 - set bl := List.Vector.toList bytes with hbl - have hlen : i < bl.reverse.length := by - simp [bl]; exact Nat.lt_trans hhi (by norm_num) - have hge : bl.reverse[i]? = some (bl.reverse[i]'hlen) := - List.getElem?_eq_getElem hlen - show - ((bytes[31 - i]).toNat : Fp p) = - ((RadixVec.ofLimbsBE' 256 (List.map BitVec.toNat bl.reverse[i]?.toList).reverse : ℕ) : Fp p) - simp only [hge, Option.toList_some, List.map_cons, List.map_nil, - List.reverse_cons, List.reverse_nil, List.nil_append, - RadixVec.ofLimbsBE'_cons, RadixVec.ofLimbsBE'_nil, List.length_nil, pow_zero, - mul_one, Nat.add_zero] - congr 1 - rw [List.getElem_reverse] - simp [bl, List.Vector.toList_getElem] - rfl - -- post-loop steps - · subst_vars - exact ofBytesLE_split_eq_foldl + subst_vars + rfl diff --git a/stdlib/lampe/Stdlib/Hash/Mod.lean b/stdlib/lampe/Stdlib/Hash/Mod.lean index e5c84d61..19f87130 100644 --- a/stdlib/lampe/Stdlib/Hash/Mod.lean +++ b/stdlib/lampe/Stdlib/Hash/Mod.lean @@ -1,28 +1,28 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.Default import Stdlib.Hash.Poseidon2 namespace Lampe.Stdlib.Hash -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» abbrev BuildHasherDefaultTp (H : Tp) : Tp := - «std-1.0.0-beta.14::hash::BuildHasherDefault».tp h![H] + «std-1.0.0-beta.25::hash::BuildHasherDefault».tp h![H] abbrev Hasher.hasImpl (env : Env) (tp : Tp) := - «std-1.0.0-beta.14::hash::Hasher».hasImpl env h![] tp + «std-1.0.0-beta.25::hash::Hasher».hasImpl env h![] tp abbrev HashTrait.hasImpl (env : Env) (tp : Tp) := - «std-1.0.0-beta.14::hash::Hash».hasImpl env h![] tp + «std-1.0.0-beta.25::hash::Hash».hasImpl env h![] tp def buildHasherDefaultRepr {p H} : Tp.denote p (BuildHasherDefaultTp H) := - HList.toTuple p h![] (some «std-1.0.0-beta.14::hash::BuildHasherDefault».name) + HList.toTuple p h![] (some «std-1.0.0-beta.25::hash::BuildHasherDefault».name) theorem poseidon2_permutation4_spec {p} {input : Tp.denote p (Tp.field.array (4 : U 32))} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::poseidon2_permutation».call h![(4 : U 32)] + («std-1.0.0-beta.25::hash::poseidon2_permutation».call h![(4 : U 32)] h![input, (4 : U 32)]) (fun r => r = Lampe.Crypto.Poseidon2.noirPermutation4 input) := by enter_decl @@ -74,7 +74,7 @@ reduces to the builtin call. -/ theorem blake3_spec {p} {N : U 32} {input : Tp.denote p ((Tp.u 8).array N)} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::blake3».call h![N] h![input]) + («std-1.0.0-beta.25::hash::blake3».call h![N] h![input]) (fun r => r = Lampe.Crypto.Blake3.blake3Hash input) := by enter_decl -- Reduce `isUnconstrained()` (always `false`); the body becomes @@ -116,7 +116,7 @@ theorem buildHasherDefault_build_hasher_spec {p H} (Lampe.Stdlib.Default.default h![] H h![] h![] h![]) (fun r => r = h)) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::BuildHasher».build_hasher + («std-1.0.0-beta.25::hash::BuildHasher».build_hasher h![] (BuildHasherDefaultTp H) h![H] h![] h![buildHasherDefaultRepr (H := H)]) (fun r => r = h) := by resolve_trait @@ -129,11 +129,11 @@ theorem field_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] h![stateRef, self]) + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] .field h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] .field h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -144,12 +144,12 @@ theorem u1_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 1) .field _ p self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.u 1) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.u 1) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -160,12 +160,12 @@ theorem u8_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 8) .field _ p self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.u 8) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.u 8) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -176,12 +176,12 @@ theorem u16_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 16) .field _ p self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.u 16) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.u 16) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -192,12 +192,12 @@ theorem u32_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 32) .field _ p self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.u 32) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.u 32) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -208,12 +208,12 @@ theorem u64_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 64) .field _ p self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.u 64) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.u 64) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -224,12 +224,12 @@ theorem u128_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 128) .field _ p self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.u 128) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.u 128) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -240,13 +240,13 @@ theorem i8_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 8) .field _ p (@Builtin.CastTp.cast (.i 8) (.u 8) _ p self)]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.i 8) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.i 8) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -257,13 +257,13 @@ theorem i16_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 16) .field _ p (@Builtin.CastTp.cast (.i 16) (.u 16) _ p self)]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.i 16) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.i 16) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -274,13 +274,13 @@ theorem i32_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 32) .field _ p (@Builtin.CastTp.cast (.i 32) (.u 32) _ p self)]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.i 32) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.i 32) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -291,13 +291,13 @@ theorem i64_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast (.u 64) .field _ p (@Builtin.CastTp.cast (.i 64) (.u 64) _ p self)]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] (.i 64) h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] (.i 64) h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -308,12 +308,12 @@ theorem bool_hash_spec {p H stateRef} {h_hasher : Hasher.hasImpl env H} (h_write_spec : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] H h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] h![stateRef, @Builtin.CastTp.cast .bool .field _ p self]) (fun _ => [stateRef ↦ ⟨H, final⟩])) : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] .bool h![] h![H] h![self, stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] .bool h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait steps [h_write_spec] @@ -322,7 +322,7 @@ theorem unit_hash_spec {p H stateRef} {state : Tp.denote p H} : STHoare p env [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.14::hash::Hash».hash h![] .unit h![] h![H] h![(), stateRef]) + («std-1.0.0-beta.25::hash::Hash».hash h![] .unit h![] h![H] h![(), stateRef]) (fun _ => [stateRef ↦ ⟨H, state⟩]) := by resolve_trait steps diff --git a/stdlib/lampe/Stdlib/Hash/Pedersen.lean b/stdlib/lampe/Stdlib/Hash/Pedersen.lean index 533be661..d2082cb0 100644 --- a/stdlib/lampe/Stdlib/Hash/Pedersen.lean +++ b/stdlib/lampe/Stdlib/Hash/Pedersen.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.EmbeddedCurveOps import Stdlib.Field.Bn254 @@ -6,7 +6,7 @@ import Stdlib.Hash.Mod namespace Lampe.Stdlib.Hash.Pedersen -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Builtin (bytesToList) open Lampe.Crypto.EmbeddedCurve open Lampe.Crypto.Pedersen @@ -71,7 +71,7 @@ theorem derive_generators_spec {p} {N M : U 32} {domainBytes : Tp.denote p ((Tp.u 8).array M)} {startIdx : U 32} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::derive_generators».call h![N, M] + («std-1.0.0-beta.25::hash::derive_generators».call h![N, M] h![domainBytes, startIdx]) (fun r => r = derivePedersenGenerators p @@ -118,7 +118,7 @@ below. -/ theorem from_field_unsafe_spec {p} [Lampe.Crypto.Bn254.Prime p] {scalar : Fp p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::from_field_unsafe».call h![] h![scalar]) + («std-1.0.0-beta.25::hash::from_field_unsafe».call h![] h![scalar]) (fun r => ∃∃ xlo xhi, r = Scalar.mk xlo xhi ∧ @@ -223,7 +223,7 @@ private theorem pedersen_commitment_with_separator_spec {p N} {input : Tp.denote p (Tp.field.array N)} {separator : U 32} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::pedersen_commitment_with_separator».call h![N] + («std-1.0.0-beta.25::hash::pedersen_commitment_with_separator».call h![N] h![input, separator]) (fun r => ∃∃ Ss : List.Vector (Scalar.denote p) N.toNat, @@ -325,7 +325,7 @@ theorem pedersen_commitment_with_separator_spec_canonical {p N} {input : Tp.denote p (Tp.field.array N)} {separator : U 32} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::pedersen_commitment_with_separator».call h![N] + («std-1.0.0-beta.25::hash::pedersen_commitment_with_separator».call h![N] h![input, separator]) (fun r => r = pedersenCommitment p defaultDomainBytes input separator.toNat) := by @@ -370,7 +370,7 @@ private theorem pedersen_hash_with_separator_spec {p N} {input : Tp.denote p (Tp.field.array N)} {separator : U 32} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::pedersen_hash_with_separator».call h![N] + («std-1.0.0-beta.25::hash::pedersen_hash_with_separator».call h![N] h![input, separator]) (fun r => ∃∃ Ss : List.Vector (Scalar.denote p) N.toNat, @@ -502,7 +502,7 @@ private theorem pedersen_hash_with_separator_spec {p N} simp set lenScalar : Tp.denote p Scalar.type := HList.toTuple p h![(Builtin.CastTp.cast N : Fp p), (Builtin.CastTp.cast ↑(0 : Fp p) : Fp p)] - (some «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar».name) with hLenScalar_def + (some «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar».name) with hLenScalar_def set lenGen : Tp.denote p Point.type := length_generator.get ⟨BitVec.toNat ↑(0 : U 32), hLgBdd⟩ with hLenGen_def set sFull : Tp.denote p (Scalar.type.array (N + 1)) := @@ -697,7 +697,7 @@ theorem pedersen_hash_with_separator_spec_canonical {p N} {input : Tp.denote p (Tp.field.array N)} {separator : U 32} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::pedersen_hash_with_separator».call h![N] + («std-1.0.0-beta.25::hash::pedersen_hash_with_separator».call h![N] h![input, separator]) (fun r => r = pedersenHash p defaultDomainBytes input separator.toNat) := by @@ -733,7 +733,7 @@ theorem pedersen_commitment_spec_canonical {p N} [Lampe.Crypto.Bn254.Prime p] {input : Tp.denote p (Tp.field.array N)} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::pedersen_commitment».call h![N] h![input]) + («std-1.0.0-beta.25::hash::pedersen_commitment».call h![N] h![input]) (fun r => r = pedersenCommitment p defaultDomainBytes input 0) := by enter_decl @@ -748,7 +748,7 @@ theorem pedersen_hash_spec_canonical {p N} [Lampe.Crypto.Bn254.Prime p] {input : Tp.denote p (Tp.field.array N)} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::pedersen_hash».call h![N] h![input]) + («std-1.0.0-beta.25::hash::pedersen_hash».call h![N] h![input]) (fun r => r = pedersenHash p defaultDomainBytes input 0) := by enter_decl diff --git a/stdlib/lampe/Stdlib/Hash/Poseidon2.lean b/stdlib/lampe/Stdlib/Hash/Poseidon2.lean index 9315d411..d08687c0 100644 --- a/stdlib/lampe/Stdlib/Hash/Poseidon2.lean +++ b/stdlib/lampe/Stdlib/Hash/Poseidon2.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Lampe.Crypto.Poseidon2 import Stdlib.Default @@ -7,17 +7,17 @@ import Stdlib.Vector namespace Lampe.Stdlib.Hash.Poseidon2 -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Crypto abbrev Poseidon2Tp : Tp := - «std-1.0.0-beta.14::hash::poseidon2::Poseidon2».tp h![] + «std-1.0.0-beta.25::hash::poseidon2::Poseidon2».tp h![] abbrev Poseidon2Repr (p : Prime) : Type := Tp.denote p Poseidon2Tp abbrev Poseidon2HasherTp : Tp := - «std-1.0.0-beta.14::hash::poseidon2::Poseidon2Hasher».tp h![] + «std-1.0.0-beta.25::hash::poseidon2::Poseidon2Hasher».tp h![] abbrev Poseidon2HasherRepr (p : Prime) : Type := Tp.denote p Poseidon2HasherTp @@ -451,7 +451,7 @@ private abbrev HasherFinishLoopInv {p} theorem default_spec {p} : STHoare p env ⟦⟧ (Lampe.Stdlib.Default.default h![] - («std-1.0.0-beta.14::hash::poseidon2::Poseidon2Hasher».tp h![]) h![] h![] h![]) + («std-1.0.0-beta.25::hash::poseidon2::Poseidon2Hasher».tp h![]) h![] h![] h![]) (fun r => r = Tuple.mk h![([] : List (Tp.denote p .field))]) := by resolve_trait steps @@ -460,7 +460,7 @@ theorem default_spec {p} theorem rate_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::poseidon2::RATE».call h![] h![]) + («std-1.0.0-beta.25::hash::poseidon2::RATE».call h![] h![]) (fun r => r = (3 : U 32)) := by enter_decl steps @@ -469,7 +469,7 @@ theorem rate_spec {p} theorem new_spec {p} {iv : Tp.denote p .field} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::poseidon2::Poseidon2::new».call h![] h![iv]) + («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::new».call h![] h![iv]) (fun r => r = spongeToRepr (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) iv)) := by enter_decl steps [rate_spec] @@ -490,7 +490,7 @@ theorem perform_duplex_spec {p selfRef} {squeezeMode : Bool} : STHoare p env [selfRef ↦ ⟨Poseidon2Tp, mkPoseidon2Repr cache state cacheSize squeezeMode⟩] - («std-1.0.0-beta.14::hash::poseidon2::Poseidon2::perform_duplex».call h![] h![selfRef]) + («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::perform_duplex».call h![] h![selfRef]) (fun _ => [selfRef ↦ ⟨Poseidon2Tp, performDuplexRepr (mkPoseidon2Repr cache state cacheSize squeezeMode)⟩]) := by @@ -528,7 +528,7 @@ theorem absorb_spec {p selfRef} (hout : absorbRepr? self input = some out) : STHoare p env [selfRef ↦ ⟨Poseidon2Tp, self⟩] - («std-1.0.0-beta.14::hash::poseidon2::Poseidon2::absorb».call h![] h![selfRef, input]) + («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::absorb».call h![] h![selfRef, input]) (fun _ => [selfRef ↦ ⟨Poseidon2Tp, out⟩]) := by rcases self with ⟨cache, state, cacheSize, squeezeMode, unitTail⟩ cases unitTail @@ -651,7 +651,7 @@ theorem squeeze_spec {p selfRef} (hout : squeezeRepr? self = some (out, outSelf)) : STHoare p env [selfRef ↦ ⟨Poseidon2Tp, self⟩] - («std-1.0.0-beta.14::hash::poseidon2::Poseidon2::squeeze».call h![] h![selfRef]) + («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::squeeze».call h![] h![selfRef]) (fun r => [selfRef ↦ ⟨Poseidon2Tp, outSelf⟩] ⋆ ⟦r = out⟧) := by rcases self with ⟨cache, state, cacheSize, squeezeMode, unit0⟩ simp [squeezeRepr?, reprToSponge, Crypto.Poseidon2.Sponge.squeeze?, @@ -684,7 +684,7 @@ theorem hash_internal_spec {p} inLen.toNat isVariableLength) = some out) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::poseidon2::Poseidon2::hash_internal».call h![N] + («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::hash_internal».call h![N] h![input, inLen, isVariableLength]) (fun r => r = out) := by enter_decl @@ -762,7 +762,7 @@ theorem hash_spec {p} messageSize.toNat (messageSize ≠ N) = some out) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::poseidon2::Poseidon2::hash».call h![N] + («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::hash».call h![N] h![input, messageSize]) (fun r => r = out) := by enter_decl @@ -774,7 +774,7 @@ theorem hasher_write_spec {p selfRef} {input : Fp p} : STHoare p env [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩] - («std-1.0.0-beta.14::hash::Hasher».write h![] Poseidon2HasherTp h![] h![] + («std-1.0.0-beta.25::hash::Hasher».write h![] Poseidon2HasherTp h![] h![] h![selfRef, input]) (fun _ => [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr (inputs ++ [input])⟩]) := by resolve_trait @@ -789,7 +789,7 @@ theorem hasher_finish_spec {p} inputs.length false = some out) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::hash::Hasher».finish h![] Poseidon2HasherTp h![] h![] + («std-1.0.0-beta.25::hash::Hasher».finish h![] Poseidon2HasherTp h![] h![] h![mkPoseidon2HasherRepr inputs]) (fun r => r = out) := by resolve_trait diff --git a/stdlib/lampe/Stdlib/Lib.lean b/stdlib/lampe/Stdlib/Lib.lean index 0d8283ac..8ce772e1 100644 --- a/stdlib/lampe/Stdlib/Lib.lean +++ b/stdlib/lampe/Stdlib/Lib.lean @@ -1,9 +1,9 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Lib -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» set_option maxHeartbeats 800000 in /-- @@ -13,7 +13,7 @@ to step through print calls when verifying your programs. -/ theorem println_spec {p T a} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::println».call h![T] h![a]) + («std-1.0.0-beta.25::println».call h![T] h![a]) (fun r => r = ()) := by enter_decl step_as (⟦⟧) (fun r => r = ()) @@ -32,7 +32,7 @@ to step through print calls when verifying your programs. -/ theorem print_spec {p T a} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::print».call h![T] h![a]) + («std-1.0.0-beta.25::print».call h![T] h![a]) (fun r => r = ()) := by enter_decl step_as (⟦⟧) (fun r => r = ()) diff --git a/stdlib/lampe/Stdlib/Ops/Arith.lean b/stdlib/lampe/Stdlib/Ops/Arith.lean index 59a69ce8..b9f33983 100644 --- a/stdlib/lampe/Stdlib/Ops/Arith.lean +++ b/stdlib/lampe/Stdlib/Ops/Arith.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Init.Data.BitVec.Lemmas import Lampe import Stdlib.Convert @@ -8,7 +8,7 @@ import Stdlib.Tuple namespace Lampe.Stdlib.Ops.Arith -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Stdlib set_option Lampe.pp.Expr false @@ -17,15 +17,15 @@ set_option Lampe.pp.STHoare false /-- A shorthand for a call to the `std::ops::arith::Add::add` method. -/ @[reducible] def add {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Add».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Add».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Add».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Add».add.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Add».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Add».add.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Add».add.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::Add».add.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Add».add.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::Add».add generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::arith::Add».add.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::Add».add generics Self associatedTypes fnGenerics theorem field_add_spec {p a b} : STHoare p env ⟦⟧ @@ -81,15 +81,6 @@ theorem u8_add_spec {p a b} reduce_fn_body at * simp_all -theorem u1_add_spec {p a b} - : STHoare p env ⟦⟧ - (add h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a + b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_add_spec {p a b} : STHoare p env ⟦⟧ (add h![] (.i 8) h![] h![] h![a, b]) @@ -129,15 +120,15 @@ theorem i64_add_spec {p a b} /-- A shorthand for a call to the `std::ops::arith::Sub::sub` method. -/ @[reducible] def sub {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Sub».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Sub».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Sub».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Sub».sub.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Sub».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Sub».sub.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Sub».sub.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::Sub».sub.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Sub».sub.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::Sub».sub generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::arith::Sub».sub.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::Sub».sub generics Self associatedTypes fnGenerics theorem field_sub_spec {p a b} : STHoare p env ⟦⟧ @@ -193,15 +184,6 @@ theorem u8_sub_spec {p a b} reduce_fn_body at * simp_all -theorem u1_sub_spec {p a b} - : STHoare p env ⟦⟧ - (sub h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a - b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_sub_spec {p a b} : STHoare p env ⟦⟧ (sub h![] (.i 8) h![] h![] h![a, b]) @@ -241,15 +223,15 @@ theorem i64_sub_spec {p a b} /-- A shorthand for a call to the `std::ops::arith::Mul::mul` method. -/ @[reducible] def mul {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Mul».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Mul».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Mul».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Mul».mul.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Mul».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Mul».mul.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Mul».mul.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::Mul».mul.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Mul».mul.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::Mul».mul generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::arith::Mul».mul.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::Mul».mul generics Self associatedTypes fnGenerics theorem field_mul_spec {p a b} : STHoare p env ⟦⟧ @@ -305,15 +287,6 @@ theorem u8_mul_spec {p a b} reduce_fn_body at * simp_all -theorem u1_mul_spec {p a b} - : STHoare p env ⟦⟧ - (mul h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a * b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_mul_spec {p a b} : STHoare p env ⟦⟧ (mul h![] (.i 8) h![] h![] h![a, b]) @@ -353,15 +326,15 @@ theorem i64_mul_spec {p a b} /-- A shorthand for a call to the `std::ops::arith::Div::div` method. -/ @[reducible] def div {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Div».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Div».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Div».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Div».div.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Div».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Div».div.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Div».div.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::Div».div.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Div».div.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::Div».div generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::arith::Div».div.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::Div».div generics Self associatedTypes fnGenerics theorem field_div_spec {p a b} : STHoare p env ⟦⟧ @@ -417,15 +390,6 @@ theorem u8_div_spec {p a b} reduce_fn_body at * simp_all -theorem u1_div_spec {p a b} - : STHoare p env ⟦⟧ - (div h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a / b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_div_spec {p a b} : STHoare p env ⟦⟧ (div h![] (.i 8) h![] h![] h![a, b]) @@ -465,15 +429,15 @@ theorem i64_div_spec {p a b} /-- A shorthand for a call to the `std::ops::arith::Rem::rem` method. -/ @[reducible] def rem {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Rem».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Rem».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Rem».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Rem».rem.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Rem».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Rem».rem.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Rem».rem.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::Rem».rem.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Rem».rem.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::Rem».rem generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::arith::Rem».rem.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::Rem».rem generics Self associatedTypes fnGenerics theorem u128_rem_spec {p a b} : STHoare p env ⟦⟧ @@ -520,15 +484,6 @@ theorem u8_rem_spec {p a b} reduce_fn_body at * simp_all -theorem u1_rem_spec {p a b} - : STHoare p env ⟦⟧ - (rem h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a % b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_rem_spec {p a b} : STHoare p env ⟦⟧ (rem h![] (.i 8) h![] h![] h![a, b]) @@ -568,15 +523,15 @@ theorem i64_rem_spec {p a b} /-- A shorthand for a call to the `std::ops::arith::Neg::neg` method. -/ @[reducible] def neg {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Neg».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Neg».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Neg».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::Neg».neg.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Neg».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::Neg».neg.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Neg».neg.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::Neg».neg.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::Neg».neg.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::Neg».neg generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::arith::Neg».neg.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::Neg».neg generics Self associatedTypes fnGenerics theorem field_neg_spec {p a} : STHoare p env ⟦⟧ @@ -626,25 +581,15 @@ theorem i64_neg_spec {p a} /-- A shorthand for a call to the `std::ops::arith::WrappingAdd::wrapping_add` method. -/ @[reducible] def wrapping_add {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingAdd».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingAdd».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingAdd».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingAdd».wrapping_add.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingAdd».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingAdd».wrapping_add.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::WrappingAdd».wrapping_add.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::WrappingAdd».wrapping_add.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::WrappingAdd».wrapping_add.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::WrappingAdd».wrapping_add generics Self associatedTypes fnGenerics - -theorem u1_wrapping_add_spec {p a b} - : STHoare p env ⟦⟧ - (wrapping_add h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a + b) := by - resolve_trait - steps - subst_vars - simp only [BitVec.xor_eq] - rw [←BitVec.add_eq_xor] + («std-1.0.0-beta.25::ops::arith::WrappingAdd».wrapping_add.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::WrappingAdd».wrapping_add generics Self associatedTypes fnGenerics theorem u8_wrapping_add_spec {p a b} [gt : Prime.BitsGT p 9] @@ -813,25 +758,15 @@ theorem field_wrapping_add_spec {p a b} /-- A shorthand for a call to the `std::ops::arith::WrappingSub::wrapping_sub` method. -/ @[reducible] def wrapping_sub {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingSub».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingSub».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingSub».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingSub».wrapping_sub.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingSub».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingSub».wrapping_sub.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::WrappingSub».wrapping_sub.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::WrappingSub».wrapping_sub.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::WrappingSub».wrapping_sub.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::WrappingSub».wrapping_sub generics Self associatedTypes fnGenerics - -theorem u1_wrapping_sub_spec {p a b} - : STHoare p env ⟦⟧ - (wrapping_sub h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a - b) := by - resolve_trait - steps - subst_vars - simp only [BitVec.xor_eq] - rw [←BitVec.sub_eq_xor] + («std-1.0.0-beta.25::ops::arith::WrappingSub».wrapping_sub.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::WrappingSub».wrapping_sub generics Self associatedTypes fnGenerics theorem u8_wrapping_sub_spec {p a b} [gt : Prime.BitsGT p 129] @@ -1080,24 +1015,15 @@ theorem field_wrapping_sub_spec {p a b} /-- A shorthand for a call to the `std::ops::arith::WrappingMul::wrapping_mul` method. -/ @[reducible] def wrapping_mul {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingMul».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingMul».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingMul».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::arith::WrappingMul».wrapping_mul.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingMul».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::arith::WrappingMul».wrapping_mul.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::WrappingMul».wrapping_mul.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::arith::WrappingMul».wrapping_mul.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::arith::WrappingMul».wrapping_mul.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::arith::WrappingMul».wrapping_mul generics Self associatedTypes fnGenerics - -theorem u1_wrapping_mul_spec {p a b} - : STHoare p env ⟦⟧ - (wrapping_mul h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a * b) := by - resolve_trait - steps - subst_vars - rw [←BitVec.mul_eq_and] + («std-1.0.0-beta.25::ops::arith::WrappingMul».wrapping_mul.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::arith::WrappingMul».wrapping_mul generics Self associatedTypes fnGenerics theorem u8_wrapping_mul {p a b} [gt : Prime.BitsGT p 16] @@ -1173,7 +1099,7 @@ theorem u64_wrapping_mul {p a b} theorem two_pow_64_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::two_pow_64».call h![] h![]) + («std-1.0.0-beta.25::ops::arith::two_pow_64».call h![] h![]) (fun r => r = Integer.two_pow_64) := by enter_decl steps @@ -1183,7 +1109,7 @@ theorem two_pow_64_spec {p} set_option maxHeartbeats 800000 in theorem split_into_64_bit_limbs_spec {p a} [gt : Prime.BitsGT p 128] : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::ops::arith::split_into_64_bit_limbs».call h![] h![a]) + («std-1.0.0-beta.25::ops::arith::split_into_64_bit_limbs».call h![] h![a]) (fun r => r = Integer.split64 a) := by enter_decl step_as (⟦⟧) (fun _ => ⟦⟧) diff --git a/stdlib/lampe/Stdlib/Ops/Bit.lean b/stdlib/lampe/Stdlib/Ops/Bit.lean index c4ce9412..4f4f4171 100644 --- a/stdlib/lampe/Stdlib/Ops/Bit.lean +++ b/stdlib/lampe/Stdlib/Ops/Bit.lean @@ -1,9 +1,9 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Ops.Bit -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» set_option Lampe.pp.Expr false set_option Lampe.pp.STHoare false @@ -11,15 +11,15 @@ set_option Lampe.pp.STHoare false /-- A shorthand for a call to the `std::ops::bit::Not::not` method. -/ @[reducible] def not {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Not».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Not».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Not».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Not».not.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Not».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Not».not.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::Not».not.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::bit::Not».not.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::Not».not.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::bit::Not».not generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::bit::Not».not.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::bit::Not».not generics Self associatedTypes fnGenerics theorem bool_not_spec {p a} : STHoare p env ⟦⟧ @@ -75,15 +75,6 @@ theorem u8_not_spec {p a} reduce_fn_body at * simp_all -theorem u1_not_spec {p a} - : STHoare p env ⟦⟧ - (not h![] (.u 1) h![] h![] h![a]) - (fun r => r = a.not) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_not_spec {p a} : STHoare p env ⟦⟧ (not h![] (.i 8) h![] h![] h![a]) @@ -123,15 +114,15 @@ theorem i64_not_spec {p a} /-- A shorthand for a call to the `std::ops::bit::BitOr::bitor` method. -/ @[reducible] def bitOr {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitOr».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitOr».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitOr».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitOr».bitor.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitOr».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitOr».bitor.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::BitOr».bitor.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::bit::BitOr».bitor.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::BitOr».bitor.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::bit::BitOr».bitor generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::bit::BitOr».bitor.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::bit::BitOr».bitor generics Self associatedTypes fnGenerics theorem bool_bit_or_spec {p a b} : STHoare p env ⟦⟧ @@ -188,15 +179,6 @@ theorem u8_bit_or_spec {p a b} reduce_fn_body at * simp_all -theorem u1_bit_or_spec {p a b} - : STHoare p env ⟦⟧ - (bitOr h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a.or b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_bit_or_spec {p a b} : STHoare p env ⟦⟧ (bitOr h![] (.i 8) h![] h![] h![a, b]) @@ -236,15 +218,15 @@ theorem i64_bit_or_spec {p a b} /-- A shorthand for a call to the `std::ops::bit::BitOr::bitand` method. -/ @[reducible] def bitAnd {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitAnd».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitAnd».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitAnd».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitAnd».bitand.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitAnd».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitAnd».bitand.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::BitAnd».bitand.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::bit::BitAnd».bitand.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::BitAnd».bitand.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::bit::BitAnd».bitand generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::bit::BitAnd».bitand.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::bit::BitAnd».bitand generics Self associatedTypes fnGenerics theorem bool_bit_and_spec {p a b} : STHoare p env ⟦⟧ @@ -301,15 +283,6 @@ theorem u8_bit_and_spec {p a b} reduce_fn_body at * simp_all -theorem u1_bit_and_spec {p a b} - : STHoare p env ⟦⟧ - (bitAnd h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a.and b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_bit_and_spec {p a b} : STHoare p env ⟦⟧ (bitAnd h![] (.i 8) h![] h![] h![a, b]) @@ -349,15 +322,15 @@ theorem i64_bit_and_spec {p a b} /-- A shorthand for a call to the `std::ops::bit::BitXor::bitxor` method. -/ @[reducible] def bitXor {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitXor».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitXor».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitXor».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::BitXor».bitxor.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitXor».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::BitXor».bitxor.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::BitXor».bitxor.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::bit::BitXor».bitxor.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::BitXor».bitxor.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::bit::BitXor».bitxor generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::bit::BitXor».bitxor.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::bit::BitXor».bitxor generics Self associatedTypes fnGenerics theorem bool_bit_xor_spec {p a b} : STHoare p env ⟦⟧ @@ -414,15 +387,6 @@ theorem u8_bit_xor_spec {p a b} reduce_fn_body at * simp_all -theorem u1_bit_xor_spec {p a b} - : STHoare p env ⟦⟧ - (bitXor h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a.xor b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_bit_xor_spec {p a b} : STHoare p env ⟦⟧ (bitXor h![] (.i 8) h![] h![] h![a, b]) @@ -462,15 +426,15 @@ theorem i64_bit_xor_spec {p a b} /-- A shorthand for a call to the `std::ops::bit::Shl::shl` method. -/ @[reducible] def shl {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Shl».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Shl».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Shl».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Shl».shl.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Shl».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Shl».shl.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::Shl».shl.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::bit::Shl».shl.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::Shl».shl.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::bit::Shl».shl generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::bit::Shl».shl.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::bit::Shl».shl generics Self associatedTypes fnGenerics theorem u128_shl_spec {p a b} : STHoare p env ⟦⟧ @@ -517,15 +481,6 @@ theorem u8_shl_spec {p a b} reduce_fn_body at * simp_all -theorem u1_shl_spec {p a b} - : STHoare p env ⟦⟧ - (shl h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a <<< b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_shl_spec {p a b} : STHoare p env ⟦⟧ (shl h![] (.i 8) h![] h![] h![a, b]) @@ -565,15 +520,15 @@ theorem i64_shl_spec {p a b} /-- A shorthand for a call to the `std::ops::bit::Shr::shr` method. -/ @[reducible] def shr {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Shr».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Shr».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Shr».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::ops::bit::Shr».shr.«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Shr».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::ops::bit::Shr».shr.«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::Shr».shr.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::ops::bit::Shr».shr.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::ops::bit::Shr».shr.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::ops::bit::Shr».shr generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::ops::bit::Shr».shr.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::ops::bit::Shr».shr generics Self associatedTypes fnGenerics theorem u128_shr_spec {p a b} : STHoare p env ⟦⟧ @@ -620,15 +575,6 @@ theorem u8_shr_spec {p a b} reduce_fn_body at * simp_all -theorem u1_shr_spec {p a b} - : STHoare p env ⟦⟧ - (shr h![] (.u 1) h![] h![] h![a, b]) - (fun r => r = a >>> b) := by - resolve_trait - steps - reduce_fn_body at * - simp_all - theorem i8_shr_spec {p a b} : STHoare p env ⟦⟧ (shr h![] (.i 8) h![] h![] h![a, b]) diff --git a/stdlib/lampe/Stdlib/Option.lean b/stdlib/lampe/Stdlib/Option.lean index 2b95f97c..5cd43676 100644 --- a/stdlib/lampe/Stdlib/Option.lean +++ b/stdlib/lampe/Stdlib/Option.lean @@ -1,32 +1,32 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Stdlib.Cmp import Lampe namespace Lampe.Stdlib.Option -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Cmp.Ord set_option Lampe.pp.Expr false set_option Lampe.pp.STHoare false /-- -Convert a Lean option into a Noir `std-1.0.0-beta.14::option::Option`. +Convert a Lean option into a Noir `std-1.0.0-beta.25::option::Option`. -We recommend providing the user with `std-1.0.0-beta.14::option::Option`s at the boundary of the theorem for any +We recommend providing the user with `std-1.0.0-beta.25::option::Option`s at the boundary of the theorem for any option values 'created' by the theorem. -/ -def fromOption {p t} : Option (t.denote p) -> («std-1.0.0-beta.14::option::Option».tp h![t] |>.denote p) +def fromOption {p t} : Option (t.denote p) -> («std-1.0.0-beta.25::option::Option».tp h![t] |>.denote p) | none => (false, Tp.zero p t, ()) | some val => (true, val, ()) /-- -Convert a Noir `std-1.0.0-beta.14::option::Option` into a Lean option. +Convert a Noir `std-1.0.0-beta.25::option::Option` into a Lean option. -We recommend converting user-provided `std-1.0.0-beta.14::option::Option`s from the user, and converting them +We recommend converting user-provided `std-1.0.0-beta.25::option::Option`s from the user, and converting them within the theorem. -/ -def toOption {p t} : («std-1.0.0-beta.14::option::Option».tp h![t] |>.denote p) -> Option (t.denote p) +def toOption {p t} : («std-1.0.0-beta.25::option::Option».tp h![t] |>.denote p) -> Option (t.denote p) | (false, _, _) => none | (true, val, _) => some val @@ -36,14 +36,14 @@ lemma fromOption_toOption_id : toOption (fromOption v) = v := by @[simp] lemma option_fst_eq_toOption_isSome {p T} - {v : Tp.denote p $ «std-1.0.0-beta.14::option::Option».tp h![T]} + {v : Tp.denote p $ «std-1.0.0-beta.25::option::Option».tp h![T]} : Builtin.indexTpl v Member.head = (toOption v).isSome := by rcases v with ⟨_|_, _⟩ all_goals rfl @[simp] lemma option_snd_eq_toOption_get_of_isSome {p T} - {v : Tp.denote p $ «std-1.0.0-beta.14::option::Option».tp h![T]} + {v : Tp.denote p $ «std-1.0.0-beta.25::option::Option».tp h![T]} (v_is_some : (toOption v).isSome = true) : Builtin.indexTpl v Member.head.tail = (toOption v).get v_is_some := by rcases v with ⟨_|_, _, _⟩ @@ -62,14 +62,14 @@ lemma bind_def_of_isSome {α β} {v : Option α} {f : α → Option β} (v_is_so rcases (Option.isSome_iff_exists.mp v_is_some) with ⟨_, rfl⟩ simp_all -theorem none_spec {p T} : STHoare p env ⟦⟧ («std-1.0.0-beta.14::option::Option::none».call h![T] h![]) +theorem none_spec {p T} : STHoare p env ⟦⟧ («std-1.0.0-beta.25::option::Option::none».call h![T] h![]) (fun v => v = fromOption none) := by enter_decl steps subst_vars rfl -theorem some_spec {p T v} : STHoare p env ⟦⟧ («std-1.0.0-beta.14::option::Option::some».call h![T] h![v]) +theorem some_spec {p T v} : STHoare p env ⟦⟧ («std-1.0.0-beta.25::option::Option::some».call h![T] h![v]) (fun r => r = fromOption (some v)) := by enter_decl steps @@ -77,7 +77,7 @@ theorem some_spec {p T v} : STHoare p env ⟦⟧ («std-1.0.0-beta.14::option::O rfl theorem is_none_spec {p T v} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::is_none».call h![T] h![v]) + («std-1.0.0-beta.25::option::Option::is_none».call h![T] h![v]) (fun r => r = (toOption v).isNone) := by enter_decl steps @@ -85,7 +85,7 @@ theorem is_none_spec {p T v} : STHoare p env ⟦⟧ simp theorem is_some_spec {p T v} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::is_some».call h![T] h![v]) + («std-1.0.0-beta.25::option::Option::is_some».call h![T] h![v]) (fun r => r = (toOption v).isSome) := by enter_decl steps @@ -93,7 +93,7 @@ theorem is_some_spec {p T v} : STHoare p env ⟦⟧ simp theorem unwrap_spec {p T v} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::unwrap».call h![T] h![v]) + («std-1.0.0-beta.25::option::Option::unwrap».call h![T] h![v]) (fun r => ∃h, r = (toOption v).get h) := by enter_decl steps @@ -101,7 +101,7 @@ theorem unwrap_spec {p T v} : STHoare p env ⟦⟧ rename _ = true => v use v subst_vars - rename Tp.denote p («std-1.0.0-beta.14::option::Option».tp _) => h + rename Tp.denote p («std-1.0.0-beta.25::option::Option».tp _) => h rcases h with ⟨(_|_), _, _⟩ · contradiction · rfl @@ -109,7 +109,7 @@ theorem unwrap_spec {p T v} : STHoare p env ⟦⟧ theorem map_none_spec {p T U E f v} (v_is_none : (toOption v).isNone) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::map».call h![T, U, E] h![v, f]) + («std-1.0.0-beta.25::option::Option::map».call h![T, U, E] h![v, f]) (fun r => r = fromOption none) := by enter_decl steps @@ -124,7 +124,7 @@ theorem map_some_spec {p T U E f fb v P Q} (h_lam : STHoare p env P (fb h![(toOption v).get v_is_some]) Q) : STHoare p env (P ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::option::Option::map».call h![T, U, E] h![v, f]) + («std-1.0.0-beta.25::option::Option::map».call h![T, U, E] h![v, f]) (fun r => (∃∃vin, r = fromOption (some vin) ⋆ Q vin) ⋆ [λf ↦ fb]) := by enter_decl steps @@ -142,7 +142,7 @@ theorem map_pure_spec {p T U E P f fb v} (h_f : ∀arg, STHoare p env P (fb h![arg]) (fun r => r = f_emb arg ⋆ P)) : STHoare p env (P ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::option::Option::map».call h![T, U, E] h![v, f]) + («std-1.0.0-beta.25::option::Option::map».call h![T, U, E] h![v, f]) (fun r => r = fromOption ((toOption v).map f_emb) ⋆ P) := by by_cases h : (toOption v).isSome = true · steps [map_some_spec h (h_f _)] @@ -154,7 +154,7 @@ theorem map_pure_spec {p T U E P f fb v} theorem map_or_none_spec {p T U E v default f} (v_is_none : (toOption v).isNone) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::map_or».call h![T, U, E] h![v, default, f]) + («std-1.0.0-beta.25::option::Option::map_or».call h![T, U, E] h![v, default, f]) (fun r => r = default) := by enter_decl steps @@ -169,7 +169,7 @@ theorem map_or_some_spec {p T U E v f fb default P Q} (h_lam : STHoare p env P (fb h![(toOption v).get v_is_some]) Q) : STHoare p env (P ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::option::Option::map_or».call h![T, U, E] h![v, default, f]) + («std-1.0.0-beta.25::option::Option::map_or».call h![T, U, E] h![v, default, f]) (fun r => Q r ⋆ [λf ↦ fb]) := by enter_decl steps @@ -185,7 +185,7 @@ theorem map_or_pure_spec {p T U E P v f fb default} (h_f : ∀arg, STHoare p env P (fb h![arg]) (fun r => r = f_emb arg ⋆ P)) : STHoare p env (P ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::option::Option::map_or».call h![T, U, E] h![v, default, f]) + («std-1.0.0-beta.25::option::Option::map_or».call h![T, U, E] h![v, default, f]) (fun r => r = ((toOption v).map f_emb).getD default ⋆ P) := by by_cases h : (toOption v).isSome = true · steps [map_or_some_spec (E := E) h (h_f _)] @@ -199,7 +199,7 @@ theorem map_or_else_none_spec {p T U E1 E2 P Q v default default_b func} (default_f : STHoare p env P (default_b h![]) Q) : STHoare p env (P ⋆ [λdefault ↦ default_b]) - («std-1.0.0-beta.14::option::Option::map_or_else».call h![T, U, E1, E2] h![v, default, func]) + («std-1.0.0-beta.25::option::Option::map_or_else».call h![T, U, E1, E2] h![v, default, func]) (fun r => Q r ⋆ [λdefault ↦ default_b]) := by enter_decl steps @@ -213,7 +213,7 @@ theorem map_or_else_some_spec {p T U E1 E2 P Q v default func func_b} (func_f : STHoare p env P (func_b h![(toOption v).get v_is_some]) Q) : STHoare p env (P ⋆ [λfunc ↦ func_b]) - («std-1.0.0-beta.14::option::Option::map_or_else».call h![T, U, E1, E2] h![v, default, func]) + («std-1.0.0-beta.25::option::Option::map_or_else».call h![T, U, E1, E2] h![v, default, func]) (fun r => Q r ⋆ [λfunc ↦ func_b]) := by enter_decl steps @@ -231,7 +231,7 @@ theorem map_or_else_pure_spec {p T U E1 E2 P v default default_b func func_b} (func_f : ∀arg, STHoare p env P (func_b h![arg]) (fun r => r = func_emb arg ⋆ P)) : STHoare p env (P ⋆ [λdefault ↦ default_b] ⋆ [λfunc ↦ func_b]) - («std-1.0.0-beta.14::option::Option::map_or_else».call h![T, U, E1, E2] h![v, default, func]) + («std-1.0.0-beta.25::option::Option::map_or_else».call h![T, U, E1, E2] h![v, default, func]) (fun r => r = ((toOption v).map func_emb).getD default_emb ⋆ P) := by by_cases h : (toOption v).isSome = true · steps [map_or_else_some_spec (E1 := E1) (E2 := E2) h (func_f _)] @@ -245,7 +245,7 @@ theorem map_or_else_pure_spec {p T U E1 E2 P v default default_b func func_b} theorem and_spec {p T v w} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::and».call h![T] h![v, w]) + («std-1.0.0-beta.25::option::Option::and».call h![T] h![v, w]) (fun r => r = if (toOption v).isSome then w else fromOption none) := by enter_decl steps [is_none_spec] @@ -260,7 +260,7 @@ theorem and_spec {p T v w} theorem and_then_none_spec {p T U E self f} (self_is_none : (toOption self).isNone) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::and_then».call h![T, U, E] h![self, f]) + («std-1.0.0-beta.25::option::Option::and_then».call h![T, U, E] h![self, f]) (fun r => r = fromOption none) := by enter_decl steps @@ -275,7 +275,7 @@ theorem and_then_some_spec {p T U E P Q self f fb} (f_lam : STHoare p env P (fb h![(toOption self).get self_is_some]) Q) : STHoare p env (P ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::option::Option::and_then».call h![T, U, E] h![self, f]) + («std-1.0.0-beta.25::option::Option::and_then».call h![T, U, E] h![self, f]) (fun r => Q r ⋆ [λf ↦ fb]) := by enter_decl steps @@ -287,11 +287,11 @@ theorem and_then_some_spec {p T U E P Q self f fb} steps [STHoare.callLambda_intro (hlam := f_lam)] theorem and_then_pure_spec {p T U E P self f fb} - {f_emb : T.denote p → (Tp.denote p $ «std-1.0.0-beta.14::option::Option».tp h![U])} + {f_emb : T.denote p → (Tp.denote p $ «std-1.0.0-beta.25::option::Option».tp h![U])} (f_f : ∀arg, STHoare p env P (fb h![arg]) (fun r => r = f_emb arg ⋆ P)) : STHoare p env (P ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::option::Option::and_then».call h![T, U, E] h![self, f]) + («std-1.0.0-beta.25::option::Option::and_then».call h![T, U, E] h![self, f]) (fun r => r = ((toOption self).map f_emb).getD (fromOption none) ⋆ P) := by by_cases h : (toOption self).isSome = true · steps [and_then_some_spec (E := E) h (f_f _)] @@ -303,7 +303,7 @@ theorem and_then_pure_spec {p T U E P self f fb} theorem or_spec {p T self default} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::or».call h![T] h![self, default]) + («std-1.0.0-beta.25::option::Option::or».call h![T] h![self, default]) (fun r => r = if (toOption self).isSome then self else default) := by enter_decl steps @@ -325,7 +325,7 @@ theorem or_else_none_spec {p T E P Q self default default_b} (default_f : STHoare p env P (default_b h![]) Q) : STHoare p env (P ⋆ [λdefault ↦ default_b]) - («std-1.0.0-beta.14::option::Option::or_else».call h![T, E] h![self, default]) + («std-1.0.0-beta.25::option::Option::or_else».call h![T, E] h![self, default]) (fun r => Q r ⋆ [λdefault ↦ default_b]) := by enter_decl steps @@ -337,7 +337,7 @@ theorem or_else_none_spec {p T E P Q self default default_b} theorem or_else_some_spec {p T E self default} (self_is_some : (toOption self).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::or_else».call h![T, E] h![self, default]) + («std-1.0.0-beta.25::option::Option::or_else».call h![T, E] h![self, default]) (fun r => r = self) := by enter_decl steps @@ -348,11 +348,11 @@ theorem or_else_some_spec {p T E self default} simp_all theorem or_else_pure_spec {p T E P self default default_b} - {default_emb : Tp.denote p $ «std-1.0.0-beta.14::option::Option».tp h![T]} + {default_emb : Tp.denote p $ «std-1.0.0-beta.25::option::Option».tp h![T]} (default_f : STHoare p env P (default_b h![]) (fun r => r = default_emb ⋆ P)) : STHoare p env (P ⋆ [λdefault ↦ default_b]) - («std-1.0.0-beta.14::option::Option::or_else».call h![T, E] h![self, default]) + («std-1.0.0-beta.25::option::Option::or_else».call h![T, E] h![self, default]) (fun r => (r = if (toOption self).isSome then self else default_emb) ⋆ P) := by by_cases h : (toOption self).isSome = true . steps [or_else_some_spec h] @@ -365,7 +365,7 @@ theorem or_else_pure_spec {p T E P self default default_b} theorem xor_spec {p T self other} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::xor».call h![T] h![self, other]) + («std-1.0.0-beta.25::option::Option::xor».call h![T] h![self, other]) (fun r => r = if (toOption self).isSome then if (toOption other).isSome then fromOption none else self else if (toOption other).isSome then @@ -398,7 +398,7 @@ theorem xor_spec {p T self other} theorem filter_none_spec {p T E self pred} (self_is_none : (toOption self).isNone) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::filter».call h![T, E] h![self, pred]) + («std-1.0.0-beta.25::option::Option::filter».call h![T, E] h![self, pred]) (fun r => r = fromOption none) := by enter_decl steps @@ -414,7 +414,7 @@ theorem filter_some_spec {p T E P Q self pred pred_b} (pred_f : STHoare p env P (pred_b h![(toOption self).get self_is_some]) Q) : STHoare p env (P ⋆ [λpred ↦ pred_b]) - («std-1.0.0-beta.14::option::Option::filter».call h![T, E] h![self, pred]) + («std-1.0.0-beta.25::option::Option::filter».call h![T, E] h![self, pred]) (fun r => ∃∃b, Q b ⋆ r = if b then self else fromOption none) := by enter_decl steps @@ -440,7 +440,7 @@ theorem filter_some_spec {p T E P Q self pred pred_b} theorem flatten_spec {p T opt} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::flatten».call h![T] h![opt]) + («std-1.0.0-beta.25::option::Option::flatten».call h![T] h![opt]) (fun r => r = (toOption opt).getD (fromOption none)) := by enter_decl steps @@ -462,7 +462,7 @@ theorem flatten_spec {p T opt} set_option maxRecDepth 2000 in theorem default_spec {p T} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::default::Default».default h![] («std-1.0.0-beta.14::option::Option».tp h![T]) h![] h![] h![]) + («std-1.0.0-beta.25::default::Default».default h![] («std-1.0.0-beta.25::option::Option».tp h![T]) h![] h![] h![]) (fun r => r = fromOption none) := by resolve_trait steps [none_spec] @@ -470,15 +470,15 @@ theorem default_spec {p T} set_option maxRecDepth 2000 in theorem eq_spec {p T self other P Q} - {t_eq : «std-1.0.0-beta.14::cmp::Eq».hasImpl env h![] T} + {t_eq : «std-1.0.0-beta.25::cmp::Eq».hasImpl env h![] T} {eq_f : (h_self : (toOption self).isSome) → (h_other : (toOption other).isSome) → STHoare p env P - («std-1.0.0-beta.14::cmp::Eq».eq h![] T h![] h![] + («std-1.0.0-beta.25::cmp::Eq».eq h![] T h![] h![] h![(toOption self).get h_self, (toOption other).get h_other]) Q} : STHoare p env P - («std-1.0.0-beta.14::cmp::Eq».eq h![] («std-1.0.0-beta.14::option::Option».tp h![T]) h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Eq».eq h![] («std-1.0.0-beta.25::option::Option».tp h![T]) h![] h![] h![self, other]) (fun r => if h : (toOption self).isSome ∧ (toOption other).isSome then Q r else (r = ((toOption self).isSome == (toOption other).isSome))) := by resolve_trait @@ -512,13 +512,13 @@ theorem eq_spec {p T self other P Q} assumption theorem eq_pure_spec {p T self other} - {t_eq : «std-1.0.0-beta.14::cmp::Eq».hasImpl env h![] T} + {t_eq : «std-1.0.0-beta.25::cmp::Eq».hasImpl env h![] T} {t_eq_emb : T.denote p → T.denote p → Prop} (h_eq : ∀a b, STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Eq».eq h![] T h![] h![] h![a, b]) + («std-1.0.0-beta.25::cmp::Eq».eq h![] T h![] h![] h![a, b]) (fun r : Bool => r = t_eq_emb a b)) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Eq».eq h![] («std-1.0.0-beta.14::option::Option».tp h![T]) h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Eq».eq h![] («std-1.0.0-beta.25::option::Option».tp h![T]) h![] h![] h![self, other]) (fun r : Bool => r = Option.Rel t_eq_emb (toOption self) (toOption other)) := by apply STHoare.consequence_frame apply eq_spec @@ -561,14 +561,14 @@ theorem eq_pure_spec {p T self other} set_option maxRecDepth 2000 in theorem hash_spec {p T H self P Q R} {state : Tp.denote p $ Tp.ref H} - {t_hash : «std-1.0.0-beta.14::hash::Hash».hasImpl env h![] T} + {t_hash : «std-1.0.0-beta.25::hash::Hash».hasImpl env h![] T} {t_hash_f : (h_self : (toOption self).isSome) → STHoare p env Q - («std-1.0.0-beta.14::hash::Hash».hash h![] T h![] h![H] h![(toOption self).get h_self, state]) fun _ => R} - {bool_hash : «std-1.0.0-beta.14::hash::Hash».hasImpl env h![] Tp.bool} + («std-1.0.0-beta.25::hash::Hash».hash h![] T h![] h![H] h![(toOption self).get h_self, state]) fun _ => R} + {bool_hash : «std-1.0.0-beta.25::hash::Hash».hasImpl env h![] Tp.bool} {bool_hash_f : STHoare p env P - («std-1.0.0-beta.14::hash::Hash».hash h![] Tp.bool h![] h![H] h![(toOption self).isSome, state]) fun _ => Q} + («std-1.0.0-beta.25::hash::Hash».hash h![] Tp.bool h![] h![H] h![(toOption self).isSome, state]) fun _ => Q} : STHoare p env P - («std-1.0.0-beta.14::hash::Hash».hash h![] («std-1.0.0-beta.14::option::Option».tp h![T]) h![] h![H] h![self, state]) + («std-1.0.0-beta.25::hash::Hash».hash h![] («std-1.0.0-beta.25::option::Option».tp h![T]) h![] h![H] h![self, state]) (fun _ => if (toOption self).isSome then R else Q) := by resolve_trait steps @@ -594,15 +594,15 @@ theorem hash_spec {p T H self P Q R} set_option maxRecDepth 2000 in theorem cmp_spec {p T self other P Q} - {t_ord : «std-1.0.0-beta.14::cmp::Ord».hasImpl env h![] T} + {t_ord : «std-1.0.0-beta.25::cmp::Ord».hasImpl env h![] T} (t_ord_f : (h_self : (toOption self).isSome) → (h_other : (toOption other).isSome) → STHoare p env P - («std-1.0.0-beta.14::cmp::Ord».cmp h![] T h![] h![] + («std-1.0.0-beta.25::cmp::Ord».cmp h![] T h![] h![] h![(toOption self).get h_self, (toOption other).get h_other]) Q) : STHoare p env P - («std-1.0.0-beta.14::cmp::Ord».cmp h![] («std-1.0.0-beta.14::option::Option».tp h![T]) h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Ord».cmp h![] («std-1.0.0-beta.25::option::Option».tp h![T]) h![] h![] h![self, other]) (fun r => if (toOption self).isSome then if (toOption other).isSome then Q r else r = fromOrdering .gt else if (toOption other).isSome then r = fromOrdering .lt else @@ -643,13 +643,13 @@ theorem cmp_spec {p T self other P Q} set_option maxRecDepth 2000 in theorem cmp_pure_spec {p T self other} - {t_ord : «std-1.0.0-beta.14::cmp::Ord».hasImpl env h![] T} - {t_ord_emb : T.denote p → T.denote p → («std-1.0.0-beta.14::cmp::Ordering».tp h![] |>.denote p)} + {t_ord : «std-1.0.0-beta.25::cmp::Ord».hasImpl env h![] T} + {t_ord_emb : T.denote p → T.denote p → («std-1.0.0-beta.25::cmp::Ordering».tp h![] |>.denote p)} (t_ord_f : ∀a b, STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Ord».cmp h![] T h![] h![] h![a, b]) + («std-1.0.0-beta.25::cmp::Ord».cmp h![] T h![] h![] h![a, b]) (fun r => r = t_ord_emb a b)) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::cmp::Ord».cmp h![] («std-1.0.0-beta.14::option::Option».tp h![T]) h![] h![] h![self, other]) + («std-1.0.0-beta.25::cmp::Ord».cmp h![] («std-1.0.0-beta.25::option::Option».tp h![T]) h![] h![] h![self, other]) (fun r => r = if h : (toOption self).isSome then if g : (toOption other).isSome then t_ord_emb ((toOption self).get h) ((toOption other).get g) @@ -687,7 +687,7 @@ theorem cmp_pure_spec {p T self other} theorem expect_spec {p T N MT v message} (v_is_some : (toOption v).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::expect».call h![T, N, MT] h![v, message]) + («std-1.0.0-beta.25::option::Option::expect».call h![T, N, MT] h![v, message]) (fun r => r = (toOption v).get v_is_some) := by enter_decl steps [is_some_spec] @@ -696,7 +696,7 @@ theorem expect_spec {p T N MT v message} theorem unwrap_or_spec {p T v default} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::unwrap_or».call h![T] h![v, default]) + («std-1.0.0-beta.25::option::Option::unwrap_or».call h![T] h![v, default]) (fun r => r = (toOption v).getD default) := by enter_decl steps @@ -718,7 +718,7 @@ theorem unwrap_or_else_none_spec {p T E v default default_b P Q} (h_lam : STHoare p env P (default_b h![]) Q) : STHoare p env (P ⋆ [λdefault ↦ default_b]) - («std-1.0.0-beta.14::option::Option::unwrap_or_else».call h![T, E] h![v, default]) + («std-1.0.0-beta.25::option::Option::unwrap_or_else».call h![T, E] h![v, default]) (fun r => Q r ⋆ [λdefault ↦ default_b]) := by enter_decl steps @@ -730,7 +730,7 @@ theorem unwrap_or_else_none_spec {p T E v default default_b P Q} theorem unwrap_or_else_some_spec {p T E v default} (v_is_some : (toOption v).isSome) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::unwrap_or_else».call h![T, E] h![v, default]) + («std-1.0.0-beta.25::option::Option::unwrap_or_else».call h![T, E] h![v, default]) (fun r => r = (toOption v).get v_is_some) := by enter_decl steps @@ -745,7 +745,7 @@ theorem unwrap_or_else_some_spec {p T E v default} theorem unwrap_unchecked_spec {p T v} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::option::Option::unwrap_unchecked».call h![T] h![v]) + («std-1.0.0-beta.25::option::Option::unwrap_unchecked».call h![T] h![v]) (fun r => ∀ h : (toOption v).isSome, r = (toOption v).get h) := by enter_decl steps diff --git a/stdlib/lampe/Stdlib/Panic.lean b/stdlib/lampe/Stdlib/Panic.lean index 78e72d8a..66c075dc 100644 --- a/stdlib/lampe/Stdlib/Panic.lean +++ b/stdlib/lampe/Stdlib/Panic.lean @@ -1,9 +1,9 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.Panic -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» /-- Note that this theorem exists only to make it easy to steps through calls to `panic` in your code as @@ -11,7 +11,7 @@ it cannot (and does not) assert any meaningful properties on the functioning of -/ theorem panic_correct {p T U msg} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::panic::panic».call h![T, U] h![msg]) + («std-1.0.0-beta.25::panic::panic».call h![T, U] h![msg]) (fun _ => ⟦⟧) := by enter_decl steps diff --git a/stdlib/lampe/Stdlib/Stdlib.lean b/stdlib/lampe/Stdlib/Stdlib.lean index f87a2ab1..5131ef8a 100644 --- a/stdlib/lampe/Stdlib/Stdlib.lean +++ b/stdlib/lampe/Stdlib/Stdlib.lean @@ -1,5 +1,5 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace Lampe.Stdlib -export «std-1.0.0-beta.14» (env) +export «std-1.0.0-beta.25» (env) diff --git a/stdlib/lampe/Stdlib/String.lean b/stdlib/lampe/Stdlib/String.lean index 1af50b4e..5385f84f 100644 --- a/stdlib/lampe/Stdlib/String.lean +++ b/stdlib/lampe/Stdlib/String.lean @@ -1,28 +1,28 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe namespace Lampe.Stdlib.String -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» -- Note: the extraction returns `Slice` (= `List (U 8)`), not `Vec`. -- The Noir function `as_bytes_vec` returns `Vec`, but the Lampe extraction -- does not wrap the result in a `#_makeData` call. -- We state the spec in terms of the actual return type. -set_option maxRecDepth 1500 in +set_option maxRecDepth 4000 in set_option linter.deprecated false in theorem as_bytes_vec_spec {p N self} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::string::as_bytes_vec».call h![N] h![self]) + («std-1.0.0-beta.25::string::as_bytes_vec».call h![N] h![self]) (fun r => r = self.toList) := by enter_decl steps subst_vars rfl -set_option maxRecDepth 1500 in +set_option maxRecDepth 4000 in theorem from_spec {p N a} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::convert::From».from h![(Tp.u 8).array N] (.str N) h![] h![] h![a]) + («std-1.0.0-beta.25::convert::From».from h![(Tp.u 8).array N] (.str N) h![] h![] h![a]) (fun r => r = Lampe.Builtin.arrayAsStr! a) := by resolve_trait steps diff --git a/stdlib/lampe/Stdlib/TraitMethods.lean b/stdlib/lampe/Stdlib/TraitMethods.lean index 9f772932..4a63da12 100644 --- a/stdlib/lampe/Stdlib/TraitMethods.lean +++ b/stdlib/lampe/Stdlib/TraitMethods.lean @@ -1,4 +1,4 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe /-! @@ -12,7 +12,7 @@ pulled out into a separate file. This is that file. namespace Lampe.Stdlib -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» open Lampe.Stdlib namespace Append @@ -20,33 +20,33 @@ namespace Append /-- A shorthand for a call to the `std::append::Append::empty` method. -/ @[reducible] def empty {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::append::Append».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::append::Append».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::append::Append».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::append::Append».«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::append::Append».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::append::Append».«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::append::Append».empty.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::append::Append».empty.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::append::Append».empty.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::append::Append».empty generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::append::Append».empty.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::append::Append».empty generics Self associatedTypes fnGenerics /-- A shorthand for a call to the `std::append::Append::append` method. -/ @[reducible] def append {p} - (generics : HList Kind.denote «std-1.0.0-beta.14::append::Append».«#genericKinds») + (generics : HList Kind.denote «std-1.0.0-beta.25::append::Append».«#genericKinds») (Self : Tp) - (associatedTypes : HList Kind.denote «std-1.0.0-beta.14::append::Append».«#associatedTypesKinds») - (fnGenerics : HList Kind.denote «std-1.0.0-beta.14::append::Append».«#genericKinds») + (associatedTypes : HList Kind.denote «std-1.0.0-beta.25::append::Append».«#associatedTypesKinds») + (fnGenerics : HList Kind.denote «std-1.0.0-beta.25::append::Append».«#genericKinds») : HList (Tp.denote p) - («std-1.0.0-beta.14::append::Append».append.«#inputs» generics Self associatedTypes fnGenerics) + («std-1.0.0-beta.25::append::Append».append.«#inputs» generics Self associatedTypes fnGenerics) → Expr (Tp.denote p) - («std-1.0.0-beta.14::append::Append».append.«#output» generics Self associatedTypes fnGenerics) := - «std-1.0.0-beta.14::append::Append».append generics Self associatedTypes fnGenerics + («std-1.0.0-beta.25::append::Append».append.«#output» generics Self associatedTypes fnGenerics) := + «std-1.0.0-beta.25::append::Append».append generics Self associatedTypes fnGenerics /-- Asserts that the provided `tp` has an implementation of `std::append::Append` in the environment. -/ @[reducible] -def hasImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.14::append::Append».hasImpl env h![] tp +def hasImpl (env : Env) (tp : Tp) := «std-1.0.0-beta.25::append::Append».hasImpl env h![] tp end Append diff --git a/stdlib/lampe/Stdlib/Vector.lean b/stdlib/lampe/Stdlib/Vector.lean index fa35146d..ccc34b07 100644 --- a/stdlib/lampe/Stdlib/Vector.lean +++ b/stdlib/lampe/Stdlib/Vector.lean @@ -1,19 +1,23 @@ -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted import Lampe import Stdlib.List import Stdlib.TraitMethods namespace Lampe.Stdlib.Vector -open «std-1.0.0-beta.14» +open «std-1.0.0-beta.25» set_option maxRecDepth 2000 +-- The beta.25 stdlib env is considerably larger (tuple impls up to arity 12, +-- new integer/internal modules), and `vector` sits near the end of the env +-- concatenation that `enter_decl` has to reduce through. +set_option maxHeartbeats 1000000 set_option Lampe.pp.Expr true set_option Lampe.pp.STHoare true theorem append_spec {p T a b} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::vector::append».call h![T] h![a, b]) + («std-1.0.0-beta.25::vector::append».call h![T] h![a, b]) (fun r => r = a ++ b) := by enter_decl steps @@ -33,7 +37,7 @@ theorem append_spec {p T a b} theorem as_array_spec {p T N input} : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::vector::as_array».call h![T, N] h![input]) + («std-1.0.0-beta.25::vector::as_array».call h![T, N] h![input]) (fun r => r.toList = input) := by enter_decl steps @@ -80,7 +84,7 @@ theorem map_spec {T U Env p f fb l} (fun r => Inv (ip ++ [e]) (rp ++ [r]))) : STHoare p env (Inv [] [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::map».call h![T, U, Env] h![l, f]) + («std-1.0.0-beta.25::vector::map».call h![T, U, Env] h![l, f]) (fun v => Inv l v ⋆ [λf ↦ fb]) := by enter_decl steps @@ -110,7 +114,7 @@ theorem map_spec {T U Env p f fb l} theorem map_pure_spec {T U Env p f fb func l} (h_pure : ∀x, STHoare p env ⟦⟧ (fb h![x]) (fun r => r = func x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::vector::map».call h![T, U, Env] h![l, f]) + («std-1.0.0-beta.25::vector::map».call h![T, U, Env] h![l, f]) (fun v => v = l.map func) := by steps [map_spec (Inv := fun i o => o = i.map func)] · rfl @@ -124,7 +128,7 @@ theorem mapi_spec {T U Env p f fb l} (fun r => inv (ip ++ [e]) (op ++ [r]))) : STHoare p env (inv [] [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::mapi».call h![T, U, Env] h![l, f]) + («std-1.0.0-beta.25::vector::mapi».call h![T, U, Env] h![l, f]) (fun v => inv l v ⋆ [λf ↦ fb]) := by enter_decl steps @@ -169,7 +173,7 @@ theorem mapi_spec {T U Env p f fb l} theorem mapi_pure_spec {T U Env p f fb fEmb l} (inv_pure : ∀i x, (h : i < l.length) → STHoare p env ⟦⟧ (fb h![i, x]) (fun r => r = fEmb i x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::vector::mapi».call h![T, U, Env] h![l, f]) + («std-1.0.0-beta.25::vector::mapi».call h![T, U, Env] h![l, f]) (fun v => v = l.mapIdx fEmb) := by steps [mapi_spec (inv := fun i o => o = i.mapIdx fEmb)] · rfl @@ -193,7 +197,7 @@ theorem for_each_spec {T Env p f fb l} ((lp ++ [e]) <+: l) → STHoare p env (Inv lp) (fb h![e]) (fun _ => Inv (lp ++ [e]))) : STHoare p env (Inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::for_each».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::for_each».call h![T, Env] h![l, f]) (fun _ => Inv l ⋆ [λf ↦ fb]) := by enter_decl steps [] @@ -219,7 +223,7 @@ theorem for_eachi_spec {T Env p f fb l} ((ip ++ [e]) <+: l) → STHoare p env (inv ip) (fb h![ip.length, e]) (fun _ => inv (ip ++ [e]))) : STHoare p env (inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::for_eachi».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::for_eachi».call h![T, Env] h![l, f]) (fun _ => inv l ⋆ [λf ↦ fb]) := by enter_decl steps @@ -258,7 +262,7 @@ theorem fold_spec {p T U Env l a f fb} (fun r => inv (ip ++ [e]) r))) : STHoare p env (inv [] a ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::fold».call h![T, U, Env] h![l, a, f]) + («std-1.0.0-beta.25::vector::fold».call h![T, U, Env] h![l, a, f]) (fun r => (inv l r) ⋆ [λf ↦ fb]) := by enter_decl steps @@ -290,7 +294,7 @@ theorem fold_spec {p T U Env l a f fb} theorem fold_pure_spec {p T U Env l a f fb fEmb} (inv_pure : ∀a x, STHoare p env ⟦⟧ (fb h![a, x]) (fun r => r = fEmb a x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::vector::fold».call h![T, U, Env] h![l, a, f]) + («std-1.0.0-beta.25::vector::fold».call h![T, U, Env] h![l, a, f]) (fun r => r = l.foldl fEmb a ⋆ [λf ↦ fb]) := by steps [fold_spec (inv := fun xs v => v = xs.foldl fEmb a)] · rfl @@ -305,7 +309,7 @@ theorem reduce_spec {p T Env l f fb} (fun r => inv (ip ++ [e]) r))) : STHoare p env ((inv [] l[0]) ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::reduce».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::reduce».call h![T, Env] h![l, f]) (fun r => (inv l.tail r) ⋆ [λf ↦ fb]) := by enter_decl steps @@ -343,7 +347,7 @@ theorem reduce_pure_spec {p T Env l f fb fEmb} (l_len_gt : l.length > 0) (inv_pure : ∀a x, STHoare p env ⟦⟧ (fb h![a, x]) (fun r => r = fEmb a x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::vector::reduce».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::reduce».call h![T, Env] h![l, f]) (fun r => r = l.tail.foldl fEmb l[0] ⋆ [λf ↦ fb]) := by steps [reduce_spec (inv := fun xs v => v = xs.foldl fEmb l[0])] · rfl @@ -359,7 +363,7 @@ theorem filter_spec {p T Env l f fb} (fun r => inv (ip ++ [e]) (if r then (op ++ [e]) else op)))) : STHoare p env (inv [] [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::filter».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::filter».call h![T, Env] h![l, f]) (fun r => (inv l r) ⋆ [λf ↦ fb]) := by enter_decl steps @@ -400,7 +404,7 @@ theorem filter_spec {p T Env l f fb} theorem filter_pure_spec {p T Env l f fb fEmb} (inv_pure : ∀x, STHoare p env ⟦⟧ (fb h![x]) (fun r => r = fEmb x)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::vector::filter».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::filter».call h![T, Env] h![l, f]) (fun r => (r = l.filter fEmb)) := by steps [filter_spec (inv := fun xs v => v = xs.filter fEmb)] · rfl @@ -419,7 +423,7 @@ theorem join_spec {p T a s} (t_app_sem : ∀a b, STHoare p env ⟦⟧ (Append.append h![] T h![] h![] h![a, b]) (fun r => r = t_app_emb a b)) : STHoare p env ⟦⟧ - («std-1.0.0-beta.14::vector::join».call h![T] h![a, s]) + («std-1.0.0-beta.25::vector::join».call h![T] h![a, s]) (fun r => r = if h : a.length > 0 then a.tail.foldl (fun l r => t_app_emb (t_app_emb l s) r) a[0] else t_empty_emb) := by @@ -491,7 +495,7 @@ theorem all_spec {p T Env l f fb} (ip ++ [e] <+: l) → STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ∧ r))) : STHoare p env ((inv [] true) ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::all».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::all».call h![T, Env] h![l, f]) (fun r => (inv l r) ⋆ [λf ↦ fb]) := by enter_decl steps @@ -528,7 +532,7 @@ theorem all_spec {p T Env l f fb} theorem all_pure_spec {p T Env l f fb fEmb} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::vector::all».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::all».call h![T, Env] h![l, f]) (fun r => r = l.all fEmb) := by steps [all_spec (inv := fun x r => r = x.all fEmb)] · simp @@ -545,7 +549,7 @@ theorem any_spec {p T Env l f fb} (ip ++ [e] <+: l) → STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ∨ r))) : STHoare p env ((inv [] false) ⋆ [λf ↦ fb]) - («std-1.0.0-beta.14::vector::any».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::any».call h![T, Env] h![l, f]) (fun r => (inv l r) ⋆ [λf ↦ fb]) := by enter_decl steps @@ -582,7 +586,7 @@ theorem any_spec {p T Env l f fb} theorem any_pure_spec {p T Env l f fb fEmb} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.14::vector::any».call h![T, Env] h![l, f]) + («std-1.0.0-beta.25::vector::any».call h![T, Env] h![l, f]) (fun r => r = l.any fEmb) := by steps [any_spec (inv := fun x r => r = x.any fEmb)] · simp diff --git a/stdlib/lampe/lakefile.toml b/stdlib/lampe/lakefile.toml index 54aa7562..fd54fef3 100644 --- a/stdlib/lampe/lakefile.toml +++ b/stdlib/lampe/lakefile.toml @@ -1,10 +1,10 @@ # Generated by lampe -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" version = "1.0.0-beta.12" -defaultTargets = ["std-1.0.0-beta.14", "Stdlib"] +defaultTargets = ["std-1.0.0-beta.25", "Stdlib"] [[lean_lib]] -name = "«std-1.0.0-beta.14»" +name = "«std-1.0.0-beta.25»" [[lean_lib]] name = "Stdlib" diff --git a/stdlib/lampe/std-1.0.0-beta.14.lean b/stdlib/lampe/std-1.0.0-beta.14.lean deleted file mode 100644 index f00273b7..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14.lean +++ /dev/null @@ -1,3 +0,0 @@ - -import «std-1.0.0-beta.14».Extracted - diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted.lean deleted file mode 100644 index a7aebf73..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted.lean +++ /dev/null @@ -1,106 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.Aes128 -import «std-1.0.0-beta.14».Extracted.Append -import «std-1.0.0-beta.14».Extracted.Array.CheckShuffle -import «std-1.0.0-beta.14».Extracted.Array.Mod -import «std-1.0.0-beta.14».Extracted.Array.Quicksort -import «std-1.0.0-beta.14».Extracted.Cmp -import «std-1.0.0-beta.14».Extracted.Collections.BoundedVec -import «std-1.0.0-beta.14».Extracted.Collections.Map -import «std-1.0.0-beta.14».Extracted.Collections.Mod -import «std-1.0.0-beta.14».Extracted.Collections.Umap -import «std-1.0.0-beta.14».Extracted.Collections.Vec -import «std-1.0.0-beta.14».Extracted.Compat -import «std-1.0.0-beta.14».Extracted.Convert -import «std-1.0.0-beta.14».Extracted.Default -import «std-1.0.0-beta.14».Extracted.EcdsaSecp256K1 -import «std-1.0.0-beta.14».Extracted.EcdsaSecp256R1 -import «std-1.0.0-beta.14».Extracted.EmbeddedCurveOps -import «std-1.0.0-beta.14».Extracted.Field.Bn254 -import «std-1.0.0-beta.14».Extracted.Field.Mod -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import «std-1.0.0-beta.14».Extracted.Hash.Mod -import «std-1.0.0-beta.14».Extracted.Hash.Poseidon2 -import «std-1.0.0-beta.14».Extracted.Hint -import «std-1.0.0-beta.14».Extracted.Lib -import «std-1.0.0-beta.14».Extracted.Mem -import «std-1.0.0-beta.14».Extracted.Meta.Ctstring -import «std-1.0.0-beta.14».Extracted.Meta.Expr -import «std-1.0.0-beta.14».Extracted.Meta.FormatString -import «std-1.0.0-beta.14».Extracted.Meta.FunctionDef -import «std-1.0.0-beta.14».Extracted.Meta.Mod -import «std-1.0.0-beta.14».Extracted.Meta.Module -import «std-1.0.0-beta.14».Extracted.Meta.Op -import «std-1.0.0-beta.14».Extracted.Meta.Quoted -import «std-1.0.0-beta.14».Extracted.Meta.TraitConstraint -import «std-1.0.0-beta.14».Extracted.Meta.TraitDef -import «std-1.0.0-beta.14».Extracted.Meta.TraitImpl -import «std-1.0.0-beta.14».Extracted.Meta.Typ -import «std-1.0.0-beta.14».Extracted.Meta.TypeDef -import «std-1.0.0-beta.14».Extracted.Meta.TypedExpr -import «std-1.0.0-beta.14».Extracted.Meta.UnresolvedType -import «std-1.0.0-beta.14».Extracted.Ops.Arith -import «std-1.0.0-beta.14».Extracted.Ops.Bit -import «std-1.0.0-beta.14».Extracted.Ops.Mod -import «std-1.0.0-beta.14».Extracted.Option -import «std-1.0.0-beta.14».Extracted.Panic -import «std-1.0.0-beta.14».Extracted.Prelude -import «std-1.0.0-beta.14».Extracted.PrimitiveDocs -import «std-1.0.0-beta.14».Extracted.Runtime -import «std-1.0.0-beta.14».Extracted.String -import «std-1.0.0-beta.14».Extracted.Test -import «std-1.0.0-beta.14».Extracted.Vector - -namespace «std-1.0.0-beta.14» - -def env := Aes128.env - ++ Append.env - ++ Array.CheckShuffle.env - ++ Array.Mod.env - ++ Array.Quicksort.env - ++ Cmp.env - ++ Collections.BoundedVec.env - ++ Collections.Map.env - ++ Collections.Mod.env - ++ Collections.Umap.env - ++ Collections.Vec.env - ++ Compat.env - ++ Convert.env - ++ Default.env - ++ EcdsaSecp256K1.env - ++ EcdsaSecp256R1.env - ++ EmbeddedCurveOps.env - ++ Field.Bn254.env - ++ Field.Mod.env - ++ Hash.Mod.env - ++ Hash.Poseidon2.env - ++ Hint.env - ++ Lib.env - ++ Mem.env - ++ Meta.Ctstring.env - ++ Meta.Expr.env - ++ Meta.FormatString.env - ++ Meta.FunctionDef.env - ++ Meta.Mod.env - ++ Meta.Module.env - ++ Meta.Op.env - ++ Meta.Quoted.env - ++ Meta.TraitConstraint.env - ++ Meta.TraitDef.env - ++ Meta.TraitImpl.env - ++ Meta.Typ.env - ++ Meta.TypeDef.env - ++ Meta.TypedExpr.env - ++ Meta.UnresolvedType.env - ++ Ops.Arith.env - ++ Ops.Bit.env - ++ Ops.Mod.env - ++ Option.env - ++ Panic.env - ++ Prelude.env - ++ PrimitiveDocs.env - ++ Runtime.env - ++ String.env - ++ Test.env - ++ Vector.env diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Aes128.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Aes128.lean deleted file mode 100644 index 0320ce78..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Aes128.lean +++ /dev/null @@ -1,27 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::aes128::aes128_encrypt(input: Array, iv: Array, key: Array) -> Array := { - let padding_length = (#_cast returning u8)((#_uSub returning u32)((16: u32), (#_uRem returning u32)(uConst!(N: u32), (16: u32)))); - let padded_input = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); - for i in (0: u32) .. uConst!(N: u32) do { - (padded_input[i]: u8) = (#_arrayIndex returning u8)(input, (#_cast returning u32)(i)); - #_skip - }; - for i in uConst!(N: u32) .. (#_uSub returning u32)((#_uAdd returning u32)(uConst!(N: u32), (16: u32)), (#_uRem returning u32)(uConst!(N: u32), (16: u32))) do { - (padded_input[i]: u8) = padding_length; - #_skip - }; - let output = (#_aes128Encrypt returning Array)((#_readRef returning Array)(padded_input), iv, key); - output -} - -def «std-1.0.0-beta.14».Aes128.env : Env := Env.mk - [«std-1.0.0-beta.14::aes128::aes128_encrypt»] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Append.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Append.lean deleted file mode 100644 index 0a50718e..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Append.lean +++ /dev/null @@ -1,22 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_315] «std-1.0.0-beta.14»::append::Append<> for Vector where [] := { - noir_def empty<>() -> Vector := { - (#_asVector returning Vector)((#_mkArray returning Array)()) - }; - - noir_def append<>(self: Vector, other: Vector) -> Vector := { - («std-1.0.0-beta.14»::vector::append as λ(Vector, Vector) -> Vector)(self, other) - }; -} - -def «std-1.0.0-beta.14».Append.env : Env := Env.mk - [] - [«std-1.0.0-beta.14».impl_315] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/CheckShuffle.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/CheckShuffle.lean deleted file mode 100644 index 20101ba2..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/CheckShuffle.lean +++ /dev/null @@ -1,136 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::__get_shuffle_indices(lhs: Array, rhs: Array) -> Array := { - (#_fresh returning Array)() -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::__get_index(indices: Array, idx: u32) -> u32 := { - (#_fresh returning u32)() -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::check_shuffle(lhs: Array, rhs: Array) -> Unit := { - let shuffle_indices = («std-1.0.0-beta.14»::array::check_shuffle::__get_shuffle_indices as λ(Array, Array) -> Array)(lhs, rhs); - for i in (0: u32) .. uConst!(N: u32) do { - let idx = («std-1.0.0-beta.14»::array::check_shuffle::__get_index as λ(Array, u32) -> u32)(shuffle_indices, i); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)(shuffle_indices, (#_cast returning u32)(idx)), i)); - #_skip - }; - for i in (0: u32) .. uConst!(N: u32) do { - let idx = (#_arrayIndex returning u32)(shuffle_indices, (#_cast returning u32)(i)); - let expected = (#_arrayIndex returning T)(rhs, (#_cast returning u32)(idx)); - let result = (#_arrayIndex returning T)(lhs, (#_cast returning u32)(i)); - (#_assert returning Unit)(((T as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)(expected, result)); - #_skip - }; - #_skip -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_23]<> «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<> where [] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, other: «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>) -> bool := { - (#_bAnd returning bool)((#_bAnd returning bool)((#_bEq returning bool)(self.0, other.0), (#_fEq returning bool)(self.1, other.1)), (#_uEq returning bool)(self.2, other.2)) - }; -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle<>() -> Unit := { - let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); - let rhs = (#_mkArray returning Array)((2: Field), (0: Field), (3: Field), (1: Field), (4: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_identity<>() -> Unit := { - let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); - let rhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_fail<>() -> Unit := { - let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); - let rhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (5: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_duplicates<>() -> Unit := { - let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); - let rhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (3: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_compound_struct<>() -> Unit := { - let lhs = (#_mkArray returning Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 5: u32>)((#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (12345: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (-100: Field), (54321: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_true, (5: Field), (18446744073709551615: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_true, (9814: Field), (17221745184140693811: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (341: Field), (0: u64))); - let rhs = (#_mkArray returning Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 5: u32>)((#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (341: Field), (0: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (12345: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (-100: Field), (54321: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_true, (9814: Field), (17221745184140693811: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_true, (5: Field), (18446744073709551615: u64))); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 5: u32> as λ(Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 5: u32>, Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 5: u32>) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_empty_array<>() -> Unit := { - let lhs = (#_mkArray returning Array)(); - let rhs = (#_mkArray returning Array)(); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_single_element<>() -> Unit := { - let lhs = (#_mkArray returning Array)((42: Field)); - let rhs = (#_mkArray returning Array)((42: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_with_duplicates<>() -> Unit := { - let lhs = (#_mkArray returning Array)((1: Field), (2: Field), (1: Field), (3: Field)); - let rhs = (#_mkArray returning Array)((1: Field), (3: Field), (1: Field), (2: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_all_same_values<>() -> Unit := { - let lhs = (#_mkArray returning Array)((42: Field), (42: Field), (42: Field), (42: Field), (42: Field)); - let rhs = (#_mkArray returning Array)((42: Field), (42: Field), (42: Field), (42: Field), (42: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_bool<>() -> Unit := { - let lhs = (#_mkArray returning Array)(#_true, #_false, #_true, #_false); - let rhs = (#_mkArray returning Array)(#_false, #_true, #_false, #_true); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_compound_struct_with_duplicates<>() -> Unit := { - let struct1 = (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_true, (42: Field), (100: u64)); - let struct2 = (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (200: u64)); - let lhs = (#_mkArray returning Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 4: u32>)(struct1, struct2, struct1, struct2); - let rhs = (#_mkArray returning Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 4: u32>)(struct2, struct1, struct2, struct1); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 4: u32> as λ(Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 4: u32>, Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 4: u32>) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_compound_struct_fail<>() -> Unit := { - let lhs = (#_mkArray returning Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 2: u32>)((#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_true, (42: Field), (100: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (200: u64))); - let rhs = (#_mkArray returning Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 2: u32>)((#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_true, (42: Field), (100: u64)), (#_makeData returning «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>)(#_false, (1: Field), (200: u64))); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 2: u32> as λ(Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 2: u32>, Array<«std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<>, 2: u32>) -> Unit)(lhs, rhs); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::check_shuffle::test::test_shuffle_negative_values<>() -> Unit := { - let lhs = (#_mkArray returning Array)((-1: Field), (-2: Field), (-3: Field), (-4: Field)); - let rhs = (#_mkArray returning Array)((-4: Field), (-3: Field), (-2: Field), (-1: Field)); - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(lhs, rhs); - #_skip -} - -def «std-1.0.0-beta.14».Array.CheckShuffle.env : Env := Env.mk - [«std-1.0.0-beta.14::array::check_shuffle::__get_shuffle_indices», «std-1.0.0-beta.14::array::check_shuffle::__get_index», «std-1.0.0-beta.14::array::check_shuffle::check_shuffle», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_identity», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_fail», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_duplicates», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_compound_struct», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_empty_array», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_single_element», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_with_duplicates», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_all_same_values», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_bool», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_compound_struct_with_duplicates», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_compound_struct_fail», «std-1.0.0-beta.14::array::check_shuffle::test::test_shuffle_negative_values»] - [«std-1.0.0-beta.14».impl_23] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Mod.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Mod.lean deleted file mode 100644 index 644f8b71..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Mod.lean +++ /dev/null @@ -1,299 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::array::map(self: Array, f: λ(T) -> U) -> Array := { - let uninitialized = (#_zeroed returning U)(); - let ret = (#_ref returning & Array)((#_mkRepeatedArray returning Array)(uninitialized)); - for i in (0: u32) .. (#_arrayLen returning u32)(self) do { - (ret[i]: U) = (f as λ(T) -> U)((#_arrayIndex returning T)(self, (#_cast returning u32)(i))); - #_skip - }; - (#_readRef returning Array)(ret) -} - -noir_def «std-1.0.0-beta.14»::array::mapi(self: Array, f: λ(u32, T) -> U) -> Array := { - let uninitialized = (#_zeroed returning U)(); - let ret = (#_ref returning & Array)((#_mkRepeatedArray returning Array)(uninitialized)); - for i in (0: u32) .. (#_arrayLen returning u32)(self) do { - (ret[i]: U) = (f as λ(u32, T) -> U)(i, (#_arrayIndex returning T)(self, (#_cast returning u32)(i))); - #_skip - }; - (#_readRef returning Array)(ret) -} - -noir_def «std-1.0.0-beta.14»::array::for_each(self: Array, f: λ(T) -> Unit) -> Unit := { - for i in (0: u32) .. (#_arrayLen returning u32)(self) do { - (f as λ(T) -> Unit)((#_arrayIndex returning T)(self, (#_cast returning u32)(i))); - #_skip - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::for_eachi(self: Array, f: λ(u32, T) -> Unit) -> Unit := { - for i in (0: u32) .. (#_arrayLen returning u32)(self) do { - (f as λ(u32, T) -> Unit)(i, (#_arrayIndex returning T)(self, (#_cast returning u32)(i))); - #_skip - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::fold(self: Array, accumulator: U, f: λ(U, T) -> U) -> U := { - let accumulator = (#_ref returning & U)(accumulator); - { - { - let ζi0 = self; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let elem = (#_arrayIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); - { - accumulator = (f as λ(U, T) -> U)((#_readRef returning U)(accumulator), elem); - #_skip - } - }; - #_skip - }; - (#_readRef returning U)(accumulator) -} -} - -noir_def «std-1.0.0-beta.14»::array::reduce(self: Array, f: λ(T, T) -> T) -> T := { - let accumulator = (#_ref returning & T)((#_arrayIndex returning T)(self, (0: u32))); - for i in (1: u32) .. (#_arrayLen returning u32)(self) do { - accumulator = (f as λ(T, T) -> T)((#_readRef returning T)(accumulator), (#_arrayIndex returning T)(self, (#_cast returning u32)(i))); - #_skip - }; - (#_readRef returning T)(accumulator) -} - -noir_def «std-1.0.0-beta.14»::array::«all»(self: Array, predicate: λ(T) -> bool) -> bool := { - let ret = (#_ref returning & bool)(#_true); - { - let ζi0 = self; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let elem = (#_arrayIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); - { - ret = (#_bAnd returning bool)((#_readRef returning bool)(ret), (predicate as λ(T) -> bool)(elem)); - #_skip - } - }; - #_skip - }; - (#_readRef returning bool)(ret) -} - -noir_def «std-1.0.0-beta.14»::array::any(self: Array, predicate: λ(T) -> bool) -> bool := { - let ret = (#_ref returning & bool)(#_false); - { - let ζi0 = self; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let elem = (#_arrayIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); - { - ret = (#_bOr returning bool)((#_readRef returning bool)(ret), (predicate as λ(T) -> bool)(elem)); - #_skip - } - }; - #_skip - }; - (#_readRef returning bool)(ret) -} - -noir_def «std-1.0.0-beta.14»::array::concat(self: Array, array2: Array) -> Array := { - let result = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((#_zeroed returning T)())); - for i in (0: u32) .. uConst!(N: u32) do { - (result[i]: T) = (#_arrayIndex returning T)(self, (#_cast returning u32)(i)); - #_skip - }; - for i in (0: u32) .. uConst!(M: u32) do { - let i_4238 = (#_uAdd returning u32)(i, uConst!(N: u32)); - (result[i_4238]: T) = (#_arrayIndex returning T)(array2, (#_cast returning u32)(i)); - #_skip - }; - (#_readRef returning Array)(result) -} - -noir_def «std-1.0.0-beta.14»::array::sort(self: Array) -> Array := { - («std-1.0.0-beta.14»::array::sort_via as λ(Array, λ(T, T) -> bool) -> Array)(self, (fn(a: T, b: T): bool := { - let __0 = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(a, b); - let __1 = («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - let __3 = («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - let __7 = ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __1); - let __15 = ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __3); - (#_bOr returning bool)(__7, __15) - })) -} - -noir_def «std-1.0.0-beta.14»::array::sort_via(self: Array, ordering: λ(T, T) -> bool) -> Array := { - let sorted = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(T, T) -> bool) -> Array)(self, (ordering as λ(T, T) -> bool)) - }; - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - for i in (0: u32) .. (#_uSub returning u32)(uConst!(N: u32), (1: u32)) do { - (#_assert returning Unit)((ordering as λ(T, T) -> bool)((#_arrayIndex returning T)(sorted, (#_cast returning u32)(i)), (#_arrayIndex returning T)(sorted, (#_cast returning u32)((#_uAdd returning u32)(i, (1: u32)))))); - #_skip - }; - («std-1.0.0-beta.14»::array::check_shuffle::check_shuffle as λ(Array, Array) -> Unit)(self, sorted); - #_skip - }; - sorted -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_24] «std-1.0.0-beta.14»::convert::From > for Array where [] := { - noir_def «from»<>(s: String) -> Array := { - (#_strAsBytes returning Array)(s) - }; -} - -noir_def «std-1.0.0-beta.14»::array::test::map_empty<>() -> Unit := { - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.14»::array::map as λ(Array, λ(Field) -> Field) -> Array)((#_mkArray returning Array)(), (fn(x: Field): Field := (#_fAdd returning Field)(x, (1: Field)))), (#_mkArray returning Array)())); - #_skip -} - -noir_global_def «std-1.0.0-beta.14»::array::test::arr_with_100_values: Array = (#_mkArray returning Array)((42: u32), (123: u32), (87: u32), (93: u32), (48: u32), (80: u32), (50: u32), (5: u32), (104: u32), (84: u32), (70: u32), (47: u32), (119: u32), (66: u32), (71: u32), (121: u32), (3: u32), (29: u32), (42: u32), (118: u32), (2: u32), (54: u32), (89: u32), (44: u32), (81: u32), (0: u32), (26: u32), (106: u32), (68: u32), (96: u32), (84: u32), (48: u32), (95: u32), (54: u32), (45: u32), (32: u32), (89: u32), (100: u32), (109: u32), (19: u32), (37: u32), (41: u32), (19: u32), (98: u32), (53: u32), (114: u32), (107: u32), (66: u32), (6: u32), (74: u32), (13: u32), (19: u32), (105: u32), (64: u32), (123: u32), (28: u32), (44: u32), (50: u32), (89: u32), (58: u32), (123: u32), (126: u32), (21: u32), (43: u32), (86: u32), (35: u32), (21: u32), (62: u32), (82: u32), (0: u32), (108: u32), (120: u32), (72: u32), (72: u32), (62: u32), (80: u32), (12: u32), (71: u32), (70: u32), (86: u32), (116: u32), (73: u32), (38: u32), (15: u32), (127: u32), (81: u32), (30: u32), (8: u32), (125: u32), (28: u32), (26: u32), (69: u32), (114: u32), (63: u32), (27: u32), (28: u32), (61: u32), (42: u32), (13: u32), (32: u32)); - -noir_global_def «std-1.0.0-beta.14»::array::test::expected_with_100_values: Array = (#_mkArray returning Array)((0: u32), (0: u32), (2: u32), (3: u32), (5: u32), (6: u32), (8: u32), (12: u32), (13: u32), (13: u32), (15: u32), (19: u32), (19: u32), (19: u32), (21: u32), (21: u32), (26: u32), (26: u32), (27: u32), (28: u32), (28: u32), (28: u32), (29: u32), (30: u32), (32: u32), (32: u32), (35: u32), (37: u32), (38: u32), (41: u32), (42: u32), (42: u32), (42: u32), (43: u32), (44: u32), (44: u32), (45: u32), (47: u32), (48: u32), (48: u32), (50: u32), (50: u32), (53: u32), (54: u32), (54: u32), (58: u32), (61: u32), (62: u32), (62: u32), (63: u32), (64: u32), (66: u32), (66: u32), (68: u32), (69: u32), (70: u32), (70: u32), (71: u32), (71: u32), (72: u32), (72: u32), (73: u32), (74: u32), (80: u32), (80: u32), (81: u32), (81: u32), (82: u32), (84: u32), (84: u32), (86: u32), (86: u32), (87: u32), (89: u32), (89: u32), (89: u32), (93: u32), (95: u32), (96: u32), (98: u32), (100: u32), (104: u32), (105: u32), (106: u32), (107: u32), (108: u32), (109: u32), (114: u32), (114: u32), (116: u32), (118: u32), (119: u32), (120: u32), (121: u32), (123: u32), (123: u32), (123: u32), (125: u32), (126: u32), (127: u32)); - -noir_def «std-1.0.0-beta.14»::array::test::sort_u32<>(a: u32, b: u32) -> bool := { - (#_uLeq returning bool)(a, b) -} - -noir_def «std-1.0.0-beta.14»::array::test::test_sort<>() -> Unit := { - let arr = (#_ref returning & Array)((#_mkArray returning Array)((3: u32), (6: u32), (8: u32), (10: u32), (1: u32), (2: u32), (1: u32))); - let sorted = («std-1.0.0-beta.14»::array::sort as λ(Array) -> Array)((#_readRef returning Array)(arr)); - let expected = (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (6: u32), (8: u32), (10: u32)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::test_sort_100_values<>() -> Unit := { - let arr = (#_ref returning & Array)((#_mkArray returning Array)((42: u32), (123: u32), (87: u32), (93: u32), (48: u32), (80: u32), (50: u32), (5: u32), (104: u32), (84: u32), (70: u32), (47: u32), (119: u32), (66: u32), (71: u32), (121: u32), (3: u32), (29: u32), (42: u32), (118: u32), (2: u32), (54: u32), (89: u32), (44: u32), (81: u32), (0: u32), (26: u32), (106: u32), (68: u32), (96: u32), (84: u32), (48: u32), (95: u32), (54: u32), (45: u32), (32: u32), (89: u32), (100: u32), (109: u32), (19: u32), (37: u32), (41: u32), (19: u32), (98: u32), (53: u32), (114: u32), (107: u32), (66: u32), (6: u32), (74: u32), (13: u32), (19: u32), (105: u32), (64: u32), (123: u32), (28: u32), (44: u32), (50: u32), (89: u32), (58: u32), (123: u32), (126: u32), (21: u32), (43: u32), (86: u32), (35: u32), (21: u32), (62: u32), (82: u32), (0: u32), (108: u32), (120: u32), (72: u32), (72: u32), (62: u32), (80: u32), (12: u32), (71: u32), (70: u32), (86: u32), (116: u32), (73: u32), (38: u32), (15: u32), (127: u32), (81: u32), (30: u32), (8: u32), (125: u32), (28: u32), (26: u32), (69: u32), (114: u32), (63: u32), (27: u32), (28: u32), (61: u32), (42: u32), (13: u32), (32: u32))); - let sorted = («std-1.0.0-beta.14»::array::sort as λ(Array) -> Array)((#_readRef returning Array)(arr)); - let expected = (#_mkArray returning Array)((0: u32), (0: u32), (2: u32), (3: u32), (5: u32), (6: u32), (8: u32), (12: u32), (13: u32), (13: u32), (15: u32), (19: u32), (19: u32), (19: u32), (21: u32), (21: u32), (26: u32), (26: u32), (27: u32), (28: u32), (28: u32), (28: u32), (29: u32), (30: u32), (32: u32), (32: u32), (35: u32), (37: u32), (38: u32), (41: u32), (42: u32), (42: u32), (42: u32), (43: u32), (44: u32), (44: u32), (45: u32), (47: u32), (48: u32), (48: u32), (50: u32), (50: u32), (53: u32), (54: u32), (54: u32), (58: u32), (61: u32), (62: u32), (62: u32), (63: u32), (64: u32), (66: u32), (66: u32), (68: u32), (69: u32), (70: u32), (70: u32), (71: u32), (71: u32), (72: u32), (72: u32), (73: u32), (74: u32), (80: u32), (80: u32), (81: u32), (81: u32), (82: u32), (84: u32), (84: u32), (86: u32), (86: u32), (87: u32), (89: u32), (89: u32), (89: u32), (93: u32), (95: u32), (96: u32), (98: u32), (100: u32), (104: u32), (105: u32), (106: u32), (107: u32), (108: u32), (109: u32), (114: u32), (114: u32), (116: u32), (118: u32), (119: u32), (120: u32), (121: u32), (123: u32), (123: u32), (123: u32), (125: u32), (126: u32), (127: u32)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::test_sort_100_values_comptime<>() -> Unit := { - let sorted = («std-1.0.0-beta.14»::array::sort as λ(Array) -> Array)((«std-1.0.0-beta.14»::array::test::arr_with_100_values<> as λ() -> Array)()); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, («std-1.0.0-beta.14»::array::test::expected_with_100_values<> as λ() -> Array)())); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::test_sort_via<>() -> Unit := { - let arr = (#_ref returning & Array)((#_mkArray returning Array)((3: u32), (6: u32), (8: u32), (10: u32), (1: u32), (2: u32), (1: u32))); - let sorted = («std-1.0.0-beta.14»::array::sort_via as λ(Array, λ(u32, u32) -> bool) -> Array)((#_readRef returning Array)(arr), («std-1.0.0-beta.14»::array::test::sort_u32<> as λ(u32, u32) -> bool)); - let expected = (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (6: u32), (8: u32), (10: u32)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::test_sort_via_100_values<>() -> Unit := { - let arr = (#_ref returning & Array)((#_mkArray returning Array)((42: u32), (123: u32), (87: u32), (93: u32), (48: u32), (80: u32), (50: u32), (5: u32), (104: u32), (84: u32), (70: u32), (47: u32), (119: u32), (66: u32), (71: u32), (121: u32), (3: u32), (29: u32), (42: u32), (118: u32), (2: u32), (54: u32), (89: u32), (44: u32), (81: u32), (0: u32), (26: u32), (106: u32), (68: u32), (96: u32), (84: u32), (48: u32), (95: u32), (54: u32), (45: u32), (32: u32), (89: u32), (100: u32), (109: u32), (19: u32), (37: u32), (41: u32), (19: u32), (98: u32), (53: u32), (114: u32), (107: u32), (66: u32), (6: u32), (74: u32), (13: u32), (19: u32), (105: u32), (64: u32), (123: u32), (28: u32), (44: u32), (50: u32), (89: u32), (58: u32), (123: u32), (126: u32), (21: u32), (43: u32), (86: u32), (35: u32), (21: u32), (62: u32), (82: u32), (0: u32), (108: u32), (120: u32), (72: u32), (72: u32), (62: u32), (80: u32), (12: u32), (71: u32), (70: u32), (86: u32), (116: u32), (73: u32), (38: u32), (15: u32), (127: u32), (81: u32), (30: u32), (8: u32), (125: u32), (28: u32), (26: u32), (69: u32), (114: u32), (63: u32), (27: u32), (28: u32), (61: u32), (42: u32), (13: u32), (32: u32))); - let sorted = («std-1.0.0-beta.14»::array::sort_via as λ(Array, λ(u32, u32) -> bool) -> Array)((#_readRef returning Array)(arr), («std-1.0.0-beta.14»::array::test::sort_u32<> as λ(u32, u32) -> bool)); - let expected = (#_mkArray returning Array)((0: u32), (0: u32), (2: u32), (3: u32), (5: u32), (6: u32), (8: u32), (12: u32), (13: u32), (13: u32), (15: u32), (19: u32), (19: u32), (19: u32), (21: u32), (21: u32), (26: u32), (26: u32), (27: u32), (28: u32), (28: u32), (28: u32), (29: u32), (30: u32), (32: u32), (32: u32), (35: u32), (37: u32), (38: u32), (41: u32), (42: u32), (42: u32), (42: u32), (43: u32), (44: u32), (44: u32), (45: u32), (47: u32), (48: u32), (48: u32), (50: u32), (50: u32), (53: u32), (54: u32), (54: u32), (58: u32), (61: u32), (62: u32), (62: u32), (63: u32), (64: u32), (66: u32), (66: u32), (68: u32), (69: u32), (70: u32), (70: u32), (71: u32), (71: u32), (72: u32), (72: u32), (73: u32), (74: u32), (80: u32), (80: u32), (81: u32), (81: u32), (82: u32), (84: u32), (84: u32), (86: u32), (86: u32), (87: u32), (89: u32), (89: u32), (89: u32), (93: u32), (95: u32), (96: u32), (98: u32), (100: u32), (104: u32), (105: u32), (106: u32), (107: u32), (108: u32), (109: u32), (114: u32), (114: u32), (116: u32), (118: u32), (119: u32), (120: u32), (121: u32), (123: u32), (123: u32), (123: u32), (125: u32), (126: u32), (127: u32)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::mapi_empty<>() -> Unit := { - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.14»::array::mapi as λ(Array, λ(u32, u32) -> u32) -> Array)((#_mkArray returning Array)(), (fn(i: u32, x: u32): u32 := (#_uAdd returning u32)((#_uMul returning u32)(i, x), (1: u32)))), (#_mkArray returning Array)())); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::for_each_empty<>() -> Unit := { - let empty_array = (#_mkArray returning Array)(); - («std-1.0.0-beta.14»::array::for_each as λ(Array, λ(Field) -> Unit) -> Unit)(empty_array, (fn(_x: Field): Unit := (#_assert returning Unit)(#_false))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::for_eachi_empty<>() -> Unit := { - let empty_array = (#_mkArray returning Array)(); - («std-1.0.0-beta.14»::array::for_eachi as λ(Array, λ(u32, Field) -> Unit) -> Unit)(empty_array, (fn(_i: u32, _x: Field): Unit := (#_assert returning Unit)(#_false))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::map_example<>() -> Unit := { - let a = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); - let b = («std-1.0.0-beta.14»::array::map as λ(Array, λ(Field) -> Field) -> Array)(a, (fn(a: Field): Field := (#_fMul returning Field)(a, (2: Field)))); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(b, (#_mkArray returning Array)((2: Field), (4: Field), (6: Field)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::mapi_example<>() -> Unit := { - let a = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)); - let b = («std-1.0.0-beta.14»::array::mapi as λ(Array, λ(u32, u32) -> u32) -> Array)(a, (fn(i: u32, a: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(a, (2: u32))))); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(b, (#_mkArray returning Array)((2: u32), (5: u32), (8: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::for_each_example<>() -> Unit := { - let a = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); - let b = (#_ref returning & Array)((#_mkArray returning Array)((0: Field), (0: Field), (0: Field))); - let b_ref = b; - let i = (#_ref returning & u32)((0: u32)); - let i_ref = i; - («std-1.0.0-beta.14»::array::for_each > > as λ(Array, λ(Field) -> Unit) -> Unit)(a, (fn(x: Field): Unit := { - { - let i_3190 = (#_readRef returning u32)(i_ref); - ((*b_ref: Array)[i_3190]: Field) = (#_fMul returning Field)(x, (2: Field)); - #_skip - }; - (*i_ref: u32) = (#_uAdd returning u32)((#_readRef returning u32)(i_ref), (1: u32)); - #_skip - })); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(b), (#_mkArray returning Array)((2: Field), (4: Field), (6: Field)))); - (#_assert returning Unit)((#_uEq returning bool)((#_readRef returning u32)(i), (3: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::for_eachi_example<>() -> Unit := { - let a = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)); - let b = (#_ref returning & Array)((#_mkArray returning Array)((0: u32), (0: u32), (0: u32))); - let b_ref = b; - («std-1.0.0-beta.14»::array::for_eachi > > as λ(Array, λ(u32, u32) -> Unit) -> Unit)(a, (fn(i: u32, a: u32): Unit := { - ((*b_ref: Array)[i]: u32) = (#_uAdd returning u32)(i, (#_uMul returning u32)(a, (2: u32))); - #_skip - })); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(b), (#_mkArray returning Array)((2: u32), (5: u32), (8: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::concat<>() -> Unit := { - let arr1 = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field)); - let arr2 = (#_mkArray returning Array)((6: Field), (7: Field), (8: Field), (9: Field), (10: Field), (11: Field)); - let concatenated_arr = («std-1.0.0-beta.14»::array::concat as λ(Array, Array) -> Array)(arr1, arr2); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (6: Field), (7: Field), (8: Field), (9: Field), (10: Field), (11: Field)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::concat_zero_length_with_something<>() -> Unit := { - let arr1 = (#_mkArray returning Array)(); - let arr2 = (#_mkArray returning Array)((1: Field)); - let concatenated_arr = («std-1.0.0-beta.14»::array::concat as λ(Array, Array) -> Array)(arr1, arr2); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)((1: Field)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::concat_something_with_zero_length<>() -> Unit := { - let arr1 = (#_mkArray returning Array)((1: Field)); - let arr2 = (#_mkArray returning Array)(); - let concatenated_arr = («std-1.0.0-beta.14»::array::concat as λ(Array, Array) -> Array)(arr1, arr2); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)((1: Field)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::test::concat_zero_lengths<>() -> Unit := { - let arr1 = (#_mkArray returning Array)(); - let arr2 = (#_mkArray returning Array)(); - let concatenated_arr = («std-1.0.0-beta.14»::array::concat as λ(Array, Array) -> Array)(arr1, arr2); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)())); - #_skip -} - -def «std-1.0.0-beta.14».Array.Mod.env : Env := Env.mk - [«std-1.0.0-beta.14::array::map», «std-1.0.0-beta.14::array::mapi», «std-1.0.0-beta.14::array::for_each», «std-1.0.0-beta.14::array::for_eachi», «std-1.0.0-beta.14::array::fold», «std-1.0.0-beta.14::array::reduce», «std-1.0.0-beta.14::array::all», «std-1.0.0-beta.14::array::any», «std-1.0.0-beta.14::array::concat», «std-1.0.0-beta.14::array::sort», «std-1.0.0-beta.14::array::sort_via», «std-1.0.0-beta.14::array::test::map_empty», «std-1.0.0-beta.14::array::test::arr_with_100_values», «std-1.0.0-beta.14::array::test::expected_with_100_values», «std-1.0.0-beta.14::array::test::sort_u32», «std-1.0.0-beta.14::array::test::test_sort», «std-1.0.0-beta.14::array::test::test_sort_100_values», «std-1.0.0-beta.14::array::test::test_sort_100_values_comptime», «std-1.0.0-beta.14::array::test::test_sort_via», «std-1.0.0-beta.14::array::test::test_sort_via_100_values», «std-1.0.0-beta.14::array::test::mapi_empty», «std-1.0.0-beta.14::array::test::for_each_empty», «std-1.0.0-beta.14::array::test::for_eachi_empty», «std-1.0.0-beta.14::array::test::map_example», «std-1.0.0-beta.14::array::test::mapi_example», «std-1.0.0-beta.14::array::test::for_each_example», «std-1.0.0-beta.14::array::test::for_eachi_example», «std-1.0.0-beta.14::array::test::concat», «std-1.0.0-beta.14::array::test::concat_zero_length_with_something», «std-1.0.0-beta.14::array::test::concat_something_with_zero_length», «std-1.0.0-beta.14::array::test::concat_zero_lengths»] - [«std-1.0.0-beta.14».impl_24] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Quicksort.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Quicksort.lean deleted file mode 100644 index 06936ef9..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Array/Quicksort.lean +++ /dev/null @@ -1,285 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::array::quicksort::partition(arr: & Array, low: u32, high: u32, sortfn: λ(T, T) -> bool) -> u32 := { - (#_fresh returning u32)() -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::quicksort_loop(arr: & Array, low: u32, high: u32, sortfn: λ(T, T) -> bool) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::quicksort(arr: Array, sortfn: λ(T, T) -> bool) -> Array := { - (#_fresh returning Array)() -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::ascending(a: T, b: T) -> bool := { - let __0 = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(a, b); - let __1 = («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __1) -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::descending(a: T, b: T) -> bool := { - let __0 = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(a, b); - let __1 = («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __1) -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_empty_array<>() -> Unit := { - let arr = (#_mkArray returning Array)(); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, arr)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_single_element<>() -> Unit := { - let arr = (#_mkArray returning Array)((42: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, arr)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_two_elements_ascending<>() -> Unit := { - let arr = (#_mkArray returning Array)((2: u32), (1: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_two_elements_descending<>() -> Unit := { - let arr = (#_mkArray returning Array)((1: u32), (2: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::descending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((2: u32), (1: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_already_sorted_ascending<>() -> Unit := { - let arr = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_already_sorted_ascending_with_one_out_of_order<>() -> Unit := { - let arr = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u32))); - for i in (0: u32) .. (1000: u32) do { - (arr[i]: u32) = (#_cast returning u32)(i); - #_skip - }; - (arr[(0: u32)]: u32) = (2: u32); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)((#_readRef returning Array)(arr), («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (arr[(0: u32)]: u32) = (1: u32); - (arr[(1: u32)]: u32) = (2: u32); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_readRef returning Array)(arr))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_already_sorted_descending<>() -> Unit := { - let arr = (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::descending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_reverse_sorted_ascending<>() -> Unit := { - let arr = (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_reverse_sorted_descending<>() -> Unit := { - let arr = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::descending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_random_array_ascending<>() -> Unit := { - let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (9: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_random_array_descending<>() -> Unit := { - let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::descending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((9: u32), (6: u32), (5: u32), (4: u32), (3: u32), (2: u32), (1: u32), (1: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_duplicate_elements<>() -> Unit := { - let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32), (5: u32), (3: u32), (5: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (3: u32), (4: u32), (5: u32), (5: u32), (5: u32), (6: u32), (9: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_all_same_elements<>() -> Unit := { - let arr = (#_mkArray returning Array)((42: u32), (42: u32), (42: u32), (42: u32), (42: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((42: u32), (42: u32), (42: u32), (42: u32), (42: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_large_array<>() -> Unit := { - let arr = (#_mkArray returning Array)((9: u32), (8: u32), (7: u32), (6: u32), (5: u32), (4: u32), (3: u32), (2: u32), (1: u32), (0: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((0: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32), (9: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_negative_numbers<>() -> Unit := { - let arr = (#_mkArray returning Array< i32, 8: u32>)((-3: i32), (1: i32), (-4: i32), (1: i32), (-5: i32), (9: i32), (-2: i32), (6: i32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort< i32, 8: u32, Unit> as λ(Array< i32, 8: u32>, λ(i32, i32) -> bool) -> Array< i32, 8: u32>)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending< i32> as λ(i32, i32) -> bool)) - }; - (#_assert returning Unit)(((Array< i32, 8: u32> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array< i32, 8: u32>, Array< i32, 8: u32>) -> bool)(result, (#_mkArray returning Array< i32, 8: u32>)((-5: i32), (-4: i32), (-3: i32), (-2: i32), (1: i32), (1: i32), (6: i32), (9: i32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_zero_values<>() -> Unit := { - let arr = (#_mkArray returning Array)((0: u32), (1: u32), (0: u32), (2: u32), (0: u32), (3: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((0: u32), (0: u32), (0: u32), (1: u32), (2: u32), (3: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_edge_case_near_sorted<>() -> Unit := { - let arr = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (5: u32), (4: u32), (6: u32), (7: u32), (8: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_edge_case_near_reverse_sorted<>() -> Unit := { - let arr = (#_mkArray returning Array)((8: u32), (7: u32), (6: u32), (4: u32), (5: u32), (3: u32), (2: u32), (1: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::abs_compare<>(a: i32, b: i32) -> bool := { - let abs_a = if (#_iLt returning bool)(a, (0: i32)) then { - (#_iNeg returning i32)(a) - } else { - a - }; - let abs_b = if (#_iLt returning bool)(b, (0: i32)) then { - (#_iNeg returning i32)(b) - } else { - b - }; - (#_iLt returning bool)(abs_a, abs_b) -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_custom_comparison<>() -> Unit := { - let arr = (#_mkArray returning Array< i32, 8: u32>)((-3: i32), (1: i32), (-4: i32), (1: i32), (-5: i32), (9: i32), (-2: i32), (6: i32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort< i32, 8: u32, Unit> as λ(Array< i32, 8: u32>, λ(i32, i32) -> bool) -> Array< i32, 8: u32>)(arr, («std-1.0.0-beta.14»::array::quicksort::test::abs_compare<> as λ(i32, i32) -> bool)) - }; - (#_assert returning Unit)(((Array< i32, 8: u32> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array< i32, 8: u32>, Array< i32, 8: u32>) -> bool)(result, (#_mkArray returning Array< i32, 8: u32>)((1: i32), (1: i32), (-2: i32), (-3: i32), (-4: i32), (-5: i32), (6: i32), (9: i32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_equivalent_same_relative_order<>() -> Unit := { - let arr = (#_mkArray returning Array< i32, 11: u32>)((-3: i32), (1: i32), (-4: i32), (1: i32), (-5: i32), (5: i32), (-5: i32), (5: i32), (9: i32), (-2: i32), (6: i32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort< i32, 11: u32, Unit> as λ(Array< i32, 11: u32>, λ(i32, i32) -> bool) -> Array< i32, 11: u32>)(arr, («std-1.0.0-beta.14»::array::quicksort::test::abs_compare<> as λ(i32, i32) -> bool)) - }; - (#_assert returning Unit)(((Array< i32, 11: u32> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array< i32, 11: u32>, Array< i32, 11: u32>) -> bool)(result, (#_mkArray returning Array< i32, 11: u32>)((1: i32), (1: i32), (-2: i32), (-3: i32), (-4: i32), (-5: i32), (5: i32), (-5: i32), (5: i32), (6: i32), (9: i32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_maximum_values<>() -> Unit := { - let arr = (#_mkArray returning Array)((#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (1: u32))), (1: u32), (0: u32), (#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (2: u32)))); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((0: u32), (1: u32), (#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (2: u32))), (#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (1: u32)))))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_alternating_pattern<>() -> Unit := { - let arr = (#_mkArray returning Array)((1: u32), (9: u32), (2: u32), (8: u32), (3: u32), (7: u32), (4: u32), (6: u32), (5: u32)); - let result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32), (9: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_multiple_sorts_same_array<>() -> Unit := { - let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); - let result1 = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - let result2 = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - let result3 = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result1, result2)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result2, result3)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result1, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (9: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::array::quicksort::test::test_descending_then_ascending<>() -> Unit := { - let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); - let desc_result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.14»::array::quicksort::test::descending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(desc_result, (#_mkArray returning Array)((9: u32), (6: u32), (5: u32), (4: u32), (3: u32), (2: u32), (1: u32), (1: u32)))); - let asc_result = { - («std-1.0.0-beta.14»::array::quicksort::quicksort as λ(Array, λ(u32, u32) -> bool) -> Array)(desc_result, («std-1.0.0-beta.14»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(asc_result, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (9: u32)))); - #_skip -} - -def «std-1.0.0-beta.14».Array.Quicksort.env : Env := Env.mk - [«std-1.0.0-beta.14::array::quicksort::partition», «std-1.0.0-beta.14::array::quicksort::quicksort_loop», «std-1.0.0-beta.14::array::quicksort::quicksort», «std-1.0.0-beta.14::array::quicksort::test::ascending», «std-1.0.0-beta.14::array::quicksort::test::descending», «std-1.0.0-beta.14::array::quicksort::test::test_empty_array», «std-1.0.0-beta.14::array::quicksort::test::test_single_element», «std-1.0.0-beta.14::array::quicksort::test::test_two_elements_ascending», «std-1.0.0-beta.14::array::quicksort::test::test_two_elements_descending», «std-1.0.0-beta.14::array::quicksort::test::test_already_sorted_ascending», «std-1.0.0-beta.14::array::quicksort::test::test_already_sorted_ascending_with_one_out_of_order», «std-1.0.0-beta.14::array::quicksort::test::test_already_sorted_descending», «std-1.0.0-beta.14::array::quicksort::test::test_reverse_sorted_ascending», «std-1.0.0-beta.14::array::quicksort::test::test_reverse_sorted_descending», «std-1.0.0-beta.14::array::quicksort::test::test_random_array_ascending», «std-1.0.0-beta.14::array::quicksort::test::test_random_array_descending», «std-1.0.0-beta.14::array::quicksort::test::test_duplicate_elements», «std-1.0.0-beta.14::array::quicksort::test::test_all_same_elements», «std-1.0.0-beta.14::array::quicksort::test::test_large_array», «std-1.0.0-beta.14::array::quicksort::test::test_negative_numbers», «std-1.0.0-beta.14::array::quicksort::test::test_zero_values», «std-1.0.0-beta.14::array::quicksort::test::test_edge_case_near_sorted», «std-1.0.0-beta.14::array::quicksort::test::test_edge_case_near_reverse_sorted», «std-1.0.0-beta.14::array::quicksort::test::abs_compare», «std-1.0.0-beta.14::array::quicksort::test::test_custom_comparison», «std-1.0.0-beta.14::array::quicksort::test::test_equivalent_same_relative_order», «std-1.0.0-beta.14::array::quicksort::test::test_maximum_values», «std-1.0.0-beta.14::array::quicksort::test::test_alternating_pattern», «std-1.0.0-beta.14::array::quicksort::test::test_multiple_sorts_same_array», «std-1.0.0-beta.14::array::quicksort::test::test_descending_then_ascending»] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Cmp.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Cmp.lean deleted file mode 100644 index 799a09c2..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Cmp.lean +++ /dev/null @@ -1,453 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_78]<> «std-1.0.0-beta.14»::cmp::Eq<> for Field where [] := { - noir_def eq<>(self: Field, other: Field) -> bool := { - (#_fEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_79]<> «std-1.0.0-beta.14»::cmp::Eq<> for u128 where [] := { - noir_def eq<>(self: u128, other: u128) -> bool := { - (#_uEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_80]<> «std-1.0.0-beta.14»::cmp::Eq<> for u64 where [] := { - noir_def eq<>(self: u64, other: u64) -> bool := { - (#_uEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_81]<> «std-1.0.0-beta.14»::cmp::Eq<> for u32 where [] := { - noir_def eq<>(self: u32, other: u32) -> bool := { - (#_uEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_82]<> «std-1.0.0-beta.14»::cmp::Eq<> for u16 where [] := { - noir_def eq<>(self: u16, other: u16) -> bool := { - (#_uEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_83]<> «std-1.0.0-beta.14»::cmp::Eq<> for u8 where [] := { - noir_def eq<>(self: u8, other: u8) -> bool := { - (#_uEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_84]<> «std-1.0.0-beta.14»::cmp::Eq<> for u1 where [] := { - noir_def eq<>(self: u1, other: u1) -> bool := { - (#_uEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_85]<> «std-1.0.0-beta.14»::cmp::Eq<> for i8 where [] := { - noir_def eq<>(self: i8, other: i8) -> bool := { - (#_iEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_86]<> «std-1.0.0-beta.14»::cmp::Eq<> for i16 where [] := { - noir_def eq<>(self: i16, other: i16) -> bool := { - (#_iEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_87]<> «std-1.0.0-beta.14»::cmp::Eq<> for i32 where [] := { - noir_def eq<>(self: i32, other: i32) -> bool := { - (#_iEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_88]<> «std-1.0.0-beta.14»::cmp::Eq<> for i64 where [] := { - noir_def eq<>(self: i64, other: i64) -> bool := { - (#_iEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_89]<> «std-1.0.0-beta.14»::cmp::Eq<> for Unit where [] := { - noir_def eq<>(_self: Unit, _other: Unit) -> bool := { - #_true - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_90]<> «std-1.0.0-beta.14»::cmp::Eq<> for bool where [] := { - noir_def eq<>(self: bool, other: bool) -> bool := { - (#_bEq returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_91] «std-1.0.0-beta.14»::cmp::Eq<> for Array where [T: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: Array, other: Array) -> bool := { - let result = (#_ref returning & bool)(#_true); - for i in (0: u32) .. (#_arrayLen returning u32)(self) do { - result = (#_bAnd returning bool)((#_readRef returning bool)(result), ((T as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)((#_arrayIndex returning T)(self, (#_cast returning u32)(i)), (#_arrayIndex returning T)(other, (#_cast returning u32)(i)))); - #_skip - }; - (#_readRef returning bool)(result) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_92] «std-1.0.0-beta.14»::cmp::Eq<> for Vector where [T: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: Vector, other: Vector) -> bool := { - let result = (#_ref returning & bool)((#_uEq returning bool)((#_arrayLen returning u32)(self), (#_arrayLen returning u32)(other))); - if (#_readRef returning bool)(result) then { - for i in (0: u32) .. (#_arrayLen returning u32)(self) do { - result = (#_bAnd returning bool)((#_readRef returning bool)(result), ((T as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)((#_vectorIndex returning T)(self, (#_cast returning u32)(i)), (#_vectorIndex returning T)(other, (#_cast returning u32)(i)))); - #_skip - }; - #_skip - }; - (#_readRef returning bool)(result) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_93] «std-1.0.0-beta.14»::cmp::Eq<> for String where [] := { - noir_def eq<>(self: String, other: String) -> bool := { - let self_bytes = (#_strAsBytes returning Array)(self); - let other_bytes = (#_strAsBytes returning Array)(other); - ((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(self_bytes, other_bytes) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_94] «std-1.0.0-beta.14»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Eq<>, B: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: Tuple, other: Tuple) -> bool := { - (#_bAnd returning bool)(((A as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_95] «std-1.0.0-beta.14»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Eq<>, B: «std-1.0.0-beta.14»::cmp::Eq<>, C: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: Tuple, other: Tuple) -> bool := { - (#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_96] «std-1.0.0-beta.14»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Eq<>, B: «std-1.0.0-beta.14»::cmp::Eq<>, C: «std-1.0.0-beta.14»::cmp::Eq<>, D: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: Tuple, other: Tuple) -> bool := { - (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_97] «std-1.0.0-beta.14»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Eq<>, B: «std-1.0.0-beta.14»::cmp::Eq<>, C: «std-1.0.0-beta.14»::cmp::Eq<>, D: «std-1.0.0-beta.14»::cmp::Eq<>, E: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: Tuple, other: Tuple) -> bool := { - (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_98]<> «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::cmp::Ordering<> where [] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::cmp::Ordering<>, other: «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool := { - (#_fEq returning bool)(self.0, other.0) - }; -} - -noir_def «std-1.0.0-beta.14»::cmp::Ordering::less<>() -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - (#_makeData returning «std-1.0.0-beta.14»::cmp::Ordering<>)((0: Field)) -} - -noir_def «std-1.0.0-beta.14»::cmp::Ordering::equal<>() -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - (#_makeData returning «std-1.0.0-beta.14»::cmp::Ordering<>)((1: Field)) -} - -noir_def «std-1.0.0-beta.14»::cmp::Ordering::greater<>() -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - (#_makeData returning «std-1.0.0-beta.14»::cmp::Ordering<>)((2: Field)) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_99]<> «std-1.0.0-beta.14»::cmp::Ord<> for u128 where [] := { - noir_def cmp<>(self: u128, other: u128) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_uLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_uGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_100]<> «std-1.0.0-beta.14»::cmp::Ord<> for u64 where [] := { - noir_def cmp<>(self: u64, other: u64) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_uLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_uGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_101]<> «std-1.0.0-beta.14»::cmp::Ord<> for u32 where [] := { - noir_def cmp<>(self: u32, other: u32) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_uLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_uGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_102]<> «std-1.0.0-beta.14»::cmp::Ord<> for u16 where [] := { - noir_def cmp<>(self: u16, other: u16) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_uLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_uGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_103]<> «std-1.0.0-beta.14»::cmp::Ord<> for u8 where [] := { - noir_def cmp<>(self: u8, other: u8) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_uLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_uGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_104]<> «std-1.0.0-beta.14»::cmp::Ord<> for i8 where [] := { - noir_def cmp<>(self: i8, other: i8) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_iLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_iGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_105]<> «std-1.0.0-beta.14»::cmp::Ord<> for i16 where [] := { - noir_def cmp<>(self: i16, other: i16) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_iLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_iGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_106]<> «std-1.0.0-beta.14»::cmp::Ord<> for i32 where [] := { - noir_def cmp<>(self: i32, other: i32) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_iLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_iGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_107]<> «std-1.0.0-beta.14»::cmp::Ord<> for i64 where [] := { - noir_def cmp<>(self: i64, other: i64) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if (#_iLt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else if (#_iGt returning bool)(self, other) then { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_108]<> «std-1.0.0-beta.14»::cmp::Ord<> for Unit where [] := { - noir_def cmp<>(_self: Unit, _other: Unit) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_109]<> «std-1.0.0-beta.14»::cmp::Ord<> for bool where [] := { - noir_def cmp<>(self: bool, other: bool) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if self then { - if other then { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - } else if other then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_110] «std-1.0.0-beta.14»::cmp::Ord<> for Array where [T: «std-1.0.0-beta.14»::cmp::Ord<>] := { - noir_def cmp<>(self: Array, other: Array) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - let result = (#_ref returning & «std-1.0.0-beta.14»::cmp::Ordering<>)((«std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()); - for i in (0: u32) .. (#_arrayLen returning u32)(self) do { - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)((#_arrayIndex returning T)(self, (#_cast returning u32)(i)), (#_arrayIndex returning T)(other, (#_cast returning u32)(i))); - #_skip - } - }; - (#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_111] «std-1.0.0-beta.14»::cmp::Ord<> for Vector where [T: «std-1.0.0-beta.14»::cmp::Ord<>] := { - noir_def cmp<>(self: Vector, other: Vector) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - let self_len = (#_arrayLen returning u32)(self); - let other_len = (#_arrayLen returning u32)(other); - let min_len = if (#_uLt returning bool)(self_len, other_len) then { - self_len - } else { - other_len - }; - let result = (#_ref returning & «std-1.0.0-beta.14»::cmp::Ordering<>)((«std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()); - for i in (0: u32) .. min_len do { - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)((#_vectorIndex returning T)(self, (#_cast returning u32)(i)), (#_vectorIndex returning T)(other, (#_cast returning u32)(i))); - #_skip - } - }; - if (#_bNot returning bool)(((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)())) then { - (#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result) - } else { - ((u32 as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(u32, u32) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self_len, other_len) - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_112] «std-1.0.0-beta.14»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Ord<>, B: «std-1.0.0-beta.14»::cmp::Ord<>] := { - noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - let result = ((A as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.0, other.0); - if (#_bNot returning bool)(((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(result, («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)())) then { - result - } else { - ((B as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.1, other.1) - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_113] «std-1.0.0-beta.14»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Ord<>, B: «std-1.0.0-beta.14»::cmp::Ord<>, C: «std-1.0.0-beta.14»::cmp::Ord<>] := { - noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - let result = (#_ref returning & «std-1.0.0-beta.14»::cmp::Ordering<>)(((A as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.0, other.0)); - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((B as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.1, other.1); - #_skip - }; - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((C as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.2, other.2); - #_skip - }; - (#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_114] «std-1.0.0-beta.14»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Ord<>, B: «std-1.0.0-beta.14»::cmp::Ord<>, C: «std-1.0.0-beta.14»::cmp::Ord<>, D: «std-1.0.0-beta.14»::cmp::Ord<>] := { - noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - let result = (#_ref returning & «std-1.0.0-beta.14»::cmp::Ordering<>)(((A as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.0, other.0)); - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((B as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.1, other.1); - #_skip - }; - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((C as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.2, other.2); - #_skip - }; - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((D as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.3, other.3); - #_skip - }; - (#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_115] «std-1.0.0-beta.14»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.14»::cmp::Ord<>, B: «std-1.0.0-beta.14»::cmp::Ord<>, C: «std-1.0.0-beta.14»::cmp::Ord<>, D: «std-1.0.0-beta.14»::cmp::Ord<>, E: «std-1.0.0-beta.14»::cmp::Ord<>] := { - noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - let result = (#_ref returning & «std-1.0.0-beta.14»::cmp::Ordering<>)(((A as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.0, other.0)); - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((B as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.1, other.1); - #_skip - }; - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((C as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.2, other.2); - #_skip - }; - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((D as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.3, other.3); - #_skip - }; - if ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result), («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)()) then { - result = ((E as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.4, other.4); - #_skip - }; - (#_readRef returning «std-1.0.0-beta.14»::cmp::Ordering<>)(result) - }; -} - -noir_def «std-1.0.0-beta.14»::cmp::max(v1: T, v2: T) -> T := { - if { - let __0 = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(v1, v2); - let __1 = («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __1) - } then { - v1 - } else { - v2 - } -} - -noir_def «std-1.0.0-beta.14»::cmp::min(v1: T, v2: T) -> T := { - if { - let __0 = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(v1, v2); - let __1 = («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __1) - } then { - v2 - } else { - v1 - } -} - -noir_def «std-1.0.0-beta.14»::cmp::cmp_tests::sanity_check_min<>() -> Unit := { - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::min as λ(u64, u64) -> u64)((0: u64), (1: u64)), (0: u64))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::min as λ(u64, u64) -> u64)((0: u64), (0: u64)), (0: u64))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::min as λ(u64, u64) -> u64)((1: u64), (1: u64)), (1: u64))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::min as λ(u8, u8) -> u8)((255: u8), (0: u8)), (0: u8))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::cmp::cmp_tests::sanity_check_max<>() -> Unit := { - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::max as λ(u64, u64) -> u64)((0: u64), (1: u64)), (1: u64))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::max as λ(u64, u64) -> u64)((0: u64), (0: u64)), (0: u64))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::max as λ(u64, u64) -> u64)((1: u64), (1: u64)), (1: u64))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::cmp::max as λ(u8, u8) -> u8)((255: u8), (0: u8)), (255: u8))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::cmp::cmp_tests::correctly_handles_unequal_length_vectors<>() -> Unit := { - let vector_1 = (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))); - let vector_2 = (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field))); - (#_assert returning Unit)((#_bNot returning bool)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(vector_1, vector_2))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::cmp::cmp_tests::lexicographic_ordering_for_vectors<>() -> Unit := { - (#_assert returning Unit)(((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.14»::cmp::Ordering<>)((#_asVector returning Vector)((#_mkArray returning Array)((2: u32))), (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (1: u32), (1: u32)))), («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)())); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.14»::cmp::Ordering<>)((#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32))), (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))), («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)())); - #_skip -} - -def «std-1.0.0-beta.14».Cmp.env : Env := Env.mk - [«std-1.0.0-beta.14::cmp::Ordering::less», «std-1.0.0-beta.14::cmp::Ordering::equal», «std-1.0.0-beta.14::cmp::Ordering::greater», «std-1.0.0-beta.14::cmp::max», «std-1.0.0-beta.14::cmp::min», «std-1.0.0-beta.14::cmp::cmp_tests::sanity_check_min», «std-1.0.0-beta.14::cmp::cmp_tests::sanity_check_max», «std-1.0.0-beta.14::cmp::cmp_tests::correctly_handles_unequal_length_vectors», «std-1.0.0-beta.14::cmp::cmp_tests::lexicographic_ordering_for_vectors»] - [«std-1.0.0-beta.14».impl_78, «std-1.0.0-beta.14».impl_79, «std-1.0.0-beta.14».impl_80, «std-1.0.0-beta.14».impl_81, «std-1.0.0-beta.14».impl_82, «std-1.0.0-beta.14».impl_83, «std-1.0.0-beta.14».impl_84, «std-1.0.0-beta.14».impl_85, «std-1.0.0-beta.14».impl_86, «std-1.0.0-beta.14».impl_87, «std-1.0.0-beta.14».impl_88, «std-1.0.0-beta.14».impl_89, «std-1.0.0-beta.14».impl_90, «std-1.0.0-beta.14».impl_91, «std-1.0.0-beta.14».impl_92, «std-1.0.0-beta.14».impl_93, «std-1.0.0-beta.14».impl_94, «std-1.0.0-beta.14».impl_95, «std-1.0.0-beta.14».impl_96, «std-1.0.0-beta.14».impl_97, «std-1.0.0-beta.14».impl_98, «std-1.0.0-beta.14».impl_99, «std-1.0.0-beta.14».impl_100, «std-1.0.0-beta.14».impl_101, «std-1.0.0-beta.14».impl_102, «std-1.0.0-beta.14».impl_103, «std-1.0.0-beta.14».impl_104, «std-1.0.0-beta.14».impl_105, «std-1.0.0-beta.14».impl_106, «std-1.0.0-beta.14».impl_107, «std-1.0.0-beta.14».impl_108, «std-1.0.0-beta.14».impl_109, «std-1.0.0-beta.14».impl_110, «std-1.0.0-beta.14».impl_111, «std-1.0.0-beta.14».impl_112, «std-1.0.0-beta.14».impl_113, «std-1.0.0-beta.14».impl_114, «std-1.0.0-beta.14».impl_115] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/BoundedVec.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/BoundedVec.lean deleted file mode 100644 index ec12c38e..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/BoundedVec.lean +++ /dev/null @@ -1,884 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let zeroed = (#_zeroed returning T)(); - (#_makeData returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkRepeatedArray returning Array)(zeroed), (0: u32)) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, index: u32) -> T := { - (#_assert returning Unit)((#_uLt returning bool)(index, self.1)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, index) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, index: u32) -> T := { - (#_arrayIndex returning T)(self.0, (#_cast returning u32)(index)) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set(self: & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, index: u32, value: T) -> Unit := { - (#_assert returning Unit)((#_uLt returning bool)(index, (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, T) -> Unit)(self, index, value) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set_unchecked(self: & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, index: u32, value: T) -> Unit := { - (((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).0: Array)[index]: T) = value; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push(self: & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, elem: T) -> Unit := { - (#_assert returning Unit)((#_uLt returning bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, uConst!(MaxLen: u32))); - { - let i_4248 = (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1; - (((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).0: Array)[i_4248]: T) = elem; - #_skip - }; - ((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).1: u32) = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, (1: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32 := { - self.1 -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len(_self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32 := { - uConst!(MaxLen: u32) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array := { - self.0 -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_array(self: & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, array: Array) -> Unit := { - let new_len = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, (#_arrayLen returning u32)(array)); - (#_assert returning Unit)((#_uLeq returning bool)(new_len, uConst!(MaxLen: u32))); - for i in (0: u32) .. (#_arrayLen returning u32)(array) do { - let i_4256 = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, i); - (((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).0: Array)[i_4256]: T) = (#_arrayIndex returning T)(array, (#_cast returning u32)(i)); - #_skip - }; - ((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).1: u32) = new_len; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_vector(self: & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, vector: Vector) -> Unit := { - let new_len = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, (#_arrayLen returning u32)(vector)); - (#_assert returning Unit)((#_uLeq returning bool)(new_len, uConst!(MaxLen: u32))); - for i in (0: u32) .. (#_arrayLen returning u32)(vector) do { - let i_4260 = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, i); - (((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).0: Array)[i_4260]: T) = (#_vectorIndex returning T)(vector, (#_cast returning u32)(i)); - #_skip - }; - ((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).1: u32) = new_len; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec(self: & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, vec: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Unit := { - let append_len = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec); - let new_len = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, append_len); - (#_assert returning Unit)((#_uLeq returning bool)(new_len, uConst!(MaxLen: u32))); - if (#_isUnconstrained returning bool)() then { - for i in (0: u32) .. append_len do { - let i_4266 = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, i); - (((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).0: Array)[i_4266]: T) = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(vec, i); - #_skip - }; - #_skip - } else { - for i in (0: u32) .. uConst!(Len: u32) do { - if (#_uLt returning bool)(i, append_len) then { - let i_4268 = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, i); - (((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).0: Array)[i_4268]: T) = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(vec, i); - #_skip - } - }; - #_skip - }; - ((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).1: u32) = new_len; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array(array: Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(Len: u32), uConst!(MaxLen: u32)), "from array out of bounds"); - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, array); - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop(self: & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> T := { - (#_assert returning Unit)((#_uGt returning bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, (0: u32))); - ((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).1: u32) = (#_uSub returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1, (1: u32)); - let elem = (#_arrayIndex returning T)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).0, (#_cast returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1)); - { - let i_4274 = (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(self).1; - (((*self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec).0: Array)[i_4274]: T) = (#_zeroed returning T)(); - #_skip - }; - elem -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, predicate: λ(T) -> bool) -> bool := { - let ret = (#_ref returning & bool)(#_false); - if (#_isUnconstrained returning bool)() then { - for i in (0: u32) .. self.1 do { - ret = (#_bOr returning bool)((#_readRef returning bool)(ret), (predicate as λ(T) -> bool)((#_arrayIndex returning T)(self.0, (#_cast returning u32)(i)))); - #_skip - }; - #_skip - } else { - let exceeded_len = (#_ref returning & bool)(#_false); - for i in (0: u32) .. uConst!(MaxLen: u32) do { - exceeded_len = (#_bOr returning bool)((#_readRef returning bool)(exceeded_len), (#_uEq returning bool)(i, self.1)); - if (#_bNot returning bool)((#_readRef returning bool)(exceeded_len)) then { - ret = (#_bOr returning bool)((#_readRef returning bool)(ret), (predicate as λ(T) -> bool)((#_arrayIndex returning T)(self.0, (#_cast returning u32)(i)))); - #_skip - } - }; - #_skip - }; - (#_readRef returning bool)(ret) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::map(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, f: λ(T) -> U) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let ret = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - (ret.1: u32) = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self); - if (#_isUnconstrained returning bool)() then { - for i in (0: u32) .. («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self) do { - ((ret.0: Array)[i]: U) = (f as λ(T) -> U)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - }; - #_skip - } else { - for i in (0: u32) .. uConst!(MaxLen: u32) do { - if (#_uLt returning bool)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { - ((ret.0: Array)[i]: U) = (f as λ(T) -> U)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - } - }; - #_skip - }; - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(ret) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::mapi(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, f: λ(u32, T) -> U) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let ret = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - (ret.1: u32) = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self); - if (#_isUnconstrained returning bool)() then { - for i in (0: u32) .. («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self) do { - ((ret.0: Array)[i]: U) = (f as λ(u32, T) -> U)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - }; - #_skip - } else { - for i in (0: u32) .. uConst!(MaxLen: u32) do { - if (#_uLt returning bool)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { - ((ret.0: Array)[i]: U) = (f as λ(u32, T) -> U)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - } - }; - #_skip - }; - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(ret) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_each(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, f: λ(T) -> Unit) -> Unit := { - if (#_isUnconstrained returning bool)() then { - for i in (0: u32) .. («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self) do { - (f as λ(T) -> Unit)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - }; - #_skip - } else { - for i in (0: u32) .. uConst!(MaxLen: u32) do { - if (#_uLt returning bool)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { - (f as λ(T) -> Unit)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - } - }; - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_eachi(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, f: λ(u32, T) -> Unit) -> Unit := { - if (#_isUnconstrained returning bool)() then { - for i in (0: u32) .. («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self) do { - (f as λ(u32, T) -> Unit)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - }; - #_skip - } else { - for i in (0: u32) .. uConst!(MaxLen: u32) do { - if (#_uLt returning bool)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { - (f as λ(u32, T) -> Unit)(i, («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); - #_skip - } - }; - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts(array: Array, len: u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let array = (#_ref returning & Array)(array); - { - (#_assert returning Unit)((#_uLeq returning bool)(len, uConst!(MaxLen: u32))); - let zeroed = (#_zeroed returning T)(); - if (#_isUnconstrained returning bool)() then { - for i in len .. uConst!(MaxLen: u32) do { - (array[i]: T) = zeroed; - #_skip - }; - #_skip - } else { - for i in (0: u32) .. uConst!(MaxLen: u32) do { - if (#_uGeq returning bool)(i, len) then { - (array[i]: T) = zeroed; - #_skip - } - }; - #_skip - }; - (#_makeData returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_readRef returning Array)(array), len) -} -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts_unchecked(array: Array, len: u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - (#_assert returning Unit)((#_uLeq returning bool)(len, uConst!(MaxLen: u32))); - (#_makeData returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(array, len) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_32] «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec where [T: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, other: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool := { - if (#_uEq returning bool)(self.1, other.1) then { - ((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(self.0, other.0) - } else { - #_false - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_33] «std-1.0.0-beta.14»::convert::From > for «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec where [] := { - noir_def «from»<>(array: Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(array) - }; -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_elements_past_end_of_vec<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let __0 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Field)(vec, (0: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_beyond_length<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - let __0 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (3: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::get::get_works_within_bounds<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (2: u32)), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (4: u32)), (5: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (2: u32)), (3: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works_past_len<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (4: u32)), (0: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::set::set_updates_values_properly<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: Field), (0: Field), (0: Field), (0: Field), (0: Field)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (0: u32), (42: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (0: Field), (0: Field), (0: Field), (0: Field)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (1: u32), (43: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (43: Field), (0: Field), (0: Field), (0: Field)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (2: u32), (44: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (43: Field), (44: Field), (0: Field), (0: Field)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (1: u32), (10: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (10: Field), (44: Field), (0: Field), (0: Field)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (0: u32), (0: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((0: Field), (10: Field), (44: Field), (0: Field), (0: Field)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::set::panics_when_writing_elements_past_end_of_vec<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (0: u32), (42: Field)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::set::panics_when_setting_beyond_length<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (3: u32), (4: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (0: u32), (10: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (10: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations_past_len<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (3: u32), (40: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (3: u32)), (40: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::set::set_preserves_other_elements<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (2: u32), (30: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (1: u32)), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (2: u32)), (30: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (3: u32)), (4: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (4: u32)), (5: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::any::returns_false_if_predicate_not_satisfied<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)(#_false, #_false, #_false, #_false)); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(bool) -> bool) -> bool)(vec, (fn(value: bool): bool := value)); - (#_assert returning Unit)((#_bNot returning bool)(result)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::any::returns_true_if_predicate_satisfied<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)(#_false, #_false, #_true, #_true)); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(bool) -> bool) -> bool)(vec, (fn(value: bool): bool := value)); - (#_assert returning Unit)(result); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::any::returns_false_on_empty_boundedvec<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(bool) -> bool) -> bool)(vec, (fn(value: bool): bool := value)); - (#_assert returning Unit)((#_bNot returning bool)(result)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::any::any_with_complex_predicates<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uGt returning bool)(x, (3: u32))))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uGt returning bool)(x, (10: u32)))))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32))))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uEq returning bool)(x, (3: u32))))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::any::any_with_partial_vector<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); - (#_assert returning Unit)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): bool := (#_uEq returning bool)(x, (1: u32))))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): bool := (#_uEq returning bool)(x, (2: u32))))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): bool := (#_uEq returning bool)(x, (3: u32)))))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::map::applies_function_correctly<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): u32 := (#_uMul returning u32)(value, (2: u32)))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (4: u32), (6: u32), (8: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::map::applies_function_that_changes_return_type<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> Field) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): Field := (#_cast returning Field)((#_uMul returning u32)(value, (2: u32))))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field), (8: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::map::does_not_apply_function_past_len<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { - (5: u32) - } else { - value - })); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(result, (2: u32)), (0: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::map::map_with_conditional_logic<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(x: u32): u32 := if (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)) then { - (#_uMul returning u32)(x, (2: u32)) - } else { - x - })); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (4: u32), (3: u32), (8: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::map::map_preserves_length<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(x: u32): u32 := (#_uMul returning u32)(x, (2: u32)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(result), («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(result), («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::map::map_on_empty_vector<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(x: u32): u32 := (#_uMul returning u32)(x, (2: u32)))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, vec)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(result), (0: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(result), (5: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_correctly<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::mapi as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(i: u32, value: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32))))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32), (11: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_that_changes_return_type<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::mapi as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Field) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(i: u32, value: u32): Field := (#_cast returning Field)((#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32)))))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (5: Field), (8: Field), (11: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::mapi::does_not_apply_function_past_len<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::mapi as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(__0: u32, value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { - (5: u32) - } else { - value - })); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(result, (2: u32)), (0: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::mapi::mapi_with_index_branching_logic<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::mapi as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(i: u32, x: u32): u32 := if (#_uEq returning bool)((#_uRem returning u32)(i, (2: u32)), (0: u32)) then { - (#_uMul returning u32)(x, (2: u32)) - } else { - x - })); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (2: u32), (6: u32), (4: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, f: λ(T) -> U) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let output = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let output_ref = output; - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_each, λ(T) -> U> > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(T) -> Unit) -> Unit)(input, (fn(x: T): Unit := («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, U) -> Unit)(output_ref, (f as λ(T) -> U)(x)))); - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(output) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::smoke_test<>() -> Unit := { - let acc = (#_ref returning & u32)((0: u32)); - let acc_ref = acc; - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_each > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> Unit) -> Unit)(vec, (fn(value: u32): Unit := { - (*acc_ref: u32) = (#_uAdd returning u32)((#_readRef returning u32)(acc_ref), value); - #_skip - })); - (#_assert returning Unit)((#_uEq returning bool)((#_readRef returning u32)(acc), (6: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_correctly<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): u32 := (#_uMul returning u32)(value, (2: u32)))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (4: u32), (6: u32), (8: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_that_changes_return_type<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> Field) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): Field := (#_cast returning Field)((#_uMul returning u32)(value, (2: u32))))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field), (8: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::does_not_apply_function_past_len<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { - (5: u32) - } else { - value - })); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(result, (2: u32)), (0: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_on_empty_vector<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let count = (#_ref returning & Field)((0: Field)); - let count_ref = count; - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_each > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> Unit) -> Unit)(vec, (fn(__0: u32): Unit := { - (*count_ref: Field) = (#_fAdd returning Field)((#_readRef returning Field)(count_ref), (1: Field)); - #_skip - })); - (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(count), (0: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_with_side_effects<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - let seen = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let seen_ref = seen; - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_each > > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32) -> Unit) -> Unit)(vec, (fn(x: u32): Unit := («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(seen_ref, x))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(seen), vec)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, f: λ(u32, T) -> U) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let output = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let output_ref = output; - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_eachi, λ(u32, T) -> U> > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, T) -> Unit) -> Unit)(input, (fn(i: u32, x: T): Unit := («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, U) -> Unit)(output_ref, (f as λ(u32, T) -> U)(i, x)))); - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(output) -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::smoke_test<>() -> Unit := { - let acc = (#_ref returning & u32)((0: u32)); - let acc_ref = acc; - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_eachi > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Unit) -> Unit)(vec, (fn(i: u32, value: u32): Unit := { - (*acc_ref: u32) = (#_uAdd returning u32)((#_readRef returning u32)(acc_ref), (#_uMul returning u32)(i, value)); - #_skip - })); - (#_assert returning Unit)((#_uEq returning bool)((#_readRef returning u32)(acc), (8: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_correctly<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(i: u32, value: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32))))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32), (11: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_that_changes_return_type<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Field) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(i: u32, value: u32): Field := (#_cast returning Field)((#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32)))))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (5: Field), (8: Field), (11: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::does_not_apply_function_past_len<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); - let result = («std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec, (fn(__0: u32, value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { - (5: u32) - } else { - value - })); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(result, (2: u32)), (0: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_on_empty_vector<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let count = (#_ref returning & Field)((0: Field)); - let count_ref = count; - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_eachi > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Unit) -> Unit)(vec, (fn(__0: u32, __1: u32): Unit := { - (*count_ref: Field) = (#_fAdd returning Field)((#_readRef returning Field)(count_ref), (1: Field)); - #_skip - })); - (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(count), (0: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_with_index_tracking<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((10: u32), (20: u32), (30: u32))); - let indices = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let indices_ref = indices; - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::for_eachi > > as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Unit) -> Unit)(vec, (fn(i: u32, __0: u32): Unit := («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(indices_ref, i))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32), (2: u32))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(indices), expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_array::empty<>() -> Unit := { - let empty_array = (#_mkArray returning Array)(); - let bounded_vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)()); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (0: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (0: u32))); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)(bounded_vec), empty_array)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_array::equal_len<>() -> Unit := { - let array = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); - let bounded_vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(array); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (3: u32))); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)(bounded_vec), array)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_array::max_len_greater_then_array_len<>() -> Unit := { - let array = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); - let bounded_vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(array); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (10: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (3: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Field)(bounded_vec, (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Field)(bounded_vec, (1: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Field)(bounded_vec, (2: u32)), (3: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_array::max_len_lower_then_array_len<>() -> Unit := { - let __0 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkRepeatedArray returning Array)((0: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_array::from_array_preserves_order<>() -> Unit := { - let array = (#_mkArray returning Array)((5: u32), (3: u32), (1: u32), (4: u32), (2: u32)); - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(array); - for i in (0: u32) .. (#_arrayLen returning u32)(array) do { - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, i), (#_arrayIndex returning u32)(array, (#_cast returning u32)(i)))); - #_skip - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_array::from_array_with_different_types<>() -> Unit := { - let bool_array = (#_mkArray returning Array)(#_true, #_false, #_true); - let bool_vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(bool_array); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bool_vec), (3: u32))); - (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> bool)(bool_vec, (0: u32)), #_true)); - (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> bool)(bool_vec, (1: u32)), #_false)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::trait_from::simple<>() -> Unit := { - let array = (#_mkArray returning Array)((1: Field), (2: Field)); - let bounded_vec = ((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::convert::From >)::«from»<> as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(array); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (10: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(bounded_vec), (2: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Field)(bounded_vec, (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Field)(bounded_vec, (1: u32)), (2: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::trait_eq::empty_equality<>() -> Unit := { - let bounded_vec1 = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let bounded_vec2 = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(bounded_vec1), (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(bounded_vec2))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::trait_eq::inequality<>() -> Unit := { - let bounded_vec1 = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let bounded_vec2 = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Field) -> Unit)(bounded_vec1, (1: Field)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Field) -> Unit)(bounded_vec2, (2: Field)); - (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(bounded_vec1), (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(bounded_vec2)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_parts::from_parts<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (0: u32)), (3: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); - let vec1 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (1: u32)), (3: u32)); - let vec2 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (2: u32)), (3: u32)); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(vec1, vec2)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::from_parts::from_parts_unchecked<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts_unchecked as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (0: u32)), (3: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); - let vec1 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts_unchecked as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (1: u32)), (3: u32)); - let vec2 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts_unchecked as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (2: u32)), (3: u32)); - (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(vec1, vec2))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::push_pop::push_and_pop_operations<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (0: u32))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (1: u32))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (1: u32)), (2: u32))); - let popped = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec); - (#_assert returning Unit)((#_uEq returning bool)(popped, (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (1: u32))); - let popped2 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec); - (#_assert returning Unit)((#_uEq returning bool)(popped2, (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (0: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::push_pop::push_to_full_vector<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (3: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::push_pop::pop_from_empty_vector<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let __0 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::push_pop::push_pop_cycle<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (3: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (0: u32))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (4: u32)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (4: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_array<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, (#_mkArray returning Array)((2: u32), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (1: u32)), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (2: u32)), (3: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_vector<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_vector as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Vector) -> Unit)(vec, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (3: u32)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (1: u32)), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec), (2: u32)), (3: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec<>() -> Unit := { - let vec1 = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let vec2 = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec2, (2: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec2, (3: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec2)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec1)), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec1), (0: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec1), (1: u32)), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec1), (2: u32)), (3: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::extend::extend_array_beyond_max_len<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, (#_mkArray returning Array)((2: u32), (3: u32), (4: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::extend::extend_vector_beyond_max_len<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_vector as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Vector) -> Unit)(vec, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (3: u32), (4: u32)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::extend::extend_bounded_vec_beyond_max_len<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let other = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Unit)(vec, other); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::extend::extend_with_empty_collections<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - let original_len = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, (#_mkArray returning Array)()); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), original_len)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_vector as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, Vector) -> Unit)(vec, (#_asVector returning Vector)((#_mkArray returning Array)())); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), original_len)); - let empty = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Unit)(vec, empty); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), original_len)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::storage::storage_consistency<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (#_mkArray returning Array)((0: u32), (0: u32), (0: u32), (0: u32), (0: u32)))); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (#_mkArray returning Array)((1: u32), (2: u32), (0: u32), (0: u32), (0: u32)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::max_len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (5: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::storage::storage_after_pop<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); - let __0 = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (#_mkArray returning Array)((1: u32), (2: u32), (0: u32)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(vec)), (2: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::bounded_vec::bounded_vec_tests::storage::vector_immutable<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - let storage = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)(vec); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(storage, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (1: u32)), (2: u32))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (2: u32)), (3: u32))); - #_skip -} - -def «std-1.0.0-beta.14».Collections.BoundedVec.env : Env := Env.mk - [«std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::new», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::get_unchecked», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::set», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::set_unchecked», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::push», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::len», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::max_len», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::storage», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::extend_from_array», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::extend_from_vector», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::extend_from_bounded_vec», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::from_array», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::pop», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::any», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::map», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::mapi», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::for_each», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::for_eachi», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::from_parts», «std-1.0.0-beta.14::collections::bounded_vec::BoundedVec::from_parts_unchecked», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_elements_past_end_of_vec», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_beyond_length», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::get::get_works_within_bounds», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works_past_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::set::set_updates_values_properly», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::set::panics_when_writing_elements_past_end_of_vec», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::set::panics_when_setting_beyond_length», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations_past_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::set::set_preserves_other_elements», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::any::returns_false_if_predicate_not_satisfied», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::any::returns_true_if_predicate_satisfied», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::any::returns_false_on_empty_boundedvec», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::any::any_with_complex_predicates», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::any::any_with_partial_vector», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::map::applies_function_correctly», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::map::applies_function_that_changes_return_type», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::map::does_not_apply_function_past_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::map::map_with_conditional_logic», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::map::map_preserves_length», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::map::map_on_empty_vector», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_correctly», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_that_changes_return_type», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::mapi::does_not_apply_function_past_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::mapi::mapi_with_index_branching_logic», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_each::smoke_test», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_correctly», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_that_changes_return_type», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_each::does_not_apply_function_past_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_each::for_each_on_empty_vector», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_each::for_each_with_side_effects», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_eachi::smoke_test», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_correctly», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_that_changes_return_type», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_eachi::does_not_apply_function_past_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_on_empty_vector», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_with_index_tracking», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_array::empty», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_array::equal_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_array::max_len_greater_then_array_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_array::max_len_lower_then_array_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_array::from_array_preserves_order», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_array::from_array_with_different_types», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::trait_from::simple», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::trait_eq::empty_equality», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::trait_eq::inequality», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_parts::from_parts», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::from_parts::from_parts_unchecked», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::push_pop::push_and_pop_operations», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::push_pop::push_to_full_vector», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::push_pop::pop_from_empty_vector», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::push_pop::push_pop_cycle», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::extend::extend_from_array», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::extend::extend_from_vector», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::extend::extend_array_beyond_max_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::extend::extend_vector_beyond_max_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::extend::extend_bounded_vec_beyond_max_len», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::extend::extend_with_empty_collections», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::storage::storage_consistency», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::storage::storage_after_pop», «std-1.0.0-beta.14::collections::bounded_vec::bounded_vec_tests::storage::vector_immutable»] - [«std-1.0.0-beta.14».impl_32, «std-1.0.0-beta.14».impl_33] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Map.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Map.lean deleted file mode 100644 index 8f3e7287..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Map.lean +++ /dev/null @@ -1,336 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_global_def «std-1.0.0-beta.14»::collections::map::MAX_LOAD_FACTOR_NUMERATOR: u32 = (3: u32); - -noir_global_def «std-1.0.0-beta.14»::collections::map::MAX_LOAD_FACTOR_DENOMINATOR: u32 = (4: u32); - -noir_trait_impl[«std-1.0.0-beta.14».impl_34] «std-1.0.0-beta.14»::default::Default<> for «std-1.0.0-beta.14»::collections::map::Slot where [] := { - noir_def default<>() -> «std-1.0.0-beta.14»::collections::map::Slot := { - (#_makeData returning «std-1.0.0-beta.14»::collections::map::Slot)((#_zeroed returning K)(), (#_zeroed returning V)(), #_false, #_false) - }; -} - -noir_def «std-1.0.0-beta.14»::collections::map::Slot::is_valid(self: «std-1.0.0-beta.14»::collections::map::Slot) -> bool := { - (#_bAnd returning bool)((#_bNot returning bool)(self.3), self.2) -} - -noir_def «std-1.0.0-beta.14»::collections::map::Slot::is_available(self: «std-1.0.0-beta.14»::collections::map::Slot) -> bool := { - (#_bOr returning bool)(self.3, (#_bNot returning bool)(self.2)) -} - -noir_def «std-1.0.0-beta.14»::collections::map::Slot::set(self: & «std-1.0.0-beta.14»::collections::map::Slot, key: K, value: V) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::map::Slot).0: K) = key; - ((*self: «std-1.0.0-beta.14»::collections::map::Slot).1: V) = value; - ((*self: «std-1.0.0-beta.14»::collections::map::Slot).2: bool) = #_true; - ((*self: «std-1.0.0-beta.14»::collections::map::Slot).3: bool) = #_false; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::Slot::mark_deleted(self: & «std-1.0.0-beta.14»::collections::map::Slot) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::map::Slot).3: bool) = #_true; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::with_hasher(_build_hasher: B) -> «std-1.0.0-beta.14»::collections::map::HashMap := { - let _table = (#_mkRepeatedArray returning Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>)(((«std-1.0.0-beta.14»::collections::map::Slot as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.14»::collections::map::Slot)()); - let _len = (0: u32); - (#_makeData returning «std-1.0.0-beta.14»::collections::map::HashMap)(_table, _len, _build_hasher) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::clear(self: & «std-1.0.0-beta.14»::collections::map::HashMap) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).0: Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>) = (#_mkRepeatedArray returning Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>)(((«std-1.0.0-beta.14»::collections::map::Slot as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.14»::collections::map::Slot)()); - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).1: u32) = (0: u32); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::contains_key(self: «std-1.0.0-beta.14»::collections::map::HashMap, key: K) -> bool := { - («std-1.0.0-beta.14»::option::Option::is_some as λ(«std-1.0.0-beta.14»::option::Option) -> bool)((«std-1.0.0-beta.14»::collections::map::HashMap::get as λ(«std-1.0.0-beta.14»::collections::map::HashMap, K) -> «std-1.0.0-beta.14»::option::Option)(self, key)) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::is_empty(self: «std-1.0.0-beta.14»::collections::map::HashMap) -> bool := { - (#_uEq returning bool)(self.1, (0: u32)) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::entries(self: «std-1.0.0-beta.14»::collections::map::HashMap) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32> := { - let entries = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new, N: u32> as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)()); - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)(slot) then { - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push, N: u32> as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>, Tuple) -> Unit)(entries, (#_makeData returning Tuple)(slot.0, slot.1)); - #_skip - } - } - }; - #_skip - }; - let self_len = self.1; - let entries_len = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len, N: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)(entries)); - let msg = (#_mkFormatString returning FmtString<82: u32, Tuple >)("Amount of valid elements should have been {}{self_len}{} times, but got {}{entries_len}{}.", self_len, entries_len); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len, N: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)(entries)), self.1)); - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)(entries) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::keys(self: «std-1.0.0-beta.14»::collections::map::HashMap) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let keys = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)(slot) then { - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, K) -> Unit)(keys, slot.0); - #_skip - } - } - }; - #_skip - }; - let self_len = self.1; - let keys_len = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(keys)); - let msg = (#_mkFormatString returning FmtString<79: u32, Tuple >)("Amount of valid elements should have been {}{self_len}{} times, but got {}{keys_len}{}.", self_len, keys_len); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(keys)), self.1)); - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(keys) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::values(self: «std-1.0.0-beta.14»::collections::map::HashMap) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let values = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)()); - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)(slot) then { - («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, V) -> Unit)(values, slot.1); - #_skip - } - } - }; - #_skip - }; - let self_len = self.1; - let values_len = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(values)); - let msg = (#_mkFormatString returning FmtString<81: u32, Tuple >)("Amount of valid elements should have been {}{self_len}{} times, but got {}{values_len}{}.", self_len, values_len); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(values)), self.1)); - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(values) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::iter_mut(self: & «std-1.0.0-beta.14»::collections::map::HashMap, f: λ(K, V) -> Tuple) -> Unit := { - let entries = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)((«std-1.0.0-beta.14»::collections::map::HashMap::entries as λ(«std-1.0.0-beta.14»::collections::map::HashMap) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self))); - let new_map = (#_ref returning & «std-1.0.0-beta.14»::collections::map::HashMap)((«std-1.0.0-beta.14»::collections::map::HashMap::with_hasher as λ(B) -> «std-1.0.0-beta.14»::collections::map::HashMap)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).2)); - for i in (0: u32) .. uConst!(N: u32) do { - if (#_uLt returning bool)(i, (#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).1) then { - let entry = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked, N: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>, u32) -> Tuple)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)(entries), i); - let (key, value) = (f as λ(K, V) -> Tuple)(entry.0, entry.1); - («std-1.0.0-beta.14»::collections::map::HashMap::insert as λ(& «std-1.0.0-beta.14»::collections::map::HashMap, K, V) -> Unit)(new_map, key, value); - #_skip - } - }; - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).0: Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(new_map).0; - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).1: u32) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(new_map).1; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::iter_keys_mut(self: & «std-1.0.0-beta.14»::collections::map::HashMap, f: λ(K) -> K) -> Unit := { - let entries = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)((«std-1.0.0-beta.14»::collections::map::HashMap::entries as λ(«std-1.0.0-beta.14»::collections::map::HashMap) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self))); - let new_map = (#_ref returning & «std-1.0.0-beta.14»::collections::map::HashMap)((«std-1.0.0-beta.14»::collections::map::HashMap::with_hasher as λ(B) -> «std-1.0.0-beta.14»::collections::map::HashMap)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).2)); - for i in (0: u32) .. uConst!(N: u32) do { - if (#_uLt returning bool)(i, (#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).1) then { - let entry = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::get_unchecked, N: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>, u32) -> Tuple)((#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, N: u32>)(entries), i); - let (key, value) = (#_makeData returning Tuple)((f as λ(K) -> K)(entry.0), entry.1); - («std-1.0.0-beta.14»::collections::map::HashMap::insert as λ(& «std-1.0.0-beta.14»::collections::map::HashMap, K, V) -> Unit)(new_map, key, value); - #_skip - } - }; - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).0: Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(new_map).0; - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).1: u32) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(new_map).1; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::iter_values_mut(self: & «std-1.0.0-beta.14»::collections::map::HashMap, f: λ(V) -> V) -> Unit := { - for i in (0: u32) .. uConst!(N: u32) do { - let slot = (#_ref returning & «std-1.0.0-beta.14»::collections::map::Slot)((#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).0, (#_cast returning u32)(i))); - if («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot)) then { - (slot.1: V) = (f as λ(V) -> V)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot).1); - (((*self: «std-1.0.0-beta.14»::collections::map::HashMap).0: Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>)[i]: «std-1.0.0-beta.14»::collections::map::Slot) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot); - #_skip - } - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::retain(self: & «std-1.0.0-beta.14»::collections::map::HashMap, f: λ(K, V) -> bool) -> Unit := { - for index in (0: u32) .. uConst!(N: u32) do { - let slot = (#_ref returning & «std-1.0.0-beta.14»::collections::map::Slot)((#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).0, (#_cast returning u32)(index))); - if («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot)) then { - if (#_bNot returning bool)((f as λ(K, V) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot).0, (#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot).1)) then { - («std-1.0.0-beta.14»::collections::map::Slot::mark_deleted as λ(& «std-1.0.0-beta.14»::collections::map::Slot) -> Unit)(slot); - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).1: u32) = (#_uSub returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).1, (1: u32)); - (((*self: «std-1.0.0-beta.14»::collections::map::HashMap).0: Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>)[index]: «std-1.0.0-beta.14»::collections::map::Slot) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot); - #_skip - } - } - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::len(self: «std-1.0.0-beta.14»::collections::map::HashMap) -> u32 := { - self.1 -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::capacity(_self: «std-1.0.0-beta.14»::collections::map::HashMap) -> u32 := { - uConst!(N: u32) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::get(self: «std-1.0.0-beta.14»::collections::map::HashMap, key: K) -> «std-1.0.0-beta.14»::option::Option := { - let result = (#_ref returning & «std-1.0.0-beta.14»::option::Option)((«std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)()); - let hash = («std-1.0.0-beta.14»::collections::map::HashMap::hash as λ(«std-1.0.0-beta.14»::collections::map::HashMap, K) -> u32)(self, key); - let should_break = (#_ref returning & bool)(#_false); - for attempt in (0: u32) .. uConst!(N: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(should_break)) then { - let index = («std-1.0.0-beta.14»::collections::map::HashMap::quadratic_probe as λ(«std-1.0.0-beta.14»::collections::map::HashMap, u32, u32) -> u32)(self, hash, (#_cast returning u32)(attempt)); - let slot = (#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)(self.0, (#_cast returning u32)(index)); - if («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)(slot) then { - if ((K as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(K, K) -> bool)(slot.0, key) then { - result = («std-1.0.0-beta.14»::option::Option::some as λ(V) -> «std-1.0.0-beta.14»::option::Option)(slot.1); - should_break = #_true; - #_skip - } - } - } - }; - (#_readRef returning «std-1.0.0-beta.14»::option::Option)(result) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::insert(self: & «std-1.0.0-beta.14»::collections::map::HashMap, key: K, value: V) -> Unit := { - («std-1.0.0-beta.14»::collections::map::HashMap::assert_load_factor as λ(«std-1.0.0-beta.14»::collections::map::HashMap) -> Unit)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self)); - let hash = («std-1.0.0-beta.14»::collections::map::HashMap::hash as λ(«std-1.0.0-beta.14»::collections::map::HashMap, K) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self), key); - let should_break = (#_ref returning & bool)(#_false); - for attempt in (0: u32) .. uConst!(N: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(should_break)) then { - let index = («std-1.0.0-beta.14»::collections::map::HashMap::quadratic_probe as λ(«std-1.0.0-beta.14»::collections::map::HashMap, u32, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self), hash, (#_cast returning u32)(attempt)); - let slot = (#_ref returning & «std-1.0.0-beta.14»::collections::map::Slot)((#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).0, (#_cast returning u32)(index))); - let insert = (#_ref returning & bool)(#_false); - if («std-1.0.0-beta.14»::collections::map::Slot::is_available as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot)) then { - insert = #_true; - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).1: u32) = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).1, (1: u32)); - #_skip - } else { - if ((K as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(K, K) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot).0, key) then { - insert = #_true; - #_skip - } - }; - if (#_readRef returning bool)(insert) then { - («std-1.0.0-beta.14»::collections::map::Slot::set as λ(& «std-1.0.0-beta.14»::collections::map::Slot, K, V) -> Unit)(slot, key, value); - (((*self: «std-1.0.0-beta.14»::collections::map::HashMap).0: Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>)[index]: «std-1.0.0-beta.14»::collections::map::Slot) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot); - should_break = #_true; - #_skip - } - } - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::remove(self: & «std-1.0.0-beta.14»::collections::map::HashMap, key: K) -> Unit := { - let hash = («std-1.0.0-beta.14»::collections::map::HashMap::hash as λ(«std-1.0.0-beta.14»::collections::map::HashMap, K) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self), key); - let should_break = (#_ref returning & bool)(#_false); - for attempt in (0: u32) .. uConst!(N: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(should_break)) then { - let index = («std-1.0.0-beta.14»::collections::map::HashMap::quadratic_probe as λ(«std-1.0.0-beta.14»::collections::map::HashMap, u32, u32) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self), hash, (#_cast returning u32)(attempt)); - let slot = (#_ref returning & «std-1.0.0-beta.14»::collections::map::Slot)((#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).0, (#_cast returning u32)(index))); - if («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot)) then { - if ((K as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(K, K) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot).0, key) then { - («std-1.0.0-beta.14»::collections::map::Slot::mark_deleted as λ(& «std-1.0.0-beta.14»::collections::map::Slot) -> Unit)(slot); - (((*self: «std-1.0.0-beta.14»::collections::map::HashMap).0: Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>)[index]: «std-1.0.0-beta.14»::collections::map::Slot) = (#_readRef returning «std-1.0.0-beta.14»::collections::map::Slot)(slot); - ((*self: «std-1.0.0-beta.14»::collections::map::HashMap).1: u32) = (#_uSub returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::map::HashMap)(self).1, (1: u32)); - should_break = #_true; - #_skip - } - } - } - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::hash(self: «std-1.0.0-beta.14»::collections::map::HashMap, key: K) -> u32 := { - let hasher = (#_ref returning & B_as_BuildHasher_H)(((B as «std-1.0.0-beta.14»::hash::BuildHasher<>)::build_hasher<> as λ(B) -> B_as_BuildHasher_H)(self.2)); - ((K as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(K, & B_as_BuildHasher_H) -> Unit)(key, hasher); - (#_cast returning u32)(((B_as_BuildHasher_H as «std-1.0.0-beta.14»::hash::Hasher<>)::finish<> as λ(B_as_BuildHasher_H) -> Field)((#_readRef returning B_as_BuildHasher_H)(hasher))) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::quadratic_probe(_self: «std-1.0.0-beta.14»::collections::map::HashMap, hash: u32, attempt: u32) -> u32 := { - let attempt_u64 = (#_cast returning u64)(attempt); - let offset = (#_uDiv returning u64)((#_uAdd returning u64)(attempt_u64, (#_uMul returning u64)(attempt_u64, attempt_u64)), (2: u64)); - (#_cast returning u32)((#_uRem returning u64)((#_uAdd returning u64)((#_cast returning u64)(hash), offset), (#_cast returning u64)(uConst!(N: u32)))) -} - -noir_def «std-1.0.0-beta.14»::collections::map::HashMap::assert_load_factor(self: «std-1.0.0-beta.14»::collections::map::HashMap) -> Unit := { - let lhs = (#_uMul returning u32)(self.1, («std-1.0.0-beta.14»::collections::map::MAX_LOAD_FACTOR_DENOMINATOR<> as λ() -> u32)()); - let rhs = (#_uMul returning u32)((#_arrayLen returning u32)(self.0), («std-1.0.0-beta.14»::collections::map::MAX_LOAD_FACTOR_NUMERATOR<> as λ() -> u32)()); - let exceeded = (#_uGeq returning bool)(lhs, rhs); - (#_assert returning Unit)((#_bNot returning bool)(exceeded)); - #_skip -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_35] «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::collections::map::HashMap where [K: «std-1.0.0-beta.14»::cmp::Eq<>, K: «std-1.0.0-beta.14»::hash::Hash<>, V: «std-1.0.0-beta.14»::cmp::Eq<>, B: «std-1.0.0-beta.14»::hash::BuildHasher] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::collections::map::HashMap, other: «std-1.0.0-beta.14»::collections::map::HashMap) -> bool := { - let equal = (#_ref returning & bool)(#_false); - if (#_uEq returning bool)((«std-1.0.0-beta.14»::collections::map::HashMap::len as λ(«std-1.0.0-beta.14»::collections::map::HashMap) -> u32)(self), («std-1.0.0-beta.14»::collections::map::HashMap::len as λ(«std-1.0.0-beta.14»::collections::map::HashMap) -> u32)(other)) then { - equal = #_true; - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_arrayIndex returning «std-1.0.0-beta.14»::collections::map::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if (#_bAnd returning bool)((#_readRef returning bool)(equal), («std-1.0.0-beta.14»::collections::map::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::map::Slot) -> bool)(slot)) then { - let other_value = («std-1.0.0-beta.14»::collections::map::HashMap::get as λ(«std-1.0.0-beta.14»::collections::map::HashMap, K) -> «std-1.0.0-beta.14»::option::Option)(other, slot.0); - if («std-1.0.0-beta.14»::option::Option::is_none as λ(«std-1.0.0-beta.14»::option::Option) -> bool)(other_value) then { - equal = #_false; - #_skip - } else { - let other_value = («std-1.0.0-beta.14»::option::Option::unwrap_unchecked as λ(«std-1.0.0-beta.14»::option::Option) -> V)(other_value); - if (#_bNot returning bool)(((V as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(V, V) -> bool)(slot.1, other_value)) then { - equal = #_false; - #_skip - } - } - } - } - }; - #_skip - } - }; - (#_readRef returning bool)(equal) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_36] «std-1.0.0-beta.14»::default::Default<> for «std-1.0.0-beta.14»::collections::map::HashMap where [B: «std-1.0.0-beta.14»::hash::BuildHasher, B: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> «std-1.0.0-beta.14»::collections::map::HashMap := { - let _build_hasher = ((B as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> B)(); - let map = («std-1.0.0-beta.14»::collections::map::HashMap::with_hasher as λ(B) -> «std-1.0.0-beta.14»::collections::map::HashMap)(_build_hasher); - map - }; -} - -noir_def «std-1.0.0-beta.14»::collections::map::test::test_quadratic_probe_function<>() -> Unit := { - let map = ((«std-1.0.0-beta.14»::collections::map::HashMap > > as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.14»::collections::map::HashMap > >)(); - let hash1 = (123: u32); - let attempt1 = (1000000: u32); - let result = («std-1.0.0-beta.14»::collections::map::HashMap::quadratic_probe > > as λ(«std-1.0.0-beta.14»::collections::map::HashMap > >, u32, u32) -> u32)(map, hash1, attempt1); - (#_assert returning Unit)((#_uEq returning bool)(result, (123: u32))); - #_skip -} - -def «std-1.0.0-beta.14».Collections.Map.env : Env := Env.mk - [«std-1.0.0-beta.14::collections::map::MAX_LOAD_FACTOR_NUMERATOR», «std-1.0.0-beta.14::collections::map::MAX_LOAD_FACTOR_DENOMINATOR», «std-1.0.0-beta.14::collections::map::Slot::is_valid», «std-1.0.0-beta.14::collections::map::Slot::is_available», «std-1.0.0-beta.14::collections::map::Slot::set», «std-1.0.0-beta.14::collections::map::Slot::mark_deleted», «std-1.0.0-beta.14::collections::map::HashMap::with_hasher», «std-1.0.0-beta.14::collections::map::HashMap::clear», «std-1.0.0-beta.14::collections::map::HashMap::contains_key», «std-1.0.0-beta.14::collections::map::HashMap::is_empty», «std-1.0.0-beta.14::collections::map::HashMap::entries», «std-1.0.0-beta.14::collections::map::HashMap::keys», «std-1.0.0-beta.14::collections::map::HashMap::values», «std-1.0.0-beta.14::collections::map::HashMap::iter_mut», «std-1.0.0-beta.14::collections::map::HashMap::iter_keys_mut», «std-1.0.0-beta.14::collections::map::HashMap::iter_values_mut», «std-1.0.0-beta.14::collections::map::HashMap::retain», «std-1.0.0-beta.14::collections::map::HashMap::len», «std-1.0.0-beta.14::collections::map::HashMap::capacity», «std-1.0.0-beta.14::collections::map::HashMap::get», «std-1.0.0-beta.14::collections::map::HashMap::insert», «std-1.0.0-beta.14::collections::map::HashMap::remove», «std-1.0.0-beta.14::collections::map::HashMap::hash», «std-1.0.0-beta.14::collections::map::HashMap::quadratic_probe», «std-1.0.0-beta.14::collections::map::HashMap::assert_load_factor», «std-1.0.0-beta.14::collections::map::test::test_quadratic_probe_function»] - [«std-1.0.0-beta.14».impl_34, «std-1.0.0-beta.14».impl_35, «std-1.0.0-beta.14».impl_36] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Mod.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Mod.lean deleted file mode 100644 index dc493b21..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Mod.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Collections.Mod.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Umap.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Umap.lean deleted file mode 100644 index 299b9fef..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Umap.lean +++ /dev/null @@ -1,246 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_37] «std-1.0.0-beta.14»::default::Default<> for «std-1.0.0-beta.14»::collections::umap::Slot where [] := { - noir_def default<>() -> «std-1.0.0-beta.14»::collections::umap::Slot := { - (#_makeData returning «std-1.0.0-beta.14»::collections::umap::Slot)((#_zeroed returning K)(), (#_zeroed returning V)(), #_false, #_false) - }; -} - -noir_def «std-1.0.0-beta.14»::collections::umap::Slot::is_valid(self: «std-1.0.0-beta.14»::collections::umap::Slot) -> bool := { - (#_bAnd returning bool)((#_bNot returning bool)(self.3), self.2) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::Slot::is_available(self: «std-1.0.0-beta.14»::collections::umap::Slot) -> bool := { - (#_bOr returning bool)(self.3, (#_bNot returning bool)(self.2)) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::Slot::set(self: & «std-1.0.0-beta.14»::collections::umap::Slot, key: K, value: V) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::umap::Slot).0: K) = key; - ((*self: «std-1.0.0-beta.14»::collections::umap::Slot).1: V) = value; - ((*self: «std-1.0.0-beta.14»::collections::umap::Slot).2: bool) = #_true; - ((*self: «std-1.0.0-beta.14»::collections::umap::Slot).3: bool) = #_false; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::umap::Slot::mark_deleted(self: & «std-1.0.0-beta.14»::collections::umap::Slot) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::umap::Slot).3: bool) = #_true; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::with_hasher(_build_hasher: B) -> «std-1.0.0-beta.14»::collections::umap::UHashMap := { - let _table = (#_asVector returning Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)((#_mkArray returning Array<«std-1.0.0-beta.14»::collections::umap::Slot, 1: u32>)(((«std-1.0.0-beta.14»::collections::umap::Slot as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.14»::collections::umap::Slot)())); - let _len = (0: u32); - (#_makeData returning «std-1.0.0-beta.14»::collections::umap::UHashMap)(_table, _len, _build_hasher) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::with_hasher_and_capacity(_build_hasher: B, capacity: u32) -> «std-1.0.0-beta.14»::collections::umap::UHashMap := { - let _table = (#_ref returning & Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)((#_asVector returning Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)((#_mkArray returning Array<«std-1.0.0-beta.14»::collections::umap::Slot, 0: u32>)())); - for _ in (0: u32) .. capacity do { - _table = (#_vectorPushBack returning Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)((#_readRef returning Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)(_table), ((«std-1.0.0-beta.14»::collections::umap::Slot as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.14»::collections::umap::Slot)()); - #_skip - }; - let _len = (0: u32); - (#_makeData returning «std-1.0.0-beta.14»::collections::umap::UHashMap)((#_readRef returning Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)(_table), _len, _build_hasher) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::clear(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::umap::UHashMap).0: Vector<«std-1.0.0-beta.14»::collections::umap::Slot >) = (#_asVector returning Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)((#_mkArray returning Array<«std-1.0.0-beta.14»::collections::umap::Slot, 1: u32>)(((«std-1.0.0-beta.14»::collections::umap::Slot as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.14»::collections::umap::Slot)())); - ((*self: «std-1.0.0-beta.14»::collections::umap::UHashMap).1: u32) = (0: u32); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::contains_key(self: «std-1.0.0-beta.14»::collections::umap::UHashMap, key: K) -> bool := { - («std-1.0.0-beta.14»::option::Option::is_some as λ(«std-1.0.0-beta.14»::option::Option) -> bool)({ - («std-1.0.0-beta.14»::collections::umap::UHashMap::get as λ(«std-1.0.0-beta.14»::collections::umap::UHashMap, K) -> «std-1.0.0-beta.14»::option::Option)(self, key) - }) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::is_empty(self: «std-1.0.0-beta.14»::collections::umap::UHashMap) -> bool := { - (#_uEq returning bool)(self.1, (0: u32)) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::entries(self: «std-1.0.0-beta.14»::collections::umap::UHashMap) -> Vector > := { - let entries = (#_ref returning & Vector >)((#_asVector returning Vector >)((#_mkArray returning Array, 0: u32>)())); - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_vectorIndex returning «std-1.0.0-beta.14»::collections::umap::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if («std-1.0.0-beta.14»::collections::umap::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::umap::Slot) -> bool)(slot) then { - entries = (#_vectorPushBack returning Vector >)((#_readRef returning Vector >)(entries), (#_makeData returning Tuple)(slot.0, slot.1)); - #_skip - } - } - }; - #_skip - }; - let self_len = self.1; - let entries_len = (#_arrayLen returning u32)((#_readRef returning Vector >)(entries)); - let msg = (#_mkFormatString returning FmtString<82: u32, Tuple >)("Amount of valid elements should have been {}{self_len}{} times, but got {}{entries_len}{}.", self_len, entries_len); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_readRef returning Vector >)(entries)), self.1)); - (#_readRef returning Vector >)(entries) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::keys(self: «std-1.0.0-beta.14»::collections::umap::UHashMap) -> Vector := { - let keys = (#_ref returning & Vector)((#_asVector returning Vector)((#_mkArray returning Array)())); - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_vectorIndex returning «std-1.0.0-beta.14»::collections::umap::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if («std-1.0.0-beta.14»::collections::umap::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::umap::Slot) -> bool)(slot) then { - keys = (#_vectorPushBack returning Vector)((#_readRef returning Vector)(keys), slot.0); - #_skip - } - } - }; - #_skip - }; - let self_len = self.1; - let keys_len = (#_arrayLen returning u32)((#_readRef returning Vector)(keys)); - let msg = (#_mkFormatString returning FmtString<79: u32, Tuple >)("Amount of valid elements should have been {}{self_len}{} times, but got {}{keys_len}{}.", self_len, keys_len); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_readRef returning Vector)(keys)), self.1)); - (#_readRef returning Vector)(keys) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::values(self: «std-1.0.0-beta.14»::collections::umap::UHashMap) -> Vector := { - let values = (#_ref returning & Vector)((#_asVector returning Vector)((#_mkArray returning Array)())); - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_vectorIndex returning «std-1.0.0-beta.14»::collections::umap::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if («std-1.0.0-beta.14»::collections::umap::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::umap::Slot) -> bool)(slot) then { - values = (#_vectorPushBack returning Vector)((#_readRef returning Vector)(values), slot.1); - #_skip - } - } - }; - #_skip - }; - let self_len = self.1; - let values_len = (#_arrayLen returning u32)((#_readRef returning Vector)(values)); - let msg = (#_mkFormatString returning FmtString<81: u32, Tuple >)("Amount of valid elements should have been {}{self_len}{} times, but got {}{values_len}{}.", self_len, values_len); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_readRef returning Vector)(values)), self.1)); - (#_readRef returning Vector)(values) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::iter_mut(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap, f: λ(K, V) -> Tuple) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::iter_keys_mut(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap, f: λ(K) -> K) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::iter_values_mut(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap, f: λ(V) -> V) -> Unit := { - for i in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::UHashMap)(self).0) do { - let slot = (#_ref returning & «std-1.0.0-beta.14»::collections::umap::Slot)((#_vectorIndex returning «std-1.0.0-beta.14»::collections::umap::Slot)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::UHashMap)(self).0, (#_cast returning u32)(i))); - if («std-1.0.0-beta.14»::collections::umap::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::umap::Slot) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot)) then { - («std-1.0.0-beta.14»::collections::umap::Slot::set as λ(& «std-1.0.0-beta.14»::collections::umap::Slot, K, V) -> Unit)(slot, (#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot).0, (f as λ(V) -> V)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot).1)); - (((*self: «std-1.0.0-beta.14»::collections::umap::UHashMap).0: Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)[[i]]: «std-1.0.0-beta.14»::collections::umap::Slot) = (#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot); - #_skip - } - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::retain(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap, f: λ(K, V) -> bool) -> Unit := { - for index in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::UHashMap)(self).0) do { - let slot = (#_ref returning & «std-1.0.0-beta.14»::collections::umap::Slot)((#_vectorIndex returning «std-1.0.0-beta.14»::collections::umap::Slot)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::UHashMap)(self).0, (#_cast returning u32)(index))); - if («std-1.0.0-beta.14»::collections::umap::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::umap::Slot) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot)) then { - if (#_bNot returning bool)((f as λ(K, V) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot).0, (#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot).1)) then { - («std-1.0.0-beta.14»::collections::umap::Slot::mark_deleted as λ(& «std-1.0.0-beta.14»::collections::umap::Slot) -> Unit)(slot); - ((*self: «std-1.0.0-beta.14»::collections::umap::UHashMap).1: u32) = (#_uSub returning u32)((#_readRef returning «std-1.0.0-beta.14»::collections::umap::UHashMap)(self).1, (1: u32)); - (((*self: «std-1.0.0-beta.14»::collections::umap::UHashMap).0: Vector<«std-1.0.0-beta.14»::collections::umap::Slot >)[[index]]: «std-1.0.0-beta.14»::collections::umap::Slot) = (#_readRef returning «std-1.0.0-beta.14»::collections::umap::Slot)(slot); - #_skip - } - } - }; - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::len(self: «std-1.0.0-beta.14»::collections::umap::UHashMap) -> u32 := { - self.1 -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::capacity(self: «std-1.0.0-beta.14»::collections::umap::UHashMap) -> u32 := { - (#_arrayLen returning u32)(self.0) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::get(self: «std-1.0.0-beta.14»::collections::umap::UHashMap, key: K) -> «std-1.0.0-beta.14»::option::Option := { - (#_fresh returning «std-1.0.0-beta.14»::option::Option)() -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::insert(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap, key: K, value: V) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::try_resize(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::remove(self: & «std-1.0.0-beta.14»::collections::umap::UHashMap, key: K) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::hash(self: «std-1.0.0-beta.14»::collections::umap::UHashMap, key: K) -> u32 := { - let hasher = (#_ref returning & B_as_BuildHasher_H)(((B as «std-1.0.0-beta.14»::hash::BuildHasher<>)::build_hasher<> as λ(B) -> B_as_BuildHasher_H)(self.2)); - ((K as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(K, & B_as_BuildHasher_H) -> Unit)(key, hasher); - (#_cast returning u32)(((B_as_BuildHasher_H as «std-1.0.0-beta.14»::hash::Hasher<>)::finish<> as λ(B_as_BuildHasher_H) -> Field)((#_readRef returning B_as_BuildHasher_H)(hasher))) -} - -noir_def «std-1.0.0-beta.14»::collections::umap::UHashMap::linear_probe(self: «std-1.0.0-beta.14»::collections::umap::UHashMap, hash: u32, attempt: u32) -> u32 := { - (#_uRem returning u32)((#_uAdd returning u32)(hash, attempt), (#_arrayLen returning u32)(self.0)) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_38] «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::collections::umap::UHashMap where [K: «std-1.0.0-beta.14»::cmp::Eq<>, K: «std-1.0.0-beta.14»::hash::Hash<>, V: «std-1.0.0-beta.14»::cmp::Eq<>, B: «std-1.0.0-beta.14»::hash::BuildHasher] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::collections::umap::UHashMap, other: «std-1.0.0-beta.14»::collections::umap::UHashMap) -> bool := { - let equal = (#_ref returning & bool)(#_false); - if (#_uEq returning bool)((«std-1.0.0-beta.14»::collections::umap::UHashMap::len as λ(«std-1.0.0-beta.14»::collections::umap::UHashMap) -> u32)(self), («std-1.0.0-beta.14»::collections::umap::UHashMap::len as λ(«std-1.0.0-beta.14»::collections::umap::UHashMap) -> u32)(other)) then { - equal = #_true; - { - let ζi0 = self.0; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let slot = (#_vectorIndex returning «std-1.0.0-beta.14»::collections::umap::Slot)(ζi0, (#_cast returning u32)(ζi1)); - { - if (#_bAnd returning bool)((#_readRef returning bool)(equal), («std-1.0.0-beta.14»::collections::umap::Slot::is_valid as λ(«std-1.0.0-beta.14»::collections::umap::Slot) -> bool)(slot)) then { - let other_value = { - («std-1.0.0-beta.14»::collections::umap::UHashMap::get as λ(«std-1.0.0-beta.14»::collections::umap::UHashMap, K) -> «std-1.0.0-beta.14»::option::Option)(other, slot.0) - }; - if («std-1.0.0-beta.14»::option::Option::is_none as λ(«std-1.0.0-beta.14»::option::Option) -> bool)(other_value) then { - equal = #_false; - #_skip - } else { - let other_value = («std-1.0.0-beta.14»::option::Option::unwrap_unchecked as λ(«std-1.0.0-beta.14»::option::Option) -> V)(other_value); - if (#_bNot returning bool)(((V as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(V, V) -> bool)(slot.1, other_value)) then { - equal = #_false; - #_skip - } - } - } - } - }; - #_skip - } - }; - (#_readRef returning bool)(equal) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_39] «std-1.0.0-beta.14»::default::Default<> for «std-1.0.0-beta.14»::collections::umap::UHashMap where [B: «std-1.0.0-beta.14»::hash::BuildHasher, B: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> «std-1.0.0-beta.14»::collections::umap::UHashMap := { - («std-1.0.0-beta.14»::collections::umap::UHashMap::with_hasher as λ(B) -> «std-1.0.0-beta.14»::collections::umap::UHashMap)(((B as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> B)()) - }; -} - -def «std-1.0.0-beta.14».Collections.Umap.env : Env := Env.mk - [«std-1.0.0-beta.14::collections::umap::Slot::is_valid», «std-1.0.0-beta.14::collections::umap::Slot::is_available», «std-1.0.0-beta.14::collections::umap::Slot::set», «std-1.0.0-beta.14::collections::umap::Slot::mark_deleted», «std-1.0.0-beta.14::collections::umap::UHashMap::with_hasher», «std-1.0.0-beta.14::collections::umap::UHashMap::with_hasher_and_capacity», «std-1.0.0-beta.14::collections::umap::UHashMap::clear», «std-1.0.0-beta.14::collections::umap::UHashMap::contains_key», «std-1.0.0-beta.14::collections::umap::UHashMap::is_empty», «std-1.0.0-beta.14::collections::umap::UHashMap::entries», «std-1.0.0-beta.14::collections::umap::UHashMap::keys», «std-1.0.0-beta.14::collections::umap::UHashMap::values», «std-1.0.0-beta.14::collections::umap::UHashMap::iter_mut», «std-1.0.0-beta.14::collections::umap::UHashMap::iter_keys_mut», «std-1.0.0-beta.14::collections::umap::UHashMap::iter_values_mut», «std-1.0.0-beta.14::collections::umap::UHashMap::retain», «std-1.0.0-beta.14::collections::umap::UHashMap::len», «std-1.0.0-beta.14::collections::umap::UHashMap::capacity», «std-1.0.0-beta.14::collections::umap::UHashMap::get», «std-1.0.0-beta.14::collections::umap::UHashMap::insert», «std-1.0.0-beta.14::collections::umap::UHashMap::try_resize», «std-1.0.0-beta.14::collections::umap::UHashMap::remove», «std-1.0.0-beta.14::collections::umap::UHashMap::hash», «std-1.0.0-beta.14::collections::umap::UHashMap::linear_probe»] - [«std-1.0.0-beta.14».impl_37, «std-1.0.0-beta.14».impl_38, «std-1.0.0-beta.14».impl_39] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Vec.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Vec.lean deleted file mode 100644 index b2b95068..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Collections/Vec.lean +++ /dev/null @@ -1,286 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::new() -> «std-1.0.0-beta.14»::collections::vec::Vec := { - (#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)())) -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::from_vector(vector: Vector) -> «std-1.0.0-beta.14»::collections::vec::Vec := { - (#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)(vector) -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::get(self: «std-1.0.0-beta.14»::collections::vec::Vec, index: u32) -> T := { - (#_vectorIndex returning T)(self.0, (#_cast returning u32)(index)) -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::set(self: & «std-1.0.0-beta.14»::collections::vec::Vec, index: u32, value: T) -> Unit := { - (((*self: «std-1.0.0-beta.14»::collections::vec::Vec).0: Vector)[[index]]: T) = value; - #_skip -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::push(self: & «std-1.0.0-beta.14»::collections::vec::Vec, elem: T) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::vec::Vec).0: Vector) = (#_vectorPushBack returning Vector)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(self).0, elem); - #_skip -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::pop(self: & «std-1.0.0-beta.14»::collections::vec::Vec) -> T := { - let (popped_vector, last_elem) = (#_vectorPopBack returning Tuple, T>)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(self).0); - ((*self: «std-1.0.0-beta.14»::collections::vec::Vec).0: Vector) = popped_vector; - last_elem -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::insert(self: & «std-1.0.0-beta.14»::collections::vec::Vec, index: u32, elem: T) -> Unit := { - ((*self: «std-1.0.0-beta.14»::collections::vec::Vec).0: Vector) = (#_vectorInsert returning Vector)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(self).0, index, elem); - #_skip -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::remove(self: & «std-1.0.0-beta.14»::collections::vec::Vec, index: u32) -> T := { - let (new_vector, elem) = (#_vectorRemove returning Tuple, T>)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(self).0, index); - ((*self: «std-1.0.0-beta.14»::collections::vec::Vec).0: Vector) = new_vector; - elem -} - -[[deprecated "std::collections::vec::Vec is deprecated, use the built-in vector type instead"]] -noir_def «std-1.0.0-beta.14»::collections::vec::Vec::len(self: «std-1.0.0-beta.14»::collections::vec::Vec) -> u32 := { - (#_arrayLen returning u32)(self.0) -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::new::creates_empty_vector<>() -> Unit := { - let vec = («std-1.0.0-beta.14»::collections::vec::Vec::new as λ() -> «std-1.0.0-beta.14»::collections::vec::Vec)(); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)(vec), (0: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::from_vector::creates_vector_with_elements<>() -> Unit := { - let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field))); - let vec = («std-1.0.0-beta.14»::collections::vec::Vec::from_vector as λ(Vector) -> «std-1.0.0-beta.14»::collections::vec::Vec)(vector); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)(vec), (5: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(vec.0, vector)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::get::retrieves_elements_correctly<>() -> Unit := { - let vec = (#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((10: Field), (20: Field), (30: Field), (40: Field), (50: Field)))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (0: u32)), (10: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (1: u32)), (20: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (2: u32)), (30: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (3: u32)), (40: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (4: u32)), (50: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::get::panics_on_out_of_bounds<>() -> Unit := { - let vec = (#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field)))); - let __0 = («std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (3: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::set::updates_values_properly<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (0: Field), (0: Field), (0: Field), (0: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (0: u32), (42: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec).0, (#_asVector returning Vector)((#_mkArray returning Array)((42: Field), (0: Field), (0: Field), (0: Field), (0: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (1: u32), (43: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec).0, (#_asVector returning Vector)((#_mkArray returning Array)((42: Field), (43: Field), (0: Field), (0: Field), (0: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (2: u32), (44: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec).0, (#_asVector returning Vector)((#_mkArray returning Array)((42: Field), (43: Field), (44: Field), (0: Field), (0: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (1: u32), (10: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec).0, (#_asVector returning Vector)((#_mkArray returning Array)((42: Field), (10: Field), (44: Field), (0: Field), (0: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (0: u32), (0: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec).0, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (10: Field), (44: Field), (0: Field), (0: Field))))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::set::panics_when_writing_elements_past_end_of_vec<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((«std-1.0.0-beta.14»::collections::vec::Vec::new as λ() -> «std-1.0.0-beta.14»::collections::vec::Vec)()); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (0: u32), (42: Field)); - let __0 = («std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::push::adds_element_to_end<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))))); - let original_len = («std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)); - («std-1.0.0-beta.14»::collections::vec::Vec::push as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, Field) -> Unit)(vec, (4: Field)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (#_uAdd returning u32)(original_len, (1: u32)))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (4: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::push::on_empty_vector<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((«std-1.0.0-beta.14»::collections::vec::Vec::new as λ() -> «std-1.0.0-beta.14»::collections::vec::Vec)()); - («std-1.0.0-beta.14»::collections::vec::Vec::push as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, Field) -> Unit)(vec, (42: Field)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (1: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (42: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::pop::removes_last_element<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field))))); - let original_len = («std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)); - let popped = («std-1.0.0-beta.14»::collections::vec::Vec::pop as λ(& «std-1.0.0-beta.14»::collections::vec::Vec) -> Field)(vec); - (#_assert returning Unit)((#_fEq returning bool)(popped, (5: Field))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (#_uSub returning u32)(original_len, (1: u32)))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (4: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::pop::on_empty_vector_panics<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((«std-1.0.0-beta.14»::collections::vec::Vec::new as λ() -> «std-1.0.0-beta.14»::collections::vec::Vec)()); - let __0 = («std-1.0.0-beta.14»::collections::vec::Vec::pop as λ(& «std-1.0.0-beta.14»::collections::vec::Vec) -> Field)(vec); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::insert::at_beginning<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::insert as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (0: u32), (0: Field)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (4: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (0: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (3: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::insert::at_middle<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (4: Field), (5: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::insert as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (2: u32), (3: Field)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (5: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (3: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (4: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (4: u32)), (5: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::insert::at_end<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::insert as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (3: u32), (4: Field)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (4: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (3: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (4: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::insert::beyond_length_panics<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))))); - («std-1.0.0-beta.14»::collections::vec::Vec::insert as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (4: u32), (5: Field)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::remove::from_beginning<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field))))); - let removed = («std-1.0.0-beta.14»::collections::vec::Vec::remove as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (0: u32)); - (#_assert returning Unit)((#_fEq returning bool)(removed, (0: Field))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (4: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (3: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (4: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::remove::from_middle<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field))))); - let removed = («std-1.0.0-beta.14»::collections::vec::Vec::remove as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (2: u32)); - (#_assert returning Unit)((#_fEq returning bool)(removed, (3: Field))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (4: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (4: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (5: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::remove::from_end<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field))))); - let removed = («std-1.0.0-beta.14»::collections::vec::Vec::remove as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (4: u32)); - (#_assert returning Unit)((#_fEq returning bool)(removed, (5: Field))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (4: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (3: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (4: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::remove::beyond_length_panics<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))))); - let __0 = («std-1.0.0-beta.14»::collections::vec::Vec::remove as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (3: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::len::returns_correct_length<>() -> Unit := { - let empty_vec = («std-1.0.0-beta.14»::collections::vec::Vec::new as λ() -> «std-1.0.0-beta.14»::collections::vec::Vec)(); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)(empty_vec), (0: u32))); - let single_vec = (#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((42: Field)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)(single_vec), (1: u32))); - let multi_vec = (#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)(multi_vec), (5: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::vec_integration::multiple_operations_chain_correctly<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((«std-1.0.0-beta.14»::collections::vec::Vec::new as λ() -> «std-1.0.0-beta.14»::collections::vec::Vec)()); - («std-1.0.0-beta.14»::collections::vec::Vec::push as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, Field) -> Unit)(vec, (1: Field)); - («std-1.0.0-beta.14»::collections::vec::Vec::push as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, Field) -> Unit)(vec, (2: Field)); - («std-1.0.0-beta.14»::collections::vec::Vec::push as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, Field) -> Unit)(vec, (3: Field)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (3: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (3: Field))); - («std-1.0.0-beta.14»::collections::vec::Vec::insert as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (1: u32), (10: Field)); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (4: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (10: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (2: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), (3: Field))); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (0: u32), (100: Field)); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, Field) -> Unit)(vec, (2: u32), (200: Field)); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (100: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (200: Field))); - let removed = («std-1.0.0-beta.14»::collections::vec::Vec::remove as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)(vec, (1: u32)); - (#_assert returning Unit)((#_fEq returning bool)(removed, (10: Field))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (3: u32))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), (100: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), (200: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> Field)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), (3: Field))); - let popped = («std-1.0.0-beta.14»::collections::vec::Vec::pop as λ(& «std-1.0.0-beta.14»::collections::vec::Vec) -> Field)(vec); - (#_assert returning Unit)((#_fEq returning bool)(popped, (3: Field))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (2: u32))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::collections::vec::vec_tests::vec_integration::vector_with_custom_types<>() -> Unit := { - let vec = (#_ref returning & «std-1.0.0-beta.14»::collections::vec::Vec)((#_makeData returning «std-1.0.0-beta.14»::collections::vec::Vec)((#_asVector returning Vector)((#_mkArray returning Array)(#_true, #_false, #_true)))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (3: u32))); - (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (0: u32)), #_true)); - (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), #_false)); - (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (2: u32)), #_true)); - («std-1.0.0-beta.14»::collections::vec::Vec::set as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, u32, bool) -> Unit)(vec, (1: u32), #_true); - (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (1: u32)), #_true)); - («std-1.0.0-beta.14»::collections::vec::Vec::push as λ(& «std-1.0.0-beta.14»::collections::vec::Vec, bool) -> Unit)(vec, #_false); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::len as λ(«std-1.0.0-beta.14»::collections::vec::Vec) -> u32)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec)), (4: u32))); - (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.14»::collections::vec::Vec::get as λ(«std-1.0.0-beta.14»::collections::vec::Vec, u32) -> bool)((#_readRef returning «std-1.0.0-beta.14»::collections::vec::Vec)(vec), (3: u32)), #_false)); - #_skip -} - -def «std-1.0.0-beta.14».Collections.Vec.env : Env := Env.mk - [«std-1.0.0-beta.14::collections::vec::vec_tests::new::creates_empty_vector», «std-1.0.0-beta.14::collections::vec::vec_tests::from_vector::creates_vector_with_elements», «std-1.0.0-beta.14::collections::vec::vec_tests::get::retrieves_elements_correctly», «std-1.0.0-beta.14::collections::vec::vec_tests::get::panics_on_out_of_bounds», «std-1.0.0-beta.14::collections::vec::vec_tests::set::updates_values_properly», «std-1.0.0-beta.14::collections::vec::vec_tests::set::panics_when_writing_elements_past_end_of_vec», «std-1.0.0-beta.14::collections::vec::vec_tests::push::adds_element_to_end», «std-1.0.0-beta.14::collections::vec::vec_tests::push::on_empty_vector», «std-1.0.0-beta.14::collections::vec::vec_tests::pop::removes_last_element», «std-1.0.0-beta.14::collections::vec::vec_tests::pop::on_empty_vector_panics», «std-1.0.0-beta.14::collections::vec::vec_tests::insert::at_beginning», «std-1.0.0-beta.14::collections::vec::vec_tests::insert::at_middle», «std-1.0.0-beta.14::collections::vec::vec_tests::insert::at_end», «std-1.0.0-beta.14::collections::vec::vec_tests::insert::beyond_length_panics», «std-1.0.0-beta.14::collections::vec::vec_tests::remove::from_beginning», «std-1.0.0-beta.14::collections::vec::vec_tests::remove::from_middle», «std-1.0.0-beta.14::collections::vec::vec_tests::remove::from_end», «std-1.0.0-beta.14::collections::vec::vec_tests::remove::beyond_length_panics», «std-1.0.0-beta.14::collections::vec::vec_tests::len::returns_correct_length», «std-1.0.0-beta.14::collections::vec::vec_tests::vec_integration::multiple_operations_chain_correctly», «std-1.0.0-beta.14::collections::vec::vec_tests::vec_integration::vector_with_custom_types»] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Convert.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Convert.lean deleted file mode 100644 index 991f6224..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Convert.lean +++ /dev/null @@ -1,882 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_40] «std-1.0.0-beta.14»::convert::From for T where [] := { - noir_def «from»<>(input: T) -> T := { - input - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_41] «std-1.0.0-beta.14»::convert::Into for U where [T: «std-1.0.0-beta.14»::convert::From] := { - noir_def into<>(self: U) -> T := { - ((T as «std-1.0.0-beta.14»::convert::From)::«from»<> as λ(U) -> T)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_42]<> «std-1.0.0-beta.14»::convert::From for u16 where [] := { - noir_def «from»<>(value: u8) -> u16 := { - (#_cast returning u16)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_43]<> «std-1.0.0-beta.14»::convert::From for u32 where [] := { - noir_def «from»<>(value: u8) -> u32 := { - (#_cast returning u32)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_44]<> «std-1.0.0-beta.14»::convert::From for u32 where [] := { - noir_def «from»<>(value: u16) -> u32 := { - (#_cast returning u32)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_45]<> «std-1.0.0-beta.14»::convert::From for u64 where [] := { - noir_def «from»<>(value: u8) -> u64 := { - (#_cast returning u64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_46]<> «std-1.0.0-beta.14»::convert::From for u64 where [] := { - noir_def «from»<>(value: u16) -> u64 := { - (#_cast returning u64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_47]<> «std-1.0.0-beta.14»::convert::From for u64 where [] := { - noir_def «from»<>(value: u32) -> u64 := { - (#_cast returning u64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_48]<> «std-1.0.0-beta.14»::convert::From for u128 where [] := { - noir_def «from»<>(value: u8) -> u128 := { - (#_cast returning u128)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_49]<> «std-1.0.0-beta.14»::convert::From for u128 where [] := { - noir_def «from»<>(value: u16) -> u128 := { - (#_cast returning u128)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_50]<> «std-1.0.0-beta.14»::convert::From for u128 where [] := { - noir_def «from»<>(value: u32) -> u128 := { - (#_cast returning u128)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_51]<> «std-1.0.0-beta.14»::convert::From for u128 where [] := { - noir_def «from»<>(value: u64) -> u128 := { - (#_cast returning u128)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_52]<> «std-1.0.0-beta.14»::convert::From for Field where [] := { - noir_def «from»<>(value: u8) -> Field := { - (#_cast returning Field)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_53]<> «std-1.0.0-beta.14»::convert::From for Field where [] := { - noir_def «from»<>(value: u16) -> Field := { - (#_cast returning Field)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_54]<> «std-1.0.0-beta.14»::convert::From for Field where [] := { - noir_def «from»<>(value: u32) -> Field := { - (#_cast returning Field)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_55]<> «std-1.0.0-beta.14»::convert::From for Field where [] := { - noir_def «from»<>(value: u64) -> Field := { - (#_cast returning Field)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_56]<> «std-1.0.0-beta.14»::convert::From for Field where [] := { - noir_def «from»<>(value: u128) -> Field := { - (#_cast returning Field)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_57]<> «std-1.0.0-beta.14»::convert::From< i8> for i16 where [] := { - noir_def «from»<>(value: i8) -> i16 := { - (#_cast returning i16)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_58]<> «std-1.0.0-beta.14»::convert::From< i8> for i32 where [] := { - noir_def «from»<>(value: i8) -> i32 := { - (#_cast returning i32)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_59]<> «std-1.0.0-beta.14»::convert::From< i16> for i32 where [] := { - noir_def «from»<>(value: i16) -> i32 := { - (#_cast returning i32)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_60]<> «std-1.0.0-beta.14»::convert::From< i8> for i64 where [] := { - noir_def «from»<>(value: i8) -> i64 := { - (#_cast returning i64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_61]<> «std-1.0.0-beta.14»::convert::From< i16> for i64 where [] := { - noir_def «from»<>(value: i16) -> i64 := { - (#_cast returning i64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_62]<> «std-1.0.0-beta.14»::convert::From< i32> for i64 where [] := { - noir_def «from»<>(value: i32) -> i64 := { - (#_cast returning i64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_63]<> «std-1.0.0-beta.14»::convert::From for u8 where [] := { - noir_def «from»<>(value: bool) -> u8 := { - (#_cast returning u8)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_64]<> «std-1.0.0-beta.14»::convert::From for u16 where [] := { - noir_def «from»<>(value: bool) -> u16 := { - (#_cast returning u16)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_65]<> «std-1.0.0-beta.14»::convert::From for u32 where [] := { - noir_def «from»<>(value: bool) -> u32 := { - (#_cast returning u32)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_66]<> «std-1.0.0-beta.14»::convert::From for u64 where [] := { - noir_def «from»<>(value: bool) -> u64 := { - (#_cast returning u64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_67]<> «std-1.0.0-beta.14»::convert::From for u128 where [] := { - noir_def «from»<>(value: bool) -> u128 := { - (#_cast returning u128)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_68]<> «std-1.0.0-beta.14»::convert::From for i8 where [] := { - noir_def «from»<>(value: bool) -> i8 := { - (#_cast returning i8)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_69]<> «std-1.0.0-beta.14»::convert::From for i16 where [] := { - noir_def «from»<>(value: bool) -> i16 := { - (#_cast returning i16)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_70]<> «std-1.0.0-beta.14»::convert::From for i32 where [] := { - noir_def «from»<>(value: bool) -> i32 := { - (#_cast returning i32)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_71]<> «std-1.0.0-beta.14»::convert::From for i64 where [] := { - noir_def «from»<>(value: bool) -> i64 := { - (#_cast returning i64)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_72]<> «std-1.0.0-beta.14»::convert::From for Field where [] := { - noir_def «from»<>(value: bool) -> Field := { - (#_cast returning Field)(value) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_349]<> «std-1.0.0-beta.14»::convert::AsPrimitive for bool where [] := { - noir_def as_<>(self: bool) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_399]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for bool where [] := { - noir_def as_<>(self: bool) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_319]<> «std-1.0.0-beta.14»::convert::AsPrimitive for bool where [] := { - noir_def as_<>(self: bool) -> bool := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_369]<> «std-1.0.0-beta.14»::convert::AsPrimitive for bool where [] := { - noir_def as_<>(self: bool) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_339]<> «std-1.0.0-beta.14»::convert::AsPrimitive for bool where [] := { - noir_def as_<>(self: bool) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_389]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for bool where [] := { - noir_def as_<>(self: bool) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_359]<> «std-1.0.0-beta.14»::convert::AsPrimitive for bool where [] := { - noir_def as_<>(self: bool) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_409]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for bool where [] := { - noir_def as_<>(self: bool) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_329]<> «std-1.0.0-beta.14»::convert::AsPrimitive for bool where [] := { - noir_def as_<>(self: bool) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_379]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for bool where [] := { - noir_def as_<>(self: bool) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_350]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u8 where [] := { - noir_def as_<>(self: u8) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_400]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for u8 where [] := { - noir_def as_<>(self: u8) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_320]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u8 where [] := { - noir_def as_<>(self: u8) -> bool := { - (#_uNeq returning bool)(self, (0: u8)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_370]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u8 where [] := { - noir_def as_<>(self: u8) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_340]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u8 where [] := { - noir_def as_<>(self: u8) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_390]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for u8 where [] := { - noir_def as_<>(self: u8) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_360]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u8 where [] := { - noir_def as_<>(self: u8) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_410]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for u8 where [] := { - noir_def as_<>(self: u8) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_330]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u8 where [] := { - noir_def as_<>(self: u8) -> u8 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_380]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for u8 where [] := { - noir_def as_<>(self: u8) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_351]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u16 where [] := { - noir_def as_<>(self: u16) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_401]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for u16 where [] := { - noir_def as_<>(self: u16) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_321]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u16 where [] := { - noir_def as_<>(self: u16) -> bool := { - (#_uNeq returning bool)(self, (0: u16)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_371]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u16 where [] := { - noir_def as_<>(self: u16) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_341]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u16 where [] := { - noir_def as_<>(self: u16) -> u16 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_391]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for u16 where [] := { - noir_def as_<>(self: u16) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_361]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u16 where [] := { - noir_def as_<>(self: u16) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_411]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for u16 where [] := { - noir_def as_<>(self: u16) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_331]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u16 where [] := { - noir_def as_<>(self: u16) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_381]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for u16 where [] := { - noir_def as_<>(self: u16) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_352]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u32 where [] := { - noir_def as_<>(self: u32) -> u32 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_402]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for u32 where [] := { - noir_def as_<>(self: u32) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_322]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u32 where [] := { - noir_def as_<>(self: u32) -> bool := { - (#_uNeq returning bool)(self, (0: u32)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_372]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u32 where [] := { - noir_def as_<>(self: u32) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_342]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u32 where [] := { - noir_def as_<>(self: u32) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_392]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for u32 where [] := { - noir_def as_<>(self: u32) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_362]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u32 where [] := { - noir_def as_<>(self: u32) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_412]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for u32 where [] := { - noir_def as_<>(self: u32) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_332]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u32 where [] := { - noir_def as_<>(self: u32) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_382]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for u32 where [] := { - noir_def as_<>(self: u32) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_323]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u64 where [] := { - noir_def as_<>(self: u64) -> bool := { - (#_uNeq returning bool)(self, (0: u64)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_373]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u64 where [] := { - noir_def as_<>(self: u64) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_343]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u64 where [] := { - noir_def as_<>(self: u64) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_393]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for u64 where [] := { - noir_def as_<>(self: u64) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_363]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u64 where [] := { - noir_def as_<>(self: u64) -> u64 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_413]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for u64 where [] := { - noir_def as_<>(self: u64) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_333]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u64 where [] := { - noir_def as_<>(self: u64) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_383]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for u64 where [] := { - noir_def as_<>(self: u64) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_353]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u64 where [] := { - noir_def as_<>(self: u64) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_403]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for u64 where [] := { - noir_def as_<>(self: u64) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_324]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u128 where [] := { - noir_def as_<>(self: u128) -> bool := { - (#_uNeq returning bool)(self, (0: u128)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_374]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u128 where [] := { - noir_def as_<>(self: u128) -> u128 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_344]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u128 where [] := { - noir_def as_<>(self: u128) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_394]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for u128 where [] := { - noir_def as_<>(self: u128) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_364]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u128 where [] := { - noir_def as_<>(self: u128) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_414]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for u128 where [] := { - noir_def as_<>(self: u128) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_334]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u128 where [] := { - noir_def as_<>(self: u128) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_384]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for u128 where [] := { - noir_def as_<>(self: u128) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_354]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u128 where [] := { - noir_def as_<>(self: u128) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_404]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for u128 where [] := { - noir_def as_<>(self: u128) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_325]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i8 where [] := { - noir_def as_<>(self: i8) -> bool := { - (#_iNeq returning bool)(self, (0: i8)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_375]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i8 where [] := { - noir_def as_<>(self: i8) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_345]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i8 where [] := { - noir_def as_<>(self: i8) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_395]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for i8 where [] := { - noir_def as_<>(self: i8) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_365]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i8 where [] := { - noir_def as_<>(self: i8) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_415]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for i8 where [] := { - noir_def as_<>(self: i8) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_335]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i8 where [] := { - noir_def as_<>(self: i8) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_385]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for i8 where [] := { - noir_def as_<>(self: i8) -> i8 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_355]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i8 where [] := { - noir_def as_<>(self: i8) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_405]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for i8 where [] := { - noir_def as_<>(self: i8) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_326]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i16 where [] := { - noir_def as_<>(self: i16) -> bool := { - (#_iNeq returning bool)(self, (0: i16)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_376]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i16 where [] := { - noir_def as_<>(self: i16) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_346]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i16 where [] := { - noir_def as_<>(self: i16) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_396]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for i16 where [] := { - noir_def as_<>(self: i16) -> i16 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_366]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i16 where [] := { - noir_def as_<>(self: i16) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_416]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for i16 where [] := { - noir_def as_<>(self: i16) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_336]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i16 where [] := { - noir_def as_<>(self: i16) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_386]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for i16 where [] := { - noir_def as_<>(self: i16) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_356]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i16 where [] := { - noir_def as_<>(self: i16) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_406]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for i16 where [] := { - noir_def as_<>(self: i16) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_327]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i32 where [] := { - noir_def as_<>(self: i32) -> bool := { - (#_iNeq returning bool)(self, (0: i32)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_377]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i32 where [] := { - noir_def as_<>(self: i32) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_347]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i32 where [] := { - noir_def as_<>(self: i32) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_397]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for i32 where [] := { - noir_def as_<>(self: i32) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_367]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i32 where [] := { - noir_def as_<>(self: i32) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_417]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for i32 where [] := { - noir_def as_<>(self: i32) -> i64 := { - (#_cast returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_337]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i32 where [] := { - noir_def as_<>(self: i32) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_387]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for i32 where [] := { - noir_def as_<>(self: i32) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_357]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i32 where [] := { - noir_def as_<>(self: i32) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_407]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for i32 where [] := { - noir_def as_<>(self: i32) -> i32 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_348]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i64 where [] := { - noir_def as_<>(self: i64) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_398]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i16> for i64 where [] := { - noir_def as_<>(self: i64) -> i16 := { - (#_cast returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_368]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i64 where [] := { - noir_def as_<>(self: i64) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_418]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i64> for i64 where [] := { - noir_def as_<>(self: i64) -> i64 := { - self - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_338]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i64 where [] := { - noir_def as_<>(self: i64) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_388]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i8> for i64 where [] := { - noir_def as_<>(self: i64) -> i8 := { - (#_cast returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_358]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i64 where [] := { - noir_def as_<>(self: i64) -> u32 := { - (#_cast returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_408]<> «std-1.0.0-beta.14»::convert::AsPrimitive< i32> for i64 where [] := { - noir_def as_<>(self: i64) -> i32 := { - (#_cast returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_328]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i64 where [] := { - noir_def as_<>(self: i64) -> bool := { - (#_iNeq returning bool)(self, (0: i64)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_378]<> «std-1.0.0-beta.14»::convert::AsPrimitive for i64 where [] := { - noir_def as_<>(self: i64) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_419]<> «std-1.0.0-beta.14»::convert::AsPrimitive for bool where [] := { - noir_def as_<>(self: bool) -> Field := { - (#_cast returning Field)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_420]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u8 where [] := { - noir_def as_<>(self: u8) -> Field := { - (#_cast returning Field)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_421]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u16 where [] := { - noir_def as_<>(self: u16) -> Field := { - (#_cast returning Field)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_422]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u32 where [] := { - noir_def as_<>(self: u32) -> Field := { - (#_cast returning Field)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_423]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u64 where [] := { - noir_def as_<>(self: u64) -> Field := { - (#_cast returning Field)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_424]<> «std-1.0.0-beta.14»::convert::AsPrimitive for u128 where [] := { - noir_def as_<>(self: u128) -> Field := { - (#_cast returning Field)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_427]<> «std-1.0.0-beta.14»::convert::AsPrimitive for Field where [] := { - noir_def as_<>(self: Field) -> u16 := { - (#_cast returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_426]<> «std-1.0.0-beta.14»::convert::AsPrimitive for Field where [] := { - noir_def as_<>(self: Field) -> u8 := { - (#_cast returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_425]<> «std-1.0.0-beta.14»::convert::AsPrimitive for Field where [] := { - noir_def as_<>(self: Field) -> bool := { - (#_fNeq returning bool)(self, (0: Field)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_430]<> «std-1.0.0-beta.14»::convert::AsPrimitive for Field where [] := { - noir_def as_<>(self: Field) -> u128 := { - (#_cast returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_429]<> «std-1.0.0-beta.14»::convert::AsPrimitive for Field where [] := { - noir_def as_<>(self: Field) -> u64 := { - (#_cast returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_428]<> «std-1.0.0-beta.14»::convert::AsPrimitive for Field where [] := { - noir_def as_<>(self: Field) -> u32 := { - (#_cast returning u32)(self) - }; -} - -def «std-1.0.0-beta.14».Convert.env : Env := Env.mk - [] - [«std-1.0.0-beta.14».impl_40, «std-1.0.0-beta.14».impl_41, «std-1.0.0-beta.14».impl_42, «std-1.0.0-beta.14».impl_43, «std-1.0.0-beta.14».impl_44, «std-1.0.0-beta.14».impl_45, «std-1.0.0-beta.14».impl_46, «std-1.0.0-beta.14».impl_47, «std-1.0.0-beta.14».impl_48, «std-1.0.0-beta.14».impl_49, «std-1.0.0-beta.14».impl_50, «std-1.0.0-beta.14».impl_51, «std-1.0.0-beta.14».impl_52, «std-1.0.0-beta.14».impl_53, «std-1.0.0-beta.14».impl_54, «std-1.0.0-beta.14».impl_55, «std-1.0.0-beta.14».impl_56, «std-1.0.0-beta.14».impl_57, «std-1.0.0-beta.14».impl_58, «std-1.0.0-beta.14».impl_59, «std-1.0.0-beta.14».impl_60, «std-1.0.0-beta.14».impl_61, «std-1.0.0-beta.14».impl_62, «std-1.0.0-beta.14».impl_63, «std-1.0.0-beta.14».impl_64, «std-1.0.0-beta.14».impl_65, «std-1.0.0-beta.14».impl_66, «std-1.0.0-beta.14».impl_67, «std-1.0.0-beta.14».impl_68, «std-1.0.0-beta.14».impl_69, «std-1.0.0-beta.14».impl_70, «std-1.0.0-beta.14».impl_71, «std-1.0.0-beta.14».impl_72, «std-1.0.0-beta.14».impl_349, «std-1.0.0-beta.14».impl_399, «std-1.0.0-beta.14».impl_319, «std-1.0.0-beta.14».impl_369, «std-1.0.0-beta.14».impl_339, «std-1.0.0-beta.14».impl_389, «std-1.0.0-beta.14».impl_359, «std-1.0.0-beta.14».impl_409, «std-1.0.0-beta.14».impl_329, «std-1.0.0-beta.14».impl_379, «std-1.0.0-beta.14».impl_350, «std-1.0.0-beta.14».impl_400, «std-1.0.0-beta.14».impl_320, «std-1.0.0-beta.14».impl_370, «std-1.0.0-beta.14».impl_340, «std-1.0.0-beta.14».impl_390, «std-1.0.0-beta.14».impl_360, «std-1.0.0-beta.14».impl_410, «std-1.0.0-beta.14».impl_330, «std-1.0.0-beta.14».impl_380, «std-1.0.0-beta.14».impl_351, «std-1.0.0-beta.14».impl_401, «std-1.0.0-beta.14».impl_321, «std-1.0.0-beta.14».impl_371, «std-1.0.0-beta.14».impl_341, «std-1.0.0-beta.14».impl_391, «std-1.0.0-beta.14».impl_361, «std-1.0.0-beta.14».impl_411, «std-1.0.0-beta.14».impl_331, «std-1.0.0-beta.14».impl_381, «std-1.0.0-beta.14».impl_352, «std-1.0.0-beta.14».impl_402, «std-1.0.0-beta.14».impl_322, «std-1.0.0-beta.14».impl_372, «std-1.0.0-beta.14».impl_342, «std-1.0.0-beta.14».impl_392, «std-1.0.0-beta.14».impl_362, «std-1.0.0-beta.14».impl_412, «std-1.0.0-beta.14».impl_332, «std-1.0.0-beta.14».impl_382, «std-1.0.0-beta.14».impl_323, «std-1.0.0-beta.14».impl_373, «std-1.0.0-beta.14».impl_343, «std-1.0.0-beta.14».impl_393, «std-1.0.0-beta.14».impl_363, «std-1.0.0-beta.14».impl_413, «std-1.0.0-beta.14».impl_333, «std-1.0.0-beta.14».impl_383, «std-1.0.0-beta.14».impl_353, «std-1.0.0-beta.14».impl_403, «std-1.0.0-beta.14».impl_324, «std-1.0.0-beta.14».impl_374, «std-1.0.0-beta.14».impl_344, «std-1.0.0-beta.14».impl_394, «std-1.0.0-beta.14».impl_364, «std-1.0.0-beta.14».impl_414, «std-1.0.0-beta.14».impl_334, «std-1.0.0-beta.14».impl_384, «std-1.0.0-beta.14».impl_354, «std-1.0.0-beta.14».impl_404, «std-1.0.0-beta.14».impl_325, «std-1.0.0-beta.14».impl_375, «std-1.0.0-beta.14».impl_345, «std-1.0.0-beta.14».impl_395, «std-1.0.0-beta.14».impl_365, «std-1.0.0-beta.14».impl_415, «std-1.0.0-beta.14».impl_335, «std-1.0.0-beta.14».impl_385, «std-1.0.0-beta.14».impl_355, «std-1.0.0-beta.14».impl_405, «std-1.0.0-beta.14».impl_326, «std-1.0.0-beta.14».impl_376, «std-1.0.0-beta.14».impl_346, «std-1.0.0-beta.14».impl_396, «std-1.0.0-beta.14».impl_366, «std-1.0.0-beta.14».impl_416, «std-1.0.0-beta.14».impl_336, «std-1.0.0-beta.14».impl_386, «std-1.0.0-beta.14».impl_356, «std-1.0.0-beta.14».impl_406, «std-1.0.0-beta.14».impl_327, «std-1.0.0-beta.14».impl_377, «std-1.0.0-beta.14».impl_347, «std-1.0.0-beta.14».impl_397, «std-1.0.0-beta.14».impl_367, «std-1.0.0-beta.14».impl_417, «std-1.0.0-beta.14».impl_337, «std-1.0.0-beta.14».impl_387, «std-1.0.0-beta.14».impl_357, «std-1.0.0-beta.14».impl_407, «std-1.0.0-beta.14».impl_348, «std-1.0.0-beta.14».impl_398, «std-1.0.0-beta.14».impl_368, «std-1.0.0-beta.14».impl_418, «std-1.0.0-beta.14».impl_338, «std-1.0.0-beta.14».impl_388, «std-1.0.0-beta.14».impl_358, «std-1.0.0-beta.14».impl_408, «std-1.0.0-beta.14».impl_328, «std-1.0.0-beta.14».impl_378, «std-1.0.0-beta.14».impl_419, «std-1.0.0-beta.14».impl_420, «std-1.0.0-beta.14».impl_421, «std-1.0.0-beta.14».impl_422, «std-1.0.0-beta.14».impl_423, «std-1.0.0-beta.14».impl_424, «std-1.0.0-beta.14».impl_427, «std-1.0.0-beta.14».impl_426, «std-1.0.0-beta.14».impl_425, «std-1.0.0-beta.14».impl_430, «std-1.0.0-beta.14».impl_429, «std-1.0.0-beta.14».impl_428] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Default.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Default.lean deleted file mode 100644 index 8b1a5914..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Default.lean +++ /dev/null @@ -1,126 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_272]<> «std-1.0.0-beta.14»::default::Default<> for Field where [] := { - noir_def default<>() -> Field := { - (0: Field) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_273]<> «std-1.0.0-beta.14»::default::Default<> for u1 where [] := { - noir_def default<>() -> u1 := { - (0: u1) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_274]<> «std-1.0.0-beta.14»::default::Default<> for u8 where [] := { - noir_def default<>() -> u8 := { - (0: u8) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_275]<> «std-1.0.0-beta.14»::default::Default<> for u16 where [] := { - noir_def default<>() -> u16 := { - (0: u16) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_276]<> «std-1.0.0-beta.14»::default::Default<> for u32 where [] := { - noir_def default<>() -> u32 := { - (0: u32) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_277]<> «std-1.0.0-beta.14»::default::Default<> for u64 where [] := { - noir_def default<>() -> u64 := { - (0: u64) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_278]<> «std-1.0.0-beta.14»::default::Default<> for u128 where [] := { - noir_def default<>() -> u128 := { - (0: u128) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_279]<> «std-1.0.0-beta.14»::default::Default<> for i8 where [] := { - noir_def default<>() -> i8 := { - (0: i8) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_280]<> «std-1.0.0-beta.14»::default::Default<> for i16 where [] := { - noir_def default<>() -> i16 := { - (0: i16) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_281]<> «std-1.0.0-beta.14»::default::Default<> for i32 where [] := { - noir_def default<>() -> i32 := { - (0: i32) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_282]<> «std-1.0.0-beta.14»::default::Default<> for i64 where [] := { - noir_def default<>() -> i64 := { - (0: i64) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_283]<> «std-1.0.0-beta.14»::default::Default<> for Unit where [] := { - noir_def default<>() -> Unit := { - #_unit - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_284]<> «std-1.0.0-beta.14»::default::Default<> for bool where [] := { - noir_def default<>() -> bool := { - #_false - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_285] «std-1.0.0-beta.14»::default::Default<> for Array where [T: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> Array := { - (#_mkRepeatedArray returning Array)(((T as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> T)()) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_286] «std-1.0.0-beta.14»::default::Default<> for Vector where [] := { - noir_def default<>() -> Vector := { - (#_asVector returning Vector)((#_mkArray returning Array)()) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_287] «std-1.0.0-beta.14»::default::Default<> for Tuple where [A: «std-1.0.0-beta.14»::default::Default<>, B: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> Tuple := { - (#_makeData returning Tuple)(((A as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> B)()) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_288] «std-1.0.0-beta.14»::default::Default<> for Tuple where [A: «std-1.0.0-beta.14»::default::Default<>, B: «std-1.0.0-beta.14»::default::Default<>, C: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> Tuple := { - (#_makeData returning Tuple)(((A as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> C)()) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_289] «std-1.0.0-beta.14»::default::Default<> for Tuple where [A: «std-1.0.0-beta.14»::default::Default<>, B: «std-1.0.0-beta.14»::default::Default<>, C: «std-1.0.0-beta.14»::default::Default<>, D: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> Tuple := { - (#_makeData returning Tuple)(((A as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> D)()) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_290] «std-1.0.0-beta.14»::default::Default<> for Tuple where [A: «std-1.0.0-beta.14»::default::Default<>, B: «std-1.0.0-beta.14»::default::Default<>, C: «std-1.0.0-beta.14»::default::Default<>, D: «std-1.0.0-beta.14»::default::Default<>, E: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> Tuple := { - (#_makeData returning Tuple)(((A as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> E)()) - }; -} - -def «std-1.0.0-beta.14».Default.env : Env := Env.mk - [] - [«std-1.0.0-beta.14».impl_272, «std-1.0.0-beta.14».impl_273, «std-1.0.0-beta.14».impl_274, «std-1.0.0-beta.14».impl_275, «std-1.0.0-beta.14».impl_276, «std-1.0.0-beta.14».impl_277, «std-1.0.0-beta.14».impl_278, «std-1.0.0-beta.14».impl_279, «std-1.0.0-beta.14».impl_280, «std-1.0.0-beta.14».impl_281, «std-1.0.0-beta.14».impl_282, «std-1.0.0-beta.14».impl_283, «std-1.0.0-beta.14».impl_284, «std-1.0.0-beta.14».impl_285, «std-1.0.0-beta.14».impl_286, «std-1.0.0-beta.14».impl_287, «std-1.0.0-beta.14».impl_288, «std-1.0.0-beta.14».impl_289, «std-1.0.0-beta.14».impl_290] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256K1.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256K1.lean deleted file mode 100644 index 1be8bc25..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256K1.lean +++ /dev/null @@ -1,16 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::ecdsa_secp256k1::verify_signature<>(public_key_x: Array, public_key_y: Array, signature: Array, message_hash: Array) -> bool := { - (#_ecdsaSecp256K1 returning bool)(public_key_x, public_key_y, signature, message_hash, #_true) -} - -def «std-1.0.0-beta.14».EcdsaSecp256K1.env : Env := Env.mk - [«std-1.0.0-beta.14::ecdsa_secp256k1::verify_signature»] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256R1.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256R1.lean deleted file mode 100644 index 9c9af507..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/EcdsaSecp256R1.lean +++ /dev/null @@ -1,16 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::ecdsa_secp256r1::verify_signature<>(public_key_x: Array, public_key_y: Array, signature: Array, message_hash: Array) -> bool := { - (#_ecdsaSecp256R1 returning bool)(public_key_x, public_key_y, signature, message_hash, #_true) -} - -def «std-1.0.0-beta.14».EcdsaSecp256R1.env : Env := Env.mk - [«std-1.0.0-beta.14::ecdsa_secp256r1::verify_signature»] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/EmbeddedCurveOps.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/EmbeddedCurveOps.lean deleted file mode 100644 index 5443b349..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/EmbeddedCurveOps.lean +++ /dev/null @@ -1,124 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint::double<>(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - («std-1.0.0-beta.14»::embedded_curve_ops::embedded_curve_add<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(self, self) -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<>() -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((0: Field), (0: Field), #_true) -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint::generator<>() -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((1: Field), (17631683881184975370165255887551781615748388533673675138860: Field), #_false) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_25]<> «std-1.0.0-beta.14»::ops::arith::Add<> for «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { - noir_def add<>(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, other: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - («std-1.0.0-beta.14»::embedded_curve_ops::embedded_curve_add<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_26]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { - noir_def sub<>(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, other: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - ((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(self, ((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(other)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_27]<> «std-1.0.0-beta.14»::ops::arith::Neg<> for «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { - noir_def neg<>(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(self.0, (#_fNeg returning Field)(self.1), self.2) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_28]<> «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, b: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool := { - (#_bOr returning bool)((#_bAnd returning bool)(self.2, b.2), (#_bAnd returning bool)((#_bAnd returning bool)((#_bEq returning bool)(self.2, b.2), (#_fEq returning bool)(self.0, b.0)), (#_fEq returning bool)(self.1, b.1))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_29]<> «std-1.0.0-beta.14»::hash::Hash<> for «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { - noir_def hash(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, state: & H) -> Unit := { - if self.2 then { - ((bool as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(bool, & H) -> Unit)(self.2, state); - #_skip - } else { - ((Field as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, state); - ((Field as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.1, state); - #_skip - } - }; -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar::new<>(lo: Field, hi: Field) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<> := { - (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)(lo, hi) -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar::from_field<>(scalar: Field) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<> := { - let (a, b) = («std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)(scalar); - (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)(a, b) -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar::from_bytes<>(bytes: Array, offset: u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<> := { - let v = (#_ref returning & Field)((1: Field)); - let lo = (#_ref returning & Field)((#_cast returning Field)((0: Field))); - let hi = (#_ref returning & Field)((#_cast returning Field)((0: Field))); - for i in (0: u32) .. (16: u32) do { - lo = (#_fAdd returning Field)((#_readRef returning Field)(lo), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uAdd returning u32)(offset, (31: u32)), i)))), (#_readRef returning Field)(v))); - hi = (#_fAdd returning Field)((#_readRef returning Field)(hi), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uAdd returning u32)(offset, (15: u32)), i)))), (#_readRef returning Field)(v))); - v = (#_fMul returning Field)((#_readRef returning Field)(v), (256: Field)); - #_skip - }; - let sig_s = (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)((#_readRef returning Field)(lo), (#_readRef returning Field)(hi)); - sig_s -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_30]<> «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<> where [] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, other: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool := { - (#_bAnd returning bool)((#_fEq returning bool)(other.1, self.1), (#_fEq returning bool)(other.0, self.0)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_31]<> «std-1.0.0-beta.14»::hash::Hash<> for «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<> where [] := { - noir_def hash(self: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, state: & H) -> Unit := { - ((Field as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.1, state); - ((Field as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, state); - #_skip - }; -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::multi_scalar_mul(points: Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>, scalars: Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - (#_arrayIndex returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_multiScalarMul returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)(points, scalars, #_true), (0: u32)) -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::fixed_base_scalar_mul<>(scalar: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - («std-1.0.0-beta.14»::embedded_curve_ops::multi_scalar_mul<1: u32> as λ(Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>, Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)()), (#_mkArray returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>)(scalar)) -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::embedded_curve_add<>(point1: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, point2: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - if (#_isUnconstrained returning bool)() then { - if point1.2 then { - point2 - } else if point2.2 then { - point1 - } else { - («std-1.0.0-beta.14»::embedded_curve_ops::embedded_curve_add_inner<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(point1, point2) - } - } else { - («std-1.0.0-beta.14»::embedded_curve_ops::embedded_curve_add_inner<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(point1, point2) - } -} - -noir_def «std-1.0.0-beta.14»::embedded_curve_ops::embedded_curve_add_inner<>(point1: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, point2: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - (#_arrayIndex returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_embeddedCurveAdd returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)(point1, point2, #_true), (0: u32)) -} - -def «std-1.0.0-beta.14».EmbeddedCurveOps.env : Env := Env.mk - [«std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint::double», «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity», «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurvePoint::generator», «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar::new», «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar::from_field», «std-1.0.0-beta.14::embedded_curve_ops::EmbeddedCurveScalar::from_bytes», «std-1.0.0-beta.14::embedded_curve_ops::multi_scalar_mul», «std-1.0.0-beta.14::embedded_curve_ops::fixed_base_scalar_mul», «std-1.0.0-beta.14::embedded_curve_ops::embedded_curve_add», «std-1.0.0-beta.14::embedded_curve_ops::embedded_curve_add_inner»] - [«std-1.0.0-beta.14».impl_25, «std-1.0.0-beta.14».impl_26, «std-1.0.0-beta.14».impl_27, «std-1.0.0-beta.14».impl_28, «std-1.0.0-beta.14».impl_29, «std-1.0.0-beta.14».impl_30, «std-1.0.0-beta.14».impl_31] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Field/Mod.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Field/Mod.lean deleted file mode 100644 index 9952ac0d..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Field/Mod.lean +++ /dev/null @@ -1,548 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::field::assert_max_bit_size(self: Field) -> Unit := { - (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(BIT_SIZE: u32), (#_cast returning u32)((#_modulusNumBits returning u64)())), "BIT_SIZE must be less than modulus_num_bits"); - (#_applyRangeConstraint returning Unit)(self, uConst!(BIT_SIZE: u32)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::to_le_bits(self: Field) -> Array := { - let bits = (#_toLeBits returning Array)(self); - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let p = (#_modulusLeBits returning Vector)(); - (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); - let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); - for i in (0: u32) .. uConst!(N: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { - if (#_uNeq returning bool)((#_arrayIndex returning u1)(bits, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning u1)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))) then { - (#_assert returning Unit)((#_uEq returning bool)((#_vectorIndex returning u1)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (1: u1))); - ok = #_true; - #_skip - } - } - }; - (#_assert returning Unit)((#_readRef returning bool)(ok)); - #_skip - }; - bits -} - -noir_def «std-1.0.0-beta.14»::field::to_be_bits(self: Field) -> Array := { - let bits = (#_toBeBits returning Array)(self); - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let p = (#_modulusBeBits returning Vector)(); - (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); - let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); - for i in (0: u32) .. uConst!(N: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { - if (#_uNeq returning bool)((#_arrayIndex returning u1)(bits, (#_cast returning u32)(i)), (#_vectorIndex returning u1)(p, (#_cast returning u32)(i))) then { - (#_assert returning Unit)((#_uEq returning bool)((#_vectorIndex returning u1)(p, (#_cast returning u32)(i)), (1: u1))); - ok = #_true; - #_skip - } - } - }; - (#_assert returning Unit)((#_readRef returning bool)(ok)); - #_skip - }; - bits -} - -noir_def «std-1.0.0-beta.14»::field::to_le_bytes(self: Field) -> Array := { - (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBytes returning Vector)())), "N must be less than or equal to modulus_le_bytes().len()"); - let bytes = («std-1.0.0-beta.14»::field::to_le_radix as λ(Field, u32) -> Array)(self, (256: u32)); - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let p = (#_modulusLeBytes returning Vector)(); - (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); - let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); - for i in (0: u32) .. uConst!(N: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { - if (#_uNeq returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning u8)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))) then { - (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning u8)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))))); - ok = #_true; - #_skip - } - } - }; - (#_assert returning Unit)((#_readRef returning bool)(ok)); - #_skip - }; - bytes -} - -noir_def «std-1.0.0-beta.14»::field::to_be_bytes(self: Field) -> Array := { - (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBytes returning Vector)())), "N must be less than or equal to modulus_le_bytes().len()"); - let bytes = («std-1.0.0-beta.14»::field::to_be_radix as λ(Field, u32) -> Array)(self, (256: u32)); - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let p = (#_modulusBeBytes returning Vector)(); - (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); - let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); - for i in (0: u32) .. uConst!(N: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { - if (#_uNeq returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i)), (#_vectorIndex returning u8)(p, (#_cast returning u32)(i))) then { - (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i)), (#_vectorIndex returning u8)(p, (#_cast returning u32)(i)))); - ok = #_true; - #_skip - } - } - }; - (#_assert returning Unit)((#_readRef returning bool)(ok)); - #_skip - }; - bytes -} - -noir_def «std-1.0.0-beta.14»::field::to_le_radix(self: Field, radix: u32) -> Array := { - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - (#_staticAssert returning Unit)((#_uLt returning bool)((1: u32), radix), "radix must be greater than 1"); - (#_staticAssert returning Unit)((#_uLeq returning bool)(radix, (256: u32)), "radix must be less than or equal to 256"); - (#_staticAssert returning Unit)((#_uEq returning bool)((#_uAnd returning u32)(radix, (#_uSub returning u32)(radix, (1: u32))), (0: u32)), "radix must be a power of 2"); - #_skip - }; - (#_toLeRadix returning Array)(self, radix) -} - -noir_def «std-1.0.0-beta.14»::field::to_be_radix(self: Field, radix: u32) -> Array := { - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - (#_staticAssert returning Unit)((#_uLt returning bool)((1: u32), radix), "radix must be greater than 1"); - (#_staticAssert returning Unit)((#_uLeq returning bool)(radix, (256: u32)), "radix must be less than or equal to 256"); - (#_staticAssert returning Unit)((#_uEq returning bool)((#_uAnd returning u32)(radix, (#_uSub returning u32)(radix, (1: u32))), (0: u32)), "radix must be a power of 2"); - #_skip - }; - (#_toBeRadix returning Array)(self, radix) -} - -noir_def «std-1.0.0-beta.14»::field::pow_32<>(self: Field, exponent: Field) -> Field := { - let r = (#_ref returning & Field)((1: Field)); - let b = («std-1.0.0-beta.14»::field::to_le_bits<32: u32> as λ(Field) -> Array)(exponent); - for i in (1: u32) .. (33: u32) do { - r = (#_fMul returning Field)((#_readRef returning Field)(r), (#_readRef returning Field)(r)); - r = (#_fAdd returning Field)((#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u1)(b, (#_cast returning u32)((#_uSub returning u32)((32: u32), i)))), (#_fMul returning Field)((#_readRef returning Field)(r), self)), (#_fMul returning Field)((#_fSub returning Field)((1: Field), (#_cast returning Field)((#_arrayIndex returning u1)(b, (#_cast returning u32)((#_uSub returning u32)((32: u32), i))))), (#_readRef returning Field)(r))); - #_skip - }; - (#_readRef returning Field)(r) -} - -noir_def «std-1.0.0-beta.14»::field::sgn0<>(self: Field) -> u1 := { - (#_cast returning u1)(self) -} - -noir_def «std-1.0.0-beta.14»::field::lt<>(self: Field, another: Field) -> bool := { - if («std-1.0.0-beta.14»::compat::is_bn254<> as λ() -> bool)() then { - («std-1.0.0-beta.14»::field::bn254::lt<> as λ(Field, Field) -> bool)(self, another) - } else { - («std-1.0.0-beta.14»::field::lt_fallback<> as λ(Field, Field) -> bool)(self, another) - } -} - -noir_def «std-1.0.0-beta.14»::field::from_le_bytes(bytes: Array) -> Field := { - (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBytes returning Vector)())), "N must be less than or equal to modulus_le_bytes().len()"); - let v = (#_ref returning & Field)((1: Field)); - let result = (#_ref returning & Field)((0: Field)); - for i in (0: u32) .. uConst!(N: u32) do { - result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i))), (#_readRef returning Field)(v))); - v = (#_fMul returning Field)((#_readRef returning Field)(v), (256: Field)); - #_skip - }; - (#_readRef returning Field)(result) -} - -noir_def «std-1.0.0-beta.14»::field::from_be_bytes(bytes: Array) -> Field := { - let v = (#_ref returning & Field)((1: Field)); - let result = (#_ref returning & Field)((0: Field)); - for i in (0: u32) .. uConst!(N: u32) do { - result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))), (#_readRef returning Field)(v))); - v = (#_fMul returning Field)((#_readRef returning Field)(v), (256: Field)); - #_skip - }; - (#_readRef returning Field)(result) -} - -noir_def «std-1.0.0-beta.14»::field::__field_less_than<>(x: Field, y: Field) -> bool := { - (#_fresh returning bool)() -} - -noir_def «std-1.0.0-beta.14»::field::field_less_than<>(x: Field, y: Field) -> bool := { - (#_fresh returning bool)() -} - -noir_def «std-1.0.0-beta.14»::field::bytes32_to_field<>(bytes32: Array) -> Field := { - let v = (#_ref returning & Field)((1: Field)); - let high = (#_ref returning & Field)((#_cast returning Field)((0: Field))); - let low = (#_ref returning & Field)((#_cast returning Field)((0: Field))); - for i in (0: u32) .. (16: u32) do { - high = (#_fAdd returning Field)((#_readRef returning Field)(high), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes32, (#_cast returning u32)((#_uSub returning u32)((15: u32), i)))), (#_readRef returning Field)(v))); - low = (#_fAdd returning Field)((#_readRef returning Field)(low), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes32, (#_cast returning u32)((#_uSub returning u32)((#_uAdd returning u32)((16: u32), (15: u32)), i)))), (#_readRef returning Field)(v))); - v = (#_fMul returning Field)((#_readRef returning Field)(v), (256: Field)); - #_skip - }; - (#_fAdd returning Field)((#_readRef returning Field)(low), (#_fMul returning Field)((#_readRef returning Field)(high), (#_readRef returning Field)(v))) -} - -noir_def «std-1.0.0-beta.14»::field::lt_fallback<>(x: Field, y: Field) -> bool := { - if (#_isUnconstrained returning bool)() then { - («std-1.0.0-beta.14»::field::field_less_than<> as λ(Field, Field) -> bool)(x, y) - } else { - let x_bytes = («std-1.0.0-beta.14»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(x); - let y_bytes = («std-1.0.0-beta.14»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(y); - let x_is_lt = (#_ref returning & bool)(#_false); - let done = (#_ref returning & bool)(#_false); - for i in (0: u32) .. (32: u32) do { - if (#_bNot returning bool)((#_readRef returning bool)(done)) then { - let x_byte = (#_cast returning u8)((#_arrayIndex returning u8)(x_bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)((32: u32), (1: u32)), i)))); - let y_byte = (#_cast returning u8)((#_arrayIndex returning u8)(y_bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)((32: u32), (1: u32)), i)))); - let bytes_match = (#_uEq returning bool)(x_byte, y_byte); - if (#_bNot returning bool)(bytes_match) then { - x_is_lt = (#_uLt returning bool)(x_byte, y_byte); - done = #_true; - #_skip - } - } - }; - (#_readRef returning bool)(x_is_lt) - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_be_bits<>() -> Unit := { - let field = (2: Field); - let bits = («std-1.0.0-beta.14»::field::to_be_bits<8: u32> as λ(Field) -> Array)(field); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bits, (#_mkArray returning Array)((0: u1), (0: u1), (0: u1), (0: u1), (0: u1), (0: u1), (1: u1), (0: u1)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_bits<>() -> Unit := { - let field = (2: Field); - let bits = («std-1.0.0-beta.14»::field::to_le_bits<8: u32> as λ(Field) -> Array)(field); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bits, (#_mkArray returning Array)((0: u1), (1: u1), (0: u1), (0: u1), (0: u1), (0: u1), (0: u1), (0: u1)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_be_bytes<>() -> Unit := { - let field = (2: Field); - let bytes = («std-1.0.0-beta.14»::field::to_be_bytes<8: u32> as λ(Field) -> Array)(field); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (2: u8)))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::from_be_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_bytes<>() -> Unit := { - let field = (2: Field); - let bytes = («std-1.0.0-beta.14»::field::to_le_bytes<8: u32> as λ(Field) -> Array)(field); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((2: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_be_radix<>() -> Unit := { - let field = (259: Field); - let bytes = («std-1.0.0-beta.14»::field::to_be_radix<8: u32> as λ(Field, u32) -> Array)(field, (256: u32)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (1: u8), (3: u8)))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::from_be_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_radix<>() -> Unit := { - let field = (259: Field); - let bytes = («std-1.0.0-beta.14»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (256: u32)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((3: u8), (1: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_radix_1<>() -> Unit := { - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let field = (2: Field); - let __0 = («std-1.0.0-beta.14»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (1: u32)); - #_skip - } else { - («std-1.0.0-beta.14»::panic::panic, Unit> as λ(String<28: u32>) -> Unit)("radix must be greater than 1"); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_radix_brillig_1<>() -> Unit := { - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let field = (1: Field); - let __0 = («std-1.0.0-beta.14»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (1: u32)); - #_skip - } else { - («std-1.0.0-beta.14»::panic::panic, Unit> as λ(String<28: u32>) -> Unit)("radix must be greater than 1"); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_radix_3<>() -> Unit := { - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let field = (2: Field); - let __0 = («std-1.0.0-beta.14»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (3: u32)); - #_skip - } else { - («std-1.0.0-beta.14»::panic::panic, Unit> as λ(String<26: u32>) -> Unit)("radix must be a power of 2"); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_radix_brillig_3<>() -> Unit := { - if (#_isUnconstrained returning bool)() then { - let field = (1: Field); - let out = («std-1.0.0-beta.14»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (3: u32)); - let expected = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); - (expected[(0: u32)]: u8) = (1: u8); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(out, (#_readRef returning Array)(expected))); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_le_radix_512<>() -> Unit := { - if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { - let field = (2: Field); - let __0 = («std-1.0.0-beta.14»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (512: u32)); - #_skip - } else { - («std-1.0.0-beta.14»::panic::panic, Unit> as λ(String<39: u32>) -> Unit)("radix must be less than or equal to 256") - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::not_enough_limbs_brillig<>() -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::field::tests::not_enough_limbs<>() -> Unit := { - let __0 = («std-1.0.0-beta.14»::field::to_le_bytes<16: u32> as λ(Field) -> Array)((340282366920938463463374607431768211456: Field)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_field_less_than<>() -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_large_field_values_unconstrained<>() -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_large_field_values<>() -> Unit := { - let large_val = (18446744073709551615: Field); - let bits = («std-1.0.0-beta.14»::field::to_le_bits<64: u32> as λ(Field) -> Array)(large_val); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u1)(bits, (0: u32)), (1: u1))); - let bytes = («std-1.0.0-beta.14»::field::to_le_bytes<8: u32> as λ(Field) -> Array)(large_val); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(bytes), large_val)); - let radix_bytes = («std-1.0.0-beta.14»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(large_val, (256: u32)); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(radix_bytes), large_val)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_decomposition_edge_cases<>() -> Unit := { - let zero_bits = («std-1.0.0-beta.14»::field::to_le_bits<8: u32> as λ(Field) -> Array)((0: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(zero_bits, (#_mkRepeatedArray returning Array)((0: u1)))); - let zero_bytes = («std-1.0.0-beta.14»::field::to_le_bytes<8: u32> as λ(Field) -> Array)((0: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(zero_bytes, (#_mkRepeatedArray returning Array)((0: u8)))); - let one_bits = («std-1.0.0-beta.14»::field::to_le_bits<8: u32> as λ(Field) -> Array)((1: Field)); - let expected = (#_mkArray returning Array)((1: u1), (0: u1), (0: u1), (0: u1), (0: u1), (0: u1), (0: u1), (0: u1)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(one_bits, expected)); - let pow2_bits = («std-1.0.0-beta.14»::field::to_le_bits<8: u32> as λ(Field) -> Array)((4: Field)); - let expected = (#_mkArray returning Array)((0: u1), (0: u1), (1: u1), (0: u1), (0: u1), (0: u1), (0: u1), (0: u1)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(pow2_bits, expected)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_pow_32<>() -> Unit := { - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((2: Field), (3: Field)), (8: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((3: Field), (2: Field)), (9: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((5: Field), (0: Field)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((7: Field), (1: Field)), (7: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((2: Field), (10: Field)), (1024: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((0: Field), (5: Field)), (0: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((0: Field), (0: Field)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::field::pow_32<> as λ(Field, Field) -> Field)((1: Field), (100: Field)), (1: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_sgn0<>() -> Unit := { - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((0: Field)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((2: Field)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((4: Field)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((100: Field)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((1: Field)), (1: u1))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((3: Field)), (1: u1))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((5: Field)), (1: u1))); - (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.14»::field::sgn0<> as λ(Field) -> u1)((101: Field)), (1: u1))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_bit_decomposition_overflow<>() -> Unit := { - let large_val = (1152921504606846976: Field); - let __0 = («std-1.0.0-beta.14»::field::to_le_bits<8: u32> as λ(Field) -> Array)(large_val); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_byte_decomposition_overflow<>() -> Unit := { - let large_val = (1152921504606846976: Field); - let __0 = («std-1.0.0-beta.14»::field::to_le_bytes<4: u32> as λ(Field) -> Array)(large_val); - #_skip -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_from_be_bytes_bn254_edge_cases<>() -> Unit := { - if («std-1.0.0-beta.14»::compat::is_bn254<> as λ() -> bool)() then { - let p_minus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); - (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (0: u8))); - { - let i_3469 = (#_uSub returning u32)((32: u32), (1: u32)); - (p_minus_1_bytes[i_3469]: u8) = (#_uSub returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8)); - #_skip - }; - let p_minus_1 = («std-1.0.0-beta.14»::field::from_be_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bytes)); - (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); - let p_minus_1_converted_bytes = («std-1.0.0-beta.14»::field::to_be_bytes<32: u32> as λ(Field) -> Array)(p_minus_1); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bytes, (#_readRef returning Array)(p_minus_1_bytes))); - let p_plus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); - (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (255: u8))); - { - let i_3473 = (#_uSub returning u32)((32: u32), (1: u32)); - (p_plus_1_bytes[i_3473]: u8) = (#_uAdd returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8)); - #_skip - }; - let p_plus_1 = («std-1.0.0-beta.14»::field::from_be_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_1_bytes)); - (#_assert returning Unit)((#_fEq returning bool)(p_plus_1, (1: Field))); - let p_plus_1_converted_bytes = (#_ref returning & Array)((«std-1.0.0-beta.14»::field::to_be_bytes<32: u32> as λ(Field) -> Array)(p_plus_1)); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_converted_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8))); - { - let i_3476 = (#_uSub returning u32)((32: u32), (1: u32)); - (p_plus_1_converted_bytes[i_3476]: u8) = (0: u8); - #_skip - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_1_converted_bytes), (#_mkRepeatedArray returning Array)((0: u8)))); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusBeBytes returning Vector)()), (32: u32))); - let p = («std-1.0.0-beta.14»::field::from_be_bytes<32: u32> as λ(Array) -> Field)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); - (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); - let p_bytes = («std-1.0.0-beta.14»::field::to_be_bytes<32: u32> as λ(Field) -> Array)((0: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bytes, (#_mkRepeatedArray returning Array)((0: u8)))); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_from_le_bytes_bn254_edge_cases<>() -> Unit := { - if («std-1.0.0-beta.14»::compat::is_bn254<> as λ() -> bool)() then { - let p_minus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); - (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (0: u32)), (0: u8))); - (p_minus_1_bytes[(0: u32)]: u8) = (#_uSub returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (0: u32)), (1: u8)); - let p_minus_1 = («std-1.0.0-beta.14»::field::from_le_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bytes)); - (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); - let p_minus_1_converted_bytes = («std-1.0.0-beta.14»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(p_minus_1); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bytes, (#_readRef returning Array)(p_minus_1_bytes))); - let p_plus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); - (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (0: u32)), (255: u8))); - (p_plus_1_bytes[(0: u32)]: u8) = (#_uAdd returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (0: u32)), (1: u8)); - let p_plus_1 = («std-1.0.0-beta.14»::field::from_le_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_1_bytes)); - (#_assert returning Unit)((#_fEq returning bool)(p_plus_1, (1: Field))); - let p_plus_1_converted_bytes = (#_ref returning & Array)((«std-1.0.0-beta.14»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(p_plus_1)); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_converted_bytes), (0: u32)), (1: u8))); - (p_plus_1_converted_bytes[(0: u32)]: u8) = (0: u8); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_1_converted_bytes), (#_mkRepeatedArray returning Array)((0: u8)))); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusLeBytes returning Vector)()), (32: u32))); - let p = («std-1.0.0-beta.14»::field::from_le_bytes<32: u32> as λ(Array) -> Field)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); - (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); - let p_bytes = («std-1.0.0-beta.14»::field::to_le_bytes<32: u32> as λ(Field) -> Array)((0: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bytes, (#_mkRepeatedArray returning Array)((0: u8)))); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::from_le_bits(bits: Array) -> Field := { - (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBits returning Vector)())), "N must be less than or equal to modulus_le_bits().len()"); - let v = (#_ref returning & Field)((1: Field)); - let result = (#_ref returning & Field)((0: Field)); - for i in (0: u32) .. uConst!(N: u32) do { - result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u1)(bits, (#_cast returning u32)(i))), (#_readRef returning Field)(v))); - v = (#_fMul returning Field)((#_readRef returning Field)(v), (2: Field)); - #_skip - }; - (#_readRef returning Field)(result) -} - -noir_def «std-1.0.0-beta.14»::field::tests::from_be_bits(bits: Array) -> Field := { - let v = (#_ref returning & Field)((1: Field)); - let result = (#_ref returning & Field)((0: Field)); - for i in (0: u32) .. uConst!(N: u32) do { - result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u1)(bits, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))), (#_readRef returning Field)(v))); - v = (#_fMul returning Field)((#_readRef returning Field)(v), (2: Field)); - #_skip - }; - (#_readRef returning Field)(result) -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_from_be_bits_bn254_edge_cases<>() -> Unit := { - if («std-1.0.0-beta.14»::compat::is_bn254<> as λ() -> bool)() then { - let p_minus_1_bits = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBits returning Vector)())); - (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u1)((#_readRef returning Array)(p_minus_1_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (1: u32)))), (0: u1))); - { - let i_3496 = (#_uSub returning u32)((254: u32), (1: u32)); - (p_minus_1_bits[i_3496]: u1) = (#_uSub returning u1)((#_arrayIndex returning u1)((#_readRef returning Array)(p_minus_1_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (1: u32)))), (1: u1)); - #_skip - }; - let p_minus_1 = («std-1.0.0-beta.14»::field::tests::from_be_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bits)); - (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); - let p_minus_1_converted_bits = («std-1.0.0-beta.14»::field::to_be_bits<254: u32> as λ(Field) -> Array)(p_minus_1); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bits, (#_readRef returning Array)(p_minus_1_bits))); - let p_plus_4_bits = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBits returning Vector)())); - (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u1)((#_readRef returning Array)(p_plus_4_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (3: u32)))), (1: u1))); - { - let i_3500 = (#_uSub returning u32)((254: u32), (3: u32)); - (p_plus_4_bits[i_3500]: u1) = (#_uAdd returning u1)((#_arrayIndex returning u1)((#_readRef returning Array)(p_plus_4_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (3: u32)))), (1: u1)); - #_skip - }; - let p_plus_4 = («std-1.0.0-beta.14»::field::tests::from_be_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_4_bits)); - (#_assert returning Unit)((#_fEq returning bool)(p_plus_4, (4: Field))); - let p_plus_4_converted_bits = (#_ref returning & Array)((«std-1.0.0-beta.14»::field::to_be_bits<254: u32> as λ(Field) -> Array)(p_plus_4)); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u1)((#_readRef returning Array)(p_plus_4_converted_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (3: u32)))), (1: u1))); - { - let i_3503 = (#_uSub returning u32)((254: u32), (3: u32)); - (p_plus_4_converted_bits[i_3503]: u1) = (0: u1); - #_skip - }; - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_4_converted_bits), (#_mkRepeatedArray returning Array)((0: u1)))); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusBeBits returning Vector)()), (254: u32))); - let p = («std-1.0.0-beta.14»::field::tests::from_be_bits<254: u32> as λ(Array) -> Field)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBits returning Vector)())); - (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); - let p_bits = («std-1.0.0-beta.14»::field::to_be_bits<254: u32> as λ(Field) -> Array)((0: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bits, (#_mkRepeatedArray returning Array)((0: u1)))); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::field::tests::test_to_from_le_bits_bn254_edge_cases<>() -> Unit := { - if («std-1.0.0-beta.14»::compat::is_bn254<> as λ() -> bool)() then { - let p_minus_1_bits = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBits returning Vector)())); - (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u1)((#_readRef returning Array)(p_minus_1_bits), (0: u32)), (0: u1))); - (p_minus_1_bits[(0: u32)]: u1) = (#_uSub returning u1)((#_arrayIndex returning u1)((#_readRef returning Array)(p_minus_1_bits), (0: u32)), (1: u1)); - let p_minus_1 = («std-1.0.0-beta.14»::field::tests::from_le_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bits)); - (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); - let p_minus_1_converted_bits = («std-1.0.0-beta.14»::field::to_le_bits<254: u32> as λ(Field) -> Array)(p_minus_1); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bits, (#_readRef returning Array)(p_minus_1_bits))); - let p_plus_4_bits = (#_ref returning & Array)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBits returning Vector)())); - (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u1)((#_readRef returning Array)(p_plus_4_bits), (2: u32)), (1: u1))); - (p_plus_4_bits[(2: u32)]: u1) = (#_uAdd returning u1)((#_arrayIndex returning u1)((#_readRef returning Array)(p_plus_4_bits), (2: u32)), (1: u1)); - let p_plus_4 = («std-1.0.0-beta.14»::field::tests::from_le_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_4_bits)); - (#_assert returning Unit)((#_fEq returning bool)(p_plus_4, (4: Field))); - let p_plus_4_converted_bits = (#_ref returning & Array)((«std-1.0.0-beta.14»::field::to_le_bits<254: u32> as λ(Field) -> Array)(p_plus_4)); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u1)((#_readRef returning Array)(p_plus_4_converted_bits), (2: u32)), (1: u1))); - (p_plus_4_converted_bits[(2: u32)]: u1) = (0: u1); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_4_converted_bits), (#_mkRepeatedArray returning Array)((0: u1)))); - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusLeBits returning Vector)()), (254: u32))); - let p = («std-1.0.0-beta.14»::field::tests::from_le_bits<254: u32> as λ(Array) -> Field)((«std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBits returning Vector)())); - (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); - let p_bits = («std-1.0.0-beta.14»::field::to_le_bits<254: u32> as λ(Field) -> Array)((0: Field)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bits, (#_mkRepeatedArray returning Array)((0: u1)))); - #_skip - } -} - -def «std-1.0.0-beta.14».Field.Mod.env : Env := Env.mk - [«std-1.0.0-beta.14::field::assert_max_bit_size», «std-1.0.0-beta.14::field::to_le_bits», «std-1.0.0-beta.14::field::to_be_bits», «std-1.0.0-beta.14::field::to_le_bytes», «std-1.0.0-beta.14::field::to_be_bytes», «std-1.0.0-beta.14::field::to_le_radix», «std-1.0.0-beta.14::field::to_be_radix», «std-1.0.0-beta.14::field::pow_32», «std-1.0.0-beta.14::field::sgn0», «std-1.0.0-beta.14::field::lt», «std-1.0.0-beta.14::field::from_le_bytes», «std-1.0.0-beta.14::field::from_be_bytes», «std-1.0.0-beta.14::field::__field_less_than», «std-1.0.0-beta.14::field::field_less_than», «std-1.0.0-beta.14::field::bytes32_to_field», «std-1.0.0-beta.14::field::lt_fallback», «std-1.0.0-beta.14::field::tests::test_to_be_bits», «std-1.0.0-beta.14::field::tests::test_to_le_bits», «std-1.0.0-beta.14::field::tests::test_to_be_bytes», «std-1.0.0-beta.14::field::tests::test_to_le_bytes», «std-1.0.0-beta.14::field::tests::test_to_be_radix», «std-1.0.0-beta.14::field::tests::test_to_le_radix», «std-1.0.0-beta.14::field::tests::test_to_le_radix_1», «std-1.0.0-beta.14::field::tests::test_to_le_radix_brillig_1», «std-1.0.0-beta.14::field::tests::test_to_le_radix_3», «std-1.0.0-beta.14::field::tests::test_to_le_radix_brillig_3», «std-1.0.0-beta.14::field::tests::test_to_le_radix_512», «std-1.0.0-beta.14::field::tests::not_enough_limbs_brillig», «std-1.0.0-beta.14::field::tests::not_enough_limbs», «std-1.0.0-beta.14::field::tests::test_field_less_than», «std-1.0.0-beta.14::field::tests::test_large_field_values_unconstrained», «std-1.0.0-beta.14::field::tests::test_large_field_values», «std-1.0.0-beta.14::field::tests::test_decomposition_edge_cases», «std-1.0.0-beta.14::field::tests::test_pow_32», «std-1.0.0-beta.14::field::tests::test_sgn0», «std-1.0.0-beta.14::field::tests::test_bit_decomposition_overflow», «std-1.0.0-beta.14::field::tests::test_byte_decomposition_overflow», «std-1.0.0-beta.14::field::tests::test_to_from_be_bytes_bn254_edge_cases», «std-1.0.0-beta.14::field::tests::test_to_from_le_bytes_bn254_edge_cases», «std-1.0.0-beta.14::field::tests::from_le_bits», «std-1.0.0-beta.14::field::tests::from_be_bits», «std-1.0.0-beta.14::field::tests::test_to_from_be_bits_bn254_edge_cases», «std-1.0.0-beta.14::field::tests::test_to_from_le_bits_bn254_edge_cases»] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/GeneratedTypes.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/GeneratedTypes.lean deleted file mode 100644 index 8b70d0c6..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/GeneratedTypes.lean +++ /dev/null @@ -1,225 +0,0 @@ --- Generated by lampe - -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_struct_def «std-1.0.0-beta.14»::collections::map::Slot { - K, - V, - bool, - bool, -} - -noir_struct_def «std-1.0.0-beta.14»::collections::map::HashMap { - Array<«std-1.0.0-beta.14»::collections::map::Slot, N: u32>, - u32, - B, -} - -noir_struct_def «std-1.0.0-beta.14»::collections::umap::Slot { - K, - V, - bool, - bool, -} - -noir_struct_def «std-1.0.0-beta.14»::collections::umap::UHashMap { - Vector<«std-1.0.0-beta.14»::collections::umap::Slot >, - u32, - B, -} - -noir_struct_def «std-1.0.0-beta.14»::hash::BuildHasherDefault {} - -noir_struct_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> { - Field, - Field, - bool, -} - -noir_struct_def «std-1.0.0-beta.14»::option::Option { - bool, - T, -} - -noir_struct_def «std-1.0.0-beta.14»::array::check_shuffle::test::CompoundStruct<> { - bool, - Field, - u64, -} - -noir_struct_def «std-1.0.0-beta.14»::«meta»::tests::MyOtherStruct<> { - u32, -} - -noir_struct_def «std-1.0.0-beta.14»::«meta»::tests::Bar<> { - Field, - Array, -} - -noir_struct_def «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<> { - Field, - Field, -} - -noir_struct_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp<> { - Field, -} - -noir_struct_def «std-1.0.0-beta.14»::collections::vec::Vec { - Vector, -} - -noir_struct_def «std-1.0.0-beta.14»::cmp::Ordering<> { - Field, -} - -noir_struct_def «std-1.0.0-beta.14»::«meta»::tests::MyStruct<> { - i32, -} - -noir_struct_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<> { - Vector, -} - -noir_struct_def «std-1.0.0-beta.14»::«meta»::op::UnaryOp<> { - Field, -} - -noir_struct_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<> { - Array, - Array, - u32, - bool, -} - -noir_struct_def «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec { - Array, - u32, -} - -noir_type_alias «std-1.0.0-beta.14»::«meta»::DeriveFunction<> := λ(Unit) -> Unit; - -noir_struct_def «std-1.0.0-beta.14»::test::OracleMock<> { - Field, -} - -noir_trait_def «std-1.0.0-beta.14»::append::Append<> [] := { - method empty<>() -> Self; - method append<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::cmp::Eq<> [] := { - method eq<>(Self, Self) -> bool; -} - -noir_trait_def «std-1.0.0-beta.14»::cmp::Ord<> [] := { - method cmp<>(Self, Self) -> «std-1.0.0-beta.14»::cmp::Ordering<>; -} - -noir_trait_def «std-1.0.0-beta.14»::convert::AsPrimitive [] := { - method as_<>(Self) -> T; -} - -noir_trait_def «std-1.0.0-beta.14»::convert::From [] := { - method «from»<>(T) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::convert::Into [] := { - method into<>(Self) -> T; -} - -noir_trait_def «std-1.0.0-beta.14»::default::Default<> [] := { - method default<>() -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::hash::BuildHasher<> [H: Type] := { - method build_hasher<>(Self) -> H; -} - -noir_trait_def «std-1.0.0-beta.14»::hash::Hash<> [] := { - method hash(Self, & H) -> Unit; -} - -noir_trait_def «std-1.0.0-beta.14»::hash::Hasher<> [] := { - method finish<>(Self) -> Field; - method write<>(& Self, Field) -> Unit; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::Add<> [] := { - method add<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::Div<> [] := { - method div<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::Mul<> [] := { - method mul<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::Neg<> [] := { - method neg<>(Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::Rem<> [] := { - method rem<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::Sub<> [] := { - method sub<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> [] := { - method wrapping_add<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::WrappingMul<> [] := { - method wrapping_mul<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::arith::WrappingSub<> [] := { - method wrapping_sub<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::bit::BitAnd<> [] := { - method bitand<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::bit::BitOr<> [] := { - method bitor<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::bit::BitXor<> [] := { - method bitxor<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::bit::Not<> [] := { - method not<>(Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::bit::Shl<> [] := { - method shl<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::ops::bit::Shr<> [] := { - method shr<>(Self, Self) -> Self; -} - -noir_trait_def «std-1.0.0-beta.14»::panic::StringLike<> [] := {} - -noir_trait_def «std-1.0.0-beta.14»::«meta»::ctstring::AsCtString<> [] := { - method as_ctstring<>(Self) -> Unit; -} - -noir_trait_def «std-1.0.0-beta.14»::«meta»::tests::DoNothing<> [] := { - method do_nothing<>(Self) -> Unit; -} - -noir_trait_def «std-1.0.0-beta.14»::«meta»::tests::FieldCount<> [] := { - method field_count<>() -> u32; -} - diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Mod.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Mod.lean deleted file mode 100644 index 232b4ce8..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Mod.lean +++ /dev/null @@ -1,279 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -[[deprecated "This function has been moved to std::hash::keccakf1600"]] -noir_def «std-1.0.0-beta.14»::hash::keccak::keccakf1600<>(input: Array) -> Array := { - (#_keccakf1600 returning Array)(input) -} - -noir_def «std-1.0.0-beta.14»::hash::blake3(input: Array) -> Array := { - if (#_isUnconstrained returning bool)() then { - (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (1024: u32)), "Barretenberg cannot prove blake3 hashes with inputs larger than 1024 bytes"); - #_skip - }; - (#_blake3 returning Array)(input) -} - -noir_def «std-1.0.0-beta.14»::hash::pedersen_commitment(input: Array) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - («std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(input, (0: u32)) -} - -noir_def «std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator(input: Array, separator: u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> := { - let points = (#_ref returning & Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>)((#_mkRepeatedArray returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>)((#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)))); - for i in (0: u32) .. uConst!(N: u32) do { - (points[i]: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>) = («std-1.0.0-beta.14»::hash::from_field_unsafe<> as λ(Field) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)((#_arrayIndex returning Field)(input, (#_cast returning u32)(i))); - #_skip - }; - let generators = («std-1.0.0-beta.14»::hash::derive_generators as λ(Array, u32) -> Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>)((#_strAsBytes returning Array)("DEFAULT_DOMAIN_SEPARATOR"), separator); - («std-1.0.0-beta.14»::embedded_curve_ops::multi_scalar_mul as λ(Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>, Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(generators, (#_readRef returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>)(points)) -} - -noir_def «std-1.0.0-beta.14»::hash::pedersen_hash(input: Array) -> Field := { - («std-1.0.0-beta.14»::hash::pedersen_hash_with_separator as λ(Array, u32) -> Field)(input, (0: u32)) -} - -noir_def «std-1.0.0-beta.14»::hash::pedersen_hash_with_separator(input: Array, separator: u32) -> Field := { - let scalars = (#_ref returning & Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, (N + 1): u32>)((#_mkRepeatedArray returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, (N + 1): u32>)((#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)))); - let generators = (#_ref returning & Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, (N + 1): u32>)((#_mkRepeatedArray returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, (N + 1): u32>)((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)())); - (#_assertConstant returning Unit)(separator); - let domain_generators = («std-1.0.0-beta.14»::hash::derive_generators as λ(Array, u32) -> Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>)((#_strAsBytes returning Array)("DEFAULT_DOMAIN_SEPARATOR"), separator); - for i in (0: u32) .. uConst!(N: u32) do { - (scalars[i]: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>) = («std-1.0.0-beta.14»::hash::from_field_unsafe<> as λ(Field) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)((#_arrayIndex returning Field)(input, (#_cast returning u32)(i))); - (generators[i]: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) = (#_arrayIndex returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(domain_generators, (#_cast returning u32)(i)); - #_skip - }; - (scalars[uConst!(N: u32)]: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>) = (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)((#_cast returning Field)(uConst!(N: u32)), (#_cast returning Field)((0: Field))); - let length_generator = («std-1.0.0-beta.14»::hash::derive_generators<1: u32, 20: u32> as λ(Array, u32) -> Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)((#_strAsBytes returning Array)("pedersen_hash_length"), (0: u32)); - (generators[uConst!(N: u32)]: «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) = (#_arrayIndex returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)(length_generator, (0: u32)); - (#_arrayIndex returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_multiScalarMul returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)((#_readRef returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, (N + 1): u32>)(generators), (#_readRef returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>, (N + 1): u32>)(scalars), #_true), (0: u32)).0 -} - -noir_def «std-1.0.0-beta.14»::hash::derive_generators(domain_separator_bytes: Array, starting_index: u32) -> Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32> := { - (#_assertConstant returning Unit)(domain_separator_bytes); - (#_assertConstant returning Unit)(starting_index); - (#_derivePedersenGenerators returning Array<«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>)(domain_separator_bytes, starting_index) -} - -noir_def «std-1.0.0-beta.14»::hash::from_field_unsafe<>(scalar: Field) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<> := { - let (xlo, xhi) = { - («std-1.0.0-beta.14»::field::bn254::decompose_hint<> as λ(Field) -> Tuple)(scalar) - }; - (#_assert returning Unit)((#_fEq returning bool)(scalar, (#_fAdd returning Field)(xlo, (#_fMul returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), xhi)))); - let (a, b) = if (#_fEq returning bool)(xhi, («std-1.0.0-beta.14»::field::bn254::PHI<> as λ() -> Field)()) then { - (#_makeData returning Tuple)(xlo, («std-1.0.0-beta.14»::field::bn254::PLO<> as λ() -> Field)()) - } else { - (#_makeData returning Tuple)(xhi, («std-1.0.0-beta.14»::field::bn254::PHI<> as λ() -> Field)()) - }; - («std-1.0.0-beta.14»::field::bn254::assert_lt<> as λ(Field, Field) -> Unit)(a, b); - (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurveScalar<>)(xlo, xhi) -} - -noir_def «std-1.0.0-beta.14»::hash::poseidon2_permutation(input: Array, state_len: u32) -> Array := { - (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(input), state_len)); - (#_poseidon2Permutation returning Array)(input) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_2] «std-1.0.0-beta.14»::hash::BuildHasher<> for «std-1.0.0-beta.14»::hash::BuildHasherDefault where [H: «std-1.0.0-beta.14»::hash::Hasher<>, H: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def build_hasher<>(_self: «std-1.0.0-beta.14»::hash::BuildHasherDefault) -> H := { - ((H as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> H)() - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_3] «std-1.0.0-beta.14»::default::Default<> for «std-1.0.0-beta.14»::hash::BuildHasherDefault where [H: «std-1.0.0-beta.14»::hash::Hasher<>, H: «std-1.0.0-beta.14»::default::Default<>] := { - noir_def default<>() -> «std-1.0.0-beta.14»::hash::BuildHasherDefault := { - (#_makeData returning «std-1.0.0-beta.14»::hash::BuildHasherDefault)() - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_4]<> «std-1.0.0-beta.14»::hash::Hash<> for Field where [] := { - noir_def hash(self: Field, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, self); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_5]<> «std-1.0.0-beta.14»::hash::Hash<> for u1 where [] := { - noir_def hash(self: u1, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_6]<> «std-1.0.0-beta.14»::hash::Hash<> for u8 where [] := { - noir_def hash(self: u8, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_7]<> «std-1.0.0-beta.14»::hash::Hash<> for u16 where [] := { - noir_def hash(self: u16, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_8]<> «std-1.0.0-beta.14»::hash::Hash<> for u32 where [] := { - noir_def hash(self: u32, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_9]<> «std-1.0.0-beta.14»::hash::Hash<> for u64 where [] := { - noir_def hash(self: u64, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_10]<> «std-1.0.0-beta.14»::hash::Hash<> for u128 where [] := { - noir_def hash(self: u128, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_11]<> «std-1.0.0-beta.14»::hash::Hash<> for i8 where [] := { - noir_def hash(self: i8, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u8)(self))); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_12]<> «std-1.0.0-beta.14»::hash::Hash<> for i16 where [] := { - noir_def hash(self: i16, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u16)(self))); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_13]<> «std-1.0.0-beta.14»::hash::Hash<> for i32 where [] := { - noir_def hash(self: i32, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u32)(self))); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_14]<> «std-1.0.0-beta.14»::hash::Hash<> for i64 where [] := { - noir_def hash(self: i64, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u64)(self))); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_15]<> «std-1.0.0-beta.14»::hash::Hash<> for bool where [] := { - noir_def hash(self: bool, state: & H) -> Unit := { - ((H as «std-1.0.0-beta.14»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_16]<> «std-1.0.0-beta.14»::hash::Hash<> for Unit where [] := { - noir_def hash(_self: Unit, _state: & H) -> Unit := { - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_17] «std-1.0.0-beta.14»::hash::Hash<> for Array where [T: «std-1.0.0-beta.14»::hash::Hash<>] := { - noir_def hash(self: Array, state: & H) -> Unit := { - let ζi0 = self; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let elem = (#_arrayIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); - { - ((T as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(T, & H) -> Unit)(elem, state); - #_skip - } - }; - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_18] «std-1.0.0-beta.14»::hash::Hash<> for Vector where [T: «std-1.0.0-beta.14»::hash::Hash<>] := { - noir_def hash(self: Vector, state: & H) -> Unit := { - ((u32 as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(u32, & H) -> Unit)((#_arrayLen returning u32)(self), state); - { - let ζi0 = self; - for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { - let elem = (#_vectorIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); - { - ((T as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(T, & H) -> Unit)(elem, state); - #_skip - } - }; - #_skip - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_19] «std-1.0.0-beta.14»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.14»::hash::Hash<>, B: «std-1.0.0-beta.14»::hash::Hash<>] := { - noir_def hash(self: Tuple, state: & H) -> Unit := { - ((A as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); - ((B as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_20] «std-1.0.0-beta.14»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.14»::hash::Hash<>, B: «std-1.0.0-beta.14»::hash::Hash<>, C: «std-1.0.0-beta.14»::hash::Hash<>] := { - noir_def hash(self: Tuple, state: & H) -> Unit := { - ((A as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); - ((B as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); - ((C as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_21] «std-1.0.0-beta.14»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.14»::hash::Hash<>, B: «std-1.0.0-beta.14»::hash::Hash<>, C: «std-1.0.0-beta.14»::hash::Hash<>, D: «std-1.0.0-beta.14»::hash::Hash<>] := { - noir_def hash(self: Tuple, state: & H) -> Unit := { - ((A as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); - ((B as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); - ((C as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); - ((D as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_22] «std-1.0.0-beta.14»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.14»::hash::Hash<>, B: «std-1.0.0-beta.14»::hash::Hash<>, C: «std-1.0.0-beta.14»::hash::Hash<>, D: «std-1.0.0-beta.14»::hash::Hash<>, E: «std-1.0.0-beta.14»::hash::Hash<>] := { - noir_def hash(self: Tuple, state: & H) -> Unit := { - ((A as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); - ((B as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); - ((C as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); - ((D as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); - ((E as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); - #_skip - }; -} - -noir_def «std-1.0.0-beta.14»::hash::assert_pedersen<>() -> Unit := { - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<1: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field)), (1: u32)), (-9563966249275741675388072609438711537348680428347819854678797696612266004386: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<1: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field)), (1: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((2393473289045184898987089634332637236754766663897650125720167164137088869378: Field), (-7135402912423807765050323395026152633898511180575289670895350565966806597339: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<2: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field)), (2: u32)), (-4514641934080458214240751313245257091597283372119704256508270041112972328364: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<2: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field)), (2: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((-1005469533000889117657666498472954572857833872027279582301287737791321798830: Field), (-197930408253518363600434091261593976805802346006803044607495721019065268361: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<3: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field)), (3: u32)), (5326303462429251635333445553787815334884504473158538697533567972354818497508: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<3: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field)), (3: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((-7445492827528947374509602945629683494533192071041804482180938699494227714940: Field), (-346969586742294743999106690738565516862306986837138292504091779330690805808: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<4: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field)), (4: u32)), (386725976317305842536127973743796063021078557104668993698335256486699462108: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<4: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field)), (4: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((3474050104565946163748262682994355436071725368663608454945085151569694677961: Field), (4969143737471383592015577254419974288705429190161323890019554309538525237268: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<5: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field)), (5: u32)), (445627510378474786942205982382342880084933256779806571759234109296077544482: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<5: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field)), (5: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((10552833461612204383225982278685649771700648236894998952452362214619168226089: Field), (-1251131729610909206337824637802607977413231765663205492654376476649374713610: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<6: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field)), (6: u32)), (10217545977856619241380062255630350521414270790482717416408002401121937565042: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<6: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field)), (6: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((11335069702571578236117888955050736139682779524214984889155721704928197387927: Field), (-7733361908666485801415200275635877656445756448956549185022038133647049615622: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<7: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field)), (7: u32)), (8389099894375185114295483291630893019224023442848409888108611454294869536227: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<7: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field)), (7: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((601182919381464537093882307577577658521785998356796832152269409048770009401: Field), (-8704984668101593449807889537070046830501821124601109099832679891796819531525: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<8: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field)), (8: u32)), (-364414833671337260860436705614307386127212237115043515297237560718972836517: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<8: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field)), (8: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((10105395258059943854471547573391327707179901153940064586773125525172385465411: Field), (-7764172381957047914625405480055519449068901615240110013280942913930205438090: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<9: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field)), (9: u32)), (5694292929090063810102755351119629986122166830204542196709417013467308391399: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<9: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field)), (9: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((4630760469979870165820917922898436050077118370325830990580986530746633543789: Field), (445421188486227550820408419830973545028032672242093648088931561027838255858: Field), #_false))); - (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.14»::hash::pedersen_hash_with_separator<10: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field), (10: Field)), (10: u32)), (-1612865150156425111011383725280441289912228955196006102547487828548180279661: Field))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.14»::hash::pedersen_commitment_with_separator<10: u32> as λ(Array, u32) -> «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field), (10: Field)), (10: u32)), (#_makeData returning «std-1.0.0-beta.14»::embedded_curve_ops::EmbeddedCurvePoint<>)((-311556882567474412576811669014419164866085063813982345701073780395111226613: Field), (-163948955461070038478898748306472919392980231474444415480716967232318545340: Field), #_false))); - #_skip -} - -def «std-1.0.0-beta.14».Hash.Mod.env : Env := Env.mk - [«std-1.0.0-beta.14::hash::blake3», «std-1.0.0-beta.14::hash::pedersen_commitment», «std-1.0.0-beta.14::hash::pedersen_commitment_with_separator», «std-1.0.0-beta.14::hash::pedersen_hash», «std-1.0.0-beta.14::hash::pedersen_hash_with_separator», «std-1.0.0-beta.14::hash::derive_generators», «std-1.0.0-beta.14::hash::from_field_unsafe», «std-1.0.0-beta.14::hash::poseidon2_permutation», «std-1.0.0-beta.14::hash::assert_pedersen»] - [«std-1.0.0-beta.14».impl_2, «std-1.0.0-beta.14».impl_3, «std-1.0.0-beta.14».impl_4, «std-1.0.0-beta.14».impl_5, «std-1.0.0-beta.14».impl_6, «std-1.0.0-beta.14».impl_7, «std-1.0.0-beta.14».impl_8, «std-1.0.0-beta.14».impl_9, «std-1.0.0-beta.14».impl_10, «std-1.0.0-beta.14».impl_11, «std-1.0.0-beta.14».impl_12, «std-1.0.0-beta.14».impl_13, «std-1.0.0-beta.14».impl_14, «std-1.0.0-beta.14».impl_15, «std-1.0.0-beta.14».impl_16, «std-1.0.0-beta.14».impl_17, «std-1.0.0-beta.14».impl_18, «std-1.0.0-beta.14».impl_19, «std-1.0.0-beta.14».impl_20, «std-1.0.0-beta.14».impl_21, «std-1.0.0-beta.14».impl_22] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Poseidon2.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Poseidon2.lean deleted file mode 100644 index b793518e..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hash/Poseidon2.lean +++ /dev/null @@ -1,100 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_global_def «std-1.0.0-beta.14»::hash::poseidon2::RATE: u32 = (3: u32); - -noir_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::hash(input: Array, message_size: u32) -> Field := { - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::hash_internal as λ(Array, u32, bool) -> Field)(input, message_size, (#_uNeq returning bool)(message_size, uConst!(N: u32))) -} - -noir_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::new<>(iv: Field) -> «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<> := { - let result = (#_ref returning & «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)((#_makeData returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)((#_mkRepeatedArray returning Array)((0: Field)), (#_mkRepeatedArray returning Array)((0: Field)), (0: u32), #_false)); - ((result.1: Array)[(«std-1.0.0-beta.14»::hash::poseidon2::RATE<> as λ() -> u32)()]: Field) = iv; - (#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(result) -} - -noir_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::perform_duplex<>(self: & «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>) -> Unit := { - for i in (0: u32) .. («std-1.0.0-beta.14»::hash::poseidon2::RATE<> as λ() -> u32)() do { - if (#_uLt returning bool)(i, (#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).2) then { - (((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>).1: Array)[i]: Field) = (#_fAdd returning Field)((#_arrayIndex returning Field)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).1, (#_cast returning u32)(i)), (#_arrayIndex returning Field)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).0, (#_cast returning u32)(i))); - #_skip - } - }; - ((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>).1: Array) = (#_poseidon2Permutation returning Array)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).1); - #_skip -} - -noir_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::absorb<>(self: & «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>, input: Field) -> Unit := { - (#_assert returning Unit)((#_bNot returning bool)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).3)); - if (#_uEq returning bool)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).2, («std-1.0.0-beta.14»::hash::poseidon2::RATE<> as λ() -> u32)()) then { - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::perform_duplex<> as λ(& «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>) -> Unit)(self); - (((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>).0: Array)[(0: u32)]: Field) = input; - ((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>).2: u32) = (1: u32); - #_skip - } else { - { - let i_2755 = (#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).2; - (((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>).0: Array)[i_2755]: Field) = input; - #_skip - }; - ((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>).2: u32) = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).2, (1: u32)); - #_skip - } -} - -noir_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::squeeze<>(self: & «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>) -> Field := { - (#_assert returning Unit)((#_bNot returning bool)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).3)); - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::perform_duplex<> as λ(& «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>) -> Unit)(self); - ((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>).3: bool) = #_true; - (#_arrayIndex returning Field)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(self).1, (0: u32)) -} - -noir_def «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::hash_internal(input: Array, in_len: u32, is_variable_length: bool) -> Field := { - let two_pow_64 = (18446744073709551616: Field); - let iv = (#_fMul returning Field)((#_cast returning Field)(in_len), two_pow_64); - let sponge = (#_ref returning & «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)((«std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::new<> as λ(Field) -> «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(iv)); - for i in (0: u32) .. (#_arrayLen returning u32)(input) do { - if (#_uLt returning bool)(i, in_len) then { - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::absorb<> as λ(& «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>, Field) -> Unit)(sponge, (#_arrayIndex returning Field)(input, (#_cast returning u32)(i))); - #_skip - } - }; - if is_variable_length then { - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::absorb<> as λ(& «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>, Field) -> Unit)(sponge, (1: Field)); - #_skip - }; - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::squeeze<> as λ(& «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>) -> Field)(sponge) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_0]<> «std-1.0.0-beta.14»::hash::Hasher<> for «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<> where [] := { - noir_def finish<>(self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<>) -> Field := { - let iv = (#_fMul returning Field)((#_cast returning Field)((#_arrayLen returning u32)(self.0)), (18446744073709551616: Field)); - let sponge = (#_ref returning & «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)((«std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::new<> as λ(Field) -> «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>)(iv)); - for i in (0: u32) .. (#_arrayLen returning u32)(self.0) do { - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::absorb<> as λ(& «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>, Field) -> Unit)(sponge, (#_vectorIndex returning Field)(self.0, (#_cast returning u32)(i))); - #_skip - }; - («std-1.0.0-beta.14»::hash::poseidon2::Poseidon2::squeeze<> as λ(& «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2<>) -> Field)(sponge) - }; - - noir_def write<>(self: & «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<>, input: Field) -> Unit := { - ((*self: «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<>).0: Vector) = (#_vectorPushBack returning Vector)((#_readRef returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<>)(self).0, input); - #_skip - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_1]<> «std-1.0.0-beta.14»::default::Default<> for «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<> where [] := { - noir_def default<>() -> «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<> := { - (#_makeData returning «std-1.0.0-beta.14»::hash::poseidon2::Poseidon2Hasher<>)((#_asVector returning Vector)((#_mkArray returning Array)())) - }; -} - -def «std-1.0.0-beta.14».Hash.Poseidon2.env : Env := Env.mk - [«std-1.0.0-beta.14::hash::poseidon2::RATE», «std-1.0.0-beta.14::hash::poseidon2::Poseidon2::hash», «std-1.0.0-beta.14::hash::poseidon2::Poseidon2::new», «std-1.0.0-beta.14::hash::poseidon2::Poseidon2::perform_duplex», «std-1.0.0-beta.14::hash::poseidon2::Poseidon2::absorb», «std-1.0.0-beta.14::hash::poseidon2::Poseidon2::squeeze», «std-1.0.0-beta.14::hash::poseidon2::Poseidon2::hash_internal»] - [«std-1.0.0-beta.14».impl_0, «std-1.0.0-beta.14».impl_1] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hint.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hint.lean deleted file mode 100644 index 0294f3f4..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Hint.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Hint.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Mem.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Mem.lean deleted file mode 100644 index 1401bed2..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Mem.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Mem.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Ctstring.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Ctstring.lean deleted file mode 100644 index 5736ffac..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Ctstring.lean +++ /dev/null @@ -1,28 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_292] «std-1.0.0-beta.14»::«meta»::ctstring::AsCtString<> for String where [] := { - noir_def as_ctstring<>(self: String) -> Unit := { - (#_strAsCtstring returning Unit)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_293] «std-1.0.0-beta.14»::«meta»::ctstring::AsCtString<> for FmtString where [] := { - noir_def as_ctstring<>(self: FmtString) -> Unit := { - (#_fmtstrAsCtstring returning Unit)(self) - }; -} - -noir_def «std-1.0.0-beta.14»::«meta»::ctstring::test::as_quoted_str_example<>() -> Unit := { - #_unit -} - -def «std-1.0.0-beta.14».Meta.Ctstring.env : Env := Env.mk - [«std-1.0.0-beta.14::meta::ctstring::test::as_quoted_str_example»] - [«std-1.0.0-beta.14».impl_292, «std-1.0.0-beta.14».impl_293] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Expr.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Expr.lean deleted file mode 100644 index 234f2d8f..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Expr.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.Expr.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FormatString.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FormatString.lean deleted file mode 100644 index 796a755a..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FormatString.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.FormatString.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FunctionDef.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FunctionDef.lean deleted file mode 100644 index 6496c78e..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/FunctionDef.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.FunctionDef.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Mod.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Mod.lean deleted file mode 100644 index f7b2cf8c..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Mod.lean +++ /dev/null @@ -1,44 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::«meta»::tests::returning_versus_macro_insertion<>() -> Unit := { - #_unit -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_431]<> «std-1.0.0-beta.14»::«meta»::tests::FieldCount<> for «std-1.0.0-beta.14»::«meta»::tests::Bar<> where [] := { - noir_def field_count<>() -> u32 := { - (2: u32) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_314]<> «std-1.0.0-beta.14»::«meta»::tests::DoNothing<> for «std-1.0.0-beta.14»::«meta»::tests::Bar<> where [] := { - noir_def do_nothing<>(__0: «std-1.0.0-beta.14»::«meta»::tests::Bar<>) -> Unit := { - #_skip - }; -} - -noir_def «std-1.0.0-beta.14»::«meta»::tests::concatenate_test<>() -> Unit := { - #_unit -} - -noir_def «std-1.0.0-beta.14»::«meta»::tests::remove_unused_warnings<>() -> Unit := { - let __0 = (#_makeData returning «std-1.0.0-beta.14»::«meta»::tests::Bar<>)((1: Field), (#_mkArray returning Array)((2: Field), (3: Field))); - let __1 = (#_makeData returning «std-1.0.0-beta.14»::«meta»::tests::MyStruct<>)((1: i32)); - let __3 = (#_makeData returning «std-1.0.0-beta.14»::«meta»::tests::MyOtherStruct<>)((2: u32)); - let __7 = («std-1.0.0-beta.14»::«meta»::tests::derive_do_nothing<> as λ(Unit) -> Unit)((«std-1.0.0-beta.14»::panic::panic, Unit> as λ(String<0: u32>) -> Unit)("")); - let __15 = («std-1.0.0-beta.14»::«meta»::tests::derive_do_nothing_alt<> as λ(Unit) -> Unit)((«std-1.0.0-beta.14»::panic::panic, Unit> as λ(String<0: u32>) -> Unit)("")); - if #_false then { - («std-1.0.0-beta.14»::«meta»::tests::remove_unused_warnings<> as λ() -> Unit)(); - #_skip - } -} - -def «std-1.0.0-beta.14».Meta.Mod.env : Env := Env.mk - [«std-1.0.0-beta.14::meta::tests::returning_versus_macro_insertion», «std-1.0.0-beta.14::meta::tests::concatenate_test», «std-1.0.0-beta.14::meta::tests::remove_unused_warnings»] - [«std-1.0.0-beta.14».impl_431, «std-1.0.0-beta.14».impl_314] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Module.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Module.lean deleted file mode 100644 index a081a60a..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Module.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.Module.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Op.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Op.lean deleted file mode 100644 index bcbf3d50..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Op.lean +++ /dev/null @@ -1,118 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_300]<> «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::«meta»::op::UnaryOp<> where [] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::«meta»::op::UnaryOp<>, other: «std-1.0.0-beta.14»::«meta»::op::UnaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, other.0) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_301]<> «std-1.0.0-beta.14»::hash::Hash<> for «std-1.0.0-beta.14»::«meta»::op::UnaryOp<> where [] := { - noir_def hash(self: «std-1.0.0-beta.14»::«meta»::op::UnaryOp<>, h: & H) -> Unit := { - ((Field as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, h); - #_skip - }; -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::UnaryOp::is_minus<>(self: «std-1.0.0-beta.14»::«meta»::op::UnaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (0: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::UnaryOp::is_not<>(self: «std-1.0.0-beta.14»::«meta»::op::UnaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (1: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::UnaryOp::is_mutable_reference<>(self: «std-1.0.0-beta.14»::«meta»::op::UnaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (2: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::UnaryOp::is_dereference<>(self: «std-1.0.0-beta.14»::«meta»::op::UnaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (3: Field)) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_302]<> «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::«meta»::op::BinaryOp<> where [] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>, other: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, other.0) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_303]<> «std-1.0.0-beta.14»::hash::Hash<> for «std-1.0.0-beta.14»::«meta»::op::BinaryOp<> where [] := { - noir_def hash(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>, h: & H) -> Unit := { - ((Field as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, h); - #_skip - }; -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_add<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (0: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_subtract<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (1: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_multiply<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (2: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_divide<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (3: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_equal<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (4: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_not_equal<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (5: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_less_than<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (6: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_less_than_or_equal<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (7: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_greater_than<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (8: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_greater_than_or_equal<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (9: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_and<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (10: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_or<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (11: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_xor<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (12: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_shift_right<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (13: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_shift_left<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (14: Field)) -} - -noir_def «std-1.0.0-beta.14»::«meta»::op::BinaryOp::is_modulo<>(self: «std-1.0.0-beta.14»::«meta»::op::BinaryOp<>) -> bool := { - (#_fEq returning bool)(self.0, (15: Field)) -} - -def «std-1.0.0-beta.14».Meta.Op.env : Env := Env.mk - [«std-1.0.0-beta.14::meta::op::UnaryOp::is_minus», «std-1.0.0-beta.14::meta::op::UnaryOp::is_not», «std-1.0.0-beta.14::meta::op::UnaryOp::is_mutable_reference», «std-1.0.0-beta.14::meta::op::UnaryOp::is_dereference», «std-1.0.0-beta.14::meta::op::BinaryOp::is_add», «std-1.0.0-beta.14::meta::op::BinaryOp::is_subtract», «std-1.0.0-beta.14::meta::op::BinaryOp::is_multiply», «std-1.0.0-beta.14::meta::op::BinaryOp::is_divide», «std-1.0.0-beta.14::meta::op::BinaryOp::is_equal», «std-1.0.0-beta.14::meta::op::BinaryOp::is_not_equal», «std-1.0.0-beta.14::meta::op::BinaryOp::is_less_than», «std-1.0.0-beta.14::meta::op::BinaryOp::is_less_than_or_equal», «std-1.0.0-beta.14::meta::op::BinaryOp::is_greater_than», «std-1.0.0-beta.14::meta::op::BinaryOp::is_greater_than_or_equal», «std-1.0.0-beta.14::meta::op::BinaryOp::is_and», «std-1.0.0-beta.14::meta::op::BinaryOp::is_or», «std-1.0.0-beta.14::meta::op::BinaryOp::is_xor», «std-1.0.0-beta.14::meta::op::BinaryOp::is_shift_right», «std-1.0.0-beta.14::meta::op::BinaryOp::is_shift_left», «std-1.0.0-beta.14::meta::op::BinaryOp::is_modulo»] - [«std-1.0.0-beta.14».impl_300, «std-1.0.0-beta.14».impl_301, «std-1.0.0-beta.14».impl_302, «std-1.0.0-beta.14».impl_303] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Quoted.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Quoted.lean deleted file mode 100644 index 440cf90a..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Quoted.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.Quoted.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitConstraint.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitConstraint.lean deleted file mode 100644 index 3f464caa..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitConstraint.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.TraitConstraint.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitDef.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitDef.lean deleted file mode 100644 index 351d3cbe..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitDef.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.TraitDef.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitImpl.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitImpl.lean deleted file mode 100644 index e4530247..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TraitImpl.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.TraitImpl.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Typ.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Typ.lean deleted file mode 100644 index 491954be..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/Typ.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.Typ.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypeDef.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypeDef.lean deleted file mode 100644 index be039cc1..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypeDef.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.TypeDef.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypedExpr.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypedExpr.lean deleted file mode 100644 index 0518d270..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/TypedExpr.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.TypedExpr.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/UnresolvedType.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/UnresolvedType.lean deleted file mode 100644 index 506a4dff..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Meta/UnresolvedType.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Meta.UnresolvedType.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Arith.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Arith.lean deleted file mode 100644 index 570a86d2..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Arith.lean +++ /dev/null @@ -1,863 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_116]<> «std-1.0.0-beta.14»::ops::arith::Add<> for Field where [] := { - noir_def add<>(self: Field, other: Field) -> Field := { - (#_fAdd returning Field)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_117]<> «std-1.0.0-beta.14»::ops::arith::Add<> for u128 where [] := { - noir_def add<>(self: u128, other: u128) -> u128 := { - (#_uAdd returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_118]<> «std-1.0.0-beta.14»::ops::arith::Add<> for u64 where [] := { - noir_def add<>(self: u64, other: u64) -> u64 := { - (#_uAdd returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_119]<> «std-1.0.0-beta.14»::ops::arith::Add<> for u32 where [] := { - noir_def add<>(self: u32, other: u32) -> u32 := { - (#_uAdd returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_120]<> «std-1.0.0-beta.14»::ops::arith::Add<> for u16 where [] := { - noir_def add<>(self: u16, other: u16) -> u16 := { - (#_uAdd returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_121]<> «std-1.0.0-beta.14»::ops::arith::Add<> for u8 where [] := { - noir_def add<>(self: u8, other: u8) -> u8 := { - (#_uAdd returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_122]<> «std-1.0.0-beta.14»::ops::arith::Add<> for u1 where [] := { - noir_def add<>(self: u1, other: u1) -> u1 := { - (#_uAdd returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_123]<> «std-1.0.0-beta.14»::ops::arith::Add<> for i8 where [] := { - noir_def add<>(self: i8, other: i8) -> i8 := { - (#_iAdd returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_124]<> «std-1.0.0-beta.14»::ops::arith::Add<> for i16 where [] := { - noir_def add<>(self: i16, other: i16) -> i16 := { - (#_iAdd returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_125]<> «std-1.0.0-beta.14»::ops::arith::Add<> for i32 where [] := { - noir_def add<>(self: i32, other: i32) -> i32 := { - (#_iAdd returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_126]<> «std-1.0.0-beta.14»::ops::arith::Add<> for i64 where [] := { - noir_def add<>(self: i64, other: i64) -> i64 := { - (#_iAdd returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_127]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for Field where [] := { - noir_def sub<>(self: Field, other: Field) -> Field := { - (#_fSub returning Field)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_128]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for u128 where [] := { - noir_def sub<>(self: u128, other: u128) -> u128 := { - (#_uSub returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_129]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for u64 where [] := { - noir_def sub<>(self: u64, other: u64) -> u64 := { - (#_uSub returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_130]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for u32 where [] := { - noir_def sub<>(self: u32, other: u32) -> u32 := { - (#_uSub returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_131]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for u16 where [] := { - noir_def sub<>(self: u16, other: u16) -> u16 := { - (#_uSub returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_132]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for u8 where [] := { - noir_def sub<>(self: u8, other: u8) -> u8 := { - (#_uSub returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_133]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for u1 where [] := { - noir_def sub<>(self: u1, other: u1) -> u1 := { - (#_uSub returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_134]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for i8 where [] := { - noir_def sub<>(self: i8, other: i8) -> i8 := { - (#_iSub returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_135]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for i16 where [] := { - noir_def sub<>(self: i16, other: i16) -> i16 := { - (#_iSub returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_136]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for i32 where [] := { - noir_def sub<>(self: i32, other: i32) -> i32 := { - (#_iSub returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_137]<> «std-1.0.0-beta.14»::ops::arith::Sub<> for i64 where [] := { - noir_def sub<>(self: i64, other: i64) -> i64 := { - (#_iSub returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_138]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for Field where [] := { - noir_def mul<>(self: Field, other: Field) -> Field := { - (#_fMul returning Field)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_139]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for u128 where [] := { - noir_def mul<>(self: u128, other: u128) -> u128 := { - (#_uMul returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_140]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for u64 where [] := { - noir_def mul<>(self: u64, other: u64) -> u64 := { - (#_uMul returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_141]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for u32 where [] := { - noir_def mul<>(self: u32, other: u32) -> u32 := { - (#_uMul returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_142]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for u16 where [] := { - noir_def mul<>(self: u16, other: u16) -> u16 := { - (#_uMul returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_143]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for u8 where [] := { - noir_def mul<>(self: u8, other: u8) -> u8 := { - (#_uMul returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_144]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for u1 where [] := { - noir_def mul<>(self: u1, other: u1) -> u1 := { - (#_uMul returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_145]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for i8 where [] := { - noir_def mul<>(self: i8, other: i8) -> i8 := { - (#_iMul returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_146]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for i16 where [] := { - noir_def mul<>(self: i16, other: i16) -> i16 := { - (#_iMul returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_147]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for i32 where [] := { - noir_def mul<>(self: i32, other: i32) -> i32 := { - (#_iMul returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_148]<> «std-1.0.0-beta.14»::ops::arith::Mul<> for i64 where [] := { - noir_def mul<>(self: i64, other: i64) -> i64 := { - (#_iMul returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_149]<> «std-1.0.0-beta.14»::ops::arith::Div<> for Field where [] := { - noir_def div<>(self: Field, other: Field) -> Field := { - (#_fDiv returning Field)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_150]<> «std-1.0.0-beta.14»::ops::arith::Div<> for u128 where [] := { - noir_def div<>(self: u128, other: u128) -> u128 := { - (#_uDiv returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_151]<> «std-1.0.0-beta.14»::ops::arith::Div<> for u64 where [] := { - noir_def div<>(self: u64, other: u64) -> u64 := { - (#_uDiv returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_152]<> «std-1.0.0-beta.14»::ops::arith::Div<> for u32 where [] := { - noir_def div<>(self: u32, other: u32) -> u32 := { - (#_uDiv returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_153]<> «std-1.0.0-beta.14»::ops::arith::Div<> for u16 where [] := { - noir_def div<>(self: u16, other: u16) -> u16 := { - (#_uDiv returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_154]<> «std-1.0.0-beta.14»::ops::arith::Div<> for u8 where [] := { - noir_def div<>(self: u8, other: u8) -> u8 := { - (#_uDiv returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_155]<> «std-1.0.0-beta.14»::ops::arith::Div<> for u1 where [] := { - noir_def div<>(self: u1, other: u1) -> u1 := { - (#_uDiv returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_156]<> «std-1.0.0-beta.14»::ops::arith::Div<> for i8 where [] := { - noir_def div<>(self: i8, other: i8) -> i8 := { - (#_iDiv returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_157]<> «std-1.0.0-beta.14»::ops::arith::Div<> for i16 where [] := { - noir_def div<>(self: i16, other: i16) -> i16 := { - (#_iDiv returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_158]<> «std-1.0.0-beta.14»::ops::arith::Div<> for i32 where [] := { - noir_def div<>(self: i32, other: i32) -> i32 := { - (#_iDiv returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_159]<> «std-1.0.0-beta.14»::ops::arith::Div<> for i64 where [] := { - noir_def div<>(self: i64, other: i64) -> i64 := { - (#_iDiv returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_160]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for u128 where [] := { - noir_def rem<>(self: u128, other: u128) -> u128 := { - (#_uRem returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_161]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for u64 where [] := { - noir_def rem<>(self: u64, other: u64) -> u64 := { - (#_uRem returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_162]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for u32 where [] := { - noir_def rem<>(self: u32, other: u32) -> u32 := { - (#_uRem returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_163]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for u16 where [] := { - noir_def rem<>(self: u16, other: u16) -> u16 := { - (#_uRem returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_164]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for u8 where [] := { - noir_def rem<>(self: u8, other: u8) -> u8 := { - (#_uRem returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_165]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for u1 where [] := { - noir_def rem<>(self: u1, other: u1) -> u1 := { - (#_uRem returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_166]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for i8 where [] := { - noir_def rem<>(self: i8, other: i8) -> i8 := { - (#_iRem returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_167]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for i16 where [] := { - noir_def rem<>(self: i16, other: i16) -> i16 := { - (#_iRem returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_168]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for i32 where [] := { - noir_def rem<>(self: i32, other: i32) -> i32 := { - (#_iRem returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_169]<> «std-1.0.0-beta.14»::ops::arith::Rem<> for i64 where [] := { - noir_def rem<>(self: i64, other: i64) -> i64 := { - (#_iRem returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_170]<> «std-1.0.0-beta.14»::ops::arith::Neg<> for Field where [] := { - noir_def neg<>(self: Field) -> Field := { - (#_fNeg returning Field)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_171]<> «std-1.0.0-beta.14»::ops::arith::Neg<> for i8 where [] := { - noir_def neg<>(self: i8) -> i8 := { - (#_iNeg returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_172]<> «std-1.0.0-beta.14»::ops::arith::Neg<> for i16 where [] := { - noir_def neg<>(self: i16) -> i16 := { - (#_iNeg returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_173]<> «std-1.0.0-beta.14»::ops::arith::Neg<> for i32 where [] := { - noir_def neg<>(self: i32) -> i32 := { - (#_iNeg returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_174]<> «std-1.0.0-beta.14»::ops::arith::Neg<> for i64 where [] := { - noir_def neg<>(self: i64) -> i64 := { - (#_iNeg returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_175]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for u1 where [] := { - noir_def wrapping_add<>(self: u1, y: u1) -> u1 := { - (#_uXor returning u1)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_176]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for u8 where [] := { - noir_def wrapping_add<>(self: u8, y: u8) -> u8 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_add_hlp as λ(u8, u8) -> u8)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_177]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for u16 where [] := { - noir_def wrapping_add<>(self: u16, y: u16) -> u16 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_add_hlp as λ(u16, u16) -> u16)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_178]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for u32 where [] := { - noir_def wrapping_add<>(self: u32, y: u32) -> u32 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_add_hlp as λ(u32, u32) -> u32)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_179]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for u64 where [] := { - noir_def wrapping_add<>(self: u64, y: u64) -> u64 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_add_hlp as λ(u64, u64) -> u64)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_180]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for u128 where [] := { - noir_def wrapping_add<>(self: u128, y: u128) -> u128 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_add_hlp as λ(u128, u128) -> u128)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_181]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for i8 where [] := { - noir_def wrapping_add<>(self: i8, y: i8) -> i8 := { - let x = (#_cast returning u8)(self); - (#_cast returning i8)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)(x, (#_cast returning u8)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_182]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for i16 where [] := { - noir_def wrapping_add<>(self: i16, y: i16) -> i16 := { - let x = (#_cast returning u16)(self); - (#_cast returning i16)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u16, u16) -> u16)(x, (#_cast returning u16)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_183]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for i32 where [] := { - noir_def wrapping_add<>(self: i32, y: i32) -> i32 := { - let x = (#_cast returning u32)(self); - (#_cast returning i32)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u32, u32) -> u32)(x, (#_cast returning u32)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_184]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for i64 where [] := { - noir_def wrapping_add<>(self: i64, y: i64) -> i64 := { - let x = (#_cast returning u64)(self); - (#_cast returning i64)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)(x, (#_cast returning u64)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_185]<> «std-1.0.0-beta.14»::ops::arith::WrappingAdd<> for Field where [] := { - noir_def wrapping_add<>(self: Field, y: Field) -> Field := { - (#_fAdd returning Field)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_186]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for u1 where [] := { - noir_def wrapping_sub<>(self: u1, y: u1) -> u1 := { - (#_uXor returning u1)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_187]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for u8 where [] := { - noir_def wrapping_sub<>(self: u8, y: u8) -> u8 := { - (#_cast returning u8)((«std-1.0.0-beta.14»::ops::arith::wrapping_sub_hlp as λ(u8, u8) -> Field)(self, y)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_188]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for u16 where [] := { - noir_def wrapping_sub<>(self: u16, y: u16) -> u16 := { - (#_cast returning u16)((«std-1.0.0-beta.14»::ops::arith::wrapping_sub_hlp as λ(u16, u16) -> Field)(self, y)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_189]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for u32 where [] := { - noir_def wrapping_sub<>(self: u32, y: u32) -> u32 := { - (#_cast returning u32)((«std-1.0.0-beta.14»::ops::arith::wrapping_sub_hlp as λ(u32, u32) -> Field)(self, y)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_190]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for u64 where [] := { - noir_def wrapping_sub<>(self: u64, y: u64) -> u64 := { - (#_cast returning u64)((«std-1.0.0-beta.14»::ops::arith::wrapping_sub_hlp as λ(u64, u64) -> Field)(self, y)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_191]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for u128 where [] := { - noir_def wrapping_sub<>(self: u128, y: u128) -> u128 := { - (#_cast returning u128)((«std-1.0.0-beta.14»::ops::arith::wrapping_sub_hlp as λ(u128, u128) -> Field)(self, y)) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_192]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for i8 where [] := { - noir_def wrapping_sub<>(self: i8, y: i8) -> i8 := { - let x = (#_cast returning u8)(self); - (#_cast returning i8)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)(x, (#_cast returning u8)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_193]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for i16 where [] := { - noir_def wrapping_sub<>(self: i16, y: i16) -> i16 := { - let x = (#_cast returning u16)(self); - (#_cast returning i16)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u16, u16) -> u16)(x, (#_cast returning u16)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_194]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for i32 where [] := { - noir_def wrapping_sub<>(self: i32, y: i32) -> i32 := { - let x = (#_cast returning u32)(self); - (#_cast returning i32)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u32, u32) -> u32)(x, (#_cast returning u32)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_195]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for i64 where [] := { - noir_def wrapping_sub<>(self: i64, y: i64) -> i64 := { - let x = (#_cast returning u64)(self); - (#_cast returning i64)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)(x, (#_cast returning u64)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_196]<> «std-1.0.0-beta.14»::ops::arith::WrappingSub<> for Field where [] := { - noir_def wrapping_sub<>(self: Field, y: Field) -> Field := { - (#_fSub returning Field)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_197]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for u1 where [] := { - noir_def wrapping_mul<>(self: u1, y: u1) -> u1 := { - (#_uAnd returning u1)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_198]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for u8 where [] := { - noir_def wrapping_mul<>(self: u8, y: u8) -> u8 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_mul_hlp as λ(u8, u8) -> u8)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_199]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for u16 where [] := { - noir_def wrapping_mul<>(self: u16, y: u16) -> u16 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_mul_hlp as λ(u16, u16) -> u16)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_200]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for u32 where [] := { - noir_def wrapping_mul<>(self: u32, y: u32) -> u32 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_mul_hlp as λ(u32, u32) -> u32)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_201]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for u64 where [] := { - noir_def wrapping_mul<>(self: u64, y: u64) -> u64 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_mul_hlp as λ(u64, u64) -> u64)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_202]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for i8 where [] := { - noir_def wrapping_mul<>(self: i8, y: i8) -> i8 := { - let x = (#_cast returning u8)(self); - (#_cast returning i8)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)(x, (#_cast returning u8)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_203]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for i16 where [] := { - noir_def wrapping_mul<>(self: i16, y: i16) -> i16 := { - let x = (#_cast returning u16)(self); - (#_cast returning i16)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u16, u16) -> u16)(x, (#_cast returning u16)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_204]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for i32 where [] := { - noir_def wrapping_mul<>(self: i32, y: i32) -> i32 := { - let x = (#_cast returning u32)(self); - (#_cast returning i32)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u32, u32) -> u32)(x, (#_cast returning u32)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_205]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for i64 where [] := { - noir_def wrapping_mul<>(self: i64, y: i64) -> i64 := { - let x = (#_cast returning u64)(self); - (#_cast returning i64)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)(x, (#_cast returning u64)(y))) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_206]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for u128 where [] := { - noir_def wrapping_mul<>(self: u128, y: u128) -> u128 := { - («std-1.0.0-beta.14»::ops::arith::wrapping_mul128_hlp<> as λ(u128, u128) -> u128)(self, y) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_207]<> «std-1.0.0-beta.14»::ops::arith::WrappingMul<> for Field where [] := { - noir_def wrapping_mul<>(self: Field, y: Field) -> Field := { - (#_fMul returning Field)(self, y) - }; -} - -noir_def «std-1.0.0-beta.14»::ops::arith::wrapping_add_hlp(x: T, y: T) -> T := { - ((Field as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(Field) -> T)((#_fAdd returning Field)(((T as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(x), ((T as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(y))) -} - -noir_def «std-1.0.0-beta.14»::ops::arith::wrapping_sub_hlp(x: T, y: T) -> Field := { - (#_fSub returning Field)((#_fAdd returning Field)(((T as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(x), (340282366920938463463374607431768211456: Field)), ((T as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(y)) -} - -noir_def «std-1.0.0-beta.14»::ops::arith::wrapping_mul_hlp(x: T, y: T) -> T := { - ((Field as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(Field) -> T)((#_fMul returning Field)(((T as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(x), ((T as «std-1.0.0-beta.14»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(y))) -} - -noir_global_def «std-1.0.0-beta.14»::ops::arith::two_pow_64: u128 = (18446744073709551616: u128); - -noir_def «std-1.0.0-beta.14»::ops::arith::split64<>(x: u128) -> Tuple := { - (#_fresh returning Tuple)() -} - -noir_def «std-1.0.0-beta.14»::ops::arith::split_into_64_bit_limbs<>(x: u128) -> Tuple := { - let (x_lo, x_hi) = { - («std-1.0.0-beta.14»::ops::arith::split64<> as λ(u128) -> Tuple)(x) - }; - (#_assert returning Unit)((#_fEq returning bool)((#_cast returning Field)(x), (#_fAdd returning Field)((#_cast returning Field)(x_lo), (#_fMul returning Field)((#_cast returning Field)(x_hi), (#_cast returning Field)((«std-1.0.0-beta.14»::ops::arith::two_pow_64<> as λ() -> u128)()))))); - (#_makeData returning Tuple)(x_lo, x_hi) -} - -noir_def «std-1.0.0-beta.14»::ops::arith::wrapping_mul128_hlp<>(x: u128, y: u128) -> u128 := { - let (x_lo, x_hi) = («std-1.0.0-beta.14»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(x); - let (y_lo, y_hi) = («std-1.0.0-beta.14»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(y); - let low = (#_fMul returning Field)((#_cast returning Field)(x_lo), (#_cast returning Field)(y_lo)); - let lo = (#_cast returning Field)((#_cast returning u64)(low)); - let carry = (#_fDiv returning Field)((#_fSub returning Field)(low, lo), (#_cast returning Field)((«std-1.0.0-beta.14»::ops::arith::two_pow_64<> as λ() -> u128)())); - let high = (#_fAdd returning Field)((#_fAdd returning Field)((#_fMul returning Field)((#_cast returning Field)(x_lo), (#_cast returning Field)(y_hi)), (#_fMul returning Field)((#_cast returning Field)(x_hi), (#_cast returning Field)(y_lo))), carry); - let hi = (#_cast returning Field)((#_cast returning u64)(high)); - (#_cast returning u128)((#_fAdd returning Field)(lo, (#_fMul returning Field)((#_cast returning Field)((«std-1.0.0-beta.14»::ops::arith::two_pow_64<> as λ() -> u128)()), hi))) -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::test_static_assert_custom_message<>() -> Unit := { - (#_staticAssert returning Unit)((#_fEq returning bool)((1: Field), (2: Field)), "custom message"); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_basic_arithmetic_traits<>() -> Unit := { - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)((5: Field), (3: Field)), (8: Field))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(u8, u8) -> u8)((0: u8), (255: u8)), (255: u8))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)((42: Field), (58: Field)), (100: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)((10: Field), (3: Field)), (7: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)((100: Field), (42: Field)), (58: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Mul<>)::mul<> as λ(Field, Field) -> Field)((6: Field), (7: Field)), (42: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((15: Field), (3: Field)), (5: Field))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(u8, u8) -> u8)((10: u8), (3: u8)), (3: u8))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((15: Field), (3: Field)), (5: Field))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::Rem<>)::rem<> as λ(u128, u128) -> u128)((17: u128), (5: u128)), (2: u128))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::Rem<>)::rem<> as λ(u8, u8) -> u8)((10: u8), (3: u8)), (1: u8))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)((42: Field)), (-42: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)((-10: Field)), (10: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)((42: Field)), (-42: Field))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_division<>() -> Unit := { - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((42: Field), (1: Field)), (42: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((0: Field), (1: Field)), (0: Field))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(u8, u8) -> u8)((255: u8), (1: u8)), (255: u8))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((42: Field), (42: Field)), (1: Field))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((1: Field), (1: Field)), (1: Field))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::Rem<>)::rem<> as λ(u128, u128) -> u128)((42: u128), (42: u128)), (0: u128))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::Rem<>)::rem<> as λ(u128, u128) -> u128)((0: u128), (42: u128)), (0: u128))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::Rem<>)::rem<> as λ(u128, u128) -> u128)((1: u128), (42: u128)), (1: u128))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_u8_sub_overflow_failure<>() -> Unit := { - let __0 = ((u8 as «std-1.0.0-beta.14»::ops::arith::Sub<>)::sub<> as λ(u8, u8) -> u8)((0: u8), (1: u8)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_u8_add_overflow_failure<>() -> Unit := { - let __0 = ((u8 as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(u8, u8) -> u8)((255: u8), (1: u8)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_u8_mul_overflow_failure<>() -> Unit := { - let __0 = ((u8 as «std-1.0.0-beta.14»::ops::arith::Mul<>)::mul<> as λ(u8, u8) -> u8)((255: u8), (2: u8)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_u16_sub_overflow_failure<>() -> Unit := { - let __0 = ((u16 as «std-1.0.0-beta.14»::ops::arith::Sub<>)::sub<> as λ(u16, u16) -> u16)((0: u16), (1: u16)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_u16_add_overflow_failure<>() -> Unit := { - let __0 = ((u16 as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(u16, u16) -> u16)((65535: u16), (1: u16)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_u16_mul_overflow_failure<>() -> Unit := { - let __0 = ((u16 as «std-1.0.0-beta.14»::ops::arith::Mul<>)::mul<> as λ(u16, u16) -> u16)((65535: u16), (2: u16)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_signed_sub_overflow_failure<>() -> Unit := { - let val = (-128: i8); - let __0 = ((i8 as «std-1.0.0-beta.14»::ops::arith::Sub<>)::sub<> as λ(i8, i8) -> i8)(val, (1: i8)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_signed_overflow_failure<>() -> Unit := { - let __0 = ((i8 as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(i8, i8) -> i8)((127: i8), (1: i8)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::arithmetic::test_field<>() -> Unit := { - let zero = (0: Field); - let one = (1: Field); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(zero, one), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(one, zero), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)(one, one), zero)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Mul<>)::mul<> as λ(Field, Field) -> Field)(one, one), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)(one, one), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(zero), zero)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(one), (#_fNeg returning Field)(one))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::wrapping_arithmetic::test_wrapping_add<>() -> Unit := { - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((255: u8), (1: u8)), (0: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((255: u8), (255: u8)), (254: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((0: u8), (0: u8)), (0: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((128: u8), (128: u8)), (0: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u16, u16) -> u16)((65535: u16), (1: u16)), (0: u16))); - (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u16, u16) -> u16)((65535: u16), (65535: u16)), (65534: u16))); - (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u32, u32) -> u32)((4294967295: u32), (1: u32)), (0: u32))); - (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u32, u32) -> u32)((4294967295: u32), (4294967295: u32)), (4294967294: u32))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (1: u64)), (0: u64))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (18446744073709551615: u64)), (18446744073709551614: u64))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u128, u128) -> u128)((340282366920938463463374607431768211455: u128), (1: u128)), (0: u128))); - (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i8, i8) -> i8)((127: i8), (1: i8)), (-128: i8))); - let val = (-128: i8); - (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i8, i8) -> i8)(val, (-1: i8)), (127: i8))); - let forty_two = (42: Field); - let fifty_eight = (58: Field); - let hundred = (100: Field); - let neg_two = (-2: Field); - let two = (2: Field); - let zero = (0: Field); - let neg_two_hundred = (-200: Field); - let neg_one_ninety_eight = (-198: Field); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(forty_two, fifty_eight), hundred)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(neg_two, two), zero)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(neg_two_hundred, two), neg_one_ninety_eight)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::wrapping_arithmetic::test_wrapping_sub<>() -> Unit := { - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((0: u8), (1: u8)), (255: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((255: u8), (255: u8)), (0: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((0: u8), (0: u8)), (0: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((1: u8), (2: u8)), (255: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u16, u16) -> u16)((0: u16), (1: u16)), (65535: u16))); - (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u16, u16) -> u16)((65535: u16), (65535: u16)), (0: u16))); - (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u32, u32) -> u32)((0: u32), (1: u32)), (4294967295: u32))); - (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u32, u32) -> u32)((4294967295: u32), (4294967295: u32)), (0: u32))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)((0: u64), (1: u64)), (18446744073709551615: u64))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (18446744073709551615: u64)), (0: u64))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u128, u128) -> u128)((0: u128), (1: u128)), (340282366920938463463374607431768211455: u128))); - let val = (-128: i8); - (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i8, i8) -> i8)(val, (1: i8)), (127: i8))); - (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i8, i8) -> i8)((127: i8), (-1: i8)), (-128: i8))); - let forty_two = (42: Field); - let fifty_eight = (58: Field); - let neg_sixteen = (-16: Field); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(Field, Field) -> Field)(forty_two, fifty_eight), neg_sixteen)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::wrapping_arithmetic::test_wrapping_mul<>() -> Unit := { - let zero = (0: u128); - let one = (1: u128); - let two_pow_64 = (18446744073709551616: u128); - let u128_max = (340282366920938463463374607431768211455: u128); - (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(zero, one))); - (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(one, zero))); - (#_assert returning Unit)((#_uEq returning bool)(one, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(one, one))); - (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(zero, two_pow_64))); - (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(two_pow_64, zero))); - (#_assert returning Unit)((#_uEq returning bool)(two_pow_64, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(two_pow_64, one))); - (#_assert returning Unit)((#_uEq returning bool)(two_pow_64, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(one, two_pow_64))); - (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(two_pow_64, two_pow_64))); - (#_assert returning Unit)((#_uEq returning bool)(one, ((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(u128_max, u128_max))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)((255: u8), (2: u8)), (254: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)((255: u8), (255: u8)), (1: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)((128: u8), (2: u8)), (0: u8))); - (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u16, u16) -> u16)((65535: u16), (2: u16)), (65534: u16))); - (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u16, u16) -> u16)((65535: u16), (65535: u16)), (1: u16))); - (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u32, u32) -> u32)((4294967295: u32), (2: u32)), (4294967294: u32))); - (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u32, u32) -> u32)((4294967295: u32), (4294967295: u32)), (1: u32))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (2: u64)), (18446744073709551614: u64))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (18446744073709551615: u64)), (1: u64))); - (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i8, i8) -> i8)((127: i8), (2: i8)), (-2: i8))); - let val = (-128: i8); - (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i8, i8) -> i8)(val, (-1: i8)), (-128: i8))); - let six = (6: Field); - let seven = (7: Field); - let forty_two = (42: Field); - let neg_two = (-2: Field); - let two = (2: Field); - let neg_four = (-4: Field); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(six, seven), forty_two)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(neg_two, two), neg_four)); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::wrapping_arithmetic::test_u1_behavior<>() -> Unit := { - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u1, u1) -> u1)((0: u1), (0: u1)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u1, u1) -> u1)((0: u1), (1: u1)), (1: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u1, u1) -> u1)((1: u1), (0: u1)), (1: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u1, u1) -> u1)((1: u1), (1: u1)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u1, u1) -> u1)((0: u1), (0: u1)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u1, u1) -> u1)((0: u1), (1: u1)), (1: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u1, u1) -> u1)((1: u1), (0: u1)), (1: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u1, u1) -> u1)((1: u1), (1: u1)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u1, u1) -> u1)((0: u1), (0: u1)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u1, u1) -> u1)((0: u1), (1: u1)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u1, u1) -> u1)((1: u1), (0: u1)), (0: u1))); - (#_assert returning Unit)((#_uEq returning bool)(((u1 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u1, u1) -> u1)((1: u1), (1: u1)), (1: u1))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::wrapping_arithmetic::test_wrapping_vs_regular<>() -> Unit := { - let u64_large = (1311768467463790320: u64); - let u128_large = (24197857203266734864793317670504947440: u128); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)(u64_large, (1: u64)), (#_uAdd returning u64)(u64_large, (1: u64)))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)(u64_large, (1: u64)), (#_uSub returning u64)(u64_large, (1: u64)))); - (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)(u64_large, (2: u64)), (#_uMul returning u64)(u64_large, (2: u64)))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u128, u128) -> u128)(u128_large, (1: u128)), (#_uAdd returning u128)(u128_large, (1: u128)))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u128, u128) -> u128)(u128_large, (1: u128)), (#_uSub returning u128)(u128_large, (1: u128)))); - (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(u128_large, (2: u128)), (#_uMul returning u128)(u128_large, (2: u128)))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::wrapping_arithmetic::test_field_wrapping_operations<>() -> Unit := { - let zero = (0: Field); - let one = (1: Field); - let large_val = (18446744073709551615: Field); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(zero, one), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(one, large_val), (#_fAdd returning Field)(one, large_val))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(Field, Field) -> Field)(zero, one), (#_fNeg returning Field)(one))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(Field, Field) -> Field)(one, large_val), (#_fSub returning Field)(one, large_val))); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(zero, one), zero)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(one, large_val), large_val)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(zero, one), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(one, zero), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)(one, one), zero)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Mul<>)::mul<> as λ(Field, Field) -> Field)(one, one), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)(one, one), one)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(zero), zero)); - (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.14»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(one), (#_fNeg returning Field)(one))); - #_skip -} - -noir_def «std-1.0.0-beta.14»::ops::arith::tests::split_functions::test_split_functions<>() -> Unit := { - let small_val = (81985529216486895: u128); - let large_val = (24197857203266734864793317670504947440: u128); - let max_val = (340282366920938463463374607431768211455: u128); - { - let (lo, hi) = («std-1.0.0-beta.14»::ops::arith::split64<> as λ(u128) -> Tuple)(small_val); - (#_assert returning Unit)((#_uEq returning bool)(lo, (81985529216486895: u64))); - (#_assert returning Unit)((#_uEq returning bool)(hi, (0: u64))); - let (lo2, hi2) = («std-1.0.0-beta.14»::ops::arith::split64<> as λ(u128) -> Tuple)(large_val); - (#_assert returning Unit)((#_uEq returning bool)(lo2, (1311768467463790320: u64))); - (#_assert returning Unit)((#_uEq returning bool)(hi2, (1311768467463790320: u64))); - #_skip - }; - let (lo3, hi3) = («std-1.0.0-beta.14»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(small_val); - (#_assert returning Unit)((#_uEq returning bool)(lo3, (81985529216486895: u64))); - (#_assert returning Unit)((#_uEq returning bool)(hi3, (0: u64))); - let (lo4, hi4) = («std-1.0.0-beta.14»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(large_val); - (#_assert returning Unit)((#_uEq returning bool)(lo4, (1311768467463790320: u64))); - (#_assert returning Unit)((#_uEq returning bool)(hi4, (1311768467463790320: u64))); - let (lo5, hi5) = («std-1.0.0-beta.14»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(max_val); - (#_assert returning Unit)((#_uEq returning bool)(lo5, (18446744073709551615: u64))); - (#_assert returning Unit)((#_uEq returning bool)(hi5, (18446744073709551615: u64))); - #_skip -} - -def «std-1.0.0-beta.14».Ops.Arith.env : Env := Env.mk - [«std-1.0.0-beta.14::ops::arith::wrapping_add_hlp», «std-1.0.0-beta.14::ops::arith::wrapping_sub_hlp», «std-1.0.0-beta.14::ops::arith::wrapping_mul_hlp», «std-1.0.0-beta.14::ops::arith::two_pow_64», «std-1.0.0-beta.14::ops::arith::split64», «std-1.0.0-beta.14::ops::arith::split_into_64_bit_limbs», «std-1.0.0-beta.14::ops::arith::wrapping_mul128_hlp», «std-1.0.0-beta.14::ops::arith::tests::test_static_assert_custom_message», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_basic_arithmetic_traits», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_division», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_u8_sub_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_u8_add_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_u8_mul_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_u16_sub_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_u16_add_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_u16_mul_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_signed_sub_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_signed_overflow_failure», «std-1.0.0-beta.14::ops::arith::tests::arithmetic::test_field», «std-1.0.0-beta.14::ops::arith::tests::wrapping_arithmetic::test_wrapping_add», «std-1.0.0-beta.14::ops::arith::tests::wrapping_arithmetic::test_wrapping_sub», «std-1.0.0-beta.14::ops::arith::tests::wrapping_arithmetic::test_wrapping_mul», «std-1.0.0-beta.14::ops::arith::tests::wrapping_arithmetic::test_u1_behavior», «std-1.0.0-beta.14::ops::arith::tests::wrapping_arithmetic::test_wrapping_vs_regular», «std-1.0.0-beta.14::ops::arith::tests::wrapping_arithmetic::test_field_wrapping_operations», «std-1.0.0-beta.14::ops::arith::tests::split_functions::test_split_functions»] - [«std-1.0.0-beta.14».impl_116, «std-1.0.0-beta.14».impl_117, «std-1.0.0-beta.14».impl_118, «std-1.0.0-beta.14».impl_119, «std-1.0.0-beta.14».impl_120, «std-1.0.0-beta.14».impl_121, «std-1.0.0-beta.14».impl_122, «std-1.0.0-beta.14».impl_123, «std-1.0.0-beta.14».impl_124, «std-1.0.0-beta.14».impl_125, «std-1.0.0-beta.14».impl_126, «std-1.0.0-beta.14».impl_127, «std-1.0.0-beta.14».impl_128, «std-1.0.0-beta.14».impl_129, «std-1.0.0-beta.14».impl_130, «std-1.0.0-beta.14».impl_131, «std-1.0.0-beta.14».impl_132, «std-1.0.0-beta.14».impl_133, «std-1.0.0-beta.14».impl_134, «std-1.0.0-beta.14».impl_135, «std-1.0.0-beta.14».impl_136, «std-1.0.0-beta.14».impl_137, «std-1.0.0-beta.14».impl_138, «std-1.0.0-beta.14».impl_139, «std-1.0.0-beta.14».impl_140, «std-1.0.0-beta.14».impl_141, «std-1.0.0-beta.14».impl_142, «std-1.0.0-beta.14».impl_143, «std-1.0.0-beta.14».impl_144, «std-1.0.0-beta.14».impl_145, «std-1.0.0-beta.14».impl_146, «std-1.0.0-beta.14».impl_147, «std-1.0.0-beta.14».impl_148, «std-1.0.0-beta.14».impl_149, «std-1.0.0-beta.14».impl_150, «std-1.0.0-beta.14».impl_151, «std-1.0.0-beta.14».impl_152, «std-1.0.0-beta.14».impl_153, «std-1.0.0-beta.14».impl_154, «std-1.0.0-beta.14».impl_155, «std-1.0.0-beta.14».impl_156, «std-1.0.0-beta.14».impl_157, «std-1.0.0-beta.14».impl_158, «std-1.0.0-beta.14».impl_159, «std-1.0.0-beta.14».impl_160, «std-1.0.0-beta.14».impl_161, «std-1.0.0-beta.14».impl_162, «std-1.0.0-beta.14».impl_163, «std-1.0.0-beta.14».impl_164, «std-1.0.0-beta.14».impl_165, «std-1.0.0-beta.14».impl_166, «std-1.0.0-beta.14».impl_167, «std-1.0.0-beta.14».impl_168, «std-1.0.0-beta.14».impl_169, «std-1.0.0-beta.14».impl_170, «std-1.0.0-beta.14».impl_171, «std-1.0.0-beta.14».impl_172, «std-1.0.0-beta.14».impl_173, «std-1.0.0-beta.14».impl_174, «std-1.0.0-beta.14».impl_175, «std-1.0.0-beta.14».impl_176, «std-1.0.0-beta.14».impl_177, «std-1.0.0-beta.14».impl_178, «std-1.0.0-beta.14».impl_179, «std-1.0.0-beta.14».impl_180, «std-1.0.0-beta.14».impl_181, «std-1.0.0-beta.14».impl_182, «std-1.0.0-beta.14».impl_183, «std-1.0.0-beta.14».impl_184, «std-1.0.0-beta.14».impl_185, «std-1.0.0-beta.14».impl_186, «std-1.0.0-beta.14».impl_187, «std-1.0.0-beta.14».impl_188, «std-1.0.0-beta.14».impl_189, «std-1.0.0-beta.14».impl_190, «std-1.0.0-beta.14».impl_191, «std-1.0.0-beta.14».impl_192, «std-1.0.0-beta.14».impl_193, «std-1.0.0-beta.14».impl_194, «std-1.0.0-beta.14».impl_195, «std-1.0.0-beta.14».impl_196, «std-1.0.0-beta.14».impl_197, «std-1.0.0-beta.14».impl_198, «std-1.0.0-beta.14».impl_199, «std-1.0.0-beta.14».impl_200, «std-1.0.0-beta.14».impl_201, «std-1.0.0-beta.14».impl_202, «std-1.0.0-beta.14».impl_203, «std-1.0.0-beta.14».impl_204, «std-1.0.0-beta.14».impl_205, «std-1.0.0-beta.14».impl_206, «std-1.0.0-beta.14».impl_207] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Bit.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Bit.lean deleted file mode 100644 index da6ee59e..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Bit.lean +++ /dev/null @@ -1,396 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_trait_impl[«std-1.0.0-beta.14».impl_208]<> «std-1.0.0-beta.14»::ops::bit::Not<> for bool where [] := { - noir_def not<>(self: bool) -> bool := { - (#_bNot returning bool)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_209]<> «std-1.0.0-beta.14»::ops::bit::Not<> for u128 where [] := { - noir_def not<>(self: u128) -> u128 := { - (#_uNot returning u128)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_210]<> «std-1.0.0-beta.14»::ops::bit::Not<> for u64 where [] := { - noir_def not<>(self: u64) -> u64 := { - (#_uNot returning u64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_211]<> «std-1.0.0-beta.14»::ops::bit::Not<> for u32 where [] := { - noir_def not<>(self: u32) -> u32 := { - (#_uNot returning u32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_212]<> «std-1.0.0-beta.14»::ops::bit::Not<> for u16 where [] := { - noir_def not<>(self: u16) -> u16 := { - (#_uNot returning u16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_213]<> «std-1.0.0-beta.14»::ops::bit::Not<> for u8 where [] := { - noir_def not<>(self: u8) -> u8 := { - (#_uNot returning u8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_214]<> «std-1.0.0-beta.14»::ops::bit::Not<> for u1 where [] := { - noir_def not<>(self: u1) -> u1 := { - (#_uNot returning u1)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_215]<> «std-1.0.0-beta.14»::ops::bit::Not<> for i8 where [] := { - noir_def not<>(self: i8) -> i8 := { - (#_iNot returning i8)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_216]<> «std-1.0.0-beta.14»::ops::bit::Not<> for i16 where [] := { - noir_def not<>(self: i16) -> i16 := { - (#_iNot returning i16)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_217]<> «std-1.0.0-beta.14»::ops::bit::Not<> for i32 where [] := { - noir_def not<>(self: i32) -> i32 := { - (#_iNot returning i32)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_218]<> «std-1.0.0-beta.14»::ops::bit::Not<> for i64 where [] := { - noir_def not<>(self: i64) -> i64 := { - (#_iNot returning i64)(self) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_219]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for bool where [] := { - noir_def bitor<>(self: bool, other: bool) -> bool := { - (#_bOr returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_220]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for u128 where [] := { - noir_def bitor<>(self: u128, other: u128) -> u128 := { - (#_uOr returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_221]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for u64 where [] := { - noir_def bitor<>(self: u64, other: u64) -> u64 := { - (#_uOr returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_222]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for u32 where [] := { - noir_def bitor<>(self: u32, other: u32) -> u32 := { - (#_uOr returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_223]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for u16 where [] := { - noir_def bitor<>(self: u16, other: u16) -> u16 := { - (#_uOr returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_224]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for u8 where [] := { - noir_def bitor<>(self: u8, other: u8) -> u8 := { - (#_uOr returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_225]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for u1 where [] := { - noir_def bitor<>(self: u1, other: u1) -> u1 := { - (#_uOr returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_226]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for i8 where [] := { - noir_def bitor<>(self: i8, other: i8) -> i8 := { - (#_iOr returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_227]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for i16 where [] := { - noir_def bitor<>(self: i16, other: i16) -> i16 := { - (#_iOr returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_228]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for i32 where [] := { - noir_def bitor<>(self: i32, other: i32) -> i32 := { - (#_iOr returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_229]<> «std-1.0.0-beta.14»::ops::bit::BitOr<> for i64 where [] := { - noir_def bitor<>(self: i64, other: i64) -> i64 := { - (#_iOr returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_230]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for bool where [] := { - noir_def bitand<>(self: bool, other: bool) -> bool := { - (#_bAnd returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_231]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for u128 where [] := { - noir_def bitand<>(self: u128, other: u128) -> u128 := { - (#_uAnd returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_232]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for u64 where [] := { - noir_def bitand<>(self: u64, other: u64) -> u64 := { - (#_uAnd returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_233]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for u32 where [] := { - noir_def bitand<>(self: u32, other: u32) -> u32 := { - (#_uAnd returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_234]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for u16 where [] := { - noir_def bitand<>(self: u16, other: u16) -> u16 := { - (#_uAnd returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_235]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for u8 where [] := { - noir_def bitand<>(self: u8, other: u8) -> u8 := { - (#_uAnd returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_236]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for u1 where [] := { - noir_def bitand<>(self: u1, other: u1) -> u1 := { - (#_uAnd returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_237]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for i8 where [] := { - noir_def bitand<>(self: i8, other: i8) -> i8 := { - (#_iAnd returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_238]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for i16 where [] := { - noir_def bitand<>(self: i16, other: i16) -> i16 := { - (#_iAnd returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_239]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for i32 where [] := { - noir_def bitand<>(self: i32, other: i32) -> i32 := { - (#_iAnd returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_240]<> «std-1.0.0-beta.14»::ops::bit::BitAnd<> for i64 where [] := { - noir_def bitand<>(self: i64, other: i64) -> i64 := { - (#_iAnd returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_241]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for bool where [] := { - noir_def bitxor<>(self: bool, other: bool) -> bool := { - (#_bXor returning bool)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_242]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for u128 where [] := { - noir_def bitxor<>(self: u128, other: u128) -> u128 := { - (#_uXor returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_243]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for u64 where [] := { - noir_def bitxor<>(self: u64, other: u64) -> u64 := { - (#_uXor returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_244]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for u32 where [] := { - noir_def bitxor<>(self: u32, other: u32) -> u32 := { - (#_uXor returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_245]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for u16 where [] := { - noir_def bitxor<>(self: u16, other: u16) -> u16 := { - (#_uXor returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_246]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for u8 where [] := { - noir_def bitxor<>(self: u8, other: u8) -> u8 := { - (#_uXor returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_247]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for u1 where [] := { - noir_def bitxor<>(self: u1, other: u1) -> u1 := { - (#_uXor returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_248]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for i8 where [] := { - noir_def bitxor<>(self: i8, other: i8) -> i8 := { - (#_iXor returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_249]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for i16 where [] := { - noir_def bitxor<>(self: i16, other: i16) -> i16 := { - (#_iXor returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_250]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for i32 where [] := { - noir_def bitxor<>(self: i32, other: i32) -> i32 := { - (#_iXor returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_251]<> «std-1.0.0-beta.14»::ops::bit::BitXor<> for i64 where [] := { - noir_def bitxor<>(self: i64, other: i64) -> i64 := { - (#_iXor returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_252]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for u128 where [] := { - noir_def shl<>(self: u128, other: u128) -> u128 := { - (#_uShl returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_253]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for u64 where [] := { - noir_def shl<>(self: u64, other: u64) -> u64 := { - (#_uShl returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_254]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for u32 where [] := { - noir_def shl<>(self: u32, other: u32) -> u32 := { - (#_uShl returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_255]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for u16 where [] := { - noir_def shl<>(self: u16, other: u16) -> u16 := { - (#_uShl returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_256]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for u8 where [] := { - noir_def shl<>(self: u8, other: u8) -> u8 := { - (#_uShl returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_257]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for u1 where [] := { - noir_def shl<>(self: u1, other: u1) -> u1 := { - (#_uShl returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_258]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for i8 where [] := { - noir_def shl<>(self: i8, other: i8) -> i8 := { - (#_iShl returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_259]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for i16 where [] := { - noir_def shl<>(self: i16, other: i16) -> i16 := { - (#_iShl returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_260]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for i32 where [] := { - noir_def shl<>(self: i32, other: i32) -> i32 := { - (#_iShl returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_261]<> «std-1.0.0-beta.14»::ops::bit::Shl<> for i64 where [] := { - noir_def shl<>(self: i64, other: i64) -> i64 := { - (#_iShl returning i64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_262]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for u128 where [] := { - noir_def shr<>(self: u128, other: u128) -> u128 := { - (#_uShr returning u128)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_263]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for u64 where [] := { - noir_def shr<>(self: u64, other: u64) -> u64 := { - (#_uShr returning u64)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_264]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for u32 where [] := { - noir_def shr<>(self: u32, other: u32) -> u32 := { - (#_uShr returning u32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_265]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for u16 where [] := { - noir_def shr<>(self: u16, other: u16) -> u16 := { - (#_uShr returning u16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_266]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for u8 where [] := { - noir_def shr<>(self: u8, other: u8) -> u8 := { - (#_uShr returning u8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_267]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for u1 where [] := { - noir_def shr<>(self: u1, other: u1) -> u1 := { - (#_uShr returning u1)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_268]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for i8 where [] := { - noir_def shr<>(self: i8, other: i8) -> i8 := { - (#_iShr returning i8)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_269]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for i16 where [] := { - noir_def shr<>(self: i16, other: i16) -> i16 := { - (#_iShr returning i16)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_270]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for i32 where [] := { - noir_def shr<>(self: i32, other: i32) -> i32 := { - (#_iShr returning i32)(self, other) - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_271]<> «std-1.0.0-beta.14»::ops::bit::Shr<> for i64 where [] := { - noir_def shr<>(self: i64, other: i64) -> i64 := { - (#_iShr returning i64)(self, other) - }; -} - -def «std-1.0.0-beta.14».Ops.Bit.env : Env := Env.mk - [] - [«std-1.0.0-beta.14».impl_208, «std-1.0.0-beta.14».impl_209, «std-1.0.0-beta.14».impl_210, «std-1.0.0-beta.14».impl_211, «std-1.0.0-beta.14».impl_212, «std-1.0.0-beta.14».impl_213, «std-1.0.0-beta.14».impl_214, «std-1.0.0-beta.14».impl_215, «std-1.0.0-beta.14».impl_216, «std-1.0.0-beta.14».impl_217, «std-1.0.0-beta.14».impl_218, «std-1.0.0-beta.14».impl_219, «std-1.0.0-beta.14».impl_220, «std-1.0.0-beta.14».impl_221, «std-1.0.0-beta.14».impl_222, «std-1.0.0-beta.14».impl_223, «std-1.0.0-beta.14».impl_224, «std-1.0.0-beta.14».impl_225, «std-1.0.0-beta.14».impl_226, «std-1.0.0-beta.14».impl_227, «std-1.0.0-beta.14».impl_228, «std-1.0.0-beta.14».impl_229, «std-1.0.0-beta.14».impl_230, «std-1.0.0-beta.14».impl_231, «std-1.0.0-beta.14».impl_232, «std-1.0.0-beta.14».impl_233, «std-1.0.0-beta.14».impl_234, «std-1.0.0-beta.14».impl_235, «std-1.0.0-beta.14».impl_236, «std-1.0.0-beta.14».impl_237, «std-1.0.0-beta.14».impl_238, «std-1.0.0-beta.14».impl_239, «std-1.0.0-beta.14».impl_240, «std-1.0.0-beta.14».impl_241, «std-1.0.0-beta.14».impl_242, «std-1.0.0-beta.14».impl_243, «std-1.0.0-beta.14».impl_244, «std-1.0.0-beta.14».impl_245, «std-1.0.0-beta.14».impl_246, «std-1.0.0-beta.14».impl_247, «std-1.0.0-beta.14».impl_248, «std-1.0.0-beta.14».impl_249, «std-1.0.0-beta.14».impl_250, «std-1.0.0-beta.14».impl_251, «std-1.0.0-beta.14».impl_252, «std-1.0.0-beta.14».impl_253, «std-1.0.0-beta.14».impl_254, «std-1.0.0-beta.14».impl_255, «std-1.0.0-beta.14».impl_256, «std-1.0.0-beta.14».impl_257, «std-1.0.0-beta.14».impl_258, «std-1.0.0-beta.14».impl_259, «std-1.0.0-beta.14».impl_260, «std-1.0.0-beta.14».impl_261, «std-1.0.0-beta.14».impl_262, «std-1.0.0-beta.14».impl_263, «std-1.0.0-beta.14».impl_264, «std-1.0.0-beta.14».impl_265, «std-1.0.0-beta.14».impl_266, «std-1.0.0-beta.14».impl_267, «std-1.0.0-beta.14».impl_268, «std-1.0.0-beta.14».impl_269, «std-1.0.0-beta.14».impl_270, «std-1.0.0-beta.14».impl_271] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Mod.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Mod.lean deleted file mode 100644 index 8b775a40..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Ops/Mod.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Ops.Mod.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Option.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Option.lean deleted file mode 100644 index 4fe7c887..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Option.lean +++ /dev/null @@ -1,194 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::option::Option::none() -> «std-1.0.0-beta.14»::option::Option := { - (#_makeData returning «std-1.0.0-beta.14»::option::Option)(#_false, (#_zeroed returning T)()) -} - -noir_def «std-1.0.0-beta.14»::option::Option::some(_value: T) -> «std-1.0.0-beta.14»::option::Option := { - (#_makeData returning «std-1.0.0-beta.14»::option::Option)(#_true, _value) -} - -noir_def «std-1.0.0-beta.14»::option::Option::is_none(self: «std-1.0.0-beta.14»::option::Option) -> bool := { - (#_bNot returning bool)(self.0) -} - -noir_def «std-1.0.0-beta.14»::option::Option::is_some(self: «std-1.0.0-beta.14»::option::Option) -> bool := { - self.0 -} - -noir_def «std-1.0.0-beta.14»::option::Option::unwrap(self: «std-1.0.0-beta.14»::option::Option) -> T := { - (#_assert returning Unit)(self.0); - self.1 -} - -noir_def «std-1.0.0-beta.14»::option::Option::unwrap_unchecked(self: «std-1.0.0-beta.14»::option::Option) -> T := { - self.1 -} - -noir_def «std-1.0.0-beta.14»::option::Option::unwrap_or(self: «std-1.0.0-beta.14»::option::Option, default: T) -> T := { - if self.0 then { - self.1 - } else { - default - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::unwrap_or_else(self: «std-1.0.0-beta.14»::option::Option, default: λ() -> T) -> T := { - if self.0 then { - self.1 - } else { - (default as λ() -> T)() - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::expect(self: «std-1.0.0-beta.14»::option::Option, message: FmtString) -> T := { - (#_assert returning Unit)((«std-1.0.0-beta.14»::option::Option::is_some as λ(«std-1.0.0-beta.14»::option::Option) -> bool)(self)); - self.1 -} - -noir_def «std-1.0.0-beta.14»::option::Option::map(self: «std-1.0.0-beta.14»::option::Option, f: λ(T) -> U) -> «std-1.0.0-beta.14»::option::Option := { - if self.0 then { - («std-1.0.0-beta.14»::option::Option::some as λ(U) -> «std-1.0.0-beta.14»::option::Option)((f as λ(T) -> U)(self.1)) - } else { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::map_or(self: «std-1.0.0-beta.14»::option::Option, default: U, f: λ(T) -> U) -> U := { - if self.0 then { - (f as λ(T) -> U)(self.1) - } else { - default - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::map_or_else(self: «std-1.0.0-beta.14»::option::Option, default: λ() -> U, f: λ(T) -> U) -> U := { - if self.0 then { - (f as λ(T) -> U)(self.1) - } else { - (default as λ() -> U)() - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::and(self: «std-1.0.0-beta.14»::option::Option, other: «std-1.0.0-beta.14»::option::Option) -> «std-1.0.0-beta.14»::option::Option := { - if («std-1.0.0-beta.14»::option::Option::is_none as λ(«std-1.0.0-beta.14»::option::Option) -> bool)(self) then { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } else { - other - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::and_then(self: «std-1.0.0-beta.14»::option::Option, f: λ(T) -> «std-1.0.0-beta.14»::option::Option) -> «std-1.0.0-beta.14»::option::Option := { - if self.0 then { - (f as λ(T) -> «std-1.0.0-beta.14»::option::Option)(self.1) - } else { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::or(self: «std-1.0.0-beta.14»::option::Option, other: «std-1.0.0-beta.14»::option::Option) -> «std-1.0.0-beta.14»::option::Option := { - if self.0 then { - self - } else { - other - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::or_else(self: «std-1.0.0-beta.14»::option::Option, default: λ() -> «std-1.0.0-beta.14»::option::Option) -> «std-1.0.0-beta.14»::option::Option := { - if self.0 then { - self - } else { - (default as λ() -> «std-1.0.0-beta.14»::option::Option)() - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::xor(self: «std-1.0.0-beta.14»::option::Option, other: «std-1.0.0-beta.14»::option::Option) -> «std-1.0.0-beta.14»::option::Option := { - if self.0 then { - if other.0 then { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } else { - self - } - } else if other.0 then { - other - } else { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::filter(self: «std-1.0.0-beta.14»::option::Option, predicate: λ(T) -> bool) -> «std-1.0.0-beta.14»::option::Option := { - if self.0 then { - if (predicate as λ(T) -> bool)(self.1) then { - self - } else { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } - } else { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } -} - -noir_def «std-1.0.0-beta.14»::option::Option::flatten(option: «std-1.0.0-beta.14»::option::Option<«std-1.0.0-beta.14»::option::Option >) -> «std-1.0.0-beta.14»::option::Option := { - if option.0 then { - option.1 - } else { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - } -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_73] «std-1.0.0-beta.14»::default::Default<> for «std-1.0.0-beta.14»::option::Option where [] := { - noir_def default<>() -> «std-1.0.0-beta.14»::option::Option := { - («std-1.0.0-beta.14»::option::Option::none as λ() -> «std-1.0.0-beta.14»::option::Option)() - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_74] «std-1.0.0-beta.14»::cmp::Eq<> for «std-1.0.0-beta.14»::option::Option where [T: «std-1.0.0-beta.14»::cmp::Eq<>] := { - noir_def eq<>(self: «std-1.0.0-beta.14»::option::Option, other: «std-1.0.0-beta.14»::option::Option) -> bool := { - if (#_bEq returning bool)(self.0, other.0) then { - if self.0 then { - ((T as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)(self.1, other.1) - } else { - #_true - } - } else { - #_false - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_75] «std-1.0.0-beta.14»::hash::Hash<> for «std-1.0.0-beta.14»::option::Option where [T: «std-1.0.0-beta.14»::hash::Hash<>] := { - noir_def hash(self: «std-1.0.0-beta.14»::option::Option, state: & H) -> Unit := { - ((bool as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(bool, & H) -> Unit)(self.0, state); - if self.0 then { - ((T as «std-1.0.0-beta.14»::hash::Hash<>)::hash as λ(T, & H) -> Unit)(self.1, state); - #_skip - } - }; -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_76] «std-1.0.0-beta.14»::cmp::Ord<> for «std-1.0.0-beta.14»::option::Option where [T: «std-1.0.0-beta.14»::cmp::Ord<>] := { - noir_def cmp<>(self: «std-1.0.0-beta.14»::option::Option, other: «std-1.0.0-beta.14»::option::Option) -> «std-1.0.0-beta.14»::cmp::Ordering<> := { - if self.0 then { - if other.0 then { - ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)(self.1, other.1) - } else { - («std-1.0.0-beta.14»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - } else if other.0 then { - («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } else { - («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)() - } - }; -} - -def «std-1.0.0-beta.14».Option.env : Env := Env.mk - [«std-1.0.0-beta.14::option::Option::none», «std-1.0.0-beta.14::option::Option::some», «std-1.0.0-beta.14::option::Option::is_none», «std-1.0.0-beta.14::option::Option::is_some», «std-1.0.0-beta.14::option::Option::unwrap», «std-1.0.0-beta.14::option::Option::unwrap_unchecked», «std-1.0.0-beta.14::option::Option::unwrap_or», «std-1.0.0-beta.14::option::Option::unwrap_or_else», «std-1.0.0-beta.14::option::Option::expect», «std-1.0.0-beta.14::option::Option::map», «std-1.0.0-beta.14::option::Option::map_or», «std-1.0.0-beta.14::option::Option::map_or_else», «std-1.0.0-beta.14::option::Option::and», «std-1.0.0-beta.14::option::Option::and_then», «std-1.0.0-beta.14::option::Option::or», «std-1.0.0-beta.14::option::Option::or_else», «std-1.0.0-beta.14::option::Option::xor», «std-1.0.0-beta.14::option::Option::filter», «std-1.0.0-beta.14::option::Option::flatten»] - [«std-1.0.0-beta.14».impl_73, «std-1.0.0-beta.14».impl_74, «std-1.0.0-beta.14».impl_75, «std-1.0.0-beta.14».impl_76] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Panic.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Panic.lean deleted file mode 100644 index 483d617e..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Panic.lean +++ /dev/null @@ -1,23 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::panic::panic(message: T) -> U := { - (#_assert returning Unit)(#_false); - (#_zeroed returning U)() -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_317] «std-1.0.0-beta.14»::panic::StringLike<> for String where [] := { -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_318] «std-1.0.0-beta.14»::panic::StringLike<> for FmtString where [] := { -} - -def «std-1.0.0-beta.14».Panic.env : Env := Env.mk - [«std-1.0.0-beta.14::panic::panic»] - [«std-1.0.0-beta.14».impl_317, «std-1.0.0-beta.14».impl_318] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Prelude.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Prelude.lean deleted file mode 100644 index 8092f83a..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Prelude.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Prelude.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/PrimitiveDocs.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/PrimitiveDocs.lean deleted file mode 100644 index 5ac6e7cb..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/PrimitiveDocs.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».PrimitiveDocs.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Runtime.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Runtime.lean deleted file mode 100644 index bd31bf01..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Runtime.lean +++ /dev/null @@ -1,12 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -def «std-1.0.0-beta.14».Runtime.env : Env := Env.mk - [] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/String.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/String.lean deleted file mode 100644 index cf2127dd..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/String.lean +++ /dev/null @@ -1,22 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::string::as_bytes_vec(self: String) -> Vector := { - (#_asVector returning Vector)((#_strAsBytes returning Array)(self)) -} - -noir_trait_impl[«std-1.0.0-beta.14».impl_77] «std-1.0.0-beta.14»::convert::From > for String where [] := { - noir_def «from»<>(bytes: Array) -> String := { - (#_arrayAsStrUnchecked returning String)(bytes) - }; -} - -def «std-1.0.0-beta.14».String.env : Env := Env.mk - [«std-1.0.0-beta.14::string::as_bytes_vec»] - [«std-1.0.0-beta.14».impl_77] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Test.lean b/stdlib/lampe/std-1.0.0-beta.14/Extracted/Test.lean deleted file mode 100644 index 7d79dede..00000000 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Test.lean +++ /dev/null @@ -1,68 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -set_option linter.unusedVariables false - -noir_def «std-1.0.0-beta.14»::test::create_mock_oracle(name: String) -> Field := { - (#_fresh returning Field)() -} - -noir_def «std-1.0.0-beta.14»::test::set_mock_params_oracle(id: Field, params: P) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::test::get_mock_last_params_oracle(id: Field) -> P := { - (#_fresh returning P)() -} - -noir_def «std-1.0.0-beta.14»::test::set_mock_returns_oracle(id: Field, returns: R) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::test::set_mock_times_oracle<>(id: Field, times: u64) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::test::clear_mock_oracle<>(id: Field) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::test::get_times_mock_called<>(id: Field) -> Field := { - (#_fresh returning Field)() -} - -noir_def «std-1.0.0-beta.14»::test::OracleMock::mock(name: String) -> «std-1.0.0-beta.14»::test::OracleMock<> := { - (#_fresh returning «std-1.0.0-beta.14»::test::OracleMock<>)() -} - -noir_def «std-1.0.0-beta.14»::test::OracleMock::with_params(self: «std-1.0.0-beta.14»::test::OracleMock<>, params: P) -> «std-1.0.0-beta.14»::test::OracleMock<> := { - (#_fresh returning «std-1.0.0-beta.14»::test::OracleMock<>)() -} - -noir_def «std-1.0.0-beta.14»::test::OracleMock::get_last_params(self: «std-1.0.0-beta.14»::test::OracleMock<>) -> P := { - (#_fresh returning P)() -} - -noir_def «std-1.0.0-beta.14»::test::OracleMock::returns(self: «std-1.0.0-beta.14»::test::OracleMock<>, returns: R) -> «std-1.0.0-beta.14»::test::OracleMock<> := { - (#_fresh returning «std-1.0.0-beta.14»::test::OracleMock<>)() -} - -noir_def «std-1.0.0-beta.14»::test::OracleMock::times<>(self: «std-1.0.0-beta.14»::test::OracleMock<>, times: u64) -> «std-1.0.0-beta.14»::test::OracleMock<> := { - (#_fresh returning «std-1.0.0-beta.14»::test::OracleMock<>)() -} - -noir_def «std-1.0.0-beta.14»::test::OracleMock::clear<>(self: «std-1.0.0-beta.14»::test::OracleMock<>) -> Unit := { - (#_fresh returning Unit)() -} - -noir_def «std-1.0.0-beta.14»::test::OracleMock::times_called<>(self: «std-1.0.0-beta.14»::test::OracleMock<>) -> Field := { - (#_fresh returning Field)() -} - -def «std-1.0.0-beta.14».Test.env : Env := Env.mk - [«std-1.0.0-beta.14::test::create_mock_oracle», «std-1.0.0-beta.14::test::set_mock_params_oracle», «std-1.0.0-beta.14::test::get_mock_last_params_oracle», «std-1.0.0-beta.14::test::set_mock_returns_oracle», «std-1.0.0-beta.14::test::set_mock_times_oracle», «std-1.0.0-beta.14::test::clear_mock_oracle», «std-1.0.0-beta.14::test::get_times_mock_called», «std-1.0.0-beta.14::test::OracleMock::mock», «std-1.0.0-beta.14::test::OracleMock::with_params», «std-1.0.0-beta.14::test::OracleMock::get_last_params», «std-1.0.0-beta.14::test::OracleMock::returns», «std-1.0.0-beta.14::test::OracleMock::times», «std-1.0.0-beta.14::test::OracleMock::clear», «std-1.0.0-beta.14::test::OracleMock::times_called»] - [] diff --git a/stdlib/lampe/std-1.0.0-beta.25.lean b/stdlib/lampe/std-1.0.0-beta.25.lean new file mode 100644 index 00000000..5c8d51a4 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25.lean @@ -0,0 +1,3 @@ + +import «std-1.0.0-beta.25».Extracted + diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted.lean new file mode 100644 index 00000000..bfec24f6 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted.lean @@ -0,0 +1,108 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.Aes128 +import «std-1.0.0-beta.25».Extracted.Append +import «std-1.0.0-beta.25».Extracted.Array.CheckShuffle +import «std-1.0.0-beta.25».Extracted.Array.Mod +import «std-1.0.0-beta.25».Extracted.Array.Quicksort +import «std-1.0.0-beta.25».Extracted.Cmp +import «std-1.0.0-beta.25».Extracted.Collections.BoundedVec +import «std-1.0.0-beta.25».Extracted.Collections.Mod +import «std-1.0.0-beta.25».Extracted.Collections.Umap +import «std-1.0.0-beta.25».Extracted.Compat +import «std-1.0.0-beta.25».Extracted.Convert +import «std-1.0.0-beta.25».Extracted.Default +import «std-1.0.0-beta.25».Extracted.EcdsaSecp256K1 +import «std-1.0.0-beta.25».Extracted.EcdsaSecp256R1 +import «std-1.0.0-beta.25».Extracted.EmbeddedCurveOps +import «std-1.0.0-beta.25».Extracted.Field.Bn254 +import «std-1.0.0-beta.25».Extracted.Field.Mod +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.Hash.Mod +import «std-1.0.0-beta.25».Extracted.Hash.Poseidon2 +import «std-1.0.0-beta.25».Extracted.Hint +import «std-1.0.0-beta.25».Extracted.Integer +import «std-1.0.0-beta.25».Extracted.Internal.Mod +import «std-1.0.0-beta.25».Extracted.Lib +import «std-1.0.0-beta.25».Extracted.Mem +import «std-1.0.0-beta.25».Extracted.Meta.Ctstring +import «std-1.0.0-beta.25».Extracted.Meta.Expr +import «std-1.0.0-beta.25».Extracted.Meta.FormatString +import «std-1.0.0-beta.25».Extracted.Meta.FunctionDef +import «std-1.0.0-beta.25».Extracted.Meta.Location +import «std-1.0.0-beta.25».Extracted.Meta.Mod +import «std-1.0.0-beta.25».Extracted.Meta.Module +import «std-1.0.0-beta.25».Extracted.Meta.Op +import «std-1.0.0-beta.25».Extracted.Meta.Quoted +import «std-1.0.0-beta.25».Extracted.Meta.TraitConstraint +import «std-1.0.0-beta.25».Extracted.Meta.TraitDef +import «std-1.0.0-beta.25».Extracted.Meta.TraitImpl +import «std-1.0.0-beta.25».Extracted.Meta.Typ +import «std-1.0.0-beta.25».Extracted.Meta.TypeDef +import «std-1.0.0-beta.25».Extracted.Meta.TypedExpr +import «std-1.0.0-beta.25».Extracted.Meta.UnresolvedType +import «std-1.0.0-beta.25».Extracted.Ops.Arith +import «std-1.0.0-beta.25».Extracted.Ops.Bit +import «std-1.0.0-beta.25».Extracted.Ops.Mod +import «std-1.0.0-beta.25».Extracted.Option +import «std-1.0.0-beta.25».Extracted.Panic +import «std-1.0.0-beta.25».Extracted.Prelude +import «std-1.0.0-beta.25».Extracted.PrimitiveDocs +import «std-1.0.0-beta.25».Extracted.Runtime +import «std-1.0.0-beta.25».Extracted.String +import «std-1.0.0-beta.25».Extracted.Test +import «std-1.0.0-beta.25».Extracted.Vector + +namespace «std-1.0.0-beta.25» + +def env := Aes128.env + ++ Append.env + ++ Array.CheckShuffle.env + ++ Array.Mod.env + ++ Array.Quicksort.env + ++ Cmp.env + ++ Collections.BoundedVec.env + ++ Collections.Mod.env + ++ Collections.Umap.env + ++ Compat.env + ++ Convert.env + ++ Default.env + ++ EcdsaSecp256K1.env + ++ EcdsaSecp256R1.env + ++ EmbeddedCurveOps.env + ++ Field.Bn254.env + ++ Field.Mod.env + ++ Hash.Mod.env + ++ Hash.Poseidon2.env + ++ Hint.env + ++ Integer.env + ++ Internal.Mod.env + ++ Lib.env + ++ Mem.env + ++ Meta.Ctstring.env + ++ Meta.Expr.env + ++ Meta.FormatString.env + ++ Meta.FunctionDef.env + ++ Meta.Location.env + ++ Meta.Mod.env + ++ Meta.Module.env + ++ Meta.Op.env + ++ Meta.Quoted.env + ++ Meta.TraitConstraint.env + ++ Meta.TraitDef.env + ++ Meta.TraitImpl.env + ++ Meta.Typ.env + ++ Meta.TypeDef.env + ++ Meta.TypedExpr.env + ++ Meta.UnresolvedType.env + ++ Ops.Arith.env + ++ Ops.Bit.env + ++ Ops.Mod.env + ++ Option.env + ++ Panic.env + ++ Prelude.env + ++ PrimitiveDocs.env + ++ Runtime.env + ++ String.env + ++ Test.env + ++ Vector.env diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Aes128.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Aes128.lean new file mode 100644 index 00000000..83251371 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Aes128.lean @@ -0,0 +1,36 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::aes128::aes128_encrypt(input: Array, iv: Array, key: Array) -> Array := { + let padding_length = (#_cast returning u8)((#_uSub returning u32)((16: u32), (#_uRem returning u32)(uConst!(N: u32), (16: u32)))); + let padded_input = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); + for i in (0: u32) .. uConst!(N: u32) do { + (padded_input[i]: u8) = (#_arrayIndex returning u8)(input, (#_cast returning u32)(i)); + #_skip + }; + for i in uConst!(N: u32) .. (#_uSub returning u32)((#_uAdd returning u32)(uConst!(N: u32), (16: u32)), (#_uRem returning u32)(uConst!(N: u32), (16: u32))) do { + (padded_input[i]: u8) = padding_length; + #_skip + }; + let output = (#_aes128Encrypt returning Array)((#_readRef returning Array)(padded_input), iv, key); + output +} + +noir_def «std-1.0.0-beta.25»::aes128::tests::encrypt<>() -> Unit := { + let input = (#_strAsBytes returning Array)("kevlovesrust"); + let iv = (#_strAsBytes returning Array)("0000000000000000"); + let key = (#_strAsBytes returning Array)("0000000000000000"); + let output = (#_mkArray returning Array)((244: u8), (14: u8), (126: u8), (172: u8), (171: u8), (40: u8), (208: u8), (186: u8), (173: u8), (184: u8), (226: u8), (105: u8), (238: u8), (122: u8), (205: u8), (191: u8)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::aes128::aes128_encrypt<12: u32> as λ(Array, Array, Array) -> Array)(input, iv, key), output)); + #_skip +} + +def «std-1.0.0-beta.25».Aes128.env : Env := Env.mk + [«std-1.0.0-beta.25::aes128::aes128_encrypt», «std-1.0.0-beta.25::aes128::tests::encrypt»] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Append.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Append.lean new file mode 100644 index 00000000..8deadce3 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Append.lean @@ -0,0 +1,40 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_331] «std-1.0.0-beta.25»::append::Append<> for Vector where [] := { + noir_def empty<>() -> Vector := { + (#_asVector returning Vector)((#_mkArray returning Array)()) + }; + + noir_def append<>(self: Vector, other: Vector) -> Vector := { + («std-1.0.0-beta.25»::vector::append as λ(Vector, Vector) -> Vector)(self, other) + }; +} + +noir_def «std-1.0.0-beta.25»::append::tests::vector_empty<>() -> Unit := { + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(((Vector as «std-1.0.0-beta.25»::append::Append<>)::empty<> as λ() -> Vector)(), (#_mkVector returning Vector)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::append::tests::vector_append<>() -> Unit := { + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(((Vector as «std-1.0.0-beta.25»::append::Append<>)::append<> as λ(Vector, Vector) -> Vector)((#_mkVector returning Vector)((1: Field), (2: Field)), (#_asVector returning Vector)((#_mkArray returning Array)((3: Field), (4: Field), (5: Field)))), (#_mkVector returning Vector)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::append::tests::quoted_append<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::append::tests::quoted_empty<>() -> Unit := { + #_unit +} + +def «std-1.0.0-beta.25».Append.env : Env := Env.mk + [«std-1.0.0-beta.25::append::tests::vector_empty», «std-1.0.0-beta.25::append::tests::vector_append», «std-1.0.0-beta.25::append::tests::quoted_append», «std-1.0.0-beta.25::append::tests::quoted_empty»] + [«std-1.0.0-beta.25».impl_331] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/CheckShuffle.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/CheckShuffle.lean new file mode 100644 index 00000000..e3916d30 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/CheckShuffle.lean @@ -0,0 +1,136 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::__get_shuffle_indices(lhs: & Array, rhs: & Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::__get_index(indices: & Array, idx: u32) -> u32 := { + (#_fresh returning u32)() +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::check_shuffle(lhs: & Array, rhs: & Array) -> Unit := { + let shuffle_indices = («std-1.0.0-beta.25»::array::check_shuffle::__get_shuffle_indices as λ(& Array, & Array) -> Array)(lhs, rhs); + for i in (0: u32) .. uConst!(N: u32) do { + let idx = («std-1.0.0-beta.25»::array::check_shuffle::__get_index as λ(& Array, u32) -> u32)((#_ref returning & Array)(shuffle_indices), i); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)(shuffle_indices, (#_cast returning u32)(idx)), i)); + #_skip + }; + for i in (0: u32) .. uConst!(N: u32) do { + let idx = (#_arrayIndex returning u32)(shuffle_indices, (#_cast returning u32)(i)); + let expected = (#_arrayIndex returning T)((#_readRef returning Array)(rhs), (#_cast returning u32)(idx)); + let result = (#_arrayIndex returning T)((#_readRef returning Array)(lhs), (#_cast returning u32)(i)); + (#_assert returning Unit)(((T as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)(expected, result)); + #_skip + }; + #_skip +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_30]<> «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<> where [] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, other: «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bEq returning bool)(self.0, other.0), (#_fEq returning bool)(self.1, other.1)), (#_uEq returning bool)(self.2, other.2)) + }; +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle<>() -> Unit := { + let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); + let rhs = (#_mkArray returning Array)((2: Field), (0: Field), (3: Field), (1: Field), (4: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_identity<>() -> Unit := { + let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); + let rhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_fail<>() -> Unit := { + let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); + let rhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (5: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_duplicates<>() -> Unit := { + let lhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (4: Field)); + let rhs = (#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field), (3: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_compound_struct<>() -> Unit := { + let lhs = (#_mkArray returning Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 5: u32>)((#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (12345: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (-100: Field), (54321: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_true, (5: Field), (18446744073709551615: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_true, (9814: Field), (17221745184140693811: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (341: Field), (0: u64))); + let rhs = (#_mkArray returning Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 5: u32>)((#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (341: Field), (0: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (12345: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (-100: Field), (54321: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_true, (9814: Field), (17221745184140693811: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_true, (5: Field), (18446744073709551615: u64))); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 5: u32> as λ(& Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 5: u32>, & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 5: u32>) -> Unit)((#_ref returning & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 5: u32>)(lhs), (#_ref returning & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 5: u32>)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_empty_array<>() -> Unit := { + let lhs = (#_mkArray returning Array)(); + let rhs = (#_mkArray returning Array)(); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_single_element<>() -> Unit := { + let lhs = (#_mkArray returning Array)((42: Field)); + let rhs = (#_mkArray returning Array)((42: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_with_duplicates<>() -> Unit := { + let lhs = (#_mkArray returning Array)((1: Field), (2: Field), (1: Field), (3: Field)); + let rhs = (#_mkArray returning Array)((1: Field), (3: Field), (1: Field), (2: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_all_same_values<>() -> Unit := { + let lhs = (#_mkArray returning Array)((42: Field), (42: Field), (42: Field), (42: Field), (42: Field)); + let rhs = (#_mkArray returning Array)((42: Field), (42: Field), (42: Field), (42: Field), (42: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_bool<>() -> Unit := { + let lhs = (#_mkArray returning Array)(#_true, #_false, #_true, #_false); + let rhs = (#_mkArray returning Array)(#_false, #_true, #_false, #_true); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_compound_struct_with_duplicates<>() -> Unit := { + let struct1 = (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_true, (42: Field), (100: u64)); + let struct2 = (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (200: u64)); + let lhs = (#_mkArray returning Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 4: u32>)(struct1, struct2, struct1, struct2); + let rhs = (#_mkArray returning Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 4: u32>)(struct2, struct1, struct2, struct1); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 4: u32> as λ(& Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 4: u32>, & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 4: u32>) -> Unit)((#_ref returning & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 4: u32>)(lhs), (#_ref returning & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 4: u32>)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_compound_struct_fail<>() -> Unit := { + let lhs = (#_mkArray returning Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 2: u32>)((#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_true, (42: Field), (100: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (0: Field), (200: u64))); + let rhs = (#_mkArray returning Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 2: u32>)((#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_true, (42: Field), (100: u64)), (#_makeData returning «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>)(#_false, (1: Field), (200: u64))); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 2: u32> as λ(& Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 2: u32>, & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 2: u32>) -> Unit)((#_ref returning & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 2: u32>)(lhs), (#_ref returning & Array<«std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<>, 2: u32>)(rhs)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::check_shuffle::test::test_shuffle_negative_values<>() -> Unit := { + let lhs = (#_mkArray returning Array)((-1: Field), (-2: Field), (-3: Field), (-4: Field)); + let rhs = (#_mkArray returning Array)((-4: Field), (-3: Field), (-2: Field), (-1: Field)); + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)((#_ref returning & Array)(lhs), (#_ref returning & Array)(rhs)); + #_skip +} + +def «std-1.0.0-beta.25».Array.CheckShuffle.env : Env := Env.mk + [«std-1.0.0-beta.25::array::check_shuffle::__get_shuffle_indices», «std-1.0.0-beta.25::array::check_shuffle::__get_index», «std-1.0.0-beta.25::array::check_shuffle::check_shuffle», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_identity», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_fail», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_duplicates», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_compound_struct», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_empty_array», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_single_element», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_with_duplicates», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_all_same_values», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_bool», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_compound_struct_with_duplicates», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_compound_struct_fail», «std-1.0.0-beta.25::array::check_shuffle::test::test_shuffle_negative_values»] + [«std-1.0.0-beta.25».impl_30] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Mod.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Mod.lean new file mode 100644 index 00000000..62aa0d27 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Mod.lean @@ -0,0 +1,361 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::array::map(self: & Array, f: λ(T) -> U) -> Array := { + let uninitialized = (#_zeroed returning U)(); + let ret = (#_ref returning & Array)((#_mkRepeatedArray returning Array)(uninitialized)); + for i in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(self)) do { + (ret[i]: U) = (f as λ(T) -> U)((#_arrayIndex returning T)((#_readRef returning Array)(self), (#_cast returning u32)(i))); + #_skip + }; + (#_readRef returning Array)(ret) +} + +noir_def «std-1.0.0-beta.25»::array::mapi(self: & Array, f: λ(u32, T) -> U) -> Array := { + let uninitialized = (#_zeroed returning U)(); + let ret = (#_ref returning & Array)((#_mkRepeatedArray returning Array)(uninitialized)); + for i in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(self)) do { + (ret[i]: U) = (f as λ(u32, T) -> U)(i, (#_arrayIndex returning T)((#_readRef returning Array)(self), (#_cast returning u32)(i))); + #_skip + }; + (#_readRef returning Array)(ret) +} + +noir_def «std-1.0.0-beta.25»::array::for_each(self: & Array, f: λ(T) -> Unit) -> Unit := { + for i in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(self)) do { + (f as λ(T) -> Unit)((#_arrayIndex returning T)((#_readRef returning Array)(self), (#_cast returning u32)(i))); + #_skip + }; + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::for_eachi(self: & Array, f: λ(u32, T) -> Unit) -> Unit := { + for i in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(self)) do { + (f as λ(u32, T) -> Unit)(i, (#_arrayIndex returning T)((#_readRef returning Array)(self), (#_cast returning u32)(i))); + #_skip + }; + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::fold(self: & Array, accumulator: U, f: λ(U, T) -> U) -> U := { + let accumulator = (#_ref returning & U)(accumulator); + { + { + let ζi0 = self; + for ζi1 in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(ζi0)) do { + let elem = (#_arrayIndex returning T)((#_readRef returning Array)(ζi0), (#_cast returning u32)(ζi1)); + { + accumulator = (f as λ(U, T) -> U)((#_readRef returning U)(accumulator), elem); + #_skip + } + }; + #_skip + }; + (#_readRef returning U)(accumulator) +} +} + +noir_def «std-1.0.0-beta.25»::array::reduce(self: & Array, f: λ(T, T) -> T) -> T := { + let accumulator = (#_ref returning & T)((#_arrayIndex returning T)((#_readRef returning Array)(self), (0: u32))); + for i in (1: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(self)) do { + accumulator = (f as λ(T, T) -> T)((#_readRef returning T)(accumulator), (#_arrayIndex returning T)((#_readRef returning Array)(self), (#_cast returning u32)(i))); + #_skip + }; + (#_readRef returning T)(accumulator) +} + +noir_def «std-1.0.0-beta.25»::array::«all»(self: & Array, predicate: λ(T) -> bool) -> bool := { + let ret = (#_ref returning & bool)(#_true); + { + let ζi0 = self; + for ζi1 in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(ζi0)) do { + let elem = (#_arrayIndex returning T)((#_readRef returning Array)(ζi0), (#_cast returning u32)(ζi1)); + { + let op_rhs_0 = (predicate as λ(T) -> bool)(elem); + ret = (#_bAnd returning bool)((#_readRef returning bool)(ret), op_rhs_0); + #_skip + } + }; + #_skip + }; + (#_readRef returning bool)(ret) +} + +noir_def «std-1.0.0-beta.25»::array::any(self: & Array, predicate: λ(T) -> bool) -> bool := { + let ret = (#_ref returning & bool)(#_false); + { + let ζi0 = self; + for ζi1 in (0: u32) .. (#_arrayLen returning u32)((#_readRef returning Array)(ζi0)) do { + let elem = (#_arrayIndex returning T)((#_readRef returning Array)(ζi0), (#_cast returning u32)(ζi1)); + { + let op_rhs_0 = (predicate as λ(T) -> bool)(elem); + ret = (#_bOr returning bool)((#_readRef returning bool)(ret), op_rhs_0); + #_skip + } + }; + #_skip + }; + (#_readRef returning bool)(ret) +} + +noir_def «std-1.0.0-beta.25»::array::concat(self: & Array, array2: Array) -> Array := { + let result = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((#_zeroed returning T)())); + for i in (0: u32) .. uConst!(N: u32) do { + (result[i]: T) = (#_arrayIndex returning T)((#_readRef returning Array)(self), (#_cast returning u32)(i)); + #_skip + }; + for i in (0: u32) .. uConst!(M: u32) do { + (result[(#_uAdd returning u32)(i, uConst!(N: u32))]: T) = (#_arrayIndex returning T)(array2, (#_cast returning u32)(i)); + #_skip + }; + (#_readRef returning Array)(result) +} + +noir_def «std-1.0.0-beta.25»::array::sort(self: & Array) -> Array := { + («std-1.0.0-beta.25»::array::sort_via as λ(& Array, λ(T, T) -> bool) -> Array)(self, (fn(a: T, b: T): bool := { + let __0 = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(a, b); + let __1 = («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + let __3 = («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + let __7 = ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __1); + let __15 = ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __3); + (#_bOr returning bool)(__7, __15) + })) +} + +noir_def «std-1.0.0-beta.25»::array::sort_via(self: & Array, ordering: λ(T, T) -> bool) -> Array := { + if (#_uNeq returning bool)(uConst!(N: u32), (0: u32)) then { + let sorted = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(T, T) -> bool) -> Array)(self, (ordering as λ(T, T) -> bool)) + }; + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + for i in (0: u32) .. (#_uSub returning u32)(uConst!(N: u32), (1: u32)) do { + (#_assert returning Unit)((ordering as λ(T, T) -> bool)((#_arrayIndex returning T)(sorted, (#_cast returning u32)(i)), (#_arrayIndex returning T)(sorted, (#_cast returning u32)((#_uAdd returning u32)(i, (1: u32)))))); + #_skip + }; + («std-1.0.0-beta.25»::array::check_shuffle::check_shuffle as λ(& Array, & Array) -> Unit)(self, (#_ref returning & Array)(sorted)); + #_skip + }; + sorted + } else { + (#_readRef returning Array)(self) + } +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_31] «std-1.0.0-beta.25»::convert::From > for Array where [] := { + noir_def «from»<>(s: String) -> Array := { + (#_strAsBytes returning Array)(s) + }; +} + +noir_def «std-1.0.0-beta.25»::array::test::map_empty<>() -> Unit := { + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::array::map as λ(& Array, λ(Field) -> Field) -> Array)((#_ref returning & Array)((#_mkArray returning Array)()), (fn(x: Field): Field := (#_fAdd returning Field)(x, (1: Field)))), (#_mkArray returning Array)())); + #_skip +} + +noir_global_def «std-1.0.0-beta.25»::array::test::arr_with_100_values: Array = (#_mkArray returning Array)((42: u32), (123: u32), (87: u32), (93: u32), (48: u32), (80: u32), (50: u32), (5: u32), (104: u32), (84: u32), (70: u32), (47: u32), (119: u32), (66: u32), (71: u32), (121: u32), (3: u32), (29: u32), (42: u32), (118: u32), (2: u32), (54: u32), (89: u32), (44: u32), (81: u32), (0: u32), (26: u32), (106: u32), (68: u32), (96: u32), (84: u32), (48: u32), (95: u32), (54: u32), (45: u32), (32: u32), (89: u32), (100: u32), (109: u32), (19: u32), (37: u32), (41: u32), (19: u32), (98: u32), (53: u32), (114: u32), (107: u32), (66: u32), (6: u32), (74: u32), (13: u32), (19: u32), (105: u32), (64: u32), (123: u32), (28: u32), (44: u32), (50: u32), (89: u32), (58: u32), (123: u32), (126: u32), (21: u32), (43: u32), (86: u32), (35: u32), (21: u32), (62: u32), (82: u32), (0: u32), (108: u32), (120: u32), (72: u32), (72: u32), (62: u32), (80: u32), (12: u32), (71: u32), (70: u32), (86: u32), (116: u32), (73: u32), (38: u32), (15: u32), (127: u32), (81: u32), (30: u32), (8: u32), (125: u32), (28: u32), (26: u32), (69: u32), (114: u32), (63: u32), (27: u32), (28: u32), (61: u32), (42: u32), (13: u32), (32: u32)); + +noir_global_def «std-1.0.0-beta.25»::array::test::expected_with_100_values: Array = (#_mkArray returning Array)((0: u32), (0: u32), (2: u32), (3: u32), (5: u32), (6: u32), (8: u32), (12: u32), (13: u32), (13: u32), (15: u32), (19: u32), (19: u32), (19: u32), (21: u32), (21: u32), (26: u32), (26: u32), (27: u32), (28: u32), (28: u32), (28: u32), (29: u32), (30: u32), (32: u32), (32: u32), (35: u32), (37: u32), (38: u32), (41: u32), (42: u32), (42: u32), (42: u32), (43: u32), (44: u32), (44: u32), (45: u32), (47: u32), (48: u32), (48: u32), (50: u32), (50: u32), (53: u32), (54: u32), (54: u32), (58: u32), (61: u32), (62: u32), (62: u32), (63: u32), (64: u32), (66: u32), (66: u32), (68: u32), (69: u32), (70: u32), (70: u32), (71: u32), (71: u32), (72: u32), (72: u32), (73: u32), (74: u32), (80: u32), (80: u32), (81: u32), (81: u32), (82: u32), (84: u32), (84: u32), (86: u32), (86: u32), (87: u32), (89: u32), (89: u32), (89: u32), (93: u32), (95: u32), (96: u32), (98: u32), (100: u32), (104: u32), (105: u32), (106: u32), (107: u32), (108: u32), (109: u32), (114: u32), (114: u32), (116: u32), (118: u32), (119: u32), (120: u32), (121: u32), (123: u32), (123: u32), (123: u32), (125: u32), (126: u32), (127: u32)); + +noir_def «std-1.0.0-beta.25»::array::test::sort_u32<>(a: u32, b: u32) -> bool := { + (#_uLeq returning bool)(a, b) +} + +noir_def «std-1.0.0-beta.25»::array::test::test_sort<>() -> Unit := { + let arr = (#_mkArray returning Array)((3: u32), (6: u32), (8: u32), (10: u32), (1: u32), (2: u32), (1: u32)); + let sorted = («std-1.0.0-beta.25»::array::sort as λ(& Array) -> Array)((#_ref returning & Array)(arr)); + let expected = (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (6: u32), (8: u32), (10: u32)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_sort_empty<>() -> Unit := { + let arr = (#_mkArray returning Array)(); + let sorted = («std-1.0.0-beta.25»::array::sort as λ(& Array) -> Array)((#_ref returning & Array)(arr)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, arr)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_sort_via_empty<>() -> Unit := { + let arr = (#_mkArray returning Array)(); + let sorted = («std-1.0.0-beta.25»::array::sort_via as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::test::sort_u32<> as λ(u32, u32) -> bool)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, arr)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_sort_100_values<>() -> Unit := { + let arr = (#_mkArray returning Array)((42: u32), (123: u32), (87: u32), (93: u32), (48: u32), (80: u32), (50: u32), (5: u32), (104: u32), (84: u32), (70: u32), (47: u32), (119: u32), (66: u32), (71: u32), (121: u32), (3: u32), (29: u32), (42: u32), (118: u32), (2: u32), (54: u32), (89: u32), (44: u32), (81: u32), (0: u32), (26: u32), (106: u32), (68: u32), (96: u32), (84: u32), (48: u32), (95: u32), (54: u32), (45: u32), (32: u32), (89: u32), (100: u32), (109: u32), (19: u32), (37: u32), (41: u32), (19: u32), (98: u32), (53: u32), (114: u32), (107: u32), (66: u32), (6: u32), (74: u32), (13: u32), (19: u32), (105: u32), (64: u32), (123: u32), (28: u32), (44: u32), (50: u32), (89: u32), (58: u32), (123: u32), (126: u32), (21: u32), (43: u32), (86: u32), (35: u32), (21: u32), (62: u32), (82: u32), (0: u32), (108: u32), (120: u32), (72: u32), (72: u32), (62: u32), (80: u32), (12: u32), (71: u32), (70: u32), (86: u32), (116: u32), (73: u32), (38: u32), (15: u32), (127: u32), (81: u32), (30: u32), (8: u32), (125: u32), (28: u32), (26: u32), (69: u32), (114: u32), (63: u32), (27: u32), (28: u32), (61: u32), (42: u32), (13: u32), (32: u32)); + let sorted = («std-1.0.0-beta.25»::array::sort as λ(& Array) -> Array)((#_ref returning & Array)(arr)); + let expected = (#_mkArray returning Array)((0: u32), (0: u32), (2: u32), (3: u32), (5: u32), (6: u32), (8: u32), (12: u32), (13: u32), (13: u32), (15: u32), (19: u32), (19: u32), (19: u32), (21: u32), (21: u32), (26: u32), (26: u32), (27: u32), (28: u32), (28: u32), (28: u32), (29: u32), (30: u32), (32: u32), (32: u32), (35: u32), (37: u32), (38: u32), (41: u32), (42: u32), (42: u32), (42: u32), (43: u32), (44: u32), (44: u32), (45: u32), (47: u32), (48: u32), (48: u32), (50: u32), (50: u32), (53: u32), (54: u32), (54: u32), (58: u32), (61: u32), (62: u32), (62: u32), (63: u32), (64: u32), (66: u32), (66: u32), (68: u32), (69: u32), (70: u32), (70: u32), (71: u32), (71: u32), (72: u32), (72: u32), (73: u32), (74: u32), (80: u32), (80: u32), (81: u32), (81: u32), (82: u32), (84: u32), (84: u32), (86: u32), (86: u32), (87: u32), (89: u32), (89: u32), (89: u32), (93: u32), (95: u32), (96: u32), (98: u32), (100: u32), (104: u32), (105: u32), (106: u32), (107: u32), (108: u32), (109: u32), (114: u32), (114: u32), (116: u32), (118: u32), (119: u32), (120: u32), (121: u32), (123: u32), (123: u32), (123: u32), (125: u32), (126: u32), (127: u32)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_sort_100_values_comptime<>() -> Unit := { + let sorted = («std-1.0.0-beta.25»::array::sort as λ(& Array) -> Array)((#_ref returning & Array)((«std-1.0.0-beta.25»::array::test::arr_with_100_values<> as λ() -> Array)())); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, («std-1.0.0-beta.25»::array::test::expected_with_100_values<> as λ() -> Array)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_sort_via<>() -> Unit := { + let arr = (#_mkArray returning Array)((3: u32), (6: u32), (8: u32), (10: u32), (1: u32), (2: u32), (1: u32)); + let sorted = («std-1.0.0-beta.25»::array::sort_via as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::test::sort_u32<> as λ(u32, u32) -> bool)); + let expected = (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (6: u32), (8: u32), (10: u32)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_sort_via_100_values<>() -> Unit := { + let arr = (#_mkArray returning Array)((42: u32), (123: u32), (87: u32), (93: u32), (48: u32), (80: u32), (50: u32), (5: u32), (104: u32), (84: u32), (70: u32), (47: u32), (119: u32), (66: u32), (71: u32), (121: u32), (3: u32), (29: u32), (42: u32), (118: u32), (2: u32), (54: u32), (89: u32), (44: u32), (81: u32), (0: u32), (26: u32), (106: u32), (68: u32), (96: u32), (84: u32), (48: u32), (95: u32), (54: u32), (45: u32), (32: u32), (89: u32), (100: u32), (109: u32), (19: u32), (37: u32), (41: u32), (19: u32), (98: u32), (53: u32), (114: u32), (107: u32), (66: u32), (6: u32), (74: u32), (13: u32), (19: u32), (105: u32), (64: u32), (123: u32), (28: u32), (44: u32), (50: u32), (89: u32), (58: u32), (123: u32), (126: u32), (21: u32), (43: u32), (86: u32), (35: u32), (21: u32), (62: u32), (82: u32), (0: u32), (108: u32), (120: u32), (72: u32), (72: u32), (62: u32), (80: u32), (12: u32), (71: u32), (70: u32), (86: u32), (116: u32), (73: u32), (38: u32), (15: u32), (127: u32), (81: u32), (30: u32), (8: u32), (125: u32), (28: u32), (26: u32), (69: u32), (114: u32), (63: u32), (27: u32), (28: u32), (61: u32), (42: u32), (13: u32), (32: u32)); + let sorted = («std-1.0.0-beta.25»::array::sort_via as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::test::sort_u32<> as λ(u32, u32) -> bool)); + let expected = (#_mkArray returning Array)((0: u32), (0: u32), (2: u32), (3: u32), (5: u32), (6: u32), (8: u32), (12: u32), (13: u32), (13: u32), (15: u32), (19: u32), (19: u32), (19: u32), (21: u32), (21: u32), (26: u32), (26: u32), (27: u32), (28: u32), (28: u32), (28: u32), (29: u32), (30: u32), (32: u32), (32: u32), (35: u32), (37: u32), (38: u32), (41: u32), (42: u32), (42: u32), (42: u32), (43: u32), (44: u32), (44: u32), (45: u32), (47: u32), (48: u32), (48: u32), (50: u32), (50: u32), (53: u32), (54: u32), (54: u32), (58: u32), (61: u32), (62: u32), (62: u32), (63: u32), (64: u32), (66: u32), (66: u32), (68: u32), (69: u32), (70: u32), (70: u32), (71: u32), (71: u32), (72: u32), (72: u32), (73: u32), (74: u32), (80: u32), (80: u32), (81: u32), (81: u32), (82: u32), (84: u32), (84: u32), (86: u32), (86: u32), (87: u32), (89: u32), (89: u32), (89: u32), (93: u32), (95: u32), (96: u32), (98: u32), (100: u32), (104: u32), (105: u32), (106: u32), (107: u32), (108: u32), (109: u32), (114: u32), (114: u32), (116: u32), (118: u32), (119: u32), (120: u32), (121: u32), (123: u32), (123: u32), (123: u32), (125: u32), (126: u32), (127: u32)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(sorted, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::mapi_empty<>() -> Unit := { + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::array::mapi as λ(& Array, λ(u32, u32) -> u32) -> Array)((#_ref returning & Array)((#_mkArray returning Array)()), (fn(i: u32, x: u32): u32 := (#_uAdd returning u32)((#_uMul returning u32)(i, x), (1: u32)))), (#_mkArray returning Array)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::for_each_empty<>() -> Unit := { + let empty_array = (#_mkArray returning Array)(); + («std-1.0.0-beta.25»::array::for_each as λ(& Array, λ(Field) -> Unit) -> Unit)((#_ref returning & Array)(empty_array), (fn(_x: Field): Unit := (#_assert returning Unit)(#_false))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::for_eachi_empty<>() -> Unit := { + let empty_array = (#_mkArray returning Array)(); + («std-1.0.0-beta.25»::array::for_eachi as λ(& Array, λ(u32, Field) -> Unit) -> Unit)((#_ref returning & Array)(empty_array), (fn(_i: u32, _x: Field): Unit := (#_assert returning Unit)(#_false))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::map_example<>() -> Unit := { + let a = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); + let b = («std-1.0.0-beta.25»::array::map as λ(& Array, λ(Field) -> Field) -> Array)((#_ref returning & Array)(a), (fn(a: Field): Field := (#_fMul returning Field)(a, (2: Field)))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(b, (#_mkArray returning Array)((2: Field), (4: Field), (6: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::mapi_example<>() -> Unit := { + let a = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)); + let b = («std-1.0.0-beta.25»::array::mapi as λ(& Array, λ(u32, u32) -> u32) -> Array)((#_ref returning & Array)(a), (fn(i: u32, a: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(a, (2: u32))))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(b, (#_mkArray returning Array)((2: u32), (5: u32), (8: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::for_each_example<>() -> Unit := { + let a = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); + let b = (#_ref returning & Array)((#_mkArray returning Array)((0: Field), (0: Field), (0: Field))); + let b_ref = b; + let i = (#_ref returning & u32)((0: u32)); + let i_ref = i; + («std-1.0.0-beta.25»::array::for_each > > as λ(& Array, λ(Field) -> Unit) -> Unit)((#_ref returning & Array)(a), (fn(x: Field): Unit := { + ((*b_ref: Array)[(#_readRef returning u32)(i_ref)]: Field) = (#_fMul returning Field)(x, (2: Field)); + (*i_ref: u32) = (#_uAdd returning u32)((#_readRef returning u32)(i_ref), (1: u32)); + #_skip + })); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(b), (#_mkArray returning Array)((2: Field), (4: Field), (6: Field)))); + (#_assert returning Unit)((#_uEq returning bool)((#_readRef returning u32)(i), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::for_eachi_example<>() -> Unit := { + let a = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)); + let b = (#_ref returning & Array)((#_mkArray returning Array)((0: u32), (0: u32), (0: u32))); + let b_ref = b; + («std-1.0.0-beta.25»::array::for_eachi > > as λ(& Array, λ(u32, u32) -> Unit) -> Unit)((#_ref returning & Array)(a), (fn(i: u32, a: u32): Unit := { + ((*b_ref: Array)[i]: u32) = (#_uAdd returning u32)(i, (#_uMul returning u32)(a, (2: u32))); + #_skip + })); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(b), (#_mkArray returning Array)((2: u32), (5: u32), (8: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::concat<>() -> Unit := { + let arr1 = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field)); + let arr2 = (#_mkArray returning Array)((6: Field), (7: Field), (8: Field), (9: Field), (10: Field), (11: Field)); + let concatenated_arr = («std-1.0.0-beta.25»::array::concat as λ(& Array, Array) -> Array)((#_ref returning & Array)(arr1), arr2); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (6: Field), (7: Field), (8: Field), (9: Field), (10: Field), (11: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::concat_zero_length_with_something<>() -> Unit := { + let arr1 = (#_mkArray returning Array)(); + let arr2 = (#_mkArray returning Array)((1: Field)); + let concatenated_arr = («std-1.0.0-beta.25»::array::concat as λ(& Array, Array) -> Array)((#_ref returning & Array)(arr1), arr2); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)((1: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::concat_something_with_zero_length<>() -> Unit := { + let arr1 = (#_mkArray returning Array)((1: Field)); + let arr2 = (#_mkArray returning Array)(); + let concatenated_arr = («std-1.0.0-beta.25»::array::concat as λ(& Array, Array) -> Array)((#_ref returning & Array)(arr1), arr2); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)((1: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::concat_zero_lengths<>() -> Unit := { + let arr1 = (#_mkArray returning Array)(); + let arr2 = (#_mkArray returning Array)(); + let concatenated_arr = («std-1.0.0-beta.25»::array::concat as λ(& Array, Array) -> Array)((#_ref returning & Array)(arr1), arr2); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(concatenated_arr, (#_mkArray returning Array)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_fold<>() -> Unit := { + let array = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); + let sum_plus_10 = («std-1.0.0-beta.25»::array::fold as λ(& Array, Field, λ(Field, Field) -> Field) -> Field)((#_ref returning & Array)(array), (10: Field), (fn(x: Field, y: Field): Field := (#_fAdd returning Field)(x, y))); + (#_assert returning Unit)((#_fEq returning bool)(sum_plus_10, (16: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_reduce<>() -> Unit := { + let array = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); + let sum = («std-1.0.0-beta.25»::array::reduce as λ(& Array, λ(Field, Field) -> Field) -> Field)((#_ref returning & Array)(array), (fn(x: Field, y: Field): Field := (#_fAdd returning Field)(x, y))); + (#_assert returning Unit)((#_fEq returning bool)(sum, (6: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_reduce_failure_on_empty_array<>() -> Unit := { + let array = (#_mkArray returning Array)(); + let sum = («std-1.0.0-beta.25»::array::reduce as λ(& Array, λ(Field, Field) -> Field) -> Field)((#_ref returning & Array)(array), (fn(x: Field, y: Field): Field := (#_fAdd returning Field)(x, y))); + (#_assert returning Unit)((#_fEq returning bool)(sum, (6: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_all<>() -> Unit := { + let array = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)); + (#_assert returning Unit)((«std-1.0.0-beta.25»::array::«all» as λ(& Array, λ(u32) -> bool) -> bool)((#_ref returning & Array)(array), (fn(x: u32): bool := (#_uGeq returning bool)(x, (1: u32))))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::array::«all» as λ(& Array, λ(u32) -> bool) -> bool)((#_ref returning & Array)(array), (fn(x: u32): bool := (#_uGeq returning bool)(x, (2: u32)))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_any<>() -> Unit := { + let array = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)); + (#_assert returning Unit)((«std-1.0.0-beta.25»::array::any as λ(& Array, λ(u32) -> bool) -> bool)((#_ref returning & Array)(array), (fn(x: u32): bool := (#_uGeq returning bool)(x, (3: u32))))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::array::any as λ(& Array, λ(u32) -> bool) -> bool)((#_ref returning & Array)(array), (fn(x: u32): bool := (#_uGeq returning bool)(x, (4: u32)))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_to_string<>() -> Unit := { + let str = (#_arrayAsStrUnchecked returning String<4: u32>)((#_mkArray returning Array)((78: u8), (111: u8), (105: u8), (114: u8))); + (#_assert returning Unit)(((String<4: u32> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(String<4: u32>, String<4: u32>) -> bool)(str, "Noir")); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::test::test_bytes_from_string<>() -> Unit := { + let bytes = ((Array as «std-1.0.0-beta.25»::convert::From >)::«from»<> as λ(String<4: u32>) -> Array)("Noir"); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((78: u8), (111: u8), (105: u8), (114: u8)))); + #_skip +} + +def «std-1.0.0-beta.25».Array.Mod.env : Env := Env.mk + [«std-1.0.0-beta.25::array::map», «std-1.0.0-beta.25::array::mapi», «std-1.0.0-beta.25::array::for_each», «std-1.0.0-beta.25::array::for_eachi», «std-1.0.0-beta.25::array::fold», «std-1.0.0-beta.25::array::reduce», «std-1.0.0-beta.25::array::all», «std-1.0.0-beta.25::array::any», «std-1.0.0-beta.25::array::concat», «std-1.0.0-beta.25::array::sort», «std-1.0.0-beta.25::array::sort_via», «std-1.0.0-beta.25::array::test::map_empty», «std-1.0.0-beta.25::array::test::arr_with_100_values», «std-1.0.0-beta.25::array::test::expected_with_100_values», «std-1.0.0-beta.25::array::test::sort_u32», «std-1.0.0-beta.25::array::test::test_sort», «std-1.0.0-beta.25::array::test::test_sort_empty», «std-1.0.0-beta.25::array::test::test_sort_via_empty», «std-1.0.0-beta.25::array::test::test_sort_100_values», «std-1.0.0-beta.25::array::test::test_sort_100_values_comptime», «std-1.0.0-beta.25::array::test::test_sort_via», «std-1.0.0-beta.25::array::test::test_sort_via_100_values», «std-1.0.0-beta.25::array::test::mapi_empty», «std-1.0.0-beta.25::array::test::for_each_empty», «std-1.0.0-beta.25::array::test::for_eachi_empty», «std-1.0.0-beta.25::array::test::map_example», «std-1.0.0-beta.25::array::test::mapi_example», «std-1.0.0-beta.25::array::test::for_each_example», «std-1.0.0-beta.25::array::test::for_eachi_example», «std-1.0.0-beta.25::array::test::concat», «std-1.0.0-beta.25::array::test::concat_zero_length_with_something», «std-1.0.0-beta.25::array::test::concat_something_with_zero_length», «std-1.0.0-beta.25::array::test::concat_zero_lengths», «std-1.0.0-beta.25::array::test::test_fold», «std-1.0.0-beta.25::array::test::test_reduce», «std-1.0.0-beta.25::array::test::test_reduce_failure_on_empty_array», «std-1.0.0-beta.25::array::test::test_all», «std-1.0.0-beta.25::array::test::test_any», «std-1.0.0-beta.25::array::test::test_to_string», «std-1.0.0-beta.25::array::test::test_bytes_from_string»] + [«std-1.0.0-beta.25».impl_31] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Quicksort.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Quicksort.lean new file mode 100644 index 00000000..11b057ec --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Array/Quicksort.lean @@ -0,0 +1,285 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::array::quicksort::partition(arr: & Array, low: u32, high: u32, sortfn: λ(T, T) -> bool) -> u32 := { + (#_fresh returning u32)() +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::quicksort_loop(arr: & Array, low: u32, high: u32, sortfn: λ(T, T) -> bool) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::quicksort(arr: & Array, sortfn: λ(T, T) -> bool) -> Array := { + (#_fresh returning Array)() +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::ascending(a: T, b: T) -> bool := { + let __0 = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(a, b); + let __1 = («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __1) +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::descending(a: T, b: T) -> bool := { + let __0 = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(a, b); + let __1 = («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __1) +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_empty_array<>() -> Unit := { + let arr = (#_mkArray returning Array)(); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, arr)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_single_element<>() -> Unit := { + let arr = (#_mkArray returning Array)((42: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, arr)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_two_elements_ascending<>() -> Unit := { + let arr = (#_mkArray returning Array)((2: u32), (1: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_two_elements_descending<>() -> Unit := { + let arr = (#_mkArray returning Array)((1: u32), (2: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::descending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((2: u32), (1: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_already_sorted_ascending<>() -> Unit := { + let arr = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_already_sorted_ascending_with_one_out_of_order<>() -> Unit := { + let arr = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u32))); + for i in (0: u32) .. (1000: u32) do { + (arr[i]: u32) = (#_cast returning u32)(i); + #_skip + }; + (arr[(0: u32)]: u32) = (2: u32); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)(arr, («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (arr[(0: u32)]: u32) = (1: u32); + (arr[(1: u32)]: u32) = (2: u32); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_readRef returning Array)(arr))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_already_sorted_descending<>() -> Unit := { + let arr = (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::descending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_reverse_sorted_ascending<>() -> Unit := { + let arr = (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_reverse_sorted_descending<>() -> Unit := { + let arr = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::descending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((5: u32), (4: u32), (3: u32), (2: u32), (1: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_random_array_ascending<>() -> Unit := { + let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (9: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_random_array_descending<>() -> Unit := { + let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::descending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((9: u32), (6: u32), (5: u32), (4: u32), (3: u32), (2: u32), (1: u32), (1: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_duplicate_elements<>() -> Unit := { + let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32), (5: u32), (3: u32), (5: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (3: u32), (4: u32), (5: u32), (5: u32), (5: u32), (6: u32), (9: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_all_same_elements<>() -> Unit := { + let arr = (#_mkArray returning Array)((42: u32), (42: u32), (42: u32), (42: u32), (42: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((42: u32), (42: u32), (42: u32), (42: u32), (42: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_large_array<>() -> Unit := { + let arr = (#_mkArray returning Array)((9: u32), (8: u32), (7: u32), (6: u32), (5: u32), (4: u32), (3: u32), (2: u32), (1: u32), (0: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((0: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32), (9: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_negative_numbers<>() -> Unit := { + let arr = (#_mkArray returning Array< i32, 8: u32>)((-3: i32), (1: i32), (-4: i32), (1: i32), (-5: i32), (9: i32), (-2: i32), (6: i32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort< i32, 8: u32, Unit> as λ(& Array< i32, 8: u32>, λ(i32, i32) -> bool) -> Array< i32, 8: u32>)((#_ref returning & Array< i32, 8: u32>)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending< i32> as λ(i32, i32) -> bool)) + }; + (#_assert returning Unit)(((Array< i32, 8: u32> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array< i32, 8: u32>, Array< i32, 8: u32>) -> bool)(result, (#_mkArray returning Array< i32, 8: u32>)((-5: i32), (-4: i32), (-3: i32), (-2: i32), (1: i32), (1: i32), (6: i32), (9: i32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_zero_values<>() -> Unit := { + let arr = (#_mkArray returning Array)((0: u32), (1: u32), (0: u32), (2: u32), (0: u32), (3: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((0: u32), (0: u32), (0: u32), (1: u32), (2: u32), (3: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_edge_case_near_sorted<>() -> Unit := { + let arr = (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (5: u32), (4: u32), (6: u32), (7: u32), (8: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_edge_case_near_reverse_sorted<>() -> Unit := { + let arr = (#_mkArray returning Array)((8: u32), (7: u32), (6: u32), (4: u32), (5: u32), (3: u32), (2: u32), (1: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::abs_compare<>(a: i32, b: i32) -> bool := { + let abs_a = if (#_iLt returning bool)(a, (0: i32)) then { + (#_iNeg returning i32)(a) + } else { + a + }; + let abs_b = if (#_iLt returning bool)(b, (0: i32)) then { + (#_iNeg returning i32)(b) + } else { + b + }; + (#_iLt returning bool)(abs_a, abs_b) +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_custom_comparison<>() -> Unit := { + let arr = (#_mkArray returning Array< i32, 8: u32>)((-3: i32), (1: i32), (-4: i32), (1: i32), (-5: i32), (9: i32), (-2: i32), (6: i32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort< i32, 8: u32, Unit> as λ(& Array< i32, 8: u32>, λ(i32, i32) -> bool) -> Array< i32, 8: u32>)((#_ref returning & Array< i32, 8: u32>)(arr), («std-1.0.0-beta.25»::array::quicksort::test::abs_compare<> as λ(i32, i32) -> bool)) + }; + (#_assert returning Unit)(((Array< i32, 8: u32> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array< i32, 8: u32>, Array< i32, 8: u32>) -> bool)(result, (#_mkArray returning Array< i32, 8: u32>)((1: i32), (1: i32), (-2: i32), (-3: i32), (-4: i32), (-5: i32), (6: i32), (9: i32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_equivalent_same_relative_order<>() -> Unit := { + let arr = (#_mkArray returning Array< i32, 11: u32>)((-3: i32), (1: i32), (-4: i32), (1: i32), (-5: i32), (5: i32), (-5: i32), (5: i32), (9: i32), (-2: i32), (6: i32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort< i32, 11: u32, Unit> as λ(& Array< i32, 11: u32>, λ(i32, i32) -> bool) -> Array< i32, 11: u32>)((#_ref returning & Array< i32, 11: u32>)(arr), («std-1.0.0-beta.25»::array::quicksort::test::abs_compare<> as λ(i32, i32) -> bool)) + }; + (#_assert returning Unit)(((Array< i32, 11: u32> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array< i32, 11: u32>, Array< i32, 11: u32>) -> bool)(result, (#_mkArray returning Array< i32, 11: u32>)((1: i32), (1: i32), (-2: i32), (-3: i32), (-4: i32), (-5: i32), (5: i32), (-5: i32), (5: i32), (6: i32), (9: i32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_maximum_values<>() -> Unit := { + let arr = (#_mkArray returning Array)((#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (1: u32))), (1: u32), (0: u32), (#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (2: u32)))); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((0: u32), (1: u32), (#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (2: u32))), (#_uXor returning u32)((2: u32), (#_uSub returning u32)((32: u32), (1: u32)))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_alternating_pattern<>() -> Unit := { + let arr = (#_mkArray returning Array)((1: u32), (9: u32), (2: u32), (8: u32), (3: u32), (7: u32), (4: u32), (6: u32), (5: u32)); + let result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32), (9: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_multiple_sorts_same_array<>() -> Unit := { + let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); + let result1 = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + let result2 = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + let result3 = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result1, result2)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result2, result3)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result1, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (9: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::array::quicksort::test::test_descending_then_ascending<>() -> Unit := { + let arr = (#_mkArray returning Array)((3: u32), (1: u32), (4: u32), (1: u32), (5: u32), (9: u32), (2: u32), (6: u32)); + let desc_result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(arr), («std-1.0.0-beta.25»::array::quicksort::test::descending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(desc_result, (#_mkArray returning Array)((9: u32), (6: u32), (5: u32), (4: u32), (3: u32), (2: u32), (1: u32), (1: u32)))); + let asc_result = { + («std-1.0.0-beta.25»::array::quicksort::quicksort as λ(& Array, λ(u32, u32) -> bool) -> Array)((#_ref returning & Array)(desc_result), («std-1.0.0-beta.25»::array::quicksort::test::ascending as λ(u32, u32) -> bool)) + }; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(asc_result, (#_mkArray returning Array)((1: u32), (1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (9: u32)))); + #_skip +} + +def «std-1.0.0-beta.25».Array.Quicksort.env : Env := Env.mk + [«std-1.0.0-beta.25::array::quicksort::partition», «std-1.0.0-beta.25::array::quicksort::quicksort_loop», «std-1.0.0-beta.25::array::quicksort::quicksort», «std-1.0.0-beta.25::array::quicksort::test::ascending», «std-1.0.0-beta.25::array::quicksort::test::descending», «std-1.0.0-beta.25::array::quicksort::test::test_empty_array», «std-1.0.0-beta.25::array::quicksort::test::test_single_element», «std-1.0.0-beta.25::array::quicksort::test::test_two_elements_ascending», «std-1.0.0-beta.25::array::quicksort::test::test_two_elements_descending», «std-1.0.0-beta.25::array::quicksort::test::test_already_sorted_ascending», «std-1.0.0-beta.25::array::quicksort::test::test_already_sorted_ascending_with_one_out_of_order», «std-1.0.0-beta.25::array::quicksort::test::test_already_sorted_descending», «std-1.0.0-beta.25::array::quicksort::test::test_reverse_sorted_ascending», «std-1.0.0-beta.25::array::quicksort::test::test_reverse_sorted_descending», «std-1.0.0-beta.25::array::quicksort::test::test_random_array_ascending», «std-1.0.0-beta.25::array::quicksort::test::test_random_array_descending», «std-1.0.0-beta.25::array::quicksort::test::test_duplicate_elements», «std-1.0.0-beta.25::array::quicksort::test::test_all_same_elements», «std-1.0.0-beta.25::array::quicksort::test::test_large_array», «std-1.0.0-beta.25::array::quicksort::test::test_negative_numbers», «std-1.0.0-beta.25::array::quicksort::test::test_zero_values», «std-1.0.0-beta.25::array::quicksort::test::test_edge_case_near_sorted», «std-1.0.0-beta.25::array::quicksort::test::test_edge_case_near_reverse_sorted», «std-1.0.0-beta.25::array::quicksort::test::abs_compare», «std-1.0.0-beta.25::array::quicksort::test::test_custom_comparison», «std-1.0.0-beta.25::array::quicksort::test::test_equivalent_same_relative_order», «std-1.0.0-beta.25::array::quicksort::test::test_maximum_values», «std-1.0.0-beta.25::array::quicksort::test::test_alternating_pattern», «std-1.0.0-beta.25::array::quicksort::test::test_multiple_sorts_same_array», «std-1.0.0-beta.25::array::quicksort::test::test_descending_then_ascending»] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Cmp.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Cmp.lean new file mode 100644 index 00000000..0238e9db --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Cmp.lean @@ -0,0 +1,838 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_84]<> «std-1.0.0-beta.25»::cmp::Eq<> for Field where [] := { + noir_def eq<>(self: Field, other: Field) -> bool := { + (#_fEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_85]<> «std-1.0.0-beta.25»::cmp::Eq<> for u128 where [] := { + noir_def eq<>(self: u128, other: u128) -> bool := { + (#_uEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_86]<> «std-1.0.0-beta.25»::cmp::Eq<> for u64 where [] := { + noir_def eq<>(self: u64, other: u64) -> bool := { + (#_uEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_87]<> «std-1.0.0-beta.25»::cmp::Eq<> for u32 where [] := { + noir_def eq<>(self: u32, other: u32) -> bool := { + (#_uEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_88]<> «std-1.0.0-beta.25»::cmp::Eq<> for u16 where [] := { + noir_def eq<>(self: u16, other: u16) -> bool := { + (#_uEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_89]<> «std-1.0.0-beta.25»::cmp::Eq<> for u8 where [] := { + noir_def eq<>(self: u8, other: u8) -> bool := { + (#_uEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_90]<> «std-1.0.0-beta.25»::cmp::Eq<> for i8 where [] := { + noir_def eq<>(self: i8, other: i8) -> bool := { + (#_iEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_91]<> «std-1.0.0-beta.25»::cmp::Eq<> for i16 where [] := { + noir_def eq<>(self: i16, other: i16) -> bool := { + (#_iEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_92]<> «std-1.0.0-beta.25»::cmp::Eq<> for i32 where [] := { + noir_def eq<>(self: i32, other: i32) -> bool := { + (#_iEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_93]<> «std-1.0.0-beta.25»::cmp::Eq<> for i64 where [] := { + noir_def eq<>(self: i64, other: i64) -> bool := { + (#_iEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_94]<> «std-1.0.0-beta.25»::cmp::Eq<> for Unit where [] := { + noir_def eq<>(_self: Unit, _other: Unit) -> bool := { + #_true + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_95]<> «std-1.0.0-beta.25»::cmp::Eq<> for bool where [] := { + noir_def eq<>(self: bool, other: bool) -> bool := { + (#_bEq returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_96] «std-1.0.0-beta.25»::cmp::Eq<> for Array where [T: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Array, other: Array) -> bool := { + let result = (#_ref returning & bool)(#_true); + for i in (0: u32) .. (#_arrayLen returning u32)(self) do { + let op_rhs_0 = ((T as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)((#_arrayIndex returning T)(self, (#_cast returning u32)(i)), (#_arrayIndex returning T)(other, (#_cast returning u32)(i))); + result = (#_bAnd returning bool)((#_readRef returning bool)(result), op_rhs_0); + #_skip + }; + (#_readRef returning bool)(result) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_97] «std-1.0.0-beta.25»::cmp::Eq<> for Vector where [T: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Vector, other: Vector) -> bool := { + let result = (#_ref returning & bool)((#_uEq returning bool)((#_arrayLen returning u32)(self), (#_arrayLen returning u32)(other))); + if (#_readRef returning bool)(result) then { + for i in (0: u32) .. (#_arrayLen returning u32)(self) do { + let op_rhs_0 = ((T as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)((#_vectorIndex returning T)(self, (#_cast returning u32)(i)), (#_vectorIndex returning T)(other, (#_cast returning u32)(i))); + result = (#_bAnd returning bool)((#_readRef returning bool)(result), op_rhs_0); + #_skip + }; + #_skip + }; + (#_readRef returning bool)(result) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_98] «std-1.0.0-beta.25»::cmp::Eq<> for String where [] := { + noir_def eq<>(self: String, other: String) -> bool := { + let self_bytes = (#_strAsBytes returning Array)(self); + let other_bytes = (#_strAsBytes returning Array)(other); + ((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(self_bytes, other_bytes) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_99] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + ((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_100] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_101] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_102] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_103] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_104] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>, F: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)), ((F as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(F, F) -> bool)(self.5, other.5)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_105] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>, F: «std-1.0.0-beta.25»::cmp::Eq<>, G: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)), ((F as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(F, F) -> bool)(self.5, other.5)), ((G as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(G, G) -> bool)(self.6, other.6)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_106] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>, F: «std-1.0.0-beta.25»::cmp::Eq<>, G: «std-1.0.0-beta.25»::cmp::Eq<>, H: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)), ((F as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(F, F) -> bool)(self.5, other.5)), ((G as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(G, G) -> bool)(self.6, other.6)), ((H as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(H, H) -> bool)(self.7, other.7)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_107] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>, F: «std-1.0.0-beta.25»::cmp::Eq<>, G: «std-1.0.0-beta.25»::cmp::Eq<>, H: «std-1.0.0-beta.25»::cmp::Eq<>, I: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)), ((F as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(F, F) -> bool)(self.5, other.5)), ((G as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(G, G) -> bool)(self.6, other.6)), ((H as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(H, H) -> bool)(self.7, other.7)), ((I as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(I, I) -> bool)(self.8, other.8)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_108] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>, F: «std-1.0.0-beta.25»::cmp::Eq<>, G: «std-1.0.0-beta.25»::cmp::Eq<>, H: «std-1.0.0-beta.25»::cmp::Eq<>, I: «std-1.0.0-beta.25»::cmp::Eq<>, J: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)), ((F as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(F, F) -> bool)(self.5, other.5)), ((G as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(G, G) -> bool)(self.6, other.6)), ((H as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(H, H) -> bool)(self.7, other.7)), ((I as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(I, I) -> bool)(self.8, other.8)), ((J as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(J, J) -> bool)(self.9, other.9)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_109] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>, F: «std-1.0.0-beta.25»::cmp::Eq<>, G: «std-1.0.0-beta.25»::cmp::Eq<>, H: «std-1.0.0-beta.25»::cmp::Eq<>, I: «std-1.0.0-beta.25»::cmp::Eq<>, J: «std-1.0.0-beta.25»::cmp::Eq<>, K: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)), ((F as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(F, F) -> bool)(self.5, other.5)), ((G as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(G, G) -> bool)(self.6, other.6)), ((H as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(H, H) -> bool)(self.7, other.7)), ((I as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(I, I) -> bool)(self.8, other.8)), ((J as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(J, J) -> bool)(self.9, other.9)), ((K as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(K, K) -> bool)(self.10, other.10)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_110] «std-1.0.0-beta.25»::cmp::Eq<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::cmp::Eq<>, C: «std-1.0.0-beta.25»::cmp::Eq<>, D: «std-1.0.0-beta.25»::cmp::Eq<>, E: «std-1.0.0-beta.25»::cmp::Eq<>, F: «std-1.0.0-beta.25»::cmp::Eq<>, G: «std-1.0.0-beta.25»::cmp::Eq<>, H: «std-1.0.0-beta.25»::cmp::Eq<>, I: «std-1.0.0-beta.25»::cmp::Eq<>, J: «std-1.0.0-beta.25»::cmp::Eq<>, K: «std-1.0.0-beta.25»::cmp::Eq<>, L: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: Tuple, other: Tuple) -> bool := { + (#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)((#_bAnd returning bool)(((A as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(A, A) -> bool)(self.0, other.0), ((B as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(B, B) -> bool)(self.1, other.1)), ((C as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(C, C) -> bool)(self.2, other.2)), ((D as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(D, D) -> bool)(self.3, other.3)), ((E as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(E, E) -> bool)(self.4, other.4)), ((F as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(F, F) -> bool)(self.5, other.5)), ((G as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(G, G) -> bool)(self.6, other.6)), ((H as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(H, H) -> bool)(self.7, other.7)), ((I as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(I, I) -> bool)(self.8, other.8)), ((J as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(J, J) -> bool)(self.9, other.9)), ((K as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(K, K) -> bool)(self.10, other.10)), ((L as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(L, L) -> bool)(self.11, other.11)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_111]<> «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::cmp::Ordering<> where [] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::cmp::Ordering<>, other: «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool := { + (#_fEq returning bool)(self.0, other.0) + }; +} + +noir_def «std-1.0.0-beta.25»::cmp::Ordering::less<>() -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + (#_makeData returning «std-1.0.0-beta.25»::cmp::Ordering<>)((0: Field)) +} + +noir_def «std-1.0.0-beta.25»::cmp::Ordering::equal<>() -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + (#_makeData returning «std-1.0.0-beta.25»::cmp::Ordering<>)((1: Field)) +} + +noir_def «std-1.0.0-beta.25»::cmp::Ordering::greater<>() -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + (#_makeData returning «std-1.0.0-beta.25»::cmp::Ordering<>)((2: Field)) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_112]<> «std-1.0.0-beta.25»::cmp::Ord<> for u128 where [] := { + noir_def cmp<>(self: u128, other: u128) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_uLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_uGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_113]<> «std-1.0.0-beta.25»::cmp::Ord<> for u64 where [] := { + noir_def cmp<>(self: u64, other: u64) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_uLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_uGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_114]<> «std-1.0.0-beta.25»::cmp::Ord<> for u32 where [] := { + noir_def cmp<>(self: u32, other: u32) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_uLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_uGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_115]<> «std-1.0.0-beta.25»::cmp::Ord<> for u16 where [] := { + noir_def cmp<>(self: u16, other: u16) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_uLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_uGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_116]<> «std-1.0.0-beta.25»::cmp::Ord<> for u8 where [] := { + noir_def cmp<>(self: u8, other: u8) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_uLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_uGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_117]<> «std-1.0.0-beta.25»::cmp::Ord<> for i8 where [] := { + noir_def cmp<>(self: i8, other: i8) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_iLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_iGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_118]<> «std-1.0.0-beta.25»::cmp::Ord<> for i16 where [] := { + noir_def cmp<>(self: i16, other: i16) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_iLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_iGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_119]<> «std-1.0.0-beta.25»::cmp::Ord<> for i32 where [] := { + noir_def cmp<>(self: i32, other: i32) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_iLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_iGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_120]<> «std-1.0.0-beta.25»::cmp::Ord<> for i64 where [] := { + noir_def cmp<>(self: i64, other: i64) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if (#_iLt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else if (#_iGt returning bool)(self, other) then { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_121]<> «std-1.0.0-beta.25»::cmp::Ord<> for Unit where [] := { + noir_def cmp<>(_self: Unit, _other: Unit) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_122]<> «std-1.0.0-beta.25»::cmp::Ord<> for bool where [] := { + noir_def cmp<>(self: bool, other: bool) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if self then { + if other then { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + } else if other then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_123] «std-1.0.0-beta.25»::cmp::Ord<> for Array where [T: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Array, other: Array) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)((«std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()); + for i in (0: u32) .. (#_arrayLen returning u32)(self) do { + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_arrayIndex returning T)(self, (#_cast returning u32)(i)), (#_arrayIndex returning T)(other, (#_cast returning u32)(i))); + #_skip + } + }; + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_124] «std-1.0.0-beta.25»::cmp::Ord<> for Vector where [T: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Vector, other: Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let self_len = (#_arrayLen returning u32)(self); + let other_len = (#_arrayLen returning u32)(other); + let min_len = if (#_uLt returning bool)(self_len, other_len) then { + self_len + } else { + other_len + }; + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)((«std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()); + for i in (0: u32) .. min_len do { + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_vectorIndex returning T)(self, (#_cast returning u32)(i)), (#_vectorIndex returning T)(other, (#_cast returning u32)(i))); + #_skip + } + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((u32 as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(u32, u32) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self_len, other_len) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_125] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + ((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_126] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = ((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0); + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(result, («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + result + } else { + ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_127] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_128] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_129] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_130] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>, F: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((F as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(F, F) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.5, other.5) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_131] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>, F: «std-1.0.0-beta.25»::cmp::Ord<>, G: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((F as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(F, F) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.5, other.5); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((G as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(G, G) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.6, other.6) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_132] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>, F: «std-1.0.0-beta.25»::cmp::Ord<>, G: «std-1.0.0-beta.25»::cmp::Ord<>, H: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((F as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(F, F) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.5, other.5); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((G as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(G, G) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.6, other.6); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((H as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(H, H) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.7, other.7) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_133] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>, F: «std-1.0.0-beta.25»::cmp::Ord<>, G: «std-1.0.0-beta.25»::cmp::Ord<>, H: «std-1.0.0-beta.25»::cmp::Ord<>, I: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((F as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(F, F) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.5, other.5); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((G as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(G, G) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.6, other.6); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((H as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(H, H) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.7, other.7); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((I as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(I, I) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.8, other.8) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_134] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>, F: «std-1.0.0-beta.25»::cmp::Ord<>, G: «std-1.0.0-beta.25»::cmp::Ord<>, H: «std-1.0.0-beta.25»::cmp::Ord<>, I: «std-1.0.0-beta.25»::cmp::Ord<>, J: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((F as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(F, F) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.5, other.5); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((G as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(G, G) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.6, other.6); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((H as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(H, H) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.7, other.7); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((I as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(I, I) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.8, other.8); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((J as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(J, J) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.9, other.9) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_135] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>, F: «std-1.0.0-beta.25»::cmp::Ord<>, G: «std-1.0.0-beta.25»::cmp::Ord<>, H: «std-1.0.0-beta.25»::cmp::Ord<>, I: «std-1.0.0-beta.25»::cmp::Ord<>, J: «std-1.0.0-beta.25»::cmp::Ord<>, K: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((F as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(F, F) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.5, other.5); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((G as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(G, G) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.6, other.6); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((H as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(H, H) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.7, other.7); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((I as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(I, I) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.8, other.8); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((J as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(J, J) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.9, other.9); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((K as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(K, K) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.10, other.10) + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_136] «std-1.0.0-beta.25»::cmp::Ord<> for Tuple where [A: «std-1.0.0-beta.25»::cmp::Ord<>, B: «std-1.0.0-beta.25»::cmp::Ord<>, C: «std-1.0.0-beta.25»::cmp::Ord<>, D: «std-1.0.0-beta.25»::cmp::Ord<>, E: «std-1.0.0-beta.25»::cmp::Ord<>, F: «std-1.0.0-beta.25»::cmp::Ord<>, G: «std-1.0.0-beta.25»::cmp::Ord<>, H: «std-1.0.0-beta.25»::cmp::Ord<>, I: «std-1.0.0-beta.25»::cmp::Ord<>, J: «std-1.0.0-beta.25»::cmp::Ord<>, K: «std-1.0.0-beta.25»::cmp::Ord<>, L: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: Tuple, other: Tuple) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + let result = (#_ref returning & «std-1.0.0-beta.25»::cmp::Ordering<>)(((A as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(A, A) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.0, other.0)); + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((B as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(B, B) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((C as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(C, C) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.2, other.2); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((D as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(D, D) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.3, other.3); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((E as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(E, E) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.4, other.4); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((F as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(F, F) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.5, other.5); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((G as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(G, G) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.6, other.6); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((H as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(H, H) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.7, other.7); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((I as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(I, I) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.8, other.8); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((J as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(J, J) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.9, other.9); + #_skip + }; + if ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)()) then { + result = ((K as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(K, K) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.10, other.10); + #_skip + }; + if (#_bNot returning bool)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)((#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())) then { + (#_readRef returning «std-1.0.0-beta.25»::cmp::Ordering<>)(result) + } else { + ((L as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(L, L) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.11, other.11) + } + }; +} + +noir_def «std-1.0.0-beta.25»::cmp::max(v1: T, v2: T) -> T := { + if { + let __0 = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(v1, v2); + let __1 = («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __1) + } then { + v1 + } else { + v2 + } +} + +noir_def «std-1.0.0-beta.25»::cmp::min(v1: T, v2: T) -> T := { + if { + let __0 = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(v1, v2); + let __1 = («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __1) + } then { + v2 + } else { + v1 + } +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::sanity_check_min<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::min as λ(u64, u64) -> u64)((0: u64), (1: u64)), (0: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::min as λ(u64, u64) -> u64)((0: u64), (0: u64)), (0: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::min as λ(u64, u64) -> u64)((1: u64), (1: u64)), (1: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::min as λ(u8, u8) -> u8)((255: u8), (0: u8)), (0: u8))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::sanity_check_max<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::max as λ(u64, u64) -> u64)((0: u64), (1: u64)), (1: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::max as λ(u64, u64) -> u64)((0: u64), (0: u64)), (0: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::max as λ(u64, u64) -> u64)((1: u64), (1: u64)), (1: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::cmp::max as λ(u8, u8) -> u8)((255: u8), (0: u8)), (255: u8))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::correctly_handles_unequal_length_vectors<>() -> Unit := { + let vector_1 = (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))); + let vector_2 = (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field))); + (#_assert returning Unit)((#_bNot returning bool)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(vector_1, vector_2))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::lexicographic_ordering_for_vectors<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_asVector returning Vector)((#_mkArray returning Array)((2: u32))), (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (1: u32), (1: u32)))), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32))), (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::eq_unit<>() -> Unit := { + (#_assert returning Unit)(((Unit as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Unit, Unit) -> bool)(#_unit, #_unit)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::eq_bool<>() -> Unit := { + (#_assert returning Unit)(((bool as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(bool, bool) -> bool)(#_false, #_false)); + (#_assert returning Unit)((#_bNot returning bool)(((bool as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(bool, bool) -> bool)(#_false, #_true))); + (#_assert returning Unit)((#_bNot returning bool)(((bool as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(bool, bool) -> bool)(#_true, #_false))); + (#_assert returning Unit)(((bool as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(bool, bool) -> bool)(#_true, #_true)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::eq_integers<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::eq_tuples<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::cmp_unit<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Unit as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Unit, Unit) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(#_unit, #_unit), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::cmp_bool<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((bool as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(bool, bool) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(#_false, #_true), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((bool as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(bool, bool) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(#_false, #_false), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((bool as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(bool, bool) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(#_true, #_true), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((bool as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(bool, bool) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(#_true, #_false), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::cmp_integers<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::cmp_tuples<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::cmp_array<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Array as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Array, Array) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkArray returning Array)((1: u8), (2: u8), (3: u8)), (#_mkArray returning Array)((1: u8), (2: u8), (3: u8))), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Array as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Array, Array) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkArray returning Array)((1: u8), (2: u8), (3: u8)), (#_mkArray returning Array)((1: u8), (3: u8), (2: u8))), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Array as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Array, Array) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkArray returning Array)((1: u8), (3: u8), (3: u8)), (#_mkArray returning Array)((1: u8), (2: u8), (3: u8))), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::cmp::cmp_tests::cmp_vectors<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((1: u8), (2: u8), (3: u8)), (#_mkVector returning Vector)((1: u8), (2: u8), (3: u8))), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((1: u8), (3: u8), (3: u8)), (#_mkVector returning Vector)((1: u8), (2: u8), (3: u8))), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((1: u8), (2: u8), (3: u8)), (#_mkVector returning Vector)((1: u8), (3: u8), (3: u8))), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((1: u8), (2: u8)), (#_mkVector returning Vector)((1: u8), (2: u8), (3: u8))), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((1: u8), (2: u8), (3: u8)), (#_mkVector returning Vector)((1: u8), (2: u8))), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((10: u8), (0: u8)), (#_mkVector returning Vector)((9: u8))), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((9: u8), (0: u8)), (#_mkVector returning Vector)((10: u8))), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((9: u8)), (#_mkVector returning Vector)((10: u8), (0: u8))), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((Vector as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(Vector, Vector) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_mkVector returning Vector)((10: u8)), (#_mkVector returning Vector)((9: u8), (0: u8))), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + #_skip +} + +def «std-1.0.0-beta.25».Cmp.env : Env := Env.mk + [«std-1.0.0-beta.25::cmp::Ordering::less», «std-1.0.0-beta.25::cmp::Ordering::equal», «std-1.0.0-beta.25::cmp::Ordering::greater», «std-1.0.0-beta.25::cmp::max», «std-1.0.0-beta.25::cmp::min», «std-1.0.0-beta.25::cmp::cmp_tests::sanity_check_min», «std-1.0.0-beta.25::cmp::cmp_tests::sanity_check_max», «std-1.0.0-beta.25::cmp::cmp_tests::correctly_handles_unequal_length_vectors», «std-1.0.0-beta.25::cmp::cmp_tests::lexicographic_ordering_for_vectors», «std-1.0.0-beta.25::cmp::cmp_tests::eq_unit», «std-1.0.0-beta.25::cmp::cmp_tests::eq_bool», «std-1.0.0-beta.25::cmp::cmp_tests::eq_integers», «std-1.0.0-beta.25::cmp::cmp_tests::eq_tuples», «std-1.0.0-beta.25::cmp::cmp_tests::cmp_unit», «std-1.0.0-beta.25::cmp::cmp_tests::cmp_bool», «std-1.0.0-beta.25::cmp::cmp_tests::cmp_integers», «std-1.0.0-beta.25::cmp::cmp_tests::cmp_tuples», «std-1.0.0-beta.25::cmp::cmp_tests::cmp_array», «std-1.0.0-beta.25::cmp::cmp_tests::cmp_vectors»] + [«std-1.0.0-beta.25».impl_84, «std-1.0.0-beta.25».impl_85, «std-1.0.0-beta.25».impl_86, «std-1.0.0-beta.25».impl_87, «std-1.0.0-beta.25».impl_88, «std-1.0.0-beta.25».impl_89, «std-1.0.0-beta.25».impl_90, «std-1.0.0-beta.25».impl_91, «std-1.0.0-beta.25».impl_92, «std-1.0.0-beta.25».impl_93, «std-1.0.0-beta.25».impl_94, «std-1.0.0-beta.25».impl_95, «std-1.0.0-beta.25».impl_96, «std-1.0.0-beta.25».impl_97, «std-1.0.0-beta.25».impl_98, «std-1.0.0-beta.25».impl_99, «std-1.0.0-beta.25».impl_100, «std-1.0.0-beta.25».impl_101, «std-1.0.0-beta.25».impl_102, «std-1.0.0-beta.25».impl_103, «std-1.0.0-beta.25».impl_104, «std-1.0.0-beta.25».impl_105, «std-1.0.0-beta.25».impl_106, «std-1.0.0-beta.25».impl_107, «std-1.0.0-beta.25».impl_108, «std-1.0.0-beta.25».impl_109, «std-1.0.0-beta.25».impl_110, «std-1.0.0-beta.25».impl_111, «std-1.0.0-beta.25».impl_112, «std-1.0.0-beta.25».impl_113, «std-1.0.0-beta.25».impl_114, «std-1.0.0-beta.25».impl_115, «std-1.0.0-beta.25».impl_116, «std-1.0.0-beta.25».impl_117, «std-1.0.0-beta.25».impl_118, «std-1.0.0-beta.25».impl_119, «std-1.0.0-beta.25».impl_120, «std-1.0.0-beta.25».impl_121, «std-1.0.0-beta.25».impl_122, «std-1.0.0-beta.25».impl_123, «std-1.0.0-beta.25».impl_124, «std-1.0.0-beta.25».impl_125, «std-1.0.0-beta.25».impl_126, «std-1.0.0-beta.25».impl_127, «std-1.0.0-beta.25».impl_128, «std-1.0.0-beta.25».impl_129, «std-1.0.0-beta.25».impl_130, «std-1.0.0-beta.25».impl_131, «std-1.0.0-beta.25».impl_132, «std-1.0.0-beta.25».impl_133, «std-1.0.0-beta.25».impl_134, «std-1.0.0-beta.25».impl_135, «std-1.0.0-beta.25».impl_136] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/BoundedVec.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/BoundedVec.lean new file mode 100644 index 00000000..16f05c54 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/BoundedVec.lean @@ -0,0 +1,1097 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::unconstrained_any_with_complex_predicates<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::unconstrained_returns_false_if_predicate_not_satisfied<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::unconstrained_returns_true_if_predicate_satisfied<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::map::unconstrained_applies_function_correctly<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::mapi::unconstrained_applies_function_correctly<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::unconstrained_smoke_test<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::unconstrained_smoke_test<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_parts::unconstrained_from_parts<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::unconstrained_extend_from_bounded_vec<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::unconstrained_extend_from_bounded_vec_preserves_tail_storage<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let zeroed = (#_zeroed returning T)(); + (#_makeData returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkRepeatedArray returning Array)(zeroed), (0: u32)) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, index: u32) -> T := { + (#_assert returning Unit)((#_uLt returning bool)(index, (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, index) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, index: u32) -> T := { + (#_arrayIndex returning T)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).0, (#_cast returning u32)(index)) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, index: u32, value: T) -> Unit := { + (#_assert returning Unit)((#_uLt returning bool)(index, (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, T) -> Unit)(self, index, value) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_unchecked(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, index: u32, value: T) -> Unit := { + (((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).0: Array)[index]: T) = value; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, elem: T) -> Unit := { + (#_assert returning Unit)((#_uLt returning bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, uConst!(MaxLen: u32))); + (((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).0: Array)[(#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1]: T) = elem; + ((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).1: u32) = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, (1: u32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32 := { + (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1 +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_len(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, len: u32) -> Unit := { + (#_assert returning Unit)((#_uLeq returning bool)(len, uConst!(MaxLen: u32))); + ((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).1: u32) = len; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, len: u32) -> Unit := { + if (#_uLt returning bool)(len, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { + ((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).1: u32) = len; + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len(_self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32 := { + uConst!(MaxLen: u32) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage(self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array := { + self.0 +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_array(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, array: Array) -> Unit := { + let new_len = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, (#_arrayLen returning u32)(array)); + (#_assert returning Unit)((#_uLeq returning bool)(new_len, uConst!(MaxLen: u32))); + for i in (0: u32) .. (#_arrayLen returning u32)(array) do { + (((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).0: Array)[(#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, i)]: T) = (#_arrayIndex returning T)(array, (#_cast returning u32)(i)); + #_skip + }; + ((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).1: u32) = new_len; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_vector(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, vector: Vector) -> Unit := { + let new_len = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, (#_arrayLen returning u32)(vector)); + (#_assert returning Unit)((#_uLeq returning bool)(new_len, uConst!(MaxLen: u32))); + for i in (0: u32) .. (#_arrayLen returning u32)(vector) do { + (((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).0: Array)[(#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, i)]: T) = (#_vectorIndex returning T)(vector, (#_cast returning u32)(i)); + #_skip + }; + ((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).1: u32) = new_len; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, vec: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit := { + let append_len = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)); + let new_len = (#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, append_len); + (#_assert returning Unit)((#_uLeq returning bool)(new_len, uConst!(MaxLen: u32))); + if (#_isUnconstrained returning bool)() then { + for i in (0: u32) .. append_len do { + (((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).0: Array)[(#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, i)]: T) = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), i); + #_skip + }; + #_skip + } else { + let max = («std-1.0.0-beta.25»::cmp::min as λ(u32, u32) -> u32)(uConst!(Len: u32), uConst!(MaxLen: u32)); + for i in (0: u32) .. max do { + if (#_uLt returning bool)(i, append_len) then { + (((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).0: Array)[(#_uAdd returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, i)]: T) = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), i); + #_skip + } + }; + #_skip + }; + ((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).1: u32) = new_len; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array(array: Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(Len: u32), uConst!(MaxLen: u32)), "from array out of bounds"); + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, array); + (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> T := { + (#_assert returning Unit)((#_uGt returning bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, (0: u32))); + ((*self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec).1: u32) = (#_uSub returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1, (1: u32)); + (#_arrayIndex returning T)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).0, (#_cast returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(self).1)) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any(self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, predicate: λ(T) -> bool) -> bool := { + let ret = (#_ref returning & bool)(#_false); + if (#_isUnconstrained returning bool)() then { + for i in (0: u32) .. self.1 do { + let op_rhs_0 = (predicate as λ(T) -> bool)((#_arrayIndex returning T)(self.0, (#_cast returning u32)(i))); + ret = (#_bOr returning bool)((#_readRef returning bool)(ret), op_rhs_0); + #_skip + }; + #_skip + } else { + let exceeded_len = (#_ref returning & bool)(#_false); + for i in (0: u32) .. uConst!(MaxLen: u32) do { + exceeded_len = (#_bOr returning bool)((#_readRef returning bool)(exceeded_len), (#_uEq returning bool)(i, self.1)); + if (#_bNot returning bool)((#_readRef returning bool)(exceeded_len)) then { + let op_rhs_1 = (predicate as λ(T) -> bool)((#_arrayIndex returning T)(self.0, (#_cast returning u32)(i))); + ret = (#_bOr returning bool)((#_readRef returning bool)(ret), op_rhs_1); + #_skip + } + }; + #_skip + }; + (#_readRef returning bool)(ret) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::map(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, f: λ(T) -> U) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let ret = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + (ret.1: u32) = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self); + if (#_isUnconstrained returning bool)() then { + for i in (0: u32) .. («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self) do { + ((ret.0: Array)[i]: U) = (f as λ(T) -> U)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + }; + #_skip + } else { + for i in (0: u32) .. uConst!(MaxLen: u32) do { + if (#_uLt returning bool)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { + ((ret.0: Array)[i]: U) = (f as λ(T) -> U)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + } + }; + #_skip + }; + (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(ret) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::mapi(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, f: λ(u32, T) -> U) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let ret = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + (ret.1: u32) = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self); + if (#_isUnconstrained returning bool)() then { + for i in (0: u32) .. («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self) do { + ((ret.0: Array)[i]: U) = (f as λ(u32, T) -> U)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + }; + #_skip + } else { + for i in (0: u32) .. uConst!(MaxLen: u32) do { + if (#_uLt returning bool)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { + ((ret.0: Array)[i]: U) = (f as λ(u32, T) -> U)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + } + }; + #_skip + }; + (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(ret) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_each(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, f: λ(T) -> Unit) -> Unit := { + if (#_isUnconstrained returning bool)() then { + for i in (0: u32) .. («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self) do { + (f as λ(T) -> Unit)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + }; + #_skip + } else { + for i in (0: u32) .. uConst!(MaxLen: u32) do { + if (#_uLt returning bool)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { + (f as λ(T) -> Unit)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + } + }; + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_eachi(self: & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, f: λ(u32, T) -> Unit) -> Unit := { + if (#_isUnconstrained returning bool)() then { + for i in (0: u32) .. («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self) do { + (f as λ(u32, T) -> Unit)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + }; + #_skip + } else { + for i in (0: u32) .. uConst!(MaxLen: u32) do { + if (#_uLt returning bool)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(self)) then { + (f as λ(u32, T) -> Unit)(i, («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> T)(self, i)); + #_skip + } + }; + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts(array: Array, len: u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let array = (#_ref returning & Array)(array); + { + (#_assert returning Unit)((#_uLeq returning bool)(len, uConst!(MaxLen: u32))); + (#_makeData returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_readRef returning Array)(array), len) +} +} + +[[deprecated "`BoundedVec::from_parts` no longer requires an extra loop, `BoundedVec::from_parts_unchecked` is no longer required"]] +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts_unchecked(array: Array, len: u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + (#_assert returning Unit)((#_uLeq returning bool)(len, uConst!(MaxLen: u32))); + (#_makeData returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(array, len) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_39] «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec where [T: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, other: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool := { + if (#_uEq returning bool)(self.1, other.1) then { + if (#_isUnconstrained returning bool)() then { + («std-1.0.0-beta.25»::collections::bounded_vec::unconstrained_eq as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(self, other) + } else { + let eq = (#_ref returning & bool)(#_true); + for i in (0: u32) .. uConst!(MaxLen: u32) do { + if (#_uLt returning bool)(i, self.1) then { + let op_rhs_0 = ((T as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)((#_arrayIndex returning T)(self.0, (#_cast returning u32)(i)), (#_arrayIndex returning T)(other.0, (#_cast returning u32)(i))); + eq = (#_bAnd returning bool)((#_readRef returning bool)(eq), op_rhs_0); + #_skip + } + }; + (#_readRef returning bool)(eq) + } + } else { + #_false + } + }; +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::unconstrained_eq(a: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, b: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool := { + (#_fresh returning bool)() +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_40] «std-1.0.0-beta.25»::convert::From > for «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec where [] := { + noir_def «from»<>(array: Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(array) + }; +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_elements_past_end_of_vec<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let __0 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Field)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (0: u32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_beyond_length<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + let __0 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (3: u32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::get::get_works_within_bounds<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (2: u32)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (4: u32)), (5: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (2: u32)), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works_past_len<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (4: u32)), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set::set_updates_values_properly<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: Field), (0: Field), (0: Field), (0: Field), (0: Field)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (0: u32), (42: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (0: Field), (0: Field), (0: Field), (0: Field)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (1: u32), (43: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (43: Field), (0: Field), (0: Field), (0: Field)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (2: u32), (44: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (43: Field), (44: Field), (0: Field), (0: Field)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (1: u32), (10: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((42: Field), (10: Field), (44: Field), (0: Field), (0: Field)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (0: u32), (0: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec).0, (#_mkArray returning Array)((0: Field), (10: Field), (44: Field), (0: Field), (0: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set::panics_when_writing_elements_past_end_of_vec<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, Field) -> Unit)(vec, (0: u32), (42: Field)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set::panics_when_setting_beyond_length<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (3: u32), (4: u32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (0: u32), (10: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (10: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations_past_len<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (3: u32), (40: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (3: u32)), (40: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set::set_preserves_other_elements<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, u32) -> Unit)(vec, (2: u32), (30: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (2: u32)), (30: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (3: u32)), (4: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (4: u32)), (5: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set_len::set_len_works_after_multiple_unchecked_sets<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u8), (2: u8), (3: u8)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, u8) -> Unit)(vec, (3: u32), (44: u8)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, u8) -> Unit)(vec, (4: u32), (55: u8)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32, u8) -> Unit)(vec, (5: u32), (66: u8)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (8: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (8: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u8)(vec, (3: u32)), (44: u8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u8)(vec, (4: u32)), (55: u8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u8)(vec, (5: u32)), (66: u8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u8)(vec, (6: u32)), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u8)(vec, (7: u32)), (0: u8))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, (#_mkArray returning Array)((88: u8), (99: u8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (10: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set_len::set_len_can_reduce_the_length<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (2: u32)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (3: u32)), (4: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (4: u32)), (5: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::set_len::panics_when_set_len_beyond_max_len<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::set_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (6: u32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::truncate::truncate_shortens_to_len<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (3: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (2: u32)), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::truncate::truncate_to_zero_empties_the_vec<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (0: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::truncate::truncate_to_equal_len_is_noop<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (3: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::truncate::truncate_to_greater_len_is_noop<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (8: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::truncate::truncate_beyond_max_len_is_noop<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (100: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::truncate::truncate_does_not_zero_remaining_storage<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (2: u32)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (3: u32)), (4: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (4: u32)), (5: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::truncate::truncate_then_push_continues_from_new_len<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::truncate as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (30: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (2: u32)), (30: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::returns_false_if_predicate_not_satisfied<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)(#_false, #_false, #_false, #_false)); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(bool) -> bool) -> bool)(vec, (fn(value: bool): bool := value)); + (#_assert returning Unit)((#_bNot returning bool)(result)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::returns_true_if_predicate_satisfied<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)(#_false, #_false, #_true, #_true)); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(bool) -> bool) -> bool)(vec, (fn(value: bool): bool := value)); + (#_assert returning Unit)(result); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::returns_false_on_empty_boundedvec<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(bool) -> bool) -> bool)(vec, (fn(value: bool): bool := value)); + (#_assert returning Unit)((#_bNot returning bool)(result)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::any_with_complex_predicates<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uGt returning bool)(x, (3: u32))))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uGt returning bool)(x, (10: u32)))))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32))))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)(vec, (fn(x: u32): bool := (#_uEq returning bool)(x, (3: u32))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::any::any_with_partial_vector<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + (#_assert returning Unit)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): bool := (#_uEq returning bool)(x, (1: u32))))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): bool := (#_uEq returning bool)(x, (2: u32))))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::any as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> bool) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): bool := (#_uEq returning bool)(x, (3: u32)))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::map::applies_function_correctly<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::map as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(value: u32): u32 := (#_uMul returning u32)(value, (2: u32)))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (4: u32), (6: u32), (8: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::map::applies_function_that_changes_return_type<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::map as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> Field) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(value: u32): Field := (#_cast returning Field)((#_uMul returning u32)(value, (2: u32))))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field), (8: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::map::does_not_apply_function_past_len<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::map as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { + (5: u32) + } else { + value + })); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result), (2: u32)), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::map::map_with_conditional_logic<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::map as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): u32 := if (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)) then { + (#_uMul returning u32)(x, (2: u32)) + } else { + x + })); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (4: u32), (3: u32), (8: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::map::map_preserves_length<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::map as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): u32 := (#_uMul returning u32)(x, (2: u32)))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result)), («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result)), («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::map::map_on_empty_vector<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::map as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): u32 := (#_uMul returning u32)(x, (2: u32)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, vec)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result)), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result)), (5: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_correctly<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::mapi as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(i: u32, value: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32))))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32), (11: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_that_changes_return_type<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::mapi as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Field) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(i: u32, value: u32): Field := (#_cast returning Field)((#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32)))))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (5: Field), (8: Field), (11: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::mapi::does_not_apply_function_past_len<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::mapi as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(__0: u32, value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { + (5: u32) + } else { + value + })); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result), (2: u32)), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::mapi::mapi_with_index_branching_logic<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::mapi as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(i: u32, x: u32): u32 := if (#_uEq returning bool)((#_uRem returning u32)(i, (2: u32)), (0: u32)) then { + (#_uMul returning u32)(x, (2: u32)) + } else { + x + })); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (2: u32), (6: u32), (4: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, f: λ(T) -> U) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let output = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let output_ref = output; + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_each, λ(T) -> U> > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(T) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input), (fn(x: T): Unit := («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, U) -> Unit)(output_ref, (f as λ(T) -> U)(x)))); + (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(output) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::smoke_test<>() -> Unit := { + let acc = (#_ref returning & u32)((0: u32)); + let acc_ref = acc; + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_each > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(value: u32): Unit := { + (*acc_ref: u32) = (#_uAdd returning u32)((#_readRef returning u32)(acc_ref), value); + #_skip + })); + (#_assert returning Unit)((#_uEq returning bool)((#_readRef returning u32)(acc), (6: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_correctly<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): u32 := (#_uMul returning u32)(value, (2: u32)))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (4: u32), (6: u32), (8: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_that_changes_return_type<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> Field) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): Field := (#_cast returning Field)((#_uMul returning u32)(value, (2: u32))))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field), (8: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::does_not_apply_function_past_len<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec, (fn(value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { + (5: u32) + } else { + value + })); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result), (2: u32)), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_on_empty_vector<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let count = (#_ref returning & Field)((0: Field)); + let count_ref = count; + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_each > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(__0: u32): Unit := { + (*count_ref: Field) = (#_fAdd returning Field)((#_readRef returning Field)(count_ref), (1: Field)); + #_skip + })); + (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(count), (0: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_each::for_each_with_side_effects<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + let seen = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let seen_ref = seen; + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_each > > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(x: u32): Unit := («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(seen_ref, x))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(seen), vec)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, f: λ(u32, T) -> U) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let output = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let output_ref = output; + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_eachi, λ(u32, T) -> U> > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, T) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input), (fn(i: u32, x: T): Unit := («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, U) -> Unit)(output_ref, (f as λ(u32, T) -> U)(i, x)))); + (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(output) +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::smoke_test<>() -> Unit := { + let acc = (#_ref returning & u32)((0: u32)); + let acc_ref = acc; + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_eachi > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(i: u32, value: u32): Unit := { + (*acc_ref: u32) = (#_uAdd returning u32)((#_readRef returning u32)(acc_ref), (#_uMul returning u32)(i, value)); + #_skip + })); + (#_assert returning Unit)((#_uEq returning bool)((#_readRef returning u32)(acc), (8: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_correctly<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec, (fn(i: u32, value: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32))))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32), (11: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_that_changes_return_type<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Field) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec, (fn(i: u32, value: u32): Field := (#_cast returning Field)((#_uAdd returning u32)(i, (#_uMul returning u32)(value, (2: u32)))))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: Field), (5: Field), (8: Field), (11: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::does_not_apply_function_past_len<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32))); + let result = («std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec, (fn(__0: u32, value: u32): u32 := if (#_uEq returning bool)(value, (0: u32)) then { + (5: u32) + } else { + value + })); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((5: u32), (1: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(result), (2: u32)), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_on_empty_vector<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let count = (#_ref returning & Field)((0: Field)); + let count_ref = count; + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_eachi > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(__0: u32, __1: u32): Unit := { + (*count_ref: Field) = (#_fAdd returning Field)((#_readRef returning Field)(count_ref), (1: Field)); + #_skip + })); + (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(count), (0: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_with_index_tracking<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((10: u32), (20: u32), (30: u32))); + let indices = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let indices_ref = indices; + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::for_eachi > > as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, λ(u32, u32) -> Unit) -> Unit)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (fn(i: u32, __0: u32): Unit := («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(indices_ref, i))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((0: u32), (1: u32), (2: u32))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(indices), expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_array::empty<>() -> Unit := { + let empty_array = (#_mkArray returning Array)(); + let bounded_vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)()); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (0: u32))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)(bounded_vec), empty_array)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_array::equal_len<>() -> Unit := { + let array = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); + let bounded_vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(array); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (3: u32))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)(bounded_vec), array)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_array::max_len_greater_then_array_len<>() -> Unit := { + let array = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); + let bounded_vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(array); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (10: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (3: u32))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Field)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec), (0: u32)), (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Field)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec), (1: u32)), (2: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Field)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec), (2: u32)), (3: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_array::max_len_lower_then_array_len<>() -> Unit := { + let __0 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkRepeatedArray returning Array)((0: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_array::from_array_preserves_order<>() -> Unit := { + let array = (#_mkArray returning Array)((5: u32), (3: u32), (1: u32), (4: u32), (2: u32)); + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(array); + for i in (0: u32) .. (#_arrayLen returning u32)(array) do { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), i), (#_arrayIndex returning u32)(array, (#_cast returning u32)(i)))); + #_skip + }; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_array::from_array_with_different_types<>() -> Unit := { + let bool_array = (#_mkArray returning Array)(#_true, #_false, #_true); + let bool_vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bool_array); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bool_vec)), (3: u32))); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> bool)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bool_vec), (0: u32)), #_true)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> bool)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bool_vec), (1: u32)), #_false)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::trait_from::simple<>() -> Unit := { + let array = (#_mkArray returning Array)((1: Field), (2: Field)); + let bounded_vec = ((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::convert::From >)::«from»<> as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(array); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (10: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec)), (2: u32))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Field)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec), (0: u32)), (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Field)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec), (1: u32)), (2: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::trait_eq::empty_equality<>() -> Unit := { + let bounded_vec1 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let bounded_vec2 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(bounded_vec1, bounded_vec2)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::trait_eq::equality<>() -> Unit := { + let bounded_vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let bounded_vec2 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Field) -> Unit)(bounded_vec1, (1: Field)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Field) -> Unit)(bounded_vec2, (1: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec1), (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec2))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::trait_eq::inequality<>() -> Unit := { + let bounded_vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let bounded_vec2 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Field) -> Unit)(bounded_vec1, (1: Field)); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec1), (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec2)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Field) -> Unit)(bounded_vec2, (2: Field)); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec1), (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(bounded_vec2)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::from_parts::from_parts<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (0: u32)), (3: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (3: u32))); + let vec1 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (1: u32)), (3: u32)); + let vec2 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (2: u32)), (3: u32)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(vec1, vec2)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::push_pop::push_and_pop_operations<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (0: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (1: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (1: u32)), (2: u32))); + let popped = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec); + (#_assert returning Unit)((#_uEq returning bool)(popped, (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (1: u32))); + let popped2 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec); + (#_assert returning Unit)((#_uEq returning bool)(popped2, (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::push_pop::push_to_full_vector<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (3: u32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::push_pop::pop_from_empty_vector<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let __0 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::push_pop::push_pop_cycle<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (3: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (0: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (4: u32)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (4: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_array<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, (#_mkArray returning Array)((2: u32), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (2: u32)), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_vector<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_vector as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Vector) -> Unit)(vec, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (3: u32)))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec, (2: u32)), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec<>() -> Unit := { + let vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let vec2 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec2, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec2, (3: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec2)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec1), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (2: u32)), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_limit<>() -> Unit := { + let vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let vec2 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec2, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec2)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec1), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (1: u32)), (2: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_full_and_empty<>() -> Unit := { + let vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let vec2 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, vec2); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec1), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (1: u32)), (2: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_zero_len<>() -> Unit := { + let vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let vec2 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, vec2); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec1), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_last_zeroed<>() -> Unit := { + let vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let vec2 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (2: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec2, (3: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, (#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec2)); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec1), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get_unchecked as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (3: u32)), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_empty_self<>() -> Unit := { + let vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let vec2 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, vec2); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec1), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (2: u32)), (3: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_preserves_tail_storage<>() -> Unit := { + let dst = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((10: u32), (99: u32), (123: u32), (7: u32)), (1: u32))); + let src = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts as λ(Array, u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((20: u32), (0: u32), (0: u32), (0: u32)), (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(dst, src); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(dst), (2: u32))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(dst)), (#_mkArray returning Array)((10: u32), (20: u32), (123: u32), (7: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_equal_capacity<>() -> Unit := { + let vec1 = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec1, (1: u32)); + let vec2 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((2: u32), (3: u32), (4: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec1, vec2); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec1), (4: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (2: u32)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)(vec1, (3: u32)), (4: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_array_beyond_max_len<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, (#_mkArray returning Array)((2: u32), (3: u32), (4: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_vector_beyond_max_len<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_vector as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Vector) -> Unit)(vec, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (3: u32), (4: u32)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_bounded_vec_beyond_max_len<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let other = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec, other); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::extend::extend_with_empty_collections<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + let original_len = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_array as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Array) -> Unit)(vec, (#_mkArray returning Array)()); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), original_len)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_vector as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, Vector) -> Unit)(vec, (#_asVector returning Vector)((#_mkArray returning Array)())); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), original_len)); + let empty = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::extend_from_bounded_vec as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Unit)(vec, empty); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), original_len)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::storage::storage_consistency<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)()); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (#_mkArray returning Array)((0: u32), (0: u32), (0: u32), (0: u32), (0: u32)))); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (1: u32)); + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::push as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> Unit)(vec, (2: u32)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (#_mkArray returning Array)((1: u32), (2: u32), (0: u32), (0: u32), (0: u32)))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::max_len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (5: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::storage::storage_after_pop<>() -> Unit := { + let vec = (#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + let __0 = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::pop as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)((#_readRef returning «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)(vec), (2: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::bounded_vec::bounded_vec_tests::storage::vector_immutable<>() -> Unit := { + let vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); + let storage = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)(vec); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(storage, (#_mkArray returning Array)((1: u32), (2: u32), (3: u32)))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (0: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(vec), (2: u32)), (3: u32))); + #_skip +} + +def «std-1.0.0-beta.25».Collections.BoundedVec.env : Env := Env.mk + [«std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::unconstrained_any_with_complex_predicates», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::unconstrained_returns_false_if_predicate_not_satisfied», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::unconstrained_returns_true_if_predicate_satisfied», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::map::unconstrained_applies_function_correctly», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::mapi::unconstrained_applies_function_correctly», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::unconstrained_smoke_test», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::unconstrained_smoke_test», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_parts::unconstrained_from_parts», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::unconstrained_extend_from_bounded_vec», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::unconstrained_extend_from_bounded_vec_preserves_tail_storage», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::new», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set_unchecked», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::push», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::set_len», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::truncate», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::max_len», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::storage», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::extend_from_array», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::extend_from_vector», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::extend_from_bounded_vec», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::from_array», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::pop», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::any», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::map», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::mapi», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::for_each», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::for_eachi», «std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::from_parts», «std-1.0.0-beta.25::collections::bounded_vec::unconstrained_eq», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_elements_past_end_of_vec», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::get::panics_when_reading_beyond_length», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::get::get_works_within_bounds», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::get::get_unchecked_works_past_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set::set_updates_values_properly», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set::panics_when_writing_elements_past_end_of_vec», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set::panics_when_setting_beyond_length», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set::set_unchecked_operations_past_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set::set_preserves_other_elements», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set_len::set_len_works_after_multiple_unchecked_sets», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set_len::set_len_can_reduce_the_length», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::set_len::panics_when_set_len_beyond_max_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::truncate::truncate_shortens_to_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::truncate::truncate_to_zero_empties_the_vec», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::truncate::truncate_to_equal_len_is_noop», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::truncate::truncate_to_greater_len_is_noop», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::truncate::truncate_beyond_max_len_is_noop», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::truncate::truncate_does_not_zero_remaining_storage», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::truncate::truncate_then_push_continues_from_new_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::returns_false_if_predicate_not_satisfied», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::returns_true_if_predicate_satisfied», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::returns_false_on_empty_boundedvec», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::any_with_complex_predicates», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::any::any_with_partial_vector», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::map::applies_function_correctly», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::map::applies_function_that_changes_return_type», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::map::does_not_apply_function_past_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::map::map_with_conditional_logic», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::map::map_preserves_length», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::map::map_on_empty_vector», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_correctly», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::mapi::applies_function_that_changes_return_type», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::mapi::does_not_apply_function_past_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::mapi::mapi_with_index_branching_logic», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::for_each_map», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::smoke_test», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_correctly», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::applies_function_that_changes_return_type», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::does_not_apply_function_past_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::for_each_on_empty_vector», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_each::for_each_with_side_effects», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_mapi», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::smoke_test», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_correctly», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::applies_function_that_changes_return_type», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::does_not_apply_function_past_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_on_empty_vector», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::for_eachi::for_eachi_with_index_tracking», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_array::empty», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_array::equal_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_array::max_len_greater_then_array_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_array::max_len_lower_then_array_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_array::from_array_preserves_order», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_array::from_array_with_different_types», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::trait_from::simple», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::trait_eq::empty_equality», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::trait_eq::equality», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::trait_eq::inequality», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::from_parts::from_parts», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::push_pop::push_and_pop_operations», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::push_pop::push_to_full_vector», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::push_pop::pop_from_empty_vector», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::push_pop::push_pop_cycle», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_array», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_vector», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_limit», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_full_and_empty», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_zero_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_last_zeroed», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_empty_self», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_preserves_tail_storage», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_from_bounded_vec_equal_capacity», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_array_beyond_max_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_vector_beyond_max_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_bounded_vec_beyond_max_len», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::extend::extend_with_empty_collections», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::storage::storage_consistency», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::storage::storage_after_pop», «std-1.0.0-beta.25::collections::bounded_vec::bounded_vec_tests::storage::vector_immutable»] + [«std-1.0.0-beta.25».impl_39, «std-1.0.0-beta.25».impl_40] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Mod.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Mod.lean new file mode 100644 index 00000000..41962a66 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Mod.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Collections.Mod.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Umap.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Umap.lean new file mode 100644 index 00000000..604e9247 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Collections/Umap.lean @@ -0,0 +1,208 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_43] «std-1.0.0-beta.25»::default::Default<> for «std-1.0.0-beta.25»::collections::umap::Slot where [] := { + noir_def default<>() -> «std-1.0.0-beta.25»::collections::umap::Slot := { + (#_makeData returning «std-1.0.0-beta.25»::collections::umap::Slot)((#_zeroed returning K)(), (#_zeroed returning V)(), #_false, #_false) + }; +} + +noir_def «std-1.0.0-beta.25»::collections::umap::Slot::is_valid(self: & «std-1.0.0-beta.25»::collections::umap::Slot) -> bool := { + (#_bAnd returning bool)((#_bNot returning bool)((#_readRef returning «std-1.0.0-beta.25»::collections::umap::Slot)(self).3), (#_readRef returning «std-1.0.0-beta.25»::collections::umap::Slot)(self).2) +} + +noir_def «std-1.0.0-beta.25»::collections::umap::Slot::set(self: & «std-1.0.0-beta.25»::collections::umap::Slot, key: K, value: V) -> Unit := { + ((*self: «std-1.0.0-beta.25»::collections::umap::Slot).0: K) = key; + ((*self: «std-1.0.0-beta.25»::collections::umap::Slot).1: V) = value; + ((*self: «std-1.0.0-beta.25»::collections::umap::Slot).2: bool) = #_true; + ((*self: «std-1.0.0-beta.25»::collections::umap::Slot).3: bool) = #_false; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::umap::Slot::mark_deleted(self: & «std-1.0.0-beta.25»::collections::umap::Slot) -> Unit := { + ((*self: «std-1.0.0-beta.25»::collections::umap::Slot).3: bool) = #_true; + #_skip +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::with_hasher(_build_hasher: B) -> «std-1.0.0-beta.25»::collections::umap::UHashMap := { + let _table = (#_asVector returning Vector<«std-1.0.0-beta.25»::collections::umap::Slot >)((#_mkArray returning Array<«std-1.0.0-beta.25»::collections::umap::Slot, 1: u32>)(((«std-1.0.0-beta.25»::collections::umap::Slot as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.25»::collections::umap::Slot)())); + let _len = (0: u32); + (#_makeData returning «std-1.0.0-beta.25»::collections::umap::UHashMap)(_table, _len, _build_hasher) +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::with_hasher_and_capacity(_build_hasher: B, capacity: u32) -> «std-1.0.0-beta.25»::collections::umap::UHashMap := { + let capacity = if (#_uEq returning bool)(capacity, (0: u32)) then { + (1: u32) + } else { + capacity + }; + let _table = (#_ref returning & Vector<«std-1.0.0-beta.25»::collections::umap::Slot >)((#_asVector returning Vector<«std-1.0.0-beta.25»::collections::umap::Slot >)((#_mkArray returning Array<«std-1.0.0-beta.25»::collections::umap::Slot, 0: u32>)())); + for _ in (0: u32) .. capacity do { + _table = (#_vectorPushBack returning Vector<«std-1.0.0-beta.25»::collections::umap::Slot >)((#_readRef returning Vector<«std-1.0.0-beta.25»::collections::umap::Slot >)(_table), ((«std-1.0.0-beta.25»::collections::umap::Slot as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.25»::collections::umap::Slot)()); + #_skip + }; + let _len = (0: u32); + (#_makeData returning «std-1.0.0-beta.25»::collections::umap::UHashMap)((#_readRef returning Vector<«std-1.0.0-beta.25»::collections::umap::Slot >)(_table), _len, _build_hasher) +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::clear(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::contains_key(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, key: K) -> bool := { + (#_fresh returning bool)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::is_empty(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> bool := { + (#_fresh returning bool)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::entries(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> Vector > := { + (#_fresh returning Vector >)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::keys(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> Vector := { + (#_fresh returning Vector)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::values(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> Vector := { + (#_fresh returning Vector)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::iter_mut(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, f: λ(K, V) -> Tuple) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::iter_keys_mut(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, f: λ(K) -> K) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::iter_values_mut(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, f: λ(V) -> V) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::retain(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, f: λ(K, V) -> bool) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::len(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> u32 := { + (#_fresh returning u32)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::capacity(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> u32 := { + (#_fresh returning u32)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::get(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, key: K) -> «std-1.0.0-beta.25»::option::Option := { + (#_fresh returning «std-1.0.0-beta.25»::option::Option)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::insert(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, key: K, value: V) -> bool := { + (#_fresh returning bool)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::try_resize(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::remove(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, key: K) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::hash(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, key: K) -> u32 := { + let hasher = (#_ref returning & B_as_BuildHasher_H)(((B as «std-1.0.0-beta.25»::hash::BuildHasher<>)::build_hasher<> as λ(B) -> B_as_BuildHasher_H)((#_readRef returning «std-1.0.0-beta.25»::collections::umap::UHashMap)(self).2)); + ((K as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(K, & B_as_BuildHasher_H) -> Unit)(key, hasher); + (#_cast returning u32)(((B_as_BuildHasher_H as «std-1.0.0-beta.25»::hash::Hasher<>)::finish_ref<> as λ(& B_as_BuildHasher_H) -> Field)(hasher)) +} + +noir_def «std-1.0.0-beta.25»::collections::umap::UHashMap::linear_probe(self: & «std-1.0.0-beta.25»::collections::umap::UHashMap, hash: u32, attempt: u32) -> u32 := { + (#_cast returning u32)((#_uRem returning u64)((#_uAdd returning u64)((#_cast returning u64)(hash), (#_cast returning u64)(attempt)), (#_cast returning u64)((#_arrayLen returning u32)((#_readRef returning «std-1.0.0-beta.25»::collections::umap::UHashMap)(self).0)))) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_44] «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::collections::umap::UHashMap where [K: «std-1.0.0-beta.25»::cmp::Eq<>, K: «std-1.0.0-beta.25»::hash::Hash<>, V: «std-1.0.0-beta.25»::cmp::Eq<>, B: «std-1.0.0-beta.25»::hash::BuildHasher] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::collections::umap::UHashMap, other: «std-1.0.0-beta.25»::collections::umap::UHashMap) -> bool := { + if (#_isUnconstrained returning bool)() then { + let equal = (#_ref returning & bool)(#_false); + if (#_uEq returning bool)((«std-1.0.0-beta.25»::collections::umap::UHashMap::len as λ(& «std-1.0.0-beta.25»::collections::umap::UHashMap) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::umap::UHashMap)(self)), («std-1.0.0-beta.25»::collections::umap::UHashMap::len as λ(& «std-1.0.0-beta.25»::collections::umap::UHashMap) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::umap::UHashMap)(other))) then { + equal = #_true; + { + let ζi0 = self.0; + for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { + let slot = (#_vectorIndex returning «std-1.0.0-beta.25»::collections::umap::Slot)(ζi0, (#_cast returning u32)(ζi1)); + { + if (#_bAnd returning bool)((#_readRef returning bool)(equal), («std-1.0.0-beta.25»::collections::umap::Slot::is_valid as λ(& «std-1.0.0-beta.25»::collections::umap::Slot) -> bool)((#_ref returning & «std-1.0.0-beta.25»::collections::umap::Slot)(slot))) then { + let other_value = («std-1.0.0-beta.25»::collections::umap::UHashMap::get as λ(& «std-1.0.0-beta.25»::collections::umap::UHashMap, K) -> «std-1.0.0-beta.25»::option::Option)((#_ref returning & «std-1.0.0-beta.25»::collections::umap::UHashMap)(other), slot.0); + if («std-1.0.0-beta.25»::option::Option::is_none as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)(other_value)) then { + equal = #_false; + #_skip + } else { + let other_value = («std-1.0.0-beta.25»::option::Option::unwrap_unchecked as λ(«std-1.0.0-beta.25»::option::Option) -> V)(other_value); + if (#_bNot returning bool)(((V as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(V, V) -> bool)(slot.1, other_value)) then { + equal = #_false; + #_skip + } + } + } + } + }; + #_skip + } + }; + (#_readRef returning bool)(equal) + } else { + («std-1.0.0-beta.25»::panic::panic, bool> as λ(String<66: u32>) -> bool)("Equality check on UHashMap is not supported in constrained context") + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_45] «std-1.0.0-beta.25»::default::Default<> for «std-1.0.0-beta.25»::collections::umap::UHashMap where [B: «std-1.0.0-beta.25»::hash::BuildHasher, B: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> «std-1.0.0-beta.25»::collections::umap::UHashMap := { + («std-1.0.0-beta.25»::collections::umap::UHashMap::with_hasher as λ(B) -> «std-1.0.0-beta.25»::collections::umap::UHashMap)(((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)()) + }; +} + +noir_def «std-1.0.0-beta.25»::collections::umap::test::test_general_usage<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::test::test_no_duplicate_keys_after_deletion_and_insertion<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::collections::umap::test::test_with_hasher_and_capacity_zero<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_41]<> «std-1.0.0-beta.25»::default::Default<> for «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<> where [] := { + noir_def default<>() -> «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<> := { + (#_makeData returning «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<>)((0: Field)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_42]<> «std-1.0.0-beta.25»::hash::Hasher<> for «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<> where [] := { + noir_def finish<>(self: «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<>) -> Field := { + (4294967295: Field) + }; + + noir_def finish_ref<>(self: & «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<>) -> Field := { + ((«std-1.0.0-beta.25»::collections::umap::test::MaxHasher<> as «std-1.0.0-beta.25»::hash::Hasher<>)::finish<> as λ(«std-1.0.0-beta.25»::collections::umap::test::MaxHasher<>) -> Field)((#_readRef returning «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<>)(self)) + }; + + noir_def write<>(self: & «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<>, _input: Field) -> Unit := { + #_skip + }; +} + +noir_def «std-1.0.0-beta.25»::collections::umap::test::test_max_hash<>() -> Unit := { + (#_fresh returning Unit)() +} + +def «std-1.0.0-beta.25».Collections.Umap.env : Env := Env.mk + [«std-1.0.0-beta.25::collections::umap::Slot::is_valid», «std-1.0.0-beta.25::collections::umap::Slot::set», «std-1.0.0-beta.25::collections::umap::Slot::mark_deleted», «std-1.0.0-beta.25::collections::umap::UHashMap::with_hasher», «std-1.0.0-beta.25::collections::umap::UHashMap::with_hasher_and_capacity», «std-1.0.0-beta.25::collections::umap::UHashMap::clear», «std-1.0.0-beta.25::collections::umap::UHashMap::contains_key», «std-1.0.0-beta.25::collections::umap::UHashMap::is_empty», «std-1.0.0-beta.25::collections::umap::UHashMap::entries», «std-1.0.0-beta.25::collections::umap::UHashMap::keys», «std-1.0.0-beta.25::collections::umap::UHashMap::values», «std-1.0.0-beta.25::collections::umap::UHashMap::iter_mut», «std-1.0.0-beta.25::collections::umap::UHashMap::iter_keys_mut», «std-1.0.0-beta.25::collections::umap::UHashMap::iter_values_mut», «std-1.0.0-beta.25::collections::umap::UHashMap::retain», «std-1.0.0-beta.25::collections::umap::UHashMap::len», «std-1.0.0-beta.25::collections::umap::UHashMap::capacity», «std-1.0.0-beta.25::collections::umap::UHashMap::get», «std-1.0.0-beta.25::collections::umap::UHashMap::insert», «std-1.0.0-beta.25::collections::umap::UHashMap::try_resize», «std-1.0.0-beta.25::collections::umap::UHashMap::remove», «std-1.0.0-beta.25::collections::umap::UHashMap::hash», «std-1.0.0-beta.25::collections::umap::UHashMap::linear_probe», «std-1.0.0-beta.25::collections::umap::test::test_general_usage», «std-1.0.0-beta.25::collections::umap::test::test_no_duplicate_keys_after_deletion_and_insertion», «std-1.0.0-beta.25::collections::umap::test::test_with_hasher_and_capacity_zero», «std-1.0.0-beta.25::collections::umap::test::test_max_hash»] + [«std-1.0.0-beta.25».impl_43, «std-1.0.0-beta.25».impl_44, «std-1.0.0-beta.25».impl_45, «std-1.0.0-beta.25».impl_41, «std-1.0.0-beta.25».impl_42] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Compat.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Compat.lean similarity index 61% rename from stdlib/lampe/std-1.0.0-beta.14/Extracted/Compat.lean rename to stdlib/lampe/std-1.0.0-beta.25/Extracted/Compat.lean index 18a60039..78c1aac8 100644 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Compat.lean +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Compat.lean @@ -1,18 +1,18 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe set_option linter.unusedVariables false -noir_global_def «std-1.0.0-beta.14»::compat::BN254_MODULUS_BE_BYTES: Vector = (#_asVector returning Vector)((#_mkArray returning Array)((48: u8), (100: u8), (78: u8), (114: u8), (225: u8), (49: u8), (160: u8), (41: u8), (184: u8), (80: u8), (69: u8), (182: u8), (129: u8), (129: u8), (88: u8), (93: u8), (40: u8), (51: u8), (232: u8), (72: u8), (121: u8), (185: u8), (112: u8), (145: u8), (67: u8), (225: u8), (245: u8), (147: u8), (240: u8), (0: u8), (0: u8), (1: u8))); +noir_global_def «std-1.0.0-beta.25»::compat::BN254_MODULUS_BE_BYTES: Vector = (#_asVector returning Vector)((#_mkArray returning Array)((48: u8), (100: u8), (78: u8), (114: u8), (225: u8), (49: u8), (160: u8), (41: u8), (184: u8), (80: u8), (69: u8), (182: u8), (129: u8), (129: u8), (88: u8), (93: u8), (40: u8), (51: u8), (232: u8), (72: u8), (121: u8), (185: u8), (112: u8), (145: u8), (67: u8), (225: u8), (245: u8), (147: u8), (240: u8), (0: u8), (0: u8), (1: u8))); -noir_def «std-1.0.0-beta.14»::compat::is_bn254<>() -> bool := { +noir_def «std-1.0.0-beta.25»::compat::is_bn254<>() -> bool := { #_true } -def «std-1.0.0-beta.14».Compat.env : Env := Env.mk - [«std-1.0.0-beta.14::compat::BN254_MODULUS_BE_BYTES», «std-1.0.0-beta.14::compat::is_bn254»] +def «std-1.0.0-beta.25».Compat.env : Env := Env.mk + [«std-1.0.0-beta.25::compat::BN254_MODULUS_BE_BYTES», «std-1.0.0-beta.25::compat::is_bn254»] [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Convert.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Convert.lean new file mode 100644 index 00000000..99dd715c --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Convert.lean @@ -0,0 +1,911 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_46] «std-1.0.0-beta.25»::convert::From for T where [] := { + noir_def «from»<>(input: T) -> T := { + input + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_47] «std-1.0.0-beta.25»::convert::Into for U where [T: «std-1.0.0-beta.25»::convert::From] := { + noir_def into<>(self: U) -> T := { + ((T as «std-1.0.0-beta.25»::convert::From)::«from»<> as λ(U) -> T)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_48]<> «std-1.0.0-beta.25»::convert::From for u16 where [] := { + noir_def «from»<>(value: u8) -> u16 := { + (#_cast returning u16)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_49]<> «std-1.0.0-beta.25»::convert::From for u32 where [] := { + noir_def «from»<>(value: u8) -> u32 := { + (#_cast returning u32)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_50]<> «std-1.0.0-beta.25»::convert::From for u32 where [] := { + noir_def «from»<>(value: u16) -> u32 := { + (#_cast returning u32)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_51]<> «std-1.0.0-beta.25»::convert::From for u64 where [] := { + noir_def «from»<>(value: u8) -> u64 := { + (#_cast returning u64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_52]<> «std-1.0.0-beta.25»::convert::From for u64 where [] := { + noir_def «from»<>(value: u16) -> u64 := { + (#_cast returning u64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_53]<> «std-1.0.0-beta.25»::convert::From for u64 where [] := { + noir_def «from»<>(value: u32) -> u64 := { + (#_cast returning u64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_54]<> «std-1.0.0-beta.25»::convert::From for u128 where [] := { + noir_def «from»<>(value: u8) -> u128 := { + (#_cast returning u128)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_55]<> «std-1.0.0-beta.25»::convert::From for u128 where [] := { + noir_def «from»<>(value: u16) -> u128 := { + (#_cast returning u128)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_56]<> «std-1.0.0-beta.25»::convert::From for u128 where [] := { + noir_def «from»<>(value: u32) -> u128 := { + (#_cast returning u128)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_57]<> «std-1.0.0-beta.25»::convert::From for u128 where [] := { + noir_def «from»<>(value: u64) -> u128 := { + (#_cast returning u128)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_58]<> «std-1.0.0-beta.25»::convert::From for Field where [] := { + noir_def «from»<>(value: u8) -> Field := { + (#_cast returning Field)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_59]<> «std-1.0.0-beta.25»::convert::From for Field where [] := { + noir_def «from»<>(value: u16) -> Field := { + (#_cast returning Field)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_60]<> «std-1.0.0-beta.25»::convert::From for Field where [] := { + noir_def «from»<>(value: u32) -> Field := { + (#_cast returning Field)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_61]<> «std-1.0.0-beta.25»::convert::From for Field where [] := { + noir_def «from»<>(value: u64) -> Field := { + (#_cast returning Field)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_62]<> «std-1.0.0-beta.25»::convert::From for Field where [] := { + noir_def «from»<>(value: u128) -> Field := { + (#_cast returning Field)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_63]<> «std-1.0.0-beta.25»::convert::From< i8> for i16 where [] := { + noir_def «from»<>(value: i8) -> i16 := { + (#_cast returning i16)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_64]<> «std-1.0.0-beta.25»::convert::From< i8> for i32 where [] := { + noir_def «from»<>(value: i8) -> i32 := { + (#_cast returning i32)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_65]<> «std-1.0.0-beta.25»::convert::From< i16> for i32 where [] := { + noir_def «from»<>(value: i16) -> i32 := { + (#_cast returning i32)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_66]<> «std-1.0.0-beta.25»::convert::From< i8> for i64 where [] := { + noir_def «from»<>(value: i8) -> i64 := { + (#_cast returning i64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_67]<> «std-1.0.0-beta.25»::convert::From< i16> for i64 where [] := { + noir_def «from»<>(value: i16) -> i64 := { + (#_cast returning i64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_68]<> «std-1.0.0-beta.25»::convert::From< i32> for i64 where [] := { + noir_def «from»<>(value: i32) -> i64 := { + (#_cast returning i64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_69]<> «std-1.0.0-beta.25»::convert::From for u8 where [] := { + noir_def «from»<>(value: bool) -> u8 := { + (#_cast returning u8)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_70]<> «std-1.0.0-beta.25»::convert::From for u16 where [] := { + noir_def «from»<>(value: bool) -> u16 := { + (#_cast returning u16)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_71]<> «std-1.0.0-beta.25»::convert::From for u32 where [] := { + noir_def «from»<>(value: bool) -> u32 := { + (#_cast returning u32)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_72]<> «std-1.0.0-beta.25»::convert::From for u64 where [] := { + noir_def «from»<>(value: bool) -> u64 := { + (#_cast returning u64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_73]<> «std-1.0.0-beta.25»::convert::From for u128 where [] := { + noir_def «from»<>(value: bool) -> u128 := { + (#_cast returning u128)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_74]<> «std-1.0.0-beta.25»::convert::From for i8 where [] := { + noir_def «from»<>(value: bool) -> i8 := { + (#_cast returning i8)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_75]<> «std-1.0.0-beta.25»::convert::From for i16 where [] := { + noir_def «from»<>(value: bool) -> i16 := { + (#_cast returning i16)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_76]<> «std-1.0.0-beta.25»::convert::From for i32 where [] := { + noir_def «from»<>(value: bool) -> i32 := { + (#_cast returning i32)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_77]<> «std-1.0.0-beta.25»::convert::From for i64 where [] := { + noir_def «from»<>(value: bool) -> i64 := { + (#_cast returning i64)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_78]<> «std-1.0.0-beta.25»::convert::From for Field where [] := { + noir_def «from»<>(value: bool) -> Field := { + (#_cast returning Field)(value) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_375]<> «std-1.0.0-beta.25»::convert::AsPrimitive for bool where [] := { + noir_def as_<>(self: bool) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_425]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for bool where [] := { + noir_def as_<>(self: bool) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_345]<> «std-1.0.0-beta.25»::convert::AsPrimitive for bool where [] := { + noir_def as_<>(self: bool) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_395]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for bool where [] := { + noir_def as_<>(self: bool) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_365]<> «std-1.0.0-beta.25»::convert::AsPrimitive for bool where [] := { + noir_def as_<>(self: bool) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_415]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for bool where [] := { + noir_def as_<>(self: bool) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_335]<> «std-1.0.0-beta.25»::convert::AsPrimitive for bool where [] := { + noir_def as_<>(self: bool) -> bool := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_385]<> «std-1.0.0-beta.25»::convert::AsPrimitive for bool where [] := { + noir_def as_<>(self: bool) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_355]<> «std-1.0.0-beta.25»::convert::AsPrimitive for bool where [] := { + noir_def as_<>(self: bool) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_405]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for bool where [] := { + noir_def as_<>(self: bool) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_376]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u8 where [] := { + noir_def as_<>(self: u8) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_426]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for u8 where [] := { + noir_def as_<>(self: u8) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_346]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u8 where [] := { + noir_def as_<>(self: u8) -> u8 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_396]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for u8 where [] := { + noir_def as_<>(self: u8) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_366]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u8 where [] := { + noir_def as_<>(self: u8) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_416]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for u8 where [] := { + noir_def as_<>(self: u8) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_336]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u8 where [] := { + noir_def as_<>(self: u8) -> bool := { + (#_uNeq returning bool)(self, (0: u8)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_386]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u8 where [] := { + noir_def as_<>(self: u8) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_356]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u8 where [] := { + noir_def as_<>(self: u8) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_406]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for u8 where [] := { + noir_def as_<>(self: u8) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_377]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u16 where [] := { + noir_def as_<>(self: u16) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_427]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for u16 where [] := { + noir_def as_<>(self: u16) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_347]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u16 where [] := { + noir_def as_<>(self: u16) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_397]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for u16 where [] := { + noir_def as_<>(self: u16) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_367]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u16 where [] := { + noir_def as_<>(self: u16) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_417]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for u16 where [] := { + noir_def as_<>(self: u16) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_337]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u16 where [] := { + noir_def as_<>(self: u16) -> bool := { + (#_uNeq returning bool)(self, (0: u16)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_387]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u16 where [] := { + noir_def as_<>(self: u16) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_357]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u16 where [] := { + noir_def as_<>(self: u16) -> u16 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_407]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for u16 where [] := { + noir_def as_<>(self: u16) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_348]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u32 where [] := { + noir_def as_<>(self: u32) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_398]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for u32 where [] := { + noir_def as_<>(self: u32) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_368]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u32 where [] := { + noir_def as_<>(self: u32) -> u32 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_418]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for u32 where [] := { + noir_def as_<>(self: u32) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_338]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u32 where [] := { + noir_def as_<>(self: u32) -> bool := { + (#_uNeq returning bool)(self, (0: u32)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_388]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u32 where [] := { + noir_def as_<>(self: u32) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_358]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u32 where [] := { + noir_def as_<>(self: u32) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_408]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for u32 where [] := { + noir_def as_<>(self: u32) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_378]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u32 where [] := { + noir_def as_<>(self: u32) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_428]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for u32 where [] := { + noir_def as_<>(self: u32) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_349]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u64 where [] := { + noir_def as_<>(self: u64) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_399]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for u64 where [] := { + noir_def as_<>(self: u64) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_369]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u64 where [] := { + noir_def as_<>(self: u64) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_419]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for u64 where [] := { + noir_def as_<>(self: u64) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_339]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u64 where [] := { + noir_def as_<>(self: u64) -> bool := { + (#_uNeq returning bool)(self, (0: u64)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_389]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u64 where [] := { + noir_def as_<>(self: u64) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_359]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u64 where [] := { + noir_def as_<>(self: u64) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_409]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for u64 where [] := { + noir_def as_<>(self: u64) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_379]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u64 where [] := { + noir_def as_<>(self: u64) -> u64 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_429]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for u64 where [] := { + noir_def as_<>(self: u64) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_350]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u128 where [] := { + noir_def as_<>(self: u128) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_400]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for u128 where [] := { + noir_def as_<>(self: u128) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_370]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u128 where [] := { + noir_def as_<>(self: u128) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_420]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for u128 where [] := { + noir_def as_<>(self: u128) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_340]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u128 where [] := { + noir_def as_<>(self: u128) -> bool := { + (#_uNeq returning bool)(self, (0: u128)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_390]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u128 where [] := { + noir_def as_<>(self: u128) -> u128 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_360]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u128 where [] := { + noir_def as_<>(self: u128) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_410]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for u128 where [] := { + noir_def as_<>(self: u128) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_380]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u128 where [] := { + noir_def as_<>(self: u128) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_430]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for u128 where [] := { + noir_def as_<>(self: u128) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_351]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i8 where [] := { + noir_def as_<>(self: i8) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_401]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for i8 where [] := { + noir_def as_<>(self: i8) -> i8 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_371]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i8 where [] := { + noir_def as_<>(self: i8) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_421]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for i8 where [] := { + noir_def as_<>(self: i8) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_341]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i8 where [] := { + noir_def as_<>(self: i8) -> bool := { + (#_iNeq returning bool)(self, (0: i8)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_391]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i8 where [] := { + noir_def as_<>(self: i8) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_361]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i8 where [] := { + noir_def as_<>(self: i8) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_411]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for i8 where [] := { + noir_def as_<>(self: i8) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_381]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i8 where [] := { + noir_def as_<>(self: i8) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_431]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for i8 where [] := { + noir_def as_<>(self: i8) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_352]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i16 where [] := { + noir_def as_<>(self: i16) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_402]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for i16 where [] := { + noir_def as_<>(self: i16) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_372]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i16 where [] := { + noir_def as_<>(self: i16) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_422]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for i16 where [] := { + noir_def as_<>(self: i16) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_342]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i16 where [] := { + noir_def as_<>(self: i16) -> bool := { + (#_iNeq returning bool)(self, (0: i16)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_392]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i16 where [] := { + noir_def as_<>(self: i16) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_362]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i16 where [] := { + noir_def as_<>(self: i16) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_412]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for i16 where [] := { + noir_def as_<>(self: i16) -> i16 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_382]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i16 where [] := { + noir_def as_<>(self: i16) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_432]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for i16 where [] := { + noir_def as_<>(self: i16) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_373]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i32 where [] := { + noir_def as_<>(self: i32) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_423]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for i32 where [] := { + noir_def as_<>(self: i32) -> i32 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_343]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i32 where [] := { + noir_def as_<>(self: i32) -> bool := { + (#_iNeq returning bool)(self, (0: i32)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_393]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i32 where [] := { + noir_def as_<>(self: i32) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_363]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i32 where [] := { + noir_def as_<>(self: i32) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_413]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for i32 where [] := { + noir_def as_<>(self: i32) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_383]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i32 where [] := { + noir_def as_<>(self: i32) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_433]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for i32 where [] := { + noir_def as_<>(self: i32) -> i64 := { + (#_cast returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_353]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i32 where [] := { + noir_def as_<>(self: i32) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_403]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for i32 where [] := { + noir_def as_<>(self: i32) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_374]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i64 where [] := { + noir_def as_<>(self: i64) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_424]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i32> for i64 where [] := { + noir_def as_<>(self: i64) -> i32 := { + (#_cast returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_344]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i64 where [] := { + noir_def as_<>(self: i64) -> bool := { + (#_iNeq returning bool)(self, (0: i64)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_394]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i64 where [] := { + noir_def as_<>(self: i64) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_364]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i64 where [] := { + noir_def as_<>(self: i64) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_414]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i16> for i64 where [] := { + noir_def as_<>(self: i64) -> i16 := { + (#_cast returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_384]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i64 where [] := { + noir_def as_<>(self: i64) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_434]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i64> for i64 where [] := { + noir_def as_<>(self: i64) -> i64 := { + self + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_354]<> «std-1.0.0-beta.25»::convert::AsPrimitive for i64 where [] := { + noir_def as_<>(self: i64) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_404]<> «std-1.0.0-beta.25»::convert::AsPrimitive< i8> for i64 where [] := { + noir_def as_<>(self: i64) -> i8 := { + (#_cast returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_435]<> «std-1.0.0-beta.25»::convert::AsPrimitive for bool where [] := { + noir_def as_<>(self: bool) -> Field := { + (#_cast returning Field)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_436]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u8 where [] := { + noir_def as_<>(self: u8) -> Field := { + (#_cast returning Field)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_437]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u16 where [] := { + noir_def as_<>(self: u16) -> Field := { + (#_cast returning Field)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_438]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u32 where [] := { + noir_def as_<>(self: u32) -> Field := { + (#_cast returning Field)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_439]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u64 where [] := { + noir_def as_<>(self: u64) -> Field := { + (#_cast returning Field)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_440]<> «std-1.0.0-beta.25»::convert::AsPrimitive for u128 where [] := { + noir_def as_<>(self: u128) -> Field := { + (#_cast returning Field)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_446]<> «std-1.0.0-beta.25»::convert::AsPrimitive for Field where [] := { + noir_def as_<>(self: Field) -> u128 := { + (#_cast returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_445]<> «std-1.0.0-beta.25»::convert::AsPrimitive for Field where [] := { + noir_def as_<>(self: Field) -> u64 := { + (#_cast returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_444]<> «std-1.0.0-beta.25»::convert::AsPrimitive for Field where [] := { + noir_def as_<>(self: Field) -> u32 := { + (#_cast returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_443]<> «std-1.0.0-beta.25»::convert::AsPrimitive for Field where [] := { + noir_def as_<>(self: Field) -> u16 := { + (#_cast returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_442]<> «std-1.0.0-beta.25»::convert::AsPrimitive for Field where [] := { + noir_def as_<>(self: Field) -> u8 := { + (#_cast returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_441]<> «std-1.0.0-beta.25»::convert::AsPrimitive for Field where [] := { + noir_def as_<>(self: Field) -> bool := { + (#_fNeq returning bool)(self, (0: Field)) + }; +} + +noir_def «std-1.0.0-beta.25»::convert::tests::from_identity<>() -> Unit := { + let x = (42: u32); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::convert::From)::«from»<> as λ(u32) -> u32)(x), (42: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::convert::tests::from_unsigned_widening<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::convert::tests::from_unsigned_to_field<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::convert::tests::from_signed_widening<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::convert::tests::from_bool<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::convert::tests::into_widens_unsigned<>() -> Unit := { + let value = (7: u8); + let widened = ((u8 as «std-1.0.0-beta.25»::convert::Into)::into<> as λ(u8) -> u32)(value); + (#_assert returning Unit)((#_uEq returning bool)(widened, (7: u32))); + #_skip +} + +def «std-1.0.0-beta.25».Convert.env : Env := Env.mk + [«std-1.0.0-beta.25::convert::tests::from_identity», «std-1.0.0-beta.25::convert::tests::from_unsigned_widening», «std-1.0.0-beta.25::convert::tests::from_unsigned_to_field», «std-1.0.0-beta.25::convert::tests::from_signed_widening», «std-1.0.0-beta.25::convert::tests::from_bool», «std-1.0.0-beta.25::convert::tests::into_widens_unsigned»] + [«std-1.0.0-beta.25».impl_46, «std-1.0.0-beta.25».impl_47, «std-1.0.0-beta.25».impl_48, «std-1.0.0-beta.25».impl_49, «std-1.0.0-beta.25».impl_50, «std-1.0.0-beta.25».impl_51, «std-1.0.0-beta.25».impl_52, «std-1.0.0-beta.25».impl_53, «std-1.0.0-beta.25».impl_54, «std-1.0.0-beta.25».impl_55, «std-1.0.0-beta.25».impl_56, «std-1.0.0-beta.25».impl_57, «std-1.0.0-beta.25».impl_58, «std-1.0.0-beta.25».impl_59, «std-1.0.0-beta.25».impl_60, «std-1.0.0-beta.25».impl_61, «std-1.0.0-beta.25».impl_62, «std-1.0.0-beta.25».impl_63, «std-1.0.0-beta.25».impl_64, «std-1.0.0-beta.25».impl_65, «std-1.0.0-beta.25».impl_66, «std-1.0.0-beta.25».impl_67, «std-1.0.0-beta.25».impl_68, «std-1.0.0-beta.25».impl_69, «std-1.0.0-beta.25».impl_70, «std-1.0.0-beta.25».impl_71, «std-1.0.0-beta.25».impl_72, «std-1.0.0-beta.25».impl_73, «std-1.0.0-beta.25».impl_74, «std-1.0.0-beta.25».impl_75, «std-1.0.0-beta.25».impl_76, «std-1.0.0-beta.25».impl_77, «std-1.0.0-beta.25».impl_78, «std-1.0.0-beta.25».impl_375, «std-1.0.0-beta.25».impl_425, «std-1.0.0-beta.25».impl_345, «std-1.0.0-beta.25».impl_395, «std-1.0.0-beta.25».impl_365, «std-1.0.0-beta.25».impl_415, «std-1.0.0-beta.25».impl_335, «std-1.0.0-beta.25».impl_385, «std-1.0.0-beta.25».impl_355, «std-1.0.0-beta.25».impl_405, «std-1.0.0-beta.25».impl_376, «std-1.0.0-beta.25».impl_426, «std-1.0.0-beta.25».impl_346, «std-1.0.0-beta.25».impl_396, «std-1.0.0-beta.25».impl_366, «std-1.0.0-beta.25».impl_416, «std-1.0.0-beta.25».impl_336, «std-1.0.0-beta.25».impl_386, «std-1.0.0-beta.25».impl_356, «std-1.0.0-beta.25».impl_406, «std-1.0.0-beta.25».impl_377, «std-1.0.0-beta.25».impl_427, «std-1.0.0-beta.25».impl_347, «std-1.0.0-beta.25».impl_397, «std-1.0.0-beta.25».impl_367, «std-1.0.0-beta.25».impl_417, «std-1.0.0-beta.25».impl_337, «std-1.0.0-beta.25».impl_387, «std-1.0.0-beta.25».impl_357, «std-1.0.0-beta.25».impl_407, «std-1.0.0-beta.25».impl_348, «std-1.0.0-beta.25».impl_398, «std-1.0.0-beta.25».impl_368, «std-1.0.0-beta.25».impl_418, «std-1.0.0-beta.25».impl_338, «std-1.0.0-beta.25».impl_388, «std-1.0.0-beta.25».impl_358, «std-1.0.0-beta.25».impl_408, «std-1.0.0-beta.25».impl_378, «std-1.0.0-beta.25».impl_428, «std-1.0.0-beta.25».impl_349, «std-1.0.0-beta.25».impl_399, «std-1.0.0-beta.25».impl_369, «std-1.0.0-beta.25».impl_419, «std-1.0.0-beta.25».impl_339, «std-1.0.0-beta.25».impl_389, «std-1.0.0-beta.25».impl_359, «std-1.0.0-beta.25».impl_409, «std-1.0.0-beta.25».impl_379, «std-1.0.0-beta.25».impl_429, «std-1.0.0-beta.25».impl_350, «std-1.0.0-beta.25».impl_400, «std-1.0.0-beta.25».impl_370, «std-1.0.0-beta.25».impl_420, «std-1.0.0-beta.25».impl_340, «std-1.0.0-beta.25».impl_390, «std-1.0.0-beta.25».impl_360, «std-1.0.0-beta.25».impl_410, «std-1.0.0-beta.25».impl_380, «std-1.0.0-beta.25».impl_430, «std-1.0.0-beta.25».impl_351, «std-1.0.0-beta.25».impl_401, «std-1.0.0-beta.25».impl_371, «std-1.0.0-beta.25».impl_421, «std-1.0.0-beta.25».impl_341, «std-1.0.0-beta.25».impl_391, «std-1.0.0-beta.25».impl_361, «std-1.0.0-beta.25».impl_411, «std-1.0.0-beta.25».impl_381, «std-1.0.0-beta.25».impl_431, «std-1.0.0-beta.25».impl_352, «std-1.0.0-beta.25».impl_402, «std-1.0.0-beta.25».impl_372, «std-1.0.0-beta.25».impl_422, «std-1.0.0-beta.25».impl_342, «std-1.0.0-beta.25».impl_392, «std-1.0.0-beta.25».impl_362, «std-1.0.0-beta.25».impl_412, «std-1.0.0-beta.25».impl_382, «std-1.0.0-beta.25».impl_432, «std-1.0.0-beta.25».impl_373, «std-1.0.0-beta.25».impl_423, «std-1.0.0-beta.25».impl_343, «std-1.0.0-beta.25».impl_393, «std-1.0.0-beta.25».impl_363, «std-1.0.0-beta.25».impl_413, «std-1.0.0-beta.25».impl_383, «std-1.0.0-beta.25».impl_433, «std-1.0.0-beta.25».impl_353, «std-1.0.0-beta.25».impl_403, «std-1.0.0-beta.25».impl_374, «std-1.0.0-beta.25».impl_424, «std-1.0.0-beta.25».impl_344, «std-1.0.0-beta.25».impl_394, «std-1.0.0-beta.25».impl_364, «std-1.0.0-beta.25».impl_414, «std-1.0.0-beta.25».impl_384, «std-1.0.0-beta.25».impl_434, «std-1.0.0-beta.25».impl_354, «std-1.0.0-beta.25».impl_404, «std-1.0.0-beta.25».impl_435, «std-1.0.0-beta.25».impl_436, «std-1.0.0-beta.25».impl_437, «std-1.0.0-beta.25».impl_438, «std-1.0.0-beta.25».impl_439, «std-1.0.0-beta.25».impl_440, «std-1.0.0-beta.25».impl_446, «std-1.0.0-beta.25».impl_445, «std-1.0.0-beta.25».impl_444, «std-1.0.0-beta.25».impl_443, «std-1.0.0-beta.25».impl_442, «std-1.0.0-beta.25».impl_441] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Default.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Default.lean new file mode 100644 index 00000000..d2775773 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Default.lean @@ -0,0 +1,198 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_279]<> «std-1.0.0-beta.25»::default::Default<> for Field where [] := { + noir_def default<>() -> Field := { + (0: Field) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_280]<> «std-1.0.0-beta.25»::default::Default<> for u8 where [] := { + noir_def default<>() -> u8 := { + (0: u8) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_281]<> «std-1.0.0-beta.25»::default::Default<> for u16 where [] := { + noir_def default<>() -> u16 := { + (0: u16) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_282]<> «std-1.0.0-beta.25»::default::Default<> for u32 where [] := { + noir_def default<>() -> u32 := { + (0: u32) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_283]<> «std-1.0.0-beta.25»::default::Default<> for u64 where [] := { + noir_def default<>() -> u64 := { + (0: u64) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_284]<> «std-1.0.0-beta.25»::default::Default<> for u128 where [] := { + noir_def default<>() -> u128 := { + (0: u128) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_285]<> «std-1.0.0-beta.25»::default::Default<> for i8 where [] := { + noir_def default<>() -> i8 := { + (0: i8) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_286]<> «std-1.0.0-beta.25»::default::Default<> for i16 where [] := { + noir_def default<>() -> i16 := { + (0: i16) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_287]<> «std-1.0.0-beta.25»::default::Default<> for i32 where [] := { + noir_def default<>() -> i32 := { + (0: i32) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_288]<> «std-1.0.0-beta.25»::default::Default<> for i64 where [] := { + noir_def default<>() -> i64 := { + (0: i64) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_289]<> «std-1.0.0-beta.25»::default::Default<> for Unit where [] := { + noir_def default<>() -> Unit := { + #_unit + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_290]<> «std-1.0.0-beta.25»::default::Default<> for bool where [] := { + noir_def default<>() -> bool := { + #_false + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_291] «std-1.0.0-beta.25»::default::Default<> for Array where [T: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Array := { + (#_mkRepeatedArray returning Array)(((T as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> T)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_292] «std-1.0.0-beta.25»::default::Default<> for Vector where [] := { + noir_def default<>() -> Vector := { + (#_asVector returning Vector)((#_mkArray returning Array)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_293] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_294] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_295] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_296] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_297] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_298] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>, F: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)(), ((F as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> F)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_299] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>, F: «std-1.0.0-beta.25»::default::Default<>, G: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)(), ((F as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> F)(), ((G as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> G)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_300] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>, F: «std-1.0.0-beta.25»::default::Default<>, G: «std-1.0.0-beta.25»::default::Default<>, H: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)(), ((F as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> F)(), ((G as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> G)(), ((H as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> H)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_301] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>, F: «std-1.0.0-beta.25»::default::Default<>, G: «std-1.0.0-beta.25»::default::Default<>, H: «std-1.0.0-beta.25»::default::Default<>, I: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)(), ((F as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> F)(), ((G as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> G)(), ((H as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> H)(), ((I as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> I)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_302] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>, F: «std-1.0.0-beta.25»::default::Default<>, G: «std-1.0.0-beta.25»::default::Default<>, H: «std-1.0.0-beta.25»::default::Default<>, I: «std-1.0.0-beta.25»::default::Default<>, J: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)(), ((F as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> F)(), ((G as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> G)(), ((H as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> H)(), ((I as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> I)(), ((J as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> J)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_303] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>, F: «std-1.0.0-beta.25»::default::Default<>, G: «std-1.0.0-beta.25»::default::Default<>, H: «std-1.0.0-beta.25»::default::Default<>, I: «std-1.0.0-beta.25»::default::Default<>, J: «std-1.0.0-beta.25»::default::Default<>, K: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)(), ((F as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> F)(), ((G as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> G)(), ((H as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> H)(), ((I as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> I)(), ((J as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> J)(), ((K as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> K)()) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_304] «std-1.0.0-beta.25»::default::Default<> for Tuple where [A: «std-1.0.0-beta.25»::default::Default<>, B: «std-1.0.0-beta.25»::default::Default<>, C: «std-1.0.0-beta.25»::default::Default<>, D: «std-1.0.0-beta.25»::default::Default<>, E: «std-1.0.0-beta.25»::default::Default<>, F: «std-1.0.0-beta.25»::default::Default<>, G: «std-1.0.0-beta.25»::default::Default<>, H: «std-1.0.0-beta.25»::default::Default<>, I: «std-1.0.0-beta.25»::default::Default<>, J: «std-1.0.0-beta.25»::default::Default<>, K: «std-1.0.0-beta.25»::default::Default<>, L: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> Tuple := { + (#_makeData returning Tuple)(((A as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> A)(), ((B as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> B)(), ((C as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> C)(), ((D as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> D)(), ((E as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> E)(), ((F as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> F)(), ((G as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> G)(), ((H as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> H)(), ((I as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> I)(), ((J as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> J)(), ((K as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> K)(), ((L as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> L)()) + }; +} + +noir_def «std-1.0.0-beta.25»::default::tests::defaults<>() -> Unit := { + (#_assert returning Unit)((#_unitEq returning bool)(((Unit as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Unit)(), #_unit)); + (#_assert returning Unit)((#_bEq returning bool)(((bool as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> bool)(), #_false)); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> u8)(), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> u16)(), (0: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> u32)(), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> u64)(), (0: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> u128)(), (0: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> i8)(), (0: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> i16)(), (0: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> i32)(), (0: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> i64)(), (0: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Field)(), (0: Field))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(((Array as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Array)(), (#_mkRepeatedArray returning Array)((0: Field)))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(((Vector as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Vector)(), (#_mkVector returning Vector)())); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)(((Tuple as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> Tuple)(), (#_makeData returning Tuple)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + #_skip +} + +def «std-1.0.0-beta.25».Default.env : Env := Env.mk + [«std-1.0.0-beta.25::default::tests::defaults»] + [«std-1.0.0-beta.25».impl_279, «std-1.0.0-beta.25».impl_280, «std-1.0.0-beta.25».impl_281, «std-1.0.0-beta.25».impl_282, «std-1.0.0-beta.25».impl_283, «std-1.0.0-beta.25».impl_284, «std-1.0.0-beta.25».impl_285, «std-1.0.0-beta.25».impl_286, «std-1.0.0-beta.25».impl_287, «std-1.0.0-beta.25».impl_288, «std-1.0.0-beta.25».impl_289, «std-1.0.0-beta.25».impl_290, «std-1.0.0-beta.25».impl_291, «std-1.0.0-beta.25».impl_292, «std-1.0.0-beta.25».impl_293, «std-1.0.0-beta.25».impl_294, «std-1.0.0-beta.25».impl_295, «std-1.0.0-beta.25».impl_296, «std-1.0.0-beta.25».impl_297, «std-1.0.0-beta.25».impl_298, «std-1.0.0-beta.25».impl_299, «std-1.0.0-beta.25».impl_300, «std-1.0.0-beta.25».impl_301, «std-1.0.0-beta.25».impl_302, «std-1.0.0-beta.25».impl_303, «std-1.0.0-beta.25».impl_304] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256K1.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256K1.lean new file mode 100644 index 00000000..aa336ca9 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256K1.lean @@ -0,0 +1,29 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::ecdsa_secp256k1::verify_signature<>(public_key_x: Array, public_key_y: Array, signature: Array, message_hash: Array) -> bool := { + (#_ecdsaSecp256K1 returning bool)(public_key_x, public_key_y, signature, message_hash, #_true) +} + +noir_def «std-1.0.0-beta.25»::ecdsa_secp256k1::tests::verify<>() -> Unit := { + let hashed_message = (#_ref returning & Array)((#_mkArray returning Array)((58: u8), (115: u8), (244: u8), (18: u8), (58: u8), (92: u8), (210: u8), (18: u8), (31: u8), (33: u8), (205: u8), (126: u8), (141: u8), (53: u8), (136: u8), (53: u8), (71: u8), (105: u8), (73: u8), (208: u8), (53: u8), (217: u8), (194: u8), (218: u8), (104: u8), (6: u8), (180: u8), (99: u8), (58: u8), (200: u8), (193: u8), (226: u8))); + let pub_key_x = (#_mkArray returning Array)((160: u8), (67: u8), (77: u8), (158: u8), (71: u8), (243: u8), (200: u8), (98: u8), (53: u8), (71: u8), (124: u8), (123: u8), (26: u8), (230: u8), (174: u8), (93: u8), (52: u8), (66: u8), (212: u8), (155: u8), (25: u8), (67: u8), (194: u8), (183: u8), (82: u8), (166: u8), (142: u8), (42: u8), (71: u8), (226: u8), (71: u8), (199: u8)); + let pub_key_y = (#_mkArray returning Array)((137: u8), (58: u8), (186: u8), (66: u8), (84: u8), (25: u8), (188: u8), (39: u8), (163: u8), (182: u8), (199: u8), (230: u8), (147: u8), (162: u8), (76: u8), (105: u8), (111: u8), (121: u8), (76: u8), (46: u8), (216: u8), (119: u8), (161: u8), (89: u8), (60: u8), (190: u8), (229: u8), (59: u8), (3: u8), (115: u8), (104: u8), (215: u8)); + let signature = (#_mkArray returning Array)((229: u8), (8: u8), (28: u8), (128: u8), (171: u8), (66: u8), (125: u8), (195: u8), (112: u8), (52: u8), (111: u8), (74: u8), (14: u8), (49: u8), (170: u8), (43: u8), (173: u8), (141: u8), (151: u8), (152: u8), (195: u8), (128: u8), (97: u8), (219: u8), (154: u8), (229: u8), (90: u8), (78: u8), (141: u8), (244: u8), (84: u8), (253: u8), (40: u8), (17: u8), (152: u8), (148: u8), (52: u8), (78: u8), (113: u8), (183: u8), (135: u8), (112: u8), (204: u8), (147: u8), (29: u8), (97: u8), (244: u8), (128: u8), (236: u8), (187: u8), (11: u8), (137: u8), (214: u8), (235: u8), (105: u8), (105: u8), (1: u8), (97: u8), (228: u8), (154: u8), (113: u8), (95: u8), (205: u8), (85: u8)); + let valid_signature = («std-1.0.0-beta.25»::ecdsa_secp256k1::verify_signature<> as λ(Array, Array, Array, Array) -> bool)(pub_key_x, pub_key_y, signature, (#_readRef returning Array)(hashed_message)); + (#_assert returning Unit)(valid_signature); + (hashed_message[(0: u32)]: u8) = (0: u8); + let valid_signature = («std-1.0.0-beta.25»::ecdsa_secp256k1::verify_signature<> as λ(Array, Array, Array, Array) -> bool)(pub_key_x, pub_key_y, signature, (#_readRef returning Array)(hashed_message)); + (#_assert returning Unit)((#_bNot returning bool)(valid_signature)); + #_skip +} + +def «std-1.0.0-beta.25».EcdsaSecp256K1.env : Env := Env.mk + [«std-1.0.0-beta.25::ecdsa_secp256k1::verify_signature», «std-1.0.0-beta.25::ecdsa_secp256k1::tests::verify»] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256R1.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256R1.lean new file mode 100644 index 00000000..1530fba0 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/EcdsaSecp256R1.lean @@ -0,0 +1,29 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::ecdsa_secp256r1::verify_signature<>(public_key_x: Array, public_key_y: Array, signature: Array, message_hash: Array) -> bool := { + (#_ecdsaSecp256R1 returning bool)(public_key_x, public_key_y, signature, message_hash, #_true) +} + +noir_def «std-1.0.0-beta.25»::ecdsa_secp256r1::tests::verify<>() -> Unit := { + let hashed_message = (#_ref returning & Array)((#_mkArray returning Array)((84: u8), (112: u8), (91: u8), (163: u8), (186: u8), (175: u8), (219: u8), (223: u8), (186: u8), (140: u8), (95: u8), (154: u8), (112: u8), (247: u8), (168: u8), (155: u8), (238: u8), (152: u8), (217: u8), (6: u8), (181: u8), (62: u8), (49: u8), (7: u8), (77: u8), (167: u8), (186: u8), (236: u8), (220: u8), (13: u8), (169: u8), (173: u8))); + let pub_key_x = (#_mkArray returning Array)((85: u8), (15: u8), (71: u8), (16: u8), (3: u8), (243: u8), (223: u8), (151: u8), (195: u8), (223: u8), (80: u8), (106: u8), (199: u8), (151: u8), (246: u8), (114: u8), (31: u8), (177: u8), (161: u8), (251: u8), (123: u8), (143: u8), (111: u8), (131: u8), (210: u8), (36: u8), (73: u8), (138: u8), (101: u8), (200: u8), (142: u8), (36: u8)); + let pub_key_y = (#_mkArray returning Array)((19: u8), (96: u8), (147: u8), (215: u8), (1: u8), (46: u8), (80: u8), (154: u8), (115: u8), (113: u8), (92: u8), (189: u8), (11: u8), (0: u8), (163: u8), (204: u8), (15: u8), (244: u8), (181: u8), (192: u8), (27: u8), (63: u8), (250: u8), (25: u8), (106: u8), (177: u8), (251: u8), (50: u8), (112: u8), (54: u8), (184: u8), (230: u8)); + let signature = (#_mkArray returning Array)((44: u8), (112: u8), (168: u8), (208: u8), (132: u8), (182: u8), (43: u8), (252: u8), (92: u8), (224: u8), (54: u8), (65: u8), (202: u8), (249: u8), (247: u8), (42: u8), (212: u8), (218: u8), (140: u8), (129: u8), (191: u8), (230: u8), (236: u8), (148: u8), (135: u8), (187: u8), (94: u8), (27: u8), (239: u8), (98: u8), (161: u8), (50: u8), (24: u8), (173: u8), (158: u8), (226: u8), (158: u8), (175: u8), (53: u8), (31: u8), (220: u8), (80: u8), (241: u8), (82: u8), (12: u8), (66: u8), (94: u8), (155: u8), (144: u8), (138: u8), (7: u8), (39: u8), (139: u8), (67: u8), (176: u8), (236: u8), (123: u8), (135: u8), (39: u8), (120: u8), (193: u8), (78: u8), (7: u8), (132: u8)); + let valid_signature = («std-1.0.0-beta.25»::ecdsa_secp256r1::verify_signature<> as λ(Array, Array, Array, Array) -> bool)(pub_key_x, pub_key_y, signature, (#_readRef returning Array)(hashed_message)); + (#_assert returning Unit)(valid_signature); + (hashed_message[(0: u32)]: u8) = (0: u8); + let valid_signature = («std-1.0.0-beta.25»::ecdsa_secp256r1::verify_signature<> as λ(Array, Array, Array, Array) -> bool)(pub_key_x, pub_key_y, signature, (#_readRef returning Array)(hashed_message)); + (#_assert returning Unit)((#_bNot returning bool)(valid_signature)); + #_skip +} + +def «std-1.0.0-beta.25».EcdsaSecp256R1.env : Env := Env.mk + [«std-1.0.0-beta.25::ecdsa_secp256r1::verify_signature», «std-1.0.0-beta.25::ecdsa_secp256r1::tests::verify»] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/EmbeddedCurveOps.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/EmbeddedCurveOps.lean new file mode 100644 index 00000000..ab54de19 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/EmbeddedCurveOps.lean @@ -0,0 +1,380 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<>(x: Field, y: Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(x, y) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<>(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + («std-1.0.0-beta.25»::embedded_curve_ops::embedded_curve_add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(self, self) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<>() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((0: Field), (0: Field)) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<>() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((1: Field), (17631683881184975370165255887551781615748388533673675138860: Field)) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<>(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool := { + (#_bAnd returning bool)((#_fEq returning bool)(self.0, (0: Field)), (#_fEq returning bool)(self.1, (0: Field))) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_32]<> «std-1.0.0-beta.25»::ops::arith::Add<> for «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { + noir_def add<>(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, other: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + («std-1.0.0-beta.25»::embedded_curve_ops::embedded_curve_add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_33]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { + noir_def sub<>(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, other: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(self, ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(other)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_34]<> «std-1.0.0-beta.25»::ops::arith::Neg<> for «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { + noir_def neg<>(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(self.0, (#_fNeg returning Field)(self.1)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_35]<> «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, b: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool := { + (#_bAnd returning bool)((#_fEq returning bool)(self.0, b.0), (#_fEq returning bool)(self.1, b.1)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_36]<> «std-1.0.0-beta.25»::hash::Hash<> for «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> where [] := { + noir_def hash(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, state: & H) -> Unit := { + ((Field as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, state); + ((Field as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.1, state); + #_skip + }; +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<>(lo: Field, hi: Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> := { + (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)(lo, hi) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::from_field<>(scalar: Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> := { + let (a, b) = («std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)(scalar); + (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)(a, b) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_37]<> «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> where [] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, other: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool := { + (#_bAnd returning bool)((#_fEq returning bool)(other.1, self.1), (#_fEq returning bool)(other.0, self.0)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_38]<> «std-1.0.0-beta.25»::hash::Hash<> for «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> where [] := { + noir_def hash(self: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, state: & H) -> Unit := { + ((Field as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.1, state); + ((Field as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, state); + #_skip + }; +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul(points: Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>, scalars: Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + (#_arrayIndex returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_multiScalarMul returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)(points, scalars, #_true), (0: u32)) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::fixed_base_scalar_mul<>(scalar: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + («std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<1: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)()), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>)(scalar)) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::embedded_curve_add<>(point1: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, point2: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + (#_arrayIndex returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_embeddedCurveAdd returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)(point1, point2, #_true), (0: u32)) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<>(p: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field := { + let hasher = (#_ref returning & «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(((«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)()); + ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::hash::Hash<>)::hash<«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> > as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, & «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>) -> Unit)(p, hasher); + ((«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> as «std-1.0.0-beta.25»::hash::Hasher<>)::finish<> as λ(«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>) -> Field)((#_readRef returning «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(hasher)) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<>(s: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field := { + let hasher = (#_ref returning & «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(((«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)()); + ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> as «std-1.0.0-beta.25»::hash::Hash<>)::hash<«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> > as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, & «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>) -> Unit)(s, hasher); + ((«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> as «std-1.0.0-beta.25»::hash::Hasher<>)::finish<> as λ(«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>) -> Field)((#_readRef returning «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(hasher)) +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::point_new_sets_coordinates<>() -> Unit := { + let p = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((3: Field), (5: Field)); + (#_assert returning Unit)((#_fEq returning bool)(p.0, (3: Field))); + (#_assert returning Unit)((#_fEq returning bool)(p.1, (5: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::point_at_infinity_is_origin<>() -> Unit := { + let inf = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)((#_fEq returning bool)(inf.0, (0: Field))); + (#_assert returning Unit)((#_fEq returning bool)(inf.1, (0: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::generator_has_documented_coordinates<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)((#_fEq returning bool)(g.0, (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)(g.1, (17631683881184975370165255887551781615748388533673675138860: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::is_infinite_only_true_for_origin<>() -> Unit := { + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)())); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)()))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((1: Field), (0: Field))))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((0: Field), (1: Field))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::points_with_same_coords_are_equal<>() -> Unit := { + let p = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((7: Field), (11: Field)); + let q = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((7: Field), (11: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(p, q)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::points_with_different_coords_are_unequal<>() -> Unit := { + let p = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((7: Field), (11: Field)); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(p, («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((7: Field), (12: Field))))); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(p, («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((8: Field), (11: Field))))); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(p, («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((8: Field), (12: Field))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::neg_negates_y_coordinate<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let neg_g = ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g); + (#_assert returning Unit)((#_fEq returning bool)(neg_g.0, g.0)); + (#_assert returning Unit)((#_fEq returning bool)(neg_g.1, (#_fNeg returning Field)(g.1))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::neg_is_involution<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g)), g)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::add_with_point_at_infinity_is_identity<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let inf = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, inf), g)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(inf, g), g)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::add_of_two_infinities_is_infinity<>() -> Unit := { + let inf = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(inf, inf))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::add_with_negation_is_point_at_infinity<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::add_is_commutative<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let g2 = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g2), ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g2, g))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::add_is_associative<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let g2 = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g); + let g3 = ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g2); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g2), g3), ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g2, g3)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::sub_of_a_point_with_itself_is_infinity<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::sub_with_point_at_infinity_is_identity<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let inf = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, inf), g)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::sub_inverts_add<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let g2 = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g2), g2), g)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g2), g), g2)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::double_equals_self_plus_self<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g), ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::double_of_point_at_infinity_is_infinity<>() -> Unit := { + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)()))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::embedded_curve_add_matches_add_operator<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let g2 = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::embedded_curve_add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g2), ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g, g2))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::point_hash_is_consistent_for_equal_points<>() -> Unit := { + let p = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((3: Field), (5: Field)); + let q = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((3: Field), (5: Field)); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)(p), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)(q))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::point_hash_differs_for_distinct_points<>() -> Unit := { + let p = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((3: Field), (5: Field)); + (#_assert returning Unit)((#_fNeq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)(p), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((3: Field), (7: Field))))); + (#_assert returning Unit)((#_fNeq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)(p), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((4: Field), (5: Field))))); + (#_assert returning Unit)((#_fNeq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)(p), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_point<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> Field)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((5: Field), (3: Field))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalar_new_sets_limbs<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((3: Field), (5: Field)); + (#_assert returning Unit)((#_fEq returning bool)(s.0, (3: Field))); + (#_assert returning Unit)((#_fEq returning bool)(s.1, (5: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalars_with_same_limbs_are_equal<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (11: Field)); + let t = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (11: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool)(s, t)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalars_with_different_limbs_are_unequal<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (11: Field)); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool)(s, («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (12: Field))))); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool)(s, («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((8: Field), (11: Field))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalar_from_field_decomposes_zero<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::from_field<> as λ(Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field)), («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalar_from_field_decomposes_small_value<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::from_field<> as λ(Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((78187493520: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool)(s, («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((78187493520: Field), (0: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalar_from_field_decomposes_two_pow_128<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::from_field<> as λ(Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)()); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> bool)(s, («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (1: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalar_hash_is_consistent_for_equal_scalars<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (11: Field)); + let t = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (11: Field)); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)(s), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)(t))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::scalar_hash_differs_for_distinct_scalars<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (11: Field)); + (#_assert returning Unit)((#_fNeq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)(s), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((7: Field), (12: Field))))); + (#_assert returning Unit)((#_fNeq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)(s), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((8: Field), (11: Field))))); + (#_assert returning Unit)((#_fNeq returning bool)((«std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)(s), («std-1.0.0-beta.25»::embedded_curve_ops::tests::hash_scalar<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> Field)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((11: Field), (7: Field))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::msm_with_scalar_one_returns_point<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let one = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((1: Field), (0: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<1: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)(g), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>)(one)), g)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::msm_with_scalar_zero_returns_infinity<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let zero = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)); + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<1: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)(g), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>)(zero)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::msm_with_scalar_two_doubles_point<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let two = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((2: Field), (0: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<1: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)(g), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>)(two)), («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::msm_sums_terms<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let one = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((1: Field), (0: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<2: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>)(g, g), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>)(one, one)), («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::double<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::msm_with_opposite_terms_cancels<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let one = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((1: Field), (0: Field)); + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<2: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>)(g, ((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(g)), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>)(one, one)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::msm_skips_point_at_infinity<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let inf = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let one = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((1: Field), (0: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<2: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>)(inf, g), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>)(one, one)), g)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::msm_skips_zero_scalar<>() -> Unit := { + let g = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(); + let one = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((1: Field), (0: Field)); + let zero = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<2: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 2: u32>)(g, g), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 2: u32>)(zero, one)), g)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::fixed_base_scalar_mul_with_one_returns_generator<>() -> Unit := { + let one = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((1: Field), (0: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::fixed_base_scalar_mul<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(one), («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::fixed_base_scalar_mul_with_zero_returns_infinity<>() -> Unit := { + let zero = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)); + (#_assert returning Unit)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::is_infinite<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::fixed_base_scalar_mul<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(zero))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::embedded_curve_ops::tests::fixed_base_scalar_mul_matches_msm_on_generator<>() -> Unit := { + let s = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::new<> as λ(Field, Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((2: Field), (0: Field)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::embedded_curve_ops::fixed_base_scalar_mul<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(s), («std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul<1: u32> as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::generator<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)()), (#_mkArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, 1: u32>)(s)))); + #_skip +} + +def «std-1.0.0-beta.25».EmbeddedCurveOps.env : Env := Env.mk + [«std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::new», «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::double», «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity», «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::generator», «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint::is_infinite», «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::new», «std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::from_field», «std-1.0.0-beta.25::embedded_curve_ops::multi_scalar_mul», «std-1.0.0-beta.25::embedded_curve_ops::fixed_base_scalar_mul», «std-1.0.0-beta.25::embedded_curve_ops::embedded_curve_add», «std-1.0.0-beta.25::embedded_curve_ops::tests::hash_point», «std-1.0.0-beta.25::embedded_curve_ops::tests::hash_scalar», «std-1.0.0-beta.25::embedded_curve_ops::tests::point_new_sets_coordinates», «std-1.0.0-beta.25::embedded_curve_ops::tests::point_at_infinity_is_origin», «std-1.0.0-beta.25::embedded_curve_ops::tests::generator_has_documented_coordinates», «std-1.0.0-beta.25::embedded_curve_ops::tests::is_infinite_only_true_for_origin», «std-1.0.0-beta.25::embedded_curve_ops::tests::points_with_same_coords_are_equal», «std-1.0.0-beta.25::embedded_curve_ops::tests::points_with_different_coords_are_unequal», «std-1.0.0-beta.25::embedded_curve_ops::tests::neg_negates_y_coordinate», «std-1.0.0-beta.25::embedded_curve_ops::tests::neg_is_involution», «std-1.0.0-beta.25::embedded_curve_ops::tests::add_with_point_at_infinity_is_identity», «std-1.0.0-beta.25::embedded_curve_ops::tests::add_of_two_infinities_is_infinity», «std-1.0.0-beta.25::embedded_curve_ops::tests::add_with_negation_is_point_at_infinity», «std-1.0.0-beta.25::embedded_curve_ops::tests::add_is_commutative», «std-1.0.0-beta.25::embedded_curve_ops::tests::add_is_associative», «std-1.0.0-beta.25::embedded_curve_ops::tests::sub_of_a_point_with_itself_is_infinity», «std-1.0.0-beta.25::embedded_curve_ops::tests::sub_with_point_at_infinity_is_identity», «std-1.0.0-beta.25::embedded_curve_ops::tests::sub_inverts_add», «std-1.0.0-beta.25::embedded_curve_ops::tests::double_equals_self_plus_self», «std-1.0.0-beta.25::embedded_curve_ops::tests::double_of_point_at_infinity_is_infinity», «std-1.0.0-beta.25::embedded_curve_ops::tests::embedded_curve_add_matches_add_operator», «std-1.0.0-beta.25::embedded_curve_ops::tests::point_hash_is_consistent_for_equal_points», «std-1.0.0-beta.25::embedded_curve_ops::tests::point_hash_differs_for_distinct_points», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalar_new_sets_limbs», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalars_with_same_limbs_are_equal», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalars_with_different_limbs_are_unequal», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalar_from_field_decomposes_zero», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalar_from_field_decomposes_small_value», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalar_from_field_decomposes_two_pow_128», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalar_hash_is_consistent_for_equal_scalars», «std-1.0.0-beta.25::embedded_curve_ops::tests::scalar_hash_differs_for_distinct_scalars», «std-1.0.0-beta.25::embedded_curve_ops::tests::msm_with_scalar_one_returns_point», «std-1.0.0-beta.25::embedded_curve_ops::tests::msm_with_scalar_zero_returns_infinity», «std-1.0.0-beta.25::embedded_curve_ops::tests::msm_with_scalar_two_doubles_point», «std-1.0.0-beta.25::embedded_curve_ops::tests::msm_sums_terms», «std-1.0.0-beta.25::embedded_curve_ops::tests::msm_with_opposite_terms_cancels», «std-1.0.0-beta.25::embedded_curve_ops::tests::msm_skips_point_at_infinity», «std-1.0.0-beta.25::embedded_curve_ops::tests::msm_skips_zero_scalar», «std-1.0.0-beta.25::embedded_curve_ops::tests::fixed_base_scalar_mul_with_one_returns_generator», «std-1.0.0-beta.25::embedded_curve_ops::tests::fixed_base_scalar_mul_with_zero_returns_infinity», «std-1.0.0-beta.25::embedded_curve_ops::tests::fixed_base_scalar_mul_matches_msm_on_generator»] + [«std-1.0.0-beta.25».impl_32, «std-1.0.0-beta.25».impl_33, «std-1.0.0-beta.25».impl_34, «std-1.0.0-beta.25».impl_35, «std-1.0.0-beta.25».impl_36, «std-1.0.0-beta.25».impl_37, «std-1.0.0-beta.25».impl_38] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Field/Bn254.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Field/Bn254.lean similarity index 50% rename from stdlib/lampe/std-1.0.0-beta.14/Extracted/Field/Bn254.lean rename to stdlib/lampe/std-1.0.0-beta.25/Extracted/Field/Bn254.lean index 34944a06..6ff1b757 100644 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Field/Bn254.lean +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Field/Bn254.lean @@ -1,122 +1,126 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe set_option linter.unusedVariables false -noir_global_def «std-1.0.0-beta.14»::field::bn254::PLO: Field = (53438638232309528389504892708671455233: Field); +noir_global_def «std-1.0.0-beta.25»::field::bn254::PLO: Field = (53438638232309528389504892708671455233: Field); -noir_global_def «std-1.0.0-beta.14»::field::bn254::PHI: Field = (64323764613183177041862057485226039389: Field); +noir_def «std-1.0.0-beta.25»::field::bn254::tests::unconstrained_check_gt<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_global_def «std-1.0.0-beta.25»::field::bn254::PHI: Field = (64323764613183177041862057485226039389: Field); -noir_global_def «std-1.0.0-beta.14»::field::bn254::TWO_POW_128: Field = (340282366920938463463374607431768211456: Field); +noir_global_def «std-1.0.0-beta.25»::field::bn254::TWO_POW_128: Field = (340282366920938463463374607431768211456: Field); -noir_def «std-1.0.0-beta.14»::field::bn254::compute_decomposition<>(x: Field) -> Tuple := { +noir_def «std-1.0.0-beta.25»::field::bn254::compute_decomposition<>(x: Field) -> Tuple := { let low = (#_cast returning Field)((#_cast returning u128)(x)); - let high = (#_fDiv returning Field)((#_fSub returning Field)(x, low), («std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)()); + let high = (#_fDiv returning Field)((#_fSub returning Field)(x, low), («std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)()); (#_makeData returning Tuple)(low, high) } -noir_def «std-1.0.0-beta.14»::field::bn254::decompose_hint<>(x: Field) -> Tuple := { +noir_def «std-1.0.0-beta.25»::field::bn254::decompose_hint<>(x: Field) -> Tuple := { (#_fresh returning Tuple)() } -noir_def «std-1.0.0-beta.14»::field::bn254::lte_hint<>(x: Field, y: Field) -> bool := { +noir_def «std-1.0.0-beta.25»::field::bn254::lte_hint<>(x: Field, y: Field) -> bool := { (#_fresh returning bool)() } -noir_def «std-1.0.0-beta.14»::field::bn254::assert_gt_limbs<>(a: Tuple, b: Tuple) -> Unit := { +noir_def «std-1.0.0-beta.25»::field::bn254::assert_gt_limbs<>(a: Tuple, b: Tuple) -> Unit := { let (alo, ahi) = a; let (blo, bhi) = b; { - let borrow = («std-1.0.0-beta.14»::field::bn254::lte_hint<> as λ(Field, Field) -> bool)(alo, blo); - let rlo = (#_fAdd returning Field)((#_fSub returning Field)((#_fSub returning Field)(alo, blo), (1: Field)), (#_fMul returning Field)((#_cast returning Field)(borrow), («std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)())); + let borrow = («std-1.0.0-beta.25»::field::bn254::lte_hint<> as λ(Field, Field) -> bool)(alo, blo); + let rlo = (#_fAdd returning Field)((#_fSub returning Field)((#_fSub returning Field)(alo, blo), (1: Field)), (#_fMul returning Field)((#_cast returning Field)(borrow), («std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)())); let rhi = (#_fSub returning Field)((#_fSub returning Field)(ahi, bhi), (#_cast returning Field)(borrow)); - («std-1.0.0-beta.14»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(rlo); - («std-1.0.0-beta.14»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(rhi); + («std-1.0.0-beta.25»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(rlo); + («std-1.0.0-beta.25»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(rhi); #_skip } } -noir_def «std-1.0.0-beta.14»::field::bn254::decompose<>(x: Field) -> Tuple := { +noir_def «std-1.0.0-beta.25»::field::bn254::decompose<>(x: Field) -> Tuple := { if (#_isUnconstrained returning bool)() then { - («std-1.0.0-beta.14»::field::bn254::compute_decomposition<> as λ(Field) -> Tuple)(x) + («std-1.0.0-beta.25»::field::bn254::compute_decomposition<> as λ(Field) -> Tuple)(x) } else { - let (xlo, xhi) = («std-1.0.0-beta.14»::field::bn254::decompose_hint<> as λ(Field) -> Tuple)(x); - («std-1.0.0-beta.14»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(xlo); - («std-1.0.0-beta.14»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(xhi); - (#_assert returning Unit)((#_fEq returning bool)(x, (#_fAdd returning Field)(xlo, (#_fMul returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), xhi)))); - («std-1.0.0-beta.14»::field::bn254::assert_gt_limbs<> as λ(Tuple, Tuple) -> Unit)((#_makeData returning Tuple)((«std-1.0.0-beta.14»::field::bn254::PLO<> as λ() -> Field)(), («std-1.0.0-beta.14»::field::bn254::PHI<> as λ() -> Field)()), (#_makeData returning Tuple)(xlo, xhi)); + let (xlo, xhi) = («std-1.0.0-beta.25»::field::bn254::decompose_hint<> as λ(Field) -> Tuple)(x); + («std-1.0.0-beta.25»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(xlo); + («std-1.0.0-beta.25»::field::assert_max_bit_size<128: u32> as λ(Field) -> Unit)(xhi); + (#_assert returning Unit)((#_fEq returning bool)(x, (#_fAdd returning Field)(xlo, (#_fMul returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), xhi)))); + («std-1.0.0-beta.25»::field::bn254::assert_gt_limbs<> as λ(Tuple, Tuple) -> Unit)((#_makeData returning Tuple)((«std-1.0.0-beta.25»::field::bn254::PLO<> as λ() -> Field)(), («std-1.0.0-beta.25»::field::bn254::PHI<> as λ() -> Field)()), (#_makeData returning Tuple)(xlo, xhi)); (#_makeData returning Tuple)(xlo, xhi) } } -noir_def «std-1.0.0-beta.14»::field::bn254::assert_gt<>(a: Field, b: Field) -> Unit := { +noir_def «std-1.0.0-beta.25»::field::bn254::assert_gt<>(a: Field, b: Field) -> Unit := { if (#_isUnconstrained returning bool)() then { (#_assert returning Unit)({ - («std-1.0.0-beta.14»::field::field_less_than<> as λ(Field, Field) -> bool)(b, a) + («std-1.0.0-beta.25»::field::field_less_than<> as λ(Field, Field) -> bool)(b, a) }); #_skip } else { - let a_limbs = («std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)(a); - let b_limbs = («std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)(b); - («std-1.0.0-beta.14»::field::bn254::assert_gt_limbs<> as λ(Tuple, Tuple) -> Unit)(a_limbs, b_limbs) + let a_limbs = («std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)(a); + let b_limbs = («std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)(b); + («std-1.0.0-beta.25»::field::bn254::assert_gt_limbs<> as λ(Tuple, Tuple) -> Unit)(a_limbs, b_limbs) } } -noir_def «std-1.0.0-beta.14»::field::bn254::assert_lt<>(a: Field, b: Field) -> Unit := { - («std-1.0.0-beta.14»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)(b, a); +noir_def «std-1.0.0-beta.25»::field::bn254::assert_lt<>(a: Field, b: Field) -> Unit := { + («std-1.0.0-beta.25»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)(b, a); #_skip } -noir_def «std-1.0.0-beta.14»::field::bn254::gt<>(a: Field, b: Field) -> bool := { +noir_def «std-1.0.0-beta.25»::field::bn254::gt<>(a: Field, b: Field) -> bool := { if (#_isUnconstrained returning bool)() then { - («std-1.0.0-beta.14»::field::field_less_than<> as λ(Field, Field) -> bool)(b, a) + («std-1.0.0-beta.25»::field::field_less_than<> as λ(Field, Field) -> bool)(b, a) } else if (#_fEq returning bool)(a, b) then { #_false } else { - if («std-1.0.0-beta.14»::field::field_less_than<> as λ(Field, Field) -> bool)(a, b) then { - («std-1.0.0-beta.14»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)(b, a); + if («std-1.0.0-beta.25»::field::field_less_than<> as λ(Field, Field) -> bool)(a, b) then { + («std-1.0.0-beta.25»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)(b, a); #_false } else { - («std-1.0.0-beta.14»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)(a, b); + («std-1.0.0-beta.25»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)(a, b); #_true } } } -noir_def «std-1.0.0-beta.14»::field::bn254::lt<>(a: Field, b: Field) -> bool := { - («std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)(b, a) +noir_def «std-1.0.0-beta.25»::field::bn254::lt<>(a: Field, b: Field) -> bool := { + («std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)(b, a) } -noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_decompose<>() -> Unit := { - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)()), (#_makeData returning Tuple)((0: Field), (1: Field)))); - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fAdd returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (78187493520: Field))), (#_makeData returning Tuple)((78187493520: Field), (1: Field)))); - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((78187493520: Field)), (#_makeData returning Tuple)((78187493520: Field), (0: Field)))); +noir_def «std-1.0.0-beta.25»::field::bn254::tests::check_decompose<>() -> Unit := { + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)()), (#_makeData returning Tuple)((0: Field), (1: Field)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fAdd returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (78187493520: Field))), (#_makeData returning Tuple)((78187493520: Field), (1: Field)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((78187493520: Field)), (#_makeData returning Tuple)((78187493520: Field), (0: Field)))); #_skip } -noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_lte_hint<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::field::bn254::tests::check_lte_hint<>() -> Unit := { (#_fresh returning Unit)() } -noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_gt<>() -> Unit := { - (#_assert returning Unit)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((1: Field), (0: Field))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((256: Field), (0: Field))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((0: Field), (1: Field)), (#_fSub returning Field)((0: Field), (2: Field)))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (0: Field))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((0: Field), (0: Field)))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((0: Field), (256: Field)))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((0: Field), (1: Field)), (#_fSub returning Field)((0: Field), (2: Field)))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::field::bn254::gt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((0: Field), (2: Field)), (#_fSub returning Field)((0: Field), (1: Field))))); - («std-1.0.0-beta.14»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)((#_fSub returning Field)((0: Field), (1: Field)), (0: Field)); +noir_def «std-1.0.0-beta.25»::field::bn254::tests::check_gt<>() -> Unit := { + (#_assert returning Unit)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((1: Field), (0: Field))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((256: Field), (0: Field))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((0: Field), (1: Field)), (#_fSub returning Field)((0: Field), (2: Field)))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (0: Field))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((0: Field), (0: Field)))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((0: Field), (256: Field)))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((0: Field), (1: Field)), (#_fSub returning Field)((0: Field), (2: Field)))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::field::bn254::gt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((0: Field), (2: Field)), (#_fSub returning Field)((0: Field), (1: Field))))); + («std-1.0.0-beta.25»::field::bn254::assert_gt<> as λ(Field, Field) -> Unit)((#_fSub returning Field)((0: Field), (1: Field)), (0: Field)); #_skip } -noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_plo_phi<>() -> Unit := { - (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)((«std-1.0.0-beta.14»::field::bn254::PLO<> as λ() -> Field)(), (#_fMul returning Field)((«std-1.0.0-beta.14»::field::bn254::PHI<> as λ() -> Field)(), («std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)())), (0: Field))); +noir_def «std-1.0.0-beta.25»::field::bn254::tests::check_plo_phi<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)((«std-1.0.0-beta.25»::field::bn254::PLO<> as λ() -> Field)(), (#_fMul returning Field)((«std-1.0.0-beta.25»::field::bn254::PHI<> as λ() -> Field)(), («std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)())), (0: Field))); let p_bytes = (#_modulusLeBytes returning Vector)(); let p_low = (#_ref returning & Field)((0: Field)); let p_high = (#_ref returning & Field)((0: Field)); @@ -127,40 +131,41 @@ noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_plo_phi<>() -> Unit : offset = (#_fMul returning Field)((#_readRef returning Field)(offset), (256: Field)); #_skip }; - (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(p_low), («std-1.0.0-beta.14»::field::bn254::PLO<> as λ() -> Field)())); - (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(p_high), («std-1.0.0-beta.14»::field::bn254::PHI<> as λ() -> Field)())); + (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(p_low), («std-1.0.0-beta.25»::field::bn254::PLO<> as λ() -> Field)())); + (#_assert returning Unit)((#_fEq returning bool)((#_readRef returning Field)(p_high), («std-1.0.0-beta.25»::field::bn254::PHI<> as λ() -> Field)())); #_skip } -noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_decompose_edge_cases<>() -> Unit := { - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((0: Field)), (#_makeData returning Tuple)((0: Field), (0: Field)))); - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fSub returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field))), (#_makeData returning Tuple)((#_fSub returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field)), (0: Field)))); - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fAdd returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field))), (#_makeData returning Tuple)((1: Field), (1: Field)))); - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fMul returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (2: Field))), (#_makeData returning Tuple)((0: Field), (2: Field)))); - (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fAdd returning Field)((#_fMul returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (2: Field)), (78187493520: Field))), (#_makeData returning Tuple)((78187493520: Field), (2: Field)))); +noir_def «std-1.0.0-beta.25»::field::bn254::tests::check_decompose_edge_cases<>() -> Unit := { + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((0: Field)), (#_makeData returning Tuple)((0: Field), (0: Field)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fSub returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field))), (#_makeData returning Tuple)((#_fSub returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field)), (0: Field)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fAdd returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field))), (#_makeData returning Tuple)((1: Field), (1: Field)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fMul returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (2: Field))), (#_makeData returning Tuple)((0: Field), (2: Field)))); + (#_assert returning Unit)(((Tuple as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Tuple, Tuple) -> bool)((«std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)((#_fAdd returning Field)((#_fMul returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (2: Field)), (78187493520: Field))), (#_makeData returning Tuple)((78187493520: Field), (2: Field)))); #_skip } -noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_decompose_large_values<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::field::bn254::tests::check_decompose_large_values<>() -> Unit := { let large_field = (18446744073709551615: Field); - let (lo, hi) = («std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)(large_field); - (#_assert returning Unit)((#_fEq returning bool)(large_field, (#_fAdd returning Field)(lo, (#_fMul returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), hi)))); - let large_value = (#_fSub returning Field)(large_field, («std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)()); - let (lo2, hi2) = («std-1.0.0-beta.14»::field::bn254::decompose<> as λ(Field) -> Tuple)(large_value); - (#_assert returning Unit)((#_fEq returning bool)(large_value, (#_fAdd returning Field)(lo2, (#_fMul returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), hi2)))); + let (lo, hi) = («std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)(large_field); + (#_assert returning Unit)((#_fEq returning bool)(large_field, (#_fAdd returning Field)(lo, (#_fMul returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), hi)))); + let large_value = (#_fSub returning Field)(large_field, («std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)()); + let (lo2, hi2) = («std-1.0.0-beta.25»::field::bn254::decompose<> as λ(Field) -> Tuple)(large_value); + (#_assert returning Unit)((#_fEq returning bool)(large_value, (#_fAdd returning Field)(lo2, (#_fMul returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), hi2)))); #_skip } -noir_def «std-1.0.0-beta.14»::field::bn254::tests::check_lt_comprehensive<>() -> Unit := { - (#_assert returning Unit)((«std-1.0.0-beta.14»::field::bn254::lt<> as λ(Field, Field) -> bool)((0: Field), (1: Field))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::field::bn254::lt<> as λ(Field, Field) -> bool)((1: Field), (0: Field)))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::field::bn254::lt<> as λ(Field, Field) -> bool)((0: Field), (0: Field)))); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::field::bn254::lt<> as λ(Field, Field) -> bool)((42: Field), (42: Field)))); - (#_assert returning Unit)((«std-1.0.0-beta.14»::field::bn254::lt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field)), («std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)())); - (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.14»::field::bn254::lt<> as λ(Field, Field) -> bool)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (#_fSub returning Field)((«std-1.0.0-beta.14»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field))))); +noir_def «std-1.0.0-beta.25»::field::bn254::tests::check_lt_comprehensive<>() -> Unit := { + (#_assert returning Unit)((«std-1.0.0-beta.25»::field::bn254::lt<> as λ(Field, Field) -> bool)((0: Field), (1: Field))); + («std-1.0.0-beta.25»::field::bn254::assert_lt<> as λ(Field, Field) -> Unit)((0: Field), (1: Field)); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::field::bn254::lt<> as λ(Field, Field) -> bool)((1: Field), (0: Field)))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::field::bn254::lt<> as λ(Field, Field) -> bool)((0: Field), (0: Field)))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::field::bn254::lt<> as λ(Field, Field) -> bool)((42: Field), (42: Field)))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::field::bn254::lt<> as λ(Field, Field) -> bool)((#_fSub returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field)), («std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)())); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::field::bn254::lt<> as λ(Field, Field) -> bool)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (#_fSub returning Field)((«std-1.0.0-beta.25»::field::bn254::TWO_POW_128<> as λ() -> Field)(), (1: Field))))); #_skip } -def «std-1.0.0-beta.14».Field.Bn254.env : Env := Env.mk - [«std-1.0.0-beta.14::field::bn254::PLO», «std-1.0.0-beta.14::field::bn254::PHI», «std-1.0.0-beta.14::field::bn254::TWO_POW_128», «std-1.0.0-beta.14::field::bn254::compute_decomposition», «std-1.0.0-beta.14::field::bn254::decompose_hint», «std-1.0.0-beta.14::field::bn254::lte_hint», «std-1.0.0-beta.14::field::bn254::assert_gt_limbs», «std-1.0.0-beta.14::field::bn254::decompose», «std-1.0.0-beta.14::field::bn254::assert_gt», «std-1.0.0-beta.14::field::bn254::assert_lt», «std-1.0.0-beta.14::field::bn254::gt», «std-1.0.0-beta.14::field::bn254::lt», «std-1.0.0-beta.14::field::bn254::tests::check_decompose», «std-1.0.0-beta.14::field::bn254::tests::check_lte_hint», «std-1.0.0-beta.14::field::bn254::tests::check_gt», «std-1.0.0-beta.14::field::bn254::tests::check_plo_phi», «std-1.0.0-beta.14::field::bn254::tests::check_decompose_edge_cases», «std-1.0.0-beta.14::field::bn254::tests::check_decompose_large_values», «std-1.0.0-beta.14::field::bn254::tests::check_lt_comprehensive»] +def «std-1.0.0-beta.25».Field.Bn254.env : Env := Env.mk + [«std-1.0.0-beta.25::field::bn254::PLO», «std-1.0.0-beta.25::field::bn254::tests::unconstrained_check_gt», «std-1.0.0-beta.25::field::bn254::PHI», «std-1.0.0-beta.25::field::bn254::TWO_POW_128», «std-1.0.0-beta.25::field::bn254::compute_decomposition», «std-1.0.0-beta.25::field::bn254::decompose_hint», «std-1.0.0-beta.25::field::bn254::lte_hint», «std-1.0.0-beta.25::field::bn254::assert_gt_limbs», «std-1.0.0-beta.25::field::bn254::decompose», «std-1.0.0-beta.25::field::bn254::assert_gt», «std-1.0.0-beta.25::field::bn254::assert_lt», «std-1.0.0-beta.25::field::bn254::gt», «std-1.0.0-beta.25::field::bn254::lt», «std-1.0.0-beta.25::field::bn254::tests::check_decompose», «std-1.0.0-beta.25::field::bn254::tests::check_lte_hint», «std-1.0.0-beta.25::field::bn254::tests::check_gt», «std-1.0.0-beta.25::field::bn254::tests::check_plo_phi», «std-1.0.0-beta.25::field::bn254::tests::check_decompose_edge_cases», «std-1.0.0-beta.25::field::bn254::tests::check_decompose_large_values», «std-1.0.0-beta.25::field::bn254::tests::check_lt_comprehensive»] [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Field/Mod.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Field/Mod.lean new file mode 100644 index 00000000..c30ea6ef --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Field/Mod.lean @@ -0,0 +1,654 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::field::assert_max_bit_size(self: Field) -> Unit := { + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(BIT_SIZE: u32), (#_cast returning u32)((#_modulusNumBits returning u64)())), "BIT_SIZE must be less than modulus_num_bits"); + (#_applyRangeConstraint returning Unit)(self, uConst!(BIT_SIZE: u32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::to_le_bits(self: Field) -> Array := { + let bits = (#_toLeBits returning Array)(self); + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let p = (#_modulusLeBits returning Vector)(); + (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); + let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); + for i in (0: u32) .. uConst!(N: u32) do { + if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { + if (#_bNeq returning bool)((#_arrayIndex returning bool)(bits, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning bool)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))) then { + (#_assert returning Unit)((#_vectorIndex returning bool)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))); + ok = #_true; + #_skip + } + } + }; + (#_assert returning Unit)((#_readRef returning bool)(ok)); + #_skip + }; + bits +} + +noir_def «std-1.0.0-beta.25»::field::to_be_bits(self: Field) -> Array := { + let bits = (#_toBeBits returning Array)(self); + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let p = (#_modulusBeBits returning Vector)(); + (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); + let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bits), (#_arrayLen returning u32)(p))); + for i in (0: u32) .. uConst!(N: u32) do { + if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { + if (#_bNeq returning bool)((#_arrayIndex returning bool)(bits, (#_cast returning u32)(i)), (#_vectorIndex returning bool)(p, (#_cast returning u32)(i))) then { + (#_assert returning Unit)((#_vectorIndex returning bool)(p, (#_cast returning u32)(i))); + ok = #_true; + #_skip + } + } + }; + (#_assert returning Unit)((#_readRef returning bool)(ok)); + #_skip + }; + bits +} + +noir_def «std-1.0.0-beta.25»::field::to_le_bytes(self: Field) -> Array := { + (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBytes returning Vector)())), "N must be less than or equal to modulus_le_bytes().len()"); + let bytes = («std-1.0.0-beta.25»::field::to_le_radix as λ(Field, u32) -> Array)(self, (256: u32)); + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let p = (#_modulusLeBytes returning Vector)(); + (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); + let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); + for i in (0: u32) .. uConst!(N: u32) do { + if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { + if (#_uNeq returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning u8)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))) then { + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning u8)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))))); + ok = #_true; + #_skip + } + } + }; + (#_assert returning Unit)((#_readRef returning bool)(ok)); + #_skip + }; + bytes +} + +noir_def «std-1.0.0-beta.25»::field::to_be_bytes(self: Field) -> Array := { + (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBytes returning Vector)())), "N must be less than or equal to modulus_le_bytes().len()"); + let bytes = («std-1.0.0-beta.25»::field::to_be_radix as λ(Field, u32) -> Array)(self, (256: u32)); + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let p = (#_modulusBeBytes returning Vector)(); + (#_assert returning Unit)((#_uLeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); + let ok = (#_ref returning & bool)((#_uNeq returning bool)((#_arrayLen returning u32)(bytes), (#_arrayLen returning u32)(p))); + for i in (0: u32) .. uConst!(N: u32) do { + if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { + if (#_uNeq returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i)), (#_vectorIndex returning u8)(p, (#_cast returning u32)(i))) then { + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i)), (#_vectorIndex returning u8)(p, (#_cast returning u32)(i)))); + ok = #_true; + #_skip + } + } + }; + (#_assert returning Unit)((#_readRef returning bool)(ok)); + #_skip + }; + bytes +} + +noir_def «std-1.0.0-beta.25»::field::to_le_radix(self: Field, radix: u32) -> Array := { + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + (#_staticAssert returning Unit)((#_uLt returning bool)((1: u32), radix), "radix must be greater than 1"); + (#_staticAssert returning Unit)((#_uLeq returning bool)(radix, (256: u32)), "radix must be less than or equal to 256"); + (#_staticAssert returning Unit)((#_uEq returning bool)((#_uAnd returning u32)(radix, (#_uSub returning u32)(radix, (1: u32))), (0: u32)), "radix must be a power of 2"); + #_skip + }; + (#_toLeRadix returning Array)(self, radix) +} + +noir_def «std-1.0.0-beta.25»::field::to_be_radix(self: Field, radix: u32) -> Array := { + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + (#_staticAssert returning Unit)((#_uLt returning bool)((1: u32), radix), "radix must be greater than 1"); + (#_staticAssert returning Unit)((#_uLeq returning bool)(radix, (256: u32)), "radix must be less than or equal to 256"); + (#_staticAssert returning Unit)((#_uEq returning bool)((#_uAnd returning u32)(radix, (#_uSub returning u32)(radix, (1: u32))), (0: u32)), "radix must be a power of 2"); + #_skip + }; + (#_toBeRadix returning Array)(self, radix) +} + +noir_def «std-1.0.0-beta.25»::field::pow_32<>(self: Field, exponent: Field) -> Field := { + let r = (#_ref returning & Field)((1: Field)); + let b = («std-1.0.0-beta.25»::field::to_le_bits<32: u32> as λ(Field) -> Array)(exponent); + for i in (1: u32) .. (33: u32) do { + r = (#_fMul returning Field)((#_readRef returning Field)(r), (#_readRef returning Field)(r)); + r = (#_fAdd returning Field)((#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning bool)(b, (#_cast returning u32)((#_uSub returning u32)((32: u32), i)))), (#_fMul returning Field)((#_readRef returning Field)(r), self)), (#_fMul returning Field)((#_fSub returning Field)((1: Field), (#_cast returning Field)((#_arrayIndex returning bool)(b, (#_cast returning u32)((#_uSub returning u32)((32: u32), i))))), (#_readRef returning Field)(r))); + #_skip + }; + (#_readRef returning Field)(r) +} + +noir_def «std-1.0.0-beta.25»::field::sgn0<>(self: Field) -> bool := { + (#_uEq returning bool)((#_uRem returning u8)((#_cast returning u8)(self), (2: u8)), (1: u8)) +} + +noir_def «std-1.0.0-beta.25»::field::lt<>(self: Field, another: Field) -> bool := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + («std-1.0.0-beta.25»::field::bn254::lt<> as λ(Field, Field) -> bool)(self, another) + } else { + («std-1.0.0-beta.25»::field::lt_fallback<> as λ(Field, Field) -> bool)(self, another) + } +} + +noir_def «std-1.0.0-beta.25»::field::from_le_bytes(bytes: Array) -> Field := { + (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBytes returning Vector)())), "N must be less than or equal to modulus_le_bytes().len()"); + let v = (#_ref returning & Field)((1: Field)); + let result = (#_ref returning & Field)((0: Field)); + for i in (0: u32) .. uConst!(N: u32) do { + result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i))), (#_readRef returning Field)(v))); + v = (#_fMul returning Field)((#_readRef returning Field)(v), (256: Field)); + #_skip + }; + (#_readRef returning Field)(result) +} + +noir_def «std-1.0.0-beta.25»::field::from_be_bytes(bytes: Array) -> Field := { + (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusBeBytes returning Vector)())), "N must be less than or equal to modulus_be_bytes().len()"); + let v = (#_ref returning & Field)((1: Field)); + let result = (#_ref returning & Field)((0: Field)); + for i in (0: u32) .. uConst!(N: u32) do { + result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))), (#_readRef returning Field)(v))); + v = (#_fMul returning Field)((#_readRef returning Field)(v), (256: Field)); + #_skip + }; + (#_readRef returning Field)(result) +} + +noir_def «std-1.0.0-beta.25»::field::from_le_bytes_checked(bytes: Array) -> Field := { + let p = (#_modulusLeBytes returning Vector)(); + let ok = (#_ref returning & bool)((#_uNeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)(p))); + for i in (0: u32) .. uConst!(N: u32) do { + if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { + if (#_uNeq returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning u8)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))) then { + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))), (#_vectorIndex returning u8)(p, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i))))); + ok = #_true; + #_skip + } + } + }; + (#_assert returning Unit)((#_readRef returning bool)(ok)); + («std-1.0.0-beta.25»::field::from_le_bytes as λ(Array) -> Field)(bytes) +} + +noir_def «std-1.0.0-beta.25»::field::from_be_bytes_checked(bytes: Array) -> Field := { + let p = (#_modulusBeBytes returning Vector)(); + let ok = (#_ref returning & bool)((#_uNeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)(p))); + for i in (0: u32) .. uConst!(N: u32) do { + if (#_bNot returning bool)((#_readRef returning bool)(ok)) then { + if (#_uNeq returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i)), (#_vectorIndex returning u8)(p, (#_cast returning u32)(i))) then { + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)(bytes, (#_cast returning u32)(i)), (#_vectorIndex returning u8)(p, (#_cast returning u32)(i)))); + ok = #_true; + #_skip + } + } + }; + (#_assert returning Unit)((#_readRef returning bool)(ok)); + («std-1.0.0-beta.25»::field::from_be_bytes as λ(Array) -> Field)(bytes) +} + +noir_def «std-1.0.0-beta.25»::field::__field_less_than<>(x: Field, y: Field) -> bool := { + (#_fresh returning bool)() +} + +noir_def «std-1.0.0-beta.25»::field::field_less_than<>(x: Field, y: Field) -> bool := { + (#_fresh returning bool)() +} + +noir_def «std-1.0.0-beta.25»::field::lt_fallback<>(x: Field, y: Field) -> bool := { + if (#_isUnconstrained returning bool)() then { + («std-1.0.0-beta.25»::field::field_less_than<> as λ(Field, Field) -> bool)(x, y) + } else { + let x_bytes = («std-1.0.0-beta.25»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(x); + let y_bytes = («std-1.0.0-beta.25»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(y); + let x_is_lt = (#_ref returning & bool)(#_false); + let done = (#_ref returning & bool)(#_false); + for i in (0: u32) .. (32: u32) do { + if (#_bNot returning bool)((#_readRef returning bool)(done)) then { + let x_byte = (#_cast returning u8)((#_arrayIndex returning u8)(x_bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)((32: u32), (1: u32)), i)))); + let y_byte = (#_cast returning u8)((#_arrayIndex returning u8)(y_bytes, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)((32: u32), (1: u32)), i)))); + let bytes_match = (#_uEq returning bool)(x_byte, y_byte); + if (#_bNot returning bool)(bytes_match) then { + x_is_lt = (#_uLt returning bool)(x_byte, y_byte); + done = #_true; + #_skip + } + } + }; + (#_readRef returning bool)(x_is_lt) + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_be_bits<>() -> Unit := { + let field = (2: Field); + let bits = («std-1.0.0-beta.25»::field::to_be_bits<8: u32> as λ(Field) -> Array)(field); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bits, (#_mkArray returning Array)(#_false, #_false, #_false, #_false, #_false, #_false, #_true, #_false))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_bits<>() -> Unit := { + let field = (2: Field); + let bits = («std-1.0.0-beta.25»::field::to_le_bits<8: u32> as λ(Field) -> Array)(field); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bits, (#_mkArray returning Array)(#_false, #_true, #_false, #_false, #_false, #_false, #_false, #_false))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_be_bytes<>() -> Unit := { + let field = (2: Field); + let bytes = («std-1.0.0-beta.25»::field::to_be_bytes<8: u32> as λ(Field) -> Array)(field); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (2: u8)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_be_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_bytes<>() -> Unit := { + let field = (2: Field); + let bytes = («std-1.0.0-beta.25»::field::to_le_bytes<8: u32> as λ(Field) -> Array)(field); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((2: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_be_radix<>() -> Unit := { + let field = (259: Field); + let bytes = («std-1.0.0-beta.25»::field::to_be_radix<8: u32> as λ(Field, u32) -> Array)(field, (256: u32)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (1: u8), (3: u8)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_be_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_radix<>() -> Unit := { + let field = (259: Field); + let bytes = («std-1.0.0-beta.25»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (256: u32)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(bytes, (#_mkArray returning Array)((3: u8), (1: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(bytes), field)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_radix_1<>() -> Unit := { + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let field = (2: Field); + let __0 = («std-1.0.0-beta.25»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (1: u32)); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<28: u32>) -> Unit)("radix must be greater than 1"); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_radix_brillig_1<>() -> Unit := { + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let field = (1: Field); + let __0 = («std-1.0.0-beta.25»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (1: u32)); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<28: u32>) -> Unit)("radix must be greater than 1"); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_radix_3<>() -> Unit := { + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let field = (2: Field); + let __0 = («std-1.0.0-beta.25»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (3: u32)); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<26: u32>) -> Unit)("radix must be a power of 2"); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_radix_brillig_3<>() -> Unit := { + if (#_isUnconstrained returning bool)() then { + let field = (1: Field); + let out = («std-1.0.0-beta.25»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (3: u32)); + let expected = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); + (expected[(0: u32)]: u8) = (1: u8); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(out, (#_readRef returning Array)(expected))); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_le_radix_512<>() -> Unit := { + if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { + let field = (2: Field); + let __0 = («std-1.0.0-beta.25»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(field, (512: u32)); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<39: u32>) -> Unit)("radix must be less than or equal to 256") + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::not_enough_limbs_brillig<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::field::tests::not_enough_limbs<>() -> Unit := { + let __0 = («std-1.0.0-beta.25»::field::to_le_bytes<16: u32> as λ(Field) -> Array)((340282366920938463463374607431768211456: Field)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::non_zero_field_to_le_bytes_zero_limbs<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::field::tests::non_zero_field_to_be_bytes_zero_limbs<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::field::tests::zero_field_to_bytes_zero_limbs_unconstrained<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::field::tests::zero_field_to_bytes_zero_limbs_constrained<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((«std-1.0.0-beta.25»::field::to_le_bytes<0: u32> as λ(Field) -> Array)((#_cast returning Field)((0: Field)))), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((«std-1.0.0-beta.25»::field::to_be_bytes<0: u32> as λ(Field) -> Array)((#_cast returning Field)((0: Field)))), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((«std-1.0.0-beta.25»::field::to_le_bits<0: u32> as λ(Field) -> Array)((#_cast returning Field)((0: Field)))), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((«std-1.0.0-beta.25»::field::to_be_bits<0: u32> as λ(Field) -> Array)((#_cast returning Field)((0: Field)))), (0: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::zero_field_to_bytes_zero_limbs_comptime<>() -> Unit := { + let __0 = (#_mkArray returning Array)(); + let __1 = (#_mkArray returning Array)(); + let __3 = (#_mkArray returning Array)(); + let __7 = (#_mkArray returning Array)(); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_field_less_than<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_large_field_values_unconstrained<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_large_field_values<>() -> Unit := { + let large_val = (18446744073709551615: Field); + let bits = («std-1.0.0-beta.25»::field::to_le_bits<64: u32> as λ(Field) -> Array)(large_val); + (#_assert returning Unit)((#_bEq returning bool)((#_arrayIndex returning bool)(bits, (0: u32)), #_true)); + let bytes = («std-1.0.0-beta.25»::field::to_le_bytes<8: u32> as λ(Field) -> Array)(large_val); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(bytes), large_val)); + let radix_bytes = («std-1.0.0-beta.25»::field::to_le_radix<8: u32> as λ(Field, u32) -> Array)(large_val, (256: u32)); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_le_bytes<8: u32> as λ(Array) -> Field)(radix_bytes), large_val)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_decomposition_edge_cases<>() -> Unit := { + let zero_bits = («std-1.0.0-beta.25»::field::to_le_bits<8: u32> as λ(Field) -> Array)((0: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(zero_bits, (#_mkRepeatedArray returning Array)(#_false))); + let zero_bytes = («std-1.0.0-beta.25»::field::to_le_bytes<8: u32> as λ(Field) -> Array)((0: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(zero_bytes, (#_mkRepeatedArray returning Array)((0: u8)))); + let one_bits = («std-1.0.0-beta.25»::field::to_le_bits<8: u32> as λ(Field) -> Array)((1: Field)); + let expected = (#_mkArray returning Array)(#_true, #_false, #_false, #_false, #_false, #_false, #_false, #_false); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(one_bits, expected)); + let pow2_bits = («std-1.0.0-beta.25»::field::to_le_bits<8: u32> as λ(Field) -> Array)((4: Field)); + let expected = (#_mkArray returning Array)(#_false, #_false, #_true, #_false, #_false, #_false, #_false, #_false); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(pow2_bits, expected)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_pow_32<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((2: Field), (3: Field)), (8: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((3: Field), (2: Field)), (9: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((5: Field), (0: Field)), (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((7: Field), (1: Field)), (7: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((2: Field), (10: Field)), (1024: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((0: Field), (5: Field)), (0: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((0: Field), (0: Field)), (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::pow_32<> as λ(Field, Field) -> Field)((1: Field), (100: Field)), (1: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_sgn0<>() -> Unit := { + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((0: Field)), #_false)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((2: Field)), #_false)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((4: Field)), #_false)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((100: Field)), #_false)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((1: Field)), #_true)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((3: Field)), #_true)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((5: Field)), #_true)); + (#_assert returning Unit)((#_bEq returning bool)((«std-1.0.0-beta.25»::field::sgn0<> as λ(Field) -> bool)((101: Field)), #_true)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_bit_decomposition_overflow<>() -> Unit := { + let large_val = (1152921504606846976: Field); + let __0 = («std-1.0.0-beta.25»::field::to_le_bits<8: u32> as λ(Field) -> Array)(large_val); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_byte_decomposition_overflow<>() -> Unit := { + let large_val = (1152921504606846976: Field); + let __0 = («std-1.0.0-beta.25»::field::to_le_bytes<4: u32> as λ(Field) -> Array)(large_val); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_from_be_bytes_bn254_edge_cases<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_minus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); + (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (0: u8))); + (p_minus_1_bytes[(#_uSub returning u32)((32: u32), (1: u32))]: u8) = (#_uSub returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8)); + let p_minus_1 = («std-1.0.0-beta.25»::field::from_be_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bytes)); + (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); + let p_minus_1_converted_bytes = («std-1.0.0-beta.25»::field::to_be_bytes<32: u32> as λ(Field) -> Array)(p_minus_1); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bytes, (#_readRef returning Array)(p_minus_1_bytes))); + let p_plus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (255: u8))); + (p_plus_1_bytes[(#_uSub returning u32)((32: u32), (1: u32))]: u8) = (#_uAdd returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8)); + let p_plus_1 = («std-1.0.0-beta.25»::field::from_be_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_1_bytes)); + (#_assert returning Unit)((#_fEq returning bool)(p_plus_1, (1: Field))); + let p_plus_1_converted_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::field::to_be_bytes<32: u32> as λ(Field) -> Array)(p_plus_1)); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_converted_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8))); + (p_plus_1_converted_bytes[(#_uSub returning u32)((32: u32), (1: u32))]: u8) = (0: u8); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_1_converted_bytes), (#_mkRepeatedArray returning Array)((0: u8)))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusBeBytes returning Vector)()), (32: u32))); + let p = («std-1.0.0-beta.25»::field::from_be_bytes<32: u32> as λ(Array) -> Field)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); + (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); + let p_bytes = («std-1.0.0-beta.25»::field::to_be_bytes<32: u32> as λ(Field) -> Array)((0: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bytes, (#_mkRepeatedArray returning Array)((0: u8)))); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_from_le_bytes_bn254_edge_cases<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_minus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); + (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (0: u32)), (0: u8))); + (p_minus_1_bytes[(0: u32)]: u8) = (#_uSub returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (0: u32)), (1: u8)); + let p_minus_1 = («std-1.0.0-beta.25»::field::from_le_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bytes)); + (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); + let p_minus_1_converted_bytes = («std-1.0.0-beta.25»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(p_minus_1); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bytes, (#_readRef returning Array)(p_minus_1_bytes))); + let p_plus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (0: u32)), (255: u8))); + (p_plus_1_bytes[(0: u32)]: u8) = (#_uAdd returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (0: u32)), (1: u8)); + let p_plus_1 = («std-1.0.0-beta.25»::field::from_le_bytes<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_1_bytes)); + (#_assert returning Unit)((#_fEq returning bool)(p_plus_1, (1: Field))); + let p_plus_1_converted_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(p_plus_1)); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_converted_bytes), (0: u32)), (1: u8))); + (p_plus_1_converted_bytes[(0: u32)]: u8) = (0: u8); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_1_converted_bytes), (#_mkRepeatedArray returning Array)((0: u8)))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusLeBytes returning Vector)()), (32: u32))); + let p = («std-1.0.0-beta.25»::field::from_le_bytes<32: u32> as λ(Array) -> Field)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); + (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); + let p_bytes = («std-1.0.0-beta.25»::field::to_le_bytes<32: u32> as λ(Field) -> Array)((0: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bytes, (#_mkRepeatedArray returning Array)((0: u8)))); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_from_le_bytes_checked_accepts_modulus_minus_one<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_minus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); + (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (0: u32)), (0: u8))); + (p_minus_1_bytes[(0: u32)]: u8) = (#_uSub returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (0: u32)), (1: u8)); + let p_minus_1 = («std-1.0.0-beta.25»::field::from_le_bytes_checked<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bytes)); + (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_from_le_bytes_checked_rejects_modulus<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let __0 = («std-1.0.0-beta.25»::field::from_le_bytes_checked<32: u32> as λ(Array) -> Field)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<52: u32>) -> Unit)("input bytes are not a canonical field representation"); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_from_le_bytes_checked_rejects_modulus_plus_one<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_plus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBytes returning Vector)())); + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (0: u32)), (255: u8))); + (p_plus_1_bytes[(0: u32)]: u8) = (#_uAdd returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (0: u32)), (1: u8)); + let __0 = («std-1.0.0-beta.25»::field::from_le_bytes_checked<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_1_bytes)); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<52: u32>) -> Unit)("input bytes are not a canonical field representation"); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_from_be_bytes_checked_accepts_modulus_minus_one<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_minus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); + (#_assert returning Unit)((#_uGt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (0: u8))); + (p_minus_1_bytes[(#_uSub returning u32)((32: u32), (1: u32))]: u8) = (#_uSub returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_minus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8)); + let p_minus_1 = («std-1.0.0-beta.25»::field::from_be_bytes_checked<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bytes)); + (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_from_be_bytes_checked_rejects_modulus<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let __0 = («std-1.0.0-beta.25»::field::from_be_bytes_checked<32: u32> as λ(Array) -> Field)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<52: u32>) -> Unit)("input bytes are not a canonical field representation"); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_from_be_bytes_checked_rejects_modulus_plus_one<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_plus_1_bytes = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBytes returning Vector)())); + (#_assert returning Unit)((#_uLt returning bool)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (255: u8))); + (p_plus_1_bytes[(#_uSub returning u32)((32: u32), (1: u32))]: u8) = (#_uAdd returning u8)((#_arrayIndex returning u8)((#_readRef returning Array)(p_plus_1_bytes), (#_cast returning u32)((#_uSub returning u32)((32: u32), (1: u32)))), (1: u8)); + let __0 = («std-1.0.0-beta.25»::field::from_be_bytes_checked<32: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_1_bytes)); + #_skip + } else { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<52: u32>) -> Unit)("input bytes are not a canonical field representation"); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_from_bytes_checked_small_n<>() -> Unit := { + let le_bytes = (#_mkArray returning Array)((3: u8), (1: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8)); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_le_bytes_checked<8: u32> as λ(Array) -> Field)(le_bytes), (259: Field))); + let be_bytes = (#_mkArray returning Array)((0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (0: u8), (1: u8), (3: u8)); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::field::from_be_bytes_checked<8: u32> as λ(Array) -> Field)(be_bytes), (259: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::field::tests::from_le_bits(bits: Array) -> Field := { + (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (#_arrayLen returning u32)((#_modulusLeBits returning Vector)())), "N must be less than or equal to modulus_le_bits().len()"); + let v = (#_ref returning & Field)((1: Field)); + let result = (#_ref returning & Field)((0: Field)); + for i in (0: u32) .. uConst!(N: u32) do { + result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning bool)(bits, (#_cast returning u32)(i))), (#_readRef returning Field)(v))); + v = (#_fMul returning Field)((#_readRef returning Field)(v), (2: Field)); + #_skip + }; + (#_readRef returning Field)(result) +} + +noir_def «std-1.0.0-beta.25»::field::tests::from_be_bits(bits: Array) -> Field := { + let v = (#_ref returning & Field)((1: Field)); + let result = (#_ref returning & Field)((0: Field)); + for i in (0: u32) .. uConst!(N: u32) do { + result = (#_fAdd returning Field)((#_readRef returning Field)(result), (#_fMul returning Field)((#_cast returning Field)((#_arrayIndex returning bool)(bits, (#_cast returning u32)((#_uSub returning u32)((#_uSub returning u32)(uConst!(N: u32), (1: u32)), i)))), (#_readRef returning Field)(v))); + v = (#_fMul returning Field)((#_readRef returning Field)(v), (2: Field)); + #_skip + }; + (#_readRef returning Field)(result) +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_from_be_bits_bn254_edge_cases<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_minus_1_bits = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBits returning Vector)())); + (#_assert returning Unit)((#_arrayIndex returning bool)((#_readRef returning Array)(p_minus_1_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (1: u32))))); + (p_minus_1_bits[(#_uSub returning u32)((254: u32), (1: u32))]: bool) = #_false; + let p_minus_1 = («std-1.0.0-beta.25»::field::tests::from_be_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bits)); + (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); + let p_minus_1_converted_bits = («std-1.0.0-beta.25»::field::to_be_bits<254: u32> as λ(Field) -> Array)(p_minus_1); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bits, (#_readRef returning Array)(p_minus_1_bits))); + let p_plus_4_bits = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBits returning Vector)())); + (#_assert returning Unit)((#_bNot returning bool)((#_arrayIndex returning bool)((#_readRef returning Array)(p_plus_4_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (3: u32)))))); + (p_plus_4_bits[(#_uSub returning u32)((254: u32), (3: u32))]: bool) = #_true; + let p_plus_4 = («std-1.0.0-beta.25»::field::tests::from_be_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_4_bits)); + (#_assert returning Unit)((#_fEq returning bool)(p_plus_4, (4: Field))); + let p_plus_4_converted_bits = (#_ref returning & Array)((«std-1.0.0-beta.25»::field::to_be_bits<254: u32> as λ(Field) -> Array)(p_plus_4)); + (#_assert returning Unit)((#_arrayIndex returning bool)((#_readRef returning Array)(p_plus_4_converted_bits), (#_cast returning u32)((#_uSub returning u32)((254: u32), (3: u32))))); + (p_plus_4_converted_bits[(#_uSub returning u32)((254: u32), (3: u32))]: bool) = #_false; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_4_converted_bits), (#_mkRepeatedArray returning Array)(#_false))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusBeBits returning Vector)()), (254: u32))); + let p = («std-1.0.0-beta.25»::field::tests::from_be_bits<254: u32> as λ(Array) -> Field)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusBeBits returning Vector)())); + (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); + let p_bits = («std-1.0.0-beta.25»::field::to_be_bits<254: u32> as λ(Field) -> Array)((0: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bits, (#_mkRepeatedArray returning Array)(#_false))); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::test_to_from_le_bits_bn254_edge_cases<>() -> Unit := { + if («std-1.0.0-beta.25»::compat::is_bn254<> as λ() -> bool)() then { + let p_minus_1_bits = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBits returning Vector)())); + (#_assert returning Unit)((#_arrayIndex returning bool)((#_readRef returning Array)(p_minus_1_bits), (0: u32))); + (p_minus_1_bits[(0: u32)]: bool) = #_false; + let p_minus_1 = («std-1.0.0-beta.25»::field::tests::from_le_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_minus_1_bits)); + (#_assert returning Unit)((#_fEq returning bool)((#_fAdd returning Field)(p_minus_1, (1: Field)), (0: Field))); + let p_minus_1_converted_bits = («std-1.0.0-beta.25»::field::to_le_bits<254: u32> as λ(Field) -> Array)(p_minus_1); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_minus_1_converted_bits, (#_readRef returning Array)(p_minus_1_bits))); + let p_plus_4_bits = (#_ref returning & Array)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBits returning Vector)())); + (#_assert returning Unit)((#_bNot returning bool)((#_arrayIndex returning bool)((#_readRef returning Array)(p_plus_4_bits), (2: u32)))); + (p_plus_4_bits[(2: u32)]: bool) = #_true; + let p_plus_4 = («std-1.0.0-beta.25»::field::tests::from_le_bits<254: u32> as λ(Array) -> Field)((#_readRef returning Array)(p_plus_4_bits)); + (#_assert returning Unit)((#_fEq returning bool)(p_plus_4, (4: Field))); + let p_plus_4_converted_bits = (#_ref returning & Array)((«std-1.0.0-beta.25»::field::to_le_bits<254: u32> as λ(Field) -> Array)(p_plus_4)); + (#_assert returning Unit)((#_arrayIndex returning bool)((#_readRef returning Array)(p_plus_4_converted_bits), (2: u32))); + (p_plus_4_converted_bits[(2: u32)]: bool) = #_false; + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_readRef returning Array)(p_plus_4_converted_bits), (#_mkRepeatedArray returning Array)(#_false))); + (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_modulusLeBits returning Vector)()), (254: u32))); + let p = («std-1.0.0-beta.25»::field::tests::from_le_bits<254: u32> as λ(Array) -> Field)((«std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_modulusLeBits returning Vector)())); + (#_assert returning Unit)((#_fEq returning bool)(p, (0: Field))); + let p_bits = («std-1.0.0-beta.25»::field::to_le_bits<254: u32> as λ(Field) -> Array)((0: Field)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(p_bits, (#_mkRepeatedArray returning Array)(#_false))); + #_skip + } +} + +noir_def «std-1.0.0-beta.25»::field::tests::max_bit_size_too_large<>() -> Unit := { + let x = (65536: Field); + («std-1.0.0-beta.25»::field::assert_max_bit_size<16: u32> as λ(Field) -> Unit)(x); + #_skip +} + +def «std-1.0.0-beta.25».Field.Mod.env : Env := Env.mk + [«std-1.0.0-beta.25::field::assert_max_bit_size», «std-1.0.0-beta.25::field::to_le_bits», «std-1.0.0-beta.25::field::to_be_bits», «std-1.0.0-beta.25::field::to_le_bytes», «std-1.0.0-beta.25::field::to_be_bytes», «std-1.0.0-beta.25::field::to_le_radix», «std-1.0.0-beta.25::field::to_be_radix», «std-1.0.0-beta.25::field::pow_32», «std-1.0.0-beta.25::field::sgn0», «std-1.0.0-beta.25::field::lt», «std-1.0.0-beta.25::field::from_le_bytes», «std-1.0.0-beta.25::field::from_be_bytes», «std-1.0.0-beta.25::field::from_le_bytes_checked», «std-1.0.0-beta.25::field::from_be_bytes_checked», «std-1.0.0-beta.25::field::__field_less_than», «std-1.0.0-beta.25::field::field_less_than», «std-1.0.0-beta.25::field::lt_fallback», «std-1.0.0-beta.25::field::tests::test_to_be_bits», «std-1.0.0-beta.25::field::tests::test_to_le_bits», «std-1.0.0-beta.25::field::tests::test_to_be_bytes», «std-1.0.0-beta.25::field::tests::test_to_le_bytes», «std-1.0.0-beta.25::field::tests::test_to_be_radix», «std-1.0.0-beta.25::field::tests::test_to_le_radix», «std-1.0.0-beta.25::field::tests::test_to_le_radix_1», «std-1.0.0-beta.25::field::tests::test_to_le_radix_brillig_1», «std-1.0.0-beta.25::field::tests::test_to_le_radix_3», «std-1.0.0-beta.25::field::tests::test_to_le_radix_brillig_3», «std-1.0.0-beta.25::field::tests::test_to_le_radix_512», «std-1.0.0-beta.25::field::tests::not_enough_limbs_brillig», «std-1.0.0-beta.25::field::tests::not_enough_limbs», «std-1.0.0-beta.25::field::tests::non_zero_field_to_le_bytes_zero_limbs», «std-1.0.0-beta.25::field::tests::non_zero_field_to_be_bytes_zero_limbs», «std-1.0.0-beta.25::field::tests::zero_field_to_bytes_zero_limbs_unconstrained», «std-1.0.0-beta.25::field::tests::zero_field_to_bytes_zero_limbs_constrained», «std-1.0.0-beta.25::field::tests::zero_field_to_bytes_zero_limbs_comptime», «std-1.0.0-beta.25::field::tests::test_field_less_than», «std-1.0.0-beta.25::field::tests::test_large_field_values_unconstrained», «std-1.0.0-beta.25::field::tests::test_large_field_values», «std-1.0.0-beta.25::field::tests::test_decomposition_edge_cases», «std-1.0.0-beta.25::field::tests::test_pow_32», «std-1.0.0-beta.25::field::tests::test_sgn0», «std-1.0.0-beta.25::field::tests::test_bit_decomposition_overflow», «std-1.0.0-beta.25::field::tests::test_byte_decomposition_overflow», «std-1.0.0-beta.25::field::tests::test_to_from_be_bytes_bn254_edge_cases», «std-1.0.0-beta.25::field::tests::test_to_from_le_bytes_bn254_edge_cases», «std-1.0.0-beta.25::field::tests::test_from_le_bytes_checked_accepts_modulus_minus_one», «std-1.0.0-beta.25::field::tests::test_from_le_bytes_checked_rejects_modulus», «std-1.0.0-beta.25::field::tests::test_from_le_bytes_checked_rejects_modulus_plus_one», «std-1.0.0-beta.25::field::tests::test_from_be_bytes_checked_accepts_modulus_minus_one», «std-1.0.0-beta.25::field::tests::test_from_be_bytes_checked_rejects_modulus», «std-1.0.0-beta.25::field::tests::test_from_be_bytes_checked_rejects_modulus_plus_one», «std-1.0.0-beta.25::field::tests::test_from_bytes_checked_small_n», «std-1.0.0-beta.25::field::tests::from_le_bits», «std-1.0.0-beta.25::field::tests::from_be_bits», «std-1.0.0-beta.25::field::tests::test_to_from_be_bits_bn254_edge_cases», «std-1.0.0-beta.25::field::tests::test_to_from_le_bits_bn254_edge_cases», «std-1.0.0-beta.25::field::tests::max_bit_size_too_large»] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/GeneratedTypes.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/GeneratedTypes.lean new file mode 100644 index 00000000..9ea8f004 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/GeneratedTypes.lean @@ -0,0 +1,205 @@ +-- Generated by lampe + +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_struct_def «std-1.0.0-beta.25»::collections::umap::Slot { + K, + V, + bool, + bool, +} + +noir_struct_def «std-1.0.0-beta.25»::collections::umap::UHashMap { + Vector<«std-1.0.0-beta.25»::collections::umap::Slot >, + u32, + B, +} + +noir_struct_def «std-1.0.0-beta.25»::hash::BuildHasherDefault {} + +noir_struct_def «std-1.0.0-beta.25»::cmp::Ordering<> { + Field, +} + +noir_type_alias «std-1.0.0-beta.25»::«meta»::DeriveFunction<> := λ(Unit) -> Unit; + +noir_struct_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> { + Field, + Field, +} + +noir_struct_def «std-1.0.0-beta.25»::«meta»::tests::MyStruct<> { + i32, +} + +noir_struct_def «std-1.0.0-beta.25»::collections::umap::test::MaxHasher<> { + Field, +} + +noir_struct_def «std-1.0.0-beta.25»::array::check_shuffle::test::CompoundStruct<> { + bool, + Field, + u64, +} + +noir_struct_def «std-1.0.0-beta.25»::«meta»::tests::MyOtherStruct<> { + u32, +} + +noir_struct_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp<> { + Field, +} + +noir_struct_def «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<> { + Field, + Field, +} + +noir_struct_def «std-1.0.0-beta.25»::«meta»::tests::Bar<> { + Field, + Array, +} + +noir_struct_def «std-1.0.0-beta.25»::option::Option { + bool, + T, +} + +noir_struct_def «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec { + Array, + u32, +} + +noir_struct_def «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> { + Vector, +} + +noir_struct_def «std-1.0.0-beta.25»::«meta»::op::UnaryOp<> { + Field, +} + +noir_struct_def «std-1.0.0-beta.25»::test::OracleMock<> { + Field, +} + +noir_trait_def «std-1.0.0-beta.25»::append::Append<> [] := { + method empty<>() -> Self; + method append<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::cmp::Eq<> [] := { + method eq<>(Self, Self) -> bool; +} + +noir_trait_def «std-1.0.0-beta.25»::cmp::Ord<> [] := { + method cmp<>(Self, Self) -> «std-1.0.0-beta.25»::cmp::Ordering<>; +} + +noir_trait_def «std-1.0.0-beta.25»::convert::AsPrimitive [] := { + method as_<>(Self) -> T; +} + +noir_trait_def «std-1.0.0-beta.25»::convert::From [] := { + method «from»<>(T) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::convert::Into [] := { + method into<>(Self) -> T; +} + +noir_trait_def «std-1.0.0-beta.25»::default::Default<> [] := { + method default<>() -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::hash::BuildHasher<> [H: Type] := { + method build_hasher<>(Self) -> H; +} + +noir_trait_def «std-1.0.0-beta.25»::hash::Hash<> [] := { + method hash(Self, & H) -> Unit; +} + +noir_trait_def «std-1.0.0-beta.25»::hash::Hasher<> [] := { + method finish<>(Self) -> Field; + method finish_ref<>(& Self) -> Field; + method write<>(& Self, Field) -> Unit; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::Add<> [] := { + method add<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::Div<> [] := { + method div<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::Mul<> [] := { + method mul<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::Neg<> [] := { + method neg<>(Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::Rem<> [] := { + method rem<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::Sub<> [] := { + method sub<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> [] := { + method wrapping_add<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::WrappingMul<> [] := { + method wrapping_mul<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::arith::WrappingSub<> [] := { + method wrapping_sub<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::bit::BitAnd<> [] := { + method bitand<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::bit::BitOr<> [] := { + method bitor<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::bit::BitXor<> [] := { + method bitxor<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::bit::Not<> [] := { + method not<>(Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::bit::Shl<> [] := { + method shl<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::ops::bit::Shr<> [] := { + method shr<>(Self, Self) -> Self; +} + +noir_trait_def «std-1.0.0-beta.25»::panic::StringLike<> [] := {} + +noir_trait_def «std-1.0.0-beta.25»::«meta»::ctstring::AsCtString<> [] := { + method as_ctstring<>(Self) -> Unit; +} + +noir_trait_def «std-1.0.0-beta.25»::«meta»::tests::DoNothing<> [] := { + method do_nothing<>(Self) -> Unit; +} + +noir_trait_def «std-1.0.0-beta.25»::«meta»::tests::FieldCount<> [] := { + method field_count<>() -> u32; +} + diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Mod.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Mod.lean new file mode 100644 index 00000000..05e8c968 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Mod.lean @@ -0,0 +1,367 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_global_def «std-1.0.0-beta.25»::hash::POSEIDON2_CONFIG_STATE_SIZE: u32 = (#_poseidon2ConfigStateSize returning u32)(); + +noir_def «std-1.0.0-beta.25»::hash::blake3(input: Array) -> Array := { + if (#_isUnconstrained returning bool)() then { + (#_staticAssert returning Unit)((#_uLeq returning bool)(uConst!(N: u32), (1024: u32)), "Barretenberg cannot prove blake3 hashes with inputs larger than 1024 bytes"); + #_skip + }; + (#_blake3 returning Array)(input) +} + +noir_def «std-1.0.0-beta.25»::hash::pedersen_commitment(input: Array) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + («std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(input, (0: u32)) +} + +noir_def «std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator(input: Array, separator: u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> := { + let points = (#_ref returning & Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>)((#_mkRepeatedArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>)((#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)))); + for i in (0: u32) .. uConst!(N: u32) do { + (points[i]: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::from_field<> as λ(Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((#_arrayIndex returning Field)(input, (#_cast returning u32)(i))); + #_skip + }; + let generators = («std-1.0.0-beta.25»::hash::derive_generators as λ(Array, u32) -> Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>)((#_strAsBytes returning Array)("DEFAULT_DOMAIN_SEPARATOR"), separator); + («std-1.0.0-beta.25»::embedded_curve_ops::multi_scalar_mul as λ(Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>, Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(generators, (#_readRef returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, N: u32>)(points)) +} + +noir_def «std-1.0.0-beta.25»::hash::pedersen_hash(input: Array) -> Field := { + («std-1.0.0-beta.25»::hash::pedersen_hash_with_separator as λ(Array, u32) -> Field)(input, (0: u32)) +} + +noir_def «std-1.0.0-beta.25»::hash::pedersen_hash_with_separator(input: Array, separator: u32) -> Field := { + let scalars = (#_ref returning & Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, (N + 1): u32>)((#_mkRepeatedArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, (N + 1): u32>)((#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((0: Field), (0: Field)))); + let generators = (#_ref returning & Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, (N + 1): u32>)((#_mkRepeatedArray returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, (N + 1): u32>)((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint::point_at_infinity<> as λ() -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)())); + (#_assertConstant returning Unit)(separator); + let domain_generators = («std-1.0.0-beta.25»::hash::derive_generators as λ(Array, u32) -> Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>)((#_strAsBytes returning Array)("DEFAULT_DOMAIN_SEPARATOR"), separator); + for i in (0: u32) .. uConst!(N: u32) do { + (scalars[i]: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) = («std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar::from_field<> as λ(Field) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((#_arrayIndex returning Field)(input, (#_cast returning u32)(i))); + (generators[i]: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) = (#_arrayIndex returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(domain_generators, (#_cast returning u32)(i)); + #_skip + }; + (scalars[uConst!(N: u32)]: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>) = (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>)((#_cast returning Field)(uConst!(N: u32)), (#_cast returning Field)((0: Field))); + let length_generator = («std-1.0.0-beta.25»::hash::derive_generators<1: u32, 20: u32> as λ(Array, u32) -> Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)((#_strAsBytes returning Array)("pedersen_hash_length"), (0: u32)); + (generators[uConst!(N: u32)]: «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) = (#_arrayIndex returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)(length_generator, (0: u32)); + (#_arrayIndex returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_multiScalarMul returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, 1: u32>)((#_readRef returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, (N + 1): u32>)(generators), (#_readRef returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurveScalar<>, (N + 1): u32>)(scalars), #_true), (0: u32)).0 +} + +noir_def «std-1.0.0-beta.25»::hash::derive_generators(domain_separator_bytes: Array, starting_index: u32) -> Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32> := { + (#_assertConstant returning Unit)(domain_separator_bytes); + (#_assertConstant returning Unit)(starting_index); + (#_derivePedersenGenerators returning Array<«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, N: u32>)(domain_separator_bytes, starting_index) +} + +noir_def «std-1.0.0-beta.25»::hash::poseidon2_permutation(input: Array) -> Array := { + (#_staticAssert returning Unit)((#_uEq returning bool)(uConst!(N: u32), («std-1.0.0-beta.25»::hash::POSEIDON2_CONFIG_STATE_SIZE<> as λ() -> u32)()), (#_mkFormatString returning FmtString<115: u32, Tuple >)("the input length must equal the state size in the Poseidon2 config; expected {}{POSEIDON2_CONFIG_STATE_SIZE}{}, got {}{N}", («std-1.0.0-beta.25»::hash::POSEIDON2_CONFIG_STATE_SIZE<> as λ() -> u32)(), uConst!(N: u32))); + (#_poseidon2Permutation returning Array)(input) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_2] «std-1.0.0-beta.25»::hash::BuildHasher<> for «std-1.0.0-beta.25»::hash::BuildHasherDefault where [H: «std-1.0.0-beta.25»::hash::Hasher<>, H: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def build_hasher<>(_self: «std-1.0.0-beta.25»::hash::BuildHasherDefault) -> H := { + ((H as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> H)() + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_3] «std-1.0.0-beta.25»::default::Default<> for «std-1.0.0-beta.25»::hash::BuildHasherDefault where [H: «std-1.0.0-beta.25»::hash::Hasher<>, H: «std-1.0.0-beta.25»::default::Default<>] := { + noir_def default<>() -> «std-1.0.0-beta.25»::hash::BuildHasherDefault := { + (#_makeData returning «std-1.0.0-beta.25»::hash::BuildHasherDefault)() + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_4]<> «std-1.0.0-beta.25»::hash::Hash<> for Field where [] := { + noir_def hash(self: Field, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, self); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_5]<> «std-1.0.0-beta.25»::hash::Hash<> for u8 where [] := { + noir_def hash(self: u8, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_6]<> «std-1.0.0-beta.25»::hash::Hash<> for u16 where [] := { + noir_def hash(self: u16, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_7]<> «std-1.0.0-beta.25»::hash::Hash<> for u32 where [] := { + noir_def hash(self: u32, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_8]<> «std-1.0.0-beta.25»::hash::Hash<> for u64 where [] := { + noir_def hash(self: u64, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_9]<> «std-1.0.0-beta.25»::hash::Hash<> for u128 where [] := { + noir_def hash(self: u128, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_10]<> «std-1.0.0-beta.25»::hash::Hash<> for i8 where [] := { + noir_def hash(self: i8, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u8)(self))); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_11]<> «std-1.0.0-beta.25»::hash::Hash<> for i16 where [] := { + noir_def hash(self: i16, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u16)(self))); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_12]<> «std-1.0.0-beta.25»::hash::Hash<> for i32 where [] := { + noir_def hash(self: i32, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u32)(self))); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_13]<> «std-1.0.0-beta.25»::hash::Hash<> for i64 where [] := { + noir_def hash(self: i64, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)((#_cast returning u64)(self))); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_14]<> «std-1.0.0-beta.25»::hash::Hash<> for bool where [] := { + noir_def hash(self: bool, state: & H) -> Unit := { + ((H as «std-1.0.0-beta.25»::hash::Hasher<>)::write<> as λ(& H, Field) -> Unit)(state, (#_cast returning Field)(self)); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_15]<> «std-1.0.0-beta.25»::hash::Hash<> for Unit where [] := { + noir_def hash(_self: Unit, _state: & H) -> Unit := { + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_16] «std-1.0.0-beta.25»::hash::Hash<> for Array where [T: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Array, state: & H) -> Unit := { + let ζi0 = self; + for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { + let elem = (#_arrayIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); + { + ((T as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(T, & H) -> Unit)(elem, state); + #_skip + } + }; + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_17] «std-1.0.0-beta.25»::hash::Hash<> for Vector where [T: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Vector, state: & H) -> Unit := { + ((u32 as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(u32, & H) -> Unit)((#_arrayLen returning u32)(self), state); + { + let ζi0 = self; + for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { + let elem = (#_vectorIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); + { + ((T as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(T, & H) -> Unit)(elem, state); + #_skip + } + }; + #_skip + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_18] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_19] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_20] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_21] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_22] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_23] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>, F: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + ((F as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(F, & H) -> Unit)(self.5, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_24] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>, F: «std-1.0.0-beta.25»::hash::Hash<>, G: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + ((F as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(F, & H) -> Unit)(self.5, state); + ((G as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(G, & H) -> Unit)(self.6, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_25] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>, F: «std-1.0.0-beta.25»::hash::Hash<>, G: «std-1.0.0-beta.25»::hash::Hash<>, H_: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + ((F as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(F, & H) -> Unit)(self.5, state); + ((G as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(G, & H) -> Unit)(self.6, state); + ((H_ as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(H_, & H) -> Unit)(self.7, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_26] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>, F: «std-1.0.0-beta.25»::hash::Hash<>, G: «std-1.0.0-beta.25»::hash::Hash<>, H_: «std-1.0.0-beta.25»::hash::Hash<>, I: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + ((F as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(F, & H) -> Unit)(self.5, state); + ((G as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(G, & H) -> Unit)(self.6, state); + ((H_ as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(H_, & H) -> Unit)(self.7, state); + ((I as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(I, & H) -> Unit)(self.8, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_27] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>, F: «std-1.0.0-beta.25»::hash::Hash<>, G: «std-1.0.0-beta.25»::hash::Hash<>, H_: «std-1.0.0-beta.25»::hash::Hash<>, I: «std-1.0.0-beta.25»::hash::Hash<>, J: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + ((F as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(F, & H) -> Unit)(self.5, state); + ((G as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(G, & H) -> Unit)(self.6, state); + ((H_ as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(H_, & H) -> Unit)(self.7, state); + ((I as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(I, & H) -> Unit)(self.8, state); + ((J as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(J, & H) -> Unit)(self.9, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_28] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>, F: «std-1.0.0-beta.25»::hash::Hash<>, G: «std-1.0.0-beta.25»::hash::Hash<>, H_: «std-1.0.0-beta.25»::hash::Hash<>, I: «std-1.0.0-beta.25»::hash::Hash<>, J: «std-1.0.0-beta.25»::hash::Hash<>, K: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + ((F as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(F, & H) -> Unit)(self.5, state); + ((G as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(G, & H) -> Unit)(self.6, state); + ((H_ as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(H_, & H) -> Unit)(self.7, state); + ((I as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(I, & H) -> Unit)(self.8, state); + ((J as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(J, & H) -> Unit)(self.9, state); + ((K as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(K, & H) -> Unit)(self.10, state); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_29] «std-1.0.0-beta.25»::hash::Hash<> for Tuple where [A: «std-1.0.0-beta.25»::hash::Hash<>, B: «std-1.0.0-beta.25»::hash::Hash<>, C: «std-1.0.0-beta.25»::hash::Hash<>, D: «std-1.0.0-beta.25»::hash::Hash<>, E: «std-1.0.0-beta.25»::hash::Hash<>, F: «std-1.0.0-beta.25»::hash::Hash<>, G: «std-1.0.0-beta.25»::hash::Hash<>, H_: «std-1.0.0-beta.25»::hash::Hash<>, I: «std-1.0.0-beta.25»::hash::Hash<>, J: «std-1.0.0-beta.25»::hash::Hash<>, K: «std-1.0.0-beta.25»::hash::Hash<>, L: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: Tuple, state: & H) -> Unit := { + ((A as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(A, & H) -> Unit)(self.0, state); + ((B as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(B, & H) -> Unit)(self.1, state); + ((C as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(C, & H) -> Unit)(self.2, state); + ((D as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(D, & H) -> Unit)(self.3, state); + ((E as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(E, & H) -> Unit)(self.4, state); + ((F as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(F, & H) -> Unit)(self.5, state); + ((G as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(G, & H) -> Unit)(self.6, state); + ((H_ as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(H_, & H) -> Unit)(self.7, state); + ((I as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(I, & H) -> Unit)(self.8, state); + ((J as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(J, & H) -> Unit)(self.9, state); + ((K as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(K, & H) -> Unit)(self.10, state); + ((L as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(L, & H) -> Unit)(self.11, state); + #_skip + }; +} + +noir_def «std-1.0.0-beta.25»::hash::assert_pedersen<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<1: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field)), (1: u32)), (12324276622563533546858333135818563551199683972068214489019406489963542491231: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<1: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field)), (1: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((2393473289045184898987089634332637236754766663897650125720167164137088869378: Field), (14752839959415467457196082350231122454649853219840744672802853620609001898278: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<2: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field)), (2: u32)), (17373600937758817008005654432012017996951081028296330087189934145462836167253: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<2: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field)), (2: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((20882773338838386104588739246784320515690530528388754761396916448784486696787: Field), (21690312463585756858645971653995681111742562054409231299090708465556743227256: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<3: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field)), (3: u32)), (5326303462429251635333445553787815334884504473158538697533567972354818497508: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<3: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field)), (3: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((14442750044310327847736802799627591594015172329374229861517265487081580780677: Field), (21541273285096980478247299054518709571686057413578896051194112407245117689809: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<4: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field)), (4: u32)), (386725976317305842536127973743796063021078557104668993698335256486699462108: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<4: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field)), (4: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((3474050104565946163748262682994355436071725368663608454945085151569694677961: Field), (4969143737471383592015577254419974288705429190161323890019554309538525237268: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<5: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field)), (5: u32)), (445627510378474786942205982382342880084933256779806571759234109296077544482: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<5: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field)), (5: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((10552833461612204383225982278685649771700648236894998952452362214619168226089: Field), (20637111142228366015908581107454667111135132634752828851043827709926433782007: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<6: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field)), (6: u32)), (10217545977856619241380062255630350521414270790482717416408002401121937565042: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<6: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field)), (6: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((11335069702571578236117888955050736139682779524214984889155721704928197387927: Field), (14154880963172789420831205469621397432102607951459485158676166052928758879995: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<7: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field)), (7: u32)), (8389099894375185114295483291630893019224023442848409888108611454294869536227: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<7: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field)), (7: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((601182919381464537093882307577577658521785998356796832152269409048770009401: Field), (13183258203737681772438516208187228258046543275814925243865524294778988964092: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<8: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field)), (8: u32)), (21523828038167937961385969039642967702421152163300990828400966625856835659100: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<8: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field)), (8: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((10105395258059943854471547573391327707179901153940064586773125525172385465411: Field), (14124070489882227307621000265201755639479462785175924330417261272645603057527: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<9: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field)), (9: u32)), (5694292929090063810102755351119629986122166830204542196709417013467308391399: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<9: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field)), (9: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((4630760469979870165820917922898436050077118370325830990580986530746633543789: Field), (445421188486227550820408419830973545028032672242093648088931561027838255858: Field)))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::hash::pedersen_hash_with_separator<10: u32> as λ(Array, u32) -> Field)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field), (10: Field)), (10: u32)), (20275377721682850111235022019976833798636135445220028241150716358027628215956: Field))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>, «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>) -> bool)((«std-1.0.0-beta.25»::hash::pedersen_commitment_with_separator<10: u32> as λ(Array, u32) -> «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field), (6: Field), (7: Field), (8: Field), (9: Field), (10: Field)), (10: u32)), (#_makeData returning «std-1.0.0-beta.25»::embedded_curve_ops::EmbeddedCurvePoint<>)((21576685989271800809669594076242855923682279336602051997997130406180697269004: Field), (21724293916378205183767506996950802169155384168941589928217487219343489950277: Field)))); + #_skip +} + +def «std-1.0.0-beta.25».Hash.Mod.env : Env := Env.mk + [«std-1.0.0-beta.25::hash::POSEIDON2_CONFIG_STATE_SIZE», «std-1.0.0-beta.25::hash::blake3», «std-1.0.0-beta.25::hash::pedersen_commitment», «std-1.0.0-beta.25::hash::pedersen_commitment_with_separator», «std-1.0.0-beta.25::hash::pedersen_hash», «std-1.0.0-beta.25::hash::pedersen_hash_with_separator», «std-1.0.0-beta.25::hash::derive_generators», «std-1.0.0-beta.25::hash::poseidon2_permutation», «std-1.0.0-beta.25::hash::assert_pedersen»] + [«std-1.0.0-beta.25».impl_2, «std-1.0.0-beta.25».impl_3, «std-1.0.0-beta.25».impl_4, «std-1.0.0-beta.25».impl_5, «std-1.0.0-beta.25».impl_6, «std-1.0.0-beta.25».impl_7, «std-1.0.0-beta.25».impl_8, «std-1.0.0-beta.25».impl_9, «std-1.0.0-beta.25».impl_10, «std-1.0.0-beta.25».impl_11, «std-1.0.0-beta.25».impl_12, «std-1.0.0-beta.25».impl_13, «std-1.0.0-beta.25».impl_14, «std-1.0.0-beta.25».impl_15, «std-1.0.0-beta.25».impl_16, «std-1.0.0-beta.25».impl_17, «std-1.0.0-beta.25».impl_18, «std-1.0.0-beta.25».impl_19, «std-1.0.0-beta.25».impl_20, «std-1.0.0-beta.25».impl_21, «std-1.0.0-beta.25».impl_22, «std-1.0.0-beta.25».impl_23, «std-1.0.0-beta.25».impl_24, «std-1.0.0-beta.25».impl_25, «std-1.0.0-beta.25».impl_26, «std-1.0.0-beta.25».impl_27, «std-1.0.0-beta.25».impl_28, «std-1.0.0-beta.25».impl_29] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Poseidon2.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Poseidon2.lean new file mode 100644 index 00000000..a92a1f3b --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hash/Poseidon2.lean @@ -0,0 +1,66 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_global_def «std-1.0.0-beta.25»::hash::poseidon2::CAPACITY: u32 = (1: u32); + +noir_global_def «std-1.0.0-beta.25»::hash::poseidon2::RATE: u32 = (#_uSub returning u32)((«std-1.0.0-beta.25»::hash::POSEIDON2_CONFIG_STATE_SIZE<> as λ() -> u32)(), («std-1.0.0-beta.25»::hash::poseidon2::CAPACITY<> as λ() -> u32)()); + +noir_trait_impl[«std-1.0.0-beta.25».impl_0]<> «std-1.0.0-beta.25»::hash::Hasher<> for «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> where [] := { + noir_def finish<>(self: «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>) -> Field := { + ((«std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> as «std-1.0.0-beta.25»::hash::Hasher<>)::finish_ref<> as λ(& «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>) -> Field)((#_ref returning & «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(self)) + }; + + noir_def finish_ref<>(self: & «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>) -> Field := { + let input_length = (#_arrayLen returning u32)((#_readRef returning «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(self).0); + let iv = (#_fMul returning Field)((#_cast returning Field)(input_length), (18446744073709551616: Field)); + let state = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: Field))); + (state[(«std-1.0.0-beta.25»::hash::poseidon2::RATE<> as λ() -> u32)()]: Field) = iv; + for i in (0: u32) .. (#_uDiv returning u32)(input_length, («std-1.0.0-beta.25»::hash::poseidon2::RATE<> as λ() -> u32)()) do { + for j in (0: u32) .. («std-1.0.0-beta.25»::hash::poseidon2::RATE<> as λ() -> u32)() do { + (state[j]: Field) = (#_fAdd returning Field)((#_arrayIndex returning Field)((#_readRef returning Array)(state), (#_cast returning u32)(j)), (#_vectorIndex returning Field)((#_readRef returning «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(self).0, (#_cast returning u32)((#_uAdd returning u32)((#_uMul returning u32)(i, («std-1.0.0-beta.25»::hash::poseidon2::RATE<> as λ() -> u32)()), j)))); + #_skip + }; + state = («std-1.0.0-beta.25»::hash::poseidon2_permutation<4: u32> as λ(Array) -> Array)((#_readRef returning Array)(state)); + #_skip + }; + let absorbed = (#_uMul returning u32)((#_uDiv returning u32)(input_length, («std-1.0.0-beta.25»::hash::poseidon2::RATE<> as λ() -> u32)()), («std-1.0.0-beta.25»::hash::poseidon2::RATE<> as λ() -> u32)()); + for i in (0: u32) .. (#_uRem returning u32)(input_length, («std-1.0.0-beta.25»::hash::poseidon2::RATE<> as λ() -> u32)()) do { + (state[i]: Field) = (#_fAdd returning Field)((#_arrayIndex returning Field)((#_readRef returning Array)(state), (#_cast returning u32)(i)), (#_vectorIndex returning Field)((#_readRef returning «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(self).0, (#_cast returning u32)((#_uAdd returning u32)(absorbed, i)))); + #_skip + }; + (#_arrayIndex returning Field)((«std-1.0.0-beta.25»::hash::poseidon2_permutation<4: u32> as λ(Array) -> Array)((#_readRef returning Array)(state)), (0: u32)) + }; + + noir_def write<>(self: & «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>, input: Field) -> Unit := { + ((*self: «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>).0: Vector) = (#_vectorPushBack returning Vector)((#_readRef returning «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)(self).0, input); + #_skip + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_1]<> «std-1.0.0-beta.25»::default::Default<> for «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> where [] := { + noir_def default<>() -> «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<> := { + (#_makeData returning «std-1.0.0-beta.25»::hash::poseidon2::Poseidon2Hasher<>)((#_asVector returning Vector)((#_mkArray returning Array)())) + }; +} + +noir_def «std-1.0.0-beta.25»::hash::poseidon2::test::finish_ref_matches_known_digest<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::hash::poseidon2::test::finish_ref_does_not_drop_tail_at_length_4<>() -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::hash::poseidon2::test::finish_ref_does_not_drop_tail_at_length_5<>() -> Unit := { + (#_fresh returning Unit)() +} + +def «std-1.0.0-beta.25».Hash.Poseidon2.env : Env := Env.mk + [«std-1.0.0-beta.25::hash::poseidon2::CAPACITY», «std-1.0.0-beta.25::hash::poseidon2::RATE», «std-1.0.0-beta.25::hash::poseidon2::test::finish_ref_matches_known_digest», «std-1.0.0-beta.25::hash::poseidon2::test::finish_ref_does_not_drop_tail_at_length_4», «std-1.0.0-beta.25::hash::poseidon2::test::finish_ref_does_not_drop_tail_at_length_5»] + [«std-1.0.0-beta.25».impl_0, «std-1.0.0-beta.25».impl_1] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hint.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hint.lean new file mode 100644 index 00000000..d5377f02 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Hint.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Hint.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Integer.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Integer.lean new file mode 100644 index 00000000..9d841340 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Integer.lean @@ -0,0 +1,164 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::u8::max_value<>() -> u8 := { + (255: u8) +} + +noir_def «std-1.0.0-beta.25»::u8::min_value<>() -> u8 := { + (0: u8) +} + +noir_def «std-1.0.0-beta.25»::u8::bits<>() -> u32 := { + (8: u32) +} + +noir_def «std-1.0.0-beta.25»::u16::max_value<>() -> u16 := { + (65535: u16) +} + +noir_def «std-1.0.0-beta.25»::u16::min_value<>() -> u16 := { + (0: u16) +} + +noir_def «std-1.0.0-beta.25»::u16::bits<>() -> u32 := { + (16: u32) +} + +noir_def «std-1.0.0-beta.25»::u32::max_value<>() -> u32 := { + (4294967295: u32) +} + +noir_def «std-1.0.0-beta.25»::u32::min_value<>() -> u32 := { + (0: u32) +} + +noir_def «std-1.0.0-beta.25»::u32::bits<>() -> u32 := { + (32: u32) +} + +noir_def «std-1.0.0-beta.25»::u64::max_value<>() -> u64 := { + (18446744073709551615: u64) +} + +noir_def «std-1.0.0-beta.25»::u64::min_value<>() -> u64 := { + (0: u64) +} + +noir_def «std-1.0.0-beta.25»::u64::bits<>() -> u32 := { + (64: u32) +} + +noir_def «std-1.0.0-beta.25»::i8::max_value<>() -> i8 := { + (127: i8) +} + +noir_def «std-1.0.0-beta.25»::i8::min_value<>() -> i8 := { + (-128: i8) +} + +noir_def «std-1.0.0-beta.25»::i8::bits<>() -> u32 := { + (8: u32) +} + +noir_def «std-1.0.0-beta.25»::i16::max_value<>() -> i16 := { + (32767: i16) +} + +noir_def «std-1.0.0-beta.25»::i16::min_value<>() -> i16 := { + (-32768: i16) +} + +noir_def «std-1.0.0-beta.25»::i16::bits<>() -> u32 := { + (16: u32) +} + +noir_def «std-1.0.0-beta.25»::i32::max_value<>() -> i32 := { + (2147483647: i32) +} + +noir_def «std-1.0.0-beta.25»::i32::min_value<>() -> i32 := { + (-2147483648: i32) +} + +noir_def «std-1.0.0-beta.25»::i32::bits<>() -> u32 := { + (32: u32) +} + +noir_def «std-1.0.0-beta.25»::i64::max_value<>() -> i64 := { + (9223372036854775807: i64) +} + +noir_def «std-1.0.0-beta.25»::i64::min_value<>() -> i64 := { + (-9223372036854775808: i64) +} + +noir_def «std-1.0.0-beta.25»::i64::bits<>() -> u32 := { + (64: u32) +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_u8_limits<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> u8)(), (255: u8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> u8)(), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (8: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_u16_limits<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> u16)(), (65535: u16))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> u16)(), (0: u16))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (16: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_u32_limits<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> u32)(), (4294967295: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> u32)(), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (32: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_u64_limits<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> u64)(), (18446744073709551615: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> u64)(), (0: u64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (64: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_i8_limits<>() -> Unit := { + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> i8)(), (127: i8))); + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> i8)(), (-128: i8))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (8: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_i16_limits<>() -> Unit := { + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> i16)(), (32767: i16))); + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> i16)(), (-32768: i16))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (16: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_i32_limits<>() -> Unit := { + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> i32)(), (2147483647: i32))); + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> i32)(), (-2147483648: i32))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (32: u32))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::integer::tests::test_i64_limits<>() -> Unit := { + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::max_value<> as λ() -> i64)(), (9223372036854775807: i64))); + (#_assert returning Unit)((#_iEq returning bool)((«std-1.0.0-beta.25»::integer::min_value<> as λ() -> i64)(), (-9223372036854775808: i64))); + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::integer::bits<> as λ() -> u32)(), (64: u32))); + #_skip +} + +def «std-1.0.0-beta.25».Integer.env : Env := Env.mk + [«std-1.0.0-beta.25::u8::max_value», «std-1.0.0-beta.25::u8::min_value», «std-1.0.0-beta.25::u8::bits», «std-1.0.0-beta.25::u16::max_value», «std-1.0.0-beta.25::u16::min_value», «std-1.0.0-beta.25::u16::bits», «std-1.0.0-beta.25::u32::max_value», «std-1.0.0-beta.25::u32::min_value», «std-1.0.0-beta.25::u32::bits», «std-1.0.0-beta.25::u64::max_value», «std-1.0.0-beta.25::u64::min_value», «std-1.0.0-beta.25::u64::bits», «std-1.0.0-beta.25::i8::max_value», «std-1.0.0-beta.25::i8::min_value», «std-1.0.0-beta.25::i8::bits», «std-1.0.0-beta.25::i16::max_value», «std-1.0.0-beta.25::i16::min_value», «std-1.0.0-beta.25::i16::bits», «std-1.0.0-beta.25::i32::max_value», «std-1.0.0-beta.25::i32::min_value», «std-1.0.0-beta.25::i32::bits», «std-1.0.0-beta.25::i64::max_value», «std-1.0.0-beta.25::i64::min_value», «std-1.0.0-beta.25::i64::bits», «std-1.0.0-beta.25::integer::tests::test_u8_limits», «std-1.0.0-beta.25::integer::tests::test_u16_limits», «std-1.0.0-beta.25::integer::tests::test_u32_limits», «std-1.0.0-beta.25::integer::tests::test_u64_limits», «std-1.0.0-beta.25::integer::tests::test_i8_limits», «std-1.0.0-beta.25::integer::tests::test_i16_limits», «std-1.0.0-beta.25::integer::tests::test_i32_limits», «std-1.0.0-beta.25::integer::tests::test_i64_limits»] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Internal/Mod.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Internal/Mod.lean new file mode 100644 index 00000000..537337fb --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Internal/Mod.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Internal.Mod.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Lib.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Lib.lean similarity index 50% rename from stdlib/lampe/std-1.0.0-beta.14/Extracted/Lib.lean rename to stdlib/lampe/std-1.0.0-beta.25/Extracted/Lib.lean index e7f19ccf..33dd40bf 100644 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Lib.lean +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Lib.lean @@ -1,31 +1,31 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe set_option linter.unusedVariables false -noir_def «std-1.0.0-beta.14»::print_oracle(with_newline: bool, input: T) -> Unit := { +noir_def «std-1.0.0-beta.25»::print_oracle(with_newline: bool, input: T) -> Unit := { (#_fresh returning Unit)() } -noir_def «std-1.0.0-beta.14»::print_unconstrained(with_newline: bool, input: T) -> Unit := { +noir_def «std-1.0.0-beta.25»::print_unconstrained(with_newline: bool, input: T) -> Unit := { (#_fresh returning Unit)() } -noir_def «std-1.0.0-beta.14»::println(input: T) -> Unit := { - («std-1.0.0-beta.14»::print_unconstrained as λ(bool, T) -> Unit)(#_true, input); +noir_def «std-1.0.0-beta.25»::println(input: T) -> Unit := { + («std-1.0.0-beta.25»::print_unconstrained as λ(bool, T) -> Unit)(#_true, input); #_skip } -noir_def «std-1.0.0-beta.14»::print(input: T) -> Unit := { - («std-1.0.0-beta.14»::print_unconstrained as λ(bool, T) -> Unit)(#_false, input); +noir_def «std-1.0.0-beta.25»::print(input: T) -> Unit := { + («std-1.0.0-beta.25»::print_unconstrained as λ(bool, T) -> Unit)(#_false, input); #_skip } -noir_def «std-1.0.0-beta.14»::verify_proof_with_type(verification_key: Array, proof: Array, public_inputs: Array, key_hash: Field, proof_type: u32) -> Unit := { +noir_def «std-1.0.0-beta.25»::verify_proof_with_type(verification_key: Array, proof: Array, public_inputs: Array, key_hash: Field, proof_type: u32) -> Unit := { if (#_bNot returning bool)((#_isUnconstrained returning bool)()) then { (#_assertConstant returning Unit)(proof_type); #_skip @@ -34,6 +34,6 @@ noir_def «std-1.0.0-beta.14»::verify_proof_with_type(v #_skip } -def «std-1.0.0-beta.14».Lib.env : Env := Env.mk - [«std-1.0.0-beta.14::print_oracle», «std-1.0.0-beta.14::print_unconstrained», «std-1.0.0-beta.14::println», «std-1.0.0-beta.14::print», «std-1.0.0-beta.14::verify_proof_with_type»] +def «std-1.0.0-beta.25».Lib.env : Env := Env.mk + [«std-1.0.0-beta.25::print_oracle», «std-1.0.0-beta.25::print_unconstrained», «std-1.0.0-beta.25::println», «std-1.0.0-beta.25::print», «std-1.0.0-beta.25::verify_proof_with_type»] [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Mem.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Mem.lean new file mode 100644 index 00000000..05b20887 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Mem.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Mem.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Ctstring.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Ctstring.lean new file mode 100644 index 00000000..54c93dec --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Ctstring.lean @@ -0,0 +1,36 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_306] «std-1.0.0-beta.25»::«meta»::ctstring::AsCtString<> for String where [] := { + noir_def as_ctstring<>(self: String) -> Unit := { + (#_strAsCtstring returning Unit)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_307] «std-1.0.0-beta.25»::«meta»::ctstring::AsCtString<> for FmtString where [] := { + noir_def as_ctstring<>(self: FmtString) -> Unit := { + (#_fmtstrAsCtstring returning Unit)(self) + }; +} + +noir_def «std-1.0.0-beta.25»::«meta»::ctstring::test::as_quoted_str_example<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::ctstring::test::empty<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::ctstring::test::append<>() -> Unit := { + #_unit +} + +def «std-1.0.0-beta.25».Meta.Ctstring.env : Env := Env.mk + [«std-1.0.0-beta.25::meta::ctstring::test::as_quoted_str_example», «std-1.0.0-beta.25::meta::ctstring::test::empty», «std-1.0.0-beta.25::meta::ctstring::test::append»] + [«std-1.0.0-beta.25».impl_306, «std-1.0.0-beta.25».impl_307] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Expr.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Expr.lean new file mode 100644 index 00000000..5774a4cf --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Expr.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.Expr.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FormatString.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FormatString.lean new file mode 100644 index 00000000..d62a7d7b --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FormatString.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.FormatString.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FunctionDef.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FunctionDef.lean new file mode 100644 index 00000000..4887ac92 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/FunctionDef.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.FunctionDef.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Location.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Location.lean new file mode 100644 index 00000000..d0a7f6a8 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Location.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.Location.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Mod.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Mod.lean new file mode 100644 index 00000000..15b2aacb --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Mod.lean @@ -0,0 +1,44 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::«meta»::tests::returning_versus_macro_insertion<>() -> Unit := { + #_unit +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_447]<> «std-1.0.0-beta.25»::«meta»::tests::FieldCount<> for «std-1.0.0-beta.25»::«meta»::tests::Bar<> where [] := { + noir_def field_count<>() -> u32 := { + (2: u32) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_330]<> «std-1.0.0-beta.25»::«meta»::tests::DoNothing<> for «std-1.0.0-beta.25»::«meta»::tests::Bar<> where [] := { + noir_def do_nothing<>(__0: «std-1.0.0-beta.25»::«meta»::tests::Bar<>) -> Unit := { + #_skip + }; +} + +noir_def «std-1.0.0-beta.25»::«meta»::tests::concatenate_test<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::tests::remove_unused_warnings<>() -> Unit := { + let __0 = (#_makeData returning «std-1.0.0-beta.25»::«meta»::tests::Bar<>)((1: Field), (#_mkArray returning Array)((2: Field), (3: Field))); + let __1 = (#_makeData returning «std-1.0.0-beta.25»::«meta»::tests::MyStruct<>)((1: i32)); + let __3 = (#_makeData returning «std-1.0.0-beta.25»::«meta»::tests::MyOtherStruct<>)((2: u32)); + let __7 = («std-1.0.0-beta.25»::«meta»::tests::derive_do_nothing<> as λ(Unit) -> Unit)((«std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<0: u32>) -> Unit)("")); + let __15 = («std-1.0.0-beta.25»::«meta»::tests::derive_do_nothing_alt<> as λ(Unit) -> Unit)((«std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<0: u32>) -> Unit)("")); + if #_false then { + («std-1.0.0-beta.25»::«meta»::tests::remove_unused_warnings<> as λ() -> Unit)(); + #_skip + } +} + +def «std-1.0.0-beta.25».Meta.Mod.env : Env := Env.mk + [«std-1.0.0-beta.25::meta::tests::returning_versus_macro_insertion», «std-1.0.0-beta.25::meta::tests::concatenate_test», «std-1.0.0-beta.25::meta::tests::remove_unused_warnings»] + [«std-1.0.0-beta.25».impl_447, «std-1.0.0-beta.25».impl_330] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Module.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Module.lean new file mode 100644 index 00000000..319eb7e5 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Module.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.Module.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Op.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Op.lean new file mode 100644 index 00000000..c74837cd --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Op.lean @@ -0,0 +1,142 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_316]<> «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::«meta»::op::UnaryOp<> where [] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::«meta»::op::UnaryOp<>, other: «std-1.0.0-beta.25»::«meta»::op::UnaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, other.0) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_317]<> «std-1.0.0-beta.25»::hash::Hash<> for «std-1.0.0-beta.25»::«meta»::op::UnaryOp<> where [] := { + noir_def hash(self: «std-1.0.0-beta.25»::«meta»::op::UnaryOp<>, h: & H) -> Unit := { + ((Field as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, h); + #_skip + }; +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::UnaryOp::is_minus<>(self: «std-1.0.0-beta.25»::«meta»::op::UnaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (0: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::UnaryOp::is_not<>(self: «std-1.0.0-beta.25»::«meta»::op::UnaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (1: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::UnaryOp::is_mutable_reference<>(self: «std-1.0.0-beta.25»::«meta»::op::UnaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (2: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::UnaryOp::is_dereference<>(self: «std-1.0.0-beta.25»::«meta»::op::UnaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (3: Field)) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_318]<> «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::«meta»::op::BinaryOp<> where [] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>, other: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, other.0) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_319]<> «std-1.0.0-beta.25»::hash::Hash<> for «std-1.0.0-beta.25»::«meta»::op::BinaryOp<> where [] := { + noir_def hash(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>, h: & H) -> Unit := { + ((Field as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(Field, & H) -> Unit)(self.0, h); + #_skip + }; +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_add<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (0: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_subtract<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (1: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_multiply<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (2: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_divide<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (3: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_equal<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (4: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_not_equal<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (5: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_less_than<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (6: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_less_than_or_equal<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (7: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_greater_than<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (8: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_greater_than_or_equal<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (9: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_and<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (10: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_or<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (11: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_xor<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (12: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_shift_right<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (13: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_shift_left<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (14: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::BinaryOp::is_modulo<>(self: «std-1.0.0-beta.25»::«meta»::op::BinaryOp<>) -> bool := { + (#_fEq returning bool)(self.0, (15: Field)) +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::tests::unary_op_is_methods<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::tests::unary_op_quoted<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::tests::unary_op_eq<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::tests::binary_op_is_methods<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::tests::binary_op_quoted<>() -> Unit := { + #_unit +} + +noir_def «std-1.0.0-beta.25»::«meta»::op::tests::binary_op_eq<>() -> Unit := { + #_unit +} + +def «std-1.0.0-beta.25».Meta.Op.env : Env := Env.mk + [«std-1.0.0-beta.25::meta::op::UnaryOp::is_minus», «std-1.0.0-beta.25::meta::op::UnaryOp::is_not», «std-1.0.0-beta.25::meta::op::UnaryOp::is_mutable_reference», «std-1.0.0-beta.25::meta::op::UnaryOp::is_dereference», «std-1.0.0-beta.25::meta::op::BinaryOp::is_add», «std-1.0.0-beta.25::meta::op::BinaryOp::is_subtract», «std-1.0.0-beta.25::meta::op::BinaryOp::is_multiply», «std-1.0.0-beta.25::meta::op::BinaryOp::is_divide», «std-1.0.0-beta.25::meta::op::BinaryOp::is_equal», «std-1.0.0-beta.25::meta::op::BinaryOp::is_not_equal», «std-1.0.0-beta.25::meta::op::BinaryOp::is_less_than», «std-1.0.0-beta.25::meta::op::BinaryOp::is_less_than_or_equal», «std-1.0.0-beta.25::meta::op::BinaryOp::is_greater_than», «std-1.0.0-beta.25::meta::op::BinaryOp::is_greater_than_or_equal», «std-1.0.0-beta.25::meta::op::BinaryOp::is_and», «std-1.0.0-beta.25::meta::op::BinaryOp::is_or», «std-1.0.0-beta.25::meta::op::BinaryOp::is_xor», «std-1.0.0-beta.25::meta::op::BinaryOp::is_shift_right», «std-1.0.0-beta.25::meta::op::BinaryOp::is_shift_left», «std-1.0.0-beta.25::meta::op::BinaryOp::is_modulo», «std-1.0.0-beta.25::meta::op::tests::unary_op_is_methods», «std-1.0.0-beta.25::meta::op::tests::unary_op_quoted», «std-1.0.0-beta.25::meta::op::tests::unary_op_eq», «std-1.0.0-beta.25::meta::op::tests::binary_op_is_methods», «std-1.0.0-beta.25::meta::op::tests::binary_op_quoted», «std-1.0.0-beta.25::meta::op::tests::binary_op_eq»] + [«std-1.0.0-beta.25».impl_316, «std-1.0.0-beta.25».impl_317, «std-1.0.0-beta.25».impl_318, «std-1.0.0-beta.25».impl_319] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Quoted.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Quoted.lean new file mode 100644 index 00000000..131feea4 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Quoted.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.Quoted.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitConstraint.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitConstraint.lean new file mode 100644 index 00000000..620b8374 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitConstraint.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.TraitConstraint.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitDef.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitDef.lean new file mode 100644 index 00000000..431f0e1f --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitDef.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.TraitDef.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitImpl.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitImpl.lean new file mode 100644 index 00000000..2b4525fd --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TraitImpl.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.TraitImpl.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Typ.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Typ.lean new file mode 100644 index 00000000..9c019367 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/Typ.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.Typ.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypeDef.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypeDef.lean new file mode 100644 index 00000000..99df645b --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypeDef.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.TypeDef.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypedExpr.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypedExpr.lean new file mode 100644 index 00000000..9bee35ae --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/TypedExpr.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.TypedExpr.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/UnresolvedType.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/UnresolvedType.lean new file mode 100644 index 00000000..a03f3858 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Meta/UnresolvedType.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Meta.UnresolvedType.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Arith.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Arith.lean new file mode 100644 index 00000000..8001b804 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Arith.lean @@ -0,0 +1,1047 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_137]<> «std-1.0.0-beta.25»::ops::arith::Add<> for Field where [] := { + noir_def add<>(self: Field, other: Field) -> Field := { + (#_fAdd returning Field)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_138]<> «std-1.0.0-beta.25»::ops::arith::Add<> for u128 where [] := { + noir_def add<>(self: u128, other: u128) -> u128 := { + (#_uAdd returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_139]<> «std-1.0.0-beta.25»::ops::arith::Add<> for u64 where [] := { + noir_def add<>(self: u64, other: u64) -> u64 := { + (#_uAdd returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_140]<> «std-1.0.0-beta.25»::ops::arith::Add<> for u32 where [] := { + noir_def add<>(self: u32, other: u32) -> u32 := { + (#_uAdd returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_141]<> «std-1.0.0-beta.25»::ops::arith::Add<> for u16 where [] := { + noir_def add<>(self: u16, other: u16) -> u16 := { + (#_uAdd returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_142]<> «std-1.0.0-beta.25»::ops::arith::Add<> for u8 where [] := { + noir_def add<>(self: u8, other: u8) -> u8 := { + (#_uAdd returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_143]<> «std-1.0.0-beta.25»::ops::arith::Add<> for i8 where [] := { + noir_def add<>(self: i8, other: i8) -> i8 := { + (#_iAdd returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_144]<> «std-1.0.0-beta.25»::ops::arith::Add<> for i16 where [] := { + noir_def add<>(self: i16, other: i16) -> i16 := { + (#_iAdd returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_145]<> «std-1.0.0-beta.25»::ops::arith::Add<> for i32 where [] := { + noir_def add<>(self: i32, other: i32) -> i32 := { + (#_iAdd returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_146]<> «std-1.0.0-beta.25»::ops::arith::Add<> for i64 where [] := { + noir_def add<>(self: i64, other: i64) -> i64 := { + (#_iAdd returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_147]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for Field where [] := { + noir_def sub<>(self: Field, other: Field) -> Field := { + (#_fSub returning Field)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_148]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for u128 where [] := { + noir_def sub<>(self: u128, other: u128) -> u128 := { + (#_uSub returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_149]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for u64 where [] := { + noir_def sub<>(self: u64, other: u64) -> u64 := { + (#_uSub returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_150]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for u32 where [] := { + noir_def sub<>(self: u32, other: u32) -> u32 := { + (#_uSub returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_151]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for u16 where [] := { + noir_def sub<>(self: u16, other: u16) -> u16 := { + (#_uSub returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_152]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for u8 where [] := { + noir_def sub<>(self: u8, other: u8) -> u8 := { + (#_uSub returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_153]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for i8 where [] := { + noir_def sub<>(self: i8, other: i8) -> i8 := { + (#_iSub returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_154]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for i16 where [] := { + noir_def sub<>(self: i16, other: i16) -> i16 := { + (#_iSub returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_155]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for i32 where [] := { + noir_def sub<>(self: i32, other: i32) -> i32 := { + (#_iSub returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_156]<> «std-1.0.0-beta.25»::ops::arith::Sub<> for i64 where [] := { + noir_def sub<>(self: i64, other: i64) -> i64 := { + (#_iSub returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_157]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for Field where [] := { + noir_def mul<>(self: Field, other: Field) -> Field := { + (#_fMul returning Field)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_158]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for u128 where [] := { + noir_def mul<>(self: u128, other: u128) -> u128 := { + (#_uMul returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_159]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for u64 where [] := { + noir_def mul<>(self: u64, other: u64) -> u64 := { + (#_uMul returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_160]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for u32 where [] := { + noir_def mul<>(self: u32, other: u32) -> u32 := { + (#_uMul returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_161]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for u16 where [] := { + noir_def mul<>(self: u16, other: u16) -> u16 := { + (#_uMul returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_162]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for u8 where [] := { + noir_def mul<>(self: u8, other: u8) -> u8 := { + (#_uMul returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_163]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for i8 where [] := { + noir_def mul<>(self: i8, other: i8) -> i8 := { + (#_iMul returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_164]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for i16 where [] := { + noir_def mul<>(self: i16, other: i16) -> i16 := { + (#_iMul returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_165]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for i32 where [] := { + noir_def mul<>(self: i32, other: i32) -> i32 := { + (#_iMul returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_166]<> «std-1.0.0-beta.25»::ops::arith::Mul<> for i64 where [] := { + noir_def mul<>(self: i64, other: i64) -> i64 := { + (#_iMul returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_167]<> «std-1.0.0-beta.25»::ops::arith::Div<> for Field where [] := { + noir_def div<>(self: Field, other: Field) -> Field := { + (#_fDiv returning Field)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_168]<> «std-1.0.0-beta.25»::ops::arith::Div<> for u128 where [] := { + noir_def div<>(self: u128, other: u128) -> u128 := { + (#_uDiv returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_169]<> «std-1.0.0-beta.25»::ops::arith::Div<> for u64 where [] := { + noir_def div<>(self: u64, other: u64) -> u64 := { + (#_uDiv returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_170]<> «std-1.0.0-beta.25»::ops::arith::Div<> for u32 where [] := { + noir_def div<>(self: u32, other: u32) -> u32 := { + (#_uDiv returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_171]<> «std-1.0.0-beta.25»::ops::arith::Div<> for u16 where [] := { + noir_def div<>(self: u16, other: u16) -> u16 := { + (#_uDiv returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_172]<> «std-1.0.0-beta.25»::ops::arith::Div<> for u8 where [] := { + noir_def div<>(self: u8, other: u8) -> u8 := { + (#_uDiv returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_173]<> «std-1.0.0-beta.25»::ops::arith::Div<> for i8 where [] := { + noir_def div<>(self: i8, other: i8) -> i8 := { + (#_iDiv returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_174]<> «std-1.0.0-beta.25»::ops::arith::Div<> for i16 where [] := { + noir_def div<>(self: i16, other: i16) -> i16 := { + (#_iDiv returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_175]<> «std-1.0.0-beta.25»::ops::arith::Div<> for i32 where [] := { + noir_def div<>(self: i32, other: i32) -> i32 := { + (#_iDiv returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_176]<> «std-1.0.0-beta.25»::ops::arith::Div<> for i64 where [] := { + noir_def div<>(self: i64, other: i64) -> i64 := { + (#_iDiv returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_177]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for u128 where [] := { + noir_def rem<>(self: u128, other: u128) -> u128 := { + (#_uRem returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_178]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for u64 where [] := { + noir_def rem<>(self: u64, other: u64) -> u64 := { + (#_uRem returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_179]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for u32 where [] := { + noir_def rem<>(self: u32, other: u32) -> u32 := { + (#_uRem returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_180]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for u16 where [] := { + noir_def rem<>(self: u16, other: u16) -> u16 := { + (#_uRem returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_181]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for u8 where [] := { + noir_def rem<>(self: u8, other: u8) -> u8 := { + (#_uRem returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_182]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for i8 where [] := { + noir_def rem<>(self: i8, other: i8) -> i8 := { + (#_iRem returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_183]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for i16 where [] := { + noir_def rem<>(self: i16, other: i16) -> i16 := { + (#_iRem returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_184]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for i32 where [] := { + noir_def rem<>(self: i32, other: i32) -> i32 := { + (#_iRem returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_185]<> «std-1.0.0-beta.25»::ops::arith::Rem<> for i64 where [] := { + noir_def rem<>(self: i64, other: i64) -> i64 := { + (#_iRem returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_186]<> «std-1.0.0-beta.25»::ops::arith::Neg<> for Field where [] := { + noir_def neg<>(self: Field) -> Field := { + (#_fNeg returning Field)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_187]<> «std-1.0.0-beta.25»::ops::arith::Neg<> for i8 where [] := { + noir_def neg<>(self: i8) -> i8 := { + (#_iNeg returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_188]<> «std-1.0.0-beta.25»::ops::arith::Neg<> for i16 where [] := { + noir_def neg<>(self: i16) -> i16 := { + (#_iNeg returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_189]<> «std-1.0.0-beta.25»::ops::arith::Neg<> for i32 where [] := { + noir_def neg<>(self: i32) -> i32 := { + (#_iNeg returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_190]<> «std-1.0.0-beta.25»::ops::arith::Neg<> for i64 where [] := { + noir_def neg<>(self: i64) -> i64 := { + (#_iNeg returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_191]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for u8 where [] := { + noir_def wrapping_add<>(self: u8, y: u8) -> u8 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_add_hlp as λ(u8, u8) -> u8)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_192]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for u16 where [] := { + noir_def wrapping_add<>(self: u16, y: u16) -> u16 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_add_hlp as λ(u16, u16) -> u16)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_193]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for u32 where [] := { + noir_def wrapping_add<>(self: u32, y: u32) -> u32 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_add_hlp as λ(u32, u32) -> u32)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_194]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for u64 where [] := { + noir_def wrapping_add<>(self: u64, y: u64) -> u64 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_add_hlp as λ(u64, u64) -> u64)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_195]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for u128 where [] := { + noir_def wrapping_add<>(self: u128, y: u128) -> u128 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_add_hlp as λ(u128, u128) -> u128)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_196]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for i8 where [] := { + noir_def wrapping_add<>(self: i8, y: i8) -> i8 := { + let x = (#_cast returning u8)(self); + (#_cast returning i8)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)(x, (#_cast returning u8)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_197]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for i16 where [] := { + noir_def wrapping_add<>(self: i16, y: i16) -> i16 := { + let x = (#_cast returning u16)(self); + (#_cast returning i16)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u16, u16) -> u16)(x, (#_cast returning u16)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_198]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for i32 where [] := { + noir_def wrapping_add<>(self: i32, y: i32) -> i32 := { + let x = (#_cast returning u32)(self); + (#_cast returning i32)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u32, u32) -> u32)(x, (#_cast returning u32)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_199]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for i64 where [] := { + noir_def wrapping_add<>(self: i64, y: i64) -> i64 := { + let x = (#_cast returning u64)(self); + (#_cast returning i64)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)(x, (#_cast returning u64)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_200]<> «std-1.0.0-beta.25»::ops::arith::WrappingAdd<> for Field where [] := { + noir_def wrapping_add<>(self: Field, y: Field) -> Field := { + (#_fAdd returning Field)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_201]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for u8 where [] := { + noir_def wrapping_sub<>(self: u8, y: u8) -> u8 := { + (#_cast returning u8)((«std-1.0.0-beta.25»::ops::arith::wrapping_sub_hlp as λ(u8, u8) -> Field)(self, y)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_202]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for u16 where [] := { + noir_def wrapping_sub<>(self: u16, y: u16) -> u16 := { + (#_cast returning u16)((«std-1.0.0-beta.25»::ops::arith::wrapping_sub_hlp as λ(u16, u16) -> Field)(self, y)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_203]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for u32 where [] := { + noir_def wrapping_sub<>(self: u32, y: u32) -> u32 := { + (#_cast returning u32)((«std-1.0.0-beta.25»::ops::arith::wrapping_sub_hlp as λ(u32, u32) -> Field)(self, y)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_204]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for u64 where [] := { + noir_def wrapping_sub<>(self: u64, y: u64) -> u64 := { + (#_cast returning u64)((«std-1.0.0-beta.25»::ops::arith::wrapping_sub_hlp as λ(u64, u64) -> Field)(self, y)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_205]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for u128 where [] := { + noir_def wrapping_sub<>(self: u128, y: u128) -> u128 := { + (#_cast returning u128)((«std-1.0.0-beta.25»::ops::arith::wrapping_sub_hlp as λ(u128, u128) -> Field)(self, y)) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_206]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for i8 where [] := { + noir_def wrapping_sub<>(self: i8, y: i8) -> i8 := { + let x = (#_cast returning u8)(self); + (#_cast returning i8)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)(x, (#_cast returning u8)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_207]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for i16 where [] := { + noir_def wrapping_sub<>(self: i16, y: i16) -> i16 := { + let x = (#_cast returning u16)(self); + (#_cast returning i16)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u16, u16) -> u16)(x, (#_cast returning u16)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_208]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for i32 where [] := { + noir_def wrapping_sub<>(self: i32, y: i32) -> i32 := { + let x = (#_cast returning u32)(self); + (#_cast returning i32)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u32, u32) -> u32)(x, (#_cast returning u32)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_209]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for i64 where [] := { + noir_def wrapping_sub<>(self: i64, y: i64) -> i64 := { + let x = (#_cast returning u64)(self); + (#_cast returning i64)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)(x, (#_cast returning u64)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_210]<> «std-1.0.0-beta.25»::ops::arith::WrappingSub<> for Field where [] := { + noir_def wrapping_sub<>(self: Field, y: Field) -> Field := { + (#_fSub returning Field)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_211]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for u8 where [] := { + noir_def wrapping_mul<>(self: u8, y: u8) -> u8 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_mul_hlp as λ(u8, u8) -> u8)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_212]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for u16 where [] := { + noir_def wrapping_mul<>(self: u16, y: u16) -> u16 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_mul_hlp as λ(u16, u16) -> u16)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_213]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for u32 where [] := { + noir_def wrapping_mul<>(self: u32, y: u32) -> u32 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_mul_hlp as λ(u32, u32) -> u32)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_214]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for u64 where [] := { + noir_def wrapping_mul<>(self: u64, y: u64) -> u64 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_mul_hlp as λ(u64, u64) -> u64)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_215]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for i8 where [] := { + noir_def wrapping_mul<>(self: i8, y: i8) -> i8 := { + let x = (#_cast returning u8)(self); + (#_cast returning i8)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)(x, (#_cast returning u8)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_216]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for i16 where [] := { + noir_def wrapping_mul<>(self: i16, y: i16) -> i16 := { + let x = (#_cast returning u16)(self); + (#_cast returning i16)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u16, u16) -> u16)(x, (#_cast returning u16)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_217]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for i32 where [] := { + noir_def wrapping_mul<>(self: i32, y: i32) -> i32 := { + let x = (#_cast returning u32)(self); + (#_cast returning i32)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u32, u32) -> u32)(x, (#_cast returning u32)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_218]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for i64 where [] := { + noir_def wrapping_mul<>(self: i64, y: i64) -> i64 := { + let x = (#_cast returning u64)(self); + (#_cast returning i64)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)(x, (#_cast returning u64)(y))) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_219]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for u128 where [] := { + noir_def wrapping_mul<>(self: u128, y: u128) -> u128 := { + («std-1.0.0-beta.25»::ops::arith::wrapping_mul128_hlp<> as λ(u128, u128) -> u128)(self, y) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_220]<> «std-1.0.0-beta.25»::ops::arith::WrappingMul<> for Field where [] := { + noir_def wrapping_mul<>(self: Field, y: Field) -> Field := { + (#_fMul returning Field)(self, y) + }; +} + +noir_def «std-1.0.0-beta.25»::ops::arith::wrapping_add_hlp(x: T, y: T) -> T := { + ((Field as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(Field) -> T)((#_fAdd returning Field)(((T as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(x), ((T as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(y))) +} + +noir_def «std-1.0.0-beta.25»::ops::arith::wrapping_sub_hlp(x: T, y: T) -> Field := { + (#_fSub returning Field)((#_fAdd returning Field)(((T as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(x), (340282366920938463463374607431768211456: Field)), ((T as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(y)) +} + +noir_def «std-1.0.0-beta.25»::ops::arith::wrapping_mul_hlp(x: T, y: T) -> T := { + ((Field as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(Field) -> T)((#_fMul returning Field)(((T as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(x), ((T as «std-1.0.0-beta.25»::convert::AsPrimitive)::as_<> as λ(T) -> Field)(y))) +} + +noir_global_def «std-1.0.0-beta.25»::ops::arith::two_pow_64: u128 = (18446744073709551616: u128); + +noir_def «std-1.0.0-beta.25»::ops::arith::split64<>(x: u128) -> Tuple := { + (#_fresh returning Tuple)() +} + +noir_def «std-1.0.0-beta.25»::ops::arith::split_into_64_bit_limbs<>(x: u128) -> Tuple := { + let (x_lo, x_hi) = { + («std-1.0.0-beta.25»::ops::arith::split64<> as λ(u128) -> Tuple)(x) + }; + (#_assert returning Unit)((#_fEq returning bool)((#_cast returning Field)(x), (#_fAdd returning Field)((#_cast returning Field)(x_lo), (#_fMul returning Field)((#_cast returning Field)(x_hi), (#_cast returning Field)((«std-1.0.0-beta.25»::ops::arith::two_pow_64<> as λ() -> u128)()))))); + (#_makeData returning Tuple)(x_lo, x_hi) +} + +noir_def «std-1.0.0-beta.25»::ops::arith::wrapping_mul128_hlp<>(x: u128, y: u128) -> u128 := { + let (x_lo, x_hi) = («std-1.0.0-beta.25»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(x); + let (y_lo, y_hi) = («std-1.0.0-beta.25»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(y); + let low = (#_fMul returning Field)((#_cast returning Field)(x_lo), (#_cast returning Field)(y_lo)); + let lo = (#_cast returning Field)((#_cast returning u64)(low)); + let carry = (#_fDiv returning Field)((#_fSub returning Field)(low, lo), (#_cast returning Field)((«std-1.0.0-beta.25»::ops::arith::two_pow_64<> as λ() -> u128)())); + let high = (#_fAdd returning Field)((#_fAdd returning Field)((#_fMul returning Field)((#_cast returning Field)(x_lo), (#_cast returning Field)(y_hi)), (#_fMul returning Field)((#_cast returning Field)(x_hi), (#_cast returning Field)(y_lo))), carry); + let hi = (#_cast returning Field)((#_cast returning u64)(high)); + (#_cast returning u128)((#_fAdd returning Field)(lo, (#_fMul returning Field)((#_cast returning Field)((«std-1.0.0-beta.25»::ops::arith::two_pow_64<> as λ() -> u128)()), hi))) +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::test_static_assert_custom_message<>() -> Unit := { + (#_staticAssert returning Unit)((#_fEq returning bool)((1: Field), (2: Field)), "custom message"); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::test_basic_arithmetic_traits<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)((5: Field), (3: Field)), (8: Field))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u8, u8) -> u8)((0: u8), (255: u8)), (255: u8))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)((42: Field), (58: Field)), (100: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)((10: Field), (3: Field)), (7: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)((100: Field), (42: Field)), (58: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(Field, Field) -> Field)((6: Field), (7: Field)), (42: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((15: Field), (3: Field)), (5: Field))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(u8, u8) -> u8)((10: u8), (3: u8)), (3: u8))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((15: Field), (3: Field)), (5: Field))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u64, u64) -> u64)((17: u64), (5: u64)), (2: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u8, u8) -> u8)((10: u8), (3: u8)), (1: u8))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)((42: Field)), (-42: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)((-10: Field)), (10: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)((42: Field)), (-42: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::test_division<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((42: Field), (1: Field)), (42: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((0: Field), (1: Field)), (0: Field))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(u8, u8) -> u8)((255: u8), (1: u8)), (255: u8))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((42: Field), (42: Field)), (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((1: Field), (1: Field)), (1: Field))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u32, u32) -> u32)((42: u32), (42: u32)), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u16, u16) -> u16)((0: u16), (42: u16)), (0: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u64, u64) -> u64)((1: u64), (42: u64)), (1: u64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::add::u8_overflow<>() -> Unit := { + let __0 = ((u8 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u8, u8) -> u8)((255: u8), (1: u8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::add::u16_overflow<>() -> Unit := { + let __0 = ((u16 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u16, u16) -> u16)((65535: u16), (1: u16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::add::i8_overflow<>() -> Unit := { + let __0 = ((i8 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i8, i8) -> i8)((127: i8), (1: i8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::add::i16_overflow<>() -> Unit := { + let __0 = ((i16 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i16, i16) -> i16)((32767: i16), (1: i16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::add::i32_overflow<>() -> Unit := { + let __0 = ((i32 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i32, i32) -> i32)((2147483647: i32), (1: i32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::add::i64_overflow<>() -> Unit := { + let __0 = ((i64 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i64, i64) -> i64)((9223372036854775807: i64), (1: i64)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::sub::u8_overflow<>() -> Unit := { + let __0 = ((u8 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(u8, u8) -> u8)((0: u8), (1: u8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::sub::u16_overflow<>() -> Unit := { + let __0 = ((u16 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(u16, u16) -> u16)((0: u16), (1: u16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::sub::i8_overflow<>() -> Unit := { + let val = (-128: i8); + let __0 = ((i8 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i8, i8) -> i8)(val, (1: i8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::sub::i16_overflow<>() -> Unit := { + let val = (-32768: i16); + let __0 = ((i16 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i16, i16) -> i16)(val, (1: i16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::sub::i32_overflow<>() -> Unit := { + let val = (-2147483648: i32); + let __0 = ((i32 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i32, i32) -> i32)(val, (1: i32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::sub::i64_overflow<>() -> Unit := { + let val = (-9223372036854775808: i64); + let __0 = ((i64 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i64, i64) -> i64)(val, (1: i64)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::mul::u8_overflow<>() -> Unit := { + let __0 = ((u8 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(u8, u8) -> u8)((255: u8), (2: u8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::mul::u16_overflow<>() -> Unit := { + let __0 = ((u16 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(u16, u16) -> u16)((65535: u16), (2: u16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::mul::i8_min_times_neg_one_overflow<>() -> Unit := { + let val = (-128: i8); + let __0 = ((i8 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i8, i8) -> i8)(val, (-1: i8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::mul::i16_min_times_neg_one_overflow<>() -> Unit := { + let val = (-32768: i16); + let __0 = ((i16 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i16, i16) -> i16)(val, (-1: i16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::mul::i32_min_times_neg_one_overflow<>() -> Unit := { + let val = (-2147483648: i32); + let __0 = ((i32 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i32, i32) -> i32)(val, (-1: i32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::mul::i64_min_times_neg_one_overflow<>() -> Unit := { + let val = (-9223372036854775808: i64); + let __0 = ((i64 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i64, i64) -> i64)(val, (-1: i64)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::div::i8_min_by_neg_one_overflow<>() -> Unit := { + let val = (-128: i8); + let __0 = ((i8 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i8, i8) -> i8)(val, (-1: i8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::div::i16_min_by_neg_one_overflow<>() -> Unit := { + let val = (-32768: i16); + let __0 = ((i16 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i16, i16) -> i16)(val, (-1: i16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::div::i32_min_by_neg_one_overflow<>() -> Unit := { + let val = (-2147483648: i32); + let __0 = ((i32 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i32, i32) -> i32)(val, (-1: i32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::div::i64_min_by_neg_one_overflow<>() -> Unit := { + let val = (-9223372036854775808: i64); + let __0 = ((i64 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i64, i64) -> i64)(val, (-1: i64)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::rem::i8_min_by_neg_one_overflow<>() -> Unit := { + let val = (-128: i8); + let __0 = ((i8 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i8, i8) -> i8)(val, (-1: i8)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::rem::i16_min_by_neg_one_overflow<>() -> Unit := { + let val = (-32768: i16); + let __0 = ((i16 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i16, i16) -> i16)(val, (-1: i16)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::rem::i32_min_by_neg_one_overflow<>() -> Unit := { + let val = (-2147483648: i32); + let __0 = ((i32 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i32, i32) -> i32)(val, (-1: i32)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::rem::i64_min_by_neg_one_overflow<>() -> Unit := { + let val = (-9223372036854775808: i64); + let __0 = ((i64 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i64, i64) -> i64)(val, (-1: i64)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::neg::i8_min_overflow<>() -> Unit := { + let val = (-128: i8); + let __0 = ((i8 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i8) -> i8)(val); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::neg::i16_min_overflow<>() -> Unit := { + let val = (-32768: i16); + let __0 = ((i16 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i16) -> i16)(val); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::neg::i32_min_overflow<>() -> Unit := { + let val = (-2147483648: i32); + let __0 = ((i32 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i32) -> i32)(val); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::neg::i64_min_overflow<>() -> Unit := { + let val = (-9223372036854775808: i64); + let __0 = ((i64 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i64) -> i64)(val); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::arithmetic::test_field<>() -> Unit := { + let zero = (0: Field); + let one = (1: Field); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(zero, one), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(one, zero), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)(one, one), zero)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(Field, Field) -> Field)(one, one), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)(one, one), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(zero), zero)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(one), (#_fNeg returning Field)(one))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::wrapping_arithmetic::test_wrapping_add<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((255: u8), (1: u8)), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((255: u8), (255: u8)), (254: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((0: u8), (0: u8)), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((128: u8), (128: u8)), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u16, u16) -> u16)((65535: u16), (1: u16)), (0: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u16, u16) -> u16)((65535: u16), (65535: u16)), (65534: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u32, u32) -> u32)((4294967295: u32), (1: u32)), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u32, u32) -> u32)((4294967295: u32), (4294967295: u32)), (4294967294: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (1: u64)), (0: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (18446744073709551615: u64)), (18446744073709551614: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u128, u128) -> u128)((340282366920938463463374607431768211455: u128), (1: u128)), (0: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i8, i8) -> i8)((127: i8), (1: i8)), (-128: i8))); + let val = (-128: i8); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i8, i8) -> i8)(val, (-1: i8)), (127: i8))); + let forty_two = (42: Field); + let fifty_eight = (58: Field); + let hundred = (100: Field); + let neg_two = (-2: Field); + let two = (2: Field); + let zero = (0: Field); + let neg_two_hundred = (-200: Field); + let neg_one_ninety_eight = (-198: Field); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(forty_two, fifty_eight), hundred)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(neg_two, two), zero)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(neg_two_hundred, two), neg_one_ninety_eight)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::wrapping_arithmetic::test_wrapping_sub<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((0: u8), (1: u8)), (255: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((255: u8), (255: u8)), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((0: u8), (0: u8)), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((1: u8), (2: u8)), (255: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u16, u16) -> u16)((0: u16), (1: u16)), (65535: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u16, u16) -> u16)((65535: u16), (65535: u16)), (0: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u32, u32) -> u32)((0: u32), (1: u32)), (4294967295: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u32, u32) -> u32)((4294967295: u32), (4294967295: u32)), (0: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)((0: u64), (1: u64)), (18446744073709551615: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (18446744073709551615: u64)), (0: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u128, u128) -> u128)((0: u128), (1: u128)), (340282366920938463463374607431768211455: u128))); + let val = (-128: i8); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i8, i8) -> i8)(val, (1: i8)), (127: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i8, i8) -> i8)((127: i8), (-1: i8)), (-128: i8))); + let forty_two = (42: Field); + let fifty_eight = (58: Field); + let neg_sixteen = (-16: Field); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(Field, Field) -> Field)(forty_two, fifty_eight), neg_sixteen)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::wrapping_arithmetic::test_wrapping_mul<>() -> Unit := { + let zero = (0: u128); + let one = (1: u128); + let two_pow_64 = (18446744073709551616: u128); + let u128_max = (340282366920938463463374607431768211455: u128); + (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(zero, one))); + (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(one, zero))); + (#_assert returning Unit)((#_uEq returning bool)(one, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(one, one))); + (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(zero, two_pow_64))); + (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(two_pow_64, zero))); + (#_assert returning Unit)((#_uEq returning bool)(two_pow_64, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(two_pow_64, one))); + (#_assert returning Unit)((#_uEq returning bool)(two_pow_64, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(one, two_pow_64))); + (#_assert returning Unit)((#_uEq returning bool)(zero, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(two_pow_64, two_pow_64))); + (#_assert returning Unit)((#_uEq returning bool)(one, ((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(u128_max, u128_max))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)((255: u8), (2: u8)), (254: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)((255: u8), (255: u8)), (1: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)((128: u8), (2: u8)), (0: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u16, u16) -> u16)((65535: u16), (2: u16)), (65534: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u16, u16) -> u16)((65535: u16), (65535: u16)), (1: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u32, u32) -> u32)((4294967295: u32), (2: u32)), (4294967294: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u32, u32) -> u32)((4294967295: u32), (4294967295: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (2: u64)), (18446744073709551614: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (18446744073709551615: u64)), (1: u64))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i8, i8) -> i8)((127: i8), (2: i8)), (-2: i8))); + let val = (-128: i8); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i8, i8) -> i8)(val, (-1: i8)), (-128: i8))); + let six = (6: Field); + let seven = (7: Field); + let forty_two = (42: Field); + let neg_two = (-2: Field); + let two = (2: Field); + let neg_four = (-4: Field); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(six, seven), forty_two)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(neg_two, two), neg_four)); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::wrapping_arithmetic::test_wrapping_vs_regular<>() -> Unit := { + let u64_large = (1311768467463790320: u64); + let u128_large = (24197857203266734864793317670504947440: u128); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)(u64_large, (1: u64)), (#_uAdd returning u64)(u64_large, (1: u64)))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)(u64_large, (1: u64)), (#_uSub returning u64)(u64_large, (1: u64)))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)(u64_large, (2: u64)), (#_uMul returning u64)(u64_large, (2: u64)))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u128, u128) -> u128)(u128_large, (1: u128)), (#_uAdd returning u128)(u128_large, (1: u128)))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u128, u128) -> u128)(u128_large, (1: u128)), (#_uSub returning u128)(u128_large, (1: u128)))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)(u128_large, (2: u128)), (#_uMul returning u128)(u128_large, (2: u128)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::wrapping_arithmetic::test_field_wrapping_operations<>() -> Unit := { + let zero = (0: Field); + let one = (1: Field); + let large_val = (18446744073709551615: Field); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(zero, one), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)(one, large_val), (#_fAdd returning Field)(one, large_val))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(Field, Field) -> Field)(zero, one), (#_fNeg returning Field)(one))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(Field, Field) -> Field)(one, large_val), (#_fSub returning Field)(one, large_val))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(zero, one), zero)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)(one, large_val), large_val)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(zero, one), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)(one, zero), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)(one, one), zero)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(Field, Field) -> Field)(one, one), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)(one, one), one)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(zero), zero)); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(Field) -> Field)(one), (#_fNeg returning Field)(one))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::split_functions::test_split_functions<>() -> Unit := { + let small_val = (81985529216486895: u128); + let large_val = (24197857203266734864793317670504947440: u128); + let max_val = (340282366920938463463374607431768211455: u128); + { + let (lo, hi) = («std-1.0.0-beta.25»::ops::arith::split64<> as λ(u128) -> Tuple)(small_val); + (#_assert returning Unit)((#_uEq returning bool)(lo, (81985529216486895: u64))); + (#_assert returning Unit)((#_uEq returning bool)(hi, (0: u64))); + let (lo2, hi2) = («std-1.0.0-beta.25»::ops::arith::split64<> as λ(u128) -> Tuple)(large_val); + (#_assert returning Unit)((#_uEq returning bool)(lo2, (1311768467463790320: u64))); + (#_assert returning Unit)((#_uEq returning bool)(hi2, (1311768467463790320: u64))); + #_skip + }; + let (lo3, hi3) = («std-1.0.0-beta.25»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(small_val); + (#_assert returning Unit)((#_uEq returning bool)(lo3, (81985529216486895: u64))); + (#_assert returning Unit)((#_uEq returning bool)(hi3, (0: u64))); + let (lo4, hi4) = («std-1.0.0-beta.25»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(large_val); + (#_assert returning Unit)((#_uEq returning bool)(lo4, (1311768467463790320: u64))); + (#_assert returning Unit)((#_uEq returning bool)(hi4, (1311768467463790320: u64))); + let (lo5, hi5) = («std-1.0.0-beta.25»::ops::arith::split_into_64_bit_limbs<> as λ(u128) -> Tuple)(max_val); + (#_assert returning Unit)((#_uEq returning bool)(lo5, (18446744073709551615: u64))); + (#_assert returning Unit)((#_uEq returning bool)(hi5, (18446744073709551615: u64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::add<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u8, u8) -> u8)((1: u8), (2: u8)), (3: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u16, u16) -> u16)((1: u16), (2: u16)), (3: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u32, u32) -> u32)((1: u32), (2: u32)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u64, u64) -> u64)((1: u64), (2: u64)), (3: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(u128, u128) -> u128)((1: u128), (2: u128)), (3: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i8, i8) -> i8)((1: i8), (2: i8)), (3: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i16, i16) -> i16)((1: i16), (2: i16)), (3: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i32, i32) -> i32)((1: i32), (2: i32)), (3: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(i64, i64) -> i64)((1: i64), (2: i64)), (3: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Add<>)::add<> as λ(Field, Field) -> Field)((1: Field), (2: Field)), (3: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::sub<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(u8, u8) -> u8)((3: u8), (2: u8)), (1: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(u16, u16) -> u16)((3: u16), (2: u16)), (1: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(u32, u32) -> u32)((3: u32), (2: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(u64, u64) -> u64)((3: u64), (2: u64)), (1: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(u128, u128) -> u128)((3: u128), (2: u128)), (1: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i8, i8) -> i8)((3: i8), (2: i8)), (1: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i16, i16) -> i16)((3: i16), (2: i16)), (1: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i32, i32) -> i32)((3: i32), (2: i32)), (1: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(i64, i64) -> i64)((3: i64), (2: i64)), (1: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Sub<>)::sub<> as λ(Field, Field) -> Field)((3: Field), (2: Field)), (1: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::mul<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(u8, u8) -> u8)((3: u8), (2: u8)), (6: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(u16, u16) -> u16)((3: u16), (2: u16)), (6: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(u32, u32) -> u32)((3: u32), (2: u32)), (6: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(u64, u64) -> u64)((3: u64), (2: u64)), (6: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(u128, u128) -> u128)((3: u128), (2: u128)), (6: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i8, i8) -> i8)((3: i8), (2: i8)), (6: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i16, i16) -> i16)((3: i16), (2: i16)), (6: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i32, i32) -> i32)((3: i32), (2: i32)), (6: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(i64, i64) -> i64)((3: i64), (2: i64)), (6: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Mul<>)::mul<> as λ(Field, Field) -> Field)((3: Field), (2: Field)), (6: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::div<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(u8, u8) -> u8)((6: u8), (2: u8)), (3: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(u16, u16) -> u16)((6: u16), (2: u16)), (3: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(u32, u32) -> u32)((6: u32), (2: u32)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(u64, u64) -> u64)((6: u64), (2: u64)), (3: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(u128, u128) -> u128)((6: u128), (2: u128)), (3: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i8, i8) -> i8)((6: i8), (2: i8)), (3: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i16, i16) -> i16)((6: i16), (2: i16)), (3: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i32, i32) -> i32)((6: i32), (2: i32)), (3: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(i64, i64) -> i64)((6: i64), (2: i64)), (3: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::Div<>)::div<> as λ(Field, Field) -> Field)((6: Field), (2: Field)), (3: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::rem<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u8, u8) -> u8)((3: u8), (2: u8)), (1: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u16, u16) -> u16)((3: u16), (2: u16)), (1: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u32, u32) -> u32)((3: u32), (2: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u64, u64) -> u64)((3: u64), (2: u64)), (1: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(u128, u128) -> u128)((3: u128), (2: u128)), (1: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i8, i8) -> i8)((3: i8), (2: i8)), (1: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i16, i16) -> i16)((3: i16), (2: i16)), (1: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i32, i32) -> i32)((3: i32), (2: i32)), (1: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::Rem<>)::rem<> as λ(i64, i64) -> i64)((3: i64), (2: i64)), (1: i64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::neg<>() -> Unit := { + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i8) -> i8)((3: i8)), (-3: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i16) -> i16)((3: i16)), (-3: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i32) -> i32)((3: i32)), (-3: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::Neg<>)::neg<> as λ(i64) -> i64)((3: i64)), (-3: i64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::wrapping_add<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u8, u8) -> u8)((255: u8), (2: u8)), (1: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u16, u16) -> u16)((65535: u16), (2: u16)), (1: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u32, u32) -> u32)((4294967295: u32), (2: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (2: u64)), (1: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(u128, u128) -> u128)((340282366920938463463374607431768211455: u128), (2: u128)), (1: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i8, i8) -> i8)((127: i8), (2: i8)), (-127: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i16, i16) -> i16)((32767: i16), (2: i16)), (-32767: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i32, i32) -> i32)((2147483647: i32), (2: i32)), (-2147483647: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(i64, i64) -> i64)((9223372036854775807: i64), (2: i64)), (-9223372036854775807: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingAdd<>)::wrapping_add<> as λ(Field, Field) -> Field)((1: Field), (2: Field)), (3: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::wrapping_sub<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u8, u8) -> u8)((0: u8), (1: u8)), (255: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u16, u16) -> u16)((0: u16), (1: u16)), (65535: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u32, u32) -> u32)((0: u32), (1: u32)), (4294967295: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u64, u64) -> u64)((0: u64), (1: u64)), (18446744073709551615: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(u128, u128) -> u128)((0: u128), (1: u128)), (340282366920938463463374607431768211455: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i8, i8) -> i8)((-128: i8), (1: i8)), (127: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i16, i16) -> i16)((-32768: i16), (1: i16)), (32767: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i32, i32) -> i32)((-2147483648: i32), (1: i32)), (2147483647: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(i64, i64) -> i64)((-9223372036854775808: i64), (1: i64)), (9223372036854775807: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingSub<>)::wrapping_sub<> as λ(Field, Field) -> Field)((3: Field), (1: Field)), (2: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::arith::tests::traits::wrapping_mul<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u8, u8) -> u8)((255: u8), (2: u8)), (254: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u16, u16) -> u16)((65535: u16), (2: u16)), (65534: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u32, u32) -> u32)((4294967295: u32), (2: u32)), (4294967294: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u64, u64) -> u64)((18446744073709551615: u64), (2: u64)), (18446744073709551614: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(u128, u128) -> u128)((340282366920938463463374607431768211455: u128), (2: u128)), (340282366920938463463374607431768211454: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i8, i8) -> i8)((127: i8), (2: i8)), (-2: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i16, i16) -> i16)((32767: i16), (2: i16)), (-2: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i32, i32) -> i32)((2147483647: i32), (2: i32)), (-2: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(i64, i64) -> i64)((9223372036854775807: i64), (2: i64)), (-2: i64))); + (#_assert returning Unit)((#_fEq returning bool)(((Field as «std-1.0.0-beta.25»::ops::arith::WrappingMul<>)::wrapping_mul<> as λ(Field, Field) -> Field)((2: Field), (3: Field)), (6: Field))); + #_skip +} + +def «std-1.0.0-beta.25».Ops.Arith.env : Env := Env.mk + [«std-1.0.0-beta.25::ops::arith::wrapping_add_hlp», «std-1.0.0-beta.25::ops::arith::wrapping_sub_hlp», «std-1.0.0-beta.25::ops::arith::wrapping_mul_hlp», «std-1.0.0-beta.25::ops::arith::two_pow_64», «std-1.0.0-beta.25::ops::arith::split64», «std-1.0.0-beta.25::ops::arith::split_into_64_bit_limbs», «std-1.0.0-beta.25::ops::arith::wrapping_mul128_hlp», «std-1.0.0-beta.25::ops::arith::tests::test_static_assert_custom_message», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::test_basic_arithmetic_traits», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::test_division», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::add::u8_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::add::u16_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::add::i8_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::add::i16_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::add::i32_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::add::i64_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::sub::u8_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::sub::u16_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::sub::i8_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::sub::i16_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::sub::i32_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::sub::i64_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::mul::u8_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::mul::u16_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::mul::i8_min_times_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::mul::i16_min_times_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::mul::i32_min_times_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::mul::i64_min_times_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::div::i8_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::div::i16_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::div::i32_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::div::i64_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::rem::i8_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::rem::i16_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::rem::i32_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::rem::i64_min_by_neg_one_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::neg::i8_min_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::neg::i16_min_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::neg::i32_min_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::neg::i64_min_overflow», «std-1.0.0-beta.25::ops::arith::tests::arithmetic::test_field», «std-1.0.0-beta.25::ops::arith::tests::wrapping_arithmetic::test_wrapping_add», «std-1.0.0-beta.25::ops::arith::tests::wrapping_arithmetic::test_wrapping_sub», «std-1.0.0-beta.25::ops::arith::tests::wrapping_arithmetic::test_wrapping_mul», «std-1.0.0-beta.25::ops::arith::tests::wrapping_arithmetic::test_wrapping_vs_regular», «std-1.0.0-beta.25::ops::arith::tests::wrapping_arithmetic::test_field_wrapping_operations», «std-1.0.0-beta.25::ops::arith::tests::split_functions::test_split_functions», «std-1.0.0-beta.25::ops::arith::tests::traits::add», «std-1.0.0-beta.25::ops::arith::tests::traits::sub», «std-1.0.0-beta.25::ops::arith::tests::traits::mul», «std-1.0.0-beta.25::ops::arith::tests::traits::div», «std-1.0.0-beta.25::ops::arith::tests::traits::rem», «std-1.0.0-beta.25::ops::arith::tests::traits::neg», «std-1.0.0-beta.25::ops::arith::tests::traits::wrapping_add», «std-1.0.0-beta.25::ops::arith::tests::traits::wrapping_sub», «std-1.0.0-beta.25::ops::arith::tests::traits::wrapping_mul»] + [«std-1.0.0-beta.25».impl_137, «std-1.0.0-beta.25».impl_138, «std-1.0.0-beta.25».impl_139, «std-1.0.0-beta.25».impl_140, «std-1.0.0-beta.25».impl_141, «std-1.0.0-beta.25».impl_142, «std-1.0.0-beta.25».impl_143, «std-1.0.0-beta.25».impl_144, «std-1.0.0-beta.25».impl_145, «std-1.0.0-beta.25».impl_146, «std-1.0.0-beta.25».impl_147, «std-1.0.0-beta.25».impl_148, «std-1.0.0-beta.25».impl_149, «std-1.0.0-beta.25».impl_150, «std-1.0.0-beta.25».impl_151, «std-1.0.0-beta.25».impl_152, «std-1.0.0-beta.25».impl_153, «std-1.0.0-beta.25».impl_154, «std-1.0.0-beta.25».impl_155, «std-1.0.0-beta.25».impl_156, «std-1.0.0-beta.25».impl_157, «std-1.0.0-beta.25».impl_158, «std-1.0.0-beta.25».impl_159, «std-1.0.0-beta.25».impl_160, «std-1.0.0-beta.25».impl_161, «std-1.0.0-beta.25».impl_162, «std-1.0.0-beta.25».impl_163, «std-1.0.0-beta.25».impl_164, «std-1.0.0-beta.25».impl_165, «std-1.0.0-beta.25».impl_166, «std-1.0.0-beta.25».impl_167, «std-1.0.0-beta.25».impl_168, «std-1.0.0-beta.25».impl_169, «std-1.0.0-beta.25».impl_170, «std-1.0.0-beta.25».impl_171, «std-1.0.0-beta.25».impl_172, «std-1.0.0-beta.25».impl_173, «std-1.0.0-beta.25».impl_174, «std-1.0.0-beta.25».impl_175, «std-1.0.0-beta.25».impl_176, «std-1.0.0-beta.25».impl_177, «std-1.0.0-beta.25».impl_178, «std-1.0.0-beta.25».impl_179, «std-1.0.0-beta.25».impl_180, «std-1.0.0-beta.25».impl_181, «std-1.0.0-beta.25».impl_182, «std-1.0.0-beta.25».impl_183, «std-1.0.0-beta.25».impl_184, «std-1.0.0-beta.25».impl_185, «std-1.0.0-beta.25».impl_186, «std-1.0.0-beta.25».impl_187, «std-1.0.0-beta.25».impl_188, «std-1.0.0-beta.25».impl_189, «std-1.0.0-beta.25».impl_190, «std-1.0.0-beta.25».impl_191, «std-1.0.0-beta.25».impl_192, «std-1.0.0-beta.25».impl_193, «std-1.0.0-beta.25».impl_194, «std-1.0.0-beta.25».impl_195, «std-1.0.0-beta.25».impl_196, «std-1.0.0-beta.25».impl_197, «std-1.0.0-beta.25».impl_198, «std-1.0.0-beta.25».impl_199, «std-1.0.0-beta.25».impl_200, «std-1.0.0-beta.25».impl_201, «std-1.0.0-beta.25».impl_202, «std-1.0.0-beta.25».impl_203, «std-1.0.0-beta.25».impl_204, «std-1.0.0-beta.25».impl_205, «std-1.0.0-beta.25».impl_206, «std-1.0.0-beta.25».impl_207, «std-1.0.0-beta.25».impl_208, «std-1.0.0-beta.25».impl_209, «std-1.0.0-beta.25».impl_210, «std-1.0.0-beta.25».impl_211, «std-1.0.0-beta.25».impl_212, «std-1.0.0-beta.25».impl_213, «std-1.0.0-beta.25».impl_214, «std-1.0.0-beta.25».impl_215, «std-1.0.0-beta.25».impl_216, «std-1.0.0-beta.25».impl_217, «std-1.0.0-beta.25».impl_218, «std-1.0.0-beta.25».impl_219, «std-1.0.0-beta.25».impl_220] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Bit.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Bit.lean new file mode 100644 index 00000000..6123ba98 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Bit.lean @@ -0,0 +1,443 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_trait_impl[«std-1.0.0-beta.25».impl_221]<> «std-1.0.0-beta.25»::ops::bit::Not<> for bool where [] := { + noir_def not<>(self: bool) -> bool := { + (#_bNot returning bool)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_222]<> «std-1.0.0-beta.25»::ops::bit::Not<> for u128 where [] := { + noir_def not<>(self: u128) -> u128 := { + (#_uNot returning u128)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_223]<> «std-1.0.0-beta.25»::ops::bit::Not<> for u64 where [] := { + noir_def not<>(self: u64) -> u64 := { + (#_uNot returning u64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_224]<> «std-1.0.0-beta.25»::ops::bit::Not<> for u32 where [] := { + noir_def not<>(self: u32) -> u32 := { + (#_uNot returning u32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_225]<> «std-1.0.0-beta.25»::ops::bit::Not<> for u16 where [] := { + noir_def not<>(self: u16) -> u16 := { + (#_uNot returning u16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_226]<> «std-1.0.0-beta.25»::ops::bit::Not<> for u8 where [] := { + noir_def not<>(self: u8) -> u8 := { + (#_uNot returning u8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_227]<> «std-1.0.0-beta.25»::ops::bit::Not<> for i8 where [] := { + noir_def not<>(self: i8) -> i8 := { + (#_iNot returning i8)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_228]<> «std-1.0.0-beta.25»::ops::bit::Not<> for i16 where [] := { + noir_def not<>(self: i16) -> i16 := { + (#_iNot returning i16)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_229]<> «std-1.0.0-beta.25»::ops::bit::Not<> for i32 where [] := { + noir_def not<>(self: i32) -> i32 := { + (#_iNot returning i32)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_230]<> «std-1.0.0-beta.25»::ops::bit::Not<> for i64 where [] := { + noir_def not<>(self: i64) -> i64 := { + (#_iNot returning i64)(self) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_231]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for bool where [] := { + noir_def bitor<>(self: bool, other: bool) -> bool := { + (#_bOr returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_232]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for u128 where [] := { + noir_def bitor<>(self: u128, other: u128) -> u128 := { + (#_uOr returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_233]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for u64 where [] := { + noir_def bitor<>(self: u64, other: u64) -> u64 := { + (#_uOr returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_234]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for u32 where [] := { + noir_def bitor<>(self: u32, other: u32) -> u32 := { + (#_uOr returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_235]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for u16 where [] := { + noir_def bitor<>(self: u16, other: u16) -> u16 := { + (#_uOr returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_236]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for u8 where [] := { + noir_def bitor<>(self: u8, other: u8) -> u8 := { + (#_uOr returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_237]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for i8 where [] := { + noir_def bitor<>(self: i8, other: i8) -> i8 := { + (#_iOr returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_238]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for i16 where [] := { + noir_def bitor<>(self: i16, other: i16) -> i16 := { + (#_iOr returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_239]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for i32 where [] := { + noir_def bitor<>(self: i32, other: i32) -> i32 := { + (#_iOr returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_240]<> «std-1.0.0-beta.25»::ops::bit::BitOr<> for i64 where [] := { + noir_def bitor<>(self: i64, other: i64) -> i64 := { + (#_iOr returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_241]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for bool where [] := { + noir_def bitand<>(self: bool, other: bool) -> bool := { + (#_bAnd returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_242]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for u128 where [] := { + noir_def bitand<>(self: u128, other: u128) -> u128 := { + (#_uAnd returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_243]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for u64 where [] := { + noir_def bitand<>(self: u64, other: u64) -> u64 := { + (#_uAnd returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_244]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for u32 where [] := { + noir_def bitand<>(self: u32, other: u32) -> u32 := { + (#_uAnd returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_245]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for u16 where [] := { + noir_def bitand<>(self: u16, other: u16) -> u16 := { + (#_uAnd returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_246]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for u8 where [] := { + noir_def bitand<>(self: u8, other: u8) -> u8 := { + (#_uAnd returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_247]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for i8 where [] := { + noir_def bitand<>(self: i8, other: i8) -> i8 := { + (#_iAnd returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_248]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for i16 where [] := { + noir_def bitand<>(self: i16, other: i16) -> i16 := { + (#_iAnd returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_249]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for i32 where [] := { + noir_def bitand<>(self: i32, other: i32) -> i32 := { + (#_iAnd returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_250]<> «std-1.0.0-beta.25»::ops::bit::BitAnd<> for i64 where [] := { + noir_def bitand<>(self: i64, other: i64) -> i64 := { + (#_iAnd returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_251]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for bool where [] := { + noir_def bitxor<>(self: bool, other: bool) -> bool := { + (#_bXor returning bool)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_252]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for u128 where [] := { + noir_def bitxor<>(self: u128, other: u128) -> u128 := { + (#_uXor returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_253]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for u64 where [] := { + noir_def bitxor<>(self: u64, other: u64) -> u64 := { + (#_uXor returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_254]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for u32 where [] := { + noir_def bitxor<>(self: u32, other: u32) -> u32 := { + (#_uXor returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_255]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for u16 where [] := { + noir_def bitxor<>(self: u16, other: u16) -> u16 := { + (#_uXor returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_256]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for u8 where [] := { + noir_def bitxor<>(self: u8, other: u8) -> u8 := { + (#_uXor returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_257]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for i8 where [] := { + noir_def bitxor<>(self: i8, other: i8) -> i8 := { + (#_iXor returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_258]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for i16 where [] := { + noir_def bitxor<>(self: i16, other: i16) -> i16 := { + (#_iXor returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_259]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for i32 where [] := { + noir_def bitxor<>(self: i32, other: i32) -> i32 := { + (#_iXor returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_260]<> «std-1.0.0-beta.25»::ops::bit::BitXor<> for i64 where [] := { + noir_def bitxor<>(self: i64, other: i64) -> i64 := { + (#_iXor returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_261]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for u128 where [] := { + noir_def shl<>(self: u128, other: u128) -> u128 := { + (#_uShl returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_262]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for u64 where [] := { + noir_def shl<>(self: u64, other: u64) -> u64 := { + (#_uShl returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_263]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for u32 where [] := { + noir_def shl<>(self: u32, other: u32) -> u32 := { + (#_uShl returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_264]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for u16 where [] := { + noir_def shl<>(self: u16, other: u16) -> u16 := { + (#_uShl returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_265]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for u8 where [] := { + noir_def shl<>(self: u8, other: u8) -> u8 := { + (#_uShl returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_266]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for i8 where [] := { + noir_def shl<>(self: i8, other: i8) -> i8 := { + (#_iShl returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_267]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for i16 where [] := { + noir_def shl<>(self: i16, other: i16) -> i16 := { + (#_iShl returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_268]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for i32 where [] := { + noir_def shl<>(self: i32, other: i32) -> i32 := { + (#_iShl returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_269]<> «std-1.0.0-beta.25»::ops::bit::Shl<> for i64 where [] := { + noir_def shl<>(self: i64, other: i64) -> i64 := { + (#_iShl returning i64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_270]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for u128 where [] := { + noir_def shr<>(self: u128, other: u128) -> u128 := { + (#_uShr returning u128)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_271]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for u64 where [] := { + noir_def shr<>(self: u64, other: u64) -> u64 := { + (#_uShr returning u64)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_272]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for u32 where [] := { + noir_def shr<>(self: u32, other: u32) -> u32 := { + (#_uShr returning u32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_273]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for u16 where [] := { + noir_def shr<>(self: u16, other: u16) -> u16 := { + (#_uShr returning u16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_274]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for u8 where [] := { + noir_def shr<>(self: u8, other: u8) -> u8 := { + (#_uShr returning u8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_275]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for i8 where [] := { + noir_def shr<>(self: i8, other: i8) -> i8 := { + (#_iShr returning i8)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_276]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for i16 where [] := { + noir_def shr<>(self: i16, other: i16) -> i16 := { + (#_iShr returning i16)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_277]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for i32 where [] := { + noir_def shr<>(self: i32, other: i32) -> i32 := { + (#_iShr returning i32)(self, other) + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_278]<> «std-1.0.0-beta.25»::ops::bit::Shr<> for i64 where [] := { + noir_def shr<>(self: i64, other: i64) -> i64 := { + (#_iShr returning i64)(self, other) + }; +} + +noir_def «std-1.0.0-beta.25»::ops::bit::tests::not<>() -> Unit := { + (#_assert returning Unit)((#_bEq returning bool)(((bool as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(bool) -> bool)(#_false), #_true)); + (#_assert returning Unit)((#_bEq returning bool)(((bool as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(bool) -> bool)(#_true), #_false)); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(u8) -> u8)((0: u8)), (255: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(u16) -> u16)((0: u16)), (65535: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(u32) -> u32)((0: u32)), (4294967295: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(u64) -> u64)((0: u64)), (18446744073709551615: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(u128) -> u128)((0: u128)), (340282366920938463463374607431768211455: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(i8) -> i8)((0: i8)), (-1: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(i16) -> i16)((0: i16)), (-1: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(i32) -> i32)((0: i32)), (-1: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::bit::Not<>)::not<> as λ(i64) -> i64)((0: i64)), (-1: i64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::bit::tests::bitor<>() -> Unit := { + (#_assert returning Unit)((#_bEq returning bool)(((bool as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(bool, bool) -> bool)(#_true, #_false), #_true)); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(u8, u8) -> u8)((1: u8), (2: u8)), (3: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(u16, u16) -> u16)((1: u16), (2: u16)), (3: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(u32, u32) -> u32)((1: u32), (2: u32)), (3: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(u64, u64) -> u64)((1: u64), (2: u64)), (3: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(u128, u128) -> u128)((1: u128), (2: u128)), (3: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(i8, i8) -> i8)((1: i8), (2: i8)), (3: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(i16, i16) -> i16)((1: i16), (2: i16)), (3: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(i32, i32) -> i32)((1: i32), (2: i32)), (3: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::bit::BitOr<>)::bitor<> as λ(i64, i64) -> i64)((1: i64), (2: i64)), (3: i64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::bit::tests::bitand<>() -> Unit := { + (#_assert returning Unit)((#_bEq returning bool)(((bool as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(bool, bool) -> bool)(#_true, #_false), #_false)); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(u8, u8) -> u8)((3: u8), (5: u8)), (1: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(u16, u16) -> u16)((3: u16), (5: u16)), (1: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(u32, u32) -> u32)((3: u32), (5: u32)), (1: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(u64, u64) -> u64)((3: u64), (5: u64)), (1: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(u128, u128) -> u128)((3: u128), (5: u128)), (1: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(i8, i8) -> i8)((3: i8), (5: i8)), (1: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(i16, i16) -> i16)((3: i16), (5: i16)), (1: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(i32, i32) -> i32)((3: i32), (5: i32)), (1: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::bit::BitAnd<>)::bitand<> as λ(i64, i64) -> i64)((3: i64), (5: i64)), (1: i64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::bit::tests::bitxor<>() -> Unit := { + (#_assert returning Unit)((#_bEq returning bool)(((bool as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(bool, bool) -> bool)(#_true, #_false), #_true)); + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(u8, u8) -> u8)((3: u8), (5: u8)), (6: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(u16, u16) -> u16)((3: u16), (5: u16)), (6: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(u32, u32) -> u32)((3: u32), (5: u32)), (6: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(u64, u64) -> u64)((3: u64), (5: u64)), (6: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(u128, u128) -> u128)((3: u128), (5: u128)), (6: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(i8, i8) -> i8)((3: i8), (5: i8)), (6: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(i16, i16) -> i16)((3: i16), (5: i16)), (6: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(i32, i32) -> i32)((3: i32), (5: i32)), (6: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::bit::BitXor<>)::bitxor<> as λ(i64, i64) -> i64)((3: i64), (5: i64)), (6: i64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::bit::tests::shl<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(u8, u8) -> u8)((1: u8), (1: u8)), (2: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(u16, u16) -> u16)((1: u16), (1: u16)), (2: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(u32, u32) -> u32)((1: u32), (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(u64, u64) -> u64)((1: u64), (1: u64)), (2: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(u128, u128) -> u128)((1: u128), (1: u128)), (2: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(i8, i8) -> i8)((1: i8), (1: i8)), (2: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(i16, i16) -> i16)((1: i16), (1: i16)), (2: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(i32, i32) -> i32)((1: i32), (1: i32)), (2: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::bit::Shl<>)::shl<> as λ(i64, i64) -> i64)((1: i64), (1: i64)), (2: i64))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::ops::bit::tests::shr<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)(((u8 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(u8, u8) -> u8)((4: u8), (1: u8)), (2: u8))); + (#_assert returning Unit)((#_uEq returning bool)(((u16 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(u16, u16) -> u16)((4: u16), (1: u16)), (2: u16))); + (#_assert returning Unit)((#_uEq returning bool)(((u32 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(u32, u32) -> u32)((4: u32), (1: u32)), (2: u32))); + (#_assert returning Unit)((#_uEq returning bool)(((u64 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(u64, u64) -> u64)((4: u64), (1: u64)), (2: u64))); + (#_assert returning Unit)((#_uEq returning bool)(((u128 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(u128, u128) -> u128)((4: u128), (1: u128)), (2: u128))); + (#_assert returning Unit)((#_iEq returning bool)(((i8 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(i8, i8) -> i8)((4: i8), (1: i8)), (2: i8))); + (#_assert returning Unit)((#_iEq returning bool)(((i16 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(i16, i16) -> i16)((4: i16), (1: i16)), (2: i16))); + (#_assert returning Unit)((#_iEq returning bool)(((i32 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(i32, i32) -> i32)((4: i32), (1: i32)), (2: i32))); + (#_assert returning Unit)((#_iEq returning bool)(((i64 as «std-1.0.0-beta.25»::ops::bit::Shr<>)::shr<> as λ(i64, i64) -> i64)((4: i64), (1: i64)), (2: i64))); + #_skip +} + +def «std-1.0.0-beta.25».Ops.Bit.env : Env := Env.mk + [«std-1.0.0-beta.25::ops::bit::tests::not», «std-1.0.0-beta.25::ops::bit::tests::bitor», «std-1.0.0-beta.25::ops::bit::tests::bitand», «std-1.0.0-beta.25::ops::bit::tests::bitxor», «std-1.0.0-beta.25::ops::bit::tests::shl», «std-1.0.0-beta.25::ops::bit::tests::shr»] + [«std-1.0.0-beta.25».impl_221, «std-1.0.0-beta.25».impl_222, «std-1.0.0-beta.25».impl_223, «std-1.0.0-beta.25».impl_224, «std-1.0.0-beta.25».impl_225, «std-1.0.0-beta.25».impl_226, «std-1.0.0-beta.25».impl_227, «std-1.0.0-beta.25».impl_228, «std-1.0.0-beta.25».impl_229, «std-1.0.0-beta.25».impl_230, «std-1.0.0-beta.25».impl_231, «std-1.0.0-beta.25».impl_232, «std-1.0.0-beta.25».impl_233, «std-1.0.0-beta.25».impl_234, «std-1.0.0-beta.25».impl_235, «std-1.0.0-beta.25».impl_236, «std-1.0.0-beta.25».impl_237, «std-1.0.0-beta.25».impl_238, «std-1.0.0-beta.25».impl_239, «std-1.0.0-beta.25».impl_240, «std-1.0.0-beta.25».impl_241, «std-1.0.0-beta.25».impl_242, «std-1.0.0-beta.25».impl_243, «std-1.0.0-beta.25».impl_244, «std-1.0.0-beta.25».impl_245, «std-1.0.0-beta.25».impl_246, «std-1.0.0-beta.25».impl_247, «std-1.0.0-beta.25».impl_248, «std-1.0.0-beta.25».impl_249, «std-1.0.0-beta.25».impl_250, «std-1.0.0-beta.25».impl_251, «std-1.0.0-beta.25».impl_252, «std-1.0.0-beta.25».impl_253, «std-1.0.0-beta.25».impl_254, «std-1.0.0-beta.25».impl_255, «std-1.0.0-beta.25».impl_256, «std-1.0.0-beta.25».impl_257, «std-1.0.0-beta.25».impl_258, «std-1.0.0-beta.25».impl_259, «std-1.0.0-beta.25».impl_260, «std-1.0.0-beta.25».impl_261, «std-1.0.0-beta.25».impl_262, «std-1.0.0-beta.25».impl_263, «std-1.0.0-beta.25».impl_264, «std-1.0.0-beta.25».impl_265, «std-1.0.0-beta.25».impl_266, «std-1.0.0-beta.25».impl_267, «std-1.0.0-beta.25».impl_268, «std-1.0.0-beta.25».impl_269, «std-1.0.0-beta.25».impl_270, «std-1.0.0-beta.25».impl_271, «std-1.0.0-beta.25».impl_272, «std-1.0.0-beta.25».impl_273, «std-1.0.0-beta.25».impl_274, «std-1.0.0-beta.25».impl_275, «std-1.0.0-beta.25».impl_276, «std-1.0.0-beta.25».impl_277, «std-1.0.0-beta.25».impl_278] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Mod.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Mod.lean new file mode 100644 index 00000000..9bf9f82c --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Ops/Mod.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Ops.Mod.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Option.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Option.lean new file mode 100644 index 00000000..d3c8adc2 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Option.lean @@ -0,0 +1,334 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::option::Option::none() -> «std-1.0.0-beta.25»::option::Option := { + (#_makeData returning «std-1.0.0-beta.25»::option::Option)(#_false, (#_zeroed returning T)()) +} + +noir_def «std-1.0.0-beta.25»::option::Option::some(_value: T) -> «std-1.0.0-beta.25»::option::Option := { + (#_makeData returning «std-1.0.0-beta.25»::option::Option)(#_true, _value) +} + +noir_def «std-1.0.0-beta.25»::option::Option::is_none(self: & «std-1.0.0-beta.25»::option::Option) -> bool := { + (#_bNot returning bool)((#_readRef returning «std-1.0.0-beta.25»::option::Option)(self).0) +} + +noir_def «std-1.0.0-beta.25»::option::Option::is_some(self: & «std-1.0.0-beta.25»::option::Option) -> bool := { + (#_readRef returning «std-1.0.0-beta.25»::option::Option)(self).0 +} + +noir_def «std-1.0.0-beta.25»::option::Option::unwrap(self: «std-1.0.0-beta.25»::option::Option) -> T := { + (#_assert returning Unit)(self.0); + self.1 +} + +noir_def «std-1.0.0-beta.25»::option::Option::unwrap_unchecked(self: «std-1.0.0-beta.25»::option::Option) -> T := { + self.1 +} + +noir_def «std-1.0.0-beta.25»::option::Option::unwrap_or(self: «std-1.0.0-beta.25»::option::Option, default: T) -> T := { + if self.0 then { + self.1 + } else { + default + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::unwrap_or_else(self: «std-1.0.0-beta.25»::option::Option, default: λ() -> T) -> T := { + if self.0 then { + self.1 + } else { + (default as λ() -> T)() + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::expect(self: «std-1.0.0-beta.25»::option::Option, message: FmtString) -> T := { + (#_assert returning Unit)((«std-1.0.0-beta.25»::option::Option::is_some as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)(self))); + self.1 +} + +noir_def «std-1.0.0-beta.25»::option::Option::map(self: «std-1.0.0-beta.25»::option::Option, f: λ(T) -> U) -> «std-1.0.0-beta.25»::option::Option := { + if self.0 then { + («std-1.0.0-beta.25»::option::Option::some as λ(U) -> «std-1.0.0-beta.25»::option::Option)((f as λ(T) -> U)(self.1)) + } else { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::map_or(self: «std-1.0.0-beta.25»::option::Option, default: U, f: λ(T) -> U) -> U := { + if self.0 then { + (f as λ(T) -> U)(self.1) + } else { + default + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::map_or_else(self: «std-1.0.0-beta.25»::option::Option, default: λ() -> U, f: λ(T) -> U) -> U := { + if self.0 then { + (f as λ(T) -> U)(self.1) + } else { + (default as λ() -> U)() + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::and(self: «std-1.0.0-beta.25»::option::Option, other: «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option := { + if («std-1.0.0-beta.25»::option::Option::is_none as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)(self)) then { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } else { + other + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::and_then(self: «std-1.0.0-beta.25»::option::Option, f: λ(T) -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option := { + if self.0 then { + (f as λ(T) -> «std-1.0.0-beta.25»::option::Option)(self.1) + } else { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::or(self: «std-1.0.0-beta.25»::option::Option, other: «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option := { + if self.0 then { + self + } else { + other + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::or_else(self: «std-1.0.0-beta.25»::option::Option, default: λ() -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option := { + if self.0 then { + self + } else { + (default as λ() -> «std-1.0.0-beta.25»::option::Option)() + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::xor(self: «std-1.0.0-beta.25»::option::Option, other: «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option := { + if self.0 then { + if other.0 then { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } else { + self + } + } else if other.0 then { + other + } else { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::filter(self: «std-1.0.0-beta.25»::option::Option, predicate: λ(T) -> bool) -> «std-1.0.0-beta.25»::option::Option := { + if self.0 then { + if (predicate as λ(T) -> bool)(self.1) then { + self + } else { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } + } else { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } +} + +noir_def «std-1.0.0-beta.25»::option::Option::flatten(option: «std-1.0.0-beta.25»::option::Option<«std-1.0.0-beta.25»::option::Option >) -> «std-1.0.0-beta.25»::option::Option := { + if option.0 then { + option.1 + } else { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + } +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_79] «std-1.0.0-beta.25»::default::Default<> for «std-1.0.0-beta.25»::option::Option where [] := { + noir_def default<>() -> «std-1.0.0-beta.25»::option::Option := { + («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)() + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_80] «std-1.0.0-beta.25»::cmp::Eq<> for «std-1.0.0-beta.25»::option::Option where [T: «std-1.0.0-beta.25»::cmp::Eq<>] := { + noir_def eq<>(self: «std-1.0.0-beta.25»::option::Option, other: «std-1.0.0-beta.25»::option::Option) -> bool := { + if (#_bEq returning bool)(self.0, other.0) then { + if self.0 then { + ((T as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)(self.1, other.1) + } else { + #_true + } + } else { + #_false + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_81] «std-1.0.0-beta.25»::hash::Hash<> for «std-1.0.0-beta.25»::option::Option where [T: «std-1.0.0-beta.25»::hash::Hash<>] := { + noir_def hash(self: «std-1.0.0-beta.25»::option::Option, state: & H) -> Unit := { + ((bool as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(bool, & H) -> Unit)(self.0, state); + if self.0 then { + ((T as «std-1.0.0-beta.25»::hash::Hash<>)::hash as λ(T, & H) -> Unit)(self.1, state); + #_skip + } + }; +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_82] «std-1.0.0-beta.25»::cmp::Ord<> for «std-1.0.0-beta.25»::option::Option where [T: «std-1.0.0-beta.25»::cmp::Ord<>] := { + noir_def cmp<>(self: «std-1.0.0-beta.25»::option::Option, other: «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::cmp::Ordering<> := { + if self.0 then { + if other.0 then { + ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(self.1, other.1) + } else { + («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + } else if other.0 then { + («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } else { + («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)() + } + }; +} + +noir_def «std-1.0.0-beta.25»::option::tests::some_and_none<>() -> Unit := { + (#_assert returning Unit)((«std-1.0.0-beta.25»::option::Option::is_none as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::option::Option::is_some as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())))); + (#_assert returning Unit)((«std-1.0.0-beta.25»::option::Option::is_some as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field))))); + (#_assert returning Unit)((#_bNot returning bool)((«std-1.0.0-beta.25»::option::Option::is_none as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::unwrap_succeeds<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::unwrap as λ(«std-1.0.0-beta.25»::option::Option) -> Field)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field))), (1: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::unwrap_fails<>() -> Unit := { + let __0 = («std-1.0.0-beta.25»::option::Option::unwrap as λ(«std-1.0.0-beta.25»::option::Option) -> u8)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::unwrap_or<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::unwrap_or as λ(«std-1.0.0-beta.25»::option::Option, Field) -> Field)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (2: Field)), (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::unwrap_or as λ(«std-1.0.0-beta.25»::option::Option, Field) -> Field)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (2: Field)), (2: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::unwrap_or_else<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::unwrap_or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> Field) -> Field)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(): Field := (2: Field))), (1: Field))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::unwrap_or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> Field) -> Field)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(): Field := (2: Field))), (2: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::expect_succeeds<>() -> Unit := { + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::expect as λ(«std-1.0.0-beta.25»::option::Option, FmtString<15: u32, Unit>) -> Field)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (#_mkFormatString returning FmtString<15: u32, Unit>)("Should be there")), (1: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::expect_fails<>() -> Unit := { + let __0 = («std-1.0.0-beta.25»::option::Option::expect as λ(«std-1.0.0-beta.25»::option::Option, FmtString<15: u32, Unit>) -> u8)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (#_mkFormatString returning FmtString<15: u32, Unit>)("Should be there")); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::map<>() -> Unit := { + (#_assert returning Unit)((«std-1.0.0-beta.25»::option::Option::is_none as λ(& «std-1.0.0-beta.25»::option::Option) -> bool)((#_ref returning & «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::map as λ(«std-1.0.0-beta.25»::option::Option, λ(u8) -> u8) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(x: u8): u8 := (#_uAdd returning u8)(x, (1: u8))))))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::map as λ(«std-1.0.0-beta.25»::option::Option, λ(Field) -> Field) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(x: Field): Field := (#_fAdd returning Field)(x, (1: Field)))), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((2: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::map_or<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::option::Option::map_or as λ(«std-1.0.0-beta.25»::option::Option, u8, λ(u8) -> u8) -> u8)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (0: u8), (fn(x: u8): u8 := (#_uAdd returning u8)(x, (1: u8)))), (0: u8))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::map_or as λ(«std-1.0.0-beta.25»::option::Option, Field, λ(Field) -> Field) -> Field)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (0: Field), (fn(x: Field): Field := (#_fAdd returning Field)(x, (1: Field)))), (2: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::map_or_else<>() -> Unit := { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::option::Option::map_or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> u8, λ(u8) -> u8) -> u8)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(): u8 := (0: u8)), (fn(x: u8): u8 := (#_uAdd returning u8)(x, (1: u8)))), (0: u8))); + (#_assert returning Unit)((#_fEq returning bool)((«std-1.0.0-beta.25»::option::Option::map_or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> Field, λ(Field) -> Field) -> Field)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(): Field := (0: Field)), (fn(x: Field): Field := (#_fAdd returning Field)(x, (1: Field)))), (2: Field))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::and<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8))), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((2: Field))), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((2: Field)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::and_then<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and_then as λ(«std-1.0.0-beta.25»::option::Option, λ(u8) -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(__0: u8): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and_then as λ(«std-1.0.0-beta.25»::option::Option, λ(u8) -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(__1: u8): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and_then as λ(«std-1.0.0-beta.25»::option::Option, λ(Field) -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(x: Field): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((#_fAdd returning Field)(x, (1: Field))))), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((2: Field)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::and_then as λ(«std-1.0.0-beta.25»::option::Option, λ(Field) -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(__3: Field): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::or<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8))), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((2: Field))), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::or_else<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)))), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((2: Field)))), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::or_else as λ(«std-1.0.0-beta.25»::option::Option, λ() -> «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(): «std-1.0.0-beta.25»::option::Option := («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::xor<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::xor as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::xor as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8))), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::xor as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((2: Field))), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::xor as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::filter<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::filter as λ(«std-1.0.0-beta.25»::option::Option, λ(u8) -> bool) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), (fn(__0: u8): bool := #_true)), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::filter as λ(«std-1.0.0-beta.25»::option::Option, λ(Field) -> bool) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(x: Field): bool := (#_fEq returning bool)(x, (1: Field)))), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::filter as λ(«std-1.0.0-beta.25»::option::Option, λ(Field) -> bool) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(x: Field): bool := (#_fEq returning bool)(x, (2: Field)))), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::filter as λ(«std-1.0.0-beta.25»::option::Option, λ(Field) -> bool) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)), (fn(x: Field): bool := (#_fEq returning bool)(x, (2: Field)))), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::flatten<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::flatten as λ(«std-1.0.0-beta.25»::option::Option<«std-1.0.0-beta.25»::option::Option >) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::none<«std-1.0.0-beta.25»::option::Option > as λ() -> «std-1.0.0-beta.25»::option::Option<«std-1.0.0-beta.25»::option::Option >)()), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::flatten as λ(«std-1.0.0-beta.25»::option::Option<«std-1.0.0-beta.25»::option::Option >) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some<«std-1.0.0-beta.25»::option::Option > as λ(«std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option<«std-1.0.0-beta.25»::option::Option >)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::flatten as λ(«std-1.0.0-beta.25»::option::Option<«std-1.0.0-beta.25»::option::Option >) -> «std-1.0.0-beta.25»::option::Option)((«std-1.0.0-beta.25»::option::Option::some<«std-1.0.0-beta.25»::option::Option > as λ(«std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::option::Option<«std-1.0.0-beta.25»::option::Option >)((«std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))), («std-1.0.0-beta.25»::option::Option::some as λ(Field) -> «std-1.0.0-beta.25»::option::Option)((1: Field)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::default<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::eq<>() -> Unit := { + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)())); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)), («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)()))); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8))))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)))); + (#_assert returning Unit)((#_bNot returning bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> bool)((«std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)), («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((2: u8))))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::option::tests::cmp<>() -> Unit := { + let none = («std-1.0.0-beta.25»::option::Option::none as λ() -> «std-1.0.0-beta.25»::option::Option)(); + let one = («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((1: u8)); + let two = («std-1.0.0-beta.25»::option::Option::some as λ(u8) -> «std-1.0.0-beta.25»::option::Option)((2: u8)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(none, none), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(none, one), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(one, none), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(one, one), («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(one, two), («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(((«std-1.0.0-beta.25»::option::Option as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(«std-1.0.0-beta.25»::option::Option, «std-1.0.0-beta.25»::option::Option) -> «std-1.0.0-beta.25»::cmp::Ordering<>)(two, one), («std-1.0.0-beta.25»::cmp::Ordering::greater<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)())); + #_skip +} + +def «std-1.0.0-beta.25».Option.env : Env := Env.mk + [«std-1.0.0-beta.25::option::Option::none», «std-1.0.0-beta.25::option::Option::some», «std-1.0.0-beta.25::option::Option::is_none», «std-1.0.0-beta.25::option::Option::is_some», «std-1.0.0-beta.25::option::Option::unwrap», «std-1.0.0-beta.25::option::Option::unwrap_unchecked», «std-1.0.0-beta.25::option::Option::unwrap_or», «std-1.0.0-beta.25::option::Option::unwrap_or_else», «std-1.0.0-beta.25::option::Option::expect», «std-1.0.0-beta.25::option::Option::map», «std-1.0.0-beta.25::option::Option::map_or», «std-1.0.0-beta.25::option::Option::map_or_else», «std-1.0.0-beta.25::option::Option::and», «std-1.0.0-beta.25::option::Option::and_then», «std-1.0.0-beta.25::option::Option::or», «std-1.0.0-beta.25::option::Option::or_else», «std-1.0.0-beta.25::option::Option::xor», «std-1.0.0-beta.25::option::Option::filter», «std-1.0.0-beta.25::option::Option::flatten», «std-1.0.0-beta.25::option::tests::some_and_none», «std-1.0.0-beta.25::option::tests::unwrap_succeeds», «std-1.0.0-beta.25::option::tests::unwrap_fails», «std-1.0.0-beta.25::option::tests::unwrap_or», «std-1.0.0-beta.25::option::tests::unwrap_or_else», «std-1.0.0-beta.25::option::tests::expect_succeeds», «std-1.0.0-beta.25::option::tests::expect_fails», «std-1.0.0-beta.25::option::tests::map», «std-1.0.0-beta.25::option::tests::map_or», «std-1.0.0-beta.25::option::tests::map_or_else», «std-1.0.0-beta.25::option::tests::and», «std-1.0.0-beta.25::option::tests::and_then», «std-1.0.0-beta.25::option::tests::or», «std-1.0.0-beta.25::option::tests::or_else», «std-1.0.0-beta.25::option::tests::xor», «std-1.0.0-beta.25::option::tests::filter», «std-1.0.0-beta.25::option::tests::flatten», «std-1.0.0-beta.25::option::tests::default», «std-1.0.0-beta.25::option::tests::eq», «std-1.0.0-beta.25::option::tests::cmp»] + [«std-1.0.0-beta.25».impl_79, «std-1.0.0-beta.25».impl_80, «std-1.0.0-beta.25».impl_81, «std-1.0.0-beta.25».impl_82] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Panic.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Panic.lean new file mode 100644 index 00000000..51766673 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Panic.lean @@ -0,0 +1,28 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::panic::panic(message: T) -> U := { + (#_assert returning Unit)(#_false); + (#_zeroed returning U)() +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_333] «std-1.0.0-beta.25»::panic::StringLike<> for String where [] := { +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_334] «std-1.0.0-beta.25»::panic::StringLike<> for FmtString where [] := { +} + +noir_def «std-1.0.0-beta.25»::panic::tests::panics<>() -> Unit := { + («std-1.0.0-beta.25»::panic::panic, Unit> as λ(String<5: u32>) -> Unit)("OH NO"); + #_skip +} + +def «std-1.0.0-beta.25».Panic.env : Env := Env.mk + [«std-1.0.0-beta.25::panic::panic», «std-1.0.0-beta.25::panic::tests::panics»] + [«std-1.0.0-beta.25».impl_333, «std-1.0.0-beta.25».impl_334] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Prelude.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Prelude.lean new file mode 100644 index 00000000..d07a9f2a --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Prelude.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Prelude.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/PrimitiveDocs.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/PrimitiveDocs.lean new file mode 100644 index 00000000..17a9b160 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/PrimitiveDocs.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».PrimitiveDocs.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Runtime.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Runtime.lean new file mode 100644 index 00000000..473b85d1 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Runtime.lean @@ -0,0 +1,12 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +def «std-1.0.0-beta.25».Runtime.env : Env := Env.mk + [] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/String.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/String.lean new file mode 100644 index 00000000..f6e7f999 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/String.lean @@ -0,0 +1,38 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::string::as_bytes_vec(self: String) -> Vector := { + (#_asVector returning Vector)((#_strAsBytes returning Array)(self)) +} + +noir_trait_impl[«std-1.0.0-beta.25».impl_83] «std-1.0.0-beta.25»::convert::From > for String where [] := { + noir_def «from»<>(bytes: Array) -> String := { + (#_arrayAsStrUnchecked returning String)(bytes) + }; +} + +noir_def «std-1.0.0-beta.25»::string::tests::as_bytes<>() -> Unit := { + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)((#_strAsBytes returning Array)("Noir"), (#_mkArray returning Array)((78: u8), (111: u8), (105: u8), (114: u8)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::string::tests::as_bytes_vec<>() -> Unit := { + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((«std-1.0.0-beta.25»::string::as_bytes_vec<4: u32> as λ(String<4: u32>) -> Vector)("Noir"), (#_mkVector returning Vector)((78: u8), (111: u8), (105: u8), (114: u8)))); + #_skip +} + +noir_def «std-1.0.0-beta.25»::string::tests::from_bytes<>() -> Unit := { + let str = ((String<4: u32> as «std-1.0.0-beta.25»::convert::From >)::«from»<> as λ(Array) -> String<4: u32>)((#_mkArray returning Array)((78: u8), (111: u8), (105: u8), (114: u8))); + (#_assert returning Unit)(((String<4: u32> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(String<4: u32>, String<4: u32>) -> bool)(str, "Noir")); + #_skip +} + +def «std-1.0.0-beta.25».String.env : Env := Env.mk + [«std-1.0.0-beta.25::string::as_bytes_vec», «std-1.0.0-beta.25::string::tests::as_bytes», «std-1.0.0-beta.25::string::tests::as_bytes_vec», «std-1.0.0-beta.25::string::tests::from_bytes»] + [«std-1.0.0-beta.25».impl_83] diff --git a/stdlib/lampe/std-1.0.0-beta.25/Extracted/Test.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Test.lean new file mode 100644 index 00000000..acaee9c9 --- /dev/null +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Test.lean @@ -0,0 +1,68 @@ +-- Generated by lampe + +import «std-1.0.0-beta.25».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «std-1.0.0-beta.25»::test::create_mock_oracle(name: String) -> Field := { + (#_fresh returning Field)() +} + +noir_def «std-1.0.0-beta.25»::test::set_mock_params_oracle(id: Field, params: P) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::test::get_mock_last_params_oracle(id: Field) -> P := { + (#_fresh returning P)() +} + +noir_def «std-1.0.0-beta.25»::test::set_mock_returns_oracle(id: Field, returns: R) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::test::set_mock_times_oracle<>(id: Field, times: u64) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::test::clear_mock_oracle<>(id: Field) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::test::get_times_mock_called<>(id: Field) -> Field := { + (#_fresh returning Field)() +} + +noir_def «std-1.0.0-beta.25»::test::OracleMock::mock(name: String) -> «std-1.0.0-beta.25»::test::OracleMock<> := { + (#_fresh returning «std-1.0.0-beta.25»::test::OracleMock<>)() +} + +noir_def «std-1.0.0-beta.25»::test::OracleMock::with_params(self: «std-1.0.0-beta.25»::test::OracleMock<>, params: P) -> «std-1.0.0-beta.25»::test::OracleMock<> := { + (#_fresh returning «std-1.0.0-beta.25»::test::OracleMock<>)() +} + +noir_def «std-1.0.0-beta.25»::test::OracleMock::get_last_params(self: «std-1.0.0-beta.25»::test::OracleMock<>) -> P := { + (#_fresh returning P)() +} + +noir_def «std-1.0.0-beta.25»::test::OracleMock::returns(self: «std-1.0.0-beta.25»::test::OracleMock<>, returns: R) -> «std-1.0.0-beta.25»::test::OracleMock<> := { + (#_fresh returning «std-1.0.0-beta.25»::test::OracleMock<>)() +} + +noir_def «std-1.0.0-beta.25»::test::OracleMock::times<>(self: «std-1.0.0-beta.25»::test::OracleMock<>, times: u64) -> «std-1.0.0-beta.25»::test::OracleMock<> := { + (#_fresh returning «std-1.0.0-beta.25»::test::OracleMock<>)() +} + +noir_def «std-1.0.0-beta.25»::test::OracleMock::clear<>(self: «std-1.0.0-beta.25»::test::OracleMock<>) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «std-1.0.0-beta.25»::test::OracleMock::times_called<>(self: «std-1.0.0-beta.25»::test::OracleMock<>) -> Field := { + (#_fresh returning Field)() +} + +def «std-1.0.0-beta.25».Test.env : Env := Env.mk + [«std-1.0.0-beta.25::test::create_mock_oracle», «std-1.0.0-beta.25::test::set_mock_params_oracle», «std-1.0.0-beta.25::test::get_mock_last_params_oracle», «std-1.0.0-beta.25::test::set_mock_returns_oracle», «std-1.0.0-beta.25::test::set_mock_times_oracle», «std-1.0.0-beta.25::test::clear_mock_oracle», «std-1.0.0-beta.25::test::get_times_mock_called», «std-1.0.0-beta.25::test::OracleMock::mock», «std-1.0.0-beta.25::test::OracleMock::with_params», «std-1.0.0-beta.25::test::OracleMock::get_last_params», «std-1.0.0-beta.25::test::OracleMock::returns», «std-1.0.0-beta.25::test::OracleMock::times», «std-1.0.0-beta.25::test::OracleMock::clear», «std-1.0.0-beta.25::test::OracleMock::times_called»] + [] diff --git a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Vector.lean b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Vector.lean similarity index 71% rename from stdlib/lampe/std-1.0.0-beta.14/Extracted/Vector.lean rename to stdlib/lampe/std-1.0.0-beta.25/Extracted/Vector.lean index 30ea01fc..14c30f7c 100644 --- a/stdlib/lampe/std-1.0.0-beta.14/Extracted/Vector.lean +++ b/stdlib/lampe/std-1.0.0-beta.25/Extracted/Vector.lean @@ -1,13 +1,13 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe set_option linter.unusedVariables false -noir_def «std-1.0.0-beta.14»::vector::append(self: Vector, other: Vector) -> Vector := { +noir_def «std-1.0.0-beta.25»::vector::append(self: Vector, other: Vector) -> Vector := { let self = (#_ref returning & Vector)(self); { { @@ -25,7 +25,7 @@ noir_def «std-1.0.0-beta.14»::vector::append(self: Vector, other: } } -noir_def «std-1.0.0-beta.14»::vector::as_array(self: Vector) -> Array := { +noir_def «std-1.0.0-beta.25»::vector::as_array(self: Vector) -> Array := { (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(self), uConst!(N: u32))); let array = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((#_zeroed returning T)())); for i in (0: u32) .. uConst!(N: u32) do { @@ -35,7 +35,7 @@ noir_def «std-1.0.0-beta.14»::vector::as_array(self: Vector)(array) } -noir_def «std-1.0.0-beta.14»::vector::map(self: Vector, f: λ(T) -> U) -> Vector := { +noir_def «std-1.0.0-beta.25»::vector::map(self: Vector, f: λ(T) -> U) -> Vector := { let ret = (#_ref returning & Vector)((#_asVector returning Vector)((#_mkArray returning Array)())); { let ζi0 = self; @@ -51,7 +51,7 @@ noir_def «std-1.0.0-beta.14»::vector::map(self: V (#_readRef returning Vector)(ret) } -noir_def «std-1.0.0-beta.14»::vector::mapi(self: Vector, f: λ(u32, T) -> U) -> Vector := { +noir_def «std-1.0.0-beta.25»::vector::mapi(self: Vector, f: λ(u32, T) -> U) -> Vector := { let ret = (#_ref returning & Vector)((#_asVector returning Vector)((#_mkArray returning Array)())); let index = (#_ref returning & u32)((0: u32)); { @@ -69,7 +69,7 @@ noir_def «std-1.0.0-beta.14»::vector::mapi(self: (#_readRef returning Vector)(ret) } -noir_def «std-1.0.0-beta.14»::vector::for_each(self: Vector, f: λ(T) -> Unit) -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::for_each(self: Vector, f: λ(T) -> Unit) -> Unit := { let ζi0 = self; for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { let elem = (#_vectorIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); @@ -81,7 +81,7 @@ noir_def «std-1.0.0-beta.14»::vector::for_each(self: Vecto #_skip } -noir_def «std-1.0.0-beta.14»::vector::for_eachi(self: Vector, f: λ(u32, T) -> Unit) -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::for_eachi(self: Vector, f: λ(u32, T) -> Unit) -> Unit := { let index = (#_ref returning & u32)((0: u32)); { let ζi0 = self; @@ -97,7 +97,7 @@ noir_def «std-1.0.0-beta.14»::vector::for_eachi(self: Vect } } -noir_def «std-1.0.0-beta.14»::vector::fold(self: Vector, accumulator: U, f: λ(U, T) -> U) -> U := { +noir_def «std-1.0.0-beta.25»::vector::fold(self: Vector, accumulator: U, f: λ(U, T) -> U) -> U := { let accumulator = (#_ref returning & U)(accumulator); { { @@ -115,7 +115,7 @@ noir_def «std-1.0.0-beta.14»::vector::fold(self: } } -noir_def «std-1.0.0-beta.14»::vector::reduce(self: Vector, f: λ(T, T) -> T) -> T := { +noir_def «std-1.0.0-beta.25»::vector::reduce(self: Vector, f: λ(T, T) -> T) -> T := { let accumulator = (#_ref returning & T)((#_vectorIndex returning T)(self, (0: u32))); for i in (1: u32) .. (#_arrayLen returning u32)(self) do { accumulator = (f as λ(T, T) -> T)((#_readRef returning T)(accumulator), (#_vectorIndex returning T)(self, (#_cast returning u32)(i))); @@ -124,7 +124,7 @@ noir_def «std-1.0.0-beta.14»::vector::reduce(self: Vector< (#_readRef returning T)(accumulator) } -noir_def «std-1.0.0-beta.14»::vector::filter(self: Vector, predicate: λ(T) -> bool) -> Vector := { +noir_def «std-1.0.0-beta.25»::vector::filter(self: Vector, predicate: λ(T) -> bool) -> Vector := { let ret = (#_ref returning & Vector)((#_asVector returning Vector)((#_mkArray returning Array)())); { let ζi0 = self; @@ -142,12 +142,12 @@ noir_def «std-1.0.0-beta.14»::vector::filter(self: Vector< (#_readRef returning Vector)(ret) } -noir_def «std-1.0.0-beta.14»::vector::join(self: Vector, separator: T) -> T := { - let ret = (#_ref returning & T)(((T as «std-1.0.0-beta.14»::append::Append<>)::empty<> as λ() -> T)()); +noir_def «std-1.0.0-beta.25»::vector::join(self: Vector, separator: T) -> T := { + let ret = (#_ref returning & T)(((T as «std-1.0.0-beta.25»::append::Append<>)::empty<> as λ() -> T)()); if (#_uNeq returning bool)((#_arrayLen returning u32)(self), (0: u32)) then { ret = (#_vectorIndex returning T)(self, (0: u32)); for i in (1: u32) .. (#_arrayLen returning u32)(self) do { - ret = ((T as «std-1.0.0-beta.14»::append::Append<>)::append<> as λ(T, T) -> T)(((T as «std-1.0.0-beta.14»::append::Append<>)::append<> as λ(T, T) -> T)((#_readRef returning T)(ret), separator), (#_vectorIndex returning T)(self, (#_cast returning u32)(i))); + ret = ((T as «std-1.0.0-beta.25»::append::Append<>)::append<> as λ(T, T) -> T)(((T as «std-1.0.0-beta.25»::append::Append<>)::append<> as λ(T, T) -> T)((#_readRef returning T)(ret), separator), (#_vectorIndex returning T)(self, (#_cast returning u32)(i))); #_skip }; #_skip @@ -155,14 +155,15 @@ noir_def «std-1.0.0-beta.14»::vector::join(self: Vector, separator (#_readRef returning T)(ret) } -noir_def «std-1.0.0-beta.14»::vector::«all»(self: Vector, predicate: λ(T) -> bool) -> bool := { +noir_def «std-1.0.0-beta.25»::vector::«all»(self: Vector, predicate: λ(T) -> bool) -> bool := { let ret = (#_ref returning & bool)(#_true); { let ζi0 = self; for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { let elem = (#_vectorIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); { - ret = (#_bAnd returning bool)((#_readRef returning bool)(ret), (predicate as λ(T) -> bool)(elem)); + let op_rhs_0 = (predicate as λ(T) -> bool)(elem); + ret = (#_bAnd returning bool)((#_readRef returning bool)(ret), op_rhs_0); #_skip } }; @@ -171,14 +172,15 @@ noir_def «std-1.0.0-beta.14»::vector::«all»(self: Vector (#_readRef returning bool)(ret) } -noir_def «std-1.0.0-beta.14»::vector::any(self: Vector, predicate: λ(T) -> bool) -> bool := { +noir_def «std-1.0.0-beta.25»::vector::any(self: Vector, predicate: λ(T) -> bool) -> bool := { let ret = (#_ref returning & bool)(#_false); { let ζi0 = self; for ζi1 in (0: u32) .. (#_arrayLen returning u32)(ζi0) do { let elem = (#_vectorIndex returning T)(ζi0, (#_cast returning u32)(ζi1)); { - ret = (#_bOr returning bool)((#_readRef returning bool)(ret), (predicate as λ(T) -> bool)(elem)); + let op_rhs_0 = (predicate as λ(T) -> bool)(elem); + ret = (#_bOr returning bool)((#_readRef returning bool)(ret), op_rhs_0); #_skip } }; @@ -187,87 +189,87 @@ noir_def «std-1.0.0-beta.14»::vector::any(self: Vector, (#_readRef returning bool)(ret) } -noir_def «std-1.0.0-beta.14»::vector::test::map_empty<>() -> Unit := { - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((«std-1.0.0-beta.14»::vector::map as λ(Vector, λ(Field) -> Field) -> Vector)((#_asVector returning Vector)((#_mkArray returning Array)()), (fn(x: Field): Field := (#_fAdd returning Field)(x, (1: Field)))), (#_asVector returning Vector)((#_mkArray returning Array)()))); +noir_def «std-1.0.0-beta.25»::vector::test::map_empty<>() -> Unit := { + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((«std-1.0.0-beta.25»::vector::map as λ(Vector, λ(Field) -> Field) -> Vector)((#_asVector returning Vector)((#_mkArray returning Array)()), (fn(x: Field): Field := (#_fAdd returning Field)(x, (1: Field)))), (#_asVector returning Vector)((#_mkArray returning Array)()))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::mapi_empty<>() -> Unit := { - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((«std-1.0.0-beta.14»::vector::mapi as λ(Vector, λ(u32, u32) -> u32) -> Vector)((#_asVector returning Vector)((#_mkArray returning Array)()), (fn(i: u32, x: u32): u32 := (#_uAdd returning u32)((#_uMul returning u32)(i, x), (1: u32)))), (#_asVector returning Vector)((#_mkArray returning Array)()))); +noir_def «std-1.0.0-beta.25»::vector::test::mapi_empty<>() -> Unit := { + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((«std-1.0.0-beta.25»::vector::mapi as λ(Vector, λ(u32, u32) -> u32) -> Vector)((#_asVector returning Vector)((#_mkArray returning Array)()), (fn(i: u32, x: u32): u32 := (#_uAdd returning u32)((#_uMul returning u32)(i, x), (1: u32)))), (#_asVector returning Vector)((#_mkArray returning Array)()))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::for_each_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::for_each_empty<>() -> Unit := { let empty_vector = (#_asVector returning Vector)((#_mkArray returning Array)()); - («std-1.0.0-beta.14»::vector::for_each as λ(Vector, λ(Field) -> Unit) -> Unit)(empty_vector, (fn(_x: Field): Unit := (#_assert returning Unit)(#_false))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(empty_vector, (#_asVector returning Vector)((#_mkArray returning Array)()))); + («std-1.0.0-beta.25»::vector::for_each as λ(Vector, λ(Field) -> Unit) -> Unit)(empty_vector, (fn(_x: Field): Unit := (#_assert returning Unit)(#_false))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(empty_vector, (#_asVector returning Vector)((#_mkArray returning Array)()))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::for_eachi_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::for_eachi_empty<>() -> Unit := { let empty_vector = (#_asVector returning Vector)((#_mkArray returning Array)()); - («std-1.0.0-beta.14»::vector::for_eachi as λ(Vector, λ(u32, Field) -> Unit) -> Unit)(empty_vector, (fn(_i: u32, _x: Field): Unit := (#_assert returning Unit)(#_false))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(empty_vector, (#_asVector returning Vector)((#_mkArray returning Array)()))); + («std-1.0.0-beta.25»::vector::for_eachi as λ(Vector, λ(u32, Field) -> Unit) -> Unit)(empty_vector, (fn(_i: u32, _x: Field): Unit := (#_assert returning Unit)(#_false))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(empty_vector, (#_asVector returning Vector)((#_mkArray returning Array)()))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::map_example<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::map_example<>() -> Unit := { let a = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); - let b = («std-1.0.0-beta.14»::vector::map as λ(Vector, λ(Field) -> Field) -> Vector)(a, (fn(a: Field): Field := (#_fMul returning Field)(a, (2: Field)))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(b, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field))))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(a, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))))); + let b = («std-1.0.0-beta.25»::vector::map as λ(Vector, λ(Field) -> Field) -> Vector)(a, (fn(a: Field): Field := (#_fMul returning Field)(a, (2: Field)))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(b, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(a, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::mapi_example<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::mapi_example<>() -> Unit := { let a = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); - let b = («std-1.0.0-beta.14»::vector::mapi as λ(Vector, λ(u32, u32) -> u32) -> Vector)(a, (fn(i: u32, a: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(a, (2: u32))))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(b, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32))))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(a, (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))))); + let b = («std-1.0.0-beta.25»::vector::mapi as λ(Vector, λ(u32, u32) -> u32) -> Vector)(a, (fn(i: u32, a: u32): u32 := (#_uAdd returning u32)(i, (#_uMul returning u32)(a, (2: u32))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(b, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(a, (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::for_each_example<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::for_each_example<>() -> Unit := { let a = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let b = (#_ref returning & Vector)((#_asVector returning Vector)((#_mkArray returning Array)())); let b_ref = b; - («std-1.0.0-beta.14»::vector::for_each > > as λ(Vector, λ(Field) -> Unit) -> Unit)(a, (fn(a: Field): Unit := { + («std-1.0.0-beta.25»::vector::for_each > > as λ(Vector, λ(Field) -> Unit) -> Unit)(a, (fn(a: Field): Unit := { (*b_ref: Vector) = (#_vectorPushBack returning Vector)((#_readRef returning Vector)(b_ref), (#_fMul returning Field)(a, (2: Field))); #_skip })); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning Vector)(b), (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning Vector)(b), (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (4: Field), (6: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::for_eachi_example<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::for_eachi_example<>() -> Unit := { let a = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32))); let b = (#_ref returning & Vector)((#_asVector returning Vector)((#_mkArray returning Array)())); let b_ref = b; - («std-1.0.0-beta.14»::vector::for_eachi > > as λ(Vector, λ(u32, u32) -> Unit) -> Unit)(a, (fn(i: u32, a: u32): Unit := { + («std-1.0.0-beta.25»::vector::for_eachi > > as λ(Vector, λ(u32, u32) -> Unit) -> Unit)(a, (fn(i: u32, a: u32): Unit := { (*b_ref: Vector) = (#_vectorPushBack returning Vector)((#_readRef returning Vector)(b_ref), (#_uAdd returning u32)(i, (#_uMul returning u32)(a, (2: u32)))); #_skip })); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning Vector)(b), (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)((#_readRef returning Vector)(b), (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (5: u32), (8: u32))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::len_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::len_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(empty), (0: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::len_single<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::len_single<>() -> Unit := { (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_asVector returning Vector)((#_mkArray returning Array)((42: Field)))), (1: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::len_multiple<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::len_multiple<>() -> Unit := { (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)((#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field)))), (5: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::push_back_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::push_back_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); let result = (#_vectorPushBack returning Vector)(empty, (42: Field)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (1: u32))); @@ -275,15 +277,15 @@ noir_def «std-1.0.0-beta.14»::vector::test::push_back_empty<>() -> Unit := { #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::push_back_non_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::push_back_non_empty<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let result = (#_vectorPushBack returning Vector)(vector, (4: Field)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (4: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::push_front_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::push_front_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); let result = (#_vectorPushFront returning Vector)(empty, (42: Field)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (1: u32))); @@ -291,21 +293,21 @@ noir_def «std-1.0.0-beta.14»::vector::test::push_front_empty<>() -> Unit := { #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::push_front_non_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::push_front_non_empty<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let result = (#_vectorPushFront returning Vector)(vector, (0: Field)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (4: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::pop_back_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::pop_back_empty<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)()); let (__0, __1) = (#_vectorPopBack returning Tuple, Field>)(vector); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::pop_back_one<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::pop_back_one<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((42: Field))); let (result, elem) = (#_vectorPopBack returning Tuple, Field>)(vector); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (0: u32))); @@ -313,22 +315,22 @@ noir_def «std-1.0.0-beta.14»::vector::test::pop_back_one<>() -> Unit := { #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::pop_back_multiple<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::pop_back_multiple<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let (result, elem) = (#_vectorPopBack returning Tuple, Field>)(vector); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (2: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))))); (#_assert returning Unit)((#_fEq returning bool)(elem, (3: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::pop_front_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::pop_front_empty<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)()); let (__0, __1) = (#_vectorPopFront returning Tuple >)(vector); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::pop_front_one<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::pop_front_one<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((42: Field))); let (elem, result) = (#_vectorPopFront returning Tuple >)(vector); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (0: u32))); @@ -336,266 +338,266 @@ noir_def «std-1.0.0-beta.14»::vector::test::pop_front_one<>() -> Unit := { #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::pop_front_multiple<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::pop_front_multiple<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let (elem, result) = (#_vectorPopFront returning Tuple >)(vector); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (2: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (3: Field))))); (#_assert returning Unit)((#_fEq returning bool)(elem, (1: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::insert_beginning<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::insert_beginning<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let result = (#_vectorInsert returning Vector)(vector, (0: u32), (0: Field)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (4: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::insert_middle<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::insert_middle<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let result = (#_vectorInsert returning Vector)(vector, (1: u32), (99: Field)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (4: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (99: Field), (2: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (99: Field), (2: Field), (3: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::insert_end<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::insert_end<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let result = (#_vectorInsert returning Vector)(vector, (3: u32), (4: Field)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (4: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::insert_end_out_of_bounds<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::insert_end_out_of_bounds<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))); let __0 = (#_vectorInsert returning Vector)(vector, (3: u32), (4: Field)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::remove_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::remove_empty<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)()); let (__0, __1) = (#_vectorRemove returning Tuple, Field>)(vector, (0: u32)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::remove_beginning<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::remove_beginning<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let (result, elem) = (#_vectorRemove returning Tuple, Field>)(vector, (0: u32)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (2: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (3: Field))))); (#_assert returning Unit)((#_fEq returning bool)(elem, (1: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::remove_middle<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::remove_middle<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let (result, elem) = (#_vectorRemove returning Tuple, Field>)(vector, (1: u32)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (2: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (3: Field))))); (#_assert returning Unit)((#_fEq returning bool)(elem, (2: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::remove_end<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::remove_end<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let (result, elem) = (#_vectorRemove returning Tuple, Field>)(vector, (2: u32)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (2: u32))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))))); (#_assert returning Unit)((#_fEq returning bool)(elem, (3: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::remove_end_out_of_bounds<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::remove_end_out_of_bounds<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))); let (__0, __1) = (#_vectorRemove returning Tuple, Field>)(vector, (2: u32)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::fold_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::fold_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); - let result = («std-1.0.0-beta.14»::vector::fold as λ(Vector, Field, λ(Field, Field) -> Field) -> Field)(empty, (10: Field), (fn(acc: Field, x: Field): Field := (#_fAdd returning Field)(acc, x))); + let result = («std-1.0.0-beta.25»::vector::fold as λ(Vector, Field, λ(Field, Field) -> Field) -> Field)(empty, (10: Field), (fn(acc: Field, x: Field): Field := (#_fAdd returning Field)(acc, x))); (#_assert returning Unit)((#_fEq returning bool)(result, (10: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::fold_single<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::fold_single<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((5: Field))); - let result = («std-1.0.0-beta.14»::vector::fold as λ(Vector, Field, λ(Field, Field) -> Field) -> Field)(vector, (10: Field), (fn(acc: Field, x: Field): Field := (#_fAdd returning Field)(acc, x))); + let result = («std-1.0.0-beta.25»::vector::fold as λ(Vector, Field, λ(Field, Field) -> Field) -> Field)(vector, (10: Field), (fn(acc: Field, x: Field): Field := (#_fAdd returning Field)(acc, x))); (#_assert returning Unit)((#_fEq returning bool)(result, (15: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::fold_multiple<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::fold_multiple<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))); - let result = («std-1.0.0-beta.14»::vector::fold as λ(Vector, Field, λ(Field, Field) -> Field) -> Field)(vector, (0: Field), (fn(acc: Field, x: Field): Field := (#_fAdd returning Field)(acc, x))); + let result = («std-1.0.0-beta.25»::vector::fold as λ(Vector, Field, λ(Field, Field) -> Field) -> Field)(vector, (0: Field), (fn(acc: Field, x: Field): Field := (#_fAdd returning Field)(acc, x))); (#_assert returning Unit)((#_fEq returning bool)(result, (10: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::reduce_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::reduce_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); - let __0 = («std-1.0.0-beta.14»::vector::reduce as λ(Vector, λ(Field, Field) -> Field) -> Field)(empty, (fn(a: Field, b: Field): Field := (#_fAdd returning Field)(a, b))); + let __0 = («std-1.0.0-beta.25»::vector::reduce as λ(Vector, λ(Field, Field) -> Field) -> Field)(empty, (fn(a: Field, b: Field): Field := (#_fAdd returning Field)(a, b))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::reduce_single<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::reduce_single<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((42: Field))); - let result = («std-1.0.0-beta.14»::vector::reduce as λ(Vector, λ(Field, Field) -> Field) -> Field)(vector, (fn(a: Field, b: Field): Field := (#_fAdd returning Field)(a, b))); + let result = («std-1.0.0-beta.25»::vector::reduce as λ(Vector, λ(Field, Field) -> Field) -> Field)(vector, (fn(a: Field, b: Field): Field := (#_fAdd returning Field)(a, b))); (#_assert returning Unit)((#_fEq returning bool)(result, (42: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::reduce_multiple<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::reduce_multiple<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))); - let result = («std-1.0.0-beta.14»::vector::reduce as λ(Vector, λ(Field, Field) -> Field) -> Field)(vector, (fn(a: Field, b: Field): Field := (#_fAdd returning Field)(a, b))); + let result = («std-1.0.0-beta.25»::vector::reduce as λ(Vector, λ(Field, Field) -> Field) -> Field)(vector, (fn(a: Field, b: Field): Field := (#_fAdd returning Field)(a, b))); (#_assert returning Unit)((#_fEq returning bool)(result, (10: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::filter_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::filter_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); - let result = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(empty, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); + let result = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(empty, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (0: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::filter_all_true<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::filter_all_true<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, vector)); + let result = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, vector)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::filter_all_false<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::filter_all_false<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (10: u32)))); + let result = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (10: u32)))); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (0: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::filter_some<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::filter_some<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); - let result = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (4: u32))))); + let result = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((2: u32), (4: u32))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::all_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::all_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); - let result = («std-1.0.0-beta.14»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(empty, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); + let result = («std-1.0.0-beta.25»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(empty, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); (#_assert returning Unit)((#_bEq returning bool)(result, #_true)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::all_true<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::all_true<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); + let result = («std-1.0.0-beta.25»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); (#_assert returning Unit)((#_bEq returning bool)(result, #_true)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::all_false<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::all_false<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (2: u32)))); + let result = («std-1.0.0-beta.25»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (2: u32)))); (#_assert returning Unit)((#_bEq returning bool)(result, #_false)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::any_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::any_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); - let result = («std-1.0.0-beta.14»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(empty, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); + let result = («std-1.0.0-beta.25»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(empty, (fn(x: u32): bool := (#_uGt returning bool)(x, (0: u32)))); (#_assert returning Unit)((#_bEq returning bool)(result, #_false)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::any_true<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::any_true<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (3: u32)))); + let result = («std-1.0.0-beta.25»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (3: u32)))); (#_assert returning Unit)((#_bEq returning bool)(result, #_true)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::any_false<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::any_false<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let result = («std-1.0.0-beta.14»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (10: u32)))); + let result = («std-1.0.0-beta.25»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (10: u32)))); (#_assert returning Unit)((#_bEq returning bool)(result, #_false)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::append_empty_to_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::append_empty_to_empty<>() -> Unit := { let empty1 = (#_asVector returning Vector)((#_mkArray returning Array)()); let empty2 = (#_asVector returning Vector)((#_mkArray returning Array)()); - let result = («std-1.0.0-beta.14»::vector::append as λ(Vector, Vector) -> Vector)(empty1, empty2); + let result = («std-1.0.0-beta.25»::vector::append as λ(Vector, Vector) -> Vector)(empty1, empty2); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(result), (0: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::append_empty_to_non_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::append_empty_to_non_empty<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); - let result = («std-1.0.0-beta.14»::vector::append as λ(Vector, Vector) -> Vector)(vector, empty); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, vector)); + let result = («std-1.0.0-beta.25»::vector::append as λ(Vector, Vector) -> Vector)(vector, empty); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, vector)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::append_non_empty_to_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::append_non_empty_to_empty<>() -> Unit := { let empty = (#_asVector returning Vector)((#_mkArray returning Array)()); let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); - let result = («std-1.0.0-beta.14»::vector::append as λ(Vector, Vector) -> Vector)(empty, vector); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, vector)); + let result = («std-1.0.0-beta.25»::vector::append as λ(Vector, Vector) -> Vector)(empty, vector); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, vector)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::append_two_non_empty<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::append_two_non_empty<>() -> Unit := { let vector1 = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))); let vector2 = (#_asVector returning Vector)((#_mkArray returning Array)((3: Field), (4: Field), (5: Field))); - let result = («std-1.0.0-beta.14»::vector::append as λ(Vector, Vector) -> Vector)(vector1, vector2); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field))))); + let result = («std-1.0.0-beta.25»::vector::append as λ(Vector, Vector) -> Vector)(vector1, vector2); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(result, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field))))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::as_array_single<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::as_array_single<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((42: Field))); - let array = («std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)(vector); + let array = («std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)(vector); (#_assert returning Unit)((#_fEq returning bool)((#_arrayIndex returning Field)(array, (0: u32)), (42: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::as_array_multiple<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::as_array_multiple<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); - let array = («std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)(vector); + let array = («std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)(vector); (#_assert returning Unit)((#_fEq returning bool)((#_arrayIndex returning Field)(array, (0: u32)), (1: Field))); (#_assert returning Unit)((#_fEq returning bool)((#_arrayIndex returning Field)(array, (1: u32)), (2: Field))); (#_assert returning Unit)((#_fEq returning bool)((#_arrayIndex returning Field)(array, (2: u32)), (3: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::chain_operations<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::chain_operations<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32))); - let result = («std-1.0.0-beta.14»::vector::fold as λ(Vector, u32, λ(u32, u32) -> u32) -> u32)((«std-1.0.0-beta.14»::vector::map as λ(Vector, λ(u32) -> u32) -> Vector)((«std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)))), (fn(x: u32): u32 := (#_uMul returning u32)(x, (2: u32)))), (0: u32), (fn(acc: u32, x: u32): u32 := (#_uAdd returning u32)(acc, x))); + let result = («std-1.0.0-beta.25»::vector::fold as λ(Vector, u32, λ(u32, u32) -> u32) -> u32)((«std-1.0.0-beta.25»::vector::map as λ(Vector, λ(u32) -> u32) -> Vector)((«std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)))), (fn(x: u32): u32 := (#_uMul returning u32)(x, (2: u32)))), (0: u32), (fn(acc: u32, x: u32): u32 := (#_uAdd returning u32)(acc, x))); (#_assert returning Unit)((#_uEq returning bool)(result, (12: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::nested_operations<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::nested_operations<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32))); - let filtered = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (1: u32)))); - let mapped = («std-1.0.0-beta.14»::vector::map as λ(Vector, λ(u32) -> u32) -> Vector)(filtered, (fn(x: u32): u32 := (#_uMul returning u32)(x, x))); - let sum = («std-1.0.0-beta.14»::vector::fold as λ(Vector, u32, λ(u32, u32) -> u32) -> u32)(mapped, (0: u32), (fn(acc: u32, x: u32): u32 := (#_uAdd returning u32)(acc, x))); + let filtered = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_uGt returning bool)(x, (1: u32)))); + let mapped = («std-1.0.0-beta.25»::vector::map as λ(Vector, λ(u32) -> u32) -> Vector)(filtered, (fn(x: u32): u32 := (#_uMul returning u32)(x, x))); + let sum = («std-1.0.0-beta.25»::vector::fold as λ(Vector, u32, λ(u32, u32) -> u32) -> u32)(mapped, (0: u32), (fn(acc: u32, x: u32): u32 := (#_uAdd returning u32)(acc, x))); (#_assert returning Unit)((#_uEq returning bool)(sum, (29: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::single_element_operations<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::single_element_operations<>() -> Unit := { let single = (#_asVector returning Vector)((#_mkArray returning Array)((42: Field))); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(single), (1: u32))); let pushed_back = (#_vectorPushBack returning Vector)(single, (99: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(pushed_back, (#_asVector returning Vector)((#_mkArray returning Array)((42: Field), (99: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(pushed_back, (#_asVector returning Vector)((#_mkArray returning Array)((42: Field), (99: Field))))); let pushed_front = (#_vectorPushFront returning Vector)(single, (0: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(pushed_front, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (42: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(pushed_front, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (42: Field))))); let (popped_back_vector, popped_back_elem) = (#_vectorPopBack returning Tuple, Field>)(single); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(popped_back_vector), (0: u32))); (#_assert returning Unit)((#_fEq returning bool)(popped_back_elem, (42: Field))); @@ -603,56 +605,56 @@ noir_def «std-1.0.0-beta.14»::vector::test::single_element_operations<>() -> U (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(popped_front_vector), (0: u32))); (#_assert returning Unit)((#_fEq returning bool)(popped_front_elem, (42: Field))); let inserted = (#_vectorInsert returning Vector)(single, (0: u32), (0: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(inserted, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (42: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(inserted, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (42: Field))))); let (removed_vector, removed_elem) = (#_vectorRemove returning Tuple, Field>)(single, (0: u32)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(removed_vector), (0: u32))); (#_assert returning Unit)((#_fEq returning bool)(removed_elem, (42: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::boundary_conditions<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::boundary_conditions<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); let at_start = (#_vectorInsert returning Vector)(vector, (0: u32), (0: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(at_start, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(at_start, (#_asVector returning Vector)((#_mkArray returning Array)((0: Field), (1: Field), (2: Field), (3: Field))))); let at_end = (#_vectorInsert returning Vector)(vector, (3: u32), (4: Field)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(at_end, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(at_end, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field))))); let (removed_start, elem_start) = (#_vectorRemove returning Tuple, Field>)(vector, (0: u32)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(removed_start, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (3: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(removed_start, (#_asVector returning Vector)((#_mkArray returning Array)((2: Field), (3: Field))))); (#_assert returning Unit)((#_fEq returning bool)(elem_start, (1: Field))); let (removed_end, elem_end) = (#_vectorRemove returning Tuple, Field>)(vector, (2: u32)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(removed_end, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(removed_end, (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field))))); (#_assert returning Unit)((#_fEq returning bool)(elem_end, (3: Field))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::complex_predicates<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::complex_predicates<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: u32), (2: u32), (3: u32), (4: u32), (5: u32), (6: u32), (7: u32), (8: u32), (9: u32), (10: u32))); - let even_greater_than_5 = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_bAnd returning bool)((#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)), (#_uGt returning bool)(x, (5: u32))))); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(even_greater_than_5, (#_asVector returning Vector)((#_mkArray returning Array)((6: u32), (8: u32), (10: u32))))); - let all_positive_and_less_than_20 = («std-1.0.0-beta.14»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_bAnd returning bool)((#_uGt returning bool)(x, (0: u32)), (#_uLt returning bool)(x, (20: u32))))); + let even_greater_than_5 = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(u32) -> bool) -> Vector)(vector, (fn(x: u32): bool := (#_bAnd returning bool)((#_uEq returning bool)((#_uRem returning u32)(x, (2: u32)), (0: u32)), (#_uGt returning bool)(x, (5: u32))))); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(even_greater_than_5, (#_asVector returning Vector)((#_mkArray returning Array)((6: u32), (8: u32), (10: u32))))); + let all_positive_and_less_than_20 = («std-1.0.0-beta.25»::vector::«all» as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_bAnd returning bool)((#_uGt returning bool)(x, (0: u32)), (#_uLt returning bool)(x, (20: u32))))); (#_assert returning Unit)((#_bEq returning bool)(all_positive_and_less_than_20, #_true)); - let any_divisible_by_7 = («std-1.0.0-beta.14»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (7: u32)), (0: u32)))); + let any_divisible_by_7 = («std-1.0.0-beta.25»::vector::any as λ(Vector, λ(u32) -> bool) -> bool)(vector, (fn(x: u32): bool := (#_uEq returning bool)((#_uRem returning u32)(x, (7: u32)), (0: u32)))); (#_assert returning Unit)((#_bEq returning bool)(any_divisible_by_7, #_true)); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::identity_operations<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::identity_operations<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field), (4: Field), (5: Field))); - let mapped_identity = («std-1.0.0-beta.14»::vector::map as λ(Vector, λ(Field) -> Field) -> Vector)(vector, (fn(x: Field): Field := x)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(mapped_identity, vector)); - let filtered_all = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(Field) -> bool) -> Vector)(vector, (fn(__0: Field): bool := #_true)); - (#_assert returning Unit)(((Vector as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(filtered_all, vector)); - let filtered_none = («std-1.0.0-beta.14»::vector::filter as λ(Vector, λ(Field) -> bool) -> Vector)(vector, (fn(__1: Field): bool := #_false)); + let mapped_identity = («std-1.0.0-beta.25»::vector::map as λ(Vector, λ(Field) -> Field) -> Vector)(vector, (fn(x: Field): Field := x)); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(mapped_identity, vector)); + let filtered_all = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(Field) -> bool) -> Vector)(vector, (fn(__0: Field): bool := #_true)); + (#_assert returning Unit)(((Vector as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Vector, Vector) -> bool)(filtered_all, vector)); + let filtered_none = («std-1.0.0-beta.25»::vector::filter as λ(Vector, λ(Field) -> bool) -> Vector)(vector, (fn(__1: Field): bool := #_false)); (#_assert returning Unit)((#_uEq returning bool)((#_arrayLen returning u32)(filtered_none), (0: u32))); #_skip } -noir_def «std-1.0.0-beta.14»::vector::test::as_array_size_mismatch<>() -> Unit := { +noir_def «std-1.0.0-beta.25»::vector::test::as_array_size_mismatch<>() -> Unit := { let vector = (#_asVector returning Vector)((#_mkArray returning Array)((1: Field), (2: Field), (3: Field))); - let __0 = («std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)(vector); + let __0 = («std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)(vector); #_skip } -def «std-1.0.0-beta.14».Vector.env : Env := Env.mk - [«std-1.0.0-beta.14::vector::append», «std-1.0.0-beta.14::vector::as_array», «std-1.0.0-beta.14::vector::map», «std-1.0.0-beta.14::vector::mapi», «std-1.0.0-beta.14::vector::for_each», «std-1.0.0-beta.14::vector::for_eachi», «std-1.0.0-beta.14::vector::fold», «std-1.0.0-beta.14::vector::reduce», «std-1.0.0-beta.14::vector::filter», «std-1.0.0-beta.14::vector::join», «std-1.0.0-beta.14::vector::all», «std-1.0.0-beta.14::vector::any», «std-1.0.0-beta.14::vector::test::map_empty», «std-1.0.0-beta.14::vector::test::mapi_empty», «std-1.0.0-beta.14::vector::test::for_each_empty», «std-1.0.0-beta.14::vector::test::for_eachi_empty», «std-1.0.0-beta.14::vector::test::map_example», «std-1.0.0-beta.14::vector::test::mapi_example», «std-1.0.0-beta.14::vector::test::for_each_example», «std-1.0.0-beta.14::vector::test::for_eachi_example», «std-1.0.0-beta.14::vector::test::len_empty», «std-1.0.0-beta.14::vector::test::len_single», «std-1.0.0-beta.14::vector::test::len_multiple», «std-1.0.0-beta.14::vector::test::push_back_empty», «std-1.0.0-beta.14::vector::test::push_back_non_empty», «std-1.0.0-beta.14::vector::test::push_front_empty», «std-1.0.0-beta.14::vector::test::push_front_non_empty», «std-1.0.0-beta.14::vector::test::pop_back_empty», «std-1.0.0-beta.14::vector::test::pop_back_one», «std-1.0.0-beta.14::vector::test::pop_back_multiple», «std-1.0.0-beta.14::vector::test::pop_front_empty», «std-1.0.0-beta.14::vector::test::pop_front_one», «std-1.0.0-beta.14::vector::test::pop_front_multiple», «std-1.0.0-beta.14::vector::test::insert_beginning», «std-1.0.0-beta.14::vector::test::insert_middle», «std-1.0.0-beta.14::vector::test::insert_end», «std-1.0.0-beta.14::vector::test::insert_end_out_of_bounds», «std-1.0.0-beta.14::vector::test::remove_empty», «std-1.0.0-beta.14::vector::test::remove_beginning», «std-1.0.0-beta.14::vector::test::remove_middle», «std-1.0.0-beta.14::vector::test::remove_end», «std-1.0.0-beta.14::vector::test::remove_end_out_of_bounds», «std-1.0.0-beta.14::vector::test::fold_empty», «std-1.0.0-beta.14::vector::test::fold_single», «std-1.0.0-beta.14::vector::test::fold_multiple», «std-1.0.0-beta.14::vector::test::reduce_empty», «std-1.0.0-beta.14::vector::test::reduce_single», «std-1.0.0-beta.14::vector::test::reduce_multiple», «std-1.0.0-beta.14::vector::test::filter_empty», «std-1.0.0-beta.14::vector::test::filter_all_true», «std-1.0.0-beta.14::vector::test::filter_all_false», «std-1.0.0-beta.14::vector::test::filter_some», «std-1.0.0-beta.14::vector::test::all_empty», «std-1.0.0-beta.14::vector::test::all_true», «std-1.0.0-beta.14::vector::test::all_false», «std-1.0.0-beta.14::vector::test::any_empty», «std-1.0.0-beta.14::vector::test::any_true», «std-1.0.0-beta.14::vector::test::any_false», «std-1.0.0-beta.14::vector::test::append_empty_to_empty», «std-1.0.0-beta.14::vector::test::append_empty_to_non_empty», «std-1.0.0-beta.14::vector::test::append_non_empty_to_empty», «std-1.0.0-beta.14::vector::test::append_two_non_empty», «std-1.0.0-beta.14::vector::test::as_array_single», «std-1.0.0-beta.14::vector::test::as_array_multiple», «std-1.0.0-beta.14::vector::test::chain_operations», «std-1.0.0-beta.14::vector::test::nested_operations», «std-1.0.0-beta.14::vector::test::single_element_operations», «std-1.0.0-beta.14::vector::test::boundary_conditions», «std-1.0.0-beta.14::vector::test::complex_predicates», «std-1.0.0-beta.14::vector::test::identity_operations», «std-1.0.0-beta.14::vector::test::as_array_size_mismatch»] +def «std-1.0.0-beta.25».Vector.env : Env := Env.mk + [«std-1.0.0-beta.25::vector::append», «std-1.0.0-beta.25::vector::as_array», «std-1.0.0-beta.25::vector::map», «std-1.0.0-beta.25::vector::mapi», «std-1.0.0-beta.25::vector::for_each», «std-1.0.0-beta.25::vector::for_eachi», «std-1.0.0-beta.25::vector::fold», «std-1.0.0-beta.25::vector::reduce», «std-1.0.0-beta.25::vector::filter», «std-1.0.0-beta.25::vector::join», «std-1.0.0-beta.25::vector::all», «std-1.0.0-beta.25::vector::any», «std-1.0.0-beta.25::vector::test::map_empty», «std-1.0.0-beta.25::vector::test::mapi_empty», «std-1.0.0-beta.25::vector::test::for_each_empty», «std-1.0.0-beta.25::vector::test::for_eachi_empty», «std-1.0.0-beta.25::vector::test::map_example», «std-1.0.0-beta.25::vector::test::mapi_example», «std-1.0.0-beta.25::vector::test::for_each_example», «std-1.0.0-beta.25::vector::test::for_eachi_example», «std-1.0.0-beta.25::vector::test::len_empty», «std-1.0.0-beta.25::vector::test::len_single», «std-1.0.0-beta.25::vector::test::len_multiple», «std-1.0.0-beta.25::vector::test::push_back_empty», «std-1.0.0-beta.25::vector::test::push_back_non_empty», «std-1.0.0-beta.25::vector::test::push_front_empty», «std-1.0.0-beta.25::vector::test::push_front_non_empty», «std-1.0.0-beta.25::vector::test::pop_back_empty», «std-1.0.0-beta.25::vector::test::pop_back_one», «std-1.0.0-beta.25::vector::test::pop_back_multiple», «std-1.0.0-beta.25::vector::test::pop_front_empty», «std-1.0.0-beta.25::vector::test::pop_front_one», «std-1.0.0-beta.25::vector::test::pop_front_multiple», «std-1.0.0-beta.25::vector::test::insert_beginning», «std-1.0.0-beta.25::vector::test::insert_middle», «std-1.0.0-beta.25::vector::test::insert_end», «std-1.0.0-beta.25::vector::test::insert_end_out_of_bounds», «std-1.0.0-beta.25::vector::test::remove_empty», «std-1.0.0-beta.25::vector::test::remove_beginning», «std-1.0.0-beta.25::vector::test::remove_middle», «std-1.0.0-beta.25::vector::test::remove_end», «std-1.0.0-beta.25::vector::test::remove_end_out_of_bounds», «std-1.0.0-beta.25::vector::test::fold_empty», «std-1.0.0-beta.25::vector::test::fold_single», «std-1.0.0-beta.25::vector::test::fold_multiple», «std-1.0.0-beta.25::vector::test::reduce_empty», «std-1.0.0-beta.25::vector::test::reduce_single», «std-1.0.0-beta.25::vector::test::reduce_multiple», «std-1.0.0-beta.25::vector::test::filter_empty», «std-1.0.0-beta.25::vector::test::filter_all_true», «std-1.0.0-beta.25::vector::test::filter_all_false», «std-1.0.0-beta.25::vector::test::filter_some», «std-1.0.0-beta.25::vector::test::all_empty», «std-1.0.0-beta.25::vector::test::all_true», «std-1.0.0-beta.25::vector::test::all_false», «std-1.0.0-beta.25::vector::test::any_empty», «std-1.0.0-beta.25::vector::test::any_true», «std-1.0.0-beta.25::vector::test::any_false», «std-1.0.0-beta.25::vector::test::append_empty_to_empty», «std-1.0.0-beta.25::vector::test::append_empty_to_non_empty», «std-1.0.0-beta.25::vector::test::append_non_empty_to_empty», «std-1.0.0-beta.25::vector::test::append_two_non_empty», «std-1.0.0-beta.25::vector::test::as_array_single», «std-1.0.0-beta.25::vector::test::as_array_multiple», «std-1.0.0-beta.25::vector::test::chain_operations», «std-1.0.0-beta.25::vector::test::nested_operations», «std-1.0.0-beta.25::vector::test::single_element_operations», «std-1.0.0-beta.25::vector::test::boundary_conditions», «std-1.0.0-beta.25::vector::test::complex_predicates», «std-1.0.0-beta.25::vector::test::identity_operations», «std-1.0.0-beta.25::vector::test::as_array_size_mismatch»] [] From d7904e2375368dedf78526d65520ec6cd01b9400 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:07:50 +0000 Subject: [PATCH 08/10] Repair the remaining stdlib theorems for beta.25 Completes the stdlib proof repairs so `stdlib/lampe` builds green: - BoundedVec map/mapi/for_each/for_eachi and array higher-order methods (map/mapi/for_each/for_eachi/fold/reduce/all/any/concat/sort_via/sort) restated ref-style for the by-reference &self migration - BoundedVec Eq re-proved against the new element-wise active-prefix comparison; check_shuffle restated over &[T; N] operands - Poseidon2: the sponge struct is gone upstream; model the new chunked finish_ref absorption directly (addToState/chunkState/finishDigest) and re-prove finish/finish_ref/write/RATE/CAPACITY/POSEIDON2_CONFIG_STATE_SIZE - Option: is_some/is_none restated ref-style; expect re-proved - EmbeddedCurvePoint lost is_infinite: infinity is canonically (0, 0); reshape the Lampe curve model and re-prove the point/scalar/MSM specs (round-trip lemmas now require [Bn254.Prime p] so (0,0) is off-curve) - Pedersen: bridge the removed hash::from_field_unsafe via EmbeddedCurveScalar::from_field's safe decomposition - Lampe: implement Builtin.mkFormatString (was an unprovable stub; beta.25's poseidon2_permutation builds a format string for its static assert) --- Lampe/Lampe/Builtin/Str.lean | 18 +- Lampe/Lampe/Builtin/Stubs.lean | 1 - Lampe/Lampe/Crypto/EmbeddedCurve.lean | 85 +- Lampe/Lampe/Crypto/Pedersen.lean | 2 +- Lampe/Lampe/Tactic/Steps.lean | 2 + stdlib/lampe/Stdlib/Array/CheckShuffle.lean | 26 +- stdlib/lampe/Stdlib/Array/Mod.lean | 619 +++++------ .../BoundedVec/HigherOrderMap.lean | 186 ++-- .../Stdlib/Collections/BoundedVec/Traits.lean | 81 +- stdlib/lampe/Stdlib/EmbeddedCurveOps.lean | 266 +---- stdlib/lampe/Stdlib/Hash/Mod.lean | 24 +- stdlib/lampe/Stdlib/Hash/Pedersen.lean | 154 ++- stdlib/lampe/Stdlib/Hash/Poseidon2.lean | 967 +++++------------- stdlib/lampe/Stdlib/Option.lean | 29 +- 14 files changed, 978 insertions(+), 1482 deletions(-) diff --git a/Lampe/Lampe/Builtin/Str.lean b/Lampe/Lampe/Builtin/Str.lean index 2a5605c1..e0b82b48 100644 --- a/Lampe/Lampe/Builtin/Str.lean +++ b/Lampe/Lampe/Builtin/Str.lean @@ -34,8 +34,24 @@ number of bytes it contains, not the number of characters (regardless of the enc In Noir, this corresponds to `from(bytes: [u8, N]) -> str`. -/ -def arrayAsStrUnchecked := newGenericTotalPureBuiltin +def arrayAsStrUnchecked := newGenericTotalPureBuiltin (fun n => ⟨[(Tp.u 8).array n], (.str n)⟩) (fun _ h![a] => arrayAsStr! a) +/-- +Defines the construction of a format string from its literal template and the values interpolated +into it. + +Lampe models format strings as their literal template text (`FormatString len tps` is defeq to +`String`), so this returns the template converted to a Lean string and ignores the interpolated +values. The generic parameters are the template length `s`, the format string length `n`, the +types of the interpolated values `argTps`, and the format string's argument tuple type `tp`. + +In Noir, this corresponds to the compiler-internal construction of `fmtstr` literals. +-/ +def mkFormatString := newGenericTotalPureBuiltin + (fun (a : U 32 × U 32 × List Tp × Tp) => ⟨.str a.1 :: a.2.2.1, .fmtStr a.2.1 a.2.2.2⟩) + (fun _ args => match args with + | .cons s _ => NoirStr.toString s) + end Lampe.Builtin diff --git a/Lampe/Lampe/Builtin/Stubs.lean b/Lampe/Lampe/Builtin/Stubs.lean index d1aeda41..cd26d7e0 100644 --- a/Lampe/Lampe/Builtin/Stubs.lean +++ b/Lampe/Lampe/Builtin/Stubs.lean @@ -33,7 +33,6 @@ def asWitness := stub def blackBox := stub def checkedTransmute := stub def fmtstrAsCtstring := stub -def mkFormatString := stub def recursiveAggregation := stub def sliceRefcount := stub def strAsCtstring := stub diff --git a/Lampe/Lampe/Crypto/EmbeddedCurve.lean b/Lampe/Lampe/Crypto/EmbeddedCurve.lean index 3eeb83a4..be8138fe 100644 --- a/Lampe/Lampe/Crypto/EmbeddedCurve.lean +++ b/Lampe/Lampe/Crypto/EmbeddedCurve.lean @@ -22,7 +22,7 @@ comes from `Lampe.Crypto.MathlibBridge`. @[reducible] def pointTp : Tp := .tuple (some "«std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurvePoint»") - [.field, .field, .bool] + [.field, .field] @[reducible] def scalarTp : Tp := @@ -37,7 +37,13 @@ def Scalar (p : Prime) := Tp.denote p scalarTp def pointX {p : Prime} (pt : Point p) : Fp p := pt.1 def pointY {p : Prime} (pt : Point p) : Fp p := pt.2.1 -def pointIsInfinite {p : Prime} (pt : Point p) : Bool := pt.2.2.1 + +/-- Since Noir 1.0.0-beta.25 the point at infinity is canonically `(0, 0)` +(the struct has no `is_infinite` flag any more); `(0, 0)` never satisfies the +curve equation `y² = x³ - 17` for the BN254 base field, so the encoding is +unambiguous. -/ +def pointIsInfinite {p : Prime} (pt : Point p) : Bool := + decide (pt.1 = 0) && decide (pt.2.1 = 0) def Scalar.lo {p : Prime} (s : Scalar p) : Fp p := s.1 def Scalar.hi {p : Prime} (s : Scalar p) : Fp p := s.2.1 @@ -46,14 +52,26 @@ def Scalar.hi {p : Prime} (s : Scalar p) : Fp p := s.2.1 def mkScalar {p : Prime} (lo hi : Fp p) : Scalar p := (lo, hi, ()) @[reducible] -def mkPoint {p : Prime} (x y : Fp p) (isInfinite : Bool) : Point p := (x, y, isInfinite, ()) +def mkPoint {p : Prime} (x y : Fp p) : Point p := (x, y, ()) @[reducible] -def pointAtInfinity {p : Prime} : Point p := mkPoint 0 0 true +def pointAtInfinity {p : Prime} : Point p := mkPoint 0 0 def canonicalizeInfinity {p : Prime} (pt : Point p) : Point p := if pointIsInfinite pt then pointAtInfinity else pt +/-- With the beta.25 `(0, 0)`-encoding of infinity, every point value is +already canonical. -/ +@[simp] +theorem canonicalizeInfinity_eq_self {p : Prime} (pt : Point p) : + canonicalizeInfinity pt = pt := by + obtain ⟨x, y, ⟨⟩⟩ := pt + by_cases h : pointIsInfinite ((x, y, ()) : Point p) = true + · have hxy := h + simp only [pointIsInfinite, Bool.and_eq_true, decide_eq_true_eq] at hxy + simp [canonicalizeInfinity, h, pointAtInfinity, mkPoint, hxy.1, hxy.2] + · simp [canonicalizeInfinity, h] + def curveB {p : Prime} : Fp p := -17 /-- The concrete Weierstrass curve used by Noir's embedded-curve stdlib: `y^2 = x^3 - 17`. -/ @@ -494,7 +512,7 @@ def curvePoint? {p : Prime} (pt : Point p) : Option ((affineCurve p).Point) := def encodeCurvePoint {p : Prime} : (affineCurve p).Point → Point p | 0 => pointAtInfinity - | .some (x := x) (y := y) _ => mkPoint x y false + | .some (x := x) (y := y) _ => mkPoint x y @[simp] theorem curvePoint?_infinity {p : Prime} : @@ -540,31 +558,66 @@ theorem curvePoint?_eq_some_some_iff {p : Prime} {pt : Point p} {x y : Fp p} @[simp] theorem encodeCurvePoint_some {p : Prime} {x y : Fp p} (hNs : (affineCurve p).Nonsingular x y) : encodeCurvePoint (WeierstrassCurve.Affine.Point.some (x := x) (y := y) hNs) = - mkPoint x y false := rfl + mkPoint x y := rfl theorem encodeCurvePoint_curvePoint? {p : Prime} {pt : Point p} {P : (affineCurve p).Point} (hP : curvePoint? pt = some P) : encodeCurvePoint P = canonicalizeInfinity pt := by rcases P with (_ | @⟨x, y, hNs⟩) · have hInf : pointIsInfinite pt = true := curvePoint?_eq_some_zero_iff.mp hP - simp [encodeCurvePoint, canonicalizeInfinity, hInf, - ] + obtain ⟨x', y', ⟨⟩⟩ := pt + simp only [pointIsInfinite, Bool.and_eq_true, decide_eq_true_eq] at hInf + simp [encodeCurvePoint, canonicalizeInfinity, pointIsInfinite, hInf.1, hInf.2, + pointAtInfinity, mkPoint] · obtain ⟨hFin, hx, hy⟩ := curvePoint?_eq_some_some_iff.mp hP - obtain ⟨x', y', inf, ⟨⟩⟩ := pt - simp only [pointX, pointY, pointIsInfinite] at hFin hx hy - subst hFin + obtain ⟨x', y', ⟨⟩⟩ := pt + simp only [pointX, pointY] at hx hy subst hx subst hy - simp [encodeCurvePoint, canonicalizeInfinity, pointIsInfinite, mkPoint] + simp [encodeCurvePoint, canonicalizeInfinity, hFin, mkPoint] -@[simp] theorem curvePoint?_encodeCurvePoint {p : Prime} (P : (affineCurve p).Point) : +/-- `(17 : Fp p)` is nonzero for the BN254 base field (its modulus far exceeds 17). -/ +lemma seventeen_ne_zero {p : Prime} [Bn254.Prime p] : (17 : Fp p) ≠ 0 := by + have h17lt : (17 : Nat) < p.natVal := by + have hp := Bn254.pow128_lt_prime (p := p) + have : (17 : Nat) < Lampe.pow128 := by unfold Lampe.pow128; decide + omega + intro h + have hval : ((17 : Nat) : Fp p).val = 17 := ZMod.val_natCast_of_lt h17lt + rw [show (((17 : Nat) : Fp p)) = (17 : Fp p) by norm_num, h] at hval + simp at hval + +/-- `(0, 0)` is not on `y² = x³ - 17`, so the beta.25 infinity encoding is +unambiguous over the BN254 base field. -/ +lemma not_nonsingular_origin {p : Prime} [Bn254.Prime p] : + ¬ (affineCurve p).Nonsingular 0 0 := by + intro h + have heq := h.1 + simp [WeierstrassCurve.Affine.Equation, WeierstrassCurve.Affine.polynomial, curveB] at heq + rw [show Polynomial.evalEval (0 : Fp p) 0 (Polynomial.C Polynomial.X) = 0 from by + simp [Polynomial.evalEval]] at heq + exact seventeen_ne_zero (p := p) (by linear_combination heq) + +lemma pointIsInfinite_mkPoint_of_nonsingular {p : Prime} [Bn254.Prime p] {x y : Fp p} + (hNs : (affineCurve p).Nonsingular x y) : + pointIsInfinite (mkPoint x y : Point p) = false := by + by_contra hInf + simp only [Bool.not_eq_false, pointIsInfinite, Bool.and_eq_true, decide_eq_true_eq] at hInf + obtain ⟨hx, hy⟩ := hInf + subst hx + subst hy + exact not_nonsingular_origin hNs + +@[simp] theorem curvePoint?_encodeCurvePoint {p : Prime} [Bn254.Prime p] + (P : (affineCurve p).Point) : curvePoint? (encodeCurvePoint P) = some P := by rcases P with (_ | @⟨x, y, hNs⟩) · show curvePoint? (encodeCurvePoint (0 : (affineCurve p).Point)) = some 0 rw [encodeCurvePoint_zero, curvePoint?_infinity] - · have hFin : pointIsInfinite (mkPoint x y false : Point p) = false := rfl - have hxy : (affineCurve p).Nonsingular (pointX (mkPoint x y false : Point p)) - (pointY (mkPoint x y false : Point p)) := hNs + · have hFin : pointIsInfinite (mkPoint x y : Point p) = false := + pointIsInfinite_mkPoint_of_nonsingular hNs + have hxy : (affineCurve p).Nonsingular (pointX (mkPoint x y : Point p)) + (pointY (mkPoint x y : Point p)) := hNs simp [encodeCurvePoint, curvePoint?_some_of_finite_nonsingular hFin hxy, pointX, pointY, mkPoint] diff --git a/Lampe/Lampe/Crypto/Pedersen.lean b/Lampe/Lampe/Crypto/Pedersen.lean index 93c77830..cf256bdb 100644 --- a/Lampe/Lampe/Crypto/Pedersen.lean +++ b/Lampe/Lampe/Crypto/Pedersen.lean @@ -100,7 +100,7 @@ private def liftWithParity {p : Prime} (x y : Fp p) (signBit : Bool) : Option ((affineCurve p).Point) := let y_final : Fp p := if (y.val % 2 == 1) == signBit then y else (-y) - curvePoint? (mkPoint x y_final false) + curvePoint? (mkPoint x y_final) /-- Single hash-to-curve attempt for `(preimage, attempt)`. Builds the diff --git a/Lampe/Lampe/Tactic/Steps.lean b/Lampe/Lampe/Tactic/Steps.lean index 8cd1584e..86de25a7 100644 --- a/Lampe/Lampe/Tactic/Steps.lean +++ b/Lampe/Lampe/Tactic/Steps.lean @@ -147,6 +147,8 @@ def getClosingTerm (val : Lean.Expr) : TacticM (Option (TSyntax `term)) := withT | ``Lampe.Builtin.strAsBytes => return some (←``(strAsBytes_intro)) | ``Lampe.Builtin.arrayAsStrUnchecked => return some (←``(arrayAsStrUnchecked_intro)) + | ``Lampe.Builtin.mkFormatString => + return some (←``(genericTotalPureBuiltin_intro Builtin.mkFormatString (a := (_, _, _, _)) rfl)) | ``Lampe.Builtin.isUnconstrained => return some (←``(genericTotalPureBuiltin_intro Builtin.isUnconstrained rfl)) diff --git a/stdlib/lampe/Stdlib/Array/CheckShuffle.lean b/stdlib/lampe/Stdlib/Array/CheckShuffle.lean index b1ecaed2..46a6f777 100644 --- a/stdlib/lampe/Stdlib/Array/CheckShuffle.lean +++ b/stdlib/lampe/Stdlib/Array/CheckShuffle.lean @@ -136,11 +136,14 @@ lemma get_index_spec: STHoare p env ⟦⟧ steps theorem check_shuffle_spec + {lhsRef rhsRef : Ref (.array T N)} + {lhs rhs : Tp.denote p (.array T N)} (t_eq : Cmp.Eq.hasImpl env T) (t_eq_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Eq.eq h![] T h![] h![] h![a, b]) fun r: Bool => ⟦r ↔ a = b⟧) - : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::array::check_shuffle::check_shuffle».call h![T, N] h![lhs, rhs]) - (fun _ => List.Perm lhs.toList rhs.toList) := by + : STHoare p env ([lhsRef ↦ ⟨.array T N, lhs⟩] ⋆ [rhsRef ↦ ⟨.array T N, rhs⟩]) + («std-1.0.0-beta.25::array::check_shuffle::check_shuffle».call h![T, N] h![lhsRef, rhsRef]) + (fun _ => [lhsRef ↦ ⟨.array T N, lhs⟩] ⋆ [rhsRef ↦ ⟨.array T N, rhs⟩] ⋆ + ⟦List.Perm lhs.toList rhs.toList⟧) := by enter_decl steps step_as (⟦⟧) (fun _ => ⟦⟧) @@ -166,10 +169,12 @@ theorem check_shuffle_spec rename ∀_, ∃_, _ = _ => shuffle_indices_surj - loop_inv nat fun i _ ilt => ∀(k : Fin i), lhs.get (k.castLE ilt) = rhs[(shuffle_indices.get $ k.castLE ilt).toNat]? - · intro k + loop_inv nat fun i _ ilt => [lhsRef ↦ ⟨.array T N, lhs⟩] ⋆ [rhsRef ↦ ⟨.array T N, rhs⟩] ⋆ + ⟦∀(k : Fin i), lhs.get (k.castLE ilt) = rhs[(shuffle_indices.get $ k.castLE ilt).toNat]?⟧ + · sl + intro k fin_cases k - · simp + simp · intro i _ ilt steps [t_eq_spec] @@ -231,9 +236,12 @@ theorem check_shuffle_spec /-- Shows that the shuffle check cannot succeed with the given inputs. -/ -example {t_eq : Cmp.Eq.hasImpl env (.u 8)} : - STHoare p env ⟦⟧ - («std-1.0.0-beta.25::array::check_shuffle::check_shuffle».call h![.u 8, 3] h![⟨[1, 2, 3], by simp⟩, ⟨[1, 2, 2], by simp⟩]) +example {t_eq : Cmp.Eq.hasImpl env (.u 8)} + {lhsRef rhsRef : Ref (.array (.u 8) 3)} : + STHoare p env + ([lhsRef ↦ ⟨.array (.u 8) 3, ⟨[1, 2, 3], by simp⟩⟩] ⋆ + [rhsRef ↦ ⟨.array (.u 8) 3, ⟨[1, 2, 2], by simp⟩⟩]) + («std-1.0.0-beta.25::array::check_shuffle::check_shuffle».call h![.u 8, 3] h![lhsRef, rhsRef]) (fun _ => False) := by steps [check_shuffle_spec] · simp_all diff --git a/stdlib/lampe/Stdlib/Array/Mod.lean b/stdlib/lampe/Stdlib/Array/Mod.lean index f7560504..ec95a017 100644 --- a/stdlib/lampe/Stdlib/Array/Mod.lean +++ b/stdlib/lampe/Stdlib/Array/Mod.lean @@ -14,19 +14,52 @@ open «std-1.0.0-beta.25» set_option Lampe.pp.Expr true set_option Lampe.pp.STHoare true -theorem map_spec {p T N U Env l f fb} +private lemma modify_array_isSome_bound {p tp} {K : U 32} {v : Tp.denote p (tp.array K)} + {idx : U 32} {x : Tp.denote p tp} + (hmod : ((Lens.nil.cons (Access.array idx)).modify v x).isSome = true) : + idx.toNat < K.toNat := by + by_contra h + simp [Lens.modify, Access.modify, h] at hmod + +private lemma modify_array_get {p tp} {K : U 32} (v : Tp.denote p (tp.array K)) (idx : U 32) + (x : Tp.denote p tp) (hidx : idx.toNat < K.toNat) + {hmod : ((Lens.nil.cons (Access.array idx)).modify v x).isSome = true} : + ((Lens.nil.cons (Access.array idx)).modify v x).get hmod = + List.Vector.set v ⟨idx.toNat, hidx⟩ x := by + simp [Lens.modify, Access.modify, hidx] + +private lemma take_set_succ_prefix {α} {v a : List α} {i : ℕ} {x : α} + (hv : i < v.length) (ha : i < a.length) + (hloop : v.take i = a.take i) (hx : x = a[i]'ha) : + (v.set i x).take (i + 1) = a.take (i + 1) := by + have hv' : i < (v.set i x).length := by simpa using hv + rw [List.take_succ_eq_append_getElem hv', List.take_succ_eq_append_getElem ha, + List.take_set_of_le (le_refl _), hloop, List.getElem_set_self, hx] + +private lemma take_set_append_succ {α} {v la lb : List α} {m i k : ℕ} {x : α} + (hk : k = m + i) (hv : k < v.length) (hb : i < lb.length) + (hloop : v.take (m + i) = la ++ lb.take i) (hx : x = lb[i]'hb) : + (v.set k x).take (m + (i + 1)) = la ++ lb.take (i + 1) := by + subst hk + have h1 : m + (i + 1) = (m + i) + 1 := by omega + have hv' : m + i < (v.set (m + i) x).length := by simpa using hv + rw [h1, List.take_succ_eq_append_getElem hv', List.take_set_of_le (le_refl _), hloop, + List.take_succ_eq_append_getElem hb, List.getElem_set_self, hx, List.append_assoc] + +theorem map_spec {p T N U Env l f fb} {selfRef : Ref (T.array N)} (inv : List (T.denote p) → List (U.denote p) → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (op : List (U.denote p)) (e : T.denote p), (ip ++ [e] <+: l.toList) → STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ++ [r]))) : STHoare p env - ((inv [] []) ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::map».call h![T, N, U, Env] h![l, f]) - (fun r => inv l.toList r.toList ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ (inv [] []) ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::map».call h![T, N, U, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv l.toList r.toList ⋆ [λf ↦ fb]) := by enter_decl steps loop_inv nat fun i _ _ => ∃∃v, - [ret ↦ ⟨U.array N, v⟩] ⋆ (inv (l.take i).toList (v.take i).toList) ⋆ [λf ↦ fb] + [ret ↦ ⟨U.array N, v⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ + (inv (l.take i).toList (v.take i).toList) ⋆ [λf ↦ fb] · sl · simp · intro i hlo hhi @@ -45,7 +78,8 @@ theorem map_spec {p T N U Env l f fb} Lens.get, Access.modify, Option.bind_eq_bind, Option.bind_some, Option.bind_fun_some] - have : i < (v.toList.set i «#v_5»).length := by simp_all + rename U.denote p => mapped + have : i < (v.toList.set i mapped).length := by simp_all have hi_lt_N : i < BitVec.toNat N := by simp_all simp only [dif_pos hi_lt_N, Option.get_some, List.Vector.toList_set] conv => rhs; enter [1, 2]; rw [List.take_succ_eq_append_getElem this] @@ -77,29 +111,30 @@ theorem map_spec {p T N U Env l f fb} simp only [a, List.take_length] sl -theorem map_pure_spec {p T N U Env l f fb fEmb} +theorem map_pure_spec {p T N U Env l f fb fEmb} {selfRef : Ref (T.array N)} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::map».call h![T, N, U, Env] h![l, f]) - (fun r => r.toList = l.toList.map fEmb) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::map».call h![T, N, U, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ ⟦r.toList = l.toList.map fEmb⟧) := by steps [map_spec (inv := fun i o => o = i.map fEmb)] · simp · assumption · intros; steps [inv_pure]; simp_all -theorem mapi_spec {p T N U Env l f fb} +theorem mapi_spec {p T N U Env l f fb} {selfRef : Ref (T.array N)} (inv : List (T.denote p) → List (U.denote p) → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (op : List (U.denote p)) (e : T.denote p), ((ip ++ [e]) <+: l.toList) → STHoare p env (inv ip op) (fb h![ip.length, e]) (fun r => inv (ip ++ [e]) (op ++ [r]))) : STHoare p env - (inv [] [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::mapi».call h![T, N, U, Env] h![l, f]) - (fun r => inv l.toList r.toList ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ inv [] [] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::mapi».call h![T, N, U, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv l.toList r.toList ⋆ [λf ↦ fb]) := by enter_decl steps loop_inv nat fun i _ _ => - ∃∃v, [ret ↦ ⟨U.array N, v⟩] ⋆ inv (l.take i).toList (v.take i).toList ⋆ [λf ↦ fb] + ∃∃v, [ret ↦ ⟨U.array N, v⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ + inv (l.take i).toList (v.take i).toList ⋆ [λf ↦ fb] · sl · simp · intro i hlo hhi @@ -132,7 +167,8 @@ theorem mapi_spec {p T N U Env l f fb} Lens.get, Access.modify, ↓reduceDIte, Option.bind_eq_bind, Option.bind_some, Option.bind_fun_some, Option.get_some, List.Vector.toList_set, BitVec.toNat_ofNat] - have hlen : i < (v.toList.set i «#v_5»).length := by simp_all + rename U.denote p => mapped + have hlen : i < (v.toList.set i mapped).length := by simp_all conv => rhs; enter [1, 2]; rw [List.take_succ_eq_append_getElem hlen] simp only [List.getElem_set hlen, if_true] conv => rhs; enter [1, 2, 1]; apply List.take_set_of_le (by rfl) @@ -157,11 +193,11 @@ theorem mapi_spec {p T N U Env l f fb} simp only [a, List.take_length] sl -theorem mapi_pure_spec {p T N U Env l f fb fEmb} +theorem mapi_pure_spec {p T N U Env l f fb fEmb} {selfRef : Ref (T.array N)} (inv_pure : ∀i x, (h : i < l.length) → STHoare p env ⟦⟧ (fb h![i, x]) (fun r => r = fEmb i x)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::mapi».call h![T, N, U, Env] h![l, f]) - (fun r => r.toList = l.toList.mapIdx fEmb) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::mapi».call h![T, N, U, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ ⟦r.toList = l.toList.mapIdx fEmb⟧) := by steps [mapi_spec (inv := fun i o => o = i.mapIdx fEmb)] · simp · assumption @@ -179,18 +215,19 @@ theorem mapi_pure_spec {p T N U Env l f fb fEmb} simp_all -theorem for_each_spec {p T N Env l f fb} +theorem for_each_spec {p T N Env l f fb} {selfRef : Ref (T.array N)} (inv : List (T.denote p) → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (e : T.denote p), ((ip ++ [e]) <+: l.toList) → STHoare p env (inv ip) (fb h![e]) (fun _ => inv (ip ++ [e]))) : STHoare p env - (inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::for_each».call h![T, N, Env] h![l, f]) - (fun _ => inv l.toList ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ inv [] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::for_each».call h![T, N, Env] h![selfRef, f]) + (fun _ => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv l.toList ⋆ [λf ↦ fb]) := by enter_decl steps - loop_inv nat fun i _ _ => inv (l.take i).toList ⋆ [λf ↦ fb] - · simp + loop_inv nat fun i _ _ => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv (l.take i).toList ⋆ [λf ↦ fb] + · sl + simp · intro i hlo hhi steps simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, @@ -201,28 +238,25 @@ theorem for_each_spec {p T N Env l f fb} steps [STHoare.callLambda_intro (hlam := this)] simp_all only [List.Vector.toList_take, List.take_append_getElem] sl + · + steps + have l1 : BitVec.toNat (↑(List.Vector.length l) : U 32) = l.toList.length := by simp + simp only [l1, List.Vector.toList_take, List.take_length] + sl - steps - simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, - BitVec.natCast_eq_ofNat, BitVec.ofNat_toNat, BitVec.setWidth_eq, zero_le, - List.Vector.toList_take] - have l1 : BitVec.toNat N = l.toList.length := by simp - conv => lhs; enter [1, 1]; rw [l1] - simp only [List.take_length] - sl - -theorem for_eachi_spec {p T N Env l f fb} +theorem for_eachi_spec {p T N Env l f fb} {selfRef : Ref (T.array N)} (inv : List (T.denote p) → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (e : T.denote p), ((ip ++ [e] <+: l.toList) → STHoare p env (inv ip) (fb h![ip.length, e]) (fun _ => inv (ip ++ [e])))) : STHoare p env - (inv [] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::for_eachi».call h![T, N, Env] h![l, f]) - (fun _ => inv l.toList ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ inv [] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::for_eachi».call h![T, N, Env] h![selfRef, f]) + (fun _ => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv l.toList ⋆ [λf ↦ fb]) := by enter_decl steps - loop_inv nat fun i _ _ => inv (l.take i).toList ⋆ [λf ↦ fb] - · simp + loop_inv nat fun i _ _ => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv (l.take i).toList ⋆ [λf ↦ fb] + · sl + simp · intro i hlo hhi steps simp_all only [BitVec.natCast_eq_ofNat, BitVec.toNat_intCast, Int.reducePow, @@ -249,81 +283,82 @@ theorem for_eachi_spec {p T N Env l f fb} List.Vector.toList_take, List.length_take, List.Vector.toList_length, BitVec.toNat_ofNat, Nat.reducePow, List.take_append_getElem] sl + · + steps + have l1 : BitVec.toNat (↑(List.Vector.length l) : U 32) = l.toList.length := by simp + simp only [l1, List.Vector.toList_take, List.take_length] + sl - steps - simp_all only [BitVec.natCast_eq_ofNat, BitVec.toNat_intCast, Int.reducePow, - EuclideanDomain.zero_mod, Int.toNat_zero, BitVec.ofNat_toNat, BitVec.setWidth_eq, zero_le, - List.Vector.toList_take] - have l1 : BitVec.toNat N = l.toList.length := by simp - conv => lhs; enter [1, 1]; rw [l1] - simp only [List.take_length] - sl - -theorem fold_spec {p T N U Env l a f fb} +theorem fold_spec {p T N U Env l a f fb} {selfRef : Ref (T.array N)} (inv : List (T.denote p) → U.denote p → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (accum : U.denote p) (e : T.denote p), ((ip ++ [e] <+: l.toList) → STHoare p env (inv ip accum) (fb h![accum, e]) (fun r => inv (ip ++ [e]) r))) : STHoare p env - (inv [] a ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::fold».call h![T, N, U, Env] h![l, a, f]) - (fun r => (inv l.toList r) ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ inv [] a ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::fold».call h![T, N, U, Env] h![selfRef, a, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ (inv l.toList r) ⋆ [λf ↦ fb]) := by enter_decl steps - step_as ([accumulator ↦ ⟨U, a⟩] ⋆ [λf ↦ fb] ⋆ inv [] a) - (fun _ => ∃∃v, [accumulator ↦ ⟨U, v⟩] ⋆ [λf ↦ fb] ⋆ inv l.toList v) - steps - loop_inv nat fun i _ _ => ∃∃v, [accumulator ↦ ⟨U, v⟩] ⋆ [λf ↦ fb] ⋆ inv (l.take i).toList v - · sl - · simp - · intro i hlo hhi + apply STHoare.letIn_intro + (Q := fun _ => ∃∃v, [accumulator ↦ ⟨U, v⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb] ⋆ + inv l.toList v) + · steps - simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, - zero_le, Builtin.CastTp.cast, - BitVec.truncate_eq_setWidth, BitVec.setWidth_eq, - BitVec.toNat_ofNatLT, List.Vector.toList_take] - generalize_proofs - rename U.denote p => v - - have := inv_spec (l.take i).toList v (l.toList[i]'(by simp_all)) (by simp [List.take_prefix]) - steps [STHoare.callLambda_intro (hlam := this)] - - simp_all only [List.Vector.toList_take, List.take_append_getElem, Lens.modify, Option.get_some] + -- `steps` stalls on the loop-lowering alias `let ζi0 = selfRef`; substitute it and resume. + · subst ζi0 + sl + subst ζi0 + steps + loop_inv nat fun i _ _ => ∃∃v, [accumulator ↦ ⟨U, v⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ + [λf ↦ fb] ⋆ inv (l.take i).toList v + · sl + · simp + · intro i hlo hhi + steps + simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, + zero_le, Builtin.CastTp.cast, + BitVec.truncate_eq_setWidth, BitVec.setWidth_eq, + BitVec.toNat_ofNatLT, List.Vector.toList_take] + generalize_proofs + rename U.denote p => v + + have := inv_spec (l.take i).toList v (l.toList[i]'(by simp_all)) (by simp [List.take_prefix]) + steps [STHoare.callLambda_intro (hlam := this)] + + simp_all only [List.Vector.toList_take, List.take_append_getElem, Lens.modify, Option.get_some] + sl + · + steps + have l1 : BitVec.toNat (↑(List.Vector.length l) : BitVec 32) = l.toList.length := by simp + simp only [l1, List.Vector.toList_take, List.take_length] + sl + · + intro _ + steps + subst_vars sl - steps - simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, - BitVec.natCast_eq_ofNat, BitVec.ofNat_toNat, BitVec.setWidth_eq, zero_le, - List.Vector.toList_take] - - have l1 : BitVec.toNat N = l.toList.length := by simp - simp only [l1, List.take_length] - sl - - steps - subst_vars - sl - -theorem fold_pure_spec {p T N U Env l a f fb fEmb} +theorem fold_pure_spec {p T N U Env l a f fb fEmb} {selfRef : Ref (T.array N)} (inv_pure : ∀a x, STHoare p env ⟦⟧ (fb h![a, x]) (fun r => r = fEmb a x)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::fold».call h![T, N, U, Env] h![l, a, f]) - (fun r => r = l.toList.foldl fEmb a ⋆ [λf ↦ fb]) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::fold».call h![T, N, U, Env] h![selfRef, a, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ ⟦r = l.toList.foldl fEmb a⟧ ⋆ [λf ↦ fb]) := by steps [fold_spec (inv := fun xs v => v = xs.foldl fEmb a)] · rfl · assumption · intros; steps [inv_pure]; simp_all -theorem reduce_spec {p T N Env l f fb} +theorem reduce_spec {p T N Env l f fb} {selfRef : Ref (T.array N)} (l_len_gt : l.length > 0) (inv : List (T.denote p) → T.denote p → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (acc : T.denote p) (e : T.denote p), ((ip ++ [e] <+: l.toList.tail) → STHoare p env (inv ip acc) (fb h![acc, e]) (fun r => inv (ip ++ [e]) r))) : STHoare p env - (inv [] l[0] ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::reduce».call h![T, N, Env] h![l, f]) - (fun r => inv l.toList.tail r ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ inv [] l[0] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::reduce».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv l.toList.tail r ⋆ [λf ↦ fb]) := by enter_decl steps rcases l_def : l with ⟨ts, l_prf⟩ @@ -336,7 +371,8 @@ theorem reduce_spec {p T N Env l f fb} lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, BitVec.natCast_eq_ofNat, BitVec.ofNat_toNat, BitVec.setWidth_eq] at * - loop_inv nat fun i _ _ => ∃∃v, [accumulator ↦ ⟨T, v⟩] ⋆ [λf ↦ fb] ⋆ inv (r.take (i - 1)) v + loop_inv nat fun i _ _ => ∃∃v, [accumulator ↦ ⟨T, v⟩] ⋆ + [selfRef ↦ ⟨T.array N, ⟨init :: r, l_prf⟩⟩] ⋆ [λf ↦ fb] ⋆ inv (r.take (i - 1)) v · sl · simp only [BitVec.toNat_intCast, Int.reducePow, Int.reduceMod, Int.toNat_one]; omega · intro i hlo hhi @@ -374,67 +410,74 @@ theorem reduce_spec {p T N Env l f fb} subst_vars sl -theorem reduce_pure_spec {p T N Env l f fb fEmb} +theorem reduce_pure_spec {p T N Env l f fb fEmb} {selfRef : Ref (T.array N)} (l_len_gt : l.length > 0) (inv_pure : ∀a x, STHoare p env ⟦⟧ (fb h![a, x]) (fun r => r = fEmb a x)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::reduce».call h![T, N, Env] h![l, f]) - (fun r => r = l.toList.tail.foldl fEmb l[0] ⋆ [λf ↦ fb]) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::reduce».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ + ⟦r = l.toList.tail.foldl fEmb l[0]⟧ ⋆ [λf ↦ fb]) := by steps [reduce_spec (inv := fun xs v => v = xs.foldl fEmb l[0])] · rfl · assumption · intros; steps [inv_pure]; simp_all -theorem all_spec {p T N Env l f fb} +theorem all_spec {p T N Env l f fb} {selfRef : Ref (T.array N)} (inv : List (T.denote p) → Bool → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (op : Bool) (e : T.denote p), ((ip ++ [e] <+: l.toList) → STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ∧ r)))) : STHoare p env - (inv [] true ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::all».call h![T, N, Env] h![l, f]) - (fun r => inv l.toList r ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ inv [] true ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::all».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv l.toList r ⋆ [λf ↦ fb]) := by enter_decl steps - step_as ([ret ↦ ⟨.bool, true⟩] ⋆ (inv [] true) ⋆ [λf ↦ fb]) - (fun r => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ (inv l.toList b) ⋆ [λf ↦ fb]) - - steps - loop_inv nat fun i _ _ => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ (inv (l.toList.take i) b) ⋆ [λf ↦ fb] - · sl - · simp - · intro i hlo hhi + apply STHoare.letIn_intro + (Q := fun _ => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ + (inv l.toList b) ⋆ [λf ↦ fb]) + · steps - simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, - zero_le, Builtin.CastTp.cast, - BitVec.truncate_eq_setWidth, BitVec.setWidth_eq, - BitVec.toNat_ofNatLT] - generalize_proofs - rename Tp.denote p .bool => b - - have := inv_spec (l.toList.take i) b (l.toList[i]'(by simp_all)) (by simp [List.take_prefix]) - steps [STHoare.callLambda_intro (hlam := this)] - simp_all only [Bool.decide_and, Bool.decide_eq_true, Bool.forall_bool, Bool.false_and, - Bool.true_and, List.take_append_getElem, Lens.modify, Option.get_some] - sl - exact () - · simp_all only [Bool.decide_and, Bool.decide_eq_true, Bool.forall_bool, Bool.false_and, - Bool.true_and, BitVec.natCast_eq_ofNat, BitVec.ofNat_toNat, BitVec.setWidth_eq, SLP.star_true] + -- `steps` stalls on the loop-lowering alias `let ζi0 = selfRef`; substitute it and resume. + · subst ζi0 + sl + subst ζi0 steps - - have : l.toList.length = N.toNat := by simp - simp only [←this, List.take_length] + loop_inv nat fun i _ _ => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ + (inv (l.toList.take i) b) ⋆ [λf ↦ fb] + · sl + · simp + · intro i hlo hhi + steps + simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, + zero_le, Builtin.CastTp.cast, + BitVec.truncate_eq_setWidth, BitVec.setWidth_eq, + BitVec.toNat_ofNatLT] + generalize_proofs + rename Tp.denote p .bool => b + + have := inv_spec (l.toList.take i) b (l.toList[i]'(by simp_all)) (by simp [List.take_prefix]) + steps [STHoare.callLambda_intro (hlam := this)] + simp_all only [Bool.decide_and, Bool.decide_eq_true, Bool.forall_bool, Bool.false_and, + Bool.true_and, List.take_append_getElem, Lens.modify, Option.get_some] + sl + exact () + · + steps + have l1 : BitVec.toNat (↑(List.Vector.length l) : U 32) = l.toList.length := by simp + simp only [l1, List.take_length] + sl + · + intro _ + steps + subst_vars sl - steps - subst_vars - sl - -theorem all_pure_spec {p T N Env l f fb fEmb} +theorem all_pure_spec {p T N Env l f fb fEmb} {selfRef : Ref (T.array N)} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::all».call h![T, N, Env] h![l, f]) - (fun r => r = l.toList.all fEmb) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::all».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ ⟦r = l.toList.all fEmb⟧) := by steps [all_spec (inv := fun x r => r = x.all fEmb)] · simp · assumption @@ -444,55 +487,62 @@ theorem all_pure_spec {p T N Env l f fb fEmb} List.all_cons, List.all_nil, Bool.and_true] rw [←List.all_eq] -theorem any_spec {p T N Env l f fb} +theorem any_spec {p T N Env l f fb} {selfRef : Ref (T.array N)} (inv : List (T.denote p) → Bool → SLP (State p)) (inv_spec : ∀(ip : List (T.denote p)) (op : Bool) (e : T.denote p), ((ip ++ [e] <+: l.toList) → STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ∨ r)))) : STHoare p env - (inv [] false ⋆ [λf ↦ fb]) - («std-1.0.0-beta.25::array::any».call h![T, N, Env] h![l, f]) - (fun r => inv l.toList r ⋆ [λf ↦ fb]) := by + ([selfRef ↦ ⟨T.array N, l⟩] ⋆ inv [] false ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::any».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ inv l.toList r ⋆ [λf ↦ fb]) := by enter_decl steps - step_as ([ret ↦ ⟨.bool, false⟩] ⋆ (inv [] false) ⋆ [λf ↦ fb]) - (fun r => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ (inv l.toList b) ⋆ [λf ↦ fb]) - - steps - loop_inv nat fun i _ _ => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ (inv (l.toList.take i) b) ⋆ [λf ↦ fb] - · sl - · simp - · intro i hlo hhi + apply STHoare.letIn_intro + (Q := fun _ => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ + (inv l.toList b) ⋆ [λf ↦ fb]) + · steps - simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, - zero_le, Builtin.CastTp.cast, - BitVec.truncate_eq_setWidth, BitVec.setWidth_eq, - BitVec.toNat_ofNatLT] - generalize_proofs - rename Tp.denote p .bool => b - - have := inv_spec (l.toList.take i) b (l.toList[i]'(by simp_all)) (by simp [List.take_prefix]) - steps [STHoare.callLambda_intro (hlam := this)] - simp_all only [Bool.decide_or, Bool.decide_eq_true, Bool.forall_bool, Bool.false_or, - Bool.true_or, List.take_append_getElem, Lens.modify, Option.get_some] - sl - exact () - · simp_all only [Bool.forall_bool, BitVec.natCast_eq_ofNat, BitVec.ofNat_toNat, BitVec.setWidth_eq, SLP.star_true] + -- `steps` stalls on the loop-lowering alias `let ζi0 = selfRef`; substitute it and resume. + · subst ζi0 + sl + subst ζi0 steps - - have : l.toList.length = N.toNat := by simp - simp only [←this, List.take_length] + loop_inv nat fun i _ _ => ∃∃b, [ret ↦ ⟨.bool, b⟩] ⋆ [selfRef ↦ ⟨T.array N, l⟩] ⋆ + (inv (l.toList.take i) b) ⋆ [λf ↦ fb] + · sl + · simp + · intro i hlo hhi + steps + simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, + zero_le, Builtin.CastTp.cast, + BitVec.truncate_eq_setWidth, BitVec.setWidth_eq, + BitVec.toNat_ofNatLT] + generalize_proofs + rename Tp.denote p .bool => b + + have := inv_spec (l.toList.take i) b (l.toList[i]'(by simp_all)) (by simp [List.take_prefix]) + steps [STHoare.callLambda_intro (hlam := this)] + simp_all only [Bool.decide_or, Bool.decide_eq_true, Bool.forall_bool, Bool.false_or, + Bool.true_or, List.take_append_getElem, Lens.modify, Option.get_some] + sl + exact () + · + steps + have l1 : BitVec.toNat (↑(List.Vector.length l) : U 32) = l.toList.length := by simp + simp only [l1, List.take_length] + sl + · + intro _ + steps + subst_vars sl - steps - subst_vars - sl - -theorem any_pure_spec {p T N Env l f fb fEmb} +theorem any_pure_spec {p T N Env l f fb fEmb} {selfRef : Ref (T.array N)} (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::any».call h![T, N, Env] h![l, f]) - (fun r => r = l.toList.any fEmb) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::any».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ ⟦r = l.toList.any fEmb⟧) := by steps [any_spec (inv := fun x r => r = x.any fEmb)] · simp · assumption @@ -502,97 +552,66 @@ theorem any_pure_spec {p T N Env l f fb fEmb} List.any_cons, List.any_nil, Bool.or_false] rw [←List.any_eq] -theorem concat_spec: STHoare p env ⟦⟧ - («std-1.0.0-beta.25::array::concat».call h![T, M, N] h![a₁, a₂]) - (fun r => r.toList = a₁.toList ++ a₂.toList) := by +set_option maxHeartbeats 1000000 in +theorem concat_spec {p} {T : Tp} {M N : U 32} + {a₁ : List.Vector (Tp.denote p T) M.toNat} {a₂ : List.Vector (Tp.denote p T) N.toNat} + {selfRef : Ref (T.array M)} : STHoare p env + [selfRef ↦ ⟨T.array M, a₁⟩] + («std-1.0.0-beta.25::array::concat».call h![T, M, N] h![selfRef, a₂]) + (fun r => [selfRef ↦ ⟨T.array M, a₁⟩] ⋆ ⟦r.toList = a₁.toList ++ a₂.toList⟧) := by enter_decl steps - loop_inv nat fun i _ _ => ∃∃v, [result ↦ ⟨T.array (M + N), v⟩] ⋆ (v.toList.take i = a₁.toList.take i) + loop_inv nat fun i _ _ => ∃∃v, [result ↦ ⟨T.array (M + N), v⟩] ⋆ + [selfRef ↦ ⟨T.array M, a₁⟩] ⋆ (v.toList.take i = a₁.toList.take i) · sl simp · simp · intro i hil hiu steps - rename Option.isSome _ = true => hp - simp at hp - have hi_bound : i < (BitVec.toNat M + BitVec.toNat N) % 4294967296 := by - by_contra h - push_neg at h - rw [dif_neg (by omega)] at hp - simp at hp - rw [List.take_succ_eq_append_getElem ?lt1, List.take_succ_eq_append_getElem ?lt2] - case lt1 => simp_all - case lt2 => simp_all - simp only [BitVec.toNat_add, Nat.reducePow, BitVec.add_eq, Lens.modify, Lens.get, Access.modify, - BitVec.toNat_ofNatLT, Option.bind_eq_bind, Option.bind_some, Option.bind_fun_some, - dif_pos hi_bound] - -- `congr 1` splits into the take and getElem halves. - rename_i _v hloop hcast _ _ - generalize_proofs hb1 hb2 - set X := List.Vector.set _v ⟨i, hi_bound⟩ - (List.Vector.get a₁ ⟨BitVec.toNat (Builtin.CastTp.cast - (BitVec.ofNatLT i hb1 : Tp.denote p (Tp.u 32))), hcast⟩) with hX - show List.take i (List.Vector.toList ((Option.some X).get hb2)) ++ - [(List.Vector.toList ((Option.some X).get hb2))[i] ] = _ - show List.take i (List.Vector.toList X) ++ [(List.Vector.toList X)[i] ] = _ - congr 1 - · rw [hX, List.Vector.toList_set, List.take_set_of_le (le_refl _)] - exact hloop - · -- Goal: [(toList X)[i]] = [a₁.toList[i]]. Use `List.singleton_inj`-like reduction. - have h0 : (List.Vector.toList X)[i] = (List.Vector.toList a₁)[i] := by - simp only [hX, List.Vector.toList_set, List.getElem_set_self] - simp [List.Vector.toList, List.Vector.get, BitVec.toNat_ofNatLT] - exact congrArg (fun x => [x]) h0 + rename Tp.denote _ (Tp.array _ (_ + _)) => vv + rename List.take _ _ = _ => hloop + rename Option.isSome _ = true => hmod + have hidx := modify_array_isSome_bound hmod + rw [modify_array_get _ _ _ hidx] + simp only [Builtin.CastTp.cast, BitVec.setWidth_eq, BitVec.toNat_ofNatLT, + List.Vector.toList_set] + have hivlen : i < (List.Vector.toList vv).length := by + revert hidx + simp [Builtin.CastTp.cast, BitVec.setWidth_eq, BitVec.toNat_ofNatLT, BitVec.toNat_add, + BitVec.add_eq] + apply take_set_succ_prefix hivlen ?ha hloop ?hx + case ha => simp_all + case hx => simp [List.Vector.get_eq_get_toList, List.get_eq_getElem] steps - loop_inv nat fun i _ _ => ∃∃v, [result ↦ ⟨T.array (M + N), v⟩] ⋆ (v.toList.take (M.toNat + i) = a₁.toList ++ a₂.toList.take i) + loop_inv nat fun i _ _ => ∃∃v, [result ↦ ⟨T.array (M + N), v⟩] ⋆ + [selfRef ↦ ⟨T.array M, a₁⟩] ⋆ (v.toList.take (M.toNat + i) = a₁.toList ++ a₂.toList.take i) · sl simp_all · simp · intro i hil hiu steps - rw [←add_assoc, List.take_add_one, List.take_add_one, ←List.append_assoc] - have hi_eq : i_4238.toNat = M.toNat + i := by - subst i_4238 - simp only [BitVec.toNat_add] - rw [Nat.mod_eq_of_lt (by assumption), add_comm] - rfl - rename Option.isSome _ = true => hp - simp at hp - have hi_bound : BitVec.toNat i_4238 < (BitVec.toNat M + BitVec.toNat N) % 4294967296 := by - by_contra h - push_neg at h - rw [dif_neg (by omega)] at hp - simp at hp - simp only [BitVec.toNat_add, Nat.reducePow, BitVec.add_eq, Lens.modify, Lens.get, Access.modify, Option.bind_eq_bind, Option.bind_some, Option.bind_fun_some, - dif_pos hi_bound] - rename List.Vector _ _ => _v - rename (List.Vector.toList _).take _ = _ => hloop - rename BitVec.toNat _ < BitVec.toNat _ => hcast - generalize_proofs hb1 hb2 - set X := List.Vector.set _v ⟨BitVec.toNat i_4238, hi_bound⟩ - (List.Vector.get a₂ ⟨BitVec.toNat (Builtin.CastTp.cast - (BitVec.ofNatLT i hb1 : Tp.denote p (Tp.u 32))), hcast⟩) with hX - show List.take (BitVec.toNat M + i) (List.Vector.toList X) ++ - (List.Vector.toList X)[BitVec.toNat M + i]?.toList = _ - congr 1 - · rw [hX, List.Vector.toList_set, List.take_set_of_le (show BitVec.toNat M + i ≤ BitVec.toNat i_4238 by rw [hi_eq])] - exact hloop - · have hbnd : BitVec.toNat M + i < (BitVec.toNat M + BitVec.toNat N) % 4294967296 := by - rw [← hi_eq]; exact hi_bound - have h0 : (List.Vector.toList X)[BitVec.toNat M + i]? = some - (List.Vector.get a₂ ⟨BitVec.toNat (Builtin.CastTp.cast - (BitVec.ofNatLT i hb1 : Tp.denote p (Tp.u 32))), hcast⟩) := by - simp only [hX, List.Vector.toList_set, List.getElem?_set, hi_eq] - simp [hbnd] - have h1 : (List.Vector.toList a₂)[i]? = some (List.Vector.get a₂ - ⟨BitVec.toNat (Builtin.CastTp.cast - (BitVec.ofNatLT i hb1 : Tp.denote p (Tp.u 32))), hcast⟩) := by - simp [List.Vector.toList, List.Vector.get, - BitVec.toNat_ofNatLT] - rw [h0, h1] + rename Tp.denote _ (Tp.array _ (_ + _)) => vv + rename List.take _ _ = _ => hloop + rename Option.isSome _ = true => hmod + rename BitVec.toNat _ + BitVec.toNat M < _ => hof + have hidx := modify_array_isSome_bound hmod + rw [modify_array_get _ _ _ hidx] + have hof' : i + BitVec.toNat M < 4294967296 := by + revert hof + simp [BitVec.toNat_ofNatLT] + have hivlen : i + BitVec.toNat M < (List.Vector.toList vv).length := by + revert hidx + simp [BitVec.toNat_add, BitVec.toNat_ofNatLT, BitVec.add_eq, Nat.mod_eq_of_lt hof'] + have hia : i < (List.Vector.toList a₂).length := by simp_all + simp only [Builtin.CastTp.cast, BitVec.setWidth_eq, BitVec.toNat_ofNatLT, + BitVec.toNat_add, BitVec.add_eq, List.Vector.toList_set, Nat.mod_eq_of_lt hof'] + apply take_set_append_succ ?hk ?hv hia hloop ?hx + case hk => omega + case hv => simpa using hivlen + case hx => simp [List.Vector.get_eq_get_toList, List.get_eq_getElem] steps rename List.take _ _ = _ ++ _ => hp rw [List.take_of_length_le ?le1, List.take_of_length_le ?le2] at hp @@ -617,22 +636,44 @@ output is sorted. Note that we have intentionally omitted an impure theorem for `sort_via` as we can envision no sane use-case for impure comparator functions. -/ -theorem sort_via_spec {p T N Env l f fb} +theorem sort_via_spec {p T N Env l f fb} {selfRef : Ref (T.array N)} {t_eq : Cmp.Eq.hasImpl env T} (t_eq_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Eq.eq h![] T h![] h![] h![a, b]) (fun r : Bool => ⟦r ↔ a = b⟧)) {fEmb : T.denote p → T.denote p → Bool} (f_spec : ∀a b, STHoare p env ⟦⟧ (fb h![a, b]) (fun r => r = fEmb a b)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::sort_via».call h![T, N, Env] h![l, f]) - (fun r => List.OrderedBy (fEmb · · = true) r.toList ∧ List.Perm l.toList r.toList) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::sort_via».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ + ⟦List.OrderedBy (fEmb · · = true) r.toList ∧ List.Perm l.toList r.toList⟧) := by enter_decl let r_def := fun a b => fEmb a b = true + -- Since beta.25 the whole implementation is guarded by `if N != 0`. + steps + apply STHoare.ite_intro + swap + · + -- `N = 0`: the function returns `*self` unchanged. + intro hcond + steps + have hN0 : N.toNat = 0 := by + by_contra h + simp_all + have hnil : List.Vector.toList l = [] := by + apply List.eq_nil_of_length_eq_zero + simp [hN0] + subst_vars + refine ⟨?_, ?_⟩ + · rw [hnil]; exact List.OrderedBy.nil + · exact List.Perm.refl _ + + intro hne -- The call to `std::array::quicksort::quicksort` is just an unconstrained function, so returns -- a fresh value. We can say nothing else about it. - step_as ([λf ↦ fb]) (fun _ => [λf ↦ fb]) + step_as ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + (fun _ => [selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) · steps enter_decl steps @@ -640,8 +681,9 @@ theorem sort_via_spec {p T N Env l f fb} steps any_goals exact () - step_as ([λf ↦ fb]) (fun _ => [λf ↦ fb] ⋆ - List.OrderedBy r_def sorted.toList ∧ List.Perm l.toList sorted.toList) + step_as ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + (fun _ => [selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb] ⋆ + List.OrderedBy r_def sorted.toList ∧ List.Perm l.toList sorted.toList) apply STHoare.ite_intro any_goals intros; contradiction @@ -649,19 +691,23 @@ theorem sort_via_spec {p T N Env l f fb} intro cond steps - rename_i one_lt_n have zero_lt_n : 0 < N.toNat := by - simp_all only [Bool.not_false] - exact one_lt_n + subst_vars + by_contra h + simp_all + exact hne (BitVec.eq_of_toNat_eq (by simpa using h)) have n_eq_len : sorted.toList.length = N.toNat := by simp_all - loop_inv nat fun i _ _ => [λf ↦ fb] ⋆ List.OrderedBy r_def (sorted.toList.take (i + 1)) - · simp only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, - zero_add] - - rw [List.take_add_one, List.take_zero, List.getElem?_eq_getElem (by omega)] - apply List.OrderedBy.singleton - · simp + loop_inv nat fun i _ _ => [selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb] ⋆ + List.OrderedBy r_def (sorted.toList.take (i + 1)) + · + sl + -- `take (0 + 1)` has at most one element, so it is trivially ordered. + · intro j hj + simp at hj + try omega + -- `sl` side goal: `0 ≤ N - 1` on loop bounds. + simp · intro i hlo hhi steps rename List.OrderedBy _ _ => pfx_ordered @@ -710,7 +756,8 @@ theorem sort_via_spec {p T N Env l f fb} assumption · steps [CheckShuffle.check_shuffle_spec t_eq t_eq_spec] - rename_i ord perm _ + rename List.OrderedBy _ _ => ord + rename List.Perm _ _ => perm rw [BitVec.toNat_sub_of_le (by assumption)] at ord simp only [←n_eq_len, BitVec.toNat_intCast, Int.reducePow, Int.reduceMod, Int.toNat_one] at ord rw [Nat.sub_add_cancel (by omega)] at ord @@ -728,22 +775,21 @@ ordered by the provided relation. See `sort_via_spec` for a similar theorem that does not impose this restriction. -/ -theorem sort_via_trans_spec {p T N Env l f fb} +theorem sort_via_trans_spec {p T N Env l f fb} {selfRef : Ref (T.array N)} {t_eq : Cmp.Eq.hasImpl env T} (t_eq_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Eq.eq h![] T h![] h![] h![a, b]) (fun r : Bool => ⟦r ↔ a = b⟧)) {fEmb : T.denote p → T.denote p → Bool} (fEmb_trans : Transitive (fEmb · · = true)) (f_spec : ∀a b, STHoare p env ⟦⟧ (fb h![a, b]) (fun r => r = fEmb a b)) - : STHoare p env [λf ↦ fb] - («std-1.0.0-beta.25::array::sort_via».call h![T, N, Env] h![l, f]) - (fun r => List.Pairwise (fEmb · · = true) r.toList ∧ List.Perm l.toList r.toList) := by + : STHoare p env ([selfRef ↦ ⟨T.array N, l⟩] ⋆ [λf ↦ fb]) + («std-1.0.0-beta.25::array::sort_via».call h![T, N, Env] h![selfRef, f]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ + ⟦List.Pairwise (fEmb · · = true) r.toList ∧ List.Perm l.toList r.toList⟧) := by steps [sort_via_spec (t_eq := t_eq) t_eq_spec f_spec] - constructor rename_i a rcases a with ⟨ord_by, perm⟩ - exact List.OrderedBy.trans_eq_Sorted ord_by fEmb_trans - simp_all + exact ⟨List.OrderedBy.trans_eq_Sorted ord_by fEmb_trans, perm⟩ /-- This theorem asserts that `std::array::sort` implements a valid sort (namely that the output is @@ -762,7 +808,7 @@ the output is sorted. This theorem is pure, as we argue that there is no sensible use-case for impure `Ord` and `Eq` implementations for `T`. -/ -theorem sort_spec {p T N l} +theorem sort_spec {p T N l} {selfRef : Ref (T.array N)} {t_eq : Cmp.Eq.hasImpl env T} (t_eq_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Eq.eq h![] T h![] h![] h![a, b]) (fun r : Bool => ⟦r ↔ a = b⟧)) @@ -770,10 +816,11 @@ theorem sort_spec {p T N l} (t_ord_emb : Tp.comparator p T) (t_ord_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Ord.cmp h![] T h![] h![] h![a, b]) (fun r => r = Cmp.Ord.fromOrdering (t_ord_emb a b))) - : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::array::sort».call h![T, N] h![l]) - (fun r => List.OrderedBy (Cmp.Ord.le_emb t_ord_emb · ·) r.toList - ∧ List.Perm l.toList r.toList) := by + : STHoare p env [selfRef ↦ ⟨T.array N, l⟩] + («std-1.0.0-beta.25::array::sort».call h![T, N] h![selfRef]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ + ⟦List.OrderedBy (Cmp.Ord.le_emb t_ord_emb · ·) r.toList + ∧ List.Perm l.toList r.toList⟧) := by enter_decl steps @@ -799,7 +846,7 @@ ordered by the provided relation. See `sort_spec` for a similar theorem that does not impose this restriction. -/ -theorem sort_trans_spec {p T N l} +theorem sort_trans_spec {p T N l} {selfRef : Ref (T.array N)} {t_eq : Cmp.Eq.hasImpl env T} (t_eq_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Eq.eq h![] T h![] h![] h![a, b]) (fun r : Bool => ⟦r ↔ a = b⟧)) @@ -808,16 +855,16 @@ theorem sort_trans_spec {p T N l} (t_ord_trans : Std.TransCmp t_ord_emb) (t_ord_spec : ∀a b, STHoare p env ⟦⟧ (Cmp.Ord.cmp h![] T h![] h![] h![a, b]) (fun r => r = Cmp.Ord.fromOrdering (t_ord_emb a b))) - : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::array::sort».call h![T, N] h![l]) - (fun r => List.Pairwise (Cmp.Ord.le_emb t_ord_emb · ·) r.toList - ∧ List.Perm l.toList r.toList) := by + : STHoare p env [selfRef ↦ ⟨T.array N, l⟩] + («std-1.0.0-beta.25::array::sort».call h![T, N] h![selfRef]) + (fun r => [selfRef ↦ ⟨T.array N, l⟩] ⋆ + ⟦List.Pairwise (Cmp.Ord.le_emb t_ord_emb · ·) r.toList + ∧ List.Perm l.toList r.toList⟧) := by steps [sort_spec (t_eq := t_eq) t_eq_spec (t_ord := t_ord) t_ord_emb t_ord_spec] - constructor rename_i a rcases a with ⟨ord_by, perm⟩ - apply List.OrderedBy.trans_eq_Sorted ord_by (Cmp.Ord.le_emb_trans t_ord_emb t_ord_trans) - simp_all + exact ⟨List.OrderedBy.trans_eq_Sorted ord_by (Cmp.Ord.le_emb_trans t_ord_emb t_ord_trans), + perm⟩ theorem convert_from_str_spec {p N s} : STHoare p env ⟦⟧ diff --git a/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean b/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean index 83c67698..b2236ba8 100644 --- a/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean +++ b/stdlib/lampe/Stdlib/Collections/BoundedVec/HigherOrderMap.lean @@ -10,23 +10,28 @@ Higher-order method specs for Noir `BoundedVec`: `map` and `mapi` (pure variants This module is imported by `Stdlib.Collections.BoundedVec` as part of the public API surface. -/ -private theorem len_concrete_spec' {p T MaxLen self} : - STHoare p env ⟦⟧ - («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] h![self]) - (fun r => r = len self) := by +private theorem len_concrete_spec' {p T MaxLen self} + {selfRef : Ref (bvTp T MaxLen)} : + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len».call h![T, MaxLen] + h![selfRef]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ ⟦r = len self⟧) := by enter_decl steps - simpa [len] + simp_all [len] private theorem get_unchecked_concrete_spec' {p T MaxLen self index} + {selfRef : Ref (bvTp T MaxLen)} (hindex : index.toNat < MaxLen.toNat) : - STHoare p env ⟦⟧ + STHoare p env [selfRef ↦ ⟨bvTp T MaxLen, self⟩] («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked».call h![T, MaxLen] - h![self, index]) - (fun r => r = (storage self)[index.toNat]'hindex) := by + h![selfRef, index]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] + ⋆ ⟦r = (storage self)[index.toNat]'hindex⟧) := by enter_decl steps - simpa [storage] + simp_all [storage, List.Vector.get, List.Vector.getElem_def, BitVec.setWidth_eq] + try rfl @[simp] private theorem len_modify_head_tail {p T MaxLen} @@ -120,6 +125,7 @@ private theorem mapLike_constrained_loop_effectful_spec {T : Tp} {MaxLen : U 32} {Out : Tp} {Args : List Tp} {self : Repr p T MaxLen} + {selfRef : Ref (bvTp T MaxLen)} {f : FuncRef Args Out} {fb : HList (Tp.denote p) Args → Expr (Tp.denote p) Out} {mkArgs : U 32 → Tp.denote p T → HList (Tp.denote p) Args} @@ -137,21 +143,21 @@ private theorem mapLike_constrained_loop_effectful_spec : STHoare p env ([ret ↦ ⟨bvTp Out MaxLen, ((Lens.nil.cons (Access.tuple Member.head.tail)).modify vnew (len self)).get hmod⟩] ⋆ - [λf ↦ fb] ⋆ inv [] []) + [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ [λf ↦ fb] ⋆ inv [] []) (Expr.letIn (Expr.loop (↑0) MaxLen fun i => expr!![ { let lenFn = («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len» - as λ(splice!(bvTp T MaxLen)) -> u32); - let selfLen = (lenFn as λ(splice!(bvTp T MaxLen)) -> u32)(self); + as λ(splice!((bvTp T MaxLen).ref)) -> u32); + let selfLen = (lenFn as λ(splice!((bvTp T MaxLen).ref)) -> u32)(selfRef); let cond = (#_uLt returning bool)(i, selfLen); if cond then { let getUncheckedFn = («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked» - as λ(splice!(bvTp T MaxLen), u32) -> T); - let elem = (getUncheckedFn as λ(splice!(bvTp T MaxLen), u32) -> T)(self, i); + as λ(splice!((bvTp T MaxLen).ref), u32) -> T); + let elem = (getUncheckedFn as λ(splice!((bvTp T MaxLen).ref), u32) -> T)(selfRef, i); let tmp = splice!(Expr.call Args Out f (mkArgs i elem)); splice!(Expr.modifyLens (tp₁ := bvTp Out MaxLen) (tp₂ := Out) ret tmp ((Lens.nil.cons (Access.tuple Member.head)).cons (Access.array i))); @@ -162,7 +168,8 @@ private theorem mapLike_constrained_loop_effectful_spec fun _ => Expr.skip) (fun _ => ∃∃ v : Repr p Out MaxLen, - [ret ↦ ⟨bvTp Out MaxLen, v⟩] ⋆ [λf ↦ fb] ⋆ ⟦bounded v⟧ ⋆ inv (embed self) (embed v)) := by + [ret ↦ ⟨bvTp Out MaxLen, v⟩] ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦bounded v⟧ ⋆ inv (embed self) (embed v)) := by set xs : List (T.denote p) := embed self set n : Nat := (len self).toNat have hn_le : n ≤ MaxLen.toNat := by @@ -175,8 +182,9 @@ private theorem mapLike_constrained_loop_effectful_spec ∃∃ v : Repr p Out MaxLen, [ret ↦ ⟨bvTp Out MaxLen, v⟩] ⋆ [λf ↦ fb] ⋆ - inv (xs.take (Nat.min i n)) (List.take (Nat.min i n) (storage v).toList) ⋆ - ⟦len v = len self ∧ bounded v⟧ + [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + inv (xs.take (Nat.min i n)) (List.take (Nat.min i n) (storage v).toList) ⋆ + ⟦len v = len self ∧ bounded v⟧ apply (STHoare.letIn_intro (Q := fun _ => Inv MaxLen.toNat)) · @@ -224,7 +232,7 @@ private theorem mapLike_constrained_loop_effectful_spec have hiMax : i32.toNat < MaxLen.toNat := hi_toNat ▸ hhi have hget := get_unchecked_concrete_spec' (p := p) (T := T) (MaxLen := MaxLen) (self := self) - (index := i32) (hindex := hiMax) + (selfRef := selfRef) (index := i32) (hindex := hiMax) steps [hget] have hi_embed : i < (embed self).length := by simpa [xs, hx_len] using hi_lt @@ -303,11 +311,13 @@ private theorem mapLike_constrained_loop_effectful_spec intro _ let Qfinal : SLP (State p) := ∃∃ v : Repr p Out MaxLen, - [ret ↦ ⟨bvTp Out MaxLen, v⟩] ⋆ [λf ↦ fb] ⋆ ⟦bounded v⟧ ⋆ inv xs (embed v) + [ret ↦ ⟨bvTp Out MaxLen, v⟩] ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦bounded v⟧ ⋆ inv xs (embed v) have hInv_to_Q : Inv MaxLen.toNat ⊢ Qfinal := by dsimp [Inv, Qfinal] refine SLP.exists_mono fun v => ?_ - refine SLP.star_mono SLP.entails_self (SLP.star_mono SLP.entails_self ?_) + refine SLP.star_mono SLP.entails_self + (SLP.star_mono SLP.entails_self (SLP.star_mono SLP.entails_self ?_)) rw [SLP.star_comm]; apply SLP.pure_left; intro ⟨hlenV, hbV⟩ have hlenNat : (len v).toNat = n := by simpa [n] using congrArg BitVec.toNat hlenV refine SLP.pure_right hbV fun st hinv => ?_ @@ -330,16 +340,18 @@ Note: `inv` must describe only external state effects; it is framed disjointly f `ret` heaplet used to build the output vector (same assumption as `Stdlib.Vector.map_spec`). -/ theorem map_effectful_spec {p T MaxLen Out Env self f fb} + {selfRef : Ref (bvTp T MaxLen)} (hwf_self : wellFormed self) (inv : List (T.denote p) → List (Out.denote p) → SLP (State p)) (inv_step : ∀ (ip : List (T.denote p)) (op : List (Out.denote p)) (e : T.denote p), (ip ++ [e] <+: embed self) → STHoare p env (inv ip op) (fb h![e]) (fun r => inv (ip ++ [e]) (op ++ [r]))) - : STHoare p env (inv [] [] ⋆ [λf ↦ fb]) + : STHoare p env (inv [] [] ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::map».call h![T, MaxLen, Out, Env] - h![self, f]) - (fun r => ⟦wellFormed r⟧ ⋆ inv (embed self) (embed r)) := by + h![selfRef, f]) + (fun r => ⟦wellFormed r⟧ ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + inv (embed self) (embed r)) := by enter_decl have hb : bounded self := (bounded_iff_wellFormed (v := self)).2 hwf_self set xs : List (T.denote p) := embed self @@ -355,7 +367,8 @@ theorem map_effectful_spec {p T MaxLen Out Env self f fb} ∃∃ v : Repr p Out MaxLen, [ret ↦ ⟨bvTp Out MaxLen, v⟩] ⋆ [λf ↦ fb] ⋆ - ⟦bounded v⟧ ⋆ inv xs (embed v))) + [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦bounded v⟧ ⋆ inv xs (embed v))) · apply STHoare.ite_intro_of_false rfl steps @@ -372,7 +385,7 @@ theorem map_effectful_spec {p T MaxLen Out Env self f fb} simpa [xs] using (mapLike_constrained_loop_effectful_spec (p := p) (T := T) (MaxLen := MaxLen) (Out := Out) (Args := [T]) (mkArgs := fun _ a => h![a]) - (self := self) (f := f) (fb := fb) (ret := ret) + (self := self) (selfRef := selfRef) (f := f) (fb := fb) (ret := ret) (hb := hb) (hmod := hmod) (inv := inv) (inv_step := inv_step')) · intro _ @@ -384,6 +397,7 @@ theorem map_effectful_spec {p T MaxLen Out Env self f fb} simpa [hb] using hwf theorem mapi_effectful_spec {p T MaxLen Out Env self f fb} + {selfRef : Ref (bvTp T MaxLen)} (hwf_self : wellFormed self) (inv : List (T.denote p) → List (Out.denote p) → SLP (State p)) (inv_step : @@ -391,10 +405,11 @@ theorem mapi_effectful_spec {p T MaxLen Out Env self f fb} (ip ++ [e] <+: embed self) → i.toNat = ip.length → STHoare p env (inv ip op) (fb h![i, e]) (fun r => inv (ip ++ [e]) (op ++ [r]))) - : STHoare p env (inv [] [] ⋆ [λf ↦ fb]) + : STHoare p env (inv [] [] ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::mapi».call h![T, MaxLen, Out, Env] - h![self, f]) - (fun r => ⟦wellFormed r⟧ ⋆ inv (embed self) (embed r)) := by + h![selfRef, f]) + (fun r => ⟦wellFormed r⟧ ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + inv (embed self) (embed r)) := by enter_decl have hb : bounded self := (bounded_iff_wellFormed (v := self)).2 hwf_self set xs : List (T.denote p) := embed self @@ -409,7 +424,8 @@ theorem mapi_effectful_spec {p T MaxLen Out Env self f fb} ∃∃ v : Repr p Out MaxLen, [ret ↦ ⟨bvTp Out MaxLen, v⟩] ⋆ [λf ↦ fb] ⋆ - ⟦bounded v⟧ ⋆ inv xs (embed v))) + [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦bounded v⟧ ⋆ inv xs (embed v))) · apply STHoare.ite_intro_of_false rfl steps @@ -418,7 +434,7 @@ theorem mapi_effectful_spec {p T MaxLen Out Env self f fb} simpa [xs] using (mapLike_constrained_loop_effectful_spec (p := p) (T := T) (MaxLen := MaxLen) (Out := Out) (Args := [Tp.u 32, T]) (mkArgs := fun i a => h![i, a]) - (self := self) (f := f) (fb := fb) (ret := ret) + (self := self) (selfRef := selfRef) (f := f) (fb := fb) (ret := ret) (hb := hb) (hmod := hmod) (inv := inv) (inv_step := inv_step)) · intro _ @@ -441,25 +457,32 @@ private lemma lambda_entails_lift_star_left SLP.pure_right hP SLP.entails_self theorem map_pure_spec {p T MaxLen Out Env self f fb fEmb} + {selfRef : Ref (bvTp T MaxLen)} (hwf_self : wellFormed self) (inv_pure : ∀a, STHoare p env ⟦⟧ (fb h![a]) (fun r => r = fEmb a)) - : STHoare p env [λf ↦ fb] + : STHoare p env ([λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::map».call h![T, MaxLen, Out, Env] - h![self, f]) - (fun r => wellFormed r ∧ embed r = (embed self).map fEmb) := by + h![selfRef, f]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦wellFormed r ∧ embed r = (embed self).map fEmb⟧) := by -- Corollary of `map_effectful_spec` with the pure invariant `inv ip op := ⟦op = ip.map fEmb⟧`. refine STHoare.consequence - (H₁ := ⟦([] : List (Out.denote p)) = ([] : List (T.denote p)).map fEmb⟧ ⋆ [λf ↦ fb]) - (Q₁ := fun r => ⟦wellFormed r⟧ ⋆ ⟦embed r = (embed self).map fEmb⟧) + (H₁ := ⟦([] : List (Out.denote p)) = ([] : List (T.denote p)).map fEmb⟧ ⋆ [λf ↦ fb] ⋆ + [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) + (Q₁ := fun r => ⟦wellFormed r⟧ ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦embed r = (embed self).map fEmb⟧) ?_ ?_ ?_ - · -- Pre: `[λf ↦ fb] ⊢ ⟦[] = [].map fEmb⟧ ⋆ [λf ↦ fb]`. - exact lambda_entails_lift_star_left (by simp) - · -- Post: `(⟦wellFormed r⟧ ⋆ ⟦embed r = ...⟧) ⋆ ⊤ ⊢ ⟦wellFormed r ∧ embed r = ...⟧ ⋆ ⊤`. + · -- Pre: add the trivial `⟦[] = [].map fEmb⟧` on the left. + exact SLP.pure_right (by simp) SLP.entails_self + · -- Post: fold the two lifts around the `selfRef` chunk into one. intro r - simp only [SLP.lift_star_lift] - exact SLP.entails_self + rw [SLP.star_assoc] + apply SLP.pure_left + intro hwfR + exact SLP.star_mono (SLP.star_mono_l (SLP.lift_mono fun hembR => ⟨hwfR, hembR⟩)) + SLP.entails_self · refine map_effectful_spec (p := p) (T := T) (MaxLen := MaxLen) (Out := Out) (Env := Env) - (self := self) (f := f) (fb := fb) hwf_self + (self := self) (selfRef := selfRef) (f := f) (fb := fb) hwf_self (inv := fun ip op => ⟦op = ip.map fEmb⟧) (inv_step := ?_) intro ip op e _ @@ -477,27 +500,34 @@ theorem map_pure_spec {p T MaxLen Out Env self f fb fEmb} exact SLP.pure_right (by simp [hr, hop]) SLP.entails_top theorem mapi_pure_spec {p T MaxLen Out Env self f fb fEmb} + {selfRef : Ref (bvTp T MaxLen)} (hwf_self : wellFormed self) (inv_pure : ∀ (i : U 32) (a : Tp.denote p T), (hi : i.toNat < (embed self).length) → STHoare p env ⟦⟧ (fb h![i, a]) (fun r => r = fEmb i.toNat a)) - : STHoare p env [λf ↦ fb] + : STHoare p env ([λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::mapi».call h![T, MaxLen, Out, Env] - h![self, f]) - (fun r => wellFormed r ∧ embed r = (embed self).mapIdx fEmb) := by + h![selfRef, f]) + (fun r => [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦wellFormed r ∧ embed r = (embed self).mapIdx fEmb⟧) := by -- Corollary of `mapi_effectful_spec` with the pure invariant `inv ip op := ⟦op = ip.mapIdx fEmb⟧`. refine STHoare.consequence - (H₁ := ⟦([] : List (Out.denote p)) = ([] : List (T.denote p)).mapIdx fEmb⟧ ⋆ [λf ↦ fb]) - (Q₁ := fun r => ⟦wellFormed r⟧ ⋆ ⟦embed r = (embed self).mapIdx fEmb⟧) + (H₁ := ⟦([] : List (Out.denote p)) = ([] : List (T.denote p)).mapIdx fEmb⟧ ⋆ [λf ↦ fb] ⋆ + [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) + (Q₁ := fun r => ⟦wellFormed r⟧ ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ + ⟦embed r = (embed self).mapIdx fEmb⟧) ?_ ?_ ?_ - · -- Pre: `[λf ↦ fb] ⊢ ⟦[] = [].mapIdx fEmb⟧ ⋆ [λf ↦ fb]`. - exact lambda_entails_lift_star_left (by simp) - · -- Post: `(⟦wellFormed r⟧ ⋆ ⟦embed r = ...⟧) ⋆ ⊤ ⊢ ⟦wellFormed r ∧ embed r = ...⟧ ⋆ ⊤`. + · -- Pre: add the trivial `⟦[] = [].mapIdx fEmb⟧` on the left. + exact SLP.pure_right (by simp) SLP.entails_self + · -- Post: fold the two lifts around the `selfRef` chunk into one. intro r - simp only [SLP.lift_star_lift] - exact SLP.entails_self + rw [SLP.star_assoc] + apply SLP.pure_left + intro hwfR + exact SLP.star_mono (SLP.star_mono_l (SLP.lift_mono fun hembR => ⟨hwfR, hembR⟩)) + SLP.entails_self · refine mapi_effectful_spec (p := p) (T := T) (MaxLen := MaxLen) (Out := Out) (Env := Env) - (self := self) (f := f) (fb := fb) hwf_self + (self := self) (selfRef := selfRef) (f := f) (fb := fb) hwf_self (inv := fun ip op => ⟦op = ip.mapIdx fEmb⟧) (inv_step := ?_) intro ip op i e hprefix hip_len @@ -723,6 +753,7 @@ private theorem forEachLike_constrained_loop_spec {T : Tp} {MaxLen : U 32} {Args : List Tp} {self : Repr p T MaxLen} + {selfRef : Ref (bvTp T MaxLen)} {f : FuncRef Args Tp.unit} {fb : HList (Tp.denote p) Args → Expr (Tp.denote p) Tp.unit} {mkArgs : U 32 → Tp.denote p T → HList (Tp.denote p) Args} @@ -734,28 +765,28 @@ private theorem forEachLike_constrained_loop_spec i.toNat = ip.length → STHoare p env (Inv ip) (fb (mkArgs i e)) (fun _ => Inv (ip ++ [e]))) : STHoare p env - (Inv [] ⋆ [λf ↦ fb]) + ([selfRef ↦ ⟨bvTp T MaxLen, self⟩] ⋆ [λf ↦ fb] ⋆ Inv []) (Expr.letIn (Expr.loop (↑0) MaxLen fun i => expr!![ { let lenFn = («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::len» - as λ(splice!(bvTp T MaxLen)) -> u32); - let selfLen = (lenFn as λ(splice!(bvTp T MaxLen)) -> u32)(self); + as λ(splice!((bvTp T MaxLen).ref)) -> u32); + let selfLen = (lenFn as λ(splice!((bvTp T MaxLen).ref)) -> u32)(selfRef); let cond = (#_uLt returning bool)(i, selfLen); if cond then { let getUncheckedFn = («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::get_unchecked» - as λ(splice!(bvTp T MaxLen), u32) -> T); - let elem = (getUncheckedFn as λ(splice!(bvTp T MaxLen), u32) -> T)(self, i); + as λ(splice!((bvTp T MaxLen).ref), u32) -> T); + let elem = (getUncheckedFn as λ(splice!((bvTp T MaxLen).ref), u32) -> T)(selfRef, i); splice!(Expr.call Args Tp.unit f (mkArgs i elem)); #_skip } } ]) fun _ => Expr.skip) - (fun _ => Inv (embed self) ⋆ [λf ↦ fb]) := by + (fun _ => Inv (embed self) ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) := by set xs : List (T.denote p) := embed self set n : Nat := (len self).toNat have hn_le : n ≤ MaxLen.toNat := by @@ -763,16 +794,19 @@ private theorem forEachLike_constrained_loop_spec have hx_len : xs.length = n := by simpa [xs, n] using embed_length_eq_len_toNat (v := self) hb -- Peel `let _ := (for i in 0..MaxLen { ... }) in skip`. - apply (STHoare.letIn_intro (Q := fun _ => Inv xs ⋆ [λf ↦ fb])) + apply (STHoare.letIn_intro + (Q := fun _ => Inv xs ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩])) · - loop_inv nat (fun i _ _ => Inv (xs.take (Nat.min i n)) ⋆ [λf ↦ fb]) + loop_inv nat (fun i _ _ => + Inv (xs.take (Nat.min i n)) ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) + · + -- initial entailment (`sl` leaves the `0 ≤ MaxLen` loop-bound side goal) + sl + simp · -- postcondition weakening simp only [Nat.min_eq_right hn_le, List.take_of_length_le (Nat.le_of_eq hx_len)] - exact SLP.ent_star_top - · - -- 0 ≤ MaxLen.toNat - simp [Nat.zero_le MaxLen.toNat] + sl · intro i hlo hhi have pf : i < 2 ^ 32 := lt_two_pow_of_lt_maxLen (MaxLen := MaxLen) hhi @@ -793,7 +827,7 @@ private theorem forEachLike_constrained_loop_spec simp [hmodNat]; exact hhi have hget := get_unchecked_concrete_spec' (p := p) (T := T) (MaxLen := MaxLen) (self := self) - (index := BitVec.ofNatLT i pf) (hindex := hiMax) + (selfRef := selfRef) (index := BitVec.ofNatLT i pf) (hindex := hiMax) steps [hget] subst getUncheckedFn steps [hget] @@ -838,7 +872,7 @@ private theorem forEachLike_constrained_loop_spec intro _ steps -theorem for_each_spec {T Env p MaxLen self f fb} +theorem for_each_spec {T Env p MaxLen self f fb} {selfRef : Ref (bvTp T MaxLen)} (hwf_self : wellFormed self) (Inv : List (Tp.denote p T) → SLP (State p)) (h_inv : @@ -846,10 +880,10 @@ theorem for_each_spec {T Env p MaxLen self f fb} (lp ++ [e] <+: embed self) → STHoare p env (Inv lp) (fb h![e]) (fun _ => Inv (lp ++ [e]))) : STHoare p env - (Inv [] ⋆ [λf ↦ fb]) + (Inv [] ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::for_each».call h![T, MaxLen, Env] - h![self, f]) - (fun _ => Inv (embed self) ⋆ [λf ↦ fb]) := by + h![selfRef, f]) + (fun _ => Inv (embed self) ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) := by enter_decl have hb : bounded self := (bounded_iff_wellFormed (v := self)).2 hwf_self -- Reduce `isUnconstrained()` (always `false`) and enter the constrained branch. @@ -857,15 +891,14 @@ theorem for_each_spec {T Env p MaxLen self f fb} all_goals (try exact ()) apply STHoare.ite_intro_of_false rfl steps - rw [SLP.star_comm] apply forEachLike_constrained_loop_spec (p := p) (T := T) (MaxLen := MaxLen) (Args := [T]) (mkArgs := fun _ a => h![a]) - (self := self) (f := f) (fb := fb) + (self := self) (selfRef := selfRef) (f := f) (fb := fb) (hb := hb) (Inv := Inv) (inv_step := by intro ip i e hprefix _ exact h_inv (lp := ip) (e := e) hprefix) -theorem for_eachi_spec {T Env p MaxLen self f fb} +theorem for_eachi_spec {T Env p MaxLen self f fb} {selfRef : Ref (bvTp T MaxLen)} (hwf_self : wellFormed self) (inv : List (T.denote p) → SLP (State p)) (inv_spec : @@ -873,10 +906,10 @@ theorem for_eachi_spec {T Env p MaxLen self f fb} (ip ++ [e] <+: embed self) → STHoare p env (inv ip) (fb h![ip.length, e]) (fun _ => inv (ip ++ [e]))) : STHoare p env - (inv [] ⋆ [λf ↦ fb]) + (inv [] ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) («std-1.0.0-beta.25::collections::bounded_vec::BoundedVec::for_eachi».call h![T, MaxLen, Env] - h![self, f]) - (fun _ => inv (embed self) ⋆ [λf ↦ fb]) := by + h![selfRef, f]) + (fun _ => inv (embed self) ⋆ [λf ↦ fb] ⋆ [selfRef ↦ ⟨bvTp T MaxLen, self⟩]) := by enter_decl have hb : bounded self := (bounded_iff_wellFormed (v := self)).2 hwf_self -- Reduce `isUnconstrained()` (always `false`) and enter the constrained branch. @@ -884,10 +917,9 @@ theorem for_eachi_spec {T Env p MaxLen self f fb} all_goals (try exact ()) apply STHoare.ite_intro_of_false rfl steps - rw [SLP.star_comm] apply forEachLike_constrained_loop_spec (p := p) (T := T) (MaxLen := MaxLen) (Args := [Tp.u 32, T]) (mkArgs := fun i a => h![i, a]) - (self := self) (f := f) (fb := fb) + (self := self) (selfRef := selfRef) (f := f) (fb := fb) (hb := hb) (Inv := inv) (inv_step := by intro ip i e hprefix hip_len have i_eq_len : (ip).length = i.toNat := by omega diff --git a/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean b/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean index 3c3a135f..64de49bd 100644 --- a/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean +++ b/stdlib/lampe/Stdlib/Collections/BoundedVec/Traits.lean @@ -21,25 +21,86 @@ theorem eq_trait_spec {p T MaxLen self other} (fun r : Bool => ⟦r ↔ a = b⟧)} : STHoare p env ⟦⟧ (Lampe.Stdlib.Cmp.Eq.eq h![] (bvTp T MaxLen) h![] h![] h![self, other]) - (fun r : Bool => ⟦r ↔ (len self = len other ∧ storage self = storage other)⟧) := by + (fun r : Bool => ⟦r ↔ (len self = len other ∧ embed self = embed other)⟧) := by resolve_trait - -- The extracted implementation is: - -- `if self.1 == other.1 then (self.0 == other.0) else false`. + -- The extracted implementation compares lengths, then (in the constrained branch — + -- `is_unconstrained` is modelled as `false`) compares the first `len` elements through a + -- mutable `eq` accumulator. Note it only inspects *active* elements, so the spec is stated + -- in terms of `embed`, not the whole `storage`. steps by_cases hlen : self.2.1 = other.2.1 · - -- length matches: reduce to array equality on storage. + -- length matches: run the element-comparison loop. apply STHoare.ite_intro_of_true (by show decide (Builtin.indexTpl self Member.head.tail = Builtin.indexTpl other Member.head.tail) = true change decide (self.2.1 = other.2.1) = true simp [hlen]) - steps [Lampe.Stdlib.Cmp.Eq.array_eq_pure_spec (T := T) (N := MaxLen) (a := storage self) (b := storage other) - (t_eq := t_eq) (t_eq_f := t_eq_f)] + steps + · exact () + apply STHoare.ite_intro_of_false (by rfl) + steps + loop_inv nat fun i _ _ => ∃∃v, [eq ↦ ⟨.bool, v⟩] ⋆ + (v = ((embed self).take i = (embed other).take i)) + · sl + simp + · simp + · intro i _ ihi + steps + apply STHoare.ite_intro + · intro hlt + steps [t_eq_f] + rotate_left + · exact () + rename (_ = true) = _ => hinv + rename _ ↔ _ => helem + simp only [decide_eq_true_eq] at hlt + have hi32 : i < 4294967296 := lt_trans ihi (BitVec.isLt MaxLen) + have hlt' : i < (len self).toNat := by + simpa [BitVec.lt_def, Nat.mod_eq_of_lt hi32] using hlt + have hlenN : (len other).toNat = (len self).toNat := by + show (other.2.1).toNat = (self.2.1).toNat + rw [hlen] + have hi_self : i < (embed self).length := by + rw [embed_length_eq_min_len_toNat]; exact lt_min hlt' ihi + have hi_other : i < (embed other).length := by + rw [embed_length_eq_min_len_toNat, hlenN]; exact lt_min hlt' ihi + simp only [Lens.modify, Option.get_some, Bool.and_eq_true, eq_iff_iff] at hinv ⊢ + rw [List.take_add_one, List.take_add_one, + List.getElem?_eq_getElem hi_self, List.getElem?_eq_getElem hi_other] + simp only [Option.toList_some] + rw [←List.concat_eq_append, ←List.concat_eq_append, List.concat_inj] + have helem' : op_rhs_0 = true ↔ (embed self)[i]'hi_self = (embed other)[i]'hi_other := by + simpa [embed, active, storage, List.getElem_take, List.Vector.get_eq_get_toList, + Builtin.CastTp.cast, Nat.mod_eq_of_lt hi32] using helem + exact and_congr hinv helem' + · intro hge + steps + rename (_ = true) = _ => hinv + simp only [decide_eq_false_iff_not, BitVec.not_lt] at hge + have hi32 : i < 4294967296 := lt_trans ihi (BitVec.isLt MaxLen) + have hge' : (len self).toNat ≤ i := by + simpa [BitVec.le_def, Nat.mod_eq_of_lt hi32] using hge + have hlenN : (len other).toNat = (len self).toNat := by + show (other.2.1).toNat = (self.2.1).toNat + rw [hlen] + have h1 : (embed self).length ≤ i := by + rw [embed_length_eq_min_len_toNat]; exact le_trans (Nat.min_le_left _ _) hge' + have h2 : (embed other).length ≤ i := by + rw [embed_length_eq_min_len_toNat, hlenN]; exact le_trans (Nat.min_le_left _ _) hge' + rw [List.take_of_length_le h1, List.take_of_length_le h2] at hinv + rw [List.take_of_length_le (Nat.le_succ_of_le h1), List.take_of_length_le (Nat.le_succ_of_le h2)] + exact hinv + steps rename_i v hv - refine ⟨fun h => ⟨?_, ?_⟩, fun ⟨_, h⟩ => ?_⟩ - · exact hlen - · exact (hv.mp h) - · exact hv.mpr h + rename (_ = true) = _ => hfin + have h1 : (embed self).length ≤ MaxLen.toNat := by + rw [embed_length_eq_min_len_toNat]; exact Nat.min_le_right _ _ + have h2 : (embed other).length ≤ MaxLen.toNat := by + rw [embed_length_eq_min_len_toNat]; exact Nat.min_le_right _ _ + rw [List.take_of_length_le h1, List.take_of_length_le h2] at hfin + subst hv + rw [hfin] + exact ⟨fun h => ⟨hlen, h⟩, fun ⟨_, h⟩ => h⟩ · -- length mismatch: return `false`. apply STHoare.ite_intro_of_false (by diff --git a/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean b/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean index 919cfedb..81854078 100644 --- a/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean +++ b/stdlib/lampe/Stdlib/EmbeddedCurveOps.lean @@ -52,8 +52,8 @@ def denote (p : Prime) := Tp.denote p type @[simp] theorem type_eq_crypto_pointTp : Point.type = pointTp := rfl -def mk {p} (x y : Fp p) (isInfinite : Bool) : Point.denote p := - mkPoint x y isInfinite +def mk {p} (x y : Fp p) : Point.denote p := + mkPoint x y def x {p} (self : Point.denote p) : Fp p := pointX self @@ -65,7 +65,7 @@ def isInfinite {p} (self : Point.denote p) : Bool := def infinity {p} : Point.denote p := pointAtInfinity def generator {p} : Point.denote p := - Point.mk 1 17631683881184975370165255887551781615748388533673675138860 false + Point.mk 1 17631683881184975370165255887551781615748388533673675138860 def canonicalizeInfinity {p} (self : Point.denote p) : Point.denote p := if Point.isInfinite self then Point.infinity else self @@ -81,8 +81,7 @@ def extEq {p} (self other : Point.denote p) : Prop := @[simp] private theorem indexTpl_y {p} (self : Point.denote p) : Builtin.indexTpl self Member.head.tail = Point.y self := rfl -@[simp] private theorem indexTpl_isInfinite {p} (self : Point.denote p) : - Builtin.indexTpl self Member.head.tail.tail = Point.isInfinite self := rfl +-- Since beta.25 there is no `is_infinite` member: infinity is canonically `(0, 0)`. @[simp] theorem canonicalizeInfinity_of_infinite {p} {self : Point.denote p} (h : Point.isInfinite self = true) : @@ -105,10 +104,21 @@ def extEq {p} (self other : Point.denote p) : Prop := · simp [Point.canonicalizeInfinity, h] · simp [Point.canonicalizeInfinity, h] +@[simp] theorem canonicalizeInfinity_eq_self {p} (self : Point.denote p) : + Point.canonicalizeInfinity self = self := by + obtain ⟨x, y, ⟨⟩⟩ := self + by_cases h : Point.isInfinite ((x, y, ()) : Point.denote p) = true + · have hxy := h + simp only [Point.isInfinite, pointIsInfinite, Bool.and_eq_true, + decide_eq_true_eq] at hxy + simp [Point.canonicalizeInfinity, h, Point.infinity, pointAtInfinity, mkPoint, + hxy.1, hxy.2] + · simp [Point.canonicalizeInfinity, h] + @[simp] theorem extEq_refl {p} (self : Point.denote p) : Point.extEq self self := rfl def neg {p} (self : Point.denote p) : Point.denote p := - Point.mk (Point.x self) (-(Point.y self)) (Point.isInfinite self) + Point.mk (Point.x self) (-(Point.y self)) /-- `Point.neg` on an encoded Mathlib curve point matches Mathlib's group negation under the encoding. Used to bridge `point_sub_spec` @@ -138,9 +148,7 @@ theorem neg_encodeCurvePoint {p} pointIsInfinite] def eq {p} (a b : Point.denote p) : Bool := - (Point.isInfinite a && Point.isInfinite b) || - (decide (Point.isInfinite a = Point.isInfinite b) && - decide (Point.x a = Point.x b) && decide (Point.y a = Point.y b)) + decide (Point.x a = Point.x b) && decide (Point.y a = Point.y b) end Point @@ -314,28 +322,17 @@ theorem point_eq_spec {p} {self other : Point.denote p} : (fun r => r = true ↔ Point.extEq self other) := by steps [point_eq_concrete_spec] subst_vars - obtain ⟨sx, sy, sinf, ⟨⟩⟩ := self - obtain ⟨ox, oy, oinf, ⟨⟩⟩ := other - cases sinf <;> cases oinf <;> - simp [Point.eq, Point.extEq, Point.canonicalizeInfinity, Point.infinity, - Point.x, Point.y, Point.isInfinite, pointX, - pointY, pointIsInfinite, - pointAtInfinity, mkPoint, - Bool.and_eq_true, decide_eq_true_eq] - -- After simp, three residual goals remain (cases produced in order ff, ft, tf, tt): - -- false.false: sx=ox ∧ sy=oy ↔ (sx,sy,false,()) = (ox,oy,false,()) - · constructor - · rintro ⟨rfl, rfl⟩; rfl - · intro h - refine ⟨?_, ?_⟩ - · exact (Prod.mk.inj h).1 - · exact (Prod.mk.inj (Prod.mk.inj h).2).1 - -- false.true: ¬ (sx,sy,false,()) = (0,0,true,()) - · intro h - exact Bool.false_ne_true (Prod.mk.inj (Prod.mk.inj (Prod.mk.inj h).2).2).1 - -- true.false: ¬ (0,0,true,()) = (ox,oy,false,()) + obtain ⟨sx, sy, ⟨⟩⟩ := self + obtain ⟨ox, oy, ⟨⟩⟩ := other + simp [Point.eq, Point.extEq, Point.x, Point.y, pointX, pointY, + Bool.and_eq_true, decide_eq_true_eq] + constructor + · rintro ⟨rfl, rfl⟩ + rfl · intro h - exact Bool.false_ne_true (Prod.mk.inj (Prod.mk.inj (Prod.mk.inj h).2).2).1.symm + injection h with h1 h2 + injection h2 with h2 _ + exact ⟨h1, h2⟩ private theorem scalar_eq_concrete_spec {p} {self other : Scalar.denote p} : STHoare p env ⟦⟧ @@ -391,22 +388,6 @@ theorem embedded_curve_add_builtin_spec {p} rintro ⟨h1, h2⟩ rfl -theorem embedded_curve_add_inner_spec {p} - {point1 point2 : Point.denote p} - (hOnCurve : - (curvePoint? point1).isSome ∧ - (curvePoint? point2).isSome) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.25::embedded_curve_ops::embedded_curve_add_inner».call - h![] h![point1, point2]) - (fun r => - r = encodeCurvePoint - ((curvePoint? point1).get hOnCurve.1 + - (curvePoint? point2).get hOnCurve.2)) := by - enter_decl - steps [embedded_curve_add_builtin_spec (hOnCurve := hOnCurve)] - simpa - theorem embedded_curve_add_spec {p} {point1 point2 : Point.denote p} (hOnCurve : @@ -420,11 +401,9 @@ theorem embedded_curve_add_spec {p} ((curvePoint? point1).get hOnCurve.1 + (curvePoint? point2).get hOnCurve.2)) := by enter_decl - steps - all_goals try exact () - apply STHoare.iteFalse_intro - steps [embedded_curve_add_inner_spec (hOnCurve := hOnCurve)] - assumption + steps [embedded_curve_add_builtin_spec (hOnCurve := hOnCurve)] + subst_vars + rfl private theorem point_add_concrete_spec {p} {self other : Point.denote p} (hOnCurve : @@ -443,7 +422,7 @@ private theorem point_add_concrete_spec {p} {self other : Point.denote p} /-- Canonical spec for `Add::add` on `EmbeddedCurvePoint`: under encoded-input hypotheses, Noir's point addition agrees with Mathlib's affine short-Weierstrass group law on `(affineCurve p).Point`. -/ -theorem point_add_spec {p} {self other : Point.denote p} +theorem point_add_spec {p} [Lampe.Crypto.Bn254.Prime p] {self other : Point.denote p} {P Q : (affineCurve p).Point} (hself : self = encodeCurvePoint P) (hother : other = encodeCurvePoint Q) : @@ -484,7 +463,7 @@ private theorem point_double_concrete_spec {p} {self : Point.denote p} /-- Canonical spec for `EmbeddedCurvePoint::double`: under an encoded-input hypothesis, doubling agrees with Mathlib's `P + P`. -/ -theorem point_double_spec {p} {self : Point.denote p} +theorem point_double_spec {p} [Lampe.Crypto.Bn254.Prime p] {self : Point.denote p} {P : (affineCurve p).Point} (hself : self = encodeCurvePoint P) : STHoare p env ⟦⟧ @@ -522,7 +501,7 @@ private theorem point_sub_concrete_spec {p} {self other : Point.denote p} /-- Canonical spec for `Sub::sub` on `EmbeddedCurvePoint`: under encoded-input hypotheses, point subtraction agrees with Mathlib's group `P - Q` (equivalently `P + (-Q)`). -/ -theorem point_sub_spec {p} {self other : Point.denote p} +theorem point_sub_spec {p} [Lampe.Crypto.Bn254.Prime p] {self other : Point.denote p} {P Q : (affineCurve p).Point} (hself : self = encodeCurvePoint P) (hother : other = encodeCurvePoint Q) : @@ -552,32 +531,10 @@ theorem point_sub_spec {p} {self other : Point.denote p} rw [hEq] at h exact h -theorem point_hash_infinite_spec {p H stateRef} - {self : Point.denote p} - {state final : Tp.denote p H} - {h_hasher : Lampe.Stdlib.Hash.Hasher.hasImpl env H} - (h_inf : Point.isInfinite self = true) - (h_bool_write : STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] - h![stateRef, @Builtin.CastTp.cast .bool .field _ p (Point.isInfinite self)]) - (fun _ => [stateRef ↦ ⟨H, final⟩])) - : STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) - (fun _ => [stateRef ↦ ⟨H, final⟩]) := by - resolve_trait - reduce_fn_body - steps - apply STHoare.ite_intro_of_true h_inf - steps [Lampe.Stdlib.Hash.bool_hash_spec (h_write_spec := h_bool_write)] - assumption - -theorem point_hash_finite_spec {p H stateRef} +theorem point_hash_spec {p H stateRef} {self : Point.denote p} {state state1 final : Tp.denote p H} {h_hasher : Lampe.Stdlib.Hash.Hasher.hasImpl env H} - (h_fin : Point.isInfinite self = false) (h_x_write : STHoare p env [stateRef ↦ ⟨H, state⟩] («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] @@ -593,60 +550,11 @@ theorem point_hash_finite_spec {p H stateRef} («std-1.0.0-beta.25::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) (fun _ => [stateRef ↦ ⟨H, final⟩]) := by resolve_trait - reduce_fn_body - steps - apply STHoare.ite_intro_of_false h_fin steps [Lampe.Stdlib.Hash.field_hash_spec (h_write_spec := h_x_write), Lampe.Stdlib.Hash.field_hash_spec (h_write_spec := h_y_write)] all_goals assumption -theorem point_hash_spec {p H stateRef} - {self : Point.denote p} - {state final : Tp.denote p H} - {h_hasher : Lampe.Stdlib.Hash.Hasher.hasImpl env H} - (h_write : - if Point.isInfinite self then - STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] - h![stateRef, @Builtin.CastTp.cast .bool .field _ p (Point.isInfinite self)]) - (fun _ => [stateRef ↦ ⟨H, final⟩]) - else - ∃ state1, - STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] - h![stateRef, Point.x self]) - (fun _ => [stateRef ↦ ⟨H, state1⟩]) ∧ - STHoare p env - [stateRef ↦ ⟨H, state1⟩] - («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] - h![stateRef, Point.y self]) - (fun _ => [stateRef ↦ ⟨H, final⟩])) - : STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hash».hash h![] Point.type h![] h![H] h![self, stateRef]) - (fun _ => [stateRef ↦ ⟨H, final⟩]) := by - by_cases h_inf : Point.isInfinite self = true - · simp [h_inf] at h_write - have h_bool_write : - STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] - h![stateRef, @Builtin.CastTp.cast .bool .field _ p (Point.isInfinite self)]) - (fun _ => [stateRef ↦ ⟨H, final⟩]) := by - simpa [h_inf] using h_write - exact point_hash_infinite_spec - (h_hasher := h_hasher) - (h_inf := h_inf) - (h_bool_write := h_bool_write) - · simp [h_inf] at h_write - rcases h_write with ⟨state1, h_x_write, h_y_write⟩ - exact point_hash_finite_spec - (h_hasher := h_hasher) - (h_fin := by simpa using h_inf) - (h_x_write := h_x_write) - (h_y_write := h_y_write) + /-- A limb decomposition of a field value is automatically canonical: `scalar.val < r_scalar < 2^254` forces the high limb below `2^126`. -/ @@ -695,99 +603,7 @@ theorem scalar_from_field_spec {p} [Lampe.Crypto.Bn254.Prime p] all_goals aesop (add safe forward canonical_mk_of_decomp) set_option maxRecDepth 4096 in -/-- Success spec for `EmbeddedCurveScalar::from_bytes`. - -The caller must guarantee `offset.toNat + 31 < 64`; otherwise the -Noir loop body indexes `bytes[offset + 31 - i]` (u32 arithmetic) past -the end of the 64-byte array and the circuit aborts. No -`scalar_from_bytes_oob_spec` is currently exposed because Lampe -lacks a standardized failure-spec convention in this project; see -the investigation note immediately below this declaration. -/ -theorem scalar_from_bytes_spec {p bytes offset} - (hbound : offset.toNat + 31 < 64) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::from_bytes».call - h![] h![bytes, offset]) - (fun r => - r = - Scalar.mk - (Scalar.fromBytesLoAcc bytes offset 16) - (Scalar.fromBytesHiAcc bytes offset 16)) := by - enter_decl - steps - loop_inv nat fun i _ _ => - [v ↦ ⟨.field, (256 ^ i : Fp p)⟩] ⋆ - [lo ↦ ⟨.field, Scalar.fromBytesLoAcc bytes offset i⟩] ⋆ - [hi ↦ ⟨.field, Scalar.fromBytesHiAcc bytes offset i⟩] - · simp [Scalar.fromBytesHiAcc] - sl - all_goals simp - · intro i _ hhi - have hhi_nat : i < 16 := by simpa using hhi - steps - · rw [Scalar.fromBytesLoAcc_succ] - have hmod := sub_add_mod_eq i 31 offset.toNat (by omega) (by omega) - have hidxlt : offset.toNat + 31 - i < (List.Vector.toList bytes).length := by - simp - omega - have hvidxlt : offset.toNat + 31 - i < 64 := by - simpa using hidxlt - have hge : - (List.Vector.toList bytes)[offset.toNat + 31 - i]? = - some (bytes[offset.toNat + 31 - i]'hvidxlt) := by - rw [List.getElem?_eq_getElem hidxlt, List.Vector.toList_getElem] - rfl - simp only [Scalar.byteAtField, Builtin.CastTp.cast, - Lens.modify, Option.get_some] - rw [hge] - simp [vector_get_eq_getElem, hmod] - rfl - · rw [Scalar.fromBytesHiAcc_succ] - have hmod := sub_add_mod_eq i 15 offset.toNat (by omega) (by omega) - have hidxlt : offset.toNat + 15 - i < (List.Vector.toList bytes).length := by - simp - omega - have hvidxlt : offset.toNat + 15 - i < 64 := by - simpa using hidxlt - have hge : - (List.Vector.toList bytes)[offset.toNat + 15 - i]? = - some (bytes[offset.toNat + 15 - i]'hvidxlt) := by - rw [List.getElem?_eq_getElem hidxlt, List.Vector.toList_getElem] - rfl - simp only [Scalar.byteAtField, Builtin.CastTp.cast, - Lens.modify, Option.get_some] - rw [hge] - simp [vector_get_eq_getElem, hmod] - rfl - steps - subst_vars - rfl - -theorem scalar_from_bytes_some_spec {p bytes offset scalar} - (hsome : Scalar.fromBytes? bytes offset = some scalar) : - STHoare p env ⟦⟧ - («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::from_bytes».call - h![] h![bytes, offset]) - (fun r => r = scalar) := by - have hvalid : Scalar.validOffset offset := by - by_cases h : Scalar.validOffset offset - · exact h - · rw [Scalar.fromBytes?_eq_none_of_not_validOffset h] at hsome - contradiction - have hbound : offset.toNat + 31 < 64 := by - have hoff : offset.toNat < 33 := by - simpa [Scalar.validOffset] using hvalid - omega - have hcanonical : - scalar = - Scalar.mk - (Scalar.fromBytesLoAcc bytes offset 16) - (Scalar.fromBytesHiAcc bytes offset 16) := by - have := hsome - rw [Scalar.fromBytes?_eq_some_of_validOffset hvalid] at this - exact (Option.some.inj this).symm - steps [scalar_from_bytes_spec (p := p) (bytes := bytes) (offset := offset) hbound] - simpa [hcanonical] +-- Note: `EmbeddedCurveScalar::from_bytes` was removed in Noir 1.0.0-beta.25. theorem scalar_hash_spec {p H stateRef} {self : Scalar.denote p} @@ -935,7 +751,7 @@ private lemma points_get_eq_encode {p : Prime} {N : U 32} /-- Bridging lemma: when each point is exactly the encoding of `Ps i`, the MSM accumulator equals the canonical sum `∑ i, Scalar.valueNat (scalars i) • Ps i`. -/ -private lemma msmAccFinRange_eq_sum {p : Prime} {N : U 32} +private lemma msmAccFinRange_eq_sum {p : Prime} [Lampe.Crypto.Bn254.Prime p] {N : U 32} {points : Tp.denote p (Point.type.array N)} {scalars : Tp.denote p (Scalar.type.array N)} {Ps : List.Vector (affineCurve p).Point N.toNat} @@ -953,7 +769,7 @@ private lemma msmAccFinRange_eq_sum {p : Prime} {N : U 32} /-- Result-equation spec for `multi_scalar_mul`. When each input point is the encoding of a Mathlib `WeierstrassCurve.Affine.Point`, the result is `encodeCurvePoint (∑ Scalar.valueNat (scalars i) • Ps i)`. -/ -theorem multi_scalar_mul_spec {p N} +theorem multi_scalar_mul_spec {p N} [Lampe.Crypto.Bn254.Prime p] {points : Tp.denote p (Point.type.array N)} {scalars : Tp.denote p (Scalar.type.array N)} {Ps : List.Vector (affineCurve p).Point N.toNat} @@ -978,7 +794,7 @@ theorem multi_scalar_mul_spec {p N} /-- Combined wrapper spec: result equation and canonicality together. Used by Pedersen `_spec_canonical` proofs to extract both facts in a single `steps` invocation. -/ -theorem multi_scalar_mul_combined_spec {p N} +theorem multi_scalar_mul_combined_spec {p N} [Lampe.Crypto.Bn254.Prime p] {points : Tp.denote p (Point.type.array N)} {scalars : Tp.denote p (Scalar.type.array N)} {Ps : List.Vector (affineCurve p).Point N.toNat} @@ -1028,7 +844,7 @@ theorem multi_scalar_mul_combined_spec {p N} rw [msmAccFinRange_eq_sum h_enc hOnCurve] rfl -private theorem fixed_base_scalar_mul_concrete_spec {p} +private theorem fixed_base_scalar_mul_concrete_spec {p} [Lampe.Crypto.Bn254.Prime p] {scalar : Scalar.denote p} {Pgen : (affineCurve p).Point} (h_gen : @@ -1094,7 +910,7 @@ The hypothesis `h_gen` is a side condition because proving requires knowing the concrete characteristic; downstream callers that pin `p` to BN254 discharge it directly (see `Lampe.Stdlib.EmbeddedCurveOps.Bn254.fixed_base_scalar_mul_bn254_spec`). -/ -theorem fixed_base_scalar_mul_spec {p} +theorem fixed_base_scalar_mul_spec {p} [Lampe.Crypto.Bn254.Prime p] {scalar : Scalar.denote p} {Pgen : (affineCurve p).Point} (h_gen : diff --git a/stdlib/lampe/Stdlib/Hash/Mod.lean b/stdlib/lampe/Stdlib/Hash/Mod.lean index 19f87130..096b3413 100644 --- a/stdlib/lampe/Stdlib/Hash/Mod.lean +++ b/stdlib/lampe/Stdlib/Hash/Mod.lean @@ -23,11 +23,13 @@ theorem poseidon2_permutation4_spec {p} {input : Tp.denote p (Tp.field.array (4 : U 32))} : STHoare p env ⟦⟧ («std-1.0.0-beta.25::hash::poseidon2_permutation».call h![(4 : U 32)] - h![input, (4 : U 32)]) + h![input]) (fun r => r = Lampe.Crypto.Poseidon2.noirPermutation4 input) := by enter_decl - steps [Lampe.Stdlib.Hash.Poseidon2.poseidon2_permutation_builtin_spec] - assumption + steps [Lampe.Stdlib.Hash.Poseidon2.config_state_size_spec, + Lampe.Stdlib.Hash.Poseidon2.poseidon2_permutation_builtin_spec] + · assumption + all_goals simp_all /-- Spec for the `sha256_compression` foreign builtin: returns the concrete `Crypto.Sha256.compressOne` round-function output for the @@ -138,21 +140,7 @@ theorem field_hash_spec {p H stateRef} resolve_trait steps [h_write_spec] -theorem u1_hash_spec {p H stateRef} - {self : U 1} - {state final : Tp.denote p H} - {h_hasher : Hasher.hasImpl env H} - (h_write_spec : STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hasher».write h![] H h![] h![] - h![stateRef, @Builtin.CastTp.cast (.u 1) .field _ p self]) - (fun _ => [stateRef ↦ ⟨H, final⟩])) - : STHoare p env - [stateRef ↦ ⟨H, state⟩] - («std-1.0.0-beta.25::hash::Hash».hash h![] (.u 1) h![] h![H] h![self, stateRef]) - (fun _ => [stateRef ↦ ⟨H, final⟩]) := by - resolve_trait - steps [h_write_spec] +-- Note: `u1` was removed in Noir 1.0.0-beta.25, so the corresponding `u1_hash_spec` is gone. theorem u8_hash_spec {p H stateRef} {self : U 8} diff --git a/stdlib/lampe/Stdlib/Hash/Pedersen.lean b/stdlib/lampe/Stdlib/Hash/Pedersen.lean index d2082cb0..c8f437f6 100644 --- a/stdlib/lampe/Stdlib/Hash/Pedersen.lean +++ b/stdlib/lampe/Stdlib/Hash/Pedersen.lean @@ -95,102 +95,70 @@ private lemma strAsBytes_hash_length_eq {p} : (Lampe.NoirStr.of "pedersen_hash_length") = pedersenHashLengthBytes := by rfl -/-! ### `from_field_unsafe` wrapper spec -/ - -/-- Spec for `std::hash::from_field_unsafe`. The body decomposes -`scalar` into two field limbs `xlo, xhi` via the `decompose_hint` -oracle and then enforces - -``` -scalar = xlo + 2^128 * xhi -- limb decomposition -(xhi, xlo) <ₗₑₓ (PHI, PLO) -- canonical-range -``` - -where `PLO + 2^128 * PHI = p` is the BN254 scalar-field prime -limb decomposition. The output `EmbeddedCurveScalar` is -`Scalar.mk xlo xhi`. - -Unlike `decompose`, `from_field_unsafe` does **not** call -`assert_max_bit_size<128>` on the limbs, so the per-limb bounds -`xlo.val, xhi.val < 2^128` are *not* part of the postcondition; -the constraint enforced is the canonical-range disjunction -below. -/ -theorem from_field_unsafe_spec {p} [Lampe.Crypto.Bn254.Prime p] +/-! ### `EmbeddedCurveScalar::from_field` wrapper spec + +Since beta.25, `std::hash::from_field_unsafe` is gone: the Pedersen wrappers +call `EmbeddedCurveScalar::from_field`, which decomposes through the *safe* +`bn254::decompose`. The wrapper below restates `scalar_from_field_spec` in the +limb-relation form (`fromFieldUnsafeRel`) that the loop invariants consume. -/ + +private theorem lift_mono' [LawfulHeap α] {P Q : Prop} + (h : P → Q) : (⟦P⟧ : SLP α) ⊢ ⟦Q⟧ := by + intro st hst; unfold SLP.lift at *; exact ⟨h hst.1, hst.2⟩ + +private lemma rel_of_val_decomp {p} [Lampe.Crypto.Bn254.Prime p] + {x lo hi : Fp p} (hlo : lo.val < Lampe.pow128) + (hval : x.val = lo.val + Lampe.pow128 * hi.val) : + x = lo + ((pow128 : Nat) : Fp p) * hi ∧ + ((hi = ((phi : Nat) : Fp p) ∧ lo.val < plo) ∨ hi.val < phi) := by + have hxlt : x.val < p.natVal := ZMod.val_lt x + have hp : p.natVal = plo + Lampe.pow128 * phi := + Lampe.Crypto.Bn254.Prime.natVal_eq_limbs + constructor + · have hcast := congrArg (fun n : ℕ => ((n : ℕ) : Fp p)) hval + push_cast at hcast + simpa [ZMod.natCast_val, ZMod.cast_id] using hcast + · by_cases hc : hi.val < phi + · exact Or.inr hc + · left + have hge : phi ≤ hi.val := Nat.le_of_not_lt hc + have hplo_lt : plo < Lampe.pow128 := by + unfold plo Lampe.Crypto.Bn254.plo Lampe.pow128 + decide + have h1 : Lampe.pow128 * hi.val ≤ x.val := by omega + have h2 : Lampe.pow128 * hi.val < Lampe.pow128 * (phi + 1) := by + have : Lampe.pow128 * (phi + 1) = Lampe.pow128 * phi + Lampe.pow128 := by ring + omega + have hhi_le : hi.val < phi + 1 := Nat.lt_of_mul_lt_mul_left h2 + have hhi_eq : hi.val = phi := by omega + rw [hhi_eq] at hval + refine ⟨?_, by omega⟩ + have := congrArg (fun n : ℕ => ((n : ℕ) : Fp p)) hhi_eq + simpa [ZMod.natCast_val, ZMod.natCast_zmod_val] using this + +private theorem from_field_rel_spec {p} [Lampe.Crypto.Bn254.Prime p] {scalar : Fp p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::hash::from_field_unsafe».call h![] h![scalar]) + («std-1.0.0-beta.25::embedded_curve_ops::EmbeddedCurveScalar::from_field».call + h![] h![scalar]) (fun r => ∃∃ xlo xhi, r = Scalar.mk xlo xhi ∧ - scalar = xlo + (pow128 : Fp p) * xhi ∧ - ((xhi = (phi : Fp p) ∧ xlo.val < plo) ∨ xhi.val < phi)) := by - enter_decl - apply STHoare.letIn_intro - (Q := fun (_ : Tp.denote p (Tp.tuple none [Tp.field, Tp.field])) => ⟦⟧) - · steps [Lampe.Stdlib.Field.Bn254.decompose_hint_intro (p := p)] - intro xlo_xhi - steps [Lampe.Stdlib.Field.Bn254.two_pow_128_spec (p := p), - Lampe.Stdlib.Field.Bn254.phi_spec (p := p), - Lampe.Stdlib.Field.Bn254.plo_spec (p := p), - Lampe.Stdlib.Field.Bn254.assert_lt_intro (p := p)] - rename_i hxlo hxhi _ hassert - -- Bind the ite result and case-split on the condition. - apply STHoare.letIn_intro - (Q := fun (v : Tp.denote p (Tp.tuple none [Tp.field, Tp.field])) => - ⟦v = (if decide (xhi = (phi : Fp p)) then (xlo, (plo : Fp p), ()) - else (xhi, (phi : Fp p), ()))⟧) - · -- Prove the ite produces the expected tuple. - apply STHoare.ite_intro - · intro h_eq - steps [Lampe.Stdlib.Field.Bn254.plo_spec (p := p)] - subst_vars - simp_all - · intro h_ne - steps [Lampe.Stdlib.Field.Bn254.phi_spec (p := p)] - subst_vars - simp_all - -- Bridge lemma: `(plo : Fp p).val = plo` under `[Bn254.Prime p]`. Used by the xhi=phi branch via aesop. - have hplo_val : ((plo : Nat) : Fp p).val = plo := by - have hplo_lt : (plo : Nat) < p.natVal := by - have : (plo : Nat) < Lampe.pow128 := by decide - linarith [this, Lampe.Crypto.Bn254.pow128_lt_prime (p := p)] - simpa using (ZMod.val_natCast_of_lt hplo_lt) - have hphi_val : ((phi : Nat) : Fp p).val = phi := by - have hphi_lt : (phi : Nat) < p.natVal := by - have : (phi : Nat) < Lampe.pow128 := by decide - linarith [this, Lampe.Crypto.Bn254.pow128_lt_prime (p := p)] - simpa using (ZMod.val_natCast_of_lt hphi_lt) - intro v - -- Discharge the ⟦ v = ... ⟧ pure precondition and split on the bool. - by_cases h_xhi : xhi = (phi : Fp p) - · -- Branch: xhi = phi, so v = (xlo, plo, ()). After assert_lt(xlo, plo) we get xlo.val < plo. - have h_xhi_eq : decide (xhi = (phi : Fp p)) = true := by simp [h_xhi] - simp only [h_xhi_eq, if_true] at * - steps [Lampe.Stdlib.Field.Bn254.assert_lt_intro (p := p)] - simp [SLP.exists_pure] at * - sl - aesop - · -- Branch: xhi ≠ phi, so v = (xhi, phi, ()). After assert_lt(xhi, phi) we get xhi.val < phi. - have h_xhi_eq : decide (xhi = (phi : Fp p)) = false := by simp [h_xhi] - rw [h_xhi_eq] at * - simp only [Bool.false_eq_true, if_false] at * - steps [Lampe.Stdlib.Field.Bn254.assert_lt_intro (p := p)] - rename_i _ hv_eq ha_eq hb_eq hab vret hret - have ha_xhi : a = xhi := by rw [ha_eq, hv_eq]; rfl - have hb_phi : b = ((phi : Nat) : Fp p) := by rw [hb_eq, hv_eq]; rfl - have h_xhi_val_lt : xhi.val < phi := by - have := hab - rw [ha_xhi, hb_phi] at this - simpa [hphi_val] using this - have hassert_eq : scalar = xlo + ((Lampe.pow128 : Nat) : Fp p) * xhi := by - simpa [decide_eq_true_eq] using hassert - have hret_mk : vret = Scalar.mk xlo xhi := by - simpa [Scalar.mk, HList.toTuple] using hret - simp only [SLP.exists_pure] - sl - refine ⟨xhi, hret_mk, ?_, Or.inr h_xhi_val_lt⟩ - show scalar = xlo + ((Lampe.pow128 : Nat) : Fp p) * xhi - exact hassert_eq + scalar = xlo + ((pow128 : Nat) : Fp p) * xhi ∧ + ((xhi = ((phi : Nat) : Fp p) ∧ xlo.val < plo) ∨ xhi.val < phi)) := by + apply STHoare.consequence SLP.entails_self ?_ + (scalar_from_field_spec (p := p) (scalar := scalar)) + intro r + refine SLP.star_mono_r ?_ + apply SLP.exists_intro_l + intro lo + apply SLP.exists_intro_l + intro hi + refine SLP.exists_intro_r (a := lo) (SLP.exists_intro_r (a := hi) (lift_mono' ?_)) + rintro ⟨hmk, hlo, _hhi, hval, _hcanon⟩ + obtain ⟨hfp, hdisj⟩ := rel_of_val_decomp (x := scalar) hlo hval + exact ⟨hmk, hfp, hdisj⟩ + /-! ### `pedersen_commitment_with_separator` substantive spec -/ @@ -254,7 +222,7 @@ private theorem pedersen_commitment_with_separator_spec {p N} simp at hj · simp · intro i hlo hhi - steps [from_field_unsafe_spec (p := p)] + steps [from_field_rel_spec (p := p)] simp_all only [BitVec.toNat_intCast, Int.reducePow, EuclideanDomain.zero_mod, Int.toNat_zero, zero_le, Builtin.CastTp.cast, BitVec.truncate_eq_setWidth, BitVec.setWidth_eq, BitVec.toNat_ofNatLT, @@ -435,7 +403,7 @@ private theorem pedersen_hash_with_separator_spec {p N} simp at hj · simp · intro i hlo hhi - steps [from_field_unsafe_spec (p := p)] + steps [from_field_rel_spec (p := p)] sl rename_i s_prev g_prev hPrefix hCast1 xlo xhi hRes hModS hCast2 hModG _ obtain ⟨h_mk, h_scalar, h_range⟩ := hRes diff --git a/stdlib/lampe/Stdlib/Hash/Poseidon2.lean b/stdlib/lampe/Stdlib/Hash/Poseidon2.lean index d08687c0..9d9b58b7 100644 --- a/stdlib/lampe/Stdlib/Hash/Poseidon2.lean +++ b/stdlib/lampe/Stdlib/Hash/Poseidon2.lean @@ -10,11 +10,15 @@ namespace Lampe.Stdlib.Hash.Poseidon2 open «std-1.0.0-beta.25» open Lampe.Crypto -abbrev Poseidon2Tp : Tp := - «std-1.0.0-beta.25::hash::poseidon2::Poseidon2».tp h![] +/-! +Specs for Noir's `std::hash::poseidon2` module. -abbrev Poseidon2Repr (p : Prime) : Type := - Tp.denote p Poseidon2Tp +Since Noir 1.0.0-beta.25 the `Poseidon2` sponge struct (with `new`/`absorb`/`perform_duplex`/ +`squeeze`/`hash`) no longer exists; the module only provides `Poseidon2Hasher`, whose `finish_ref` +absorbs the written inputs in `RATE`-sized chunks directly via the `poseidon2_permutation` +builtin. We model that algorithm directly (`chunkState`/`finishDigest`) and prove the `Hasher` +trait methods against it. +-/ abbrev Poseidon2HasherTp : Tp := «std-1.0.0-beta.25::hash::poseidon2::Poseidon2Hasher».tp h![] @@ -22,41 +26,6 @@ abbrev Poseidon2HasherTp : Tp := abbrev Poseidon2HasherRepr (p : Prime) : Type := Tp.denote p Poseidon2HasherTp -def addCachePrefixToState {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (n : Nat) : List.Vector (Fp p) 4 := - List.Vector.ofFn fun i => - if hRate : i.val < 3 then - if hActive : i.val < n ∧ i.val < cacheSize.toNat then - state.get i + cache.get ⟨i.val, hRate⟩ - else - state.get i - else - state.get i - -def mkPoseidon2Repr {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (squeezeMode : Bool) : Poseidon2Repr p := - Tuple.mk - (p := p) - (memTps := [Tp.field.array (3 : U 32), Tp.field.array (4 : U 32), Tp.u 32, Tp.bool]) - h![cache, state, cacheSize, squeezeMode] - -def spongeToRepr {p} - (s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)) : Poseidon2Repr p := - mkPoseidon2Repr s.cache s.state (s.cacheSize : U 32) s.squeezeMode - -def reprToSponge {p} (s : Poseidon2Repr p) : - Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p) where - cache := s.1 - state := s.2.1 - cacheSize := s.2.2.1.toNat - squeezeMode := s.2.2.2.1 - def mkPoseidon2HasherRepr {p} (inputs : List (Fp p)) : Poseidon2HasherRepr p := Tuple.mk (p := p) @@ -67,24 +36,6 @@ private lemma mkPoseidon2HasherRepr_head {p} (inputs : List (Fp p)) : Builtin.indexTpl (mkPoseidon2HasherRepr inputs) Member.head = inputs := by rfl -def performDuplexRepr {p} (s : Poseidon2Repr p) : Poseidon2Repr p := - let cache := s.1 - let state := s.2.1 - let cacheSize := s.2.2.1 - let squeezeMode := s.2.2.2.1 - mkPoseidon2Repr cache - (Crypto.Poseidon2.noirPermutation4 (addCachePrefixToState cache state cacheSize 3)) - cacheSize - squeezeMode - -def absorbRepr? {p} (s : Poseidon2Repr p) (input : Fp p) : Option (Poseidon2Repr p) := - (Crypto.Poseidon2.Sponge.absorb? (Crypto.Poseidon2.noirParams4 p) - (reprToSponge s) input).map spongeToRepr - -def squeezeRepr? {p} (s : Poseidon2Repr p) : Option (Fp p × Poseidon2Repr p) := - (Crypto.Poseidon2.Sponge.squeeze? (Crypto.Poseidon2.noirParams4 p) - (reprToSponge s)).map fun (out, sponge) => (out, spongeToRepr sponge) - private lemma vector_ext_get {α n} {v w : List.Vector α n} (h : ∀ i : Fin n, v.get i = w.get i) : v = w := by apply List.Vector.eq @@ -93,360 +44,81 @@ private lemma vector_ext_get {α n} {v w : List.Vector α n} · intro i hi₁ hi₂ simpa [List.Vector.get] using h ⟨i, by simpa using hi₁⟩ -private lemma addCachePrefixToState_succ_inactive {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (i : Nat) - (hiRate : i < 3) - (hinactive : cacheSize.toNat ≤ i) : - addCachePrefixToState cache state cacheSize i = - addCachePrefixToState cache state cacheSize (i + 1) := by +/-! +## Functional model of `Poseidon2Hasher::finish_ref` + +`addToState state xs` adds `xs[j]` to `state[j]` for every valid `j` (with `xs.length ≤ 4` at all +use sites). `chunkState inputs k` is the permutation state after absorbing the first `k` complete +`RATE`-sized (`RATE = 3`) chunks, and `finishDigest` additionally absorbs the tail remainder and +applies the final permutation. +-/ + +def addToState {p} (state : List.Vector (Fp p) 4) (xs : List (Fp p)) : + List.Vector (Fp p) 4 := + List.Vector.ofFn fun j => + if h : j.val < xs.length then state.get j + xs[j.val]'h else state.get j + +def initState {p} (len : Nat) : List.Vector (Fp p) 4 := + (List.Vector.replicate 4 0).set ⟨3, by decide⟩ (Crypto.Poseidon2.Sponge.noirIV len) + +def chunkState {p} (inputs : List (Fp p)) : Nat → List.Vector (Fp p) 4 + | 0 => initState inputs.length + | k + 1 => + Crypto.Poseidon2.noirPermutation4 + (addToState (chunkState inputs k) ((inputs.drop (3 * k)).take 3)) + +def finishDigest {p} (inputs : List (Fp p)) : Fp p := + (Crypto.Poseidon2.noirPermutation4 + (addToState (chunkState inputs (inputs.length / 3)) + (inputs.drop (3 * (inputs.length / 3))))).get ⟨0, by decide⟩ + +@[simp] +private lemma addToState_nil {p} (state : List.Vector (Fp p) 4) : + addToState state [] = state := by apply vector_ext_get intro j - simp [addCachePrefixToState] - by_cases hjRate : j.val < 3 - · simp [hjRate] - by_cases hjCache : j.val < cacheSize.toNat - · simp [Nat.lt_of_lt_of_le hjCache hinactive, hjCache] - intro; omega - · simp [hjCache] - · simp [hjRate] - -private lemma addCachePrefixToState_succ_active {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (i : Nat) - (hiRate : i < 3) - (hiState : i < 4) - (hactive : i < cacheSize.toNat) : - (addCachePrefixToState cache state cacheSize i).set - ⟨i, hiState⟩ - ((addCachePrefixToState cache state cacheSize i).get - ⟨i, hiState⟩ + cache.get ⟨i, hiRate⟩) = - addCachePrefixToState cache state cacheSize (i + 1) := by + simp [addToState] + +private lemma take_mod_drop_eq {α} (inputs : List α) : + (inputs.drop (3 * (inputs.length / 3))).take (inputs.length % 3) = + inputs.drop (3 * (inputs.length / 3)) := by + apply List.take_of_length_le + simp only [List.length_drop] + omega + +private lemma addToState_set_step {p} (state : List.Vector (Fp p) 4) (xs : List (Fp p)) + (j : Nat) (hj4 : j < 4) (hjx : j < xs.length) : + (addToState state (xs.take j)).set ⟨j, hj4⟩ + ((addToState state (xs.take j)).get ⟨j, hj4⟩ + xs[j]'hjx) = + addToState state (xs.take (j + 1)) := by + have hjtake : (xs.take j).length = j := by + simp [Nat.min_eq_left (Nat.le_of_lt hjx)] apply vector_ext_get - intro j - let iFin : Fin 4 := ⟨i, Nat.lt_trans hiRate (by decide)⟩ - by_cases hji : iFin = j - · subst j + intro k + by_cases hkj : k = (⟨j, hj4⟩ : Fin 4) + · subst hkj rw [List.Vector.get_set_same] - simp [addCachePrefixToState, hactive, iFin] - omega - · have hval_ne : j.val ≠ i := by - intro h - apply hji - ext - exact h.symm - rw [List.Vector.get_set_of_ne hji] - simp [addCachePrefixToState] - by_cases hjRate : j.val < 3 - · simp [hjRate] - by_cases hjlt : j.val < i - · simp [hjlt, - show j.val < cacheSize.toNat by omega] - intro; omega - · simp [hjlt] - intros; omega - · simp [hjRate] - -private lemma mkPoseidon2Repr_state_set_active {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (squeezeMode : Bool) - (i : Nat) - (hiRate : i < 3) - (hiState : i < 4) - (hactive : i < cacheSize.toNat) : - Builtin.replaceTuple' - (mkPoseidon2Repr cache (addCachePrefixToState cache state cacheSize i) cacheSize squeezeMode) - Member.head.tail - ((Builtin.indexTpl - (mkPoseidon2Repr cache (addCachePrefixToState cache state cacheSize i) cacheSize squeezeMode) - Member.head.tail).set ⟨i, hiState⟩ - ((Builtin.indexTpl - (mkPoseidon2Repr cache (addCachePrefixToState cache state cacheSize i) cacheSize squeezeMode) - Member.head.tail).get ⟨i, hiState⟩ + - (Builtin.indexTpl - (mkPoseidon2Repr cache (addCachePrefixToState cache state cacheSize i) cacheSize squeezeMode) - Member.head).get ⟨i, hiRate⟩)) = - mkPoseidon2Repr cache (addCachePrefixToState cache state cacheSize (i + 1)) cacheSize squeezeMode := by - change (cache, - (addCachePrefixToState cache state cacheSize i).set ⟨i, hiState⟩ - ((addCachePrefixToState cache state cacheSize i).get ⟨i, hiState⟩ + cache.get ⟨i, hiRate⟩), - cacheSize, squeezeMode, ()) = - mkPoseidon2Repr cache (addCachePrefixToState cache state cacheSize (i + 1)) cacheSize squeezeMode - rw [addCachePrefixToState_succ_active cache state cacheSize i hiRate hiState hactive] - rfl - -private lemma mkPoseidon2Repr_cache_set_get {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (input : Fp p) - (hspace : cacheSize.toNat < 3) - (hmod : - (((Lens.nil.cons (Access.tuple Member.head)).cons - (Access.array cacheSize)).modify - (mkPoseidon2Repr cache state cacheSize false) input).isSome = true) : - (((Lens.nil.cons (Access.tuple Member.head)).cons - (Access.array cacheSize)).modify - (mkPoseidon2Repr cache state cacheSize false) input).get hmod = - mkPoseidon2Repr (cache.set ⟨cacheSize.toNat, hspace⟩ input) state cacheSize false := by - simp [mkPoseidon2Repr, Lens.modify, Access.modify, hspace] - rfl - -private lemma addCachePrefixToState_eq_addCacheToState {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (squeezeMode : Bool) : - addCachePrefixToState cache state cacheSize 3 = - Crypto.Poseidon2.Sponge.addCacheToState (Crypto.Poseidon2.noirParams4 p) - { cache := cache - state := state - cacheSize := cacheSize.toNat - squeezeMode := squeezeMode } := by - apply vector_ext_get - intro i - simp [addCachePrefixToState, Crypto.Poseidon2.Sponge.addCacheToState, - Crypto.Poseidon2.noirParams4] - by_cases hi : i.val < 3 - · simp [hi] - · simp [hi] - -private lemma noirPermutation4_addCachePrefixToState_eq_sponge {p} - (cache : List.Vector (Fp p) 3) - (state : List.Vector (Fp p) 4) - (cacheSize : U 32) - (squeezeMode : Bool) : - Crypto.Poseidon2.noirPermutation4 (addCachePrefixToState cache state cacheSize 3) = - (Crypto.Poseidon2.noirParams4 p).permute - (Crypto.Poseidon2.Sponge.addCacheToState (Crypto.Poseidon2.noirParams4 p) - { cache := cache - state := state - cacheSize := cacheSize.toNat - squeezeMode := squeezeMode }) := by - rw [addCachePrefixToState_eq_addCacheToState cache state cacheSize squeezeMode] - rfl - -private def absorbList? {F : Type} (params : Crypto.Poseidon2.Params F) [Add F] : - Crypto.Poseidon2.Sponge F params → List F → Option (Crypto.Poseidon2.Sponge F params) - | s, [] => some s - | s, x :: xs => - Option.bind (Crypto.Poseidon2.Sponge.absorb? params s x) (fun s' => absorbList? params s' xs) - -private lemma absorbList?_append_one {F : Type} (params : Crypto.Poseidon2.Params F) [Add F] - {s : Crypto.Poseidon2.Sponge F params} {xs : List F} {x : F} : - absorbList? params s (xs ++ [x]) = - Option.bind (absorbList? params s xs) - (fun s'' => Crypto.Poseidon2.Sponge.absorb? params s'' x) := by - induction xs generalizing s with - | nil => simp [absorbList?] - | cons y ys ih => - dsimp [absorbList?] - cases hAbs : Crypto.Poseidon2.Sponge.absorb? params s y <;> simp [ih] - -private lemma absorbList?_take_succ {F : Type} (params : Crypto.Poseidon2.Params F) [Add F] - {s s' : Crypto.Poseidon2.Sponge F params} {xs : List F} {i : Nat} - (hi : i < xs.length) - (h : absorbList? params s (xs.take i) = some s') : - absorbList? params s (xs.take (i + 1)) = - Crypto.Poseidon2.Sponge.absorb? params s' xs[i] := by - rw [← List.take_append_getElem hi] - rw [absorbList?_append_one (params := params)] - simp [h] - -private lemma absorbList?_take_succ_some {F : Type} (params : Crypto.Poseidon2.Params F) [Add F] - {s s' s'' : Crypto.Poseidon2.Sponge F params} {xs : List F} {i : Nat} - (hi : i < xs.length) - (hprefix : absorbList? params s (xs.take i) = some s') - (hAbs : Crypto.Poseidon2.Sponge.absorb? params s' xs[i] = some s'') : - absorbList? params s (xs.take (i + 1)) = some s'' := by - rw [absorbList?_take_succ (params := params) hi hprefix] - exact hAbs - -private lemma absorbList?_eq_absorbPrefix? {F : Type} (params : Crypto.Poseidon2.Params F) [Add F] - {s : Crypto.Poseidon2.Sponge F params} {xs : List F} {n : Nat} : - absorbList? params s (xs.take n) = - Crypto.Poseidon2.Sponge.absorbPrefix? params s xs n := by - induction xs generalizing s n with - | nil => - cases n <;> simp [absorbList?, Crypto.Poseidon2.Sponge.absorbPrefix?] - | cons x xs ih => - cases n with - | zero => simp [absorbList?, Crypto.Poseidon2.Sponge.absorbPrefix?] - | succ n => - simp [absorbList?, Crypto.Poseidon2.Sponge.absorbPrefix?] - cases hAbs : Crypto.Poseidon2.Sponge.absorb? params s x <;> simp - exact ih - -private lemma absorbPrefix?_of_absorbList?_take {F : Type} - (params : Crypto.Poseidon2.Params F) [Add F] - {s s' : Crypto.Poseidon2.Sponge F params} {xs : List F} {n : Nat} - (h : absorbList? params s (xs.take n) = some s') : - Crypto.Poseidon2.Sponge.absorbPrefix? params s xs n = some s' := by - rw [← absorbList?_eq_absorbPrefix? (params := params)] - exact h - -private def SpongeValid {p} - (s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)) : Prop := - s.cacheSize ≤ 3 ∧ s.squeezeMode = false - -private lemma SpongeValid.init {p} (iv : Fp p) : - SpongeValid (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) iv) := by - simp [SpongeValid, Crypto.Poseidon2.Sponge.init, Crypto.Poseidon2.noirParams4] - -private lemma reprToSponge_spongeToRepr_of_cacheSize_lt {p} - (s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)) - (hcache : s.cacheSize < 2 ^ 32) : - reprToSponge (spongeToRepr s) = s := by - rcases s with ⟨cache, state, cacheSize, squeezeMode⟩ - have hcache' : cacheSize < 4294967296 := by - norm_num at hcache ⊢ - exact hcache - simp [reprToSponge, spongeToRepr, mkPoseidon2Repr, BitVec.toNat_ofNat, - Nat.mod_eq_of_lt hcache'] - -private lemma SpongeValid.reprToSponge_spongeToRepr {p} - {s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)} - (hv : SpongeValid s) : - reprToSponge (spongeToRepr s) = s := by - exact reprToSponge_spongeToRepr_of_cacheSize_lt s (by rcases hv with ⟨hcache, _⟩; omega) - -private lemma SpongeValid.absorb?_some {p} - {s s' : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)} - {input : Fp p} - (hv : SpongeValid s) - (h : Crypto.Poseidon2.Sponge.absorb? (Crypto.Poseidon2.noirParams4 p) s input = some s') : - SpongeValid s' := by - rcases s with ⟨cache, state, cacheSize, squeezeMode⟩ - rcases hv with ⟨hcache, hsqueeze⟩ - change cacheSize ≤ 3 at hcache - change squeezeMode = false at hsqueeze - subst squeezeMode - simp [Crypto.Poseidon2.Sponge.absorb?, Crypto.Poseidon2.Sponge.performDuplex, - Crypto.Poseidon2.noirParams4] at h - by_cases hfull : cacheSize = 3 - · simp [hfull] at h - cases h - exact ⟨by simp, rfl⟩ - · simp [hfull] at h - by_cases hspace : cacheSize < 3 - · simp [hspace] at h - cases h - simp [SpongeValid] + have hnotlt : ¬ ((j : Nat) < (xs.take j).length) := by omega + have hlt1 : (j : Nat) < (xs.take (j + 1)).length := by + simp only [List.length_take] omega - · simp [hspace] at h - -private lemma absorbRepr?_spongeToRepr {p} - {s s' : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)} - {x : Fp p} - (hv : SpongeValid s) - (h : Crypto.Poseidon2.Sponge.absorb? (Crypto.Poseidon2.noirParams4 p) s x = some s') : - absorbRepr? (spongeToRepr s) x = some (spongeToRepr s') := by - simp [absorbRepr?, SpongeValid.reprToSponge_spongeToRepr hv, h] - -private lemma squeezeRepr?_spongeToRepr {p} - {s s' : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)} - {out : Fp p} - (hv : SpongeValid s) - (h : Crypto.Poseidon2.Sponge.squeeze? (Crypto.Poseidon2.noirParams4 p) s = some (out, s')) : - squeezeRepr? (spongeToRepr s) = some (out, spongeToRepr s') := by - simp [squeezeRepr?, SpongeValid.reprToSponge_spongeToRepr hv, h] - -private lemma take_min_succ_of_not_lt {α} (xs : List α) {i n : Nat} (h : ¬ i < n) : - xs.take (Nat.min (i + 1) n) = xs.take (Nat.min i n) := by - have hn : n ≤ i := by omega - rw [show Nat.min (i + 1) n = n from Nat.min_eq_right (Nat.le_trans hn (Nat.le_succ i))] - rw [show Nat.min i n = n from Nat.min_eq_right hn] - -private lemma min_succ_of_lt {i n : Nat} (h : i < n) : - Nat.min (i + 1) n = i + 1 := by - exact Nat.min_eq_left (by omega) - -private lemma min_current_of_lt {i n : Nat} (h : i < n) : - Nat.min i n = i := by - exact Nat.min_eq_left (by omega) - -private lemma absorbList?_take_min_succ_of_lt {F : Type} - (params : Crypto.Poseidon2.Params F) [Add F] - {s s' s'' : Crypto.Poseidon2.Sponge F params} {xs : List F} {i n : Nat} - (hiLen : i < n) - (hiInput : i < xs.length) - (hprefix : absorbList? params s (xs.take (Nat.min i n)) = some s') - (hAbs : Crypto.Poseidon2.Sponge.absorb? params s' xs[i] = some s'') : - absorbList? params s (xs.take (Nat.min (i + 1) n)) = some s'' := by - have hprefixI : absorbList? params s (xs.take i) = some s' := by - simpa [min_current_of_lt hiLen] using hprefix - rw [min_succ_of_lt hiLen] - rw [absorbList?_take_succ (params := params) (hi := hiInput) hprefixI] - exact hAbs - -private lemma absorbList?_take_min_succ_of_not_lt {F : Type} - (params : Crypto.Poseidon2.Params F) [Add F] - {s s' : Crypto.Poseidon2.Sponge F params} {xs : List F} {i n : Nat} - (hge : n ≤ i) - (hprefix : absorbList? params s (xs.take (Nat.min i n)) = some s') : - absorbList? params s (xs.take (Nat.min (i + 1) n)) = some s' := by - simpa [take_min_succ_of_not_lt xs (not_lt_of_ge hge)] using hprefix - -private lemma lt_two_pow_of_lt_u32 {i : Nat} {x : U 32} (h : i < x.toNat) : - i < 2 ^ 32 := - lt_trans h - (by simpa using BitVec.toNat_lt_twoPow_of_le (m := 32) (n := 32) (x := x) (by rfl)) - -private lemma nat_lt_of_decide_bv_lt_trueLT {i : Nat} {x : U 32} - (pf32 : i < 2 ^ 32) - (h : decide (BitVec.ofNatLT i pf32 < x) = true) : i < x.toNat := by - simpa [BitVec.lt_def, BitVec.toNat_ofNatLT] using of_decide_eq_true h - -private lemma nat_le_of_decide_bv_lt_falseLT {i : Nat} {x : U 32} - (pf32 : i < 2 ^ 32) - (h : decide (BitVec.ofNatLT i pf32 < x) = false) : x.toNat ≤ i := by - exact Nat.le_of_not_gt fun hlt => by - have htrue : decide (BitVec.ofNatLT i pf32 < x) = true := by - simp [BitVec.lt_def, BitVec.toNat_ofNatLT, hlt] - rw [htrue] at h - cases h - -private lemma take_min_length_right {α} (xs : List α) (n : Nat) : - xs.take (Nat.min xs.length n) = xs.take n := by - by_cases hn : n ≤ xs.length - · simp [Nat.min_eq_right hn] - · have hlen : xs.length ≤ n := by omega - simp [Nat.min_eq_left hlen, List.take_of_length_le hlen] - -private lemma take_min_vector_length_right {α} {N : Nat} (input : List.Vector α N) (n : Nat) : - input.toList.take (Nat.min N n) = input.toList.take n := by - simpa using (take_min_length_right input.toList n) - -private abbrev HashInternalLoopInv {p} {N : U 32} - (input : List.Vector (Fp p) N.toNat) - (inLen : U 32) - (iv : Fp p) - (spongeRef : Ref Poseidon2Tp) - (i : Nat) : SLP (State p) := - ∃∃ s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p), - [spongeRef ↦ ⟨Poseidon2Tp, spongeToRepr s⟩] ⋆ - ⟦absorbList? (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) iv) - (input.toList.take (Nat.min i inLen.toNat)) = some s⟧ ⋆ - ⟦SpongeValid s⟧ - -private abbrev HasherFinishLoopInv {p} - (inputs : List (Fp p)) - (iv : Fp p) - (spongeRef : Ref Poseidon2Tp) - (i : Nat) : SLP (State p) := - ∃∃ s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p), - [spongeRef ↦ ⟨Poseidon2Tp, spongeToRepr s⟩] ⋆ - ⟦absorbList? (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) iv) - (inputs.take i) = some s⟧ ⋆ - ⟦SpongeValid s⟧ + simp only [addToState, List.Vector.get_ofFn, hnotlt, dif_neg, not_false_iff, hlt1, dif_pos] + congr 1 + simp [List.getElem_take] + · rw [List.Vector.get_set_of_ne (by simpa [eq_comm] using hkj)] + have hkvj : (k : Fin 4).val ≠ j := by + intro h + exact hkj (Fin.ext h) + simp only [addToState, List.Vector.get_ofFn, List.length_take] + by_cases hk : k.val < j + · have h1 : k.val < min j xs.length := by omega + have h2 : k.val < min (j + 1) xs.length := by omega + simp only [h1, h2, dif_pos] + congr 1 + rw [List.getElem_take, List.getElem_take] + · have h1 : ¬ (k.val < min j xs.length) := by omega + have h2 : ¬ (k.val < min (j + 1) xs.length) := by omega + simp [h1, h2] theorem default_spec {p} : STHoare p env ⟦⟧ @@ -458,21 +130,35 @@ theorem default_spec {p} subst_vars rfl -theorem rate_spec {p} +theorem capacity_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::hash::poseidon2::RATE».call h![] h![]) - (fun r => r = (3 : U 32)) := by + («std-1.0.0-beta.25::hash::poseidon2::CAPACITY».call h![] h![]) + (fun r => r = (1 : U 32)) := by enter_decl steps - rename_i hrate - simpa using hrate + subst_vars + rfl -theorem new_spec {p} {iv : Tp.denote p .field} +private theorem config_state_size_builtin_spec {p} : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::new».call h![] h![iv]) - (fun r => r = spongeToRepr (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) iv)) := by + (.callBuiltin [] (Tp.u 32) Builtin.poseidon2ConfigStateSize h![]) + (fun r => r = (4 : U 32)) := by + exact STHoare.genericTotalPureBuiltin_intro Builtin.poseidon2ConfigStateSize rfl () p env h![] + +theorem config_state_size_spec {p} + : STHoare p env ⟦⟧ + («std-1.0.0-beta.25::hash::POSEIDON2_CONFIG_STATE_SIZE».call h![] h![]) + (fun r => r = (4 : U 32)) := by enter_decl - steps [rate_spec] + steps [config_state_size_builtin_spec] + simp_all + +theorem rate_spec {p} + : STHoare p env ⟦⟧ + («std-1.0.0-beta.25::hash::poseidon2::RATE».call h![] h![]) + (fun r => r = (3 : U 32)) := by + enter_decl + steps [config_state_size_spec, capacity_spec] subst_vars rfl @@ -483,290 +169,12 @@ theorem poseidon2_permutation_builtin_spec {p} {state : List.Vector (Fp p) 4} (fun r => r = Crypto.Poseidon2.noirPermutation4 state) := by exact STHoare.genericTotalPureBuiltin_intro Builtin.poseidon2Permutation rfl () p env h![state] -theorem perform_duplex_spec {p selfRef} - {cache : List.Vector (Fp p) 3} - {state : List.Vector (Fp p) 4} - {cacheSize : U 32} - {squeezeMode : Bool} - : STHoare p env - [selfRef ↦ ⟨Poseidon2Tp, mkPoseidon2Repr cache state cacheSize squeezeMode⟩] - («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::perform_duplex».call h![] h![selfRef]) - (fun _ => - [selfRef ↦ ⟨Poseidon2Tp, - performDuplexRepr (mkPoseidon2Repr cache state cacheSize squeezeMode)⟩]) := by - enter_decl - steps [rate_spec] - loop_inv nat (fun i _ _ => - [selfRef ↦ ⟨Poseidon2Tp, - mkPoseidon2Repr cache (addCachePrefixToState cache state cacheSize i) cacheSize squeezeMode⟩]) - · simp [addCachePrefixToState, mkPoseidon2Repr] - · simp - · intro i hlo hhi - steps - apply STHoare.ite_intro - · intro hcond - steps - have hactive : i < cacheSize.toNat := by - simpa [mkPoseidon2Repr, BitVec.lt_def] using hcond - have hi4 : i < 4 := Nat.lt_trans hhi (by decide) - rw [← mkPoseidon2Repr_state_set_active cache state cacheSize squeezeMode i hhi hi4 hactive] - have hbv4 : BitVec.toNat (4 : U 32) = 4 := by decide - simp only [Lens.modify, Access.modify, Access.get, Lens.get, mkPoseidon2Repr, Option.get_some, - bind, Option.bind, BitVec.toNat_ofNatLT, hbv4, dif_pos hi4] - rfl - · intro hcond - steps - have hinactive : cacheSize.toNat ≤ i := by - simpa [mkPoseidon2Repr, BitVec.not_lt] using hcond - simp [mkPoseidon2Repr, - addCachePrefixToState_succ_inactive cache state cacheSize i hhi hinactive] - · steps [poseidon2_permutation_builtin_spec] - -theorem absorb_spec {p selfRef} - {self out : Poseidon2Repr p} - {input : Fp p} - (hout : absorbRepr? self input = some out) - : STHoare p env - [selfRef ↦ ⟨Poseidon2Tp, self⟩] - («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::absorb».call h![] h![selfRef, input]) - (fun _ => [selfRef ↦ ⟨Poseidon2Tp, out⟩]) := by - rcases self with ⟨cache, state, cacheSize, squeezeMode, unitTail⟩ - cases unitTail - simp [absorbRepr?, reprToSponge, Crypto.Poseidon2.Sponge.absorb?, - Crypto.Poseidon2.noirParams4] at hout - rcases hout with ⟨modelOut, ⟨hsqueezeMode, hmodel⟩, hout⟩ - subst squeezeMode - enter_decl - steps [rate_spec] - apply STHoare.ite_intro - · intro hfull - steps [perform_duplex_spec (cache := cache) (state := state) (cacheSize := cacheSize) - (squeezeMode := false)] - have hfullEq : cacheSize = (3 : U 32) := by - simpa [mkPoseidon2Repr] using (of_decide_eq_true hfull) - have hfullNat : cacheSize.toNat = 3 := by - simp [hfullEq] - simp [hfullNat] at hmodel - cases hmodel - rw [← hout] - subst cacheSize - congr - · intro hnotFull - have hnotFullEq : cacheSize ≠ (3 : U 32) := by - simpa [mkPoseidon2Repr, decide_eq_false_iff_not] using hnotFull - have hnotFullNat : cacheSize.toNat ≠ 3 := by - intro hnat - apply hnotFullEq - apply BitVec.eq_of_toNat_eq - simp [hnat] - simp [hnotFullNat] at hmodel - by_cases hspace : cacheSize.toNat < 3 - · simp [hspace] at hmodel - cases hmodel - let cacheAfter : Poseidon2Repr p := - mkPoseidon2Repr (cache.set ⟨cacheSize.toNat, hspace⟩ input) state cacheSize false - apply STHoare.letIn_intro (Q := fun _ => [selfRef ↦ ⟨Poseidon2Tp, cacheAfter⟩]) - · steps - subst i_2755 - congr - exact mkPoseidon2Repr_cache_set_get cache state cacheSize input hspace _ - · intro _ - steps - rw [← hout] - congr - · rcases hmodel with ⟨hspace', _⟩ - exact False.elim (hspace hspace') - -private lemma SpongeValid.absorb?_exists {p} - (s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)) - (input : Fp p) - (hv : SpongeValid s) : - ∃ s', Crypto.Poseidon2.Sponge.absorb? (Crypto.Poseidon2.noirParams4 p) s input = some s' := by - rcases s with ⟨cache, state, cacheSize, squeezeMode⟩ - rcases hv with ⟨hcache, hsqueeze⟩ - have hcache' : cacheSize ≤ 3 := by simpa [SpongeValid] using hcache - have hsqueeze' : squeezeMode = false := by simpa [SpongeValid] using hsqueeze - subst squeezeMode - by_cases hfull : cacheSize = 3 - · simp [Crypto.Poseidon2.Sponge.absorb?, Crypto.Poseidon2.Sponge.performDuplex, - Crypto.Poseidon2.noirParams4, hfull] - · have hspace : cacheSize < 3 := by omega - simp [Crypto.Poseidon2.Sponge.absorb?, Crypto.Poseidon2.noirParams4, hfull, hspace] - -private lemma SpongeValid.absorb?_step {p} - (s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)) - (input : Fp p) - (hv : SpongeValid s) : - ∃ s', - Crypto.Poseidon2.Sponge.absorb? (Crypto.Poseidon2.noirParams4 p) s input = some s' ∧ - absorbRepr? (spongeToRepr s) input = some (spongeToRepr s') ∧ - SpongeValid s' := by - rcases SpongeValid.absorb?_exists s input hv with ⟨s', hAbs⟩ - exact ⟨s', hAbs, absorbRepr?_spongeToRepr hv hAbs, SpongeValid.absorb?_some hv hAbs⟩ - -private lemma SpongeValid.squeeze?_of_hash?_false {p} - {inputs : List (Fp p)} - {inLen : Nat} - {s : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)} - {out : Fp p} - (hprefix : Crypto.Poseidon2.Sponge.absorbPrefix? (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.noirIV inLen)) inputs inLen = some s) - (hout : Crypto.Poseidon2.Sponge.hash? - (Crypto.Poseidon2.noirParams4 p) inputs inLen false = some out) : - ∃ s', - Crypto.Poseidon2.Sponge.squeeze? (Crypto.Poseidon2.noirParams4 p) s = some (out, s') := by - simp [Crypto.Poseidon2.Sponge.hash?, Crypto.Poseidon2.Sponge.hashWithIV?, hprefix] at hout - rcases hsq : Crypto.Poseidon2.Sponge.squeeze? (Crypto.Poseidon2.noirParams4 p) s with _ | ⟨out', s'⟩ - · simp [hsq] at hout - · simp [hsq] at hout - subst out' - exact ⟨s', rfl⟩ - -private lemma SpongeValid.squeeze?_of_hash?_true {p} - {inputs : List (Fp p)} - {inLen : Nat} - {s s1 : Crypto.Poseidon2.Sponge (Fp p) (Crypto.Poseidon2.noirParams4 p)} - {out : Fp p} - (hprefix : Crypto.Poseidon2.Sponge.absorbPrefix? (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.noirIV inLen)) inputs inLen = some s) - (hAbsMarker : Crypto.Poseidon2.Sponge.absorb? - (Crypto.Poseidon2.noirParams4 p) s (1 : Fp p) = some s1) - (hout : Crypto.Poseidon2.Sponge.hash? - (Crypto.Poseidon2.noirParams4 p) inputs inLen true = some out) : - ∃ s', - Crypto.Poseidon2.Sponge.squeeze? (Crypto.Poseidon2.noirParams4 p) s1 = some (out, s') := by - simp [Crypto.Poseidon2.Sponge.hash?, Crypto.Poseidon2.Sponge.hashWithIV?, hprefix, - hAbsMarker] at hout - rcases hsq : Crypto.Poseidon2.Sponge.squeeze? (Crypto.Poseidon2.noirParams4 p) s1 with _ | ⟨out', s'⟩ - · simp [hsq] at hout - · simp [hsq] at hout - subst out' - exact ⟨s', rfl⟩ - -theorem squeeze_spec {p selfRef} - {self outSelf : Poseidon2Repr p} - {out : Fp p} - (hout : squeezeRepr? self = some (out, outSelf)) - : STHoare p env - [selfRef ↦ ⟨Poseidon2Tp, self⟩] - («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::squeeze».call h![] h![selfRef]) - (fun r => [selfRef ↦ ⟨Poseidon2Tp, outSelf⟩] ⋆ ⟦r = out⟧) := by - rcases self with ⟨cache, state, cacheSize, squeezeMode, unit0⟩ - simp [squeezeRepr?, reprToSponge, Crypto.Poseidon2.Sponge.squeeze?, - Crypto.Poseidon2.Sponge.performDuplex, spongeToRepr, - mkPoseidon2Repr] at hout - rcases hout with ⟨hsqueeze, houtVal, houtSelf⟩ - subst squeezeMode - enter_decl - steps [perform_duplex_spec - (cache := cache) (state := state) (cacheSize := cacheSize) (squeezeMode := false)] - · rename_i hModify ret hBound hRet - simp [Lens.modify, Access.modify, performDuplexRepr, mkPoseidon2Repr] at hRet ⊢ - rw [hRet] - rw [noirPermutation4_addCachePrefixToState_eq_sponge cache state cacheSize false] - exact houtVal - · rename_i hModify ret hBound hRet - simp [Lens.modify, Access.modify, performDuplexRepr, mkPoseidon2Repr] at hModify ⊢ - rw [noirPermutation4_addCachePrefixToState_eq_sponge cache state cacheSize false] - congr - -theorem hash_internal_spec {p} - {N : U 32} - {input : Tp.denote p (Tp.field.array N)} - {inLen : U 32} - {isVariableLength : Bool} - {out : Fp p} - (hout : (Crypto.Poseidon2.Sponge.hash? - (Crypto.Poseidon2.noirParams4 p) - input.toList - inLen.toNat - isVariableLength) = some out) +private theorem poseidon2_permutation4_spec' {p} {input : List.Vector (Fp p) 4} : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::hash_internal».call h![N] - h![input, inLen, isVariableLength]) - (fun r => r = out) := by + («std-1.0.0-beta.25::hash::poseidon2_permutation».call h![(4 : U 32)] h![input]) + (fun r => r = Crypto.Poseidon2.noirPermutation4 input) := by enter_decl - steps [new_spec] - subst_vars - loop_inv nat (fun i _ _ => - HashInternalLoopInv input inLen (Crypto.Poseidon2.Sponge.noirIV inLen.toNat) sponge i) - · dsimp [HashInternalLoopInv] - sl - · simp [absorbList?, Crypto.Poseidon2.Sponge.noirIV] - · exact SpongeValid.init _ - · simp - · intro i hlo hhi - apply Steps.pull_exi - intro s - steps - rename_i hprefix hvalid - apply STHoare.ite_intro - · intro hcond - have hiLen : i < inLen.toNat := - nat_lt_of_decide_bv_lt_trueLT (lt_two_pow_of_lt_u32 hhi) hcond - have hiInput : i < input.toList.length := by - simpa [BitVec.toNat_ofNatLT] using hhi - rcases SpongeValid.absorb?_step s input.toList[i] hvalid with ⟨s', hAbs, hrepr, hvalid'⟩ - steps [absorb_spec (selfRef := sponge) hrepr] - dsimp [HashInternalLoopInv] - sl - · exact absorbList?_take_min_succ_of_lt - (Crypto.Poseidon2.noirParams4 p) hiLen hiInput hprefix hAbs - · exact hvalid' - · intro hcond - have hgeLen : inLen.toNat ≤ i := - nat_le_of_decide_bv_lt_falseLT (lt_two_pow_of_lt_u32 hhi) hcond - steps - dsimp [HashInternalLoopInv] - sl - · exact absorbList?_take_min_succ_of_not_lt - (Crypto.Poseidon2.noirParams4 p) hgeLen hprefix - · exact hvalid - · steps_named as [hbound, s, hprefix, hvalid] - have hprefixSem : - Crypto.Poseidon2.Sponge.absorbPrefix? (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.init (Crypto.Poseidon2.noirParams4 p) - (Crypto.Poseidon2.Sponge.noirIV inLen.toNat)) input.toList inLen.toNat = some s := - absorbPrefix?_of_absorbList?_take (Crypto.Poseidon2.noirParams4 p) - (by simpa [BitVec.toNat_ofNatLT, take_min_vector_length_right input inLen.toNat] using hprefix) - cases isVariableLength - · rcases SpongeValid.squeeze?_of_hash?_false hprefixSem hout with ⟨s', hsq⟩ - apply STHoare.letIn_intro (Q := fun _ => [sponge ↦ ⟨Poseidon2Tp, spongeToRepr s⟩]) - · apply STHoare.ite_intro_of_false rfl - steps - · intro _ - steps [squeeze_spec (selfRef := sponge) (squeezeRepr?_spongeToRepr hvalid hsq)] - subst_vars - rfl - · rcases SpongeValid.absorb?_step s (1 : Fp p) hvalid with - ⟨s1, hAbsMarker, hreprMarker, hvalid1⟩ - rcases SpongeValid.squeeze?_of_hash?_true hprefixSem hAbsMarker hout with ⟨s', hsq⟩ - apply STHoare.letIn_intro (Q := fun _ => [sponge ↦ ⟨Poseidon2Tp, spongeToRepr s1⟩]) - · apply STHoare.ite_intro_of_true rfl - steps [absorb_spec (selfRef := sponge) hreprMarker] - · intro _ - steps [squeeze_spec (selfRef := sponge) (squeezeRepr?_spongeToRepr hvalid1 hsq)] - subst_vars - rfl - -theorem hash_spec {p} - {N : U 32} - {input : Tp.denote p (Tp.field.array N)} - {messageSize : U 32} - {out : Fp p} - (hout : Crypto.Poseidon2.Sponge.hash? - (Crypto.Poseidon2.noirParams4 p) - input.toList - messageSize.toNat - (messageSize ≠ N) = some out) - : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::hash::poseidon2::Poseidon2::hash».call h![N] - h![input, messageSize]) - (fun r => r = out) := by - enter_decl - steps [hash_internal_spec hout] + steps [config_state_size_spec, poseidon2_permutation_builtin_spec] assumption theorem hasher_write_spec {p selfRef} @@ -780,49 +188,140 @@ theorem hasher_write_spec {p selfRef} resolve_trait steps +theorem hasher_finish_ref_spec {p selfRef} + {inputs : List (Fp p)} + (hlen : inputs.length < 2 ^ 32) + : STHoare p env + [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩] + («std-1.0.0-beta.25::hash::Hasher».finish_ref h![] Poseidon2HasherTp h![] h![] + h![selfRef]) + (fun r => [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩] ⋆ + ⟦r = finishDigest inputs⟧) := by + resolve_trait + steps [rate_spec] + subst_vars + apply STHoare.letIn_intro + (Q := fun _ => + [state ↦ ⟨Tp.field.array 4, chunkState inputs (inputs.length / 3)⟩] ⋆ + [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩]) + · + loop_inv nat (fun i _ _ => + [state ↦ ⟨Tp.field.array 4, chunkState inputs i⟩] ⋆ + [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩]) + · + -- `0 ≤ len / RATE` loop-bound side goal. + simp + · + intro i _ hhi + have hiLt : i < inputs.length / 3 := by + simpa [mkPoseidon2HasherRepr_head] using hhi + steps [rate_spec] + subst_vars + apply STHoare.letIn_intro + (Q := fun _ => + [state ↦ ⟨Tp.field.array 4, + addToState (chunkState inputs i) ((inputs.drop (3 * i)).take 3)⟩] ⋆ + [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩]) + · + loop_inv nat (fun j _ _ => + [state ↦ ⟨Tp.field.array 4, + addToState (chunkState inputs i) ((inputs.drop (3 * i)).take j)⟩] ⋆ + [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩]) + · + -- j = 0: `take 0 = []`, `addToState_nil`. + simp + · + -- `0 ≤ RATE` loop-bound side goal. + simp + · + intro j _ hj3 + steps [rate_spec] + have hj3' : j < 3 := by simpa using hj3 + have hj4 : j < 4 := by omega + have hdm : inputs.length / 3 * 3 ≤ inputs.length := Nat.div_mul_le_self _ _ + have hjx : j < (inputs.drop (3 * i)).length := by + simp only [List.length_drop] + omega + have hlt1 : i * 3 < 4294967296 := by omega + have hlt2 : i * 3 + j < 4294967296 := by omega + have hstep := addToState_set_step (chunkState inputs i) (inputs.drop (3 * i)) j hj4 hjx + congr 1 + rw [← hstep] + simp only [Builtin.CastTp.cast, BitVec.setWidth_eq, BitVec.toNat_ofNatLT, + BitVec.toNat_add, BitVec.toNat_mul, mkPoseidon2HasherRepr_head, + List.get_eq_getElem] + simp [Lens.modify, Access.modify, hj4, Nat.mod_eq_of_lt hlt1, Nat.mod_eq_of_lt hlt2, + List.getElem_drop, Nat.mul_comm 3 i] + rfl + · + intro _ + steps [poseidon2_permutation4_spec'] + · + intro _ + -- `absorbed := (len / RATE) * RATE`, then the tail loop, then the final permutation. + steps [rate_spec] + subst_vars + apply STHoare.letIn_intro + (Q := fun _ => + [state ↦ ⟨Tp.field.array 4, + addToState (chunkState inputs (inputs.length / 3)) + (inputs.drop (3 * (inputs.length / 3)))⟩] ⋆ + [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩]) + · + loop_inv nat (fun i _ _ => + [state ↦ ⟨Tp.field.array 4, + addToState (chunkState inputs (inputs.length / 3)) + ((inputs.drop (3 * (inputs.length / 3))).take i)⟩] ⋆ + [selfRef ↦ ⟨Poseidon2HasherTp, mkPoseidon2HasherRepr inputs⟩]) + · + -- i = 0: `take 0 = []`, `addToState_nil`. + simp + · + -- `0 ≤ len % RATE` loop-bound side goal. + simp + · + -- postcondition: taking `len % RATE` of the tail is the whole tail. + simp [mkPoseidon2HasherRepr_head, BitVec.toNat_umod, BitVec.toNat_ofNatLT, + take_mod_drop_eq] + · + intro i _ hiRem + steps + have hiRem' : i < inputs.length % 3 := by + simpa [mkPoseidon2HasherRepr_head, BitVec.toNat_umod, BitVec.toNat_ofNatLT] + using hiRem + have hi4 : i < 4 := by omega + have hdm : inputs.length / 3 * 3 ≤ inputs.length := Nat.div_mul_le_self _ _ + have hix : i < (inputs.drop (3 * (inputs.length / 3))).length := by + simp only [List.length_drop] + omega + have hlt1 : inputs.length / 3 * 3 < 4294967296 := by omega + have hlt2 : inputs.length / 3 * 3 + i < 4294967296 := by omega + have hstep := addToState_set_step (chunkState inputs (inputs.length / 3)) + (inputs.drop (3 * (inputs.length / 3))) i hi4 hix + congr 1 + rw [← hstep] + simp only [Builtin.CastTp.cast, BitVec.setWidth_eq, BitVec.toNat_ofNatLT, + BitVec.toNat_add, BitVec.toNat_mul, BitVec.toNat_udiv, mkPoseidon2HasherRepr_head, + List.get_eq_getElem] + simp [Lens.modify, Access.modify, hi4, Nat.mod_eq_of_lt hlt1, Nat.mod_eq_of_lt hlt2, + List.getElem_drop, Nat.mul_comm 3 (inputs.length / 3)] + rfl + · + intro _ + steps [poseidon2_permutation4_spec'] + subst_vars + rfl + theorem hasher_finish_spec {p} {inputs : List (Fp p)} - {out : Fp p} - (hout : Crypto.Poseidon2.Sponge.hash? - (Crypto.Poseidon2.noirParams4 p) - inputs - inputs.length - false = some out) + (hlen : inputs.length < 2 ^ 32) : STHoare p env ⟦⟧ («std-1.0.0-beta.25::hash::Hasher».finish h![] Poseidon2HasherTp h![] h![] h![mkPoseidon2HasherRepr inputs]) - (fun r => r = out) := by + (fun r => r = finishDigest inputs) := by resolve_trait - steps [new_spec] + steps [hasher_finish_ref_spec hlen] subst_vars - loop_inv nat (fun i _ _ => - HasherFinishLoopInv inputs (Crypto.Poseidon2.Sponge.noirIV inputs.length) sponge i) - · dsimp [HasherFinishLoopInv] - sl - · simp [absorbList?, mkPoseidon2HasherRepr_head, Crypto.Poseidon2.Sponge.noirIV] - · exact SpongeValid.init _ - · simp - · intro i hlo hhi - apply Steps.pull_exi - intro s - steps - rename_i hprefix hvalid hidx - simp [mkPoseidon2HasherRepr_head, BitVec.toNat_ofNatLT, List.get_eq_getElem] - have hiInputs : i < inputs.length := by - simpa [mkPoseidon2HasherRepr_head, BitVec.toNat_ofNatLT] using hhi - rcases SpongeValid.absorb?_step s inputs[i] hvalid with ⟨s', hAbs, hrepr, hvalid'⟩ - steps [absorb_spec (selfRef := sponge) hrepr] - dsimp [HasherFinishLoopInv] - sl - · exact absorbList?_take_succ_some (Crypto.Poseidon2.noirParams4 p) hiInputs hprefix hAbs - · exact hvalid' - · steps_named as [hbound, s, hprefix, hvalid] - rcases SpongeValid.squeeze?_of_hash?_false - (absorbPrefix?_of_absorbList?_take (Crypto.Poseidon2.noirParams4 p) - (by simpa [mkPoseidon2HasherRepr_head, BitVec.toNat_ofNatLT] using hprefix)) - hout with ⟨s', hsq⟩ - steps [squeeze_spec (selfRef := sponge) (squeezeRepr?_spongeToRepr hvalid hsq)] - subst_vars - rfl + rfl end Lampe.Stdlib.Hash.Poseidon2 diff --git a/stdlib/lampe/Stdlib/Option.lean b/stdlib/lampe/Stdlib/Option.lean index 5cd43676..14488950 100644 --- a/stdlib/lampe/Stdlib/Option.lean +++ b/stdlib/lampe/Stdlib/Option.lean @@ -76,21 +76,26 @@ theorem some_spec {p T v} : STHoare p env ⟦⟧ («std-1.0.0-beta.25::option::O subst_vars rfl -theorem is_none_spec {p T v} : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::option::Option::is_none».call h![T] h![v]) - (fun r => r = (toOption v).isNone) := by +-- Note: since beta.25, `is_none` and `is_some` take `&self`, so their specs are ref-style. +theorem is_none_spec {p T v} + {selfRef : Ref («std-1.0.0-beta.25::option::Option».tp h![T])} : + STHoare p env [selfRef ↦ ⟨«std-1.0.0-beta.25::option::Option».tp h![T], v⟩] + («std-1.0.0-beta.25::option::Option::is_none».call h![T] h![selfRef]) + (fun r => [selfRef ↦ ⟨«std-1.0.0-beta.25::option::Option».tp h![T], v⟩] ⋆ + ⟦r = (toOption v).isNone⟧) := by enter_decl steps - subst_vars - simp + simp_all [option_fst_eq_toOption_isSome, Option.not_isSome] -theorem is_some_spec {p T v} : STHoare p env ⟦⟧ - («std-1.0.0-beta.25::option::Option::is_some».call h![T] h![v]) - (fun r => r = (toOption v).isSome) := by +theorem is_some_spec {p T v} + {selfRef : Ref («std-1.0.0-beta.25::option::Option».tp h![T])} : + STHoare p env [selfRef ↦ ⟨«std-1.0.0-beta.25::option::Option».tp h![T], v⟩] + («std-1.0.0-beta.25::option::Option::is_some».call h![T] h![selfRef]) + (fun r => [selfRef ↦ ⟨«std-1.0.0-beta.25::option::Option».tp h![T], v⟩] ⋆ + ⟦r = (toOption v).isSome⟧) := by enter_decl steps - subst_vars - simp + simp_all [option_fst_eq_toOption_isSome] theorem unwrap_spec {p T v} : STHoare p env ⟦⟧ («std-1.0.0-beta.25::option::Option::unwrap».call h![T] h![v]) @@ -363,6 +368,7 @@ theorem or_else_pure_spec {p T E P self default default_b} subst_vars simp_all +set_option maxHeartbeats 1000000 in theorem xor_spec {p T self other} : STHoare p env ⟦⟧ («std-1.0.0-beta.25::option::Option::xor».call h![T] h![self, other]) @@ -409,6 +415,7 @@ theorem filter_none_spec {p T E self pred} steps [none_spec] simp_all +set_option maxHeartbeats 1000000 in theorem filter_some_spec {p T E P Q self pred pred_b} (self_is_some : (toOption self).isSome) (pred_f : STHoare p env P (pred_b h![(toOption self).get self_is_some]) Q) @@ -692,7 +699,7 @@ theorem expect_spec {p T N MT v message} enter_decl steps [is_some_spec] subst_vars - simp_all + exact option_snd_eq_toOption_get_of_isSome v_is_some theorem unwrap_or_spec {p T v default} : STHoare p env ⟦⟧ From dc175c547f2de7a026f5e658b00730275391ae69 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:49:15 +0000 Subject: [PATCH 09/10] Re-extract the testing projects at beta.25 and repair their proofs The Merkle projects' vendored deps/hasher-0.0.0 snapshots are replaced by direct path requires on ../../hasher/lampe: the extractor no longer vendors dependencies that ship their own lampe directory, so the stale snapshots could never be regenerated. Merkle also gains a clean.sh (matching Base64's) so generated extraction output is refreshed on every test run. MerkleFromScratch's sgn0 spec is restated for beta.25's bool bit decomposition, and Sort's handwritten env-inclusion proof plus the checked-in lakefiles/manifests now reference std-1.0.0-beta.25. --- testing/Base64/Nargo.toml | 2 +- .../lampe/Base64Test-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../lampe/Base64Test-0.0.0/Extracted/Lib.lean | 8 +- .../lampe/lake-manifest.json | 2 +- .../noir_base64-0.0.0/lampe/lakefile.toml | 2 +- .../lampe/noir_base64-0.0.0/Extracted.lean | 6 +- .../Extracted/Benchmarks/Mod.lean | 20 +- .../noir_base64-0.0.0/Extracted/Decoder.lean | 262 ++++++++--------- .../noir_base64-0.0.0/Extracted/Encoder.lean | 276 +++++++++--------- .../Extracted/Encoder/ToBeRadix.lean | 2 +- .../Extracted/GeneratedTypes.lean | 2 +- .../noir_base64-0.0.0/Extracted/Lib.lean | 8 +- .../Extracted/OracleTest.lean | 88 ++++++ testing/Base64/lampe/lake-manifest.json | 2 +- testing/Base64/lampe/lakefile.toml | 2 +- .../lampe/complexnr-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- testing/Complexnr/lampe/lake-manifest.json | 2 +- testing/Complexnr/lampe/lakefile.toml | 2 +- .../ExtractionTests-0.0.0/Extracted.lean | 4 +- .../Extracted/AssociatedType.lean | 4 +- .../Extracted/Experiments.lean | 12 +- .../Extracted/GeneratedTypes.lean | 42 +-- .../Extracted/ImplTraitReturn.lean | 6 +- .../Extracted/MultipleGenerics.lean | 4 +- .../Extracted/ShadowMut.lean | 2 +- .../Extracted/TraitAssociatedConst.lean | 6 +- .../ExtractionTests/lampe/lake-manifest.json | 2 +- testing/ExtractionTests/lampe/lakefile.toml | 2 +- testing/ExtractionTests/src/shadow_mut.nr | 2 +- testing/Merkle/clean.sh | 10 + .../hasher/lampe/hasher-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../Merkle/hasher/lampe/lake-manifest.json | 2 +- testing/Merkle/hasher/lampe/lakefile.toml | 10 +- .../merkle/lampe/Merkle-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../deps/hasher-0.0.0/lampe/hasher-0.0.0.lean | 3 - .../lampe/hasher-0.0.0/Extracted.lean | 10 - .../Extracted/GeneratedTypes.lean | 16 - .../lampe/hasher-0.0.0/Extracted/Lib.lean | 10 - .../deps/hasher-0.0.0/lampe/lakefile.toml | 20 -- .../deps/hasher-0.0.0/lampe/lean-toolchain | 1 - .../Merkle/merkle/lampe/lake-manifest.json | 4 +- testing/Merkle/merkle/lampe/lakefile.toml | 4 +- .../deps/hasher-0.0.0/lampe/hasher-0.0.0.lean | 3 - .../lampe/hasher-0.0.0/Extracted.lean | 10 - .../Extracted/GeneratedTypes.lean | 16 - .../lampe/hasher-0.0.0/Extracted/Lib.lean | 10 - .../deps/hasher-0.0.0/lampe/lakefile.toml | 20 -- .../deps/hasher-0.0.0/lampe/lean-toolchain | 1 - .../skyscraper/lampe/lake-manifest.json | 4 +- testing/Merkle/skyscraper/lampe/lakefile.toml | 4 +- .../lampe/skyscraper-0.0.0/Extracted.lean | 4 +- .../lampe/skyscraper-0.0.0/Extracted/Bar.lean | 6 +- .../Extracted/GeneratedTypes.lean | 2 +- .../skyscraper-0.0.0/Extracted/Globals.lean | 2 +- .../lampe/skyscraper-0.0.0/Extracted/Lib.lean | 4 +- testing/Merkle/skyscraper/src/bar.nr | 2 +- .../lampe/Merkle-1.0.0/Extracted.lean | 4 +- .../lampe/Merkle-1.0.0/Extracted/Bar.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../Merkle-1.0.0/Extracted/Globals/Mod.lean | 2 +- .../Extracted/Skyscraper/Mod.lean | 4 +- .../Merkle-1.0.0/Extracted/Utils/Mod.lean | 4 +- .../lampe/Merkle-1.0.0/Spec.lean | 5 +- .../lampe/lake-manifest.json | 2 +- testing/MerkleFromScratch/lampe/lakefile.toml | 2 +- testing/MerkleFromScratch/src/bar.nr | 2 +- testing/MerkleFromScratch/src/utils/mod.nr | 4 +- .../lampe/Multiple-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- testing/Multiple/lampe/lake-manifest.json | 2 +- testing/Multiple/lampe/lakefile.toml | 2 +- .../lampe/check_shuffle-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../check_shuffle-0.0.0/Extracted/Lib.lean | 8 +- .../check_shuffle-0.0.0/lampe/lakefile.toml | 2 +- testing/Sort/lampe/lake-manifest.json | 2 +- testing/Sort/lampe/lakefile.toml | 2 +- testing/Sort/lampe/noir_sort-0.0.0.lean | 2 +- .../Sort/lampe/noir_sort-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../lampe/noir_sort-0.0.0/Extracted/Lib.lean | 12 +- testing/Sort/src/quicksort/quicksort.nr | 2 +- .../Sort/src/quicksort/quicksort_explicit.nr | 2 +- .../lampe/TestDep-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../lampe/GitDep-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../deps/GitDep-0.0.0/lampe/lakefile.toml | 2 +- .../lampe/GitDep-1.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../deps/GitDep-1.0.0/lampe/lakefile.toml | 2 +- .../lampe/GitDep-2.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../deps/GitDep-2.0.0/lampe/lakefile.toml | 2 +- .../lampe/LocalDep-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../deps/LocalDep-0.0.0/lampe/lakefile.toml | 2 +- .../lampe/LocalDep-1.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../deps/LocalDep-1.0.0/lampe/lakefile.toml | 2 +- .../lampe/LocalDep-2.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 2 +- .../deps/LocalDep-2.0.0/lampe/lakefile.toml | 2 +- testing/TestDep/lampe/lake-manifest.json | 65 +++-- testing/TestDep/lampe/lakefile.toml | 6 +- .../GitDepWithLampe-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 4 +- .../GitDepWithLampe-0.0.0/Extracted/Lib.lean | 2 + .../GitDepWithLampe/lampe/lakefile.toml | 2 +- .../GitDepWithLampe-1.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 4 +- .../GitDepWithLampe-1.0.0/Extracted/Lib.lean | 2 + .../GitDepWithLampeV1/lampe/lakefile.toml | 2 +- .../GitDepWithLampe-2.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 4 +- .../GitDepWithLampe-2.0.0/Extracted/Lib.lean | 2 + .../GitDepWithLampeV2/lampe/lakefile.toml | 2 +- .../LocalDepWithLampe-0.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 4 +- .../Extracted/Lib.lean | 2 + .../LocalDepWithLampe/lampe/lakefile.toml | 2 +- .../LocalDepWithLampe-1.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 4 +- .../Extracted/Lib.lean | 2 + .../LocalDepWithLampeV1/lampe/lakefile.toml | 2 +- .../LocalDepWithLampe-2.0.0/Extracted.lean | 4 +- .../Extracted/GeneratedTypes.lean | 4 +- .../Extracted/Lib.lean | 2 + .../LocalDepWithLampeV2/lampe/lakefile.toml | 2 +- 133 files changed, 653 insertions(+), 607 deletions(-) create mode 100644 testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/OracleTest.lean create mode 100755 testing/Merkle/clean.sh delete mode 100644 testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean delete mode 100644 testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean delete mode 100644 testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean delete mode 100644 testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean delete mode 100644 testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lakefile.toml delete mode 100644 testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lean-toolchain delete mode 100644 testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean delete mode 100644 testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean delete mode 100644 testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean delete mode 100644 testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean delete mode 100644 testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lakefile.toml delete mode 100644 testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lean-toolchain diff --git a/testing/Base64/Nargo.toml b/testing/Base64/Nargo.toml index 73412fc4..bc3e4b58 100644 --- a/testing/Base64/Nargo.toml +++ b/testing/Base64/Nargo.toml @@ -4,4 +4,4 @@ type = "lib" authors = [""] [dependencies] -noir_base64 = { tag = "v0.4.2", git = "https://github.com/noir-lang/noir_base64" } +noir_base64 = { tag = "v0.5.0", git = "https://github.com/noir-lang/noir_base64" } diff --git a/testing/Base64/lampe/Base64Test-0.0.0/Extracted.lean b/testing/Base64/lampe/Base64Test-0.0.0/Extracted.lean index 38b4e1af..2673be7c 100644 --- a/testing/Base64/lampe/Base64Test-0.0.0/Extracted.lean +++ b/testing/Base64/lampe/Base64Test-0.0.0/Extracted.lean @@ -3,10 +3,10 @@ import «Base64Test-0.0.0».Extracted.GeneratedTypes import «Base64Test-0.0.0».Extracted.Lib import «noir_base64-0.0.0».Extracted -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «Base64Test-0.0.0» def env := Lib.env ++ «noir_base64-0.0.0».env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Base64/lampe/Base64Test-0.0.0/Extracted/GeneratedTypes.lean b/testing/Base64/lampe/Base64Test-0.0.0/Extracted/GeneratedTypes.lean index ee8faf11..6393cee0 100644 --- a/testing/Base64/lampe/Base64Test-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Base64/lampe/Base64Test-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import «noir_base64-0.0.0».Extracted.GeneratedTypes import Lampe diff --git a/testing/Base64/lampe/Base64Test-0.0.0/Extracted/Lib.lean b/testing/Base64/lampe/Base64Test-0.0.0/Extracted/Lib.lean index 44cbea82..62de78ad 100644 --- a/testing/Base64/lampe/Base64Test-0.0.0/Extracted/Lib.lean +++ b/testing/Base64/lampe/Base64Test-0.0.0/Extracted/Lib.lean @@ -7,12 +7,12 @@ open Lampe set_option linter.unusedVariables false -noir_def «Base64Test-0.0.0»::encode_with_padding(input: Array) -> Array := { - («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode as λ(Array) -> Array)(input) +noir_def «Base64Test-0.0.0»::encode_with_padding(input: Array) -> Array := { + («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode as λ(Array) -> Array)(input) } -noir_def «Base64Test-0.0.0»::encode_no_padding(input: Array) -> Array := { - («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode as λ(Array) -> Array)(input) +noir_def «Base64Test-0.0.0»::encode_no_padding(input: Array) -> Array := { + («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode as λ(Array) -> Array)(input) } def «Base64Test-0.0.0».Lib.env : Env := Env.mk diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lake-manifest.json b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lake-manifest.json index 45abe1dc..72a6fb7a 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lake-manifest.json +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lake-manifest.json @@ -6,7 +6,7 @@ "subDir": "stdlib/lampe", "scope": "", "rev": "0a98344e47323d1a718eb5eff65e07d83cebd4b3", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inputRev": "main", "inherited": false, diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lakefile.toml b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lakefile.toml index 6bc93b65..db3454bc 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lakefile.toml +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/lakefile.toml @@ -15,7 +15,7 @@ rev = "main" subDir = "Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted.lean index e44b0d23..3bf65593 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted.lean +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted.lean @@ -7,8 +7,9 @@ import «noir_base64-0.0.0».Extracted.Encoder import «noir_base64-0.0.0».Extracted.Encoder.ToBeRadix import «noir_base64-0.0.0».Extracted.GeneratedTypes import «noir_base64-0.0.0».Extracted.Lib +import «noir_base64-0.0.0».Extracted.OracleTest import «noir_base64-0.0.0».Extracted.Tables -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «noir_base64-0.0.0» @@ -18,5 +19,6 @@ def env := Benchmarks.Mod.env ++ Encoder.ToBeRadix.env ++ Encoder.env ++ Lib.env + ++ OracleTest.env ++ Tables.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Benchmarks/Mod.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Benchmarks/Mod.lean index a8da74ad..4c837fcd 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Benchmarks/Mod.lean +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Benchmarks/Mod.lean @@ -15,28 +15,28 @@ noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_url_safe<>(input: A («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode<610: u32> as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_var<>(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<610: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_var<>(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<610: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } -noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_url_safe_var<>(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<610: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_url_safe_var<>(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<610: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_no_pad<>(input: Array) -> Array := { («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<610: u32> as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_var_no_pad<>(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<610: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::benchmarks::bench_encode_610_var_no_pad<>(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<610: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } noir_def «noir_base64-0.0.0»::benchmarks::bench_decode_610<>(input: Array) -> Array := { («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<816: u32, 610: u32> as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::benchmarks::bench_decode_610_var<>(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let r = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<816: u32, 610: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); +noir_def «noir_base64-0.0.0»::benchmarks::bench_decode_610_var<>(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let r = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<816: u32, 610: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); r } @@ -44,8 +44,8 @@ noir_def «noir_base64-0.0.0»::benchmarks::bench_decode_610_no_pad<>(input: Arr («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<816: u32, 610: u32> as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::benchmarks::bench_decode_610_var_no_pad<>(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let r = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<816: u32, 610: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); +noir_def «noir_base64-0.0.0»::benchmarks::bench_decode_610_var_no_pad<>(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + let r = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<816: u32, 610: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); r } diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Decoder.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Decoder.lean index f34f70bf..4fbc3070 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Decoder.lean +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Decoder.lean @@ -8,46 +8,48 @@ open Lampe set_option linter.unusedVariables false noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBE::decode(input: Array) -> Array := { - («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) + («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode(input: Array) -> Array := { - («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) + («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode(input: Array) -> Array := { - («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) + («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode(input: Array) -> Array := { - («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) + («noir_base64-0.0.0»::decoder::decode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::decoder::decode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } noir_def «noir_base64-0.0.0»::decoder::__validate_decoded<>(decoded: Field, input_byte: u8, offset: u32) -> Unit := { (#_fresh returning Unit)() } -noir_def «noir_base64-0.0.0»::decoder::__get_num_padding_chars_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Tuple := { +noir_def «noir_base64-0.0.0»::decoder::__get_num_padding_chars_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Tuple := { (#_fresh returning Tuple)() } -noir_def «noir_base64-0.0.0»::decoder::decode(input: Array) -> Array := { +noir_def «noir_base64-0.0.0»::decoder::decode(input: Array) -> Array := { + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(Pad: u8), (2: u8)), "Pad must be 0 or 1"); + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(UseURLTable: u8), (2: u8)), "UseURLTable must be 0 or 1"); let rem = (#_uRem returning u32)(uConst!(OutputBytes: u32), (3: u32)); let num_padding_chars = if (#_uEq returning bool)(rem, (1: u32)) then { (2: u32) @@ -57,7 +59,7 @@ noir_def «noir_base64-0.0.0»::decoder::decode as λ() -> u32)()), j); let input_byte = (#_arrayIndex returning u8)(input, (#_cast returning u32)(offset)); let index = (#_cast returning u32)(input_byte); - let decoded = if (#_uEq returning bool)(uConst!(UseURLTable: u1), (1: u1)) then { + let decoded = if (#_uEq returning bool)(uConst!(UseURLTable: u8), (1: u8)) then { (#_arrayIndex returning Field)((«noir_base64-0.0.0»::tables::BASE64_DECODE_BE_URL_TABLE<> as λ() -> Array)(), (#_cast returning u32)(index)) } else { (#_arrayIndex returning Field)((«noir_base64-0.0.0»::tables::BASE64_DECODE_BE_TABLE<> as λ() -> Array)(), (#_cast returning u32)(index)) @@ -99,17 +101,16 @@ noir_def «noir_base64-0.0.0»::decoder::decode as λ(Field) -> Array)((#_readRef returning Field)(slice)); + let slice_bytes = («std-1.0.0-beta.25»::field::to_be_bytes<30: u32> as λ(Field) -> Array)((#_readRef returning Field)(slice)); for j in (0: u32) .. («noir_base64-0.0.0»::defaults::BYTES_PER_CHUNK<> as λ() -> u32)() do { - let i_4844 = (#_uAdd returning u32)((#_uMul returning u32)(i, («noir_base64-0.0.0»::defaults::BYTES_PER_CHUNK<> as λ() -> u32)()), j); - (result[i_4844]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(j)); + (result[(#_uAdd returning u32)((#_uMul returning u32)(i, («noir_base64-0.0.0»::defaults::BYTES_PER_CHUNK<> as λ() -> u32)()), j)]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(j)); #_skip }; #_skip }; let base64_offset = (#_uMul returning u32)(final_chunk, («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)()); let byte_offset = (#_uMul returning u32)(final_chunk, («noir_base64-0.0.0»::defaults::BYTES_PER_CHUNK<> as λ() -> u32)()); - let base64_elements_in_final_chunk = if (#_uNeq returning bool)(uConst!(Pad: u1), (0: u1)) then { + let base64_elements_in_final_chunk = if (#_uNeq returning bool)(uConst!(Pad: u8), (0: u8)) then { (#_uSub returning u32)((#_uSub returning u32)(uConst!(InputElements: u32), base64_offset), num_padding_chars) } else { (#_uSub returning u32)(uConst!(InputElements: u32), base64_offset) @@ -120,7 +121,7 @@ noir_def «noir_base64-0.0.0»::decoder::decode as λ() -> Array)(), (#_cast returning u32)(index)) } else { (#_arrayIndex returning Field)((«noir_base64-0.0.0»::tables::BASE64_DECODE_BE_TABLE<> as λ() -> Array)(), (#_cast returning u32)(index)) @@ -132,16 +133,15 @@ noir_def «noir_base64-0.0.0»::decoder::decode as λ(Field) -> Unit)((#_readRef returning Field)(validity_check)); + («std-1.0.0-beta.25»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)((#_readRef returning Field)(validity_check)); for _ in base64_elements_in_final_chunk .. («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)() do { slice = (#_fMul returning Field)((#_readRef returning Field)(slice), (64: Field)); #_skip }; - let slice_bytes = («std-1.0.0-beta.14»::field::to_be_bytes<30: u32> as λ(Field) -> Array)((#_readRef returning Field)(slice)); + let slice_bytes = («std-1.0.0-beta.25»::field::to_be_bytes<30: u32> as λ(Field) -> Array)((#_readRef returning Field)(slice)); let num_bytes_in_final_chunk = (#_uSub returning u32)(uConst!(OutputBytes: u32), byte_offset); for i in (0: u32) .. num_bytes_in_final_chunk do { - let i_4858 = (#_uAdd returning u32)(byte_offset, i); - (result[i_4858]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(i)); + (result[(#_uAdd returning u32)(byte_offset, i)]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(i)); #_skip }; #_skip @@ -149,19 +149,21 @@ noir_def «noir_base64-0.0.0»::decoder::decode)(result) } -noir_def «noir_base64-0.0.0»::decoder::decode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - let (has_first_padding_byte_claim, has_second_padding_byte_claim) = if (#_uEq returning bool)(uConst!(Pad: u1), (1: u1)) then { - («noir_base64-0.0.0»::decoder::__get_num_padding_chars_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Tuple)(input) +noir_def «noir_base64-0.0.0»::decoder::decode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(Pad: u8), (2: u8)), "Pad must be 0 or 1"); + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(UseURLTable: u8), (2: u8)), "UseURLTable must be 0 or 1"); + let (has_first_padding_byte_claim, has_second_padding_byte_claim) = if (#_uEq returning bool)(uConst!(Pad: u8), (1: u8)) then { + («noir_base64-0.0.0»::decoder::__get_num_padding_chars_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Tuple)(input) } else { (#_makeData returning Tuple)(#_false, #_false) }; - let num_padding_chars = if (#_uEq returning bool)(uConst!(Pad: u1), (1: u1)) then { + let num_padding_chars = if (#_uEq returning bool)(uConst!(Pad: u8), (1: u8)) then { (#_uAdd returning u32)((#_cast returning u32)(has_first_padding_byte_claim), (#_cast returning u32)(has_second_padding_byte_claim)) } else { (0: u32) }; - let input_length = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(input); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)(input); + let input_length = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)(input); let boundary_flags = («noir_base64-0.0.0»::boundary_check::boundary_check as λ(u32) -> Array)(input_length); let result = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); let max_num_chunks = (#_uAdd returning u32)((#_uDiv returning u32)(uConst!(InputElements: u32), («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)()), (#_cast returning u32)((#_uNeq returning bool)((#_uRem returning u32)(uConst!(InputElements: u32), («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)()), (0: u32)))); @@ -175,7 +177,7 @@ noir_def «noir_base64-0.0.0»::decoder::decode_var as λ() -> u32)()), j); let input_byte = (#_arrayIndex returning u8)(input, (#_cast returning u32)(offset)); let decode_index = (#_ref returning & Field)((0: Field)); - if (#_uEq returning bool)(uConst!(Pad: u1), (1: u1)) then { + if (#_uEq returning bool)(uConst!(Pad: u8), (1: u8)) then { let might_be_second_padding_char = (#_ref returning & Field)((0: Field)); let might_be_first_padding_char = (#_ref returning & Field)((0: Field)); if (#_uLt returning bool)((#_uAdd returning u32)(offset, (2: u32)), uConst!(InputElements: u32)) then { @@ -198,9 +200,9 @@ noir_def «noir_base64-0.0.0»::decoder::decode_var as λ(Field) -> Unit)((#_readRef returning Field)(decode_index)); + («std-1.0.0-beta.25»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)((#_readRef returning Field)(decode_index)); let decode_index = (#_cast returning u32)((#_readRef returning Field)(decode_index)); - let decoded = if (#_uEq returning bool)(uConst!(UseURLTable: u1), (1: u1)) then { + let decoded = if (#_uEq returning bool)(uConst!(UseURLTable: u8), (1: u8)) then { (#_arrayIndex returning Field)((«noir_base64-0.0.0»::tables::BASE64_DECODE_BE_URL_VAR_TABLE<> as λ() -> Array)(), (#_cast returning u32)(decode_index)) } else { (#_arrayIndex returning Field)((«noir_base64-0.0.0»::tables::BASE64_DECODE_BE_VAR_TABLE<> as λ() -> Array)(), (#_cast returning u32)(decode_index)) @@ -212,10 +214,9 @@ noir_def «noir_base64-0.0.0»::decoder::decode_var as λ(Field) -> Array)((#_readRef returning Field)(slice)); + let slice_bytes = («std-1.0.0-beta.25»::field::to_be_bytes<30: u32> as λ(Field) -> Array)((#_readRef returning Field)(slice)); for j in (0: u32) .. («noir_base64-0.0.0»::defaults::BYTES_PER_CHUNK<> as λ() -> u32)() do { - let i_4886 = (#_uAdd returning u32)((#_uMul returning u32)(i, («noir_base64-0.0.0»::defaults::BYTES_PER_CHUNK<> as λ() -> u32)()), j); - (result[i_4886]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(j)); + (result[(#_uAdd returning u32)((#_uMul returning u32)(i, («noir_base64-0.0.0»::defaults::BYTES_PER_CHUNK<> as λ() -> u32)()), j)]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(j)); #_skip }; #_skip @@ -229,7 +230,7 @@ noir_def «noir_base64-0.0.0»::decoder::decode_var as λ(Field) -> Unit)((#_readRef returning Field)(decode_index)); + («std-1.0.0-beta.25»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)((#_readRef returning Field)(decode_index)); let decode_index = (#_cast returning u32)((#_readRef returning Field)(decode_index)); - let decoded = if (#_uEq returning bool)(uConst!(UseURLTable: u1), (1: u1)) then { + let decoded = if (#_uEq returning bool)(uConst!(UseURLTable: u8), (1: u8)) then { (#_arrayIndex returning Field)((«noir_base64-0.0.0»::tables::BASE64_DECODE_BE_URL_VAR_TABLE<> as λ() -> Array)(), (#_cast returning u32)(decode_index)) } else { (#_arrayIndex returning Field)((«noir_base64-0.0.0»::tables::BASE64_DECODE_BE_VAR_TABLE<> as λ() -> Array)(), (#_cast returning u32)(decode_index)) @@ -267,21 +268,20 @@ noir_def «noir_base64-0.0.0»::decoder::decode_var as λ(Field) -> Unit)((#_readRef returning Field)(validity_check)); + («std-1.0.0-beta.25»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)((#_readRef returning Field)(validity_check)); for _ in base64_elements_in_final_chunk .. («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)() do { slice = (#_fMul returning Field)((#_readRef returning Field)(slice), (64: Field)); #_skip }; - let slice_bytes = («std-1.0.0-beta.14»::field::to_be_bytes<30: u32> as λ(Field) -> Array)((#_readRef returning Field)(slice)); + let slice_bytes = («std-1.0.0-beta.25»::field::to_be_bytes<30: u32> as λ(Field) -> Array)((#_readRef returning Field)(slice)); let num_bytes_in_final_chunk = (#_uSub returning u32)(uConst!(OutputBytes: u32), byte_offset); for i in (0: u32) .. num_bytes_in_final_chunk do { - let i_4904 = (#_uAdd returning u32)(byte_offset, i); - (result[i_4904]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(i)); + (result[(#_uAdd returning u32)(byte_offset, i)]: u8) = (#_arrayIndex returning u8)(slice_bytes, (#_cast returning u32)(i)); #_skip }; #_skip }; - if (#_uEq returning bool)(uConst!(Pad: u1), (1: u1)) then { + if (#_uEq returning bool)(uConst!(Pad: u8), (1: u8)) then { (#_assert returning Unit)((#_uEq returning bool)((#_uRem returning u32)(input_length, (4: u32)), (0: u32))); #_skip }; @@ -290,14 +290,14 @@ noir_def «noir_base64-0.0.0»::decoder::decode_var as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_readRef returning Array)(result), output_length) + («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts_unchecked as λ(Array, u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_readRef returning Array)(result), output_length) } noir_def «noir_base64-0.0.0»::decoder::test_decode_empty<>() -> Unit := { let input = (#_mkArray returning Array)(); let expected = (#_mkArray returning Array)(); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<0: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -305,15 +305,15 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_padding<>() -> Unit := { let input = (#_mkArray returning Array)((90: u8), (103: u8), (61: u8), (61: u8)); let expected = (#_mkArray returning Array)((102: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<4: u32, 1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((90: u8), (109: u8), (56: u8), (61: u8)); let expected = (#_mkArray returning Array)((102: u8), (111: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<4: u32, 2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8)); let expected = (#_mkArray returning Array)((102: u8), (111: u8), (111: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<4: u32, 3: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -321,15 +321,15 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_standard_no_pad<>() -> Unit let input = (#_mkArray returning Array)((90: u8), (103: u8)); let expected = (#_mkArray returning Array)((102: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<2: u32, 1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((90: u8), (109: u8), (56: u8)); let expected = (#_mkArray returning Array)((102: u8), (111: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<3: u32, 2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8)); let expected = (#_mkArray returning Array)((102: u8), (111: u8), (111: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<4: u32, 3: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -337,16 +337,16 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_max_byte<>() -> Unit := { let expected = (#_mkArray returning Array)((255: u8)); let input = (#_mkArray returning Array)((47: u8), (119: u8), (61: u8), (61: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<4: u32, 1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((47: u8), (119: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<2: u32, 1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((95: u8), (119: u8), (61: u8), (61: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode<4: u32, 1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((95: u8), (119: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode<2: u32, 1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -360,7 +360,7 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_standard_no_pad_fail_with_p let input = (#_mkArray returning Array)((47: u8), (43: u8), (65: u8), (61: u8)); let expected = (#_mkArray returning Array)((255: u8), (224: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<4: u32, 2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -368,7 +368,7 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_standard<>() -> Unit := { let input = (#_mkArray returning Array)((47: u8), (43: u8), (65: u8), (61: u8)); let expected = (#_mkArray returning Array)((255: u8), (224: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<4: u32, 2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -382,7 +382,7 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_url_safe_with_pad<>() -> Un let input = (#_mkArray returning Array)((95: u8), (45: u8), (65: u8), (61: u8)); let expected = (#_mkArray returning Array)((255: u8), (224: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode<4: u32, 2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -396,7 +396,7 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_url_safe<>() -> Unit := { let input = (#_mkArray returning Array)((95: u8), (45: u8), (65: u8)); let expected = (#_mkArray returning Array)((255: u8), (224: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode<3: u32, 2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -404,7 +404,7 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_url_safe_no_pad_fail_with_p let input = (#_mkArray returning Array)((95: u8), (45: u8), (65: u8), (61: u8)); let expected = (#_mkArray returning Array)((255: u8), (224: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode<4: u32, 2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -412,13 +412,13 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_ascii<>() -> Unit := { let input = (#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (103: u8), (86: u8), (50: u8), (57: u8), (121: u8), (98: u8), (71: u8), (81: u8), (104: u8)); let expected = (#_mkArray returning Array)((72: u8), (101: u8), (108: u8), (108: u8), (111: u8), (32: u8), (87: u8), (111: u8), (114: u8), (108: u8), (100: u8), (33: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<16: u32, 12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<16: u32, 12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode<16: u32, 12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode<16: u32, 12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -426,13 +426,13 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_utf8<>() -> Unit := { let input = (#_mkArray returning Array)((52: u8), (52: u8), (71: u8), (84: u8), (52: u8), (52: u8), (75: u8), (84: u8), (52: u8), (52: u8), (71: u8), (114: u8), (52: u8), (52: u8), (71: u8), (104: u8), (52: u8), (52: u8), (71: u8), (118: u8), (52: u8), (52: u8), (67: u8), (66: u8), (53: u8), (76: u8), (105: u8), (87: u8), (53: u8), (53: u8), (87: u8), (77: u8), (55: u8), (55: u8), (121: u8), (66: u8)); let expected = (#_mkArray returning Array)((227: u8), (129: u8), (147: u8), (227: u8), (130: u8), (147: u8), (227: u8), (129: u8), (171: u8), (227: u8), (129: u8), (161: u8), (227: u8), (129: u8), (175: u8), (227: u8), (128: u8), (129: u8), (228: u8), (184: u8), (150: u8), (231: u8), (149: u8), (140: u8), (239: u8), (188: u8), (129: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<36: u32, 27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<36: u32, 27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode<36: u32, 27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode<36: u32, 27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -440,10 +440,10 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_multi_chunks<>() -> Unit := let expected = (#_mkArray returning Array)((84: u8), (104: u8), (101: u8), (32: u8), (113: u8), (117: u8), (105: u8), (99: u8), (107: u8), (32: u8), (98: u8), (114: u8), (111: u8), (119: u8), (110: u8), (32: u8), (102: u8), (111: u8), (120: u8), (32: u8), (106: u8), (117: u8), (109: u8), (112: u8), (115: u8), (32: u8), (111: u8), (118: u8), (101: u8), (114: u8), (32: u8), (116: u8), (104: u8), (101: u8), (32: u8), (108: u8), (97: u8), (122: u8), (121: u8), (32: u8), (100: u8), (111: u8), (103: u8), (46: u8)); let input = (#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8), (61: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<60: u32, 44: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<59: u32, 44: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -451,89 +451,89 @@ noir_def «noir_base64-0.0.0»::decoder::test_decode_with_padding<>() -> Unit := let input = (#_mkArray returning Array)((71: u8), (120: u8), (77: u8), (108: u8), (103: u8), (119: u8), (76: u8), (105: u8), (121: u8), (112: u8), (110: u8), (86: u8), (114: u8), (69: u8), (50: u8), (67: u8), (48: u8), (83: u8), (102: u8), (52: u8), (121: u8), (122: u8), (104: u8), (99: u8), (87: u8), (84: u8), (107: u8), (65: u8), (104: u8), (83: u8), (90: u8), (53: u8), (43: u8), (87: u8), (69: u8), (82: u8), (104: u8), (75: u8), (104: u8), (88: u8), (116: u8), (108: u8), (85: u8), (61: u8)); let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<44: u32, 32: u32> as λ(Array) -> Array)(input); let expected = (#_mkArray returning Array)((27: u8), (19: u8), (37: u8), (131: u8), (2: u8), (226: u8), (202: u8), (153: u8), (213: u8), (172: u8), (77: u8), (130: u8), (209: u8), (39: u8), (248: u8), (203: u8), (56: u8), (92: u8), (89: u8), (57: u8), (0: u8), (133: u8), (38: u8), (121: u8), (249: u8), (97: u8), (17: u8), (132: u8), (168: u8), (87: u8), (182: u8), (85: u8)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::decoder::test_decode_var_empty<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<0: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<0: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::decoder::test_decode_var_padding<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8), (61: u8), (61: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - («std-1.0.0-beta.14»::println > > > as λ(FmtString<15: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<15: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >)("result {}{result}", result)); - («std-1.0.0-beta.14»::println > > > as λ(FmtString<19: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<19: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >)("expected {}{expected}", expected)); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8), (61: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<8: u32, 6: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8), (61: u8), (61: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + («std-1.0.0-beta.25»::println > > > as λ(FmtString<15: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<15: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >)("result {}{result}", result)); + («std-1.0.0-beta.25»::println > > > as λ(FmtString<19: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<19: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >)("expected {}{expected}", expected)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8), (61: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<8: u32, 6: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::decoder::test_decode_var_standard_no_pad<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - («std-1.0.0-beta.14»::println, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > > > as λ(FmtString<36: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<36: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >)("result {}{result}{}, expected {}{expected}", result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8))); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + («std-1.0.0-beta.25»::println, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > > > as λ(FmtString<36: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<36: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >)("result {}{result}{}, expected {}{expected}", result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8))); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::decoder::test_decode_var_no_pad_fail_with_padding<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((47: u8), (43: u8), (65: u8), (61: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((255: u8), (224: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((47: u8), (43: u8), (65: u8), (61: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((255: u8), (224: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<4: u32, 3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::decoder::test_decode_var<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8), (61: u8), (61: u8))); - let input_no_pad = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((72: u8), (101: u8), (108: u8), (108: u8), (111: u8), (44: u8), (32: u8), (87: u8), (111: u8), (114: u8), (108: u8), (100: u8), (33: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input_no_pad); - («std-1.0.0-beta.14»::println, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > > > as λ(FmtString<36: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<36: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >)("result {}{result}{}, expected {}{expected}", result, expected)); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input_no_pad); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8), (61: u8), (61: u8))); + let input_no_pad = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((72: u8), (101: u8), (108: u8), (108: u8), (111: u8), (44: u8), (32: u8), (87: u8), (111: u8), (114: u8), (108: u8), (100: u8), (33: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_no_pad); + («std-1.0.0-beta.25»::println, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > > > as λ(FmtString<36: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<36: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >)("result {}{result}{}, expected {}{expected}", result, expected)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode_var<24: u32, 16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_no_pad); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::decoder::test_decode_var_multi_chunks<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8), (61: u8))); - let input_no_pad = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((84: u8), (104: u8), (101: u8), (32: u8), (113: u8), (117: u8), (105: u8), (99: u8), (107: u8), (32: u8), (98: u8), (114: u8), (111: u8), (119: u8), (110: u8), (32: u8), (102: u8), (111: u8), (120: u8), (32: u8), (106: u8), (117: u8), (109: u8), (112: u8), (115: u8), (32: u8), (111: u8), (118: u8), (101: u8), (114: u8), (32: u8), (116: u8), (104: u8), (101: u8), (32: u8), (108: u8), (97: u8), (122: u8), (121: u8), (32: u8), (100: u8), (111: u8), (103: u8), (46: u8))); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input_no_pad); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input_no_pad); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8), (61: u8))); + let input_no_pad = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((84: u8), (104: u8), (101: u8), (32: u8), (113: u8), (117: u8), (105: u8), (99: u8), (107: u8), (32: u8), (98: u8), (114: u8), (111: u8), (119: u8), (110: u8), (32: u8), (102: u8), (111: u8), (120: u8), (32: u8), (106: u8), (117: u8), (109: u8), (112: u8), (115: u8), (32: u8), (111: u8), (118: u8), (101: u8), (114: u8), (32: u8), (116: u8), (104: u8), (101: u8), (32: u8), (108: u8), (97: u8), (122: u8), (121: u8), (32: u8), (100: u8), (111: u8), (103: u8), (46: u8))); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_no_pad); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode_var<64: u32, 48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_no_pad); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder.lean index bc642300..68a01abf 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder.lean +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder.lean @@ -13,43 +13,44 @@ noir_global_def «noir_base64-0.0.0»::encoder::PAD_1: Array = (# noir_global_def «noir_base64-0.0.0»::encoder::PAD_2: Array = (#_mkArray returning Array)((0: Field), (1: Field), (0: Field)); -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBE::encode(input: Array) -> Array := { - («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBE::encode(input: Array) -> Array := { + («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode(input: Array) -> Array := { - («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode(input: Array) -> Array := { + («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode(input: Array) -> Array := { - («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode(input: Array) -> Array := { + («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode(input: Array) -> Array := { - («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode(input: Array) -> Array := { + («noir_base64-0.0.0»::encoder::encode as λ(Array) -> Array)(input) } -noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { - («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input) +noir_def «noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + («noir_base64-0.0.0»::encoder::encode_var as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input) } -noir_def «noir_base64-0.0.0»::encoder::encode_elements(input: Array) -> Array := { +noir_def «noir_base64-0.0.0»::encoder::encode_elements(input: Array) -> Array := { + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(UseUrlTable: u8), (2: u8)), "UseUrlTable must be 0 or 1"); let result = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); for i in (0: u32) .. uConst!(InputElements: u32) do { let index = (#_cast returning u32)((#_arrayIndex returning u8)(input, (#_cast returning u32)(i))); - let token = if (#_uEq returning bool)(uConst!(UseUrlTable: u1), (1: u1)) then { + let token = if (#_uEq returning bool)(uConst!(UseUrlTable: u8), (1: u8)) then { (#_arrayIndex returning u8)((«noir_base64-0.0.0»::tables::BASE64URL_ENCODE_BE_TABLE<> as λ() -> Array)(), (#_cast returning u32)(index)) } else { (#_arrayIndex returning u8)((«noir_base64-0.0.0»::tables::BASE64_ENCODE_BE_TABLE<> as λ() -> Array)(), (#_cast returning u32)(index)) @@ -60,12 +61,13 @@ noir_def «noir_base64-0.0.0»::encoder::encode_elements)(result) } -noir_def «noir_base64-0.0.0»::encoder::encode_var(input: «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec := { +noir_def «noir_base64-0.0.0»::encoder::encode_var(input: «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec := { + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(UseURLTable: u8), (2: u8)), "UseURLTable must be 0 or 1"); (#_assert returning Unit)((#_bOr returning bool)((#_uEq returning bool)(uConst!(HasPadding: u32), (0: u32)), (#_uEq returning bool)(uConst!(HasPadding: u32), (1: u32)))); let result_arr = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); let output_length = (#_uAdd returning u32)((#_uAdd returning u32)((#_uDiv returning u32)((#_uMul returning u32)(uConst!(MAX_INPUT_LEN: u32), (8: u32)), (6: u32)), (#_uMul returning u32)((#_uRem returning u32)((#_uRem returning u32)(uConst!(MAX_INPUT_LEN: u32), (3: u32)), (2: u32)), (#_uAdd returning u32)((1: u32), (#_uMul returning u32)(uConst!(HasPadding: u32), (2: u32))))), (#_uMul returning u32)((#_uDiv returning u32)((#_uRem returning u32)(uConst!(MAX_INPUT_LEN: u32), (3: u32)), (2: u32)), (#_uAdd returning u32)((1: u32), uConst!(HasPadding: u32)))); - let raw = («noir_base64-0.0.0»::encoder::split_into_six_bit_chunks as λ(Array) -> Array)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> Array)(input)); - let real_length = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::len as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> u32)(input); + let raw = («noir_base64-0.0.0»::encoder::split_into_six_bit_chunks as λ(Array) -> Array)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::storage as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> Array)(input)); + let real_length = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input)); let real_length_mod_3 = if (#_uEq returning bool)(uConst!(HasPadding: u32), (1: u32)) then { (#_uRem returning u32)(real_length, (3: u32)) } else { @@ -90,7 +92,7 @@ noir_def «noir_base64-0.0.0»::encoder::encode_var as λ(Field) -> Unit)(index); + («std-1.0.0-beta.25»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)(index); let index = (#_cast returning u32)(index); (result_arr[(0: u32)]: u8) = (#_arrayIndex returning u8)((«noir_base64-0.0.0»::tables::BASE64_ENCODE_BE_VAR_TABLE<> as λ() -> Array)(), (#_cast returning u32)(index)); #_skip @@ -110,19 +112,19 @@ noir_def «noir_base64-0.0.0»::encoder::encode_var as λ(Field) -> Unit)((#_readRef returning Field)(encoding_index)); + («std-1.0.0-beta.25»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)((#_readRef returning Field)(encoding_index)); let encoding_index = (#_cast returning u32)((#_readRef returning Field)(encoding_index)); - let token = if (#_uEq returning bool)(uConst!(UseURLTable: u1), (1: u1)) then { + let token = if (#_uEq returning bool)(uConst!(UseURLTable: u8), (1: u8)) then { (#_arrayIndex returning u8)((«noir_base64-0.0.0»::tables::BASE64_ENCODE_BE_VAR_TABLE<> as λ() -> Array)(), (#_cast returning u32)(encoding_index)) } else { (#_arrayIndex returning u8)((«noir_base64-0.0.0»::tables::BASE64URL_ENCODE_BE_VAR_TABLE<> as λ() -> Array)(), (#_cast returning u32)(encoding_index)) }; - («std-1.0.0-beta.14»::field::assert_max_bit_size<7: u32> as λ(Field) -> Unit)((#_cast returning Field)(token)); + («std-1.0.0-beta.25»::field::assert_max_bit_size<7: u32> as λ(Field) -> Unit)((#_cast returning Field)(token)); (result_arr[i]: u8) = token; #_skip }; - let r = (#_ref returning & «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_parts_unchecked as λ(Array, u32) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_readRef returning Array)(result_arr), final_length)); - (#_readRef returning «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(r) + let r = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_parts_unchecked as λ(Array, u32) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_readRef returning Array)(result_arr), final_length); + r } noir_def «noir_base64-0.0.0»::encoder::split_into_six_bit_chunks(input: Array) -> Array := { @@ -151,8 +153,7 @@ noir_def «noir_base64-0.0.0»::encoder::split_into_six_bit_chunks as λ(Field) -> Array)((#_readRef returning Field)(slice)); for j in (0: u32) .. («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)() do { - let i_4666 = (#_uAdd returning u32)((#_uMul returning u32)(i, («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)()), j); - (result[i_4666]: u8) = (#_arrayIndex returning u8)(slice_base64_chunks, (#_cast returning u32)(j)); + (result[(#_uAdd returning u32)((#_uMul returning u32)(i, («noir_base64-0.0.0»::defaults::BASE64_ELEMENTS_PER_CHUNK<> as λ() -> u32)()), j)]: u8) = (#_arrayIndex returning u8)(slice_base64_chunks, (#_cast returning u32)(j)); #_skip }; #_skip @@ -176,13 +177,11 @@ noir_def «noir_base64-0.0.0»::encoder::split_into_six_bit_chunks)(result) } -noir_def «noir_base64-0.0.0»::encoder::encode(input: Array) -> Array := { +noir_def «noir_base64-0.0.0»::encoder::encode(input: Array) -> Array := { + (#_staticAssert returning Unit)((#_uLt returning bool)(uConst!(UseUrlTable: u8), (2: u8)), "UseUrlTable must be 0 or 1"); (#_assert returning Unit)((#_bOr returning bool)((#_uEq returning bool)(uConst!(UsePadding: u32), (#_cast returning u32)((0: Field))), (#_uEq returning bool)(uConst!(UsePadding: u32), (#_cast returning u32)((1: Field))))); - let result = (#_ref returning & Array)((«noir_base64-0.0.0»::encoder::encode_elements<((((InputBytes * 8) / 6) + ((UsePadding + 1) * ((InputBytes % 3) / 2))) + (((InputBytes % 3) % 2) * ((UsePadding * 2) + 1))): u32, UseUrlTable: u1> as λ(Array) -> Array)((«noir_base64-0.0.0»::encoder::split_into_six_bit_chunks as λ(Array) -> Array)(input))); + let result = (#_ref returning & Array)((«noir_base64-0.0.0»::encoder::encode_elements<((((InputBytes * 8) / 6) + ((UsePadding + 1) * ((InputBytes % 3) / 2))) + (((InputBytes % 3) % 2) * ((UsePadding * 2) + 1))): u32, UseUrlTable: u8> as λ(Array) -> Array)((«noir_base64-0.0.0»::encoder::split_into_six_bit_chunks as λ(Array) -> Array)(input))); let OutputElements = (#_uAdd returning u32)((#_uAdd returning u32)((#_uDiv returning u32)((#_uMul returning u32)(uConst!(InputBytes: u32), (8: u32)), (6: u32)), (#_uMul returning u32)((#_uRem returning u32)((#_uRem returning u32)(uConst!(InputBytes: u32), (3: u32)), (2: u32)), (#_uAdd returning u32)((1: u32), (#_uMul returning u32)(uConst!(UsePadding: u32), (2: u32))))), (#_uMul returning u32)((#_uDiv returning u32)((#_uRem returning u32)(uConst!(InputBytes: u32), (3: u32)), (2: u32)), (#_uAdd returning u32)((1: u32), uConst!(UsePadding: u32)))); if (#_uEq returning bool)(uConst!(UsePadding: u32), (1: u32)) then { let rem = (#_uRem returning u32)(uConst!(InputBytes: u32), (3: u32)); if (#_uEq returning bool)(rem, (1: u32)) then { - { - let i_4685 = (#_uSub returning u32)(OutputElements, (1: u32)); - (result[i_4685]: u8) = («noir_base64-0.0.0»::defaults::BASE64_PADDING_CHAR<> as λ() -> u8)(); - #_skip - }; - { - let i_4686 = (#_uSub returning u32)(OutputElements, (2: u32)); - (result[i_4686]: u8) = («noir_base64-0.0.0»::defaults::BASE64_PADDING_CHAR<> as λ() -> u8)(); - #_skip - } + (result[(#_uSub returning u32)(OutputElements, (1: u32))]: u8) = («noir_base64-0.0.0»::defaults::BASE64_PADDING_CHAR<> as λ() -> u8)(); + (result[(#_uSub returning u32)(OutputElements, (2: u32))]: u8) = («noir_base64-0.0.0»::defaults::BASE64_PADDING_CHAR<> as λ() -> u8)(); + #_skip } else if (#_uEq returning bool)(rem, (2: u32)) then { - let i_4687 = (#_uSub returning u32)(OutputElements, (1: u32)); - (result[i_4687]: u8) = («noir_base64-0.0.0»::defaults::BASE64_PADDING_CHAR<> as λ() -> u8)(); + (result[(#_uSub returning u32)(OutputElements, (1: u32))]: u8) = («noir_base64-0.0.0»::defaults::BASE64_PADDING_CHAR<> as λ() -> u8)(); #_skip } }; @@ -220,8 +212,8 @@ noir_def «noir_base64-0.0.0»::encoder::encode() -> Unit := { let ascii_expected = (#_mkArray returning Array)((71: u8), (120: u8), (77: u8), (108: u8), (103: u8), (119: u8), (76: u8), (105: u8), (121: u8), (112: u8), (110: u8), (86: u8), (114: u8), (69: u8), (50: u8), (67: u8), (48: u8), (83: u8), (102: u8), (52: u8), (121: u8), (122: u8), (104: u8), (99: u8), (87: u8), (84: u8), (107: u8), (65: u8), (104: u8), (83: u8), (90: u8), (53: u8), (43: u8), (87: u8), (69: u8), (82: u8), (104: u8), (75: u8), (104: u8), (88: u8), (116: u8), (108: u8), (85: u8)); let input = (#_mkArray returning Array)((6: u8), (49: u8), (12: u8), (37: u8), (32: u8), (48: u8), (11: u8), (34: u8), (50: u8), (41: u8), (39: u8), (21: u8), (43: u8), (4: u8), (54: u8), (2: u8), (52: u8), (18: u8), (31: u8), (56: u8), (50: u8), (51: u8), (33: u8), (28: u8), (22: u8), (19: u8), (36: u8), (0: u8), (33: u8), (18: u8), (25: u8), (57: u8), (62: u8), (22: u8), (4: u8), (17: u8), (33: u8), (10: u8), (33: u8), (23: u8), (45: u8), (37: u8), (20: u8)); - let ascii_result = («noir_base64-0.0.0»::encoder::encode_elements<43: u32, 0: u1> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(ascii_result, ascii_expected)); + let ascii_result = («noir_base64-0.0.0»::encoder::encode_elements<43: u32, 0: u8> as λ(Array) -> Array)(input); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(ascii_result, ascii_expected)); #_skip } @@ -229,7 +221,7 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_empty<>() -> Unit := { let input = (#_mkArray returning Array)(); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<0: u32> as λ(Array) -> Array)(input); let expected = (#_mkArray returning Array)(); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -237,15 +229,15 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_padding<>() -> Unit := { let input = (#_mkArray returning Array)((102: u8)); let expected = (#_mkArray returning Array)((90: u8), (103: u8), (61: u8), (61: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((102: u8), (111: u8)); let expected = (#_mkArray returning Array)((90: u8), (109: u8), (56: u8), (61: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((102: u8), (111: u8), (111: u8)); let expected = (#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<3: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -253,15 +245,15 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_standard_no_pad<>() -> Unit let input = (#_mkArray returning Array)((102: u8)); let expected = (#_mkArray returning Array)((90: u8), (103: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<1: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((102: u8), (111: u8)); let expected = (#_mkArray returning Array)((90: u8), (109: u8), (56: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let input = (#_mkArray returning Array)((102: u8), (111: u8), (111: u8)); let expected = (#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<3: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -269,16 +261,16 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_max_byte<>() -> Unit := { let input = (#_mkArray returning Array)((255: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<1: u32> as λ(Array) -> Array)(input); let expected = (#_mkArray returning Array)((47: u8), (119: u8), (61: u8), (61: u8)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<1: u32> as λ(Array) -> Array)(input); let expected = (#_mkArray returning Array)((47: u8), (119: u8)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode<1: u32> as λ(Array) -> Array)(input); let expected = (#_mkArray returning Array)((95: u8), (119: u8), (61: u8), (61: u8)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode<1: u32> as λ(Array) -> Array)(input); let expected = (#_mkArray returning Array)((95: u8), (119: u8)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -286,13 +278,13 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_ascii<>() -> Unit := { let input = (#_mkArray returning Array)((72: u8), (101: u8), (108: u8), (108: u8), (111: u8), (32: u8), (87: u8), (111: u8), (114: u8), (108: u8), (100: u8), (33: u8)); let expected = (#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (103: u8), (86: u8), (50: u8), (57: u8), (121: u8), (98: u8), (71: u8), (81: u8), (104: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode<12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode<12: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -300,13 +292,13 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_utf8<>() -> Unit := { let input = (#_mkArray returning Array)((227: u8), (129: u8), (147: u8), (227: u8), (130: u8), (147: u8), (227: u8), (129: u8), (171: u8), (227: u8), (129: u8), (161: u8), (227: u8), (129: u8), (175: u8), (227: u8), (128: u8), (129: u8), (228: u8), (184: u8), (150: u8), (231: u8), (149: u8), (140: u8), (239: u8), (188: u8), (129: u8)); let expected = (#_mkArray returning Array)((52: u8), (52: u8), (71: u8), (84: u8), (52: u8), (52: u8), (75: u8), (84: u8), (52: u8), (52: u8), (71: u8), (114: u8), (52: u8), (52: u8), (71: u8), (104: u8), (52: u8), (52: u8), (71: u8), (118: u8), (52: u8), (52: u8), (67: u8), (66: u8), (53: u8), (76: u8), (105: u8), (87: u8), (53: u8), (53: u8), (87: u8), (77: u8), (55: u8), (55: u8), (121: u8), (66: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode<27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode<27: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -314,10 +306,10 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_multi_chunks<>() -> Unit := let input = (#_mkArray returning Array)((84: u8), (104: u8), (101: u8), (32: u8), (113: u8), (117: u8), (105: u8), (99: u8), (107: u8), (32: u8), (98: u8), (114: u8), (111: u8), (119: u8), (110: u8), (32: u8), (102: u8), (111: u8), (120: u8), (32: u8), (106: u8), (117: u8), (109: u8), (112: u8), (115: u8), (32: u8), (111: u8), (118: u8), (101: u8), (114: u8), (32: u8), (116: u8), (104: u8), (101: u8), (32: u8), (108: u8), (97: u8), (122: u8), (121: u8), (32: u8), (100: u8), (111: u8), (103: u8), (46: u8)); let expected = (#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8), (61: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<44: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); let expected = (#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<44: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -325,7 +317,7 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_standard<>() -> Unit := { let input = (#_mkArray returning Array)((255: u8), (224: u8)); let expected = (#_mkArray returning Array)((47: u8), (43: u8), (65: u8), (61: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -333,7 +325,7 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_url_safe_with_pad<>() -> Un let input = (#_mkArray returning Array)((255: u8), (224: u8)); let expected = (#_mkArray returning Array)((95: u8), (45: u8), (65: u8), (61: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode<2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -341,7 +333,7 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode_url_safe<>() -> Unit := { let input = (#_mkArray returning Array)((255: u8), (224: u8)); let expected = (#_mkArray returning Array)((95: u8), (45: u8), (65: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode<2: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } @@ -349,92 +341,114 @@ noir_def «noir_base64-0.0.0»::encoder::test_encode<>() -> Unit := { let expected = (#_mkArray returning Array)((71: u8), (120: u8), (77: u8), (108: u8), (103: u8), (119: u8), (76: u8), (105: u8), (121: u8), (112: u8), (110: u8), (86: u8), (114: u8), (69: u8), (50: u8), (67: u8), (48: u8), (83: u8), (102: u8), (52: u8), (121: u8), (122: u8), (104: u8), (99: u8), (87: u8), (84: u8), (107: u8), (65: u8), (104: u8), (83: u8), (90: u8), (53: u8), (43: u8), (87: u8), (69: u8), (82: u8), (104: u8), (75: u8), (104: u8), (88: u8), (116: u8), (108: u8), (85: u8)); let input = (#_mkArray returning Array)((27: u8), (19: u8), (37: u8), (131: u8), (2: u8), (226: u8), (202: u8), (153: u8), (213: u8), (172: u8), (77: u8), (130: u8), (209: u8), (39: u8), (248: u8), (203: u8), (56: u8), (92: u8), (89: u8), (57: u8), (0: u8), (133: u8), (38: u8), (121: u8), (249: u8), (97: u8), (17: u8), (132: u8), (168: u8), (87: u8), (182: u8), (85: u8)); let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<32: u32> as λ(Array) -> Array)(input); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::encoder::test_base64_encode_slash<>() -> Unit := { let input = (#_mkArray returning Array)((63: u8)); - let result = («noir_base64-0.0.0»::encoder::encode_elements<1: u32, 0: u1> as λ(Array) -> Array)(input); + let result = («noir_base64-0.0.0»::encoder::encode_elements<1: u32, 0: u8> as λ(Array) -> Array)(input); (#_assert returning Unit)((#_uEq returning bool)((#_arrayIndex returning u8)(result, (0: u32)), (47: u8))); #_skip } noir_def «noir_base64-0.0.0»::encoder::test_encode_var_empty<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<0: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<0: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::new as λ() -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::encoder::test_encode_var_padding<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8), (61: u8), (61: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8), (61: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8), (61: u8), (61: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8), (61: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::encoder::test_encode_var_standard_no_pad<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<3: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (103: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (56: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((102: u8), (111: u8), (111: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((90: u8), (109: u8), (57: u8), (118: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<3: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); #_skip } noir_def «noir_base64-0.0.0»::encoder::test_encode_var<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((72: u8), (101: u8), (108: u8), (108: u8), (111: u8), (44: u8), (32: u8), (87: u8), (111: u8), (114: u8), (108: u8), (100: u8), (33: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8), (61: u8), (61: u8))); - let expected_no_pad = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - («std-1.0.0-beta.14»::println > > > as λ(FmtString<17: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<17: u32, Tuple<«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec > >)("result = {}{result}", result)); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode_var<16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<16: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((72: u8), (101: u8), (108: u8), (108: u8), (111: u8), (44: u8), (32: u8), (87: u8), (111: u8), (114: u8), (108: u8), (100: u8), (33: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8), (61: u8), (61: u8))); + let expected_no_pad = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((83: u8), (71: u8), (86: u8), (115: u8), (98: u8), (71: u8), (56: u8), (115: u8), (73: u8), (70: u8), (100: u8), (118: u8), (99: u8), (109: u8), (120: u8), (107: u8), (73: u8), (81: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + («std-1.0.0-beta.25»::println > > > as λ(FmtString<17: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >) -> Unit)((#_mkFormatString returning FmtString<17: u32, Tuple<«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec > >)("result = {}{result}", result)); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode_var<16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<16: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); #_skip } noir_def «noir_base64-0.0.0»::encoder::test_encode_var_multi_chunks<>() -> Unit := { - let input = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((84: u8), (104: u8), (101: u8), (32: u8), (113: u8), (117: u8), (105: u8), (99: u8), (107: u8), (32: u8), (98: u8), (114: u8), (111: u8), (119: u8), (110: u8), (32: u8), (102: u8), (111: u8), (120: u8), (32: u8), (106: u8), (117: u8), (109: u8), (112: u8), (115: u8), (32: u8), (111: u8), (118: u8), (101: u8), (114: u8), (32: u8), (116: u8), (104: u8), (101: u8), (32: u8), (108: u8), (97: u8), (122: u8), (121: u8), (32: u8), (100: u8), (111: u8), (103: u8), (46: u8))); - let expected = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8), (61: u8))); - let expected_no_pad = («std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8))); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode_var<48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); - let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<48: u32> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec)(input); - (#_assert returning Unit)(((«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.14»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); + let input = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((84: u8), (104: u8), (101: u8), (32: u8), (113: u8), (117: u8), (105: u8), (99: u8), (107: u8), (32: u8), (98: u8), (114: u8), (111: u8), (119: u8), (110: u8), (32: u8), (102: u8), (111: u8), (120: u8), (32: u8), (106: u8), (117: u8), (109: u8), (112: u8), (115: u8), (32: u8), (111: u8), (118: u8), (101: u8), (114: u8), (32: u8), (116: u8), (104: u8), (101: u8), (32: u8), (108: u8), (97: u8), (122: u8), (121: u8), (32: u8), (100: u8), (111: u8), (103: u8), (46: u8))); + let expected = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8), (61: u8))); + let expected_no_pad = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)((#_mkArray returning Array)((86: u8), (71: u8), (104: u8), (108: u8), (73: u8), (72: u8), (70: u8), (49: u8), (97: u8), (87: u8), (78: u8), (114: u8), (73: u8), (71: u8), (74: u8), (121: u8), (98: u8), (51: u8), (100: u8), (117: u8), (73: u8), (71: u8), (90: u8), (118: u8), (101: u8), (67: u8), (66: u8), (113: u8), (100: u8), (87: u8), (49: u8), (119: u8), (99: u8), (121: u8), (66: u8), (118: u8), (100: u8), (109: u8), (86: u8), (121: u8), (73: u8), (72: u8), (82: u8), (111: u8), (90: u8), (83: u8), (66: u8), (115: u8), (89: u8), (88: u8), (112: u8), (53: u8), (73: u8), (71: u8), (82: u8), (118: u8), (90: u8), (121: u8), (52: u8))); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode_var<48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode_var<48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode_var<48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected)); + let result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<48: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input); + (#_assert returning Unit)(((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> bool)(result, expected_no_pad)); + #_skip +} + +noir_def «noir_base64-0.0.0»::encoder::test_encode_var_matches_fixed_encode_for_partial_chunks<>() -> Unit := { + let input_arr = (#_mkArray returning Array)((125: u8)); + let input_vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_arr); + let fixed_result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode<1: u32> as λ(Array) -> Array)(input_arr); + let var_result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<1: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_vec); + (#_assert returning Unit)((#_uEq returning bool)((#_cast returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(var_result))), (#_arrayLen returning u32)(fixed_result))); + for i in (0: u32) .. (#_arrayLen returning u32)(fixed_result) do { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u8)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(var_result), i), (#_arrayIndex returning u8)(fixed_result, (#_cast returning u32)(i)))); + #_skip + }; + let input_arr = (#_mkArray returning Array)((97: u8), (98: u8)); + let input_vec = («std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::from_array as λ(Array) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_arr); + let fixed_result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode<2: u32> as λ(Array) -> Array)(input_arr); + let var_result = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode_var<2: u32> as λ(«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(input_vec); + (#_assert returning Unit)((#_uEq returning bool)((#_cast returning u32)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::len as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec) -> u32)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(var_result))), (#_arrayLen returning u32)(fixed_result))); + for i in (0: u32) .. (#_arrayLen returning u32)(fixed_result) do { + (#_assert returning Unit)((#_uEq returning bool)((«std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec::get as λ(& «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec, u32) -> u8)((#_ref returning & «std-1.0.0-beta.25»::collections::bounded_vec::BoundedVec)(var_result), i), (#_arrayIndex returning u8)(fixed_result, (#_cast returning u32)(i)))); + #_skip + }; #_skip } def «noir_base64-0.0.0».Encoder.env : Env := Env.mk - [«noir_base64-0.0.0::encoder::CONVERT_MODULO3_TO_PADDING_BYTES», «noir_base64-0.0.0::encoder::PAD_1», «noir_base64-0.0.0::encoder::PAD_2», «noir_base64-0.0.0::encoder::Base64EncodeBE::encode», «noir_base64-0.0.0::encoder::Base64EncodeBE::encode_var», «noir_base64-0.0.0::encoder::Base64EncodeBENoPad::encode», «noir_base64-0.0.0::encoder::Base64EncodeBENoPad::encode_var», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafe::encode», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafe::encode_var», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafeWithPad::encode», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafeWithPad::encode_var», «noir_base64-0.0.0::encoder::encode_elements», «noir_base64-0.0.0::encoder::encode_var», «noir_base64-0.0.0::encoder::split_into_six_bit_chunks», «noir_base64-0.0.0::encoder::encode», «noir_base64-0.0.0::encoder::test_encode_elements», «noir_base64-0.0.0::encoder::test_encode_empty», «noir_base64-0.0.0::encoder::test_encode_padding», «noir_base64-0.0.0::encoder::test_encode_standard_no_pad», «noir_base64-0.0.0::encoder::test_encode_max_byte», «noir_base64-0.0.0::encoder::test_encode_ascii», «noir_base64-0.0.0::encoder::test_encode_utf8», «noir_base64-0.0.0::encoder::test_encode_multi_chunks», «noir_base64-0.0.0::encoder::test_encode_standard», «noir_base64-0.0.0::encoder::test_encode_url_safe_with_pad», «noir_base64-0.0.0::encoder::test_encode_url_safe», «noir_base64-0.0.0::encoder::test_encode», «noir_base64-0.0.0::encoder::test_base64_encode_slash», «noir_base64-0.0.0::encoder::test_encode_var_empty», «noir_base64-0.0.0::encoder::test_encode_var_padding», «noir_base64-0.0.0::encoder::test_encode_var_standard_no_pad», «noir_base64-0.0.0::encoder::test_encode_var», «noir_base64-0.0.0::encoder::test_encode_var_multi_chunks»] + [«noir_base64-0.0.0::encoder::CONVERT_MODULO3_TO_PADDING_BYTES», «noir_base64-0.0.0::encoder::PAD_1», «noir_base64-0.0.0::encoder::PAD_2», «noir_base64-0.0.0::encoder::Base64EncodeBE::encode», «noir_base64-0.0.0::encoder::Base64EncodeBE::encode_var», «noir_base64-0.0.0::encoder::Base64EncodeBENoPad::encode», «noir_base64-0.0.0::encoder::Base64EncodeBENoPad::encode_var», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafe::encode», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafe::encode_var», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafeWithPad::encode», «noir_base64-0.0.0::encoder::Base64EncodeBEUrlSafeWithPad::encode_var», «noir_base64-0.0.0::encoder::encode_elements», «noir_base64-0.0.0::encoder::encode_var», «noir_base64-0.0.0::encoder::split_into_six_bit_chunks», «noir_base64-0.0.0::encoder::encode», «noir_base64-0.0.0::encoder::test_encode_elements», «noir_base64-0.0.0::encoder::test_encode_empty», «noir_base64-0.0.0::encoder::test_encode_padding», «noir_base64-0.0.0::encoder::test_encode_standard_no_pad», «noir_base64-0.0.0::encoder::test_encode_max_byte», «noir_base64-0.0.0::encoder::test_encode_ascii», «noir_base64-0.0.0::encoder::test_encode_utf8», «noir_base64-0.0.0::encoder::test_encode_multi_chunks», «noir_base64-0.0.0::encoder::test_encode_standard», «noir_base64-0.0.0::encoder::test_encode_url_safe_with_pad», «noir_base64-0.0.0::encoder::test_encode_url_safe», «noir_base64-0.0.0::encoder::test_encode», «noir_base64-0.0.0::encoder::test_base64_encode_slash», «noir_base64-0.0.0::encoder::test_encode_var_empty», «noir_base64-0.0.0::encoder::test_encode_var_padding», «noir_base64-0.0.0::encoder::test_encode_var_standard_no_pad», «noir_base64-0.0.0::encoder::test_encode_var», «noir_base64-0.0.0::encoder::test_encode_var_multi_chunks», «noir_base64-0.0.0::encoder::test_encode_var_matches_fixed_encode_for_partial_chunks»] [] diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder/ToBeRadix.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder/ToBeRadix.lean index 75d20afe..717d081a 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder/ToBeRadix.lean +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Encoder/ToBeRadix.lean @@ -8,7 +8,7 @@ open Lampe set_option linter.unusedVariables false noir_def «noir_base64-0.0.0»::encoder::to_be_radix::to_be_radix_64(x: Field) -> Array := { - let bytes = («std-1.0.0-beta.14»::field::to_le_bytes<((N * 3) / 4): u32> as λ(Field) -> Array)(x); + let bytes = («std-1.0.0-beta.25»::field::to_le_bytes<((N * 3) / 4): u32> as λ(Field) -> Array)(x); let result = { («noir_base64-0.0.0»::encoder::to_be_radix::to_be_radix_64_decomposition<((N * 3) / 4): u32, N: u32> as λ(Array) -> Array)(bytes) }; diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/GeneratedTypes.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/GeneratedTypes.lean index 50307c08..442722b9 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Lib.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Lib.lean index aac1ae11..beacb580 100644 --- a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Lib.lean +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/Lib.lean @@ -21,9 +21,9 @@ noir_def «noir_base64-0.0.0»::encode_and_decode<>() -> Unit := { let input = "The quick brown fox jumps over the lazy dog, while 42 ravens perch atop a rusty mailbox."; let base64_encoded = "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZywgd2hpbGUgNDIgcmF2ZW5zIHBlcmNoIGF0b3AgYSBydXN0eSBtYWlsYm94Lg=="; let encoded = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<88: u32> as λ(Array) -> Array)((#_strAsBytes returning Array)(input)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(encoded, (#_strAsBytes returning Array)(base64_encoded))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(encoded, (#_strAsBytes returning Array)(base64_encoded))); let decoded = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<120: u32, 88: u32> as λ(Array) -> Array)(encoded); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(decoded, (#_strAsBytes returning Array)(input))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(decoded, (#_strAsBytes returning Array)(input))); #_skip } @@ -31,9 +31,9 @@ noir_def «noir_base64-0.0.0»::encode_and_decode_no_pad<>() -> Unit := { let input = "The quick brown fox jumps over the lazy dog, while 42 ravens perch atop a rusty mailbox."; let base64_encoded = "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZywgd2hpbGUgNDIgcmF2ZW5zIHBlcmNoIGF0b3AgYSBydXN0eSBtYWlsYm94Lg"; let encoded = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<88: u32> as λ(Array) -> Array)((#_strAsBytes returning Array)(input)); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(encoded, (#_strAsBytes returning Array)(base64_encoded))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(encoded, (#_strAsBytes returning Array)(base64_encoded))); let decoded = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<118: u32, 88: u32> as λ(Array) -> Array)(encoded); - (#_assert returning Unit)(((Array as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(decoded, (#_strAsBytes returning Array)(input))); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(decoded, (#_strAsBytes returning Array)(input))); #_skip } diff --git a/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/OracleTest.lean b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/OracleTest.lean new file mode 100644 index 00000000..b32423cb --- /dev/null +++ b/testing/Base64/lampe/deps/noir_base64-0.0.0/lampe/noir_base64-0.0.0/Extracted/OracleTest.lean @@ -0,0 +1,88 @@ +-- Generated by lampe + +import «noir_base64-0.0.0».Extracted.GeneratedTypes +import Lampe + +open Lampe + +set_option linter.unusedVariables false + +noir_def «noir_base64-0.0.0»::oracle_test::node_base64_encode_standard<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::node_base64_encode_standard_no_pad<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::node_base64_encode_url_safe<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::node_base64_encode_url_safe_with_pad<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::get_node_standard_encode<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::get_node_no_pad_encode<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::get_node_url_safe_encode<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::get_node_url_safe_with_pad_encode<>(input: Array) -> Array := { + (#_fresh returning Array)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_oracle_standard<>(input: Array) -> bool := { + (#_fresh returning bool)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_oracle_no_pad<>(input: Array) -> bool := { + (#_fresh returning bool)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_oracle_url_safe<>(input: Array) -> bool := { + (#_fresh returning bool)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_oracle_url_safe_with_pad<>(input: Array) -> bool := { + (#_fresh returning bool)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_oracle_standard_encoding<>(input: Array) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_oracle_url_safe_encoding<>(input: Array) -> Unit := { + (#_fresh returning Unit)() +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_standard_decoding<>(input: Array) -> Unit := { + let noir_encoded = («noir_base64-0.0.0»::encoder::Base64EncodeBE::encode<20: u32> as λ(Array) -> Array)(input); + let noir_decoded = («noir_base64-0.0.0»::decoder::Base64DecodeBE::decode<28: u32, 20: u32> as λ(Array) -> Array)(noir_encoded); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(noir_decoded, input)); + let node_encoded = («noir_base64-0.0.0»::encoder::Base64EncodeBENoPad::encode<20: u32> as λ(Array) -> Array)(input); + let noir_decoded = («noir_base64-0.0.0»::decoder::Base64DecodeBENoPad::decode<27: u32, 20: u32> as λ(Array) -> Array)(node_encoded); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(noir_decoded, input)); + #_skip +} + +noir_def «noir_base64-0.0.0»::oracle_test::test_url_safe_decoding<>(input: Array) -> Unit := { + let node_encoded = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafe::encode<20: u32> as λ(Array) -> Array)(input); + let noir_decoded = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafe::decode<27: u32, 20: u32> as λ(Array) -> Array)(node_encoded); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(noir_decoded, input)); + let node_encoded = («noir_base64-0.0.0»::encoder::Base64EncodeBEUrlSafeWithPad::encode<20: u32> as λ(Array) -> Array)(input); + let noir_decoded = («noir_base64-0.0.0»::decoder::Base64DecodeBEUrlSafeWithPad::decode<28: u32, 20: u32> as λ(Array) -> Array)(node_encoded); + (#_assert returning Unit)(((Array as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(Array, Array) -> bool)(noir_decoded, input)); + #_skip +} + +def «noir_base64-0.0.0».OracleTest.env : Env := Env.mk + [«noir_base64-0.0.0::oracle_test::node_base64_encode_standard», «noir_base64-0.0.0::oracle_test::node_base64_encode_standard_no_pad», «noir_base64-0.0.0::oracle_test::node_base64_encode_url_safe», «noir_base64-0.0.0::oracle_test::node_base64_encode_url_safe_with_pad», «noir_base64-0.0.0::oracle_test::get_node_standard_encode», «noir_base64-0.0.0::oracle_test::get_node_no_pad_encode», «noir_base64-0.0.0::oracle_test::get_node_url_safe_encode», «noir_base64-0.0.0::oracle_test::get_node_url_safe_with_pad_encode», «noir_base64-0.0.0::oracle_test::test_oracle_standard», «noir_base64-0.0.0::oracle_test::test_oracle_no_pad», «noir_base64-0.0.0::oracle_test::test_oracle_url_safe», «noir_base64-0.0.0::oracle_test::test_oracle_url_safe_with_pad», «noir_base64-0.0.0::oracle_test::test_oracle_standard_encoding», «noir_base64-0.0.0::oracle_test::test_oracle_url_safe_encoding», «noir_base64-0.0.0::oracle_test::test_standard_decoding», «noir_base64-0.0.0::oracle_test::test_url_safe_decoding»] + [] diff --git a/testing/Base64/lampe/lake-manifest.json b/testing/Base64/lampe/lake-manifest.json index f2d09281..2b94f4cd 100644 --- a/testing/Base64/lampe/lake-manifest.json +++ b/testing/Base64/lampe/lake-manifest.json @@ -10,7 +10,7 @@ "configFile": "lakefile.toml"}, {"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../stdlib/lampe", diff --git a/testing/Base64/lampe/lakefile.toml b/testing/Base64/lampe/lakefile.toml index 30274b99..6ccce04b 100644 --- a/testing/Base64/lampe/lakefile.toml +++ b/testing/Base64/lampe/lakefile.toml @@ -12,7 +12,7 @@ name = "Lampe" path = "../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" path = "../../../stdlib/lampe" [[require]] diff --git a/testing/Complexnr/lampe/complexnr-0.0.0/Extracted.lean b/testing/Complexnr/lampe/complexnr-0.0.0/Extracted.lean index 421af3c5..df542085 100644 --- a/testing/Complexnr/lampe/complexnr-0.0.0/Extracted.lean +++ b/testing/Complexnr/lampe/complexnr-0.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «complexnr-0.0.0».Extracted.GeneratedTypes import «complexnr-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «complexnr-0.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Complexnr/lampe/complexnr-0.0.0/Extracted/GeneratedTypes.lean b/testing/Complexnr/lampe/complexnr-0.0.0/Extracted/GeneratedTypes.lean index 2f41f107..699a583d 100644 --- a/testing/Complexnr/lampe/complexnr-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Complexnr/lampe/complexnr-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/Complexnr/lampe/lake-manifest.json b/testing/Complexnr/lampe/lake-manifest.json index e69f908c..d83ed6e1 100644 --- a/testing/Complexnr/lampe/lake-manifest.json +++ b/testing/Complexnr/lampe/lake-manifest.json @@ -3,7 +3,7 @@ "packages": [{"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../stdlib/lampe", diff --git a/testing/Complexnr/lampe/lakefile.toml b/testing/Complexnr/lampe/lakefile.toml index 3c209976..221564a6 100644 --- a/testing/Complexnr/lampe/lakefile.toml +++ b/testing/Complexnr/lampe/lakefile.toml @@ -11,6 +11,6 @@ name = "Lampe" path = "../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" path = "../../../stdlib/lampe" diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted.lean index 5fa7f832..d8b1dcc5 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted.lean @@ -25,7 +25,7 @@ import «ExtractionTests-0.0.0».Extracted.TraitAssociatedConst import «ExtractionTests-0.0.0».Extracted.TypeOrder import «ExtractionTests-0.0.0».Extracted.UnconstrainedReturn import «ExtractionTests-0.0.0».Extracted.UnitReturn -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «ExtractionTests-0.0.0» @@ -53,4 +53,4 @@ def env := AliasMemberAccess.env ++ TypeOrder.env ++ UnconstrainedReturn.env ++ UnitReturn.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/AssociatedType.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/AssociatedType.lean index b95da3fe..3eb81ab8 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/AssociatedType.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/AssociatedType.lean @@ -7,7 +7,7 @@ open Lampe set_option linter.unusedVariables false -noir_trait_impl[«ExtractionTests-0.0.0».impl_432]<> «ExtractionTests-0.0.0»::associated_type::Foo<> for «ExtractionTests-0.0.0»::associated_type::Pair<> where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_448]<> «ExtractionTests-0.0.0»::associated_type::Foo<> for «ExtractionTests-0.0.0»::associated_type::Pair<> where [] := { noir_def foo_meth<>(self: «ExtractionTests-0.0.0»::associated_type::Pair<>) -> Field := { self.0 }; @@ -15,4 +15,4 @@ noir_trait_impl[«ExtractionTests-0.0.0».impl_432]<> «ExtractionTests-0.0.0»: def «ExtractionTests-0.0.0».AssociatedType.env : Env := Env.mk [] - [«ExtractionTests-0.0.0».impl_432] + [«ExtractionTests-0.0.0».impl_448] diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/Experiments.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/Experiments.lean index 87366212..8d6e72ba 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/Experiments.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/Experiments.lean @@ -45,7 +45,7 @@ noir_def «ExtractionTests-0.0.0»::experiments::literal_test<>() -> Unit := { let b = #_true; let _c = #_false; let _d = (#_mkRepeatedArray returning Array)((1: Field)); - let _e = (#_mkRepeatedVector returning Vector)((1: Field), (5: u32)); + let _e = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((1: Field))); let _f = (#_mkArray returning Array)((1: Field), (2: Field), (3: Field)); let _h = "asdf"; let _i = (#_mkFormatString returning FmtString<4: u32, Tuple >)("${}{b}", b); @@ -69,7 +69,7 @@ noir_def «ExtractionTests-0.0.0»::experiments::check<>(x: u8) -> Unit := { #_skip } -noir_trait_impl[«ExtractionTests-0.0.0».impl_433] «std-1.0.0-beta.14»::default::Default<> for «ExtractionTests-0.0.0»::experiments::Option2 where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_449] «std-1.0.0-beta.25»::default::Default<> for «ExtractionTests-0.0.0»::experiments::Option2 where [] := { noir_def default<>() -> «ExtractionTests-0.0.0»::experiments::Option2 := { («ExtractionTests-0.0.0»::experiments::Option2::none as λ() -> «ExtractionTests-0.0.0»::experiments::Option2)() }; @@ -91,13 +91,13 @@ noir_def «ExtractionTests-0.0.0»::experiments::Option2::is_some(self: self.0 } -noir_trait_impl[«ExtractionTests-0.0.0».impl_434] «ExtractionTests-0.0.0»::experiments::MyTrait<> for «ExtractionTests-0.0.0»::experiments::Option2 where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_450] «ExtractionTests-0.0.0»::experiments::MyTrait<> for «ExtractionTests-0.0.0»::experiments::Option2 where [] := { noir_def foo<>(self: «ExtractionTests-0.0.0»::experiments::Option2) -> «ExtractionTests-0.0.0»::experiments::Option2 := { self }; } -noir_trait_impl[«ExtractionTests-0.0.0».impl_435] «ExtractionTests-0.0.0»::experiments::MyTrait<> for Tuple where [T: «ExtractionTests-0.0.0»::experiments::MyTrait<>] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_451] «ExtractionTests-0.0.0»::experiments::MyTrait<> for Tuple where [T: «ExtractionTests-0.0.0»::experiments::MyTrait<>] := { noir_def foo<>(self: Tuple) -> Tuple := { self }; @@ -120,7 +120,7 @@ noir_def «ExtractionTests-0.0.0»::experiments::is_alias_some(x: @«Ex noir_def «ExtractionTests-0.0.0»::experiments::main<>() -> Unit := { let op1 = (#_ref returning & «ExtractionTests-0.0.0»::experiments::Option2)((«ExtractionTests-0.0.0»::experiments::Option2::some as λ(Field) -> «ExtractionTests-0.0.0»::experiments::Option2)((5: Field))); - let op2 = ((«ExtractionTests-0.0.0»::experiments::Option2 as «std-1.0.0-beta.14»::default::Default<>)::default<> as λ() -> «ExtractionTests-0.0.0»::experiments::Option2)(); + let op2 = ((«ExtractionTests-0.0.0»::experiments::Option2 as «std-1.0.0-beta.25»::default::Default<>)::default<> as λ() -> «ExtractionTests-0.0.0»::experiments::Option2)(); let _op3 = ((«ExtractionTests-0.0.0»::experiments::Option2 as «ExtractionTests-0.0.0»::experiments::MyTrait<>)::foo<> as λ(«ExtractionTests-0.0.0»::experiments::Option2) -> «ExtractionTests-0.0.0»::experiments::Option2)(if #_true then { (#_readRef returning «ExtractionTests-0.0.0»::experiments::Option2)(op1) } else { @@ -140,4 +140,4 @@ noir_def «ExtractionTests-0.0.0»::experiments::main<>() -> Unit := { def «ExtractionTests-0.0.0».Experiments.env : Env := Env.mk [«ExtractionTests-0.0.0::experiments::my_func3», «ExtractionTests-0.0.0::experiments::my_func», «ExtractionTests-0.0.0::experiments::my_func2», «ExtractionTests-0.0.0::experiments::get_unchecked», «ExtractionTests-0.0.0::experiments::my_fn», «ExtractionTests-0.0.0::experiments::cast_test», «ExtractionTests-0.0.0::experiments::tuple_test», «ExtractionTests-0.0.0::experiments::literal_test», «ExtractionTests-0.0.0::experiments::assigns», «ExtractionTests-0.0.0::experiments::uncons», «ExtractionTests-0.0.0::experiments::check», «ExtractionTests-0.0.0::experiments::Option2::none», «ExtractionTests-0.0.0::experiments::Option2::some», «ExtractionTests-0.0.0::experiments::Option2::is_none», «ExtractionTests-0.0.0::experiments::Option2::is_some», «ExtractionTests-0.0.0::experiments::string_test», «ExtractionTests-0.0.0::experiments::fmtstr_test», «ExtractionTests-0.0.0::experiments::is_alias_some», «ExtractionTests-0.0.0::experiments::main»] - [«ExtractionTests-0.0.0».impl_433, «ExtractionTests-0.0.0».impl_434, «ExtractionTests-0.0.0».impl_435] + [«ExtractionTests-0.0.0».impl_449, «ExtractionTests-0.0.0».impl_450, «ExtractionTests-0.0.0».impl_451] diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/GeneratedTypes.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/GeneratedTypes.lean index 34abec3b..16d14f2f 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/GeneratedTypes.lean @@ -1,32 +1,12 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe set_option linter.unusedVariables false -noir_struct_def «ExtractionTests-0.0.0»::struct_namespaces::test::Foo<> { - Field, -} - -noir_struct_def «ExtractionTests-0.0.0»::trait_associated_const::Bar<> {} - -noir_struct_def «ExtractionTests-0.0.0»::associated_type::Pair<> { - Field, - Field, -} - -noir_type_alias «ExtractionTests-0.0.0»::associated_type::Bar<> := «ExtractionTests-0.0.0»::associated_type::Pair<>; - -noir_struct_def «ExtractionTests-0.0.0»::experiments::Option2 { - bool, - T, -} - -noir_type_alias «ExtractionTests-0.0.0»::experiments::AliasedOpt := «ExtractionTests-0.0.0»::experiments::Option2; - noir_struct_def «ExtractionTests-0.0.0»::type_order::BarStruct<> { Field, } @@ -61,6 +41,26 @@ noir_struct_def «ExtractionTests-0.0.0»::trait_associated_const::Foo<> {} noir_type_alias «ExtractionTests-0.0.0»::alias_member_access::Foo := Tuple; +noir_struct_def «ExtractionTests-0.0.0»::struct_namespaces::test::Foo<> { + Field, +} + +noir_struct_def «ExtractionTests-0.0.0»::trait_associated_const::Bar<> {} + +noir_struct_def «ExtractionTests-0.0.0»::associated_type::Pair<> { + Field, + Field, +} + +noir_type_alias «ExtractionTests-0.0.0»::associated_type::Bar<> := «ExtractionTests-0.0.0»::associated_type::Pair<>; + +noir_struct_def «ExtractionTests-0.0.0»::experiments::Option2 { + bool, + T, +} + +noir_type_alias «ExtractionTests-0.0.0»::experiments::AliasedOpt := «ExtractionTests-0.0.0»::experiments::Option2; + noir_struct_def «ExtractionTests-0.0.0»::impl_trait_return::Bar<> {} noir_struct_def «ExtractionTests-0.0.0»::impl_trait_return::Baz<> { diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ImplTraitReturn.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ImplTraitReturn.lean index b50627d9..4736b0c6 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ImplTraitReturn.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ImplTraitReturn.lean @@ -7,7 +7,7 @@ open Lampe set_option linter.unusedVariables false -noir_trait_impl[«ExtractionTests-0.0.0».impl_437]<> «ExtractionTests-0.0.0»::impl_trait_return::Foo<> for «ExtractionTests-0.0.0»::impl_trait_return::Bar<> where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_453]<> «ExtractionTests-0.0.0»::impl_trait_return::Foo<> for «ExtractionTests-0.0.0»::impl_trait_return::Bar<> where [] := { noir_def foo<>(self: «ExtractionTests-0.0.0»::impl_trait_return::Bar<>) -> Field := { (42: Field) }; @@ -17,7 +17,7 @@ noir_trait_impl[«ExtractionTests-0.0.0».impl_437]<> «ExtractionTests-0.0.0»: }; } -noir_trait_impl[«ExtractionTests-0.0.0».impl_438]<> «ExtractionTests-0.0.0»::impl_trait_return::Foo<> for «ExtractionTests-0.0.0»::impl_trait_return::Baz<> where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_454]<> «ExtractionTests-0.0.0»::impl_trait_return::Foo<> for «ExtractionTests-0.0.0»::impl_trait_return::Baz<> where [] := { noir_def foo<>(self: «ExtractionTests-0.0.0»::impl_trait_return::Baz<>) -> Field := { self.0 }; @@ -49,4 +49,4 @@ noir_def «ExtractionTests-0.0.0»::impl_trait_return::use_baz<>() -> Field := { def «ExtractionTests-0.0.0».ImplTraitReturn.env : Env := Env.mk [«ExtractionTests-0.0.0::impl_trait_return::call_foo», «ExtractionTests-0.0.0::impl_trait_return::get_impl_bar», «ExtractionTests-0.0.0::impl_trait_return::get_impl_baz», «ExtractionTests-0.0.0::impl_trait_return::use_bar», «ExtractionTests-0.0.0::impl_trait_return::use_baz»] - [«ExtractionTests-0.0.0».impl_437, «ExtractionTests-0.0.0».impl_438] + [«ExtractionTests-0.0.0».impl_453, «ExtractionTests-0.0.0».impl_454] diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/MultipleGenerics.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/MultipleGenerics.lean index 8d140e1c..b266ca3f 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/MultipleGenerics.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/MultipleGenerics.lean @@ -7,7 +7,7 @@ open Lampe set_option linter.unusedVariables false -noir_trait_impl[«ExtractionTests-0.0.0».impl_436] «ExtractionTests-0.0.0»::multiple_generics::Foo for «ExtractionTests-0.0.0»::multiple_generics::Pair where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_452] «ExtractionTests-0.0.0»::multiple_generics::Foo for «ExtractionTests-0.0.0»::multiple_generics::Pair where [] := { noir_def foo3<>(self: «ExtractionTests-0.0.0»::multiple_generics::Pair) -> I := { self.0 }; @@ -15,4 +15,4 @@ noir_trait_impl[«ExtractionTests-0.0.0».impl_436] «ExtractionTests-0 def «ExtractionTests-0.0.0».MultipleGenerics.env : Env := Env.mk [] - [«ExtractionTests-0.0.0».impl_436] + [«ExtractionTests-0.0.0».impl_452] diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ShadowMut.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ShadowMut.lean index ccb5c1f7..6d94ab28 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ShadowMut.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/ShadowMut.lean @@ -10,7 +10,7 @@ set_option linter.unusedVariables false noir_def «ExtractionTests-0.0.0»::shadow_mut::shadow_mut<>() -> Array := { let v = (#_ref returning & Vector)((#_mkVector returning Vector)((1: u32), (2: u32), (3: u32))); let (__0, v) = (#_vectorPopFront returning Tuple >)((#_readRef returning Vector)(v)); - («std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)(v) + («std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)(v) } def «ExtractionTests-0.0.0».ShadowMut.env : Env := Env.mk diff --git a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/TraitAssociatedConst.lean b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/TraitAssociatedConst.lean index 155a5781..552518e1 100644 --- a/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/TraitAssociatedConst.lean +++ b/testing/ExtractionTests/lampe/ExtractionTests-0.0.0/Extracted/TraitAssociatedConst.lean @@ -7,13 +7,13 @@ open Lampe set_option linter.unusedVariables false -noir_trait_impl[«ExtractionTests-0.0.0».impl_439]<> «ExtractionTests-0.0.0»::trait_associated_const::HasConst<> for «ExtractionTests-0.0.0»::trait_associated_const::Foo<> where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_455]<> «ExtractionTests-0.0.0»::trait_associated_const::HasConst<> for «ExtractionTests-0.0.0»::trait_associated_const::Foo<> where [] := { noir_def double_n() -> u32 := { (#_uMul returning u32)(uConst!(N: u32), (2: u32)) }; } -noir_trait_impl[«ExtractionTests-0.0.0».impl_440]<> «ExtractionTests-0.0.0»::trait_associated_const::HasConst<> for «ExtractionTests-0.0.0»::trait_associated_const::Bar<> where [] := { +noir_trait_impl[«ExtractionTests-0.0.0».impl_456]<> «ExtractionTests-0.0.0»::trait_associated_const::HasConst<> for «ExtractionTests-0.0.0»::trait_associated_const::Bar<> where [] := { noir_def double_n() -> u32 := { (#_uMul returning u32)(uConst!(N: u32), (2: u32)) }; @@ -41,4 +41,4 @@ noir_def «ExtractionTests-0.0.0»::trait_associated_const::use_bar_array<>() -> def «ExtractionTests-0.0.0».TraitAssociatedConst.env : Env := Env.mk [«ExtractionTests-0.0.0::trait_associated_const::double_foo», «ExtractionTests-0.0.0::trait_associated_const::double_bar», «ExtractionTests-0.0.0::trait_associated_const::poly_array», «ExtractionTests-0.0.0::trait_associated_const::use_foo_array», «ExtractionTests-0.0.0::trait_associated_const::use_bar_array»] - [«ExtractionTests-0.0.0».impl_439, «ExtractionTests-0.0.0».impl_440] + [«ExtractionTests-0.0.0».impl_455, «ExtractionTests-0.0.0».impl_456] diff --git a/testing/ExtractionTests/lampe/lake-manifest.json b/testing/ExtractionTests/lampe/lake-manifest.json index 23b0fbbc..406aca46 100644 --- a/testing/ExtractionTests/lampe/lake-manifest.json +++ b/testing/ExtractionTests/lampe/lake-manifest.json @@ -3,7 +3,7 @@ "packages": [{"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../stdlib/lampe", diff --git a/testing/ExtractionTests/lampe/lakefile.toml b/testing/ExtractionTests/lampe/lakefile.toml index 053ec383..c9675984 100644 --- a/testing/ExtractionTests/lampe/lakefile.toml +++ b/testing/ExtractionTests/lampe/lakefile.toml @@ -11,5 +11,5 @@ name = "Lampe" path = "../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" path = "../../../stdlib/lampe" diff --git a/testing/ExtractionTests/src/shadow_mut.nr b/testing/ExtractionTests/src/shadow_mut.nr index b41da9b8..2efd4fdc 100644 --- a/testing/ExtractionTests/src/shadow_mut.nr +++ b/testing/ExtractionTests/src/shadow_mut.nr @@ -3,7 +3,7 @@ // must not cause an "Application type mismatch" on the new binding. pub fn shadow_mut() -> [u32; 2] { - let mut v = &[1, 2, 3]; + let mut v = @[1, 2, 3]; let (_, v) = v.pop_front(); v.as_array() } diff --git a/testing/Merkle/clean.sh b/testing/Merkle/clean.sh new file mode 100755 index 00000000..c29f7f9b --- /dev/null +++ b/testing/Merkle/clean.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euxo pipefail + +# Only remove generated extraction output; keep custom files under lampe/. +for crate in hasher merkle skyscraper; do + rm -rf ./"$crate"/lampe/*/Extracted + rm -f ./"$crate"/lampe/*/Extracted.lean + rm -rf ./"$crate"/lampe/deps/*/lampe/*/Extracted + rm -f ./"$crate"/lampe/deps/*/lampe/*/Extracted.lean +done diff --git a/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted.lean b/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted.lean index d7dd35cb..f9f89d30 100644 --- a/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted.lean +++ b/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «hasher-0.0.0».Extracted.GeneratedTypes import «hasher-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «hasher-0.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean b/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean index a6383c08..d5e6aded 100644 --- a/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Merkle/hasher/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/Merkle/hasher/lampe/lake-manifest.json b/testing/Merkle/hasher/lampe/lake-manifest.json index f94a88b2..08b34bbd 100644 --- a/testing/Merkle/hasher/lampe/lake-manifest.json +++ b/testing/Merkle/hasher/lampe/lake-manifest.json @@ -3,7 +3,7 @@ "packages": [{"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../../stdlib/lampe", diff --git a/testing/Merkle/hasher/lampe/lakefile.toml b/testing/Merkle/hasher/lampe/lakefile.toml index 572ae1e7..15fd33a6 100644 --- a/testing/Merkle/hasher/lampe/lakefile.toml +++ b/testing/Merkle/hasher/lampe/lakefile.toml @@ -8,13 +8,9 @@ name = "«hasher-0.0.0»" [[require]] name = "Lampe" -git = "https://github.com/reilabs/lampe" -rev = "main" -subDir = "Lampe" +path = "../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" -git = "https://github.com/reilabs/lampe" -rev = "main" -subDir = "stdlib/lampe" +name = "std-1.0.0-beta.25" +path = "../../../../stdlib/lampe" diff --git a/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted.lean b/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted.lean index 94d3b2dd..0b0c7f54 100644 --- a/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted.lean +++ b/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted.lean @@ -6,7 +6,7 @@ import «Merkle-0.0.0».Extracted.Witness.Mod import «Merkle-0.0.0».Extracted.Witness.Uncons import «hasher-0.0.0».Extracted import «skyscraper-0.0.0».Extracted -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «Merkle-0.0.0» @@ -15,4 +15,4 @@ def env := Main.env ++ Witness.Uncons.env ++ «hasher-0.0.0».env ++ «skyscraper-0.0.0».env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted/GeneratedTypes.lean b/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted/GeneratedTypes.lean index ea3284f7..a886802e 100644 --- a/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Merkle/merkle/lampe/Merkle-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import «hasher-0.0.0».Extracted.GeneratedTypes import «skyscraper-0.0.0».Extracted.GeneratedTypes import Lampe diff --git a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean b/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean deleted file mode 100644 index 484df01b..00000000 --- a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean +++ /dev/null @@ -1,3 +0,0 @@ - -import «hasher-0.0.0».Extracted - diff --git a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean b/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean deleted file mode 100644 index d7dd35cb..00000000 --- a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean +++ /dev/null @@ -1,10 +0,0 @@ --- Generated by lampe - -import «hasher-0.0.0».Extracted.GeneratedTypes -import «hasher-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted - -namespace «hasher-0.0.0» - -def env := Lib.env - ++ «std-1.0.0-beta.14».env diff --git a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean b/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean deleted file mode 100644 index 5b1f48fc..00000000 --- a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean +++ /dev/null @@ -1,16 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -noir_trait_def «hasher-0.0.0»::BinaryHasher [] := { - method hash<>(F, F) -> F; -} - -noir_trait_def «hasher-0.0.0»::Hasher<> [] := { - method finish<>(Self) -> Field; - method write<>(& Self, Field) -> Unit; -} - diff --git a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean b/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean deleted file mode 100644 index dd88244e..00000000 --- a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean +++ /dev/null @@ -1,10 +0,0 @@ --- Generated by lampe - -import «hasher-0.0.0».Extracted.GeneratedTypes -import Lampe - -open Lampe - -def «hasher-0.0.0».Lib.env : Env := Env.mk - [] - [] diff --git a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lakefile.toml b/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lakefile.toml deleted file mode 100644 index 572ae1e7..00000000 --- a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lakefile.toml +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by lampe -name = "hasher-0.0.0" -version = "0.0.0" -defaultTargets = ["hasher-0.0.0"] - -[[lean_lib]] -name = "«hasher-0.0.0»" - -[[require]] -name = "Lampe" -git = "https://github.com/reilabs/lampe" -rev = "main" -subDir = "Lampe" - -[[require]] -name = "std-1.0.0-beta.14" -git = "https://github.com/reilabs/lampe" -rev = "main" -subDir = "stdlib/lampe" - diff --git a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lean-toolchain b/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lean-toolchain deleted file mode 100644 index 33e0c088..00000000 --- a/testing/Merkle/merkle/lampe/deps/hasher-0.0.0/lampe/lean-toolchain +++ /dev/null @@ -1 +0,0 @@ -leanprover/lean4:v4.29.1 diff --git a/testing/Merkle/merkle/lampe/lake-manifest.json b/testing/Merkle/merkle/lampe/lake-manifest.json index 23ddcf7b..f3c53155 100644 --- a/testing/Merkle/merkle/lampe/lake-manifest.json +++ b/testing/Merkle/merkle/lampe/lake-manifest.json @@ -23,11 +23,11 @@ "name": "«hasher-0.0.0»", "manifestFile": "lake-manifest.json", "inherited": false, - "dir": "deps/hasher-0.0.0/lampe", + "dir": "../../hasher/lampe", "configFile": "lakefile.toml"}, {"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../../stdlib/lampe", diff --git a/testing/Merkle/merkle/lampe/lakefile.toml b/testing/Merkle/merkle/lampe/lakefile.toml index 747b0b1b..9fc10c9e 100644 --- a/testing/Merkle/merkle/lampe/lakefile.toml +++ b/testing/Merkle/merkle/lampe/lakefile.toml @@ -11,12 +11,12 @@ name = "Lampe" path = "../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" path = "../../../../stdlib/lampe" [[require]] name = "hasher-0.0.0" -path = "deps/hasher-0.0.0/lampe" +path = "../../hasher/lampe" [[require]] name = "skyscraper-0.0.0" diff --git a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean b/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean deleted file mode 100644 index 484df01b..00000000 --- a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0.lean +++ /dev/null @@ -1,3 +0,0 @@ - -import «hasher-0.0.0».Extracted - diff --git a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean b/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean deleted file mode 100644 index d7dd35cb..00000000 --- a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted.lean +++ /dev/null @@ -1,10 +0,0 @@ --- Generated by lampe - -import «hasher-0.0.0».Extracted.GeneratedTypes -import «hasher-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted - -namespace «hasher-0.0.0» - -def env := Lib.env - ++ «std-1.0.0-beta.14».env diff --git a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean b/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean deleted file mode 100644 index 5b1f48fc..00000000 --- a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/GeneratedTypes.lean +++ /dev/null @@ -1,16 +0,0 @@ --- Generated by lampe - -import «std-1.0.0-beta.14».Extracted.GeneratedTypes -import Lampe - -open Lampe - -noir_trait_def «hasher-0.0.0»::BinaryHasher [] := { - method hash<>(F, F) -> F; -} - -noir_trait_def «hasher-0.0.0»::Hasher<> [] := { - method finish<>(Self) -> Field; - method write<>(& Self, Field) -> Unit; -} - diff --git a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean b/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean deleted file mode 100644 index dd88244e..00000000 --- a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/hasher-0.0.0/Extracted/Lib.lean +++ /dev/null @@ -1,10 +0,0 @@ --- Generated by lampe - -import «hasher-0.0.0».Extracted.GeneratedTypes -import Lampe - -open Lampe - -def «hasher-0.0.0».Lib.env : Env := Env.mk - [] - [] diff --git a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lakefile.toml b/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lakefile.toml deleted file mode 100644 index 572ae1e7..00000000 --- a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lakefile.toml +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by lampe -name = "hasher-0.0.0" -version = "0.0.0" -defaultTargets = ["hasher-0.0.0"] - -[[lean_lib]] -name = "«hasher-0.0.0»" - -[[require]] -name = "Lampe" -git = "https://github.com/reilabs/lampe" -rev = "main" -subDir = "Lampe" - -[[require]] -name = "std-1.0.0-beta.14" -git = "https://github.com/reilabs/lampe" -rev = "main" -subDir = "stdlib/lampe" - diff --git a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lean-toolchain b/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lean-toolchain deleted file mode 100644 index 33e0c088..00000000 --- a/testing/Merkle/skyscraper/lampe/deps/hasher-0.0.0/lampe/lean-toolchain +++ /dev/null @@ -1 +0,0 @@ -leanprover/lean4:v4.29.1 diff --git a/testing/Merkle/skyscraper/lampe/lake-manifest.json b/testing/Merkle/skyscraper/lampe/lake-manifest.json index 46a24176..c7e95b91 100644 --- a/testing/Merkle/skyscraper/lampe/lake-manifest.json +++ b/testing/Merkle/skyscraper/lampe/lake-manifest.json @@ -16,11 +16,11 @@ "name": "«hasher-0.0.0»", "manifestFile": "lake-manifest.json", "inherited": false, - "dir": "deps/hasher-0.0.0/lampe", + "dir": "../../hasher/lampe", "configFile": "lakefile.toml"}, {"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../../stdlib/lampe", diff --git a/testing/Merkle/skyscraper/lampe/lakefile.toml b/testing/Merkle/skyscraper/lampe/lakefile.toml index 3d81763d..099a3e44 100644 --- a/testing/Merkle/skyscraper/lampe/lakefile.toml +++ b/testing/Merkle/skyscraper/lampe/lakefile.toml @@ -11,12 +11,12 @@ name = "Lampe" path = "../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" path = "../../../../stdlib/lampe" [[require]] name = "hasher-0.0.0" -path = "deps/hasher-0.0.0/lampe" +path = "../../hasher/lampe" [[require]] name = "proven-zk" diff --git a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted.lean b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted.lean index eab91be0..c04a3254 100644 --- a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted.lean +++ b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted.lean @@ -7,7 +7,7 @@ import «skyscraper-0.0.0».Extracted.Globals import «skyscraper-0.0.0».Extracted.Lib import «skyscraper-0.0.0».Extracted.Permute import «hasher-0.0.0».Extracted -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «skyscraper-0.0.0» @@ -17,4 +17,4 @@ def env := Bar.env ++ Lib.env ++ Permute.env ++ «hasher-0.0.0».env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Bar.lean b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Bar.lean index d42abd8d..b98a132d 100644 --- a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Bar.lean +++ b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Bar.lean @@ -8,7 +8,7 @@ open Lampe set_option linter.unusedVariables false noir_def «skyscraper-0.0.0»::bar::bar<>(a: Field) -> Field := { - let bytes = («std-1.0.0-beta.14»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(a); + let bytes = («std-1.0.0-beta.25»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(a); let new_left = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); let new_right = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); for i in (0: u32) .. (16: u32) do { @@ -31,8 +31,8 @@ noir_def «skyscraper-0.0.0»::bar::bar<>(a: Field) -> Field := { }; #_skip }; - let new_bytes_array = («std-1.0.0-beta.14»::vector::as_array as λ(Vector) -> Array)((#_readRef returning Vector)(new_bytes)); - («std-1.0.0-beta.14»::field::from_le_bytes<32: u32> as λ(Array) -> Field)(new_bytes_array) + let new_bytes_array = («std-1.0.0-beta.25»::vector::as_array as λ(Vector) -> Array)((#_readRef returning Vector)(new_bytes)); + («std-1.0.0-beta.25»::field::from_le_bytes<32: u32> as λ(Array) -> Field)(new_bytes_array) } def «skyscraper-0.0.0».Bar.env : Env := Env.mk diff --git a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/GeneratedTypes.lean b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/GeneratedTypes.lean index c8ed9421..07bc3290 100644 --- a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import «hasher-0.0.0».Extracted.GeneratedTypes import Lampe diff --git a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Globals.lean b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Globals.lean index dcc75069..bb427171 100644 --- a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Globals.lean +++ b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Globals.lean @@ -7,7 +7,7 @@ open Lampe set_option linter.unusedVariables false -noir_global_def «skyscraper-0.0.0»::globals::RC: Array = (#_mkArray returning Array)((-4058822530962036113558957735524994411356374024839875405476791844324326516925: Field), (5852100059362614845584985098022261541909346143980691326489891671321030921585: Field), (-4840154698573742532565501789862255731956493498174317200418381990571919688651: Field), (71577923540621522166602308362662170286605786204339342029375621502658138039: Field), (1630526119629192105940988602003704216811347521589219909349181656165466494167: Field), (7807402158218786806372091124904574238561123446618083586948014838053032654983: Field), (-8558681900379240296346816806663462402801546068866479372657894196934284905006: Field), (-4916733727805245440019875123169648108733681133486378553671899463457684353318: Field)); +noir_global_def «skyscraper-0.0.0»::globals::RC: Array = (#_mkArray returning Array)((17829420340877239108687448009732280677191990375576158938221412342251481978692: Field), (5852100059362614845584985098022261541909346143980691326489891671321030921585: Field), (17048088173265532689680903955395019356591870902241717143279822196003888806966: Field), (71577923540621522166602308362662170286605786204339342029375621502658138039: Field), (1630526119629192105940988602003704216811347521589219909349181656165466494167: Field), (7807402158218786806372091124904574238561123446618083586948014838053032654983: Field), (13329560971460034925899588938593812685746818331549554971040309989641523590611: Field), (16971509144034029782226530622087626979814683266929655790026304723118124142299: Field)); noir_global_def «skyscraper-0.0.0»::globals::SIGMA: Field = (9915499612839321149637521777990102151350674507940716049588462388200839649614: Field); diff --git a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Lib.lean b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Lib.lean index 2dd95412..bc4ff32d 100644 --- a/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Lib.lean +++ b/testing/Merkle/skyscraper/lampe/skyscraper-0.0.0/Extracted/Lib.lean @@ -7,7 +7,7 @@ open Lampe set_option linter.unusedVariables false -noir_trait_impl[«skyscraper-0.0.0».impl_432]<> «hasher-0.0.0»::BinaryHasher for «skyscraper-0.0.0»::Skyscraper<> where [] := { +noir_trait_impl[«skyscraper-0.0.0».impl_448]<> «hasher-0.0.0»::BinaryHasher for «skyscraper-0.0.0»::Skyscraper<> where [] := { noir_def hash<>(a: Field, b: Field) -> Field := { let s = («skyscraper-0.0.0»::permute::permute<> as λ(Array) -> Array)((#_mkArray returning Array)(a, b)); (#_fAdd returning Field)((#_arrayIndex returning Field)(s, (0: u32)), a) @@ -16,4 +16,4 @@ noir_trait_impl[«skyscraper-0.0.0».impl_432]<> «hasher-0.0.0»::BinaryHasher< def «skyscraper-0.0.0».Lib.env : Env := Env.mk [] - [«skyscraper-0.0.0».impl_432] + [«skyscraper-0.0.0».impl_448] diff --git a/testing/Merkle/skyscraper/src/bar.nr b/testing/Merkle/skyscraper/src/bar.nr index 49fbab62..28c28083 100644 --- a/testing/Merkle/skyscraper/src/bar.nr +++ b/testing/Merkle/skyscraper/src/bar.nr @@ -12,7 +12,7 @@ pub fn bar(a: Field) -> Field { new_right[i] = sbox(bytes[16 + i]); } - let mut new_bytes = new_right.as_slice(); + let mut new_bytes = new_right.as_vector(); for elem in new_left { new_bytes = new_bytes.push_back(elem); diff --git a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted.lean b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted.lean index dac6e3e3..d72d6288 100644 --- a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted.lean +++ b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted.lean @@ -10,7 +10,7 @@ import «Merkle-1.0.0».Extracted.Skyscraper.Mod import «Merkle-1.0.0».Extracted.Utils.Mod import «Merkle-1.0.0».Extracted.Witness.Mod import «Merkle-1.0.0».Extracted.Witness.Uncons -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «Merkle-1.0.0» @@ -23,4 +23,4 @@ def env := Bar.env ++ Utils.Mod.env ++ Witness.Mod.env ++ Witness.Uncons.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Bar.lean b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Bar.lean index 00040e24..5298ebd7 100644 --- a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Bar.lean +++ b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Bar.lean @@ -8,7 +8,7 @@ open Lampe set_option linter.unusedVariables false noir_def «Merkle-1.0.0»::bar::bar<>(a: Field) -> Field := { - let bytes = («std-1.0.0-beta.14»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(a); + let bytes = («std-1.0.0-beta.25»::field::to_le_bytes<32: u32> as λ(Field) -> Array)(a); let new_left = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); let new_right = (#_ref returning & Array)((#_mkRepeatedArray returning Array)((0: u8))); for i in (0: u32) .. (16: u32) do { @@ -32,7 +32,7 @@ noir_def «Merkle-1.0.0»::bar::bar<>(a: Field) -> Field := { #_skip }; let new_bytes_array = («Merkle-1.0.0»::utils::as_array<> as λ(Vector) -> Array)((#_readRef returning Vector)(new_bytes)); - («std-1.0.0-beta.14»::field::from_le_bytes<32: u32> as λ(Array) -> Field)(new_bytes_array) + («std-1.0.0-beta.25»::field::from_le_bytes<32: u32> as λ(Array) -> Field)(new_bytes_array) } def «Merkle-1.0.0».Bar.env : Env := Env.mk diff --git a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/GeneratedTypes.lean b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/GeneratedTypes.lean index b8316ea1..054e632d 100644 --- a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/GeneratedTypes.lean +++ b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Globals/Mod.lean b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Globals/Mod.lean index ed15e026..92a0e50b 100644 --- a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Globals/Mod.lean +++ b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Globals/Mod.lean @@ -7,7 +7,7 @@ open Lampe set_option linter.unusedVariables false -noir_global_def «Merkle-1.0.0»::globals::RC: Array = (#_mkArray returning Array)((-4058822530962036113558957735524994411356374024839875405476791844324326516925: Field), (5852100059362614845584985098022261541909346143980691326489891671321030921585: Field), (-4840154698573742532565501789862255731956493498174317200418381990571919688651: Field), (71577923540621522166602308362662170286605786204339342029375621502658138039: Field), (1630526119629192105940988602003704216811347521589219909349181656165466494167: Field), (7807402158218786806372091124904574238561123446618083586948014838053032654983: Field), (-8558681900379240296346816806663462402801546068866479372657894196934284905006: Field), (-4916733727805245440019875123169648108733681133486378553671899463457684353318: Field)); +noir_global_def «Merkle-1.0.0»::globals::RC: Array = (#_mkArray returning Array)((17829420340877239108687448009732280677191990375576158938221412342251481978692: Field), (5852100059362614845584985098022261541909346143980691326489891671321030921585: Field), (17048088173265532689680903955395019356591870902241717143279822196003888806966: Field), (71577923540621522166602308362662170286605786204339342029375621502658138039: Field), (1630526119629192105940988602003704216811347521589219909349181656165466494167: Field), (7807402158218786806372091124904574238561123446618083586948014838053032654983: Field), (13329560971460034925899588938593812685746818331549554971040309989641523590611: Field), (16971509144034029782226530622087626979814683266929655790026304723118124142299: Field)); noir_global_def «Merkle-1.0.0»::globals::SIGMA: Field = (9915499612839321149637521777990102151350674507940716049588462388200839649614: Field); diff --git a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Skyscraper/Mod.lean b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Skyscraper/Mod.lean index f37d3daf..8c965782 100644 --- a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Skyscraper/Mod.lean +++ b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Skyscraper/Mod.lean @@ -7,7 +7,7 @@ open Lampe set_option linter.unusedVariables false -noir_trait_impl[«Merkle-1.0.0».impl_432]<> «Merkle-1.0.0»::hasher::BinaryHasher for «Merkle-1.0.0»::skyscraper::Skyscraper<> where [] := { +noir_trait_impl[«Merkle-1.0.0».impl_448]<> «Merkle-1.0.0»::hasher::BinaryHasher for «Merkle-1.0.0»::skyscraper::Skyscraper<> where [] := { noir_def hash<>(a: Field, b: Field) -> Field := { let x = («Merkle-1.0.0»::permute::permute<> as λ(Array) -> Array)((#_mkArray returning Array)(a, b)); (#_fAdd returning Field)((#_arrayIndex returning Field)(x, (0: u32)), a) @@ -16,4 +16,4 @@ noir_trait_impl[«Merkle-1.0.0».impl_432]<> «Merkle-1.0.0»::hasher::BinaryHas def «Merkle-1.0.0».Skyscraper.Mod.env : Env := Env.mk [] - [«Merkle-1.0.0».impl_432] + [«Merkle-1.0.0».impl_448] diff --git a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Utils/Mod.lean b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Utils/Mod.lean index 1852f1d8..84fb8a32 100644 --- a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Utils/Mod.lean +++ b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Extracted/Utils/Mod.lean @@ -31,8 +31,8 @@ noir_def «Merkle-1.0.0»::utils::sbox<>(v: u8) -> u8 := { (#_uXor returning u8)(v, x6) } -noir_def «Merkle-1.0.0»::utils::sgn0<>(self: Field) -> u1 := { - (#_cast returning u1)(self) +noir_def «Merkle-1.0.0»::utils::sgn0<>(self: Field) -> bool := { + (#_uEq returning bool)((#_uRem returning u8)((#_cast returning u8)(self), (2: u8)), (1: u8)) } noir_def «Merkle-1.0.0»::utils::as_array<>(self: Vector) -> Array := { diff --git a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Spec.lean b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Spec.lean index 853734cd..96ddf4b3 100644 --- a/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Spec.lean +++ b/testing/MerkleFromScratch/lampe/Merkle-1.0.0/Spec.lean @@ -150,11 +150,12 @@ theorem sbox_intro : STHoare lp env ⟦⟧ («Merkle-1.0.0::utils::sbox».call h all_goals decide theorem sgn0_intro : STHoare lp env ⟦⟧ («Merkle-1.0.0::utils::sgn0».call h![] h![input]) - fun (output: BitVec 1) => output = input.val % 2 := by + fun (output : Bool) => output = ((@Builtin.CastTp.cast Tp.field (Tp.u 8) _ lp input) % 2 == 1) := by enter_decl simp only [«Merkle-1.0.0::utils::sgn0»] steps - simp_all + subst_vars + rfl theorem as_array_intro input (hi : input.length = 32) : STHoare lp env ⟦⟧ («Merkle-1.0.0::utils::as_array».call h![] h![input]) diff --git a/testing/MerkleFromScratch/lampe/lake-manifest.json b/testing/MerkleFromScratch/lampe/lake-manifest.json index 95d0abac..48a6fbd8 100644 --- a/testing/MerkleFromScratch/lampe/lake-manifest.json +++ b/testing/MerkleFromScratch/lampe/lake-manifest.json @@ -13,7 +13,7 @@ "configFile": "lakefile.lean"}, {"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../stdlib/lampe", diff --git a/testing/MerkleFromScratch/lampe/lakefile.toml b/testing/MerkleFromScratch/lampe/lakefile.toml index 0faa1d32..6f02f1c5 100644 --- a/testing/MerkleFromScratch/lampe/lakefile.toml +++ b/testing/MerkleFromScratch/lampe/lakefile.toml @@ -11,7 +11,7 @@ name = "Lampe" path = "../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" path = "../../../stdlib/lampe" [[require]] diff --git a/testing/MerkleFromScratch/src/bar.nr b/testing/MerkleFromScratch/src/bar.nr index 5787a9f3..e2d452c4 100644 --- a/testing/MerkleFromScratch/src/bar.nr +++ b/testing/MerkleFromScratch/src/bar.nr @@ -12,7 +12,7 @@ pub fn bar(a: Field) -> Field { new_right[i] = sbox(bytes[16 + i]); } - let mut new_bytes = new_right.as_slice(); + let mut new_bytes = new_right.as_vector(); for elem in new_left { new_bytes = new_bytes.push_back(elem); diff --git a/testing/MerkleFromScratch/src/utils/mod.nr b/testing/MerkleFromScratch/src/utils/mod.nr index 98fd2b22..7f82b342 100644 --- a/testing/MerkleFromScratch/src/utils/mod.nr +++ b/testing/MerkleFromScratch/src/utils/mod.nr @@ -24,8 +24,8 @@ pub fn sbox(v: u8) -> u8 { } // NOTE: adapted from stdlib -pub fn sgn0(self: Field) -> u1 { - self as u1 +pub fn sgn0(self: Field) -> bool { + (self as u8) % 2 == 1 } // NOTE: adapted from stdlib diff --git a/testing/Multiple/lampe/Multiple-0.0.0/Extracted.lean b/testing/Multiple/lampe/Multiple-0.0.0/Extracted.lean index c8809c4a..42f936cc 100644 --- a/testing/Multiple/lampe/Multiple-0.0.0/Extracted.lean +++ b/testing/Multiple/lampe/Multiple-0.0.0/Extracted.lean @@ -7,7 +7,7 @@ import «Multiple-0.0.0».Extracted.Baz.Mod import «Multiple-0.0.0».Extracted.Foo import «Multiple-0.0.0».Extracted.GeneratedTypes import «Multiple-0.0.0».Extracted.Main -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «Multiple-0.0.0» @@ -17,4 +17,4 @@ def env := Bar.Mod.env ++ Baz.Mod.env ++ Foo.env ++ Main.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Multiple/lampe/Multiple-0.0.0/Extracted/GeneratedTypes.lean b/testing/Multiple/lampe/Multiple-0.0.0/Extracted/GeneratedTypes.lean index 38ed6b32..3c5dd2e7 100644 --- a/testing/Multiple/lampe/Multiple-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Multiple/lampe/Multiple-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/Multiple/lampe/lake-manifest.json b/testing/Multiple/lampe/lake-manifest.json index 93d1af76..683e5bbc 100644 --- a/testing/Multiple/lampe/lake-manifest.json +++ b/testing/Multiple/lampe/lake-manifest.json @@ -3,7 +3,7 @@ "packages": [{"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«std-1.0.0-beta.25»", "manifestFile": "lake-manifest.json", "inherited": false, "dir": "../../../stdlib/lampe", diff --git a/testing/Multiple/lampe/lakefile.toml b/testing/Multiple/lampe/lakefile.toml index da335780..e5f8e77a 100644 --- a/testing/Multiple/lampe/lakefile.toml +++ b/testing/Multiple/lampe/lakefile.toml @@ -11,5 +11,5 @@ name = "Lampe" path = "../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" path = "../../../stdlib/lampe" diff --git a/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted.lean b/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted.lean index 4d470523..8e8a50b3 100644 --- a/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted.lean +++ b/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «check_shuffle-0.0.0».Extracted.GeneratedTypes import «check_shuffle-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «check_shuffle-0.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/GeneratedTypes.lean b/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/GeneratedTypes.lean index 852cc0dc..06ff2f44 100644 --- a/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/Lib.lean b/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/Lib.lean index fbd133e6..dd9aca1c 100644 --- a/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/Lib.lean +++ b/testing/Sort/lampe/deps/check_shuffle-0.0.0/lampe/check_shuffle-0.0.0/Extracted/Lib.lean @@ -30,7 +30,7 @@ noir_def «check_shuffle-0.0.0»::check_shuffle(lhs: Array)::eq<> as λ(T, T) -> bool)(expected, result)); + (#_assert returning Unit)(((T as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)(expected, result)); #_skip }; #_skip @@ -51,13 +51,13 @@ noir_def «check_shuffle-0.0.0»::get_shuffle_indices(lhs: Arra let idx = (#_arrayIndex returning u32)(shuffle_indices, (#_cast returning u32)(i)); let expected = (#_arrayIndex returning T)(rhs, (#_cast returning u32)(idx)); let result = (#_arrayIndex returning T)(lhs, (#_cast returning u32)(i)); - (#_assert returning Unit)(((T as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)(expected, result)); + (#_assert returning Unit)(((T as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(T, T) -> bool)(expected, result)); #_skip }; shuffle_indices } -noir_trait_impl[«check_shuffle-0.0.0».impl_432]<> «std-1.0.0-beta.14»::cmp::Eq<> for «check_shuffle-0.0.0»::test::CompoundStruct<> where [] := { +noir_trait_impl[«check_shuffle-0.0.0».impl_448]<> «std-1.0.0-beta.25»::cmp::Eq<> for «check_shuffle-0.0.0»::test::CompoundStruct<> where [] := { noir_def eq<>(self: «check_shuffle-0.0.0»::test::CompoundStruct<>, other: «check_shuffle-0.0.0»::test::CompoundStruct<>) -> bool := { (#_bAnd returning bool)((#_bAnd returning bool)((#_bEq returning bool)(self.0, other.0), (#_fEq returning bool)(self.1, other.1)), (#_uEq returning bool)(self.2, other.2)) }; @@ -105,4 +105,4 @@ noir_def «check_shuffle-0.0.0»::benchmark::bench_shuffle<>(lhs: Array(input: Array) -> }; for i in (0: u32) .. (#_uSub returning u32)(uConst!(N: u32), (1: u32)) do { (#_assert returning Unit)({ - let __0 = ((T as «std-1.0.0-beta.14»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.14»::cmp::Ordering<>)((#_arrayIndex returning T)(sorted, (#_cast returning u32)(i)), (#_arrayIndex returning T)(sorted, (#_cast returning u32)((#_uAdd returning u32)(i, (1: u32))))); - let __1 = («std-1.0.0-beta.14»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - let __3 = («std-1.0.0-beta.14»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.14»::cmp::Ordering<>)(); - let __7 = ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __1); - let __15 = ((«std-1.0.0-beta.14»::cmp::Ordering<> as «std-1.0.0-beta.14»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.14»::cmp::Ordering<>, «std-1.0.0-beta.14»::cmp::Ordering<>) -> bool)(__0, __3); + let __0 = ((T as «std-1.0.0-beta.25»::cmp::Ord<>)::cmp<> as λ(T, T) -> «std-1.0.0-beta.25»::cmp::Ordering<>)((#_arrayIndex returning T)(sorted, (#_cast returning u32)(i)), (#_arrayIndex returning T)(sorted, (#_cast returning u32)((#_uAdd returning u32)(i, (1: u32))))); + let __1 = («std-1.0.0-beta.25»::cmp::Ordering::less<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + let __3 = («std-1.0.0-beta.25»::cmp::Ordering::equal<> as λ() -> «std-1.0.0-beta.25»::cmp::Ordering<>)(); + let __7 = ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __1); + let __15 = ((«std-1.0.0-beta.25»::cmp::Ordering<> as «std-1.0.0-beta.25»::cmp::Eq<>)::eq<> as λ(«std-1.0.0-beta.25»::cmp::Ordering<>, «std-1.0.0-beta.25»::cmp::Ordering<>) -> bool)(__0, __3); (#_bOr returning bool)(__7, __15) }); #_skip @@ -74,7 +74,7 @@ noir_def «noir_sort-0.0.0»::test::unconditional_lt<>(_a: u32, _b: u32) -> Unit let a = (#_cast returning Field)(_a); let b = (#_cast returning Field)(_b); let diff = (#_fSub returning Field)(b, a); - («std-1.0.0-beta.14»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)(diff); + («std-1.0.0-beta.25»::field::assert_max_bit_size<32: u32> as λ(Field) -> Unit)(diff); #_skip } diff --git a/testing/Sort/src/quicksort/quicksort.nr b/testing/Sort/src/quicksort/quicksort.nr index e60df09d..1523f518 100644 --- a/testing/Sort/src/quicksort/quicksort.nr +++ b/testing/Sort/src/quicksort/quicksort.nr @@ -23,7 +23,7 @@ unconstrained fn quicksort_loop(arr: &mut [T; N], low: u32, high: where T: std::cmp::Ord, { - let mut stack: [(u32, u32)] = &[(low, high)]; + let mut stack: [(u32, u32)] = @[(low, high)]; // TODO(https://github.com/noir-lang/noir_sort/issues/22): use 'loop' once it's stabilized for _ in 0..2 * N { if stack.len() == 0 { diff --git a/testing/Sort/src/quicksort/quicksort_explicit.nr b/testing/Sort/src/quicksort/quicksort_explicit.nr index e43b069a..3a4726fd 100644 --- a/testing/Sort/src/quicksort/quicksort_explicit.nr +++ b/testing/Sort/src/quicksort/quicksort_explicit.nr @@ -27,7 +27,7 @@ unconstrained fn quicksort_loop( high: u32, sortfn: unconstrained fn(T, T) -> bool, ) { - let mut stack: [(u32, u32)] = &[(low, high)]; + let mut stack: [(u32, u32)] = @[(low, high)]; // TODO(https://github.com/noir-lang/noir_sort/issues/22): use 'loop' once it's stabilized for _ in 0..2 * N { if stack.len() == 0 { diff --git a/testing/TestDep/lampe/TestDep-0.0.0/Extracted.lean b/testing/TestDep/lampe/TestDep-0.0.0/Extracted.lean index d9e0e8b2..14fcae0a 100644 --- a/testing/TestDep/lampe/TestDep-0.0.0/Extracted.lean +++ b/testing/TestDep/lampe/TestDep-0.0.0/Extracted.lean @@ -14,7 +14,7 @@ import «LocalDep-2.0.0».Extracted import «LocalDepWithLampe-0.0.0».Extracted import «LocalDepWithLampe-1.0.0».Extracted import «LocalDepWithLampe-2.0.0».Extracted -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «TestDep-0.0.0» @@ -31,4 +31,4 @@ def env := Main.env ++ «LocalDepWithLampe-0.0.0».env ++ «LocalDepWithLampe-1.0.0».env ++ «LocalDepWithLampe-2.0.0».env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/lampe/TestDep-0.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/lampe/TestDep-0.0.0/Extracted/GeneratedTypes.lean index 796c9c72..067733b2 100644 --- a/testing/TestDep/lampe/TestDep-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/lampe/TestDep-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import «GitDep-0.0.0».Extracted.GeneratedTypes import «GitDep-1.0.0».Extracted.GeneratedTypes import «GitDep-2.0.0».Extracted.GeneratedTypes diff --git a/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted.lean b/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted.lean index 9e7df320..788b543b 100644 --- a/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted.lean +++ b/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «GitDep-0.0.0».Extracted.GeneratedTypes import «GitDep-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «GitDep-0.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted/GeneratedTypes.lean index 50307c08..442722b9 100644 --- a/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/GitDep-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/lakefile.toml b/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/lakefile.toml index 3c8f3acb..f41db29f 100644 --- a/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/lakefile.toml +++ b/testing/TestDep/lampe/deps/GitDep-0.0.0/lampe/lakefile.toml @@ -13,7 +13,7 @@ rev = "main" subDir = "Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted.lean b/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted.lean index 7f044496..759263a0 100644 --- a/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted.lean +++ b/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «GitDep-1.0.0».Extracted.GeneratedTypes import «GitDep-1.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «GitDep-1.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted/GeneratedTypes.lean index 50307c08..442722b9 100644 --- a/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/GitDep-1.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/lakefile.toml b/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/lakefile.toml index cef67e70..610be7bd 100644 --- a/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/lakefile.toml +++ b/testing/TestDep/lampe/deps/GitDep-1.0.0/lampe/lakefile.toml @@ -13,7 +13,7 @@ rev = "main" subDir = "Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted.lean b/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted.lean index 909bb375..01d90833 100644 --- a/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted.lean +++ b/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «GitDep-2.0.0».Extracted.GeneratedTypes import «GitDep-2.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «GitDep-2.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted/GeneratedTypes.lean index 50307c08..442722b9 100644 --- a/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/GitDep-2.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/lakefile.toml b/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/lakefile.toml index 9548a2bf..ca5150e2 100644 --- a/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/lakefile.toml +++ b/testing/TestDep/lampe/deps/GitDep-2.0.0/lampe/lakefile.toml @@ -13,7 +13,7 @@ rev = "main" subDir = "Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted.lean b/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted.lean index ea98f88f..0d5b79fe 100644 --- a/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted.lean +++ b/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «LocalDep-0.0.0».Extracted.GeneratedTypes import «LocalDep-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «LocalDep-0.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted/GeneratedTypes.lean index 4ff33905..1f02be9e 100644 --- a/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/LocalDep-0.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/lakefile.toml b/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/lakefile.toml index 7fc3c0ec..79d0057a 100644 --- a/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/lakefile.toml +++ b/testing/TestDep/lampe/deps/LocalDep-0.0.0/lampe/lakefile.toml @@ -13,7 +13,7 @@ rev = "main" subDir = "Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted.lean b/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted.lean index 2dacf33f..7eb39dc4 100644 --- a/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted.lean +++ b/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «LocalDep-1.0.0».Extracted.GeneratedTypes import «LocalDep-1.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «LocalDep-1.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted/GeneratedTypes.lean index 50307c08..442722b9 100644 --- a/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/LocalDep-1.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/lakefile.toml b/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/lakefile.toml index 501bfcab..b159b9c6 100644 --- a/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/lakefile.toml +++ b/testing/TestDep/lampe/deps/LocalDep-1.0.0/lampe/lakefile.toml @@ -13,7 +13,7 @@ rev = "main" subDir = "Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted.lean b/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted.lean index 43f9544e..c2b08b51 100644 --- a/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted.lean +++ b/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «LocalDep-2.0.0».Extracted.GeneratedTypes import «LocalDep-2.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «LocalDep-2.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted/GeneratedTypes.lean index 50307c08..442722b9 100644 --- a/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/LocalDep-2.0.0/Extracted/GeneratedTypes.lean @@ -1,6 +1,6 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe diff --git a/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/lakefile.toml b/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/lakefile.toml index deaca950..ed8406d8 100644 --- a/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/lakefile.toml +++ b/testing/TestDep/lampe/deps/LocalDep-2.0.0/lampe/lakefile.toml @@ -13,7 +13,7 @@ rev = "main" subDir = "Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/lampe/lake-manifest.json b/testing/TestDep/lampe/lake-manifest.json index 30e33b51..7e9e749e 100644 --- a/testing/TestDep/lampe/lake-manifest.json +++ b/testing/TestDep/lampe/lake-manifest.json @@ -47,66 +47,97 @@ "type": "git", "subDir": "testing/TestDep/testing/GitDepWithLampeV2/lampe", "scope": "", - "rev": "32964cd35655dbf5829acdcacbbe1ce0d6d79122", + "rev": "919a38712d22d05fc83e59af17ef57077abda1e0", "name": "«GitDepWithLampe-2.0.0»", "manifestFile": "lake-manifest.json", - "inputRev": "mp/fixing-namespaces", + "inputRev": "main", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/reilabs/lampe", "type": "git", "subDir": "testing/TestDep/testing/GitDepWithLampeV1/lampe", "scope": "", - "rev": "32964cd35655dbf5829acdcacbbe1ce0d6d79122", + "rev": "919a38712d22d05fc83e59af17ef57077abda1e0", "name": "«GitDepWithLampe-1.0.0»", "manifestFile": "lake-manifest.json", - "inputRev": "mp/fixing-namespaces", + "inputRev": "main", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/reilabs/lampe", "type": "git", "subDir": "testing/TestDep/testing/GitDepWithLampe/lampe", "scope": "", - "rev": "32964cd35655dbf5829acdcacbbe1ce0d6d79122", + "rev": "919a38712d22d05fc83e59af17ef57077abda1e0", "name": "«GitDepWithLampe-0.0.0»", "manifestFile": "lake-manifest.json", - "inputRev": "mp/fixing-namespaces", + "inputRev": "main", "inherited": false, "configFile": "lakefile.toml"}, {"type": "path", "scope": "", - "name": "«std-1.0.0-beta.14»", + "name": "«GitDep-2.0.0»", + "manifestFile": "lake-manifest.json", + "inherited": false, + "dir": "deps/GitDep-2.0.0/lampe", + "configFile": "lakefile.toml"}, + {"type": "path", + "scope": "", + "name": "«GitDep-1.0.0»", + "manifestFile": "lake-manifest.json", + "inherited": false, + "dir": "deps/GitDep-1.0.0/lampe", + "configFile": "lakefile.toml"}, + {"type": "path", + "scope": "", + "name": "«GitDep-0.0.0»", "manifestFile": "lake-manifest.json", "inherited": false, - "dir": "../../../stdlib/lampe/", + "dir": "deps/GitDep-0.0.0/lampe", + "configFile": "lakefile.toml"}, + {"type": "path", + "scope": "", + "name": "«std-1.0.0-beta.25»", + "manifestFile": "lake-manifest.json", + "inherited": false, + "dir": "../../../stdlib/lampe", "configFile": "lakefile.toml"}, {"type": "path", "scope": "", "name": "Lampe", "manifestFile": "lake-manifest.json", "inherited": false, - "dir": "../../../Lampe/", + "dir": "../../../Lampe", "configFile": "lakefile.lean"}, - {"url": "https://github.com/leanprover-community/mathlib4", + {"url": "https://github.com/reilabs/lampe", "type": "git", - "subDir": null, - "scope": "leanprover-community", - "rev": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", - "name": "mathlib", + "subDir": "stdlib/lampe", + "scope": "", + "rev": "919a38712d22d05fc83e59af17ef57077abda1e0", + "name": "«std-1.0.0-beta.14»", "manifestFile": "lake-manifest.json", - "inputRev": "v4.29.1", + "inputRev": "main", "inherited": true, - "configFile": "lakefile.lean"}, + "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/batteries", "type": "git", "subDir": null, - "scope": "leanprover-community", + "scope": "", "rev": "756e3321fd3b02a85ffda19fef789916223e578c", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "v4.29.1", "inherited": true, "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover-community/mathlib4", + "type": "git", + "subDir": null, + "scope": "", + "rev": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", + "name": "mathlib", + "manifestFile": "lake-manifest.json", + "inputRev": "v4.29.1", + "inherited": true, + "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/plausible", "type": "git", "subDir": null, diff --git a/testing/TestDep/lampe/lakefile.toml b/testing/TestDep/lampe/lakefile.toml index ee81c8fe..6680b18c 100644 --- a/testing/TestDep/lampe/lakefile.toml +++ b/testing/TestDep/lampe/lakefile.toml @@ -8,11 +8,11 @@ name = "«TestDep-0.0.0»" [[require]] name = "Lampe" -path = "../../../Lampe/" +path = "../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" -path = "../../../stdlib/lampe/" +name = "std-1.0.0-beta.25" +path = "../../../stdlib/lampe" [[require]] name = "GitDep-0.0.0" diff --git a/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted.lean b/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted.lean index f7a0c4a0..7bb0aec1 100644 --- a/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted.lean +++ b/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «GitDepWithLampe-0.0.0».Extracted.GeneratedTypes import «GitDepWithLampe-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «GitDepWithLampe-0.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean index 0a3e5c98..442722b9 100644 --- a/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean @@ -1,7 +1,9 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe +set_option linter.unusedVariables false + diff --git a/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/Lib.lean b/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/Lib.lean index dc8134be..718a0a12 100644 --- a/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/Lib.lean +++ b/testing/TestDep/testing/GitDepWithLampe/lampe/GitDepWithLampe-0.0.0/Extracted/Lib.lean @@ -5,6 +5,8 @@ import Lampe open Lampe +set_option linter.unusedVariables false + noir_def «GitDepWithLampe-0.0.0»::not_equal<>(x: Field, y: Field) -> bool := { (#_fNeq returning bool)(x, y) } diff --git a/testing/TestDep/testing/GitDepWithLampe/lampe/lakefile.toml b/testing/TestDep/testing/GitDepWithLampe/lampe/lakefile.toml index 902b80c6..4b2189f4 100644 --- a/testing/TestDep/testing/GitDepWithLampe/lampe/lakefile.toml +++ b/testing/TestDep/testing/GitDepWithLampe/lampe/lakefile.toml @@ -13,7 +13,7 @@ path = "../../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted.lean b/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted.lean index 4bdce84f..5c7028d5 100644 --- a/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted.lean +++ b/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «GitDepWithLampe-1.0.0».Extracted.GeneratedTypes import «GitDepWithLampe-1.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «GitDepWithLampe-1.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean index 0a3e5c98..442722b9 100644 --- a/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean @@ -1,7 +1,9 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe +set_option linter.unusedVariables false + diff --git a/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/Lib.lean b/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/Lib.lean index 0fae3644..30dd29b7 100644 --- a/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/Lib.lean +++ b/testing/TestDep/testing/GitDepWithLampeV1/lampe/GitDepWithLampe-1.0.0/Extracted/Lib.lean @@ -5,6 +5,8 @@ import Lampe open Lampe +set_option linter.unusedVariables false + noir_def «GitDepWithLampe-1.0.0»::not_equal<>(x: Field, y: Field) -> bool := { (#_fNeq returning bool)(x, y) } diff --git a/testing/TestDep/testing/GitDepWithLampeV1/lampe/lakefile.toml b/testing/TestDep/testing/GitDepWithLampeV1/lampe/lakefile.toml index b0d15f7c..fff25768 100644 --- a/testing/TestDep/testing/GitDepWithLampeV1/lampe/lakefile.toml +++ b/testing/TestDep/testing/GitDepWithLampeV1/lampe/lakefile.toml @@ -13,7 +13,7 @@ path = "../../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted.lean b/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted.lean index 4ff0344b..f9508d04 100644 --- a/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted.lean +++ b/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «GitDepWithLampe-2.0.0».Extracted.GeneratedTypes import «GitDepWithLampe-2.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «GitDepWithLampe-2.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean index 0a3e5c98..442722b9 100644 --- a/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean @@ -1,7 +1,9 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe +set_option linter.unusedVariables false + diff --git a/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/Lib.lean b/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/Lib.lean index 98bdc8ff..1a2ac557 100644 --- a/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/Lib.lean +++ b/testing/TestDep/testing/GitDepWithLampeV2/lampe/GitDepWithLampe-2.0.0/Extracted/Lib.lean @@ -5,6 +5,8 @@ import Lampe open Lampe +set_option linter.unusedVariables false + noir_def «GitDepWithLampe-2.0.0»::not_equal<>(x: Field, y: Field) -> bool := { (#_fNeq returning bool)(x, y) } diff --git a/testing/TestDep/testing/GitDepWithLampeV2/lampe/lakefile.toml b/testing/TestDep/testing/GitDepWithLampeV2/lampe/lakefile.toml index a5a9b2aa..f7000ac8 100644 --- a/testing/TestDep/testing/GitDepWithLampeV2/lampe/lakefile.toml +++ b/testing/TestDep/testing/GitDepWithLampeV2/lampe/lakefile.toml @@ -13,7 +13,7 @@ path = "../../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted.lean b/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted.lean index b5a14ff9..4a18dc2f 100644 --- a/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted.lean +++ b/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «LocalDepWithLampe-0.0.0».Extracted.GeneratedTypes import «LocalDepWithLampe-0.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «LocalDepWithLampe-0.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean index 0a3e5c98..442722b9 100644 --- a/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/GeneratedTypes.lean @@ -1,7 +1,9 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe +set_option linter.unusedVariables false + diff --git a/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/Lib.lean b/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/Lib.lean index a9b881c3..c1729bea 100644 --- a/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/Lib.lean +++ b/testing/TestDep/testing/LocalDepWithLampe/lampe/LocalDepWithLampe-0.0.0/Extracted/Lib.lean @@ -5,6 +5,8 @@ import Lampe open Lampe +set_option linter.unusedVariables false + noir_def «LocalDepWithLampe-0.0.0»::not_equal<>(x: Field, y: Field) -> bool := { (#_fNeq returning bool)(x, y) } diff --git a/testing/TestDep/testing/LocalDepWithLampe/lampe/lakefile.toml b/testing/TestDep/testing/LocalDepWithLampe/lampe/lakefile.toml index a5a5007d..8ba13fa5 100644 --- a/testing/TestDep/testing/LocalDepWithLampe/lampe/lakefile.toml +++ b/testing/TestDep/testing/LocalDepWithLampe/lampe/lakefile.toml @@ -13,7 +13,7 @@ path = "../../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted.lean b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted.lean index 3f872a0f..3e80b448 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted.lean +++ b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «LocalDepWithLampe-1.0.0».Extracted.GeneratedTypes import «LocalDepWithLampe-1.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «LocalDepWithLampe-1.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean index 0a3e5c98..442722b9 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/GeneratedTypes.lean @@ -1,7 +1,9 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe +set_option linter.unusedVariables false + diff --git a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/Lib.lean b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/Lib.lean index ebf308e8..56b485e3 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/Lib.lean +++ b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/LocalDepWithLampe-1.0.0/Extracted/Lib.lean @@ -5,6 +5,8 @@ import Lampe open Lampe +set_option linter.unusedVariables false + noir_def «LocalDepWithLampe-1.0.0»::not_equal<>(x: Field, y: Field) -> bool := { (#_fNeq returning bool)(x, y) } diff --git a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/lakefile.toml b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/lakefile.toml index 59dab672..563588b9 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV1/lampe/lakefile.toml +++ b/testing/TestDep/testing/LocalDepWithLampeV1/lampe/lakefile.toml @@ -13,7 +13,7 @@ path = "../../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" diff --git a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted.lean b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted.lean index 00206d1b..606385de 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted.lean +++ b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted.lean @@ -2,9 +2,9 @@ import «LocalDepWithLampe-2.0.0».Extracted.GeneratedTypes import «LocalDepWithLampe-2.0.0».Extracted.Lib -import «std-1.0.0-beta.14».Extracted +import «std-1.0.0-beta.25».Extracted namespace «LocalDepWithLampe-2.0.0» def env := Lib.env - ++ «std-1.0.0-beta.14».env + ++ «std-1.0.0-beta.25».env diff --git a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean index 0a3e5c98..442722b9 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean +++ b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/GeneratedTypes.lean @@ -1,7 +1,9 @@ -- Generated by lampe -import «std-1.0.0-beta.14».Extracted.GeneratedTypes +import «std-1.0.0-beta.25».Extracted.GeneratedTypes import Lampe open Lampe +set_option linter.unusedVariables false + diff --git a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/Lib.lean b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/Lib.lean index f64d22f0..1d5c213b 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/Lib.lean +++ b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/LocalDepWithLampe-2.0.0/Extracted/Lib.lean @@ -5,6 +5,8 @@ import Lampe open Lampe +set_option linter.unusedVariables false + noir_def «LocalDepWithLampe-2.0.0»::not_equal<>(x: Field, y: Field) -> bool := { (#_fNeq returning bool)(x, y) } diff --git a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/lakefile.toml b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/lakefile.toml index 852abbc0..7b9e0b95 100644 --- a/testing/TestDep/testing/LocalDepWithLampeV2/lampe/lakefile.toml +++ b/testing/TestDep/testing/LocalDepWithLampeV2/lampe/lakefile.toml @@ -13,7 +13,7 @@ path = "../../../../../Lampe" [[require]] -name = "std-1.0.0-beta.14" +name = "std-1.0.0-beta.25" git = "https://github.com/reilabs/lampe" rev = "main" subDir = "stdlib/lampe" From 4aab857e7c90785eecc8320eb2a7502a7b41a639 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:55:41 +0000 Subject: [PATCH 10/10] Run extraction tests on a larger stack The beta.25 elaborator recurses deeply enough to overflow the default 2MiB test-thread stack in debug builds, so the test helpers now run extraction on a 16MiB thread. Also adds a #[must_use] clippy had started asking for. --- src/lean/generator.rs | 1 + src/lib.rs | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/lean/generator.rs b/src/lean/generator.rs index de27812b..043a7814 100644 --- a/src/lean/generator.rs +++ b/src/lean/generator.rs @@ -3968,6 +3968,7 @@ fn type_is_variable_with_id(typ: &NoirType, id: TypeVariableId) -> bool { } } +#[must_use] pub fn sanitize_generic_name(name: &str) -> String { let name = name.strip_prefix("Self::").unwrap_or(name); name.replace("::", "_").replace(' ', "_").replace(['<', '>'], "") diff --git a/src/lib.rs b/src/lib.rs index 9cc79835..f22d18ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,6 +41,18 @@ mod tests { Project, }; + /// Runs `f` on a thread with a stack large enough for the Noir + /// elaborator's recursion, which exceeds the default test-thread stack in + /// debug builds. + fn with_large_stack(f: impl FnOnce() -> R + Send + 'static) -> R { + std::thread::Builder::new() + .stack_size(16 * 1024 * 1024) + .spawn(f) + .expect("spawning large-stack thread") + .join() + .expect("joining large-stack thread") + } + /// Set up a mock Noir project for extraction fn set_up_project(main_source: &str) -> std::io::Result<(TempDir, Project)> { let temp_dir = tempdir().expect("creating temp_dir"); @@ -68,8 +80,15 @@ authors = [""] /// Returns a tuple of warnings and a string representation of the extracted /// files - #[expect(clippy::format_push_string)] fn display_extraction_results(main_source: &str) -> std::io::Result<(Vec, String)> { + let main_source = main_source.to_string(); + with_large_stack(move || display_extraction_results_inner(&main_source)) + } + + #[expect(clippy::format_push_string)] + fn display_extraction_results_inner( + main_source: &str, + ) -> std::io::Result<(Vec, String)> { let (temp_dir, mock_project) = set_up_project(main_source)?; let warnings = mock_project @@ -103,6 +122,11 @@ authors = [""] /// Returns the generated crate data for testing the generator instead of /// the writer. fn get_crate_data(main_source: &str) -> Result { + let main_source = main_source.to_string(); + with_large_stack(move || get_crate_data_inner(&main_source)) + } + + fn get_crate_data_inner(main_source: &str) -> Result { let (temp_dir, mock_project) = set_up_project(main_source).unwrap(); // Prevent the temp directory from being deleted so that we can read the