HUB
Sign inSign up
quantumoracles-lab logo

credkellar/quantumoracles-lab

By credkellar

โ€ขUpdated 17 days ago

QuantumOracles-Lab: oracle algorithms lab - DJ, BV, Grover, Simon, queries counted. Sim!!!

Image
Machine learning & AI
Developer tools
Data science
1

151

credkellar/quantumoracles-lab repository overview

โ QuantumOracles-Lab ๐Ÿ”ฎโš›๏ธ

Quantum Oracle Algorithms Lab โ€” by Darion Kellar

Educational quantum oracle algorithms lab in ONE pure-Python file: a from-scratch statevector simulator (2^n complex amplitudes, exact arithmetic, no sampling noise) running the four textbook oracle algorithms with every oracle call COUNTED on both sides. Deutsch-Jozsa decides constant vs balanced in exactly 1 quantum query for n = 1..6, against a classical worst case of 2^(n-1) + 1 counted on constant and adversarial instances (17 at n = 5, 33 at n = 6). Bernstein-Vazirani recovers the hidden string in exactly 1 query against exactly n classical queries, counted by reading the unit vectors. Grover's success probability is MEASURED from the simulator across iterations at N = 16 โ€” 0.062500, 0.472656, 0.908447, peak 0.961319 at k = 3 = round(pi/4 * sqrt(N)) โ€” and the overshoot is printed, not hidden: P falls to 0.581704 at k = 4 and 0.125492 at k = 5, against a classical expected 8.5 queries counted over every marked position ((N+1)/2, about N/2). Simon's hidden period (n = 4, s = 1011) is recovered by real GF(2) Gaussian elimination over the sampled equations in 5 quantum queries vs 9 counted classical collision queries. A query ledger prints both counts and the ratio for all four, and a from-scratch kNN classifier identifies the problem family from the lab's own run signatures.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: these are query-complexity statements about the ORACLE MODEL โ€” one query is one black-box unitary a real machine would have to build from gates, on promised problems built for provable gaps. They are NOT practical speedup claims: the simulator itself is classical and exponential (2^n amplitudes, stated wherever a size is printed), no quantum hardware was touched, and Simon's measurement outcomes are enumerated in a fixed rotating order in place of random sampling (labelled in the report; each run still costs exactly 1 query). Every crypto-breaking / password-cracking / production / hardware / real-world-speedup claim is a permanent HOLD gate (14 total).

โ ๐Ÿงฐ Tech Stack Badges & Full Architecture Tech Stack

โ ๐Ÿ’ป Core Programming Languages & Core Systems

Python Stdlib Only Network Deterministic License Deutsch-Jozsa Grover Simon

  • ๐Ÿ Python 3.12, pure standard library (math, hashlib, json, sys) โ€” zero dependencies, zero network, deterministic (double-run byte-identical)
  • ๐Ÿ”ฎ Statevector simulator core: H / X / Z / CNOT applied by index arithmetic on 2^n complex amplitudes, oracle unitaries as exact permutations / phase flips, diffusion as inversion about the mean โ€” every probability asserted against its analytic value in CHECKS
  • ๐Ÿ”ข GF(2) linear algebra from scratch: Gaussian elimination to reduced row echelon form, null-space extraction for Simon's post-processing
  • ๐Ÿง  TinyML kNN problem-family classifier (from scratch, stdlib): deutsch-jozsa / bernstein-vazirani / grover / simon from query counts + success probability + output structure
  • ๐Ÿช‘ Council seats: Gemini Argon 4 DECIDER (names-only, tighten-only) + Muse advisor (never overrides HOLD) + Google Flow plan-only (rendered = False, live = 0)
โ โ›“๏ธ Web3 & Infrastructure
  • ๐Ÿšซ Not applicable โ€” honestly. No blockchain, no Web3, no tokens: the "infrastructure" in this lab is one offline file holding a simulated quantum register, four oracle circuits, and a paper query ledger. No fake badges here.
โ โš™๏ธ Platform Support & Hardware Architecture

Linux macOS Windows

  • ๐Ÿ–ฅ๏ธ Pure Python โ€” runs anywhere Python 3.12+ runs (Linux, macOS, Windows), plus the python:3.12-slim Docker image
  • ๐Ÿ”’ No quantum hardware is touched, ever: real QPUs, cloud quantum services, and hardware benchmarks are permanent HOLD gates (see the gate table below)
โ โšก Low-Level Infrastructure & Performance
  • ๐Ÿšซ No low-level code โ€” honestly. No C, no C++, no GPU, no compiled extensions: this is one interpreted Python file on purpose, so every amplitude can be read, checked, and diffed. Performance here means honest counting โ€” the simulator's own cost is the lesson: 2^n amplitudes, exponential in n, printed wherever a size appears.
โ ๐Ÿ› ๏ธ DevOps & Build Tools

Docker GitHub Actions pytest Git

  • ๐Ÿณ Docker (python:3.12-slim), GitHub Actions CI + Docker Publish (delivered in the paste pack)
  • ๐ŸŽฏ Target image: credkellar/quantumoracles-lab:latest
  • ๐Ÿงช Tests: pytest (55 tests) + the built-in CHECKS suite (42 checks) in main.py
โ โ˜๏ธ Cloud Providers
  • ๐Ÿšซ None โ€” honestly. No cloud provider is used or needed: the lab runs fully offline on your own machine or in a local Docker container. Docker Hub appears only as the registry the publish workflow pushes the image to.

โ ๐Ÿณ Quick start

docker pull credkellar/quantumoracles-lab:latest
docker run --rm credkellar/quantumoracles-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 42/42).

Run a specific command instead:

docker run --rm credkellar/quantumoracles-lab:latest python3 main.py checks   # CHECKS 42/42
docker run --rm credkellar/quantumoracles-lab:latest python3 main.py dj       # Deutsch-Jozsa report at n=5 (JSON)
docker run --rm credkellar/quantumoracles-lab:latest python3 main.py bv       # Bernstein-Vazirani n=6, s=101101 (JSON)
docker run --rm credkellar/quantumoracles-lab:latest python3 main.py grover   # Grover table at N=16 (JSON)
docker run --rm credkellar/quantumoracles-lab:latest python3 main.py simon    # Simon recovery report (JSON)
docker run --rm credkellar/quantumoracles-lab:latest python3 main.py ledger   # the query ledger (JSON)
docker run --rm credkellar/quantumoracles-lab:latest python3 main.py classify # kNN problem-family classifier report
docker run --rm credkellar/quantumoracles-lab:latest python3 main.py holds    # 14 HOLD gates

โ ๐Ÿ”ฌ What's inside

  • Statevector simulator, from scratch โ€” H / X / Z / CNOT by index arithmetic, norm asserted after a mixed gate sequence, Bell state probabilities exactly 0.5 / 0.5, CNOT truth table verified on all four basis states.
  • Deutsch-Jozsa, exactly 1 query โ€” phase kickback onto an ancilla in |->; the all-zero probability is exactly 1.0 for constant and exactly 0.0 for balanced at every n = 1..6; the classical worst case 2^(n-1) + 1 is counted, not quoted, on constant AND adversarial balanced instances.
  • Bernstein-Vazirani, exactly 1 query โ€” the hidden string (up to n = 6, e.g. s = 101101) is recovered with probability exactly 1.0; the classical baseline reads one bit per query and is counted at exactly n.
  • Grover, measured not quoted โ€” P(k) read off the simulated state at every k and checked against sin^2((2k + 1) theta) to 2e-6; the measured peak sits at the formula k for N = 8, 16, 32, 64, and the post-peak fall (overshoot) is a first-class table row.
  • Simon with real post-processing โ€” f(x) = min(x, x ^ s) is proven two-to-one in the checks; sampled equations y . s = 0 are solved by from-scratch GF(2) Gaussian elimination (null space), recovering s = 1011 at n = 4 in 5 runs.
  • Query ledger โ€” DJ 1 vs 17, BV 1 vs 6, Grover 3 vs 8.5, Simon 5 vs 9, each with its classical counting method named and the fine print attached: oracle-model statement, not a practical speedup claim.
  • TinyML kNN classifier โ€” deutsch-jozsa / bernstein-vazirani / grover / simon from (quantum queries, success probability, classical queries, output structure, exactness); the training grid is generated by running the lab's own algorithms, and the grid is self-consistent under the classifier.
  • Advisory seats โ€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

โ โœ… Verified

  • pytest: 55 passed
  • Built-in checks: CHECKS 42/42
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

โ ๐Ÿท๏ธ Categories

Science ยท Developer tools ยท Machine learning & AI

  • License: MIT ยฉ 2026 Darion Kellar
  • Image: credkellar/quantumoracles-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:c3f25f1baโ€ฆ
Size
41.5 MB
Last updated
17 days ago
docker pull credkellar/quantumoracles-lab:latest