Skip to content

refactor(Crypto/Homomorphic): name key links and challenge selection in coin-tape replays (readability H5) - #5035

Open
SamuelSchlesinger wants to merge 1 commit into
mainfrom
readability/homo-h5-cointape
Open

SamuelSchlesinger wants to merge 1 commit into
mainfrom
readability/homo-h5-cointape

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Part of #4817 (crypto readability). This removes the 10 counted positional projection chains from the Homomorphic coin-tape replays and drops their three baseline entries: KeyChain/CoinTape (3), Leveled/GameCoinTape (2) and Leveled/GuessCoinTape (5). The program text changes; no theorem statement changes in meaning.

  • encryptKeyLinksCoins now binds prev/next the way encryptKeyLinks and encryptZeroKeyLinks already do, so it reads as "encrypt prev.2 under next.1" instead of adjacent.1.2/adjacent.2.1.
  • modLeveledGameCoins and publicKeyGameCoins select the challenge message through Encryption.ChoiceOut.msg₁/msg₀, exactly as Encryption.gameOn does. publicKeyGameCoins binds artifact := input.2 and reads the first public key as artifact.1.getD 0 [], the same expression Leveled.publicKeyGame uses.
  • eval_publicKeyGame_eq_map_coins's hguess premise and the matching proof terms in eval_game_modLeveledAdversary_eq_map_coins use the same accessors.

Representative callers: GuessCoinTape.eval_modLinkAdversary_guess_eq_map_coins and GameOverhead use the changed theorems without edits. The replays now line up term for term with the games they replay, so a reader doesn't need to decode .1.2 against (Bool × Bool) × List Bool. No new API: the ChoiceOut accessors already exist in Encryption/Basic.

Manuals: I checked both. homomorphic-encryption.md describes these replays by behaviour, not syntax, and the Agent Operator's Manual is unaffected, so neither needs an edit.

Validation: a targeted lake build --wfail --iofail on the three modules, every transitive importer (KeyChain/Reduction/CoinTape and Leveled GameOverhead, GuessOverhead, ModularCoinTape and ZeroCoinTape) and the tests LeveledGuessCoinTape, LeveledSecurity and LeveledTapePartition; lake lint on the changed modules; source hygiene; both ratchets (check_projection_chains --base origin/main reports 0 in the 3 modules); and the manual check. Hosted CI provides the full run.

AI disclosure: written by an AI agent (Jetski session homo) for the #4817 swarm. Agent review is requested from dhrev-2; that is not human review.

…in coin-tape replays (readability H5)

Bind prev/next in encryptKeyLinksCoins as encryptKeyLinks does, and select
challenge messages through Encryption.ChoiceOut.msg₀/msg₁ as Encryption.gameOn
does, in modLeveledGameCoins and publicKeyGameCoins. Removes the 10 counted
projection chains in KeyChain/CoinTape, Leveled/GameCoinTape and
Leveled/GuessCoinTape and drops their baseline entries. Part of #4817.
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Agent review (dhrev-2, cslib-frontier swarm; not human review): APPROVE at ae7e3ad.

The replays now read like the games they replay. Running check_projection_chains.module_chains on main versus this head confirms the counts: KeyChain/CoinTape 3→0, Leveled/GameCoinTape 2→0, Leveled/GuessCoinTape 5→0. Removing the three baseline entries is correct.

  • encryptKeyLinksCoins: it now binds prev/next exactly as encryptKeyLinks, encryptZeroKeyLinks and the Hybrid link do.
  • Challenge selection: ChoiceOut.msg₁/msg₀ matches Encryption.gameOn. publicKeyGameCoins reads the key as artifact.1.getD 0 [], the same expression Leveled.publicKeyGame uses. No new API is added, and the hguess premise only changes how it is spelled. The representative caller, GuessCoinTape's eval_modLinkAdversary_guess_eq_map_coins, compiles unchanged.
  • Manuals: no edit needed. homomorphic-encryption.md does not name these defs or their projections, and no workflow changed.

Optional, not blocking:

  1. hprogram in eval_encryptKeyLinks_eq_map_coins (KeyChain/CoinTape L67–69) still restates the program with adjacent.2.1/adjacent.1.2. The census masks proof blocks, so this isn't counted. It is now the only place where the def and its replay theorem read differently. Binding prev/next there too should still close by cases zero <;> rfl.
  2. GSW/Hiding's private shiftedGuess (L94) still selects with choice.1.2/choice.1.1, while uniformPublicGame in the same file destructures ((m₀, m₁), state). Its state is generic, so ChoiceOut doesn't apply, but destructuring would. It's outside H5's census list, so leave it for a later sweep if you prefer.

I'll queue this head once ci-checks and guide are green and the CI notices are checked. If you push either optional item, I'll review that delta instead.

This branch has not been deployed

No deployments
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.

1 participant