{ "cells": [ { "cell_type": "markdown", "metadata": { "pedagogy": { "role": "meta", "difficulty": 1, "kind": "orientation", "title": "Problem Set Goals" } }, "source": "## META | difficulty 1 | Problem Set Goals\n\nThis notebook checks whether the direct negative-wrapped transform is now mechanically understandable.\n" }, { "cell_type": "markdown", "metadata": { "pedagogy": { "role": "mandatory", "difficulty": 2, "kind": "quiz", "title": "Multiple-Choice Retrieval" } }, "source": "## MANDATORY | difficulty 2 | Multiple-Choice Retrieval\n\nChoose one answer for each:\n\n1. In the negacyclic transform, `\u03c8` matters because:\n A. it makes the modulus disappear\n B. it encodes the `x^n + 1` sign structure\n C. it avoids all inverses\n\n2. The inverse transform differs from the forward transform by:\n A. an inverse root and an `n^-1` scaling\n B. a larger modulus\n C. removing all twiddle factors\n\n3. The direct matrix transform is still pedagogically useful because:\n A. it keeps every coefficient contribution visible\n B. it is how Kyber is implemented directly at full size\n C. it removes the need for butterflies\n" }, { "cell_type": "code", "execution_count": null, "metadata": { "pedagogy": { "role": "mandatory", "difficulty": 2, "kind": "quiz", "title": "Answer Key" } }, "outputs": [], "source": "# MANDATORY | difficulty 2 | Answer Key\n\nanswers = {1: \"B\", 2: \"A\", 3: \"A\"}\nprint(answers)\n" }, { "cell_type": "markdown", "metadata": { "pedagogy": { "role": "mandatory", "difficulty": 2, "kind": "exercise", "title": "Round-Trip Check" } }, "source": "## MANDATORY | difficulty 2 | Round-Trip Check\n\nVerify by code that `INTT\u03c8(NTT\u03c8(a)) = a` for a nontrivial vector.\n" }, { "cell_type": "code", "execution_count": null, "metadata": { "pedagogy": { "role": "mandatory", "difficulty": 2, "kind": "exercise", "title": "Check The Round Trip" } }, "outputs": [], "source": "# MANDATORY | difficulty 2 | Check The Round Trip\n\nfrom ntt_learning.toy_ntt import find_psi, forward_ntt_psi, inverse_ntt_psi\n\nsignal = [6, 0, 5, 2]\npsi = find_psi(4, 17)\nrecovered = inverse_ntt_psi(forward_ntt_psi(signal, 17, psi), 17, psi)\nprint(recovered)\nassert recovered == signal\n" }, { "cell_type": "markdown", "metadata": { "pedagogy": { "role": "mandatory", "difficulty": 2, "kind": "reflection", "title": "Written Reflection" } }, "source": "## MANDATORY | difficulty 2 | Written Reflection\n\nIn one paragraph, explain why the direct transform is the right place to understand the algebra, but not the right place to stop if you care about algorithmic speed.\n" }, { "cell_type": "code", "execution_count": null, "metadata": { "pedagogy": { "role": "facultative", "difficulty": 4, "kind": "exploration", "title": "Optional Challenge" } }, "outputs": [], "source": "# FACULTATIVE | difficulty 4 | Optional Challenge\n\nfrom ntt_learning.toy_ntt import find_psi, forward_ntt_psi\n\npsi = find_psi(4, 17)\nfor signal in ([1, 1, 1, 1], [0, 1, 0, 1], [3, 5, 7, 9]):\n print(signal, \"->\", forward_ntt_psi(signal, 17, psi))\n" }, { "cell_type": "markdown", "metadata": { "pedagogy": { "role": "meta", "difficulty": 1, "kind": "handoff", "title": "Next Notebook" } }, "source": "## META | difficulty 1 | Next Notebook\n\nNext notebook: `studio.ipynb`\n" } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python" }, "ntt_learning": { "title": "Problems: Negative-Wrapped NTT", "contract_version": "0.2", "sequence": [ "notebooks/START_HERE.ipynb", "notebooks/COURSE_BLUEPRINT.ipynb", "notebooks/foundations/01_convolution_to_toy_ntt/lecture.ipynb", "notebooks/foundations/01_convolution_to_toy_ntt/lab.ipynb", "notebooks/foundations/01_convolution_to_toy_ntt/problems.ipynb", "notebooks/foundations/01_convolution_to_toy_ntt/studio.ipynb", "notebooks/foundations/02_negative_wrapped_ntt/lecture.ipynb", "notebooks/foundations/02_negative_wrapped_ntt/lab.ipynb", "notebooks/foundations/02_negative_wrapped_ntt/problems.ipynb", "notebooks/foundations/02_negative_wrapped_ntt/studio.ipynb", "notebooks/butterfly_mechanics/03_fast_forward_ct/lecture.ipynb", "notebooks/butterfly_mechanics/03_fast_forward_ct/lab.ipynb", "notebooks/butterfly_mechanics/03_fast_forward_ct/problems.ipynb", "notebooks/butterfly_mechanics/03_fast_forward_ct/studio.ipynb", "notebooks/butterfly_mechanics/04_fast_inverse_gs/lecture.ipynb", "notebooks/butterfly_mechanics/04_fast_inverse_gs/lab.ipynb", "notebooks/butterfly_mechanics/04_fast_inverse_gs/problems.ipynb", "notebooks/butterfly_mechanics/04_fast_inverse_gs/studio.ipynb", "notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/lecture.ipynb", "notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/lab.ipynb", "notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/problems.ipynb", "notebooks/kyber_mapping/05_kyber_ntt_and_base_multiplication/studio.ipynb", "notebooks/professional/06_debugging_ntt_failures/lecture.ipynb", "notebooks/professional/06_debugging_ntt_failures/lab.ipynb", "notebooks/professional/06_debugging_ntt_failures/problems.ipynb", "notebooks/professional/06_debugging_ntt_failures/studio.ipynb", "notebooks/COURSE_COMPLETE.ipynb" ] } }, "nbformat": 4, "nbformat_minor": 5 }