diff --git a/.github/workflows/nor25-uniform-reserve-lean.yml b/.github/workflows/nor25-uniform-reserve-lean.yml new file mode 100644 index 00000000..d36b282c --- /dev/null +++ b/.github/workflows/nor25-uniform-reserve-lean.yml @@ -0,0 +1,47 @@ +name: NOR-25 exact robust uniform reserve and informed-evasion Lean kernel + +on: + push: + paths: + - 'MathCan/NOR25UniformReserve.lean' + - 'MathCan.lean' + - 'research/nor25/**' + - '.github/workflows/nor25-uniform-reserve-lean.yml' + pull_request: + paths: + - 'MathCan/NOR25UniformReserve.lean' + - 'MathCan.lean' + - 'research/nor25/**' + - '.github/workflows/nor25-uniform-reserve-lean.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + exact-two-stage-counts-and-transcript-axioms: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - uses: leanprover/lean-action@v1 + with: + auto-config: false + build: true + build-args: MathCan + test: false + lint: false + use-mathlib-cache: false + - name: Kernel check exact counts, rejection monotonicity and schedule-visible evasion + shell: bash + run: | + set -euo pipefail + lake env lean MathCan/NOR25UniformReserve.lean | tee nor25-uniform-reserve-axioms.txt + if grep -Eq 'sorryAx|ofReduceBool|^error:|admit' nor25-uniform-reserve-axioms.txt; then + echo 'NOR25 unexpected admission, reduction marker or Lean error' + exit 1 + fi + - uses: actions/upload-artifact@v4 + with: + name: nor25-uniform-reserve-kernel-axiom-inventory + path: nor25-uniform-reserve-axioms.txt diff --git a/MathCan.lean b/MathCan.lean index 863730b0..a869a748 100644 --- a/MathCan.lean +++ b/MathCan.lean @@ -107,3 +107,5 @@ import MathCan.NOR22ModularFutureCommitments import MathCan.NOR23CoordinateAudit import MathCan.NOR24SequentialWitness + +import MathCan.NOR25UniformReserve diff --git a/MathCan/NOR25UniformReserve.lean b/MathCan/NOR25UniformReserve.lean new file mode 100644 index 00000000..fd3bf0cd --- /dev/null +++ b/MathCan/NOR25UniformReserve.lean @@ -0,0 +1,156 @@ +import MathCan.NOR24SequentialWitness + +/-! +# NOR-25: exact two-stage uniform-reserve audit and schedule-visible evasion + +A finite verifier uses an arbitrary public-risk coordinate prefix followed +by an independently sampled uniform subset of the previously unchecked +coordinates. Condition on whether an attack touched the risk prefix. + +For any fixed residual Boolean alteration mask, an undetected uniform +size-u reserve can select only unchanged positions. The exact number of +missed reserve schedules is C(N-r,u), where N is the length of that residual +mask and r is its number of true (altered) positions. The total number of +reserve schedules is C(N,u). An alteration in the targeted prefix already +makes the audit reject. + +The formal statements concern finite enumeration, exact transcript values +and detectability. The interpretation as a probability uses idealized +uniform sampling independent of the attack, rather than public pseudorandom +seeds. A schedule-informed adversary can choose an unchecked difference. +-/ + +namespace MathCan.NOR25UniformReserve + +universe u +variable {Coordinate : Type u} + +abbrev binomial := MathCan.NOR23CoordinateAudit.binomial + +/-- Whether the risk-targeted prefix has already encountered any +changed coefficient. The remaining mask indexes only unchecked positions. -/ +def missedReserveCount + (targetedHit : Bool) (remaining : List Bool) (reserve : Nat) : Nat := + if targetedHit then 0 + else (MathCan.NOR23CoordinateAudit.kSubsets (remaining.filter (fun modified => !modified)) reserve).length + +/-- Each size-u position-subset of unchecked positions is an equally +likely audit schedule under ideal uniform sampling without replacement. -/ +def allReserveCount (remaining : List Bool) (reserve : Nat) : Nat := + (MathCan.NOR23CoordinateAudit.kSubsets remaining reserve).length + +/-- Exact numerator and denominator for any fixed attack after a +public-risk prefix. When the prefix hit, the miss numerator is zero. +Otherwise it is the hypergeometric C(N-r,u) count from the residual mask. -/ +theorem exact_two_stage_blind_count + (targetedHit : Bool) (remaining : List Bool) (reserve : Nat) : + (missedReserveCount targetedHit remaining reserve, + allReserveCount remaining reserve) = + (if targetedHit then 0 + else binomial + (remaining.length - + (remaining.filter (fun modified => modified)).length) + reserve, + binomial remaining.length reserve) := by + cases targetedHit with + | false => + change + ((MathCan.NOR23CoordinateAudit.kSubsets + (remaining.filter (fun modified => !modified)) reserve).length, + (MathCan.NOR23CoordinateAudit.kSubsets remaining reserve).length) = + (binomial + (remaining.length - + (remaining.filter (fun modified => modified)).length) reserve, + binomial remaining.length reserve) + apply Prod.ext + · exact MathCan.NOR23CoordinateAudit.fixed_attack_undetected_challenge_count + remaining reserve + · exact MathCan.NOR23CoordinateAudit.total_k_coordinate_challenges + remaining reserve + | true => + change + (0, (MathCan.NOR23CoordinateAudit.kSubsets remaining reserve).length) = + (0, binomial remaining.length reserve) + apply Prod.ext + · rfl + · exact MathCan.NOR23CoordinateAudit.total_k_coordinate_challenges + remaining reserve + +/-- Choosing an audit prefix that already intersects the changed set +forces the two-stage verifier's no-hit count to vanish for every reserve. -/ +theorem targeted_detection_is_certain + (remaining : List Bool) (reserve : Nat) : + missedReserveCount true remaining reserve = 0 := by + rfl + +/-- Adding an independent uniform reserve never increases the number +of missed schedules above the fixed-residual hypergeometric numerator. -/ +theorem uniform_reserve_miss_count_bounded + (targetedHit : Bool) (remaining : List Bool) (reserve : Nat) : + missedReserveCount targetedHit remaining reserve ≤ + binomial + (remaining.length - + (remaining.filter (fun modified => modified)).length) + reserve := by + cases targetedHit with + | false => + simp [missedReserveCount, + MathCan.NOR23CoordinateAudit.fixed_attack_undetected_challenge_count] + | true => + simp [missedReserveCount] + +/-- Any exact mismatch found in the risk prefix remains a rejection +after appending any set of uniform exploration coordinates. -/ +theorem extending_inspections_preserves_rejection + (targeted randomReserve : List Coordinate) + (candidate target : Coordinate → Int) + (rejected : ¬ MathCan.NOR23CoordinateAudit.agreesOn targeted candidate target) : + ¬ MathCan.NOR23CoordinateAudit.agreesOn + (targeted ++ randomReserve) candidate target := by + intro accepted + apply rejected + exact MathCan.NOR23CoordinateAudit.audit_agreement_monotone + targeted (targeted ++ randomReserve) candidate target + (by intro i hi; exact List.mem_append.mpr (Or.inl hi)) + accepted + +/-- A visible changed coordinate in the targeted prefix is a +deterministic rejection independent of all subsequent random choices. -/ +theorem inspected_targeted_change_is_detected + (targeted randomReserve : List Coordinate) + (candidate target : Coordinate → Int) + (i : Coordinate) + (seen : i ∈ targeted) + (changed : candidate i ≠ target i) : + ¬ MathCan.NOR23CoordinateAudit.agreesOn + (targeted ++ randomReserve) candidate target := by + exact MathCan.NOR23CoordinateAudit.checked_disagreement_definitively_rejects + (targeted ++ randomReserve) candidate target i + (List.mem_append.mpr (Or.inl seen)) changed + +/-- The zero-security limit of revealing the realized complete schedule: +any still-unchecked coordinate allows a distinct output with the SAME +full ordered exact-value transcript. This is constructive in the model. -/ +theorem schedule_visible_attacker_has_identical_transcript + (checked : List Coordinate) + (target : Coordinate → Int) + (blindSpot : ∃ i : Coordinate, i ∉ checked) : + ∃ altered : Coordinate → Int, + altered ≠ target ∧ + MathCan.NOR24SequentialWitness.readTranscript checked target = + MathCan.NOR24SequentialWitness.readTranscript checked altered := by + obtain ⟨altered, distinct, identicalOnChecked⟩ := + MathCan.NOR23CoordinateAudit.adaptive_attacker_has_undetected_alternate_future + checked target blindSpot + refine ⟨altered, distinct, ?_⟩ + exact MathCan.NOR24SequentialWitness.checked_equal_targets_have_equal_transcripts + checked target altered identicalOnChecked + +#print axioms exact_two_stage_blind_count +#print axioms targeted_detection_is_certain +#print axioms uniform_reserve_miss_count_bounded +#print axioms extending_inspections_preserves_rejection +#print axioms inspected_targeted_change_is_detected +#print axioms schedule_visible_attacker_has_identical_transcript + +end MathCan.NOR25UniformReserve diff --git a/research/nor25/ROBUST_AUDIT_FRONTIER.md b/research/nor25/ROBUST_AUDIT_FRONTIER.md new file mode 100644 index 00000000..86134706 --- /dev/null +++ b/research/nor25/ROBUST_AUDIT_FRONTIER.md @@ -0,0 +1,43 @@ +# NOR-25: the robust uniform-reserve audit frontier + +Companion mathematics to [Compactification-Theory NOR-25](https://github.com/MoralityLabAI/Compactification-Theory/pull/193), extending MathCan's NOR-23 exact finite audit counts and NOR-24 sequential transcript indistinguishability. + +## Finite theorem + +Consider an output of m indexed coordinates, a deterministic publicly chosen targeted-risk prefix T of size t and an independent random reserve R of size u sampled uniformly among the m-t coordinates outside T. The attack set A has exactly r distinct coordinates and is fixed before drawing R. The audit checks T union R and rejects on any authentic exact mismatch. + +If A intersects T, every audit detects it. If A avoids T, the number of possible R without an altered coordinate is C(m-t-r,u), and there are C(m-t,u) equiprobable possible R. Therefore the exact fixed-blind miss probability is + + C(m-t-r,u)/C(m-t,u), + +with detection + + 1 - C(m-t-r,u)/C(m-t,u). + +Provided r<=m-t and u<=m-t, an attacker whose choice precedes the audit randomness can attain the upper miss probability by avoiding T. This establishes the exact *minimax detection floor* over all fixed radius-r attacks, for any possible targeted selector. + +The Lean proof file [NOR25UniformReserve.lean](../../MathCan/NOR25UniformReserve.lean) encodes residual changed-coordinate masks. It proves the two-stage missed/total count pair, the bound on misses when the prefix already detects an attack, and preservation of exact rejection after adding any reserve. The theorem for a schedule-informed adversary constructs a distinct hidden target with the same full witnessed transcript whenever an unchecked coordinate exists. + +## Reserve-fraction frontier + +For a fixed total k, set u=k-t. If m-k>=r>0, survival at the adversarial worst case is + + Q(u) = C(m-k+u-r,u)/C(m-k+u,u). + +The factorial ratio telescopes: + + Q(u) = PRODUCT_(j=1)^u (m-k+j-r)/(m-k+j). + +Thus Q(0)=1, Q(u+1)/Q(u)=(m-k+u+1-r)/(m-k+u+1)<1, and the minimax detection floor 1-Q(u) strictly increases with reserve size u. The strict improvement costs targeted inspections, which is why the measured in-template rate belongs to the separate prospective NOR-25 experiment. + +For the registered k=16, r=4, u=8, the exact floor is + + 1 - C(m-12,8)/C(m-8,8), + +at m=769 and 1537. Every policy constrained to a fixed risk prefix and an independent uniform reserve shares this lower bound, regardless of learned risk scores. + +## Threat-model boundary + +The guarantee quantifies over a fixed attack A chosen before the random reserve. Publicly releasing the realized sampled set changes the game: the adversary can choose a changed coordinate outside all checked positions and preserve the entire ordered exact-value transcript. The MathCan theorem makes this distinction explicit. + +This pure finite counting result assumes an honest exact-value oracle. It certifies a mathematical audit allocation property, not real-world randomness secrecy or a sound full-output proof system. The corresponding prospective empirical readouts and challenge construction are controlled by the precommitted Compactification-Theory registration.