{
  "id": "deseq2-normalization",
  "revision": 2,
  "software": "DESeq2",
  "kind": "existing_software",
  "area": "Normalization",
  "title": "Median-ratio normalization · real-model invariants",
  "status": "model_only",
  "lifecycle": "active",
  "review_date": "2026-10-02",
  "review_basis": "The local contribution gate reran in an isolated copy. All 58 recorded repeatability artifact hashes matched. No independent mathematical review is claimed.",
  "version": {
    "label": "1.52.0 · 16aeab6d6158bd8cbb8e98764c2f33399b1a3fd3",
    "identity_state": "pinned",
    "hash_algorithm": "sha256",
    "hash": "8c91699286336350e66eec132ce6fdf5bb4af78e2a4d015a5a61224f62a95984",
    "hash_scope": "Official DESeq2_1.52.0.tar.gz archive. R/core.R and the repository commit are pinned separately in sources.json."
  },
  "official_source": {
    "kind": "official_upstream",
    "label": "Bioconductor DESeq2",
    "url": "https://bioconductor.org/packages/3.23/bioc/html/DESeq2.html",
    "pinned_url": "https://bioconductor.org/packages/3.23/bioc/src/contrib/DESeq2_1.52.0.tar.gz"
  },
  "property": {
    "state": "established_model",
    "summary": "In the real-valued translation, positive sample scaling preserves the retained rows and normalized between-sample ratios. Size factors follow a proved scaling identity.",
    "formal_statement": "For positive sample scales c and a nonempty retained set, s(K scaled by c)[j] = (c[j] / G(c)) * s(K)[j], where G(c) = exp(mean(log(c))). This is a translated real model, not the R floating-point implementation."
  },
  "assumptions": [
    "The mathematical model has finite real-valued count rows, positive sample scales and at least one row positive in every sample.",
    "The target uses the default ratio method and stats::median; even medians average the central log values.",
    "The production interpretation uses dense nonnegative counts, at least one sample and one all-positive row, without missing or nonfinite values.",
    "R execution, binary-output recording and Python decoding faithfully represent the executed function and observed values."
  ],
  "exclusions": [
    "The chosen 10^-12 tolerance is not a proved numerical error bound. Production R/libm correspondence remains unproved.",
    "No formal R refinement, universal floating-point accuracy bound, full-package verification or statistical validity claim.",
    "No poscounts, supplied geoMeans, custom location functions, control-gene indexing or other DESeq2 routines."
  ],
  "proof_artifact": {
    "state": "available",
    "summary": "Lean 4.32.2 and pinned Mathlib prove sample-scaling equivariance, normalized-ratio invariance and retained-row preservation in a real-valued translation.",
    "artifacts": [
      {
        "label": "Normalization.lean",
        "href": "evidence/deseq2/Normalization.lean",
        "sha256": "4206ed6b251d3d43e11e9af77496d1bdeb9c32847a2fb8531ef44899658469ee"
      },
      {
        "label": "ProductionCertificates.lean",
        "href": "evidence/deseq2/ProductionCertificates.lean",
        "sha256": "d011ba3a2bcebff4eba612c32178a6189997011421dde44284be1411fe172129"
      },
      {
        "label": "axioms.txt",
        "href": "evidence/deseq2/axioms.txt",
        "sha256": "f522e3cae9717bb0e7e57b279751e1177deb3217b5238cb2dc4a1e11b7e7bf0f"
      },
      {
        "label": "certificate-check.txt",
        "href": "evidence/deseq2/certificate-check.txt",
        "sha256": "ad9b82d826d2485cc1f59aaa4a2980c828bdfa43ebd5fdbccdcf840942d5469e"
      },
      {
        "label": "lake-manifest.json",
        "href": "evidence/deseq2/lake-manifest.json",
        "sha256": "36e34686885812ae5099114347f4c49019a347221cc13765e0dbf174a1261d18"
      },
      {
        "label": "lakefile.toml",
        "href": "evidence/deseq2/lakefile.toml",
        "sha256": "5ec19a32073e4ee43b4582b22ac9157841add3fe5222c0ac0b3f4a3bd6d7c2a4"
      },
      {
        "label": "lean-toolchain",
        "href": "evidence/deseq2/lean-toolchain",
        "sha256": "2bdc48adfa58d0017e538a0ad117c5d73d35deec879978f909406a80c8037273"
      }
    ],
    "declarations": [
      "DESeq2Verification.estimateRatio_scale",
      "DESeq2Verification.normalized_ratio_scaled",
      "DESeq2Verification.retained_scale",
      "DESeq2Verification.sizeFactor_global_scale",
      "DESeq2Verification.checkRelative_sound"
    ]
  },
  "runtime_evidence": {
    "state": "available",
    "summary": "The unchanged function assignment from R/core.R ran on 10 synthetic matrices. There are 59 kernel-checked output comparisons at a chosen 10^-12 tolerance, not a proved numerical error bound. The largest observed residual is about 3.7e-15.",
    "artifacts": [
      {
        "label": "certificates.json",
        "href": "evidence/deseq2/certificates.json",
        "sha256": "aed417f09efd35a6d9b733bdad2b3bab13fee02d1c95cf7121728ea513e99f46"
      },
      {
        "label": "cases.tsv",
        "href": "evidence/deseq2/cases.tsv",
        "sha256": "557f6a81fb9f095c7eb0db4685b9d81f4279fce4b92f4f33346bb8df25605553"
      },
      {
        "label": "boundaries.tsv",
        "href": "evidence/deseq2/boundaries.tsv",
        "sha256": "852124914c66d241dee55f41ba245d3378784711e4617beb31863b679ed20f11"
      },
      {
        "label": "repeatability.json",
        "href": "evidence/deseq2/repeatability.json",
        "sha256": "003af1d5ccd5bd6acfc3c49218c228475bf1b45ae94da5b1622d7b06b9698b6f"
      },
      {
        "label": "sources.json",
        "href": "evidence/deseq2/sources.json",
        "sha256": "853fbcb116de8479204fd818bd5bf5ad4edb35d225d25e6f5fa91823f8a8235e"
      }
    ]
  },
  "execution_bridge": {
    "state": "not_established",
    "summary": "Real logarithm/exponential identities are proved in the translation. R/libm floating-point correspondence remains unproved. Exact rational certificates bound only the recorded output comparisons; the tolerance is chosen, not derived as a numerical error bound.",
    "artifacts": [
      {
        "label": "bridge.R",
        "href": "evidence/deseq2/bridge.R",
        "sha256": "f2911fb5efedeeb7569cfd42bfba717a031bf65cf0cc691aad378904d794f41d"
      },
      {
        "label": "certify.py",
        "href": "evidence/deseq2/certify.py",
        "sha256": "c563c74d2b1337c6cdd0d022a3fe503b1d64c4db83dcfb78fd6b3888e4766b33"
      }
    ]
  },
  "trusted_base": [
    "Lean 4.32.2 kernel, pinned Mathlib and axioms propext, Classical.choice and Quot.sound.",
    "Source/hash checks, unchanged R function execution, R/libm, binary-output recording and Python binary64 decoding.",
    "The connection from the intended algorithm to the real-valued translation; no proof of numerical implementation correspondence."
  ],
  "next_step": "Review the model independently and establish production floating-point correspondence before claiming an implementation refinement.",
  "history": [
    {
      "date": "2026-10-02",
      "revision": 1,
      "action": "created",
      "reason": "Review target recorded; results remain in progress."
    },
    {
      "date": "2026-10-02",
      "revision": 2,
      "action": "corrected",
      "reason": "Accepted translated-model invariants and finite production-output comparisons after a copied gate rerun. Kept the main claim at model-only assurance.",
      "previous_record": {
        "label": "Previous record · revision 1",
        "href": "history/deseq2-normalization/revision-1.json",
        "sha256": "5dda1617235c1dbca239b86215769f39b64d4b717554bb31198791e4a4a1c8c5"
      }
    }
  ],
  "withdrawal": null,
  "execution_environment": {
    "api": "estimateSizeFactorsForMatrix(..., type=\"ratio\", locfunc=stats::median)",
    "orientation": "Count rows by sample columns",
    "backends": [
      "Dense nonnegative count matrix; unchanged upstream function assignment evaluated from R/core.R. No full DESeq2 package installation."
    ],
    "packages": {
      "DESeq2 source": "1.52.0",
      "R": "4.6.1",
      "MatrixGenerics": "1.24.0",
      "matrixStats": "1.5.0",
      "Lean": "4.32.2"
    },
    "upstream_commits": {
      "DESeq2": "16aeab6d6158bd8cbb8e98764c2f33399b1a3fd3",
      "Mathlib": "905b95818eb32af7874a58b427f50c1711a5e96c"
    },
    "configuration": {
      "method": "ratio",
      "location": "stats::median",
      "recorded_output": "binary64",
      "chosen_comparison_tolerance": "1/1000000000000"
    },
    "bounds": [
      "At least one sample and one row positive in every sample; missing and nonfinite values are excluded.",
      "Demonstrated integer inputs and their scaled values remain below 2^53.",
      "Finite evidence covers 59 nontrivial comparisons across 10 synthetic matrices; 31 residuals are nonzero.",
      "The checker rejects a 1% altered output and a zero reference denominator."
    ]
  }
}
