Skip to content

proof(SafeFPGA): add Proofs.idr — 17 structural invariants, 0 OWED - #34

Merged
hyperpolymath merged 2 commits into
mainfrom
proof-debt/standards-132-safefpga
May 20, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
proof-debt/standards-132-safefpga

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

`Proven.SafeFPGA` claimed "Invalid configurations are caught at validation time rather than during synthesis or at hardware programming time" but shipped no `Proofs.idr` — one of the ~30 named gaps under standards#132. This PR lands `src/Proven/SafeFPGA/Proofs.idr` with 17 machine-checked theorems and ZERO OWED postulates — every claim is type-level reducible.

Discharged (17)

Group Theorems What it proves
Enum self-equality (FPGAFamily) xilinx7 / ultraScale / versal / cycloneV / agilex / latticeSelfEq every family equals itself under the hand-written `Eq` instance
Enum self-equality (ResourceType) lut / ff / bram / dsp / ioSelfEq every resource type equals itself
Cross-pair anchor xilinx7VsVersalNotEq the fall-through `_ == _ = False` is reachable for distinct pairs
Resource boundary zero/full/overUtilWithinBudget 0% passes, 100% passes (max allowed), 101% fails
Validator soundness validateBitstreamPreservesConfig `Just cfg'` ⇒ `cfg' = cfg` — no silent mutation/clamping
Routing identity emptyBudgetZeroCongestion empty budget ⇒ 0 congestion
Timing thresholds empty + 500 MHz / 600 MHz both meet timing

Zero `believe_me`, zero `idris_crash`, zero OWED.

Note: latent API ambiguity flagged

`IO` as a constructor of `ResourceType` shadows `PrimIO.IO`, so `ioSelfEq` had to be qualified as `Proven.SafeFPGA.IO == Proven.SafeFPGA.IO`. This is a real ambiguity in the module's API and should be flagged for a future rename (e.g. `IOPin`).

Verification

```
$ idris2 --check src/Proven/SafeFPGA/Proofs.idr
1/2: Building Proven.SafeFPGA
2/2: Building Proven.SafeFPGA.Proofs
rc: 0
```

Refs

🤖 Generated with Claude Code

…132)

`Proven.SafeFPGA` claimed "Invalid configurations are caught at
validation time rather than during synthesis or at hardware
programming time" but shipped no `Proofs.idr` — one of the ~30
named gaps under standards#132.

This commit lands `src/Proven/SafeFPGA/Proofs.idr` with 17
machine-checked theorems. Zero believe_me, zero idris_crash, zero
OWED postulates — every claim is type-level reducible.

DISCHARGED (idris2 --check exit 0):

  Enum self-equality (6 + 5 = 11 cases):
    xilinx7SelfEq, ultraScaleSelfEq, versalSelfEq, cycloneVSelfEq,
    agilexSelfEq, latticeSelfEq              (FPGAFamily)
    lutSelfEq, ffSelfEq, bramSelfEq, dspSelfEq, ioSelfEq
                                              (ResourceType)
    xilinx7VsVersalNotEq                     (cross-pair anchor)

  Resource-budget boundary (3):
    zeroUtilWithinBudget        : 0% utilisation passes
    fullUtilWithinBudget        : 100% utilisation passes (max-allowed)
    overUtilNotWithinBudget     : 101% utilisation fails

  Bitstream-validator soundness (1):
    validateBitstreamPreservesConfig
       — `validateBitstream cfg = Just cfg' -> cfg' = cfg`
         (no silent mutation, clamping, or coercion of fields)

  Routing-congestion identity (1):
    emptyBudgetZeroCongestion   : empty resource budget -> 0 congestion

  Timing-likely thresholds (2):
    emptyBudgetLowClockMeetsTiming   : 500 MHz + empty -> True
    emptyBudgetHighClockMeetsTiming  : 600 MHz + empty -> True

Note: `IO` as a constructor of `ResourceType` is shadowed by
`PrimIO.IO`, so `ioSelfEq` is qualified as
`Proven.SafeFPGA.IO == Proven.SafeFPGA.IO`. This is a real
ambiguity in the module's API that should be flagged for a
future rename (e.g. `IOPin`).

Verified locally:

    $ idris2 --check src/Proven/SafeFPGA/Proofs.idr
    1/2: Building Proven.SafeFPGA
    2/2: Building Proven.SafeFPGA.Proofs
    rc: 0

This closes one more of the ~30 named "no Proofs.idr" gaps under #132
— and this one cleanly, with no OWED debt.

Refs metadatastician/standards#124, metadatastician/standards#132.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@@ -0,0 +1,168 @@
-- SPDX-License-Identifier: PMPL-1.0-or-later
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 297 issues detected

Severity Count
🔴 Critical 182
🟠 High 18
🟡 Medium 97

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/benchmarks/test_benchmarks.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_email.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_retry.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_math.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_uuid.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_header.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_content_type.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath merged commit 90b2755 into main May 20, 2026
12 of 20 checks passed
@hyperpolymath
hyperpolymath deleted the proof-debt/standards-132-safefpga branch May 20, 2026 12:03
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 298 issues detected

Severity Count
🔴 Critical 183
🟠 High 18
🟡 Medium 97

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/benchmarks/test_benchmarks.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_email.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_retry.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_math.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_uuid.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_header.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "Python file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/proven/proven/bindings/python/proven/safe_content_type.py",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants