The Logic of CUE Curriculum
Phase 1 output under the Video Curriculum Guide. Every unit is one video plus one post and carries exactly one idea.
What the series is. A short series on the concept page The Logic of CUE (read 2026-11-12, page last modified 2025-05-23), checked against cue v0.17.1. Nine units, under ten minutes in total. The audience writes configuration or code and has not used CUE.
Recorded source statements. Every claim in the scripts rests on one of these, quoted from the page by section, or on a command run with cue v0.17.1.
Types are values: "There are two core aspects of CUE that make it different from the usual programming or configuration languages:" then two list items, "Types are values" and "Values (and thus types) are ordered into a lattice". "They simplify the language, as many concepts that are distinct in other languages fold together. The resulting order independence simplifies reasoning about values for both humans and machines." Listed feature: "a single language for specifying data, schema, validation and policy constraints,".
The Value Lattice: "Every value in CUE, including what would in most programming languages be considered types, is partially ordered in a single hierarchy (a lattice, to be precise). Even entire configurations and schemas are placed in this hierarchy."
What is a lattice?: "A lattice is a partially ordered set, in which every two elements have a unique least upper bound (join) and greatest lower bound (meet). By definition this means there is always a single root (top) and a single leaf (bottom)." "In more general terms, we then say that A subsumes B, or that B is an instance of A." "An important aspect of a lattice is that for every two elements, there is a unique instance of both elements that subsumes all other elements that are an instance of both elements. This is called the greatest lower bound, or meet." "In that case, we could always unambiguously merge two such configurations independently of order. This is exactly what CUE does!"
Booleans: "This diagram shows that CUE interprets both true and false as an instance of bool." "What is less ordinary is that, to CUE, bool is just as much a value as true and false." "For instance, when we say that a value is both a bool and true, or in lattice terms, if we find the greatest lower bound of these values, the answer is true. Again maybe no surprise, except that in CUE this is actually an operation, denoted bool & true." "Bottom, in this example, is the result of computing true & false. A value cannot be both true and false, so this an error. Bottom is analogous to an error in many other languages. Bottom is an instance of every value and type, in fact."
Numbers: "CUE recognizes number, and the instances int and float as classes of numbers. For now it suffices to only consider number and int, the latter being an instance of the former." "But we also see “constraints”, a category of values that falls between the traditional concepts of value and type." "It allows all binary operators that result in a boolean, except ==, to be used as a constraint by leaving off the left value, where op B defines the set of all values A for which A op B is true. The constraint <10 means all numbers less than 10."
CUE types: The diagram puts "⊤ (top)" above bool, null, bytes, number, struct, list and string, and "⊥ (bottom)" below them. "The | operator in CUE allows one to define “sum types” like int | string. The same operator can also be used to describe what are called “enums” in other languages, for instance, 1 | 2 | 3. To CUE these two things—disjunctions of types and disjunctions of values—are the same thing." "These various uses of | are not the result of operator overloading: they are all the same operation in CUE."
Structs: Diagram: municipality (name: string, population: int), big city (name: string, population: >1M in the page; the screen uses int & >1M, see the cue run), London (name: 'London', population: 8M), captioned "London is a big city, which is a municipality". "Loosely speaking, a struct is an instance of another if it has at least all the fields defined by the parent and if its constraints on these fields are at least as strict as those defined by its parent." "For a newer version of an API to be backwards compatible with the previous version it must subsume it. In other words, the old version must be an instance of the new one. Or yet another way to say it: a new version may not forbid what was allowed in the older version." The script uses only the instance relation; the backward-compatibility analogy ("The instance relation for structs has an analogy in software engineering: backwards compatibility.") is on the parking list.
Structs, optional fields: "With optional fields it gets a bit more subtle, but basically, an instance may change an optional field to required, but not remove it." Caption: "Required is more specific than optional". Caption: "Conflicting values for optional fields result in disallowing that field, conflicting required fields result in a faulty struct". "An important thing to note is that, unlike for required fields, conflicting values for an optional field do not cause a struct to be faulty." "If for an optional field we find the value ⊥, we can infer "not that field", or, drop it. If we derive ⊥ for a required field, we have a problem, as a required field cannot be omitted."
Default values: "Default values are CUE’s equivalent of inheritance, specifically the kind that allows instances to override any value of its parent."
Relation to inheritance: "In CUE, if one sees a concrete value for a field, it is guaranteed that this will be the final result. If a value is not concrete (like string), it is clear the search for a concrete value is not over. In other words, an instance may never violate the constraints of its parent." "Default values do not change this property; they syntactically appear as non-concrete values. CUE also bails out and requires explicit values if two conflicting defaults are specified for the same field, again limiting the search space." "With approaches that allow overrides, whether it be the complex inheritance used in languages like GCL and Jsonnet or the much simpler file-based approaches as used in HCL and Kustomize, finding a declaration for a concrete field value does not guarantee a final answer, because another concrete value that occurs elsewhere can override it." "CUE will catch an erroneous change to that value and report the conflicting locations." "Where CUE simplifies constraints (>=3 & <=10 and >=5 & <=20 become >=5 & <=10, >=1 & <=1 becomes 1), GCL and Jsonnet do not".
Semantics (defaults): "CUE defaults, which are values marked with a in disjunctions, preserve the beneficial properties of the lattice. In order to do so, CUE must ensure that the order of picking defaults does not influence the outcome." On two fields with defaults 1 and 2 that are set equal: "So the answer in this case is that there are no concrete values as the defaults cannot be used." The scripts use the one-field case, which rests on "CUE also bails out and requires explicit values if two conflicting defaults are specified for the same field" (Relation to inheritance).
File organization: "What applies at the language level also applies at the file level. Within a package, or project, there is no need for files to mutually import each other."
cue v0.17.1, run 2026-11-12: Checked with cue eval: bool & true gives true. true & false gives "conflicting values false and true". _ & int gives int. <10 & 3 gives 3. >=3 & <=10 & >=5 & <=20 gives >=5 & <=10. "info" | "warn" | "error" with "warn" gives "warn"; with "debug" it is an error. {port: 80} & {port: 90} is an error. {port?: 80} & {port?: 90} gives {}, and {port?: 80} & {port?: 90} & {port: 80} is an error ("conflicting values"). {name: string} unified with a struct that has name and population gives that struct unchanged. replicas: 3 with replicas: 5 gives "conflicting values 5 and 3" with both positions. replicas: int | *1 gives 1; with replicas: 3 gives 3; with replicas: int | *2 gives the non-concrete int | 2 | 1. Two things the page says that this version prints differently, and the scripts therefore do not claim: true | false prints true | false, not bool; >=1 & <=1 prints >=1 & <=1, not 1. A fourth difference: the page's big city card says population: >1M, which in cue admits non-integers and so is not an instance of population: int; the screen shows int & >1M, which is (municipality unified with it returns it unchanged, and London still unifies). A third difference: for two conflicting defaults the page says the fields are left as int; cue prints int | 2 | 1, so the screen shows what cue prints.
Shared visual language. Fixed for the whole series.
Value box. A rounded box with monospace text. Every CUE value, type or constraint is drawn this way, because they are the same kind of thing.
Order line. A plain line between two value boxes. The upper box is more general, the lower is an instance of it.
Result. A value box outlined in teal: what CUE computes.
Bottom. A value box outlined in red, text _|_: an error.
Card. A panel holding a few lines of CUE: a struct or a file.
Default. Amber marks a starred default.
Metaphor drawings. Plain line drawings, one per unit, only in the beat that speaks the metaphor.
Parking list. True and on the page, but not needed for these nine ideas:
Mixing a constraint into many values from one place (jobs: [string]: acmeMonitoring) and across files.
Cycles: a: b, b: a, and a: b + 1, b: a - 1, b: 1.
The join side of the lattice: the page says true | false is bool; cue v0.17.1 prints it unresolved.
Null, and how TypeScript's undefined, void and null map onto CUE.
The formal definition of subsumption and unification over typed feature structures.
Tools that fall out: backward-compatibility checks, querying, cue trim.
Closed structs and definitions.
Backward compatibility as an instance-of question (the page calls it an analogy).
The word lattice itself, and the join operation.
1. A type is a value
Idea. In CUE a type such as bool is a value: the same kind of thing as true, only less specific.
Why it matters. Schema and data stop being two languages. One notation describes both, which is what every later unit builds on.
Context the viewer already has. None. This is the first unit.
Metaphor. Places. Spain and one street address in Madrid are both places; one is just less specific. Breaks at: places nest by containment only, so the script does not use it for combining values.
Misconception. Types are a separate layer that sits above values and checks them. Corrected in beats 3 and 5: bool is drawn and spoken as a value.
Sources. Types are values; Booleans.
Target length. about 57 seconds (90 words).
Check question. In CUE, what is the difference between bool and true?
Beats and script.
Screen: bool on the left, true on the right.
Most languages keep two worlds.
Types, like bool. And values, like true.
Screen: a wall between bool and true.
A type describes values. A value is the thing itself.
They are kept apart.
Screen: the wall goes; both are value boxes.
CUE removes the wall.
To CUE, bool is a value too.
Screen: Spain above a street address in Madrid.
Think of places.
Spain is a place. So is one street address in Madrid.
One is just less specific.
Screen: bool above true, an order line between.
Bool is the less specific one.
It says: true or false, not decided yet.
True is decided.
Screen: bool above true; both light.
So a description of data, and the data, are written the same way.
One language for both.
2. Every value has a place in one order
Idea. All CUE values sit in one order, from top, which is any value, down to bottom, which is an error; lower means more specific, and two values can sit side by side.
Why it matters. Once everything is in one order, questions like "does this data fit this schema" become "is this below that".
Context the viewer already has. Unit 1: a type is a value.
Metaphor. A guessing game. Before any answer it could be anything; each answer narrows it. Breaks at: a game ends on one answer and has no contradictions, so the script uses it only for narrowing and leaves bottom to the value boxes.
Misconception. An error is something outside the value system. Corrected in beat 6: bottom is the lowest point of the order.
Sources. The Value Lattice; What is a lattice?; Booleans; Numbers; CUE types; cue run.
Target length. about 61 seconds (102 words).
Check question. What sits at the very top of CUE's order, and what sits at the very bottom?
Beats and script.
Screen: number above int above 7.
CUE puts every value in one order.
Number is above int. Int is above seven.
Screen: the same column; the 7 lights.
Lower means more specific.
We say seven is an instance of int.
Screen: an 8 appears beside the 7.
Eight is an instance of int too.
Seven and eight sit side by side. Neither is above the other.
Screen: a wide ring that narrows.
It works like a guessing game.
Before any answer, it could be anything.
Each answer narrows it down.
Screen: underscore box above number, int, 7.
The very top is written as an underscore.
It means any value at all.
Screen: red bottom box below 7 and 8.
Below everything is bottom.
It is how CUE writes an error.
So an error is not outside the order. It is the lowest point.
3. Unifying two values gives exactly one result
Idea. The & operator, unification, gives the highest value that is an instance of both sides; there is exactly one, so it does not matter which side comes first.
Why it matters. Two people, or two files, can each state what they need, and the result does not depend on who went first.
Context the viewer already has. Units 1 and 2: values, instance of, bottom.
Metaphor. Two stencils laid on top of each other: paint gets through only where both are cut, and swapping them changes nothing. Breaks at: a stencil overlap is not itself a stencil you would name, so the script stops at order independence.
Misconception. Combining configuration means the later one wins. Corrected in beats 4 and 6: nothing wins; both hold or it is an error.
Sources. What is a lattice?; Booleans; File organization; cue run.
Target length. about 59 seconds (100 words).
Check question. What does true & false give, and why does a & b equal b & a?
Beats and script.
Screen: bool & true.
The ampersand combines two values.
CUE calls this unifying.
Screen: bool above true; true lights as the result.
The result is the highest value that is an instance of both.
Unify bool with true, and you get true.
Screen: two stencils overlapping; the overlap lights.
Picture two stencils, one on top of the other.
Paint only gets through where both are cut.
Screen: the stencils swap; the overlap stays.
Swap them. The result is the same.
There is exactly one answer, so it does not matter which comes first.
Screen: true & false gives red bottom.
What if nothing is an instance of both?
Unify true with false, and you get bottom. An error.
Screen: two file cards, one result below.
Whole files unify the same way.
No file wins. Both hold, or you get an error.
4. A constraint is a value too
Idea. A constraint such as <10 is a value that sits between a type and a single number.
Why it matters. A rule about data is written in the same notation as the data it checks, and rules combine like any other value.
Context the viewer already has. Units 1 to 3: values, the order, unifying.
Metaphor. The height bar at a fairground ride. The bar is not anyone's height, but it is a real thing and it sorts heights. Breaks at: a bar only tests, so the script moves to value boxes before showing constraints unify.
Misconception. Validation rules are separate code that runs against data. Corrected in beats 2 and 4: the rule is a value in the same order as the numbers.
Sources. Numbers; Relation to inheritance; cue run.
Target length. about 62 seconds (104 words).
Check question. Where does <10 sit in the order, relative to number and to 3?
Beats and script.
Screen: x < 10.
Take a comparison.
X is less than ten.
Screen: the x drops away, leaving <10.
Drop the left side.
What is left is a value, called a constraint.
It means every number below ten.
Screen: a height bar with a line across.
It is like the height bar at a ride.
The bar is not anyone's height. But it is real, and it sorts heights.
Screen: number above <10 above 3.
Less than ten sits below number, and above three.
Between a type and a single number.
Screen: two spans on a number line; the overlap lights.
Constraints unify like any other value.
Three to ten, with five to twenty, gives five to ten.
Screen: <10 & 3 gives 3.
Unify less than ten with three, and you get three.
The constraint and the number are the same kind of thing.
5. One operator for either-or
Idea. The | operator means "one of these", and it is the same operation whether the alternatives are values, an enum, or types, a sum type.
Why it matters. Two features that other languages keep apart collapse into one, because types are values.
Context the viewer already has. Units 1 to 3: a type is a value, unifying, bottom.
Metaphor. A menu. It can list single dishes or whole kinds of dish; either way it is a list of choices. Breaks at: a menu does not say what happens when two menus meet, so the script only unifies a menu with one choice.
Misconception. Enums and union types are different features with different rules. Corrected in beat 3.
Sources. CUE types; cue run.
Target length. about 58 seconds (98 words).
Check question. Why does CUE not need separate features for enums and sum types?
Beats and script.
Screen: "info" | "warn" | "error".
The pipe means: one of these.
Info, or warn, or error.
Other languages call this an enum.
Screen: int | string.
Int or string.
Other languages call this a sum type: a value that may be one of several types.
Screen: both lines together.
To CUE they are the same operation.
Types are values, so there is nothing to tell apart.
Screen: a menu card with three lines.
It is a menu.
A menu can list single dishes, or whole kinds of dish.
Either way, it is a list of choices.
Screen: the enum unified with "warn" gives "warn".
Unify a menu with a choice, and you get the choice.
Screen: the enum unified with "debug" gives red bottom.
Choose something that is not on it, and you get bottom.
6. Structs are ordered by their fields
Idea. One struct is an instance of another when it has at least the same fields, with constraints at least as strict; nobody has to declare the relationship.
Why it matters. Whether data matches a schema, or one schema is a tighter version of another, is settled by looking at the fields. Nothing has to be declared.
Context the viewer already has. Units 2 and 4: instance of, constraints.
Metaphor. A paper form. Every box you fill in, and every box you add, makes the form more specific. Breaks at: a form has no notion of two forms being combined, so the script uses it only for "more specific".
Misconception. One structure is a kind of another only if someone declared it, as with class inheritance. Corrected in beat 4: it follows from the fields.
Sources. Structs.
Target length. about 62 seconds (108 words).
Check question. What two things make one struct an instance of another?
Beats and script.
Screen: a card: name: string, population: int.
A struct is a set of named fields.
A municipality has a name, and a population.
Screen: a second card below: name: string, population: int & >1M.
A big city is stricter.
Its population is an int over a million.
Screen: a third card below: name: "London", population: 8M.
London fills in both fields. Its population is eight million.
London is a big city, which is a municipality.
Screen: the three cards; order lines draw between them.
Nobody declared that. It follows from the fields.
Loosely: an instance has at least the same fields, with constraints at least as strict.
Screen: a paper form; one box fills in.
Think of a paper form.
Each box you fill in makes it more specific.
Screen: name card above name-and-population card.
Adding a field does the same.
A struct with a name and a population is an instance of one with only a name.
7. An optional field can fail without breaking the struct
Idea. An optional field constrains a field without demanding it, so when its constraint becomes impossible only that field is ruled out; a required field in the same state makes the whole struct an error.
Why it matters. Schemas from different sources can disagree about a field nobody uses without making every configuration invalid.
Context the viewer already has. Units 2, 3 and 6: bottom, unifying, structs.
Metaphor. An optional box on a paper form whose rules nobody can meet. You leave it blank and hand the form in. Breaks at: a form does not say what required means, so the script states that plainly first.
Misconception. Any contradiction anywhere makes the whole configuration an error. Corrected in beat 4.
Sources. Structs, optional fields; cue run.
Target length. about 62 seconds (108 words).
Check question. What is the result of unifying port?: 80 with port?: 90, and what changes if the fields are required?
Beats and script.
Screen: port?: int.
A question mark makes a field optional.
If port is there, it must be an int. It may also be absent.
Screen: port: int.
A field without the mark is required.
It must be there.
Screen: card port: 80, ampersand, card port: 90, red bottom.
Make two required fields disagree.
Port cannot be eighty and ninety. The whole struct is an error.
Screen: card port?: 80, ampersand, card port?: 90, empty struct.
Make two optional fields disagree.
No value is an instance of both, so the field can never be filled in.
But the struct is fine without it.
Screen: a form with one optional box crossed out.
It is an optional box on a form, with rules nobody can meet.
You leave it blank, and hand the form in.
Screen: both optional cards plus port: 80, red bottom.
Fill it in anyway, and then it is an error.
8. A concrete value is final
Idea. In CUE, once a field has a concrete value nothing elsewhere can change it; a different value is an error, not an override.
Why it matters. You can read one line of configuration and trust it, without tracing layers, overlay order or file order.
Context the viewer already has. Unit 3: unifying, and that nothing wins.
Metaphor. Sticky notes and ink. Override systems are a stack of sticky notes: you read the last one, but is it really the last? In CUE a concrete value is written in ink. Breaks at: ink cannot be refined, while a non-concrete value can, so the script says ink only for concrete values.
Misconception. A later or more specific file wins. Corrected in beat 5: the second value is reported as a conflict.
Sources. Relation to inheritance; cue run.
Target length. about 62 seconds (108 words).
Check question. In CUE, what happens if one file says replicas: 3 and another says replicas: 5?
Beats and script.
Screen: two layer cards: replicas: 1, then replicas: 3 on top.
Many configuration tools work in layers.
A layer says replicas is one.
A later layer says three, and overrides it.
Screen: a stack of sticky notes.
It is a stack of sticky notes.
You read the last one. But is it really the last?
Screen: replicas: 3 with a question mark.
So when you read a value, it may not be the final one.
Something elsewhere may override it.
Screen: replicas: 3, solid.
In CUE, a concrete value is written in ink.
Concrete means a single value, like three. It is final.
Screen: replicas: 3 and replicas: 5 give a conflict.
Write five somewhere else, and nothing is overridden.
CUE reports a conflict, and points at both places.
Screen: replicas: int.
And a value that is not concrete, like int, tells you it is not settled yet.
9. A default is a preference, not an override
Idea. A default, a starred alternative, is a preference: it is used when the rest of the configuration leaves the choice undecided, a concrete value replaces it without conflict, and if two defaults for one field disagree neither is used.
Why it matters. You get the boilerplate removal that inheritance gives, with nothing hidden deciding which value wins.
Context the viewer already has. Units 3, 5 and 8: unifying, the pipe, concrete values are final.
Metaphor. Pencil and ink. A default is written in pencil and is not a concrete value; a value in ink stands; two different pencil marks settle nothing. Breaks at: pencil can be erased by anyone, a default cannot be removed, so the script never says erase.
Misconception. A default is a low-priority override, and the last default wins. Corrected in beat 5.
Sources. Default values; Relation to inheritance; Semantics (defaults); cue run.
Target length. about 57 seconds (94 words).
Check question. What does CUE do when one place says int | 1 and another says int | 2 for the same field?
Beats and script.
Screen: replicas: int | 1.
Without overrides, how do you say: replicas is one, unless told otherwise?
With a default. A star marks the preferred choice.
Screen: the star's 1 drawn as a pencil mark.
A default is written in pencil.
It is not a concrete value.
Screen: the same line gives replicas: 1.
If nothing else is said, the default is used.
Screen: the same line with replicas: 3 gives 3.
If someone writes three in ink, it is three.
No conflict. Three is an int.
Screen: int | 1 and int | 2 side by side; neither lights.
Now two defaults that disagree.
The first says one. The second says two.
Two pencil marks settle nothing. CUE does not pick.
Screen: the result int | 2 | 1.
The field stays undecided, until someone writes a concrete value.
Nothing hidden decides for you.
Estimated total: 541 seconds (9.0 minutes).
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime