{"id":51430475,"url":"https://github.com/oxarbitrage/poseidon-formal","last_synced_at":"2026-07-05T03:30:41.718Z","repository":{"id":355612898,"uuid":"1226586468","full_name":"oxarbitrage/poseidon-formal","owner":"oxarbitrage","description":"Lean 4 formalization of Poseidon hash — machine-verified permutation bijectivity over the Pallas base field","archived":false,"fork":false,"pushed_at":"2026-06-01T23:38:09.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-02T01:19:25.353Z","etag":null,"topics":["cryptography","formal-verification","hash-functions","lean4","poseidon","zcash"],"latest_commit_sha":null,"homepage":"https://oxarbitrage.github.io/blog/formally-verifying-the-zcash-orchard-stack/","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxarbitrage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-01T15:34:04.000Z","updated_at":"2026-06-01T23:38:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/oxarbitrage/poseidon-formal","commit_stats":null,"previous_names":["oxarbitrage/poseidon-formal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oxarbitrage/poseidon-formal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fposeidon-formal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fposeidon-formal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fposeidon-formal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fposeidon-formal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxarbitrage","download_url":"https://codeload.github.com/oxarbitrage/poseidon-formal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Fposeidon-formal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35142824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","formal-verification","hash-functions","lean4","poseidon","zcash"],"created_at":"2026-07-05T03:30:40.907Z","updated_at":"2026-07-05T03:30:41.676Z","avatar_url":"https://github.com/oxarbitrage.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# poseidon-formal\n\n**Status:** Fully proven — zero `sorry` statements.\n\nLean 4 formalization of the Poseidon hash function as instantiated in Zcash's Orchard protocol (t=3, R_F=8, R_P=56, α=5, over the Pallas base field 𝔽_p).\n\n## What's formalized\n\n**Key result: `permutation_bijective`** — the full Poseidon permutation on 𝔽_p³ is a bijection.\n\nProof chain:\n1. `alpha_coprime` — gcd(5, p−1) = 1, so x ↦ x⁵ is a bijection on 𝔽_p (Fermat's little theorem).\n2. `mds_mul_inv` — the 3×3 Cauchy MDS matrix has an explicit verified inverse.\n3. Each full/partial round is a bijection (composition of bijective layers).\n4. `applyRounds_bijective` — iterating bijective rounds preserves bijectivity (induction).\n\n**Sponge-level properties** — connecting `permutation_bijective` to hash security:\n- `poseidonHash_eq` — hash decomposes as squeeze ∘ permutation ∘ absorb.\n- `absorb_permute_injective` — distinct inputs produce distinct post-permutation states (determinism).\n- `domain_separation` — different capacity values can never produce the same output state.\n- `capacity_hiding` — for any rate output, multiple internal states produce it (the capacity is not revealed).\n\n**Algebraic degree growth** — defense against interpolation attacks:\n- `symFullRound_degBound` / `symPartialRound_degBound` — one round multiplies algebraic degree by ≤ 5.\n- `permutation_degree_bound` — after all 64 rounds, output degree ≤ 5⁶⁴ (interpolation requires ≥ 5⁶⁴ + 1 queries).\n\n**CICO (Constrained-Input Constrained-Output)** — formal security reduction:\n- `CICOInstance` / `IsSolution` — defines the CICO problem as a Lean predicate.\n- `eval_symPermutation` — symbolic permutation agrees with concrete under evaluation.\n- `cico_is_polynomial_root` / `cico_polynomial_degree` — any CICO attack reduces to finding roots of degree-5⁶⁴ polynomials.\n\n**S-box differential uniformity** — defense against differential cryptanalysis:\n- `sbox_differential_uniformity` — for any nonzero difference a, the equation (x+a)⁵ - x⁵ = b has at most 4 solutions (δ ≤ 4).\n\n**MDS branch number** — defense against differential/linear cryptanalysis:\n- `mds_branch_number` — for any nonzero v, hw(v) + hw(Mv) ≥ 4 (maximal branch number for a 3×3 matrix).\n\nPreimage and collision resistance are **not** proven — they are conjectured from algebraic degree bounds, not derivable from bijectivity alone.\n\nThe 192 round constants are concrete 𝔽_p values from the Grain LFSR, cross-checked against the Halo 2 reference implementation.\n\n## Axioms\n\nNone. All results are proven from first principles; `native_decide` is used for the MDS inverse and coprimality checks (Lean kernel primitive, not an axiom).\n\n## Build\n\n```shell\nlake build\n```\n\n## Dependencies\n\nLean 4 (`v4.30.0-rc2`), [Mathlib4](https://github.com/leanprover-community/mathlib4), [pasta-formal](https://github.com/oxarbitrage/pasta-formal).\n\n## References\n\n- [Zcash Protocol Spec §5.4.1.10](https://zips.z.cash/protocol/protocol.pdf)\n- [Grassi et al., \"Poseidon: A New Hash Function for ZK Proof Systems\"](https://eprint.iacr.org/2019/458)\n- [pasta-hadeshash](https://github.com/zcash/pasta-hadeshash) — Grain LFSR round constant reference\n\n---\n\n## Part of a series\n\nSix repositories formally verifying the Zcash Orchard cryptographic stack:\n\n| Layer | Repository |\n|-------|-----------|\n| Curves | [pasta-formal](https://github.com/oxarbitrage/pasta-formal) |\n| Hash | [poseidon-formal](https://github.com/oxarbitrage/poseidon-formal) |\n| Hash-to-curve | [sinsemilla-formal](https://github.com/oxarbitrage/sinsemilla-formal) |\n| Signatures | [redpallas-formal](https://github.com/oxarbitrage/redpallas-formal) |\n| Protocol | [orchard-formal](https://github.com/oxarbitrage/orchard-formal) |\n| Proof system | [halo2-formal](https://github.com/oxarbitrage/halo2-formal) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxarbitrage%2Fposeidon-formal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxarbitrage%2Fposeidon-formal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxarbitrage%2Fposeidon-formal/lists"}