78 lines
3.2 KiB
Markdown
78 lines
3.2 KiB
Markdown
# Task 15 — Curriculum module 6 (Premiers algorithmes — phase kickback)
|
|
|
|
> **Index:** [README](README.md). **Spec:** [design](../../specs/2026-04-29-quantum-tutor-design.md).
|
|
|
|
## Goal
|
|
|
|
Append module 6 (2 exercises: Bernstein-Vazirani for s='1' and a phase-kickback demonstration) to `curriculum/curriculum.json`.
|
|
|
|
> **Note vs. rev 1 of the master plan:** the original teleportation exercise required classical-controlled gates (`if (c[0]) ...`), which the v1 executor walks past silently — only `Stmt::GateCall` is handled in `executor::extract_gate_ops`. The phase-kickback exercise covers the same pedagogical territory and is executable on the v1 backend.
|
|
|
|
## Prerequisites
|
|
|
|
- Task 14 merged.
|
|
|
|
## Files
|
|
|
|
- Modify: `curriculum/curriculum.json`
|
|
|
|
## Steps
|
|
|
|
- [ ] **Step 1: Insert after module 5**
|
|
|
|
```json
|
|
,
|
|
{
|
|
"id": 6,
|
|
"title": "Premiers algorithmes quantiques",
|
|
"lessons": [
|
|
{
|
|
"id": 1,
|
|
"title": "Bernstein-Vazirani et phase kickback",
|
|
"concept": "L'algorithme de Bernstein-Vazirani retrouve une chaîne secrète en un seul appel à l'oracle. Le phase kickback est le mécanisme central : faire 'remonter' une phase d'un qubit cible vers un qubit de contrôle en superposition.",
|
|
"example_circuit": "OPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[2] q;\nbit[1] c;\nx q[1];\nh q[0];\nh q[1];\ncx q[0], q[1];\nh q[0];\nc[0] = measure q[0];",
|
|
"what_to_observe": "Bernstein-Vazirani pour s='1' : q[0] mesure toujours '1'.",
|
|
"exercises": [
|
|
{
|
|
"id": "6-1-a",
|
|
"prompt": "Bernstein-Vazirani pour s='1' : prépare l'ancilla en |−⟩ (X+H), mets q[0] en superposition (H), applique CX q[0]→q[1] (oracle pour s=1), puis H sur q[0] et mesure q[0].",
|
|
"hint": "X q[1]; H q[1]; H q[0]; CX q[0],q[1]; H q[0]; puis mesure q[0].",
|
|
"criteria": {
|
|
"required_outcomes": [{"bitstring": "1", "min_ratio": 0.99}],
|
|
"forbidden_outcomes": ["0"]
|
|
},
|
|
"feedback_pass": "Excellent ! BV retrouve s='1' en un seul appel à l'oracle.",
|
|
"feedback_fail": "Tu dois obtenir '1' avec certitude. Vérifie l'ordre : X q[1]; H q[1]; H q[0]; cx q[0],q[1]; H q[0]; mesure q[0]."
|
|
},
|
|
{
|
|
"id": "6-1-b",
|
|
"prompt": "Phase kickback : prépare q[1] en |1⟩ (X), mets q[0] en superposition (H), applique CZ q[0],q[1]. Puis H q[0] et mesure q[0].",
|
|
"hint": "Le CZ avec q[1]=|1⟩ ajoute une phase -1 quand q[0]=|1⟩ — c'est un Z 'remonté' sur q[0].",
|
|
"criteria": {
|
|
"required_outcomes": [{"bitstring": "1", "min_ratio": 0.99}],
|
|
"forbidden_outcomes": ["0"]
|
|
},
|
|
"feedback_pass": "Parfait ! La phase de q[1] s'est 'kickback' sur q[0]. C'est la clé des algorithmes quantiques.",
|
|
"feedback_fail": "Tu dois obtenir '1' sur q[0]. Vérifie : x q[1]; h q[0]; cz q[0],q[1]; h q[0]; mesure q[0]."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
- [ ] **Step 2: Verify**
|
|
|
|
```bash
|
|
cargo test tutor::tests::curriculum_json_deserializes_with_module_1 2>&1 | grep "test result"
|
|
```
|
|
|
|
Expected: `test result: ok. 1 passed`.
|
|
|
|
- [ ] **Step 3: Commit**
|
|
|
|
```bash
|
|
git add curriculum/curriculum.json
|
|
git commit -m "feat: add curriculum module 6 (premiers algorithmes - phase kickback)"
|
|
```
|