QuantumLearning/notebooks/qiskit_engineering/module_02_transpilation_and_visualization/studio.ipynb

677 lines
29 KiB
Text

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Notebook-level rule, objective, or usage guidance.\n",
"</div>\n",
"\n",
"# Transpilation and Visualization Studio\n",
"\n",
"The studio asks you to act like a hardware-aware reviewer. You will compare hostile and cooperative designs under explicit constraints and write the kind of redesign memo that later bands will depend on.\n"
],
"id": "cdd97435"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Official walkthrough guardrail.\n",
"</div>\n",
"\n",
"<!-- COURSE_NAV_TOP -->\n",
"## Mainline Navigation\n",
"\n",
"Step 22 of 59. Follow the official walkthrough in order.\n",
"\n",
"Previous notebook: [Transpilation and Visualization Problems](problems.ipynb)\n",
"\n",
"Next notebook: [Simulation and Noise Models Lecture](../module_03_simulation_and_noise_models/lecture.ipynb)\n",
"\n",
"Rule: complete the mandatory cells in this notebook before you open the next one.\n"
],
"id": "5267d191"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Notebook-level rule, objective, or usage guidance.\n",
"</div>\n",
"\n",
"## Studio Standard\n",
"\n",
"Every answer should state the abstract objective, the constraint set, and the evidence for why one implementation path is better than another. If any one of those is missing, the redesign claim is too soft.\n"
],
"id": "1d769648"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "setup"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #6b7280; background:#e5e7eb; color:#111827; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY SETUP</strong> · Difficulty 1/10 · Environment, import, or helper cell required by the notebook.\n",
"</div>\n"
],
"id": "36a43fbf"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import sys\n",
"\n",
"project_root = Path.cwd().resolve()\n",
"while not (project_root / \"pyproject.toml\").exists():\n",
" if project_root.parent == project_root:\n",
" raise RuntimeError(\"Could not locate the project root from this notebook.\")\n",
" project_root = project_root.parent\n",
"\n",
"src_path = project_root / \"src\"\n",
"if str(src_path) not in sys.path:\n",
" sys.path.insert(0, str(src_path))\n"
],
"id": "50c7b992"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "6ce28ece"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from quantum_learning import (\n",
" build_demo_noise_model,\n",
" counts_to_probabilities,\n",
" draw_circuit,\n",
" editable_circuit_lab,\n",
" line_coupling_map,\n",
" load_experiment_defaults,\n",
" plot_counts,\n",
" plot_probabilities,\n",
" quiz_block,\n",
" reflection_box,\n",
" simulate_counts,\n",
" statevector_probabilities,\n",
" step_reference_table,\n",
" transpile_summary,\n",
")\n",
"from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister\n",
"from qiskit.providers.basic_provider import BasicSimulator\n"
],
"id": "499342c3"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Notebook-level rule, objective, or usage guidance.\n",
"</div>\n",
"\n",
"## Brief 1: Rescue Versus Redesign\n",
"\n",
"Start from the topology-hostile abstract circuit and write the memo you would leave after seeing the compiled result.\n"
],
"id": "7d0cbfe0"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "e80ad6c8"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"defaults = load_experiment_defaults()\n",
"constrained_counts = lambda circuit, shots=256: simulate_counts(\n",
" circuit,\n",
" shots=shots,\n",
" basis_gates=list(defaults.transpile.basis_gates),\n",
" coupling_map=line_coupling_map(circuit.num_qubits),\n",
")\n",
"\n",
"editable_code = '\\nfrom qiskit import QuantumCircuit\\nfrom qiskit.providers.basic_provider import BasicSimulator\\nfrom quantum_learning import line_coupling_map, load_experiment_defaults, transpile_summary\\n\\ndefaults = load_experiment_defaults()\\n\\nabstract = QuantumCircuit(4, 4)\\n# [1] Start from a circuit with routing pressure.\\nabstract.h(0)\\nabstract.cx(0, 3)\\nabstract.cx(3, 1)\\nabstract.measure([0, 1, 2, 3], [0, 1, 2, 3])\\n\\n# [2] Compile to IBM-style basis gates on a line.\\nsummary = transpile_summary(\\n abstract,\\n BasicSimulator(),\\n basis_gates=list(defaults.transpile.basis_gates),\\n coupling_map=line_coupling_map(4),\\n optimization_level=0,\\n)\\n\\n# [3] Render the compiled circuit directly.\\ncircuit = summary[\"compiled_circuit\"]\\n'\n",
"editable_circuit_lab(\n",
" initial_code=editable_code,\n",
" context={\"QuantumCircuit\": QuantumCircuit, \"simulate_counts\": constrained_counts},\n",
" title='Studio Brief 1: Rescue Versus Redesign',\n",
" instructions='Inspect the compiled form and decide whether you would accept the rescue or redesign the abstract circuit.',\n",
" shots=256,\n",
")\n"
],
"id": "7608efc0"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "8ca09466"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"reflection_box('What exactly did the compiler have to rescue, and what upstream change would reduce that burden?')\n"
],
"id": "64311392"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Notebook-level rule, objective, or usage guidance.\n",
"</div>\n",
"\n",
"## Brief 2: Cooperative Rewrite\n",
"\n",
"Build the topology-aware version and compare it honestly to the compiler-rescued one.\n"
],
"id": "8128cb0f"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "0f2d38dc"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"defaults = load_experiment_defaults()\n",
"constrained_counts = lambda circuit, shots=256: simulate_counts(\n",
" circuit,\n",
" shots=shots,\n",
" basis_gates=list(defaults.transpile.basis_gates),\n",
" coupling_map=line_coupling_map(circuit.num_qubits),\n",
")\n",
"\n",
"editable_code = '\\nfrom qiskit import QuantumCircuit\\n\\ncircuit = QuantumCircuit(4, 4)\\n# [1] Build a version that respects the line from the start.\\ncircuit.h(0)\\ncircuit.cx(0, 1)\\ncircuit.cx(1, 2)\\ncircuit.cx(2, 3)\\n# [2] Keep the final question fixed while you compare cost.\\ncircuit.measure([0, 1, 2, 3], [0, 1, 2, 3])\\n'\n",
"editable_circuit_lab(\n",
" initial_code=editable_code,\n",
" context={\"QuantumCircuit\": QuantumCircuit, \"simulate_counts\": constrained_counts},\n",
" title='Studio Brief 2: Cooperative Rewrite',\n",
" instructions='Tune the local-chain design and explain whether it preserves the objective while reducing compile-time pain.',\n",
" shots=256,\n",
")\n"
],
"id": "1655d60b"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "ed0949ad"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"reflection_box('What did your redesign gain, and what did it potentially give up?')\n"
],
"id": "581d5ad4"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Notebook-level rule, objective, or usage guidance.\n",
"</div>\n",
"\n",
"## Brief 3: Optimization-Level Judgment\n",
"\n",
"Use the compiled-render widget again, but this time focus on optimization-level tradeoffs and the review language they require.\n"
],
"id": "dc402c14"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "bac37432"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"defaults = load_experiment_defaults()\n",
"constrained_counts = lambda circuit, shots=256: simulate_counts(\n",
" circuit,\n",
" shots=shots,\n",
" basis_gates=list(defaults.transpile.basis_gates),\n",
" coupling_map=line_coupling_map(circuit.num_qubits),\n",
")\n",
"\n",
"editable_code = '\\nfrom qiskit import QuantumCircuit\\nfrom qiskit.providers.basic_provider import BasicSimulator\\nfrom quantum_learning import line_coupling_map, load_experiment_defaults, transpile_summary\\n\\ndefaults = load_experiment_defaults()\\n\\nabstract = QuantumCircuit(4, 4)\\n# [1] Start from a circuit with routing pressure.\\nabstract.h(0)\\nabstract.cx(0, 3)\\nabstract.cx(3, 1)\\nabstract.measure([0, 1, 2, 3], [0, 1, 2, 3])\\n\\n# [2] Compile to IBM-style basis gates on a line.\\nsummary = transpile_summary(\\n abstract,\\n BasicSimulator(),\\n basis_gates=list(defaults.transpile.basis_gates),\\n coupling_map=line_coupling_map(4),\\n optimization_level=0,\\n)\\n\\n# [3] Render the compiled circuit directly.\\ncircuit = summary[\"compiled_circuit\"]\\n'\n",
"editable_circuit_lab(\n",
" initial_code=editable_code,\n",
" context={\"QuantumCircuit\": QuantumCircuit, \"simulate_counts\": constrained_counts},\n",
" title='Studio Brief 3: Optimization Judgment',\n",
" instructions=\"Adjust the optimization level or the abstract structure and defend the compiled result you would ship for this lesson's local target.\",\n",
" shots=256,\n",
")\n"
],
"id": "443f403f"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "test"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY TEST</strong> · Difficulty 3/10 · Official walkthrough multiple-choice test.\n",
"</div>\n"
],
"id": "94a9fcc5"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"quiz_block([{'prompt': 'What is the core job of the transpilation studio?', 'options': ['Compare compiler rescue with human redesign under explicit constraints', 'Avoid compiled diagrams', 'Reduce everything to one metric'], 'correct_index': 0, 'explanation': 'The studio asks for engineering judgment, not only observation.'}, {'prompt': 'When is a redesign claim convincing?', 'options': ['When it states the objective, the constraints, and the evidence for why the new structure is better', 'When the circuit looks simpler at first glance', 'When it uses fewer comments'], 'correct_index': 0, 'explanation': 'Convincing redesign requires a reviewable argument.'}], heading='Transpilation Studio Check')\n"
],
"id": "5a7ab835"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "c5a957cd"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"reflection_box('What is the main transpilation smell you can now recognize in an abstract circuit before compiling it?')\n"
],
"id": "2e476580"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "mandatory",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY EXERCISE</strong> · Difficulty 3/10 · Official walkthrough runnable or written exercise.\n",
"</div>\n"
],
"id": "16f3fa60"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"reflection_box('Which redesign judgment in this module still feels tentative, and what extra comparison would strengthen it?')\n"
],
"id": "26003725"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY READING</strong> · Difficulty 3/10 · Official walkthrough reading cell.\n",
"</div>\n",
"\n",
"## Studio Rubric\n",
"\n",
"Use a strict rubric here. A strong studio answer states the objective without ambiguity, states the constraint set explicitly, shows the relevant pre- and post-compile evidence, and gives a redesign recommendation that another engineer could actually test. A weak answer says only that one circuit \"looks cleaner\" or \"seems more hardware aware.\" The studio exists to eliminate that kind of soft language.\n",
"\n",
"This rubric matters because later hardware-aware modules will assume you can already argue about compile-time tradeoffs in review language. The current studio is where that language gets installed.\n"
],
"id": "58632681"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY READING</strong> · Difficulty 3/10 · Official walkthrough reading cell.\n",
"</div>\n",
"\n",
"## Studio Review Standard\n",
"\n",
"Before you leave this notebook, ask whether your memo would still make sense to a reader who never saw your intermediate experiments. If the answer is no, then the memo is still too dependent on the notebook context. A good engineering memo should survive outside the cell stream. It should say enough about the objective, constraints, and cost story that another person could reproduce the comparison or challenge your conclusion intelligently.\n",
"\n",
"That standard is intentionally high. The whole point of the studio is to move from personal experimentation toward shared engineering language.\n"
],
"id": "705ac97a"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #15803d; background:#dcfce7; color:#14532d; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>MANDATORY READING</strong> · Difficulty 3/10 · Official walkthrough reading cell.\n",
"</div>\n",
"\n",
"## Studio Exit\n",
"\n",
"A strong outcome is a short redesign memo that another engineer could act on: it states the target, the constraints, the cost, and the reason the chosen rewrite is preferable.\n"
],
"id": "55e2f648"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Official walkthrough guardrail.\n",
"</div>\n",
"\n",
"<!-- COURSE_NAV_BOTTOM -->\n",
"## What To Open Next\n",
"\n",
"Next notebook: [Simulation and Noise Models Lecture](../module_03_simulation_and_noise_models/lecture.ipynb)\n",
"\n",
"Official walkthrough rule: once every mandatory cell above is complete, open the next notebook. Anything below this cell is facultative.\n"
],
"id": "83af4502"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "facultative_zone",
"ql_track": "meta",
"ql_role": "reading",
"ql_difficulty": 1,
"ql_note": "Optional-zone boundary. The official walkthrough is already complete above."
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #2563eb; background:#dbeafe; color:#1e3a8a; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>META READING</strong> · Difficulty 1/10 · Optional-zone boundary. The official walkthrough is already complete above.\n",
"</div>\n",
"\n",
"<!-- QL_OPTIONAL_ZONE -->\n",
"## Facultative Extension Zone\n",
"\n",
"You have already completed the mandatory walkthrough for **Transpilation and Visualization Studio**. Everything below is optional. Use it only if you want deeper consolidation or extra transfer work.\n"
],
"id": "54e9f603"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "facultative",
"ql_track": "facultative",
"ql_role": "reading",
"ql_difficulty": 5,
"ql_note": "Optional extension reading."
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #ea580c; background:#ffedd5; color:#9a3412; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>FACULTATIVE READING</strong> · Difficulty 5/10 · Optional extension reading.\n",
"</div>\n",
"\n",
"## Facultative Extension Reading\n",
"\n",
"Use this optional studio extension only if the mandatory route in **Transpilation and Visualization Studio** feels stable. The right stretch here is not random complexity; it is one extra candidate, one sharper criterion, and one clearer written defence of the final decision.\n"
],
"id": "955581c6"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "facultative",
"ql_role": "test"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #ea580c; background:#ffedd5; color:#9a3412; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>FACULTATIVE TEST</strong> · Difficulty 6/10 · Optional multiple-choice extension.\n",
"</div>\n"
],
"id": "a329e32c"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ql_injected": "facultative",
"ql_track": "facultative",
"ql_role": "test",
"ql_difficulty": 6,
"ql_note": "Optional multiple-choice extension.",
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"quiz_block([{'prompt': 'What makes a facultative studio stretch worthwhile?', 'options': ['It sharpens a design judgement without breaking the single mandatory route', 'It replaces the mandatory brief', 'It adds complexity with no explicit criterion'], 'correct_index': 0, 'explanation': 'A studio stretch should sharpen judgement, not blur the route.'}, {'prompt': 'If a stretch candidate fails, what should change first?', 'options': ['The written explanation of the failure and the next criterion', 'The notebook order', 'The insistence that the failed candidate was still best'], 'correct_index': 0, 'explanation': 'The useful move is clearer review language and a better criterion.'}], heading='Facultative Extension Test')\n"
],
"id": "1157680f"
},
{
"cell_type": "markdown",
"metadata": {
"ql_injected": "badge",
"ql_track": "facultative",
"ql_role": "exercise"
},
"source": [
"<!-- QL_BADGE -->\n",
"<div style=\"padding:0.55rem 0.8rem; border-left:6px solid #ea580c; background:#ffedd5; color:#9a3412; border-radius:0.35rem; font-family:Helvetica, Arial, sans-serif; margin:0.15rem 0 0.85rem 0;\">\n",
"<strong>FACULTATIVE EXERCISE</strong> · Difficulty 7/10 · Optional written exercise.\n",
"</div>\n"
],
"id": "06757111"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ql_injected": "facultative",
"ql_track": "facultative",
"ql_role": "exercise",
"ql_difficulty": 7,
"ql_note": "Optional written exercise.",
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"reflection_box('Write one optional stretch brief for Transpilation and Visualization Studio: objective, criterion, and the single risk that would matter most in your design review.')\n"
],
"id": "56a5d370"
}
],
"metadata": {
"kernelspec": {
"display_name": "QuantumLearning (.venv)",
"language": "python",
"name": "quantum-learning"
},
"language_info": {
"name": "python",
"version": "3.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}