Compare commits
7 Commits
2464db00af
...
c29f0d25c7
Author | SHA1 | Date | |
---|---|---|---|
c29f0d25c7 | |||
871a02bb1d | |||
b5ccf95a8b | |||
563dd990a5 | |||
6681724804 | |||
8d49154277 | |||
acf57ceab6 |
18
README.md
18
README.md
@ -1,7 +1,7 @@
|
||||
[tinymist]: https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist
|
||||
[latex-workshop]: https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop
|
||||
[CC BY-NC-SA 4.0]: https://creativecommons.org/licenses/by-nc-sa/4.0
|
||||
[betalupi.com/handouts]: https://static.betalupi.com/ormc
|
||||
[betalupi.com/handouts]: https://betalupi.com/handouts
|
||||
[ORMC]: https://circles.math.ucla.edu/circles/
|
||||
[Overleaf]: https://overleaf.com
|
||||
[Typst.app]: https://typst.app
|
||||
@ -26,7 +26,7 @@ By submitting or editing a handout in this repository, you agree to release it u
|
||||
|
||||
## 🛠️ Contributing
|
||||
|
||||
If you want to use one of these handouts for a class, see [`betalupi.com/handouts`](https://betalupi.com/handouts). \
|
||||
If you want to use one of these handouts for a class, see [betalupi.com/handouts]. \
|
||||
You only need to read this section if you want to edit these handouts.
|
||||
|
||||
### Setup
|
||||
@ -56,7 +56,7 @@ This repository is organized as follows:
|
||||
- [`./tools`](./tools) contains build scripts, [`./.github`](./.github) configures automation. \
|
||||
You can ignore everything in these directories.
|
||||
|
||||
All handouts in this repository are based on `ormc_handout.cls` or `handout@0.1.0`.
|
||||
All handouts in this repository are based on `handout.cls` or `handout@0.1.0`.
|
||||
|
||||
- If you're using Typst (preferred), read [`docs-typst.md`](./docs-typst.md)
|
||||
- If you're still using LaTeX, read [`docs-latex.md`](./docs-latex.md).
|
||||
@ -95,8 +95,8 @@ _(I do not recommend this. The default toolchain makes it easier to share improv
|
||||
### For LaTeX:
|
||||
|
||||
1. Get the handout's directory (i.e, download the whole repo as a zip and extract the folder you want.)
|
||||
2. Download [`./resources/ormc_handout.cls`](./resources/ormc_handout.cls)
|
||||
3. Put this `ormc_handout.cls` in the same directory as the handout.
|
||||
2. Download [`./resources/handout.cls`](./resources/handout.cls)
|
||||
3. Put this `handout.cls` in the same directory as the handout.
|
||||
4. Fix the include path at the top of `main.tex`:
|
||||
|
||||
You'll need to replace
|
||||
@ -104,7 +104,7 @@ You'll need to replace
|
||||
```latex
|
||||
\documentclass[
|
||||
...
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
```
|
||||
|
||||
with
|
||||
@ -112,11 +112,11 @@ with
|
||||
```latex
|
||||
\documentclass[
|
||||
...
|
||||
]{ormc_handout}
|
||||
]{handout}
|
||||
```
|
||||
|
||||
5. Make a new overleaf project with the resulting directory.
|
||||
6. **Do not use pdflatex**, it misbehaves with `ormc_handout`. Tell Overleaf to use XeLaTeX.
|
||||
6. **Do not use pdflatex**, it misbehaves with `handout`. Tell Overleaf to use XeLaTeX.
|
||||
|
||||
### For Typst:
|
||||
|
||||
@ -124,5 +124,5 @@ Out-of-band typst compilation isn't supported. Clone the repository and use vsco
|
||||
This is because typst can't import packages from a relative path.
|
||||
|
||||
If you _really_ want it, standalone typst compilation _is_ possible. \
|
||||
Follow the LaTeX instructions, but fix `handout@0.1.0` instead of `ormc_handout`. \
|
||||
Follow the LaTeX instructions, but fix `handout@0.1.0` instead of `handout`. \
|
||||
You'll figure it out.
|
||||
|
@ -1,23 +1,25 @@
|
||||
# LaTeX documentation
|
||||
|
||||
All LaTeX handouts are based on [`ormc_handout.cls`](./lib/tex/ormc_handout.cls). \
|
||||
All LaTeX handouts are based on [`handout.cls`](./lib/tex/handout.cls). \
|
||||
This class is based on `article.cls`, and should work with most LaTeX packages.
|
||||
|
||||
The best way to start a new document is to make a copy of an existing one.
|
||||
- [Advanced/Cryptography](./src/Advanced/Cryptography) is a good example of a simple handout.
|
||||
- [Advanced/DFAs](./src/Advanced/DFAs) is a good example of a handout with graphs.
|
||||
- [Advanced/Geometric Optimization](./src/Advanced/Geometric%20Optimization) is a good example of a handout with geometry.
|
||||
|
||||
- [Advanced/Cryptography](./src/Advanced/Cryptography) is a good example of a simple handout.
|
||||
- [Advanced/DFAs](./src/Advanced/DFAs) is a good example of a handout with graphs.
|
||||
- [Advanced/Geometric Optimization](./src/Advanced/Geometric%20Optimization) is a good example of a handout with geometry.
|
||||
|
||||
## Notes
|
||||
- Compile your handouts with XeLaTeX. \
|
||||
`pdflatex` is known to misbehave with `ormc_handout.cls`. \
|
||||
This will happen by default if you use vscode. \
|
||||
If you use Overleaf, you'll have to configure it manually (see document settings).
|
||||
|
||||
- Compile your handouts with XeLaTeX. \
|
||||
`pdflatex` is known to misbehave with `handout.cls`. \
|
||||
This will happen by default if you use vscode. \
|
||||
If you use Overleaf, you'll have to configure it manually (see document settings).
|
||||
|
||||
## Document Options
|
||||
|
||||
Document options are passed to `\documentclass`, as follows:
|
||||
|
||||
```latex
|
||||
\documentclass[
|
||||
% Show solutions is `solutions` is provided,
|
||||
@ -37,49 +39,52 @@ Document options are passed to `\documentclass`, as follows:
|
||||
% This should only be used for single-page handouts
|
||||
% (e.g, warm-ups)
|
||||
nopagenumber
|
||||
]{ormc_handout}
|
||||
]{handout}
|
||||
```
|
||||
|
||||
Use `geometry` to change margins and page dimensions. US letter is the default.
|
||||
|
||||
|
||||
## Utilities
|
||||
- `\say{text}`: Puts text in quotes, handling details like period spacing. Courtesy of `dirtytalk`.
|
||||
- `\note[Type]{text}`: Makes a note.
|
||||
- `\hint{text}`: Shorthand for `\note[Hint]{text}`
|
||||
|
||||
- `\say{text}`: Puts text in quotes, handling details like period spacing. Courtesy of `dirtytalk`.
|
||||
- `\note[Type]{text}`: Makes a note.
|
||||
- `\hint{text}`: Shorthand for `\note[Hint]{text}`
|
||||
|
||||
## Sections
|
||||
|
||||
The usual LaTeX title-customization techniques *WILL NOT WORK* with this class. \
|
||||
The usual LaTeX title-customization techniques _WILL NOT WORK_ with this class. \
|
||||
Don't even try to load `titlesec`.
|
||||
|
||||
`ormc_handout.cls` supports two levels of sections:
|
||||
- `\section`, for large parts of the handout
|
||||
- `\definition`, `\theorem`, `\proposition`, `\example`, `\remark`, `\problem`, and `\problempart`
|
||||
`handout.cls` supports two levels of sections:
|
||||
|
||||
- `\section`, for large parts of the handout
|
||||
- `\definition`, `\theorem`, `\proposition`, `\example`, `\remark`, `\problem`, and `\problempart`
|
||||
|
||||
All these macros have the following syntax: `\problem{title}<label>`
|
||||
- `title` is the problem's title, and may be empty.
|
||||
- `label` is the problem's label. This is optional. \
|
||||
If a label is provided, this section may be referenced with `\ref{label}`.
|
||||
|
||||
- `title` is the problem's title, and may be empty.
|
||||
- `label` is the problem's label. This is optional. \
|
||||
If a label is provided, this section may be referenced with `\ref{label}`.
|
||||
|
||||
Examples:
|
||||
- `\problem{}`
|
||||
- `\problem{Bonus}`
|
||||
- `\problem{}<gcd>`, which may be referenced with `\ref{gcd}`
|
||||
|
||||
- `\problem{}`
|
||||
- `\problem{Bonus}`
|
||||
- `\problem{}<gcd>`, which may be referenced with `\ref{gcd}`
|
||||
|
||||
Do **not** use `\begin{problem} ... \end{problem}`. \
|
||||
Sections are macros, not environments.
|
||||
|
||||
## Environments:
|
||||
|
||||
- `\begin{solution}`: A fancy red for solutions to problems. \
|
||||
This is hidden if the `nosolutions` is provided.
|
||||
- `\begin{instrutornote}`: A fancy blue box for instructor notes. \
|
||||
This is hidden if the `nosolutions` is provided.
|
||||
- `\begin{examplesolution}`: A fancy gray for sample solutions. \
|
||||
This is never hidden.
|
||||
- `\begin{solution}`: A fancy red for solutions to problems. \
|
||||
This is hidden if the `nosolutions` is provided.
|
||||
- `\begin{instrutornote}`: A fancy blue box for instructor notes. \
|
||||
This is hidden if the `nosolutions` is provided.
|
||||
- `\begin{examplesolution}`: A fancy gray for sample solutions. \
|
||||
This is never hidden.
|
||||
|
||||
All the above environments break across pages and may safely be nested.
|
||||
|
||||
Each of these environments also provides the `\linehack` macro, which draws a line across the box. \
|
||||
This is useful for, say, solutions to multipart problems.
|
||||
This is useful for, say, solutions to multipart problems.
|
||||
|
@ -4,23 +4,27 @@ See [typst.app/docs](https://typst.app/docs) for typst's documentation. \
|
||||
All typst handouts are based on [`handout@0.1.0`](./lib/typst/local/handout/0.1.0).
|
||||
|
||||
The best way to start a new document is to make a copy of an existing one.
|
||||
- [Advanced/Tropical Polynomials](./src/Advanced/Tropical%20Polynomials) is a good place to start.
|
||||
- [Warm-Ups/Painting](./src/Warm-Ups/Painting) is a good example of tikz-like pictures.
|
||||
|
||||
- [Advanced/Tropical Polynomials](./src/Advanced/Tropical%20Polynomials) is a good place to start.
|
||||
- [Warm-Ups/Painting](./src/Warm-Ups/Painting) is a good example of tikz-like pictures.
|
||||
|
||||
## Notes
|
||||
- Typst's equivalent of tikz is cetz ([homepage](https://cetz-package.github.io), [docs](https://cetz-package.github.io/docs/api))
|
||||
- Typst handouts are always compiled with solutions. \
|
||||
Handouts without solutions are automatically compiled and published at [betalupi.com/handouts](https://static.betalupi.com/ormc). \
|
||||
If you'd like to compile a student handout manually, run the following command in a handout directory:
|
||||
|
||||
- Typst's equivalent of tikz is cetz ([homepage](https://cetz-package.github.io), [docs](https://cetz-package.github.io/docs/api))
|
||||
- Typst handouts are always compiled with solutions. \
|
||||
Handouts without solutions are automatically compiled and published at [betalupi.com/handouts](https://betalupi.com/handouts). \
|
||||
If you'd like to compile a student handout manually, run the following command in a handout directory:
|
||||
|
||||
```bash
|
||||
typst compile main.typ --package-path ../../../lib/typst --input show_solutions=false
|
||||
```
|
||||
|
||||
Where `package_path` is a relative path to [./lib/typst](./lib/typst).
|
||||
|
||||
## Document Options
|
||||
|
||||
All typst handouts start with the following:
|
||||
|
||||
```typst
|
||||
#show: handout.with(
|
||||
// Should match `meta.toml`
|
||||
@ -38,39 +42,44 @@ All typst handouts start with the following:
|
||||
```
|
||||
|
||||
## Notable commands
|
||||
- `#v(1fr)`: Like LaTeX's `\vfill`. Creates whitespace that grows automatically. \
|
||||
`fr` means "fraction". `#v(2fr)` will fill twice as much space as `#v(1fr)` on the same page.
|
||||
|
||||
- `#v(1fr)`: Like LaTeX's `\vfill`. Creates whitespace that grows automatically. \
|
||||
`fr` means "fraction". `#v(2fr)` will fill twice as much space as `#v(1fr)` on the same page.
|
||||
|
||||
## Utilities
|
||||
- `#note([content], type: "Note type")`: Makes a note. `type` is optional.
|
||||
- `#hint([content])`: Shorthand for `#note([content], type: "Hint")`
|
||||
- `#solution([content])`: A pretty box for solutions. Hidden in student handouts.
|
||||
- `#examplesolution([content])`: Like `#solution()`, but is never hidden.
|
||||
- `#if_solutions([content])`: Shows content only if we are showing solutions.
|
||||
- `#if_no_solutions([content])`: Shows content only if we **aren't** showing solutions.
|
||||
|
||||
- `#note([content], type: "Note type")`: Makes a note. `type` is optional.
|
||||
- `#hint([content])`: Shorthand for `#note([content], type: "Hint")`
|
||||
- `#solution([content])`: A pretty box for solutions. Hidden in student handouts.
|
||||
- `#examplesolution([content])`: Like `#solution()`, but is never hidden.
|
||||
- `#if_solutions([content])`: Shows content only if we are showing solutions.
|
||||
- `#if_no_solutions([content])`: Shows content only if we **aren't** showing solutions.
|
||||
|
||||
## Sections
|
||||
|
||||
High-level sections are denoted with `=`. \
|
||||
Subsections start with `==`, subsubsections with `===`, and so on. \
|
||||
**`handout@0.1.0` is only designed to use `=`, subsections might be ugly.**
|
||||
|
||||
|
||||
`handout@0.1.0` also provides the following commands:
|
||||
- `problem`
|
||||
- `definition`
|
||||
- `theorem`
|
||||
- `example`
|
||||
- `remark`
|
||||
|
||||
- `problem`
|
||||
- `definition`
|
||||
- `theorem`
|
||||
- `example`
|
||||
- `remark`
|
||||
|
||||
These all have the same syntax: `#problem("title", label: "label")`
|
||||
- `title` is the problem's title, and may be omitted.
|
||||
- `label` is the problem's label. This is optional. \
|
||||
If a label is provided, this problem can be referenced with `@label`
|
||||
|
||||
- `title` is the problem's title, and may be omitted.
|
||||
- `label` is the problem's label. This is optional. \
|
||||
If a label is provided, this problem can be referenced with `@label`
|
||||
|
||||
**Examples:**
|
||||
- `#problem()`
|
||||
- `#problem("Bonus")`
|
||||
- `#problem(label: "gcd")`, which may be referenced with `@gcd`
|
||||
|
||||
- `#problem()`
|
||||
- `#problem("Bonus")`
|
||||
- `#problem(label: "gcd")`, which may be referenced with `@gcd`
|
||||
|
||||
### Complete example:
|
||||
|
||||
@ -91,4 +100,4 @@ Consider the polynomial $f(x) = x^3 + 1x^2 + 3x + 6$.
|
||||
#problem()
|
||||
Recall @imaproblem.
|
||||
- use this graph to find the roots of $f$
|
||||
```
|
||||
```
|
||||
|
@ -1,5 +1,5 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesClass{../../../lib/tex/ormc_handout}[2023/05/29 2.0.2 ORMC Handout]
|
||||
\ProvidesClass{../../../lib/tex/handout}[2025/03/02 2.0.2 Mark's handout class]
|
||||
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
\@twocolumnfalse
|
||||
\@twosidefalse
|
||||
\@mparswitchfalse
|
||||
% ORMC-specific
|
||||
% Handout-specific
|
||||
\newif{\if@solutions} % If false, solutions and instructor notes are hidden.
|
||||
\newif{\if@singlenumbering} % If true, the same counter is used for all objects.
|
||||
\newif{\if@nopagenumber} % If true, don't number pages.
|
||||
@ -25,7 +25,7 @@
|
||||
\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
|
||||
\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
|
||||
\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
|
||||
% ORMC-specific options
|
||||
% Handout-specific options
|
||||
\DeclareOption{solutions}{\@solutionstrue}
|
||||
\DeclareOption{nosolutions}{\@solutionsfalse}
|
||||
\DeclareOption{multinumbering}{\@singlenumberingfalse}
|
||||
@ -37,7 +37,7 @@
|
||||
\DeclareOption{showwarning}{\@nowarningfalse}
|
||||
\DeclareOption{hidewarning}{\@nowarningtrue}
|
||||
\DeclareOption{unfinished}{\@unfinishedtrue}
|
||||
\DeclareOption*{\ClassWarning{ormc_handout}{\CurrentOption ignored}}
|
||||
\DeclareOption*{\ClassWarning{handout}{\CurrentOption ignored}}
|
||||
|
||||
\@unfinishedfalse
|
||||
\ExecuteOptions{
|
||||
@ -629,12 +629,12 @@
|
||||
|
||||
% Keep track of the current background color.
|
||||
% Useful for transparent tikz drawings.
|
||||
\def\ORMCbgcolor{white}
|
||||
\def\bgcolor{white}
|
||||
|
||||
% Make a box environment.
|
||||
% These can safely be nested.
|
||||
% Args: title, back color, frame color.
|
||||
\newenvironment{ORMCbox}[3]{
|
||||
\newenvironment{hobox}[3]{
|
||||
% \linehack draws a line across a tcolorbox.
|
||||
% tcolorbox only supports two sections, but
|
||||
% this hack allows us to have more.
|
||||
@ -653,7 +653,7 @@
|
||||
|
||||
% Keep track of the current background color.
|
||||
% Useful for transparent tikz drawings.
|
||||
\def\ORMCbgcolor{#2}
|
||||
\def\bgcolor{#2}
|
||||
|
||||
\begin{tcolorbox}[
|
||||
enhanced,
|
||||
@ -675,21 +675,21 @@
|
||||
}
|
||||
|
||||
\newenvironment{examplesolution}{
|
||||
\begin{ORMCbox}{Example Solution}{black!10!white}{black!65!white}
|
||||
\begin{hobox}{Example Solution}{black!10!white}{black!65!white}
|
||||
} {
|
||||
\end{ORMCbox}
|
||||
\end{hobox}
|
||||
}
|
||||
|
||||
\if@solutions
|
||||
\newenvironment{solution}{
|
||||
\begin{ORMCbox}{Solution}{ored!10!white}{ored}
|
||||
\begin{hobox}{Solution}{ored!10!white}{ored}
|
||||
} {
|
||||
\end{ORMCbox}
|
||||
\end{hobox}
|
||||
}
|
||||
\newenvironment{instructornote}{
|
||||
\begin{ORMCbox}{Note for Instructors}{ocyan!10!white}{ocyan}
|
||||
\begin{hobox}{Note for Instructors}{ocyan!10!white}{ocyan}
|
||||
} {
|
||||
\end{ORMCbox}
|
||||
\end{hobox}
|
||||
}
|
||||
\else
|
||||
\excludecomment{solution}
|
@ -1,5 +1,5 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{../../../lib/tex/macros}[2023/10/16 ORMC Macros]
|
||||
\ProvidesPackage{../../../lib/tex/macros}[2025/03/02 Handout macros]
|
||||
|
||||
\RequirePackage{hyperref}
|
||||
\RequirePackage{pgf}
|
||||
|
@ -29,6 +29,26 @@
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#let short_solution_warning() = {
|
||||
set text(ored)
|
||||
align(
|
||||
center,
|
||||
block(
|
||||
width: 60%,
|
||||
height: auto,
|
||||
breakable: false,
|
||||
fill: rgb(255, 255, 255),
|
||||
stroke: ored + 2pt,
|
||||
inset: 3mm,
|
||||
(
|
||||
align(center, text(weight: "bold", size: 12pt, [Instructor's Handout]))
|
||||
+ parbreak()
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
#let make_header(
|
||||
title,
|
||||
subtitle: none,
|
||||
|
@ -32,6 +32,7 @@
|
||||
title: none,
|
||||
by: none,
|
||||
subtitle: none,
|
||||
short_warning: false,
|
||||
) = {
|
||||
set page(
|
||||
margin: 20mm,
|
||||
@ -48,19 +49,28 @@
|
||||
// Text style
|
||||
set text(font: "New Computer Modern")
|
||||
set par(
|
||||
leading: 0.55em,
|
||||
first-line-indent: 0mm,
|
||||
justify: true,
|
||||
leading: 0.5em,
|
||||
spacing: 0.5em,
|
||||
|
||||
first-line-indent: 0mm,
|
||||
hanging-indent: 0mm,
|
||||
justify: true,
|
||||
)
|
||||
|
||||
//
|
||||
// List style
|
||||
show list: set block(spacing: 0.5em, below: 1em)
|
||||
set list(
|
||||
tight: false,
|
||||
indent: 5mm,
|
||||
spacing: 3mm,
|
||||
indent: 4mm,
|
||||
body-indent: 1.5mm,
|
||||
|
||||
// Manually set spacing,
|
||||
// `tight` has no effect.
|
||||
spacing: 2mm,
|
||||
)
|
||||
set enum(
|
||||
indent: 4mm,
|
||||
body-indent: 1.5mm,
|
||||
spacing: 2mm,
|
||||
)
|
||||
|
||||
//
|
||||
@ -92,8 +102,10 @@
|
||||
|
||||
// Make handout title
|
||||
{
|
||||
import "header.typ": make_header, solution_warning
|
||||
import "solution.typ": show_solutions
|
||||
import "header.typ": make_header, solution_warning, short_solution_warning
|
||||
import "solution.typ": solutions_state, reset_solutions
|
||||
|
||||
reset_solutions()
|
||||
|
||||
let url = link(
|
||||
"https://betalupi.com/handouts",
|
||||
@ -108,8 +120,14 @@
|
||||
top_right: url,
|
||||
)
|
||||
|
||||
if show_solutions {
|
||||
solution_warning()
|
||||
context {
|
||||
if solutions_state.get() {
|
||||
if short_warning {
|
||||
short_solution_warning()
|
||||
} else {
|
||||
solution_warning()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,34 +1,63 @@
|
||||
#import "misc.typ": ored, oblue
|
||||
|
||||
|
||||
/// If false, hide instructor info.
|
||||
///
|
||||
/// Compile with the following command to hide solutions:
|
||||
/// `typst compile main.typ --input show_solutions=false`
|
||||
/// If true, show it.
|
||||
///
|
||||
/// Solutions are shown by default. This behavior
|
||||
/// is less surprising than hiding content by default.
|
||||
#let show_solutions = {
|
||||
#let solutions_state = state("solutions_state", true)
|
||||
|
||||
/// Force solutions to be hidden after this point.
|
||||
///
|
||||
/// This function produces content that must be
|
||||
/// included in the document. If it is not included,
|
||||
/// this function will have no effect.
|
||||
#let hide_solutions() = {
|
||||
return solutions_state.update(x => false)
|
||||
}
|
||||
|
||||
/// Force solutions to be shown after this point.
|
||||
///
|
||||
/// This function produces content that must be
|
||||
/// included in the document. If it is not included,
|
||||
/// this function will have no effect.
|
||||
#let show_solutions() = {
|
||||
return solutions_state.update(x => true)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Reset the solution flag to its default value.
|
||||
/// This value is determined by compile flags:
|
||||
/// Compile with the following command to hide solutions:
|
||||
/// `typst compile main.typ --input show_solutions=false`
|
||||
///
|
||||
/// Solutions are shown by default.
|
||||
///
|
||||
/// This function produces content that must be
|
||||
/// included in the document. If it is not included,
|
||||
/// this function will have no effect.
|
||||
#let reset_solutions() = {
|
||||
if "show_solutions" in sys.inputs {
|
||||
// Show solutions unless they're explicitly disabled
|
||||
not (
|
||||
if (
|
||||
sys.inputs.show_solutions == "false" or sys.inputs.show_solutions == "no"
|
||||
)
|
||||
} else {
|
||||
// Show solutions by default
|
||||
true
|
||||
) {
|
||||
return solutions_state.update(x => false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#let if_solutions(content) = {
|
||||
if show_solutions { content }
|
||||
#let if_solutions(content) = context {
|
||||
if solutions_state.get() { content }
|
||||
}
|
||||
|
||||
#let if_no_solutions(content) = {
|
||||
if not show_solutions { content }
|
||||
#let if_no_solutions(content) = context {
|
||||
if not solutions_state.get() { content }
|
||||
}
|
||||
|
||||
#let if_solutions_else(if_yes, if_no) = {
|
||||
if show_solutions { if_yes } else { if_no }
|
||||
#let if_solutions_else(if_yes, if_no) = context {
|
||||
if solutions_state.get() { if_yes } else { if_no }
|
||||
}
|
||||
|
||||
#let solution(content) = {
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\input{tikzset.tex}
|
||||
|
@ -24,7 +24,7 @@
|
||||
label/.style = {
|
||||
rectangle,
|
||||
% For automatic red background in solutions
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
draw = none,
|
||||
rounded corners = 0mm
|
||||
},
|
||||
@ -32,7 +32,7 @@
|
||||
% Nodes
|
||||
edg/.style = {
|
||||
midway,
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
text = gray
|
||||
},
|
||||
int/.style = {},
|
||||
|
@ -5,7 +5,7 @@
|
||||
shortwarning,
|
||||
singlenumbering,
|
||||
unfinished
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{multicol}
|
||||
|
@ -4,7 +4,7 @@
|
||||
solutions,
|
||||
singlenumbering,
|
||||
shortwarning
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{multicol}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\input{tikzset.tex}
|
||||
|
@ -24,7 +24,7 @@
|
||||
label/.style = {
|
||||
rectangle,
|
||||
% For automatic red background in solutions
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
draw = none,
|
||||
rounded corners = 0mm
|
||||
},
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\input{tikzset.tex}
|
||||
|
@ -24,7 +24,7 @@
|
||||
label/.style = {
|
||||
rectangle,
|
||||
% For automatic red background in solutions
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
draw = none,
|
||||
rounded corners = 0mm
|
||||
},
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
@ -16,6 +16,11 @@
|
||||
\title{Error-Correcting Codes}
|
||||
\subtitle{Prepared by Mark on \today}
|
||||
|
||||
|
||||
% TODO:
|
||||
% ISBN section is tedious, could use some work.
|
||||
% Check problem 5
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
@ -1,6 +1,8 @@
|
||||
\section{Error Detection}
|
||||
|
||||
An ISBN\footnote{International Standard Book Number} is a unique numeric book identifier. It comes in two forms: ISBN-10 and ISBN-13. Naturally, ISBN-10s have ten digits, and ISBN-13s have thirteen. The final digit in both versions is a \textit{check digit}.
|
||||
An ISBN\footnote{International Standard Book Number} is a unique identifier publishers assign to their books. \par
|
||||
It comes in two forms: ISBN-10 and ISBN-13. Naturally, ISBN-10s have ten digits, and ISBN-13s have thirteen.
|
||||
The final digit in both versions is a \textit{check digit}.
|
||||
|
||||
\vspace{3mm}
|
||||
|
||||
@ -15,7 +17,8 @@ If $n_{10}$ is equal to 10, it is written as \texttt{X}.
|
||||
|
||||
|
||||
\problem{}
|
||||
Only one of the following ISBNs is valid. Which one is it?
|
||||
Only one of the following ISBNs is valid. Which one is it? \par
|
||||
\note[Note]{Dashes are meaningless.}
|
||||
|
||||
\begin{itemize}
|
||||
\item \texttt{0-134-54896-2}
|
||||
@ -23,15 +26,16 @@ Only one of the following ISBNs is valid. Which one is it?
|
||||
\end{itemize}
|
||||
|
||||
\begin{solution}
|
||||
The first has an inconsistent check digit.
|
||||
The second is valid.
|
||||
\end{solution}
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
\problem{}
|
||||
Take a valid ISBN-10 and change one digit. Is it possible that you get another valid ISBN-10? \par
|
||||
Provide a proof.
|
||||
Take a valid ISBN-10 and change one digit. \par
|
||||
Is it possible that you get another valid ISBN-10? \par
|
||||
Provide an example or a proof.
|
||||
|
||||
\begin{solution}
|
||||
Let $S$ be the sum $10n_1 + 9n_2 + ... + 2n_9 + n_{10}$, before any digits are changed.
|
||||
@ -50,9 +54,8 @@ Provide a proof.
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
Take a valid ISBN-10 and swap two adjacent digits. When will the result be a valid ISBN-10? \par
|
||||
This is called a \textit{transposition error}.
|
||||
|
||||
Take a valid ISBN-10 and swap two adjacent digits. This is called a \textit{transposition error}. \par
|
||||
When will the result be a valid ISBN-10?
|
||||
|
||||
\begin{solution}
|
||||
Let $n_1n_2...n_{10}$ be a valid ISBN-10. \par
|
||||
@ -68,7 +71,8 @@ This is called a \textit{transposition error}.
|
||||
\pagebreak
|
||||
|
||||
\definition{}
|
||||
ISBN-13 error checking is slightly different. Given a partial ISBN-13 $n_1 n_2 n_3 ... n_{12}$, the final digit is given by
|
||||
ISBN-13 error checking is slightly different. \par
|
||||
Given a partial ISBN-13 with digits $n_1 n_2 n_3 ... n_{12}$, the final digit is given by
|
||||
|
||||
$$
|
||||
n_{13} = \Biggr[ \sum_{i=1}^{12} n_i \times (2 + (-1)^i) \Biggl] \text{ mod } 10
|
||||
@ -127,7 +131,7 @@ Take a valid ISBN-13 and swap two adjacent digits. When will the result be a val
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}<isbn-nocorrect>
|
||||
\problem{}<isbnnocorrect>
|
||||
\texttt{978-008-2066-466} was a valid ISBN until I changed a single digit. \par
|
||||
Can you find the digit I changed? Can you recover the original ISBN?
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
\section{Error Correction}
|
||||
|
||||
As we saw in \ref{isbn-nocorrect}, the ISBN check-digit scheme does not allow us to correct errors. \par
|
||||
As we saw in \ref{isbnnocorrect}, the ISBN check-digit scheme does not allow us to correct errors. \par
|
||||
QR codes feature a system that does. \par
|
||||
|
||||
\vspace{1mm}
|
||||
@ -8,7 +8,8 @@ QR codes feature a system that does. \par
|
||||
Odds are, you've seen a QR code with an image in the center. Such codes aren't \say{special}---they're simply missing their central pixels. The error-correcting algorithm in the QR specification allows us to read the code despite this damage.
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\href{https://youtube.com/watch?v=dQw4w9WgXcQ}{\includegraphics[width = 3cm]{qr}}
|
||||
%\href{https://youtube.com/watch?v=dQw4w9WgXcQ}{\includegraphics[width = 3cm]{qr-rick}}
|
||||
\href{https://betalupi.com}{\includegraphics[width = 3cm]{qr-betalupi}}
|
||||
\end{figure}
|
||||
|
||||
\definition{Repeating codes}
|
||||
@ -47,7 +48,8 @@ What is the efficiency of a $k$-repeat code?
|
||||
|
||||
\vfill
|
||||
|
||||
As you just saw, repeat codes are not a good solution. You need many extra bits for even a small amount of redundancy. We need a better system.
|
||||
Repeat codes are not efficient. We need to inflate our message by
|
||||
\textit{three times} if we want to correct even a single error. We need a better system.
|
||||
|
||||
\pagebreak
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
\section{Hamming Codes}
|
||||
|
||||
Say we have a 16-bit message, for example \texttt{1011 0101 1101 1001}. \par
|
||||
Say we have an $n$-bit message, for example \texttt{1011 0101 1101 1001}. \par
|
||||
We will number its bits in binary, from left to right:
|
||||
|
||||
|
||||
@ -62,13 +62,14 @@ We will number its bits in binary, from left to right:
|
||||
|
||||
|
||||
\problem{}
|
||||
In this 16-bit message, how many message bits have an index with a one as the last digit? \par
|
||||
If we number the bits of a 16-bit message as described above, \par
|
||||
how many message bits have an index with a one as the last digit? \par
|
||||
(i.e, an index that looks like \texttt{***1})
|
||||
|
||||
\vspace{2cm}
|
||||
|
||||
\problem{}
|
||||
Say we number the bits in a 32-bit message as above. \par
|
||||
Now consider a 32-bit message. \par
|
||||
How many message bits have an index with a one as the $n^\text{th}$ digit? \par
|
||||
|
||||
\vspace{2cm}
|
||||
@ -76,7 +77,10 @@ How many message bits have an index with a one as the $n^\text{th}$ digit? \par
|
||||
|
||||
|
||||
|
||||
We now want a way to detect errors in our 16-bit message. To do this, we'll replace a few data bits with parity bits. This will reduce the amount of information we can send, but will also improve our error-detection capabilities.
|
||||
Now, let's come up with a way to detect errors in our 16-bit message.
|
||||
To do this, we'll replace a few data bits with parity bits.
|
||||
This will reduce the amount of information we can send,
|
||||
but will allow the receiver to detect errors in the received message.
|
||||
|
||||
\vspace{1mm}
|
||||
|
||||
@ -174,7 +178,8 @@ Can this coding scheme correct a single-bit error?
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
We'll now add four more parity bits, in positions \texttt{0001}, \texttt{0010}, \texttt{0100}, and \texttt{1000}:
|
||||
We'll now add four more parity bits, in positions \texttt{0001}, \texttt{0010}, \texttt{0100}, and \texttt{1000}: \par
|
||||
This error-detection scheme is called the \textit{Hamming code}.
|
||||
|
||||
\begin{center}
|
||||
\begin{tikzpicture}[scale = 1.25]
|
||||
@ -246,7 +251,7 @@ Bits \texttt{0100} and \texttt{1000} work in the same way. \par
|
||||
When counting bits in binary numbers, go from right to left.}
|
||||
|
||||
\problem{}
|
||||
Which message bits does each parity bit cover? \par
|
||||
Which message bits does each parity bit \say{cover}? \par
|
||||
In other words, which message bits affect the value of each parity bit? \par
|
||||
|
||||
\vspace{1mm}
|
||||
@ -358,7 +363,7 @@ Analyze this coding scheme.
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
Each of the following messages has either 0, 1, or two errors. \par
|
||||
Each of the following messages has either one, two, or no errors. \par
|
||||
Find the errors and correct them if possible. \par
|
||||
\hint{Bit \texttt{0000} should tell you how many errors you have.}
|
||||
|
||||
@ -590,7 +595,7 @@ A \textit{message stream} is an infinite string of binary digits.
|
||||
\problem{}
|
||||
Show that Hamming codes do not reliably detect bit deletions: \par
|
||||
\hint{
|
||||
Create a 17-bit message whose first 16 bits are a valid Hamming block, \par
|
||||
Create a 17-bit message whose first 16 bits are a valid Hamming-coded message, \par
|
||||
and which is still valid when a bit (chosen by you; not the $17^\text{th}$) is deleted.
|
||||
}
|
||||
|
||||
@ -598,10 +603,11 @@ Show that Hamming codes do not reliably detect bit deletions: \par
|
||||
|
||||
\problem{}
|
||||
Convince yourself that Hamming codes cannot correct insertions. \par
|
||||
Then, create a 16-bit message that...
|
||||
Then, create a 16-bit message that:
|
||||
\begin{itemize}
|
||||
\item is a valid Hamming block, and
|
||||
\item incorrectly "corrects" a single bit error when it encounters an insertion error.
|
||||
\item is itself a valid Hamming code, and
|
||||
\item incorrectly "corrects" a single bit error when it encounters an insertion error. \par
|
||||
You may choose where the insertion occurs.
|
||||
\end{itemize}
|
||||
|
||||
\vfill
|
||||
|
BIN
src/Advanced/Error-Correcting Codes/qr-betalupi.png
Normal file
BIN
src/Advanced/Error-Correcting Codes/qr-betalupi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
nosolutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
solutions,
|
||||
singlenumbering,
|
||||
nopagenumber
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\uptitlel{Advanced 2}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\uptitlel{Advanced 2}
|
||||
|
@ -4,7 +4,7 @@
|
||||
solutions,
|
||||
singlenumbering,
|
||||
shortwarning
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{tikz}
|
||||
|
13
src/Advanced/Gods, Demons, Mortals/main.typ
Normal file
13
src/Advanced/Gods, Demons, Mortals/main.typ
Normal file
@ -0,0 +1,13 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
|
||||
#show: handout.with(
|
||||
title: [Gods, Demons, and Mortals],
|
||||
by: "Mark",
|
||||
subtitle: [Based on Raymond Smullyan's _To Mock a Mockingbird_.],
|
||||
short_warning: true,
|
||||
)
|
||||
|
||||
#include "parts/00 warmup.typ"
|
||||
#pagebreak()
|
||||
|
||||
#include "parts/01 gods.typ"
|
6
src/Advanced/Gods, Demons, Mortals/meta.toml
Normal file
6
src/Advanced/Gods, Demons, Mortals/meta.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[metadata]
|
||||
title = "Gods, Demons, and Mortals"
|
||||
|
||||
[publish]
|
||||
handout = true
|
||||
solutions = true
|
62
src/Advanced/Gods, Demons, Mortals/parts/00 warmup.typ
Normal file
62
src/Advanced/Gods, Demons, Mortals/parts/00 warmup.typ
Normal file
@ -0,0 +1,62 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
|
||||
= Warm-Up
|
||||
|
||||
#problem("The Flower Garden")
|
||||
In a certain garden, each flower was either red, yellow, or blue, and all three colors were represented. A statistician once visited the garden and made the observation that whatever three flowers you picked, at least one of them was bound to be red.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
A second statistician visited the garden and made the observation that whatever three flowers you picked, at least one was bound to be yellow.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Two logic students heard about this and got into an argument. \
|
||||
The first student said: "It therefore follows that whatever three flowers you pick, at least one is bound to be blue,
|
||||
doesn't it?" The second student said: "Of course not!"
|
||||
Which student was right, and why?
|
||||
|
||||
#solution[
|
||||
The first student was right.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
From the first statistician's report it follows that there cannot be more than one yellow flower, because if there were two yellows, you could pick two yellows and one blue, thus having a group of three flowers that contained no red. This is contrary to the report that every group of three is bound to contain at least one red flower. Therefore there cannot be more than one yellow flower.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Similarly, there cannot be more than one blue flower, because if there were two blues, you could pick two blue flowers and one yellow and again have a group of three that contained no red. And so from the first statistician's report it follows that there is at most one yellow flower and one blue.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
And it follows from the report of the second statistician that there is at most one red flower, for if there were two reds,
|
||||
you could pick two reds and one blue, thus obtaining a group of three that contained no yellow. It also follows from the
|
||||
second report that there cannot be more than one blue, although we have already deduced this from the first report.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
The upshot of all this is that there are only three flowers in the entire garden---one red, one yellow, and one blue! And so it is of course true that whatever three flowers you pick, one of them must be blue.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
#problem("What Question")
|
||||
There is a question I could ask you that has a definite correct
|
||||
answer---either yes or no---but it is logically impossible for
|
||||
you to give the correct answer. You might know what the
|
||||
correct answer is, but you cannot give it. Anybody other than
|
||||
you might possibly be able to give the correct answer, but
|
||||
you cannot!
|
||||
|
||||
Can you figure out what question I could have in mind?
|
||||
|
||||
#solution[
|
||||
Suppose I ask you: "Is no your answer to this question?"
|
||||
|
||||
If you answer yes, then you are affirming that no is your answer to the question,
|
||||
which is of course wrong. If you answer
|
||||
no, then you are denying that no is your answer, although no
|
||||
was your answer.
|
||||
]
|
||||
|
||||
#v(1fr)
|
316
src/Advanced/Gods, Demons, Mortals/parts/01 gods.typ
Normal file
316
src/Advanced/Gods, Demons, Mortals/parts/01 gods.typ
Normal file
@ -0,0 +1,316 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
|
||||
= Gods, Demons, and Mortals
|
||||
|
||||
#generic("Setup:")
|
||||
One night, Inspector Craig had a curious dream.
|
||||
He had been browsing that day in a library specializing in rare
|
||||
books on mythology, another of his many interests. His head
|
||||
was filled with gods and demons, and so his dream was perhaps not so surprising.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Time sometimes passes in unusual ways in the course of a
|
||||
dream. Craig dreamed that he spent nine days in a region in
|
||||
which dwelled gods, demons, and mortals.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
The gods, of course, always told the truth, and the demons always lied. As to the mortals, half were knights and half were knaves. As usual, the knights told the truth and the knaves lied.
|
||||
|
||||
#problem("The First Day")
|
||||
Craig dreamed that on the first day he met a dweller of the
|
||||
region who looked as if he might be a god, though Craig could
|
||||
not be sure. The dweller evidently guessed Craig's thoughts,
|
||||
smiled, and made a statement to reassure him. From this statement, Craig knew that he was in the presence of a god.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Can you supply such a statement?
|
||||
|
||||
#solution[
|
||||
One statement that works is: "I am not a knight."
|
||||
|
||||
#v(2mm)
|
||||
|
||||
If the speaker were a knave or a demon, then it would be true that he was not a knight, but knaves and demons don't make true statements.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Therefore the speaker was neither a knave nor a
|
||||
demon, hence he was a knight or a god and his statement was
|
||||
true.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Since it was true, then he really is not a knight; hence he must be a god.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
|
||||
#problem("The Second Day")
|
||||
In this episode of the dream, Craig met a terrifying being who had every appearance of being a demon.
|
||||
|
||||
"What sort of being are you?" asked Craig, in some alarm.
|
||||
|
||||
The being answered, and Craig then realized that he was confronting not a demon, but a knave. \
|
||||
What could the being have answered?
|
||||
|
||||
#solution[
|
||||
A statement that works is: "I am a demon." Obviously
|
||||
no demon can claim he is a demon, so the speaker is not a
|
||||
demon. Therefore his statement was false and since he is not
|
||||
a demon, he must be a knave.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
|
||||
#problem("The Third Day")
|
||||
In this episode, Craig met a totally nondescript-looking being
|
||||
who from appearances could have been anything at all. The
|
||||
being then made a statement from which Craig could deduce
|
||||
that he was either a god or a demon, but Craig could not tell
|
||||
which.
|
||||
Can you supply such a statement?
|
||||
|
||||
#solution[
|
||||
This is a bit more tricky: A statement that works is: "I
|
||||
am either a god or a knave." That could be said by a god,
|
||||
since a god is either a god or a knave; it could also be falsely said by a demon.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
It couldn't be said by a knight, because a knight would never lie and claim that he is either a god or a knave, and it couldn't be said by a knave, because a knave would never admit to the true fact that he is either a god or
|
||||
a knave.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
And so the speaker must be either a god or a demon,
|
||||
but there is no way to tell which.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
|
||||
#problem("The Fourth Day")
|
||||
Craig next met a being who made the following two statements:
|
||||
- A god once claimed that I am a demon.
|
||||
- No knight has ever claimed that I am a knave.
|
||||
What sort of being was he?
|
||||
|
||||
|
||||
#solution[
|
||||
The speaker's first statement was obviously false, for if
|
||||
it were true, a god would have once claimed that the speaker
|
||||
was a demon, which would mean that the speaker really was
|
||||
a demon, but no one who tells the truth can be a demon. Since
|
||||
the first statement was false, so was the second statement, since it was made by the same speaker. Therefore a knight did once claim that the speaker was a knave, hence the speaker really
|
||||
is a knave.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
|
||||
#problem("The Fifth Day")
|
||||
A being made the following two statements to Craig:
|
||||
- I never claim to be a knave.
|
||||
- I sometimes claim that I am a demon.
|
||||
What sort of being are we now dealing with?
|
||||
|
||||
#solution[
|
||||
The speaker's second statement was obviously a lie, because no truth-teller would ever say that he sometimes claims
|
||||
to be a demon.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Therefore the first statement was also a lie,
|
||||
hence the speaker does sometimes claim to be a knave, hence
|
||||
he must be a demon.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
|
||||
#problem("The Sixth Day")
|
||||
In this episode, Craig came across two beings, each of whom
|
||||
made a statement. \
|
||||
Craig could then infer that at least one of
|
||||
them must be a god, but he could not tell which one. \
|
||||
From neither statement alone could Craig have deduced this. \
|
||||
What statements could the beings have made?
|
||||
|
||||
#solution[
|
||||
Many solutions are possible; here is one.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Let us call the two beings A and B. \
|
||||
Now, suppose A and B make the following two statements:
|
||||
- A: B is a knight.
|
||||
- B: A is not a knight.
|
||||
|
||||
A is either telling the truth or lying.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
*Case 1: A is telling the truth.* \
|
||||
Then B really is a knight,
|
||||
hence his statement is true, hence A is not a knight, therefore A must be a god, since he is telling the truth.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
|
||||
*Case 2: A is lying.* \
|
||||
Then B is not a knight, since A says he is. Also, since A is lying, then A is certainly not a knight, hence B's statement is true. Therefore B is telling the truth, but is not a knight, hence B is a god.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
So if Case 1 is true, A is a god; if Case 2 is true, then B is a god. \
|
||||
There is no way to tell whether A is telling the truth or lying.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
#problem("The Seventh Day")
|
||||
On the next day, Craig again met two beings each of whom
|
||||
made a statement. Craig could then infer that one of them was
|
||||
a knave and the other a demon, though he could not tell which
|
||||
was which. Again, from neither statement alone could Craig
|
||||
have inferred this. Can you supply two such statements?
|
||||
|
||||
#solution[
|
||||
Again, let us call the two beings A and B. \
|
||||
The following statements would work:
|
||||
- A: Both of us are knaves.
|
||||
- B: Both of us are demons.
|
||||
It is obvious that both are lying. Since A is lying, they are
|
||||
not both knaves. Since B is lying, they are not both demons.
|
||||
Therefore one is a knave and one is a demon, but there is no
|
||||
way to tell which one is which.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
|
||||
#problem("Introducing Thor")
|
||||
On the eighth day, Craig met a being who had every ap-
|
||||
pearance of being the god Thor. The being made a statement,
|
||||
and Craig then knew he must be Thor.
|
||||
What statement could Thor have made?
|
||||
|
||||
#solution[
|
||||
A statement that works is: "I am either a knave or a demon
|
||||
or the god Thor."
|
||||
|
||||
#v(2mm)
|
||||
|
||||
If the speaker were either a knave or a demon, then it would
|
||||
be true that he is either a knave or a demon or the god Thor.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
This would mean that a knave or a demon made a true statement, which is not possible. Therefore the speaker is neither a knave nor a demon, hence his statement is true.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Hence he must be the god Thor.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
#problem("A Perplexity Resolved")
|
||||
Craig and Thor became fast friends. In fact, on the evening of
|
||||
the ninth day, Thor gave a magnificent banquet in Craig's
|
||||
honor. "I propose a toast to our illustrious guest!" said Thor,
|
||||
as he raised his glass of nectar.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
After a round of cheers, Craig was asked to speak.
|
||||
"I am very perplexed!" said Craig as he rose. "I wonder
|
||||
if this may not all be a dream!"
|
||||
"Why do you think you may be dreaming?" asked Thor.
|
||||
"Because," said Craig, "two incidents have occurred today
|
||||
that seem totally inexplicable. This morning I met someone
|
||||
who made a statement which no knight, knave, god, or demon
|
||||
could possibly make. Then this afternoon I met someone else
|
||||
who also made a statement which no dweller of this region
|
||||
could possibly make. That is why I suspect that I may be
|
||||
dreaming. "
|
||||
|
||||
#v(2mm)
|
||||
|
||||
"Oh!" said Thor. "Be reassured; you are not dreaming.
|
||||
The two incidents have a perfectly rational explanation. You
|
||||
see, we have had two visitors here from another realm. Both
|
||||
of them are mortal. One is Cyrus, who always tells the truth,
|
||||
although he is not called a knight since he is not from this
|
||||
region. The other is Alexander, who sometimes tells the truth
|
||||
and sometimes lies. It must have been those two whom you
|
||||
met today. What statements did they make?"
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Craig then told the company what each had said.
|
||||
"That explains it perfectly!" said Thor. "Moreover, it follows from their having said what they did that Cyrus was the
|
||||
one you met in the morning. And interestingly enough, if you
|
||||
hadn't met Alexander in the afternoon, you could never have
|
||||
known whether the one you met in the morning was Cyrus
|
||||
or Alexander."
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Craig thought the matter over and realized that Thor was right. \
|
||||
What statements could these two outsiders have made which fulfill all of the above conditions?
|
||||
|
||||
#solution[
|
||||
Here is one possible solution:
|
||||
- morning speaker: "I am neither a knight nor a god."
|
||||
- afternoon speaker: "I am either a knave or a demon."
|
||||
|
||||
No inhabitant of the region could make either of those
|
||||
statements. No knight or god could claim that he is neither a
|
||||
knight nor a god; no knave or demon could make the true
|
||||
statement that he is neither a knight nor a god.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
As for the second statement, obviously no knight or god would claim to be either a knave or a demon and no knave or demon would admit to being a knave or a demon. Therefore both were outsiders; namely, Cyrus and Alexander.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
|
||||
The statement of the morning speaker was true and the statement of the afternoon speaker was false. Since Cyrus never makes false statements, he couldn't have been the afternoon speaker. Thus he was the morning speaker.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
#problem("A Philosophical Puzzle")
|
||||
The next morning, Craig was wide awake and recalling
|
||||
his dream. He wondered whether he had been logically inconsistent in his sleep. "The trouble is this," thought Craig: "In my dream I believed that Thor was a god and that gods always tell the truth. Yet Thor told me that I wasn't dreaming. Now how could Thor, who tells the truth, say that I wasn't dreaming when in fact I was? Wasn't this an inconsistency on my part?"
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Would you say that Craig's dream was logically inconsistent?
|
||||
|
||||
#solution[
|
||||
As I see it, Craig's dream was not necessarily inconsistent. If Craig had actually believed in the dream that he was dreaming, then the set of his beliefs during his dream would have been inconsistent, since the following propositions are indeed logically contradictory:
|
||||
- Thor is a god
|
||||
- Gods make only true statements
|
||||
- Thor stated that Craig was not dreaming;
|
||||
- Craig was dreaming.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
The contradiction is obvious. However, there is no evidence that Craig at any time of his dream believed that he was dreaming, although at one point he wondered whether he might be dreaming. Craig presumably believed that he was awake, and this belief, though false, was perfectly consistent with the other beliefs of his dream.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
Curiously enough, if Craig had formulated the belief that he was dreaming, then this belief, though correct, would have created a logical inconsistency!
|
||||
]
|
231
src/Advanced/Gods, Demons, Mortals/parts/01 logician.typ
Normal file
231
src/Advanced/Gods, Demons, Mortals/parts/01 logician.typ
Normal file
@ -0,0 +1,231 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
|
||||
= The Absentminded Logician
|
||||
|
||||
#problem("Only Three Words?")
|
||||
We are given three brothers named John, James, and William.
|
||||
John and James always lie, but William always
|
||||
tells the truth. The three are indistinguishable in appearance.
|
||||
You meet one of the three brothers on the street one day and
|
||||
wish to find out whether he is John (because John owes you
|
||||
money). You are allowed to ask him one question answerable
|
||||
by yes or no, but the question may not contain more than
|
||||
three words! What question would you ask?
|
||||
|
||||
#solution[
|
||||
The only three-word question I can think of that works
|
||||
is: "Are you James?" If you are addressing John, he will answer
|
||||
yes, since John lies, whereas both James and William would
|
||||
answer no-James because he lies, and William because he tells
|
||||
the truth. So a yes answer means that he is John and a no
|
||||
answer means that he is not John.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
#problem("A Variant")
|
||||
Suppose we change the above conditions by making John and
|
||||
James both truthful and William a liar. Again you meet one
|
||||
of the three and wish to find out if he is John. Is there now a
|
||||
three-word yes/no question that can accomplish this?
|
||||
|
||||
#solution[
|
||||
The very same question---"Are you James?"---works,
|
||||
only a yes answer now indicates that he isn't John and a no
|
||||
answer indicates that he is John.
|
||||
]
|
||||
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
#problem("A More Subtle Puzzle")
|
||||
We now have only two brothers (identical twins). One of them
|
||||
is named Arthur and the other has a different name. One of
|
||||
the two always lies and the other always tells the truth, but
|
||||
we are not told whether Arthur is the liar or the truth-teller.
|
||||
One day you meet the two brothers together, and you wish
|
||||
to find out which one is Arthur. Note that you are not inter-
|
||||
ested in finding out which one lies and which one tells the
|
||||
truth, but only in finding out which one is Arthur. You are
|
||||
allowed to ask just one of them a question answerable by yes
|
||||
or no, and again the question may not contain more than three
|
||||
words. What question would you ask?
|
||||
|
||||
#solution[
|
||||
A common wrong guess is: "Are you Arthur?" This question is quite useless here; the answer you get could be the truth
|
||||
or a lie, and you would still have no idea which one is really
|
||||
Arthur.
|
||||
|
||||
A question that works is: "Is Arthur truthful?" Arthur will
|
||||
surely answer yes to this question, because if Arthur is truthful,
|
||||
he will truthfully claim that Arthur is truthful, and if Arthur
|
||||
is not truthful, then he will falsely claim that Arthur is truthful.
|
||||
So regardless of whether Arthur is truthful or whether he lies,
|
||||
he will certainly claim that Arthur is truthful.
|
||||
|
||||
On the other hand, Arthur's brother---call him Henry---will claim that Arthur is not truthful, because if Henry is truthful, then Arthur is really not truthful and Henry will truthfully claim that Arthur is not. And if Henry lies, then Arthur really is truthful,inwhich case Henry will falsely claim that Arthur is not truthful. So whether Henry is truthful or not, he will surely claim that Arthur is not truthful.
|
||||
|
||||
In summary, Arthur will claim that
|
||||
Arthur is truthful and Arthur's brother will claim that Arthur
|
||||
is not truthful. So if you ask one of the brothers whether Arthur is truthful, and if you get yes for an answer, you will
|
||||
know that you are speaking to Arthur; if you get no for an
|
||||
answer, you will know that you are speaking to Arthur's
|
||||
brother.
|
||||
|
||||
Incidentally, there is another three-word question that
|
||||
works: "Does Arthur lie?" A yes answer to that question
|
||||
would indicate that you are not speaking to Arthur, and a no
|
||||
answer would indicate that you are speaking to Arthur. I leave
|
||||
the verification of this to the reader.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
#problem()
|
||||
Suppose that instead of wanting to find out which one is Arthur, you want to find out whether Arthur is the liar or the
|
||||
truth-teller. Again there is a three-word question that will do
|
||||
this. What three-word question will work? There is a pretty
|
||||
symmetry between the solutions of this and the last problem!
|
||||
|
||||
#solution[
|
||||
To find out whether Arthur is truthful, all you need to
|
||||
ask is: "Are you Arthur?" Suppose you get the answer yes. If
|
||||
it is a truthful answer, then the one addressed really is Arthur,
|
||||
in which case Arthur is the truthful brother.
|
||||
|
||||
If the answer is
|
||||
a lie, then the answerer is not really Arthur, in which case
|
||||
Arthur must be the other one, again the truthful brother. So
|
||||
regardless of whether the answer is truthful or a lie, a yes
|
||||
answer indicates that Arthur-whichever one he is-must be
|
||||
truthful. What if you get no for an answer?
|
||||
|
||||
Well, if it is a
|
||||
truthful answer, then the speaker is not Arthur, but since he
|
||||
is truthful, Arthur must be the brother who lies. On the other
|
||||
hand, if the no answer was a lie, then the speaker really is
|
||||
Arthur, in which case Arthur just told a lie. So a no answer,
|
||||
whether it is the truth or a lie, indicates that Arthur is the liar.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
#problem()
|
||||
This time, all you are interested in finding out is which of the
|
||||
two brothers you meet is the liar and which is the truth-teller.
|
||||
You don't care which one is Arthur, or whether Arthur is the
|
||||
liar or the truth-teller. What three-word question will accomplish this?
|
||||
|
||||
#solution[
|
||||
Just ask him: "Do you exist?
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
#problem()
|
||||
Next you are told to ask one of the brothers just one three-
|
||||
word question. If he answers yes, you will get a prize; if he
|
||||
answers no, then you get no prize. What question would you
|
||||
ask?
|
||||
|
||||
#solution[
|
||||
Just ask: "Are you truthful?" Both constant truth-tellers
|
||||
and constant liars will answer yes to that question.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
|
||||
#problem("The Absentminded Logician")
|
||||
A certain logician, though absolutely brilliant in theoretical
|
||||
matters, was extremely unobservant and highly absent-
|
||||
minded. He met two beautiful identical-twin sisters named
|
||||
Teresa and Lenore. The two were indistinguishable ill ap-
|
||||
pearance, but Teresa always told the truth and Lenore always
|
||||
lied. The logician fell in love with one of them and married
|
||||
her, but unfortunately he forgot to find out her first name!
|
||||
The other sister didn't get married till a couple of years later.
|
||||
|
||||
Quite shortly after the wedding, the logician had to go
|
||||
away for a logic conference. He returned a few days later. He
|
||||
then met one of the two sisters at a cocktail party and, of
|
||||
course, had no idea whether or not it was his wife. "I can find
|
||||
out in only one question," he thought proudly. "I'll simply
|
||||
use the Nelson Goodman principle and ask her if she is the
|
||||
type who could claim that she is my wife!" Then he had an
|
||||
even better idea: "I don't really have to be that elaborate and
|
||||
ask such a convoluted question. Why, I can find out if she is
|
||||
my wife by asking a much simpler question-in fact, one having only three words!"
|
||||
|
||||
The logician was right! What three-word question answerable
|
||||
by yes or no should he ask to find out whether the lady he was addressing was his wife?
|
||||
|
||||
#solution[
|
||||
We recall that his wife's sister was not married at the time.
|
||||
A three-word question that works is: "Is Teresa married?"
|
||||
Suppose the lady answers yes. She is either Teresa or Lenore.
|
||||
Suppose she is Teresa. Then the answer is truthful, hence Teresa is really married,
|
||||
and the lady addressed is married and his
|
||||
wife. If she is Lenore, the answer is a lie; Teresa is not really
|
||||
married, so Lenore-who is the lady addressed-is married,
|
||||
hence again the lady addressed is his wife. So a yes answer
|
||||
indicates that he is speaking to his wife, regardless of whether
|
||||
the answer is the truth or a lie. I leave it to the reader to verify
|
||||
that a no answer indicates that he is speaking to his wife's sister.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
|
||||
|
||||
#problem()
|
||||
A few days later the logician again met one of the two sisters
|
||||
at another cocktail party. He again didn't know whether it was
|
||||
his wife or his sister-in-law. "It's high time I find out once
|
||||
and for all my wife's first name," he thought. "I can ask this
|
||||
lady just one three-word yes/no question, and then I'll know!"
|
||||
What three-word question could he ask?
|
||||
|
||||
#solution[
|
||||
The question to ask now is: "Are you married?" Suppose
|
||||
she answers yes. Again, she is either Teresa or Lenore. Suppose
|
||||
she is Teresa. Then the answer is truthful, hence the lady ad-
|
||||
dressed is married, and since she is Teresa, he is married to
|
||||
Teresa. But ,what if the lady addressed is Lenore? Then the
|
||||
answer is a lie, hence the lady addressed is not really married,
|
||||
and he is married to the other lady, again Teresa. So in either
|
||||
case, a yes answer indicates that his wife's name is Teresa.
|
||||
I again leave it to the reader to verify that a no answer
|
||||
indicates that his wife's name is Lenore.
|
||||
]
|
||||
|
||||
#v(1fr)
|
||||
#pagebreak()
|
||||
|
||||
#problem()
|
||||
Suppose that in the last problem, the logician had wanted to
|
||||
know both the identity of the lady he met and the first name
|
||||
of his wife. He is again restricted to asking only one question
|
||||
answerable by yes or no, but this time there is no restriction
|
||||
on the number of words in the question.
|
||||
Can you find a question that will work?
|
||||
|
||||
#solution[
|
||||
No, because no such question exists!
|
||||
You see, in each of the preceding problems, we were trying
|
||||
to find out which of two possibilities holds, but in this problem,
|
||||
we are trying to find out which ofJour possibilities holds.
|
||||
|
||||
(The four possibilities are that the lady addressed is Teresa,
|
||||
his wife; that she is Lenore, his wife; that she is Teresa, his
|
||||
sister-in-law; and that she is Lenore, his sister-in-law.)
|
||||
|
||||
However,
|
||||
a yes/no question can elicit only two possible responses,
|
||||
and with only two possible responses it is impossible to
|
||||
determine which of four possibilities holds.
|
||||
]
|
||||
|
||||
#v(1fr)
|
@ -2,7 +2,7 @@
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\input{tikxset}
|
||||
|
@ -22,7 +22,7 @@
|
||||
label/.style = {
|
||||
circle,
|
||||
% For automatic red background in solutions
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
draw = none
|
||||
},
|
||||
%
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
nosolutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
\usepackage{units}
|
||||
\input{src/tikzset}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../../lib/tex/ormc_handout}
|
||||
]{../../../../lib/tex/handout}
|
||||
\usepackage{../../../../lib/tex/macros}
|
||||
\usepackage{units}
|
||||
\input{tikzset}
|
||||
|
@ -462,7 +462,7 @@ Thus,
|
||||
\end{equation*}
|
||||
|
||||
|
||||
\begin{ORMCbox}{Review: Multiplying Vectors by Matrices}{black!10!white}{black!65!white}
|
||||
\begin{hobox}{Review: Multiplying Vectors by Matrices}{black!10!white}{black!65!white}
|
||||
\begin{equation*}
|
||||
Av =
|
||||
\begin{bmatrix}
|
||||
@ -480,7 +480,7 @@ Thus,
|
||||
\end{equation*}
|
||||
|
||||
Note that each element of $Av$ is the dot product of a row in $A$ and a column in $v$.
|
||||
\end{ORMCbox}
|
||||
\end{hobox}
|
||||
|
||||
\problem{}
|
||||
Compute the following product:
|
||||
|
@ -154,7 +154,7 @@ The \textit{Hadamard Gate} is given by the following matrix: \par
|
||||
\end{equation*}
|
||||
\note{Note that we divide by $\sqrt{2}$, since $H$ must be orthonormal.}
|
||||
|
||||
\begin{ORMCbox}{Review: Matrix Multiplication}{black!10!white}{black!65!white}
|
||||
\begin{hobox}{Review: Matrix Multiplication}{black!10!white}{black!65!white}
|
||||
Matrix multiplication works as follows:
|
||||
|
||||
\begin{equation*}
|
||||
@ -196,7 +196,7 @@ The \textit{Hadamard Gate} is given by the following matrix: \par
|
||||
|
||||
This is exactly the first column of the matrix product. \par
|
||||
Also, note that each element of $Ac_0$ is the dot product of a row in $A$ and a column in $c_0$.
|
||||
\end{ORMCbox}
|
||||
\end{hobox}
|
||||
|
||||
|
||||
\problem{}
|
||||
|
@ -13,7 +13,7 @@
|
||||
line width = 0.35mm
|
||||
},
|
||||
qubit/.style = {
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
line width = 0.35mm
|
||||
},
|
||||
wire/.style = {
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{ifthen}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
nosolutions,
|
||||
singlenumbering,
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
\usepackage{units}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
%shortwarning
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\graphicspath{ {./images/} }
|
||||
|
@ -2,7 +2,7 @@
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{amsmath}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\input{tikxset.tex}
|
||||
|
@ -24,7 +24,7 @@
|
||||
label/.style = {
|
||||
rectangle,
|
||||
% For automatic red background in solutions
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
draw = none,
|
||||
rounded corners = 0mm
|
||||
},
|
||||
|
@ -4,7 +4,7 @@
|
||||
solutions,
|
||||
singlenumbering,
|
||||
shortwarning
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
\input{diagram}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
shortwarning
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{chessfss}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{units}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
\usetikzlibrary{calc}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
label/.style = {
|
||||
rectangle,
|
||||
% For automatic red background in solutions
|
||||
fill = \ORMCbgcolor,
|
||||
fill = \bgcolor,
|
||||
draw = none,
|
||||
rounded corners = 0mm
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
% use [nosolutions] flag to hide solutions.
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[solutions]{../../../lib/tex/ormc_handout}
|
||||
\documentclass[solutions]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
singlenumbering
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\usepackage{units}
|
||||
|
@ -190,7 +190,7 @@ For example, see the proof of the statement in \ref{binomsum} on the next page.
|
||||
\pagebreak
|
||||
|
||||
|
||||
\begin{ORMCbox}{Alternative Proof}{ogrape!10!white}{ogrape}
|
||||
\begin{hobox}{Alternative Proof}{ogrape!10!white}{ogrape}
|
||||
Consider the following problem: \par
|
||||
How many ways are there to write a number $x$ as an ordered sum of positive integers? \par
|
||||
\note{
|
||||
@ -234,7 +234,7 @@ For example, see the proof of the statement in \ref{binomsum} on the next page.
|
||||
We've found that the number of ways to split $x$ can be written as either
|
||||
$\sum_{n = 1}^{x-1} \binom{x-1}{n}$ or $2^{x-1}$,
|
||||
and therefore $\sum_{n = 1}^{x-1} \binom{x-1}{n} = 2^{x-1}$.
|
||||
\end{ORMCbox}
|
||||
\end{hobox}
|
||||
|
||||
|
||||
\pagebreak
|
@ -2,7 +2,7 @@
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
% use [nosolutions] flag to hide solutions.
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[solutions]{../../../lib/tex/ormc_handout}
|
||||
\documentclass[solutions]{../../../lib/tex/handout}
|
||||
\usepackage{adjustbox}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
% use [nosolutions] flag to hide solutions.
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[solutions]{../../../lib/tex/ormc_handout}
|
||||
\documentclass[solutions]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
shortwarning,
|
||||
singlenumbering,
|
||||
nopagenumber
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
\geometry{top = 20mm}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
hidewarning,
|
||||
singlenumbering,
|
||||
nopagenumber
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
hidewarning,
|
||||
singlenumbering,
|
||||
nopagenumber
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
hidewarning,
|
||||
singlenumbering,
|
||||
nopagenumber
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
\def\utri#1#2{
|
||||
@ -102,7 +102,7 @@
|
||||
|
||||
\vfill
|
||||
|
||||
\begin{ORMCbox}{Notes}{ogrape!10!white}{ogrape}
|
||||
\begin{hobox}{Notes}{ogrape!10!white}{ogrape}
|
||||
\begin{itemize}
|
||||
\item
|
||||
Each player needs to make multiple groups before the first player's second turn. \par
|
||||
@ -111,7 +111,7 @@
|
||||
|
||||
\item Groups are easiest to secure near the corners or along the edges. Play there first. \par
|
||||
\end{itemize}
|
||||
\end{ORMCbox}
|
||||
\end{hobox}
|
||||
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
\documentclass[
|
||||
solutions,
|
||||
shortwarning
|
||||
]{../../../lib/tex/ormc_handout}
|
||||
]{../../../lib/tex/handout}
|
||||
\usepackage{../../../lib/tex/macros}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user