绑定与能力分析¶
oracq.infrastructure.linking
Gap analysis of open oracles, partial binding and QRAM captured resource promotion.
- class oracq.infrastructure.linking.OracleRequirement(name, paradigm, path, registers, attributes)[源代码]¶
基类:
objectDescribe an unimplemented open oracle declaration and its call sites.
- 变量:
name (str) -- module name of the open declaration, i.e. the slot name used at binding time.
paradigm (str) --
oracle_paradigmparadigm designated by the declaration.path (tuple[str, ...]) -- sequence of module names along the shortest call path from the entry module to the declaration.
registers (tuple) -- formal register signature tuple of the declaration.
attributes (tuple) -- attribute entry tuple of the declaration, each a key-value pair.
- name¶
- paradigm¶
- path¶
- registers¶
- attributes¶
- class oracq.infrastructure.linking.Binding(operation, resources=None)[源代码]¶
基类:
objectBind an open declaration slot to an implementing operation, optionally carrying a QRAM resource mapping.
- 变量:
operation (oracq.infrastructure.builder.Operation) --
Operationproviding the implementation; its module name must differ from the declaration slot name.resources (dict[str, str] | None) -- mapping from the implementation's formal resource parameters to entry logical resource names; resources not explicitly covered are auto-captured as
slot name__resource nameand promoted to entry resources.
- operation¶
- resources = None¶
- class oracq.infrastructure.linking.BindingIssue(code, path, expected, actual, message)[源代码]¶
基类:
objectStructured reason for a binding failure; makes no claim of proving the oracle's mathematical semantics.
- code¶
- path¶
- expected¶
- actual¶
- message¶
- exception oracq.infrastructure.linking.BindingError(issues)[源代码]¶
-
Binding diagnostic that remains compatible with ValidationError.
- class oracq.infrastructure.linking.BindingReport(source_digest, result_digest, bindings, resource_mappings, remaining, resources, issues=())[源代码]¶
基类:
objectBinding manifest, program fingerprints and remaining dependencies; stores only exchangeable data.
- source_digest¶
- result_digest¶
- bindings¶
- resource_mappings¶
- remaining¶
- resources¶
- issues = ()¶
- property ok¶
Whether this binding passed the structural checks; does not require every slot to be closed.
- class oracq.infrastructure.linking.BindingResult(program, report)[源代码]¶
基类:
objectProgram and report of one binding, avoiding a second linking pass after checking.
- program¶
- report¶
- oracq.infrastructure.linking.bind_with_report(program, bindings)[源代码]¶
Perform one pure-functional binding, returning a directly usable program plus a traceable report.
Invalid input programs are still rejected by validate; binding errors of candidate implementations are recorded in the report. Data contents are not part of the RIR fingerprint, and run records must identify the QRAM data snapshot separately.
- oracq.infrastructure.linking.calls(nodes)[源代码]¶
Yield all module call nodes in an instruction body, including nested structure blocks, in order of appearance.
- 参数:
nodes -- instruction body to scan;
Noneor an empty tuple is treated as no content.- 返回:
Callnodes lazily yielded in order of appearance, including inside nested blocks.- 返回类型:
Iterator[Call]
- oracq.infrastructure.linking.stores(nodes)[源代码]¶
List all Store side effects in an instruction body, including nested structure blocks.
- 参数:
nodes -- instruction body to scan;
Noneor an empty tuple is treated as no content.- 返回:
Storenodes lazily yielded in order of appearance, including inside nested blocks.- 返回类型:
Iterator[Store]
- oracq.infrastructure.linking.uses_store(program)[源代码]¶
Whether a QRAM random write exists in any entry-reachable module.
- 参数:
program -- RIR program to check, traversed from the entry along the call graph.
- 返回:
True when any entry-reachable module body contains a
Storenode.- 返回类型:
bool
- oracq.infrastructure.linking.unresolved(program)[源代码]¶
List structurally reachable unimplemented declarations from the entry, with the first shortest call path for each.
- 参数:
program -- RIR program to analyze; structural validation runs first.
- 返回:
list of open declaration requirements sorted by declaration name, each recording the first shortest call path from the entry.
- 返回类型:
tuple[OracleRequirement, ...]
- oracq.infrastructure.linking.capability_table(program)[源代码]¶
Derive the transformation capabilities of all modules in one traversal.
- 参数:
program -- RIR program to analyze, traversing all its modules.
- 返回:
mapping from module names to capability dicts; modules containing
Storeside effects have all capabilities False.- 返回类型:
dict[str, dict[str, bool]]
- oracq.infrastructure.linking.capabilities(program, key=None)[源代码]¶
Return the transformation capability dict of a given module, the entry by default.
Capability values are derived by conservatively conjoining the module declaration with the capabilities of called modules; see
capability_table.- 参数:
program --
Programto analyze.key -- target module name; the entry module is used when omitted.
- 返回:
boolean dict keyed by
supports_adjointandsupports_controlled.- 返回类型:
dict
- oracq.infrastructure.linking.bind(program, bindings)[源代码]¶
Bind declared slots; newly added QRAM resources are promoted explicitly along the module graph, and other slots may stay open.
- 参数:
program --
ProgramorOperationcontaining open declaration slots.bindings -- mapping from declaration slot names to
Bindingor a bareOperation.
- 返回:
revalidated program after binding and promoting captured resources; untouched slots stay open.
- 返回类型: