Binary word presentation of typed UC interfaces #
Library infrastructure toward #6043 and #8377 (no cited result): typed UC machines and environments
communicate over indexed query-reply specifications E : ι → Type (partySpec, netSpec,
protocolSpec, execSpec), whereas WordOracleComp and IsOraclePPTOn execute on finite channel
tags carrying List Bool payloads. This module supplies the lowering from typed ProbOracleComp
programs to WordOracleComp programs over finitely many channels, together with the dual encoded
oracle, canonical-request normalizer, and strict oracle PPT preservation certificates.
Modelling decisions and restrictions #
- Named structures.
WordPortpackages total polynomial-time decoders for queries and replies on a singlenetSpec Q Rport, andWordInterfacepackages channel routing, total query/reply decoding, and per-channel normalization cost certificates (replyNormalize,requestNormalize). - Relation to
Cslib.OracleCodecand off-image requests.WordInterface.toOracleCodecbuilds a partialOracleCodec I.Channel ι EwhosedecodeQueryrecognizes valid(I.channel q, I.request q)requests.WordInterface.encodeOraclenormalizes each incoming word withI.requestNormalizeand delegates toI.toOracleCodec.wordOracle; byI.request_decodeQuery, the normalized pair is the encoded query ofI.decodeQuery cw.1 cw.2, so off-image requests still calloracleonce (WordInterface.encodeOracle_apply), while canonical requests agree directly withI.toOracleCodec.wordOracle(WordInterface.encodeOracle_eq_wordOracle). Conversely,WordInterface.normalizeRequestsrewrites every query(c, w)of an arbitrary word program to(c, I.requestNormalize c w), so interacting withI.encodeOracle oraclehas the exact same joint output and oracle-state law as running the canonicalized program againstI.toOracleCodec.wordOracle(which leaves oracle state unchanged on off-image requests) (WordInterface.runWith_encodeOracle_eq_wordOracle_normalizeRequests), while preserving strict oracle PPT (WordInterface.isOraclePPTOn_normalizeRequests) without extra reply-length bounds. Total request/reply decoders and the finiteChannelnormalization certificates (replyNormalize,requestNormalize) are needed so a word machine can normalize arbitrary incoming or outgoing words in polynomial time. - Nonempty party rank (
n ≥ 1,[NeZero n]).n ≥ 1is intrinsic to any total partyWordPort (Fin n × In) (Option Out), not merely the standard constructorWordPort.party, sinceparty.queryDecoder.decode []must inhabitFin n × In. (WordPort.partyencodes party indices in unary and decodes arbitrary words modulonunder[NeZero n].) An empty corruption setC = ∅at positivenis distinct and covered. - Interface coverage. The constructors
WordInterface.empty,WordInterface.net, andWordInterface.sumcoverOracleSpec.empty,netSpec, and⊕ₒ, which suffices forExecution,Composition, andDummyAdversary. Dependent-reply interfaces such asSSP.sessionSpec(MultiSession) are not covered here. - Explicit reply truncation (
limit).ProbOracleComp.lowerWith I limitisProbOracleComp.simulate (I.lowerQuery limit): it truncates each word reply tolimitbits viaList.take limitbefore decoding, matching the strict clock contract ofIsOraclePPTOn.query_take. Structural equations come directly fromProbOracleComp.simulate_*. When every reply of a typed stateful oracle encodes withinlimitbits,ProbOracleComp.runWith_lowerWithequates the lowered word run againstI.encodeOracle oraclewith the original typed run.
Main definitions #
Cslib.Crypto.Protocols.UC.WordPort: total query and reply decoders for anetSpecport.Cslib.Crypto.Protocols.UC.WordInterface: finite-channel word presentation of a typed interface.Cslib.Crypto.Protocols.UC.WordInterface.empty,.net,.sum,.protocol,.exec,WordPort.sum,WordPort.party: constructors and UC interface abbreviations.Cslib.Crypto.Protocols.UC.WordInterface.toOracleCodec,.encodeOracle,.lowerQuery,.normalizeRequests:OracleCodecview, total channel-encoded oracle, single-query lowering handler, and canonical-request normalizer.Cslib.ProbOracleComp.lowerWith: lower a typedProbOracleCompviaProbOracleComp.simulate (I.lowerQuery limit).
Main results #
Cslib.Crypto.Protocols.UC.WordInterface.encodeOracle_apply: stateful evaluation ofencodeOracleviatoOracleCodec.wordOracleat the normalized request.Cslib.Crypto.Protocols.UC.WordInterface.encodeOracle_eq_wordOracle: agreement withtoOracleCodec.wordOracleon encoded requests.Cslib.Crypto.Protocols.UC.WordInterface.encodeOracle_sum: encoded sum-interface routing.Cslib.Crypto.Protocols.UC.WordInterface.runWith_lowerQueryandCslib.ProbOracleComp.runWith_lowerWith: lowered execution agrees with typed execution when every supported reply fits withinlimitbits.Cslib.Crypto.Protocols.UC.WordPort.computable_partyIndex:WordPort.partyexposes the decoded party index in polynomial time.Cslib.Crypto.Protocols.UC.WordInterface.isOraclePPTOn_lowerWith_queryandCslib.Crypto.Protocols.UC.WordInterface.isOraclePPTOn_lowerWith_decodeQuery: lowered, re-encoded queries (and decoded(channel, word)queries) are uniform strict oracle PPT when their channel, request/word, and reply bound are polynomial time.Cslib.Crypto.Protocols.UC.WordInterface.runWith_encodeOracle_eq_wordOracle_normalizeRequests: running any word program againstI.encodeOracle oraclehas the same joint output and state law as runningI.normalizeRequests programagainstI.toOracleCodec.wordOracle oracle(which leaves oracle state unchanged on off-image requests).Cslib.Crypto.Protocols.UC.WordInterface.queriesSatisfy_normalizeRequests,Cslib.Crypto.Protocols.UC.WordInterface.normalizeRequests_idempotent, andCslib.Crypto.Protocols.UC.WordInterface.normalizeRequests_lowerWith: normalized programs issue only canonical requests, normalization is idempotent, and lowered programs are fixed points.Cslib.Crypto.Protocols.UC.WordInterface.isOraclePPTOn_normalizeRequests: canonical-request normalization preserves uniform strict oracle PPT for arbitrary word adversaries.
Library construction (no cited definition): a binary presentation of one typed port
netSpec Q R packaging total decoders for its queries and replies. Because queryDecoder.decode []
must inhabit Q, any total party port WordPort (Fin n × In) (Option Out) intrinsically requires
n ≥ 1 (not merely the WordPort.party constructor), whereas an empty corruption set C = ∅ at
positive n is distinct and covered.
Injection from typed queries to bit words.
- queryDecoder : Turing.MultiTapeTM.Decoder self.query
Total polynomial-time decoder for queries.
Injection from typed replies to bit words.
- replyDecoder : Turing.MultiTapeTM.Decoder self.reply
Total polynomial-time decoder for replies.
Library construction (no cited definition): a typed interface presented over finitely many word channels.
- Channel : Type
Finite tag type identifying the interface's word channels.
- decEq : DecidableEq self.Channel
- channel : ι → self.Channel
Channel carrying each typed query.
Encoded request word for each typed query.
Total decoder recovering a typed query from a channel and request word.
Query-dependent injection from typed replies to bit words.
Total decoder recovering a typed reply from a word.
Decoding a reply word and re-encoding it is one polynomial-time word map per channel.
- reply_decodeReply (q : ι) (w : List Bool) : (self.reply q) (self.decodeReply q w) = self.replyNormalize (self.channel q) w
- computable_replyNormalize : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : self.Channel × List Bool) => self.replyNormalize c.1 c.2) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encFinite self.Channel) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits
The same normalization cost certificate for requests.
- request_decodeQuery (c : self.Channel) (w : List Bool) : self.channel (self.decodeQuery c w) = c ∧ self.request (self.decodeQuery c w) = self.requestNormalize c w
- computable_requestNormalize : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : self.Channel × List Bool) => self.requestNormalize c.1 c.2) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encFinite self.Channel) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits
Library infrastructure: word presentation of the empty interface OracleSpec.empty.
Library infrastructure: word presentation of a single typed port netSpec Q R.
Library infrastructure: disjoint sum of two typed word interfaces.
Library construction (no cited definition): word interface for a UC protocol
protocolSpec n In Out NetQ NetR.
Library construction (no cited definition): word interface for a UC execution environment
execSpec n In Out AdvQ AdvR.
Library infrastructure (no cited result): view a WordInterface as a partial OracleCodec
that accepts exactly canonical (I.channel q, I.request q) pairs.
Library infrastructure (no cited result): present a typed stateful oracle on I.Channel by
routing through I.toOracleCodec.wordOracle at the I.requestNormalize-normalized request.
Unlike calling I.toOracleCodec.wordOracle directly (which answers off-image requests with []
without querying oracle), encodeOracle normalizes every request to
I.toOracleCodec.encodeQuery (I.decodeQuery cw.1 cw.2) via I.request_decodeQuery and calls
oracle once (encodeOracle_apply); both agree on encoded requests (encodeOracle_eq_wordOracle).
Library infrastructure (no cited result): stateful equation for I.encodeOracle oracle on any
(c, w) and state s, obtained by normalizing (c, w) via I.request_decodeQuery and applying
OracleCodec.wordOracle_encodeQuery.
Library infrastructure (no cited result): I.requestNormalize fixes every canonical request
word I.request q on its channel I.channel q.
Library infrastructure (no cited result): I.requestNormalize is idempotent on every channel
and word.
Library infrastructure (no cited result): on every canonical query request
(I.channel q, I.request q), the total channel-encoded oracle agrees with
I.toOracleCodec.wordOracle. Off-image requests differ: encodeOracle normalizes the request via
I.requestNormalize before delegating to I.toOracleCodec.wordOracle and therefore still calls
oracle on I.decodeQuery, whereas OracleCodec.wordOracle directly returns [].
Library infrastructure (no cited result): the encoded oracle of a sum interface routes left and right channel requests to the respective component encoded oracles.
Library infrastructure: lower a single typed query to its channel request with reply
truncation to limit bits and decoding.
Library infrastructure: running a single lowered query against I.encodeOracle oracle agrees
with running oracle when every supported reply fits in limit bits.
Library construction (no cited definition): party-port word presentation for n ≥ 1
([NeZero n]) parties, encoding party indices in unary and decoding arbitrary words modulo n.
Library infrastructure (no cited result): WordPort.party input exposes the decoded party
index Fin n in polynomial time.
Library construction (no cited definition): lower a typed program ProbOracleComp E α to a
word program over I.Channel via ProbOracleComp.simulate (I.lowerQuery limit), keeping private
samples private and truncating each word reply to limit bits before decoding.
Library infrastructure (no cited result): a typed program lowered with reply bound limit has
the joint law of the typed program against every typed stateful oracle whose encoded replies fit in
limit bits.
Library infrastructure (no cited result): one lowered typed query, re-encoded, is uniform
strict oracle PPT on I.Channel when its channel, request, and reply bound are computed in
polynomial time. This consumes the replyNormalize and computable_replyNormalize interface
certificates.
Library infrastructure (no cited result): a lowered, re-encoded decoded query
I.decodeQuery (ch a) (word a) is uniform strict oracle PPT when its channel, request word, and
reply bound are computable in polynomial time.
Canonical-request normalizer #
Rewrite every external word query (c, w) of a word program to its canonical representative
(c, I.requestNormalize c w), preserving private coin draws and returning oracle replies
verbatim.
Request normalization preserves returned values.
Request normalization distributes over bind.
Request normalization commutes with mapping.
Request normalization preserves private samples.
Request normalization rewrites a single query (c, w) to (c, I.requestNormalize c w).
Interacting with the total normalized oracle I.encodeOracle oracle produces the exact same
joint output and oracle-state distribution as running I.normalizeRequests program against
I.toOracleCodec.wordOracle oracle (which leaves oracle state unchanged on off-image requests),
for every word program (including off-image queries).
Interacting with I.encodeOracle oracle produces the same joint output and oracle-state law as
running the typed adaptation I.toOracleCodec.adapt (I.normalizeRequests program) directly against
oracle.
Every external query issued by I.normalizeRequests program is a canonical
(I.channel q, I.request q) pair.
Any word program whose queries are already canonical is fixed identically by
I.normalizeRequests.
Canonical-request normalization is idempotent.
Every external query issued by a lowered typed program program.lowerWith I limit is
canonical.
Lowered typed programs are already canonical and therefore fixed by I.normalizeRequests.
For any word program whose queries are all canonical, I.encodeOracle oracle and
I.toOracleCodec.wordOracle oracle induce the same joint output and oracle-state law.
Canonical-request normalization preserves external query budgets.
Canonical-request normalization preserves uniform strict oracle PPT for arbitrary word
adversaries, with no extra reply-length assumption: a polynomial-time realizing machine running for
T steps cannot inspect beyond the first T bits of any oracle reply
(Turing.MultiTapePTM.runOracle_eq_simulate_take), so normalizing each request and taking T
reply bits realizes I.normalizeRequests identically against every stateful external oracle.