Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,65 @@ end OpeningStepResult

namespace CanonicalOpening

/-- A verifier either audits one global response or opens one local response. -/
inductive GlobalLocalChallenge (Index : Type) where
/-- Audit the response intended to establish the global relation. -/
| global
/-- Open the response at one challenged local index. -/
| opening (index : Index)

/--
A one-round strategy commits before the challenge, then supplies separate
global and local responses. The local response function is semantic strategy
state, not a claim that its entire table is transmitted.
-/
structure SeparatedResponseStrategy
(Commitment GlobalResponse Index LocalResponse : Type) where
Comment on lines +44 to +45

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the separated model enumerable

When consumers pass SeparatedResponseStrategy and GlobalLocalChallenge directly to hasPerfectOneStepStrategy, typeclass synthesis cannot satisfy its [Fintype Proof] and [Fintype Challenge] requirements even when every component type and Index is finite, because neither new declaration provides a conditional Fintype instance. Derive or define these instances so the finite strategy model can actually be used by the executable checker without downstream orphan instances.

Useful? React with 👍 / 👎.

/-- The message fixed before the verifier reveals its challenge. -/
commitment : Commitment
/-- The response used on the global audit branch. -/
globalResponse : GlobalResponse
/-- The response used at each local opening branch. -/
localResponse : Index → LocalResponse

namespace SeparatedResponseStrategy

/-- Run the branch selected by a global-or-local challenge. -/
def run
{Commitment GlobalResponse Index LocalResponse ChildClaim : Type}
(global : Commitment → GlobalResponse → OpeningStepResult ChildClaim)
(localStep : Commitment → Index → LocalResponse → OpeningStepResult ChildClaim)
(strategy : SeparatedResponseStrategy Commitment GlobalResponse Index LocalResponse) :
GlobalLocalChallenge Index → OpeningStepResult ChildClaim
| .global => global strategy.commitment strategy.globalResponse
| .opening index => localStep strategy.commitment index (strategy.localResponse index)

/--
A separated strategy survives every challenge exactly when its global response
and every independently selectable local response are safe. This equivalence
is the response-splicing seam that a real commitment mechanism must close.
-/
theorem safeForEveryChallenge_iff

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rename the theorem using snake_case

Rename this public theorem to safe_for_every_challenge_iff; the internal camelCase phrase violates the repository's explicit naming convention for theorem names and makes the newly exported API inconsistent.

AGENTS.md reference: AGENTS.md:L67-L67

Useful? React with 👍 / 👎.

{Commitment GlobalResponse Index LocalResponse ChildClaim : Type}
(childTrue : ChildClaim → Bool)
(global : Commitment → GlobalResponse → OpeningStepResult ChildClaim)
(localStep : Commitment → Index → LocalResponse → OpeningStepResult ChildClaim)
(strategy : SeparatedResponseStrategy Commitment GlobalResponse Index LocalResponse) :
(∀ challenge, (strategy.run global localStep challenge).isSafe childTrue = true) ↔
(global strategy.commitment strategy.globalResponse).isSafe childTrue = true ∧
∀ index,
(localStep strategy.commitment index (strategy.localResponse index)).isSafe childTrue =
true := by
constructor
· intro hSafe
exact ⟨hSafe .global, fun index => hSafe (.opening index)⟩
· rintro ⟨hGlobal, hLocal⟩ challenge
cases challenge with
| global => exact hGlobal
| opening index => exact hLocal index

end SeparatedResponseStrategy

/--
One fixed proof survives every challenge without rejection or a false child.
This proposition states the semantic contract before finite enumeration.
Expand Down