Programming Search⌘K

Patterncore

Composite pattern

Also called Composite, part-whole hierarchy, object tree.

Leaves and containers share one interface, and a container forwards each call to its children. Client code then treats one object and a whole tree of objects in the same way.

Family
structural-design
Intent
Compose objects into tree structures that represent part-whole hierarchies, so that clients treat individual objects and compositions of objects uniformly.
Refactorings
Replace implicit tree with composite

Intent

Compose objects into tree structures that represent part-whole hierarchies. Clients then treat a single object and a composition of objects in the same way.1 The client calls one operation on the root, and the tree does the work at every level.

Problem

A program shows a directory tree with the size of each entry. A file has a size. A directory has the sum of the sizes of everything below it. A directory can hold files and other directories, to any depth.

When the program treats files and directories as different things, each operation must test which one it has. The tests repeat in every operation, and an operation that forgets a level gives a wrong answer with no error. This one handles one level of directories:

This code runs but gives a wrong answer on purpose.

project = {
    "readme.md": 200,
    "src": {"main.go": 1200, "util.go": 300},
}


def total(entries):
    result = 0
    for size in entries.values():
        if isinstance(size, int):
            result += size  # a file
        # a directory is skipped: the author handled only one level
    return result


print(total(project))
Output
200

Design Patterns uses a drawing editor. A picture holds lines, rectangles, text and other pictures. Code that must tell the primitive objects from the containers is more complex, and the pattern removes that need.1 The forces are these. The structure is recursive. Most operations mean the same thing for a part and for a whole. And clients should not have to know which one they hold.

Solution

Design Patterns has four participants.1

  • Component declares the interface for all objects in the tree, such as size and lines.
  • Leaf is an object with no children. It does the operation itself.
  • Composite holds children and implements the operation by calling it on each child, often with some work before or after.
  • Client handles all objects through the component interface.

The key is that the composite is also a component. A directory is an entry, so a directory can hold directories. The recursion of the operation follows the recursion of the data (see Recursion). The client calls size on the root and does not test anything.

Transparency or safety

The child operations, add, remove and children, raise a design question. Design Patterns presents a trade-off.1 When the component declares them, all objects have one interface. This is transparency, but a client can call add on a leaf, and the leaf must fail at run time. When only the composite declares them, the compiler stops a call to add on a leaf. This is safety, but the client must know when it holds a composite. The Python and C++ example files choose safety: only Directory has children.

Example

The example files build the same tree and print it with the size of each entry. A directory shows a slash and the total of its children:

Language Form
Python an abstract base class with a leaf class and a composite class
JavaScript two classes with the same methods and no base class
TypeScript a discriminated union and functions that switch on the kind8
Java a sealed interface with two records, and switch with pattern matching9
C# an abstract class with two sealed classes
C++ an abstract class, and children owned by std::unique_ptr
Go an interface, with a slice of the interface in the composite
Rust an enum with a leaf variant and a composite variant, and match
SQL a table where each row names its parent, and a recursive common table expression10

Objects or a sum type

The examples use two forms. Python, JavaScript, C#, C++ and Go put each operation in each class. TypeScript, Java and Rust list the cases in one type and write each operation as one function with a case for each kind. Both forms are composites, because the client calls size on any entry and the same code handles both kinds.

The two forms favour different changes. Wadler named this the expression problem. Take the kinds of data as rows of a table and the operations as columns. In a functional language, the rows are fixed in a datatype declaration, and a column is cheap to add. In an object-oriented language, the columns are fixed in a class declaration, and a row is cheap to add.2 The table below shows what each change costs here:

Change Classes with methods Sum type with functions
add a kind of entry, such as a link one class; no other code changes every function changes; the compiler lists them
add an operation, such as a count of files every class changes one function
who can add a kind any code, also outside the module only the module that declares the type

Choose by the change that the program expects. A file tree has few kinds and many operations, so a sum type suits it. A widget toolkit has many kinds of widgets that users add, so classes suit it.

PythonGitHub
from abc import ABC, abstractmethod


class Entry(ABC):
    """The component: what a file and a directory have in common."""

    def __init__(self, name: str) -> None:
        self.name = name

    @abstractmethod
    def size(self) -> int: ...

    @abstractmethod
    def lines(self, depth: int = 0) -> list[str]: ...


class File(Entry):
    def __init__(self, name: str, size: int) -> None:
        super().__init__(name)
        self._size = size

    def size(self) -> int:
        return self._size

    def lines(self, depth=0):
        return [f"{'  ' * depth}{self.name} {self._size}"]


class Directory(Entry):
    def __init__(self, name: str, *children: Entry) -> None:
        super().__init__(name)
        self.children = list(children)

    def size(self) -> int:
        return sum(child.size() for child in self.children)

    def lines(self, depth=0):
        result = [f"{'  ' * depth}{self.name}/ {self.size()}"]
        for child in self.children:
            result.extend(child.lines(depth + 1))
        return result


project = Directory(
    "project",
    File("readme.md", 200),
    Directory("src", File("main.go", 1200), File("util.go", 300)),
)
print("\n".join(project.lines()))
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. The classic form. Entry is the component, File is the leaf and Directory is the composite. size and lines work on both, and Directory forwards them to its children.
  • The child list lives only in Directory. A File has no add method, so code cannot add a child to a file. This is the safe form of the pattern (see the node).
  • The recursion depth equals the depth of the tree. CPython raises RecursionError above its recursion limit, so a tree that is thousands of levels deep needs an explicit stack.
#include <iostream>
#include <memory>
#include <string>
#include <vector>

class Entry {
public:
    explicit Entry(std::string name) : name_(std::move(name)) {}
    virtual ~Entry() = default;
    virtual long size() const = 0;
    virtual void print(std::ostream& out, int depth) const = 0;

protected:
    std::string name_;
};

class File : public Entry {
public:
    File(std::string name, long size) : Entry(std::move(name)), size_(size) {}
    long size() const override { return size_; }
    void print(std::ostream& out, int depth) const override {
        out << std::string(2 * depth, ' ') << name_ << ' ' << size_ << '\n';
    }

private:
    long size_;
};

class Directory : public Entry {
public:
    explicit Directory(std::string name) : Entry(std::move(name)) {}

    Directory& add(std::unique_ptr<Entry> child) {
        children_.push_back(std::move(child));
        return *this;
    }

    long size() const override {
        long total = 0;
        for (const auto& child : children_) {
            total += child->size();
        }
        return total;
    }

    void print(std::ostream& out, int depth) const override {
        out << std::string(2 * depth, ' ') << name_ << "/ " << size() << '\n';
        for (const auto& child : children_) {
            child->print(out, depth + 1);
        }
    }

private:
    std::vector<std::unique_ptr<Entry>> children_;
};

int main() {
    auto src = std::make_unique<Directory>("src");
    src->add(std::make_unique<File>("main.go", 1200)).add(std::make_unique<File>("util.go", 300));
    Directory project("project");
    project.add(std::make_unique<File>("readme.md", 200)).add(std::move(src));
    project.print(std::cout, 0);
}
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. An abstract base class with pure virtual functions, and a composite that owns its children through std::unique_ptr.
  • Each child has one owner, so the destructor of the root frees the whole tree. add takes the unique_ptr by value, so the caller gives up ownership and cannot add the same child twice.
  • A tree with links to the parent keeps them as raw pointers or references that do not own. An owning link in both directions would leak or free twice.
JavaGitHub
import java.util.List;
import java.util.stream.Stream;

public class Main {
    sealed interface Entry permits File, Directory {}

    record File(String name, long size) implements Entry {}

    record Directory(String name, List<Entry> children) implements Entry {
        Directory(String name, Entry... children) {
            this(name, List.of(children));
        }
    }

    static long size(Entry entry) {
        return switch (entry) {
            case File f -> f.size();
            case Directory d -> d.children().stream().mapToLong(Main::size).sum();
        };
    }

    static Stream<String> lines(Entry entry, int depth) {
        String indent = "  ".repeat(depth);
        return switch (entry) {
            case File f -> Stream.of(indent + f.name() + " " + f.size());
            case Directory d -> Stream.concat(
                    Stream.of(indent + d.name() + "/ " + size(d)),
                    d.children().stream().flatMap(child -> lines(child, depth + 1)));
        };
    }

    public static void main(String[] args) {
        Entry project = new Directory("project",
                new File("readme.md", 200),
                new Directory("src", new File("main.go", 1200), new File("util.go", 300)));
        lines(project, 0).forEach(System.out::println);
    }
}
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. A sealed interface lists its two implementations, and records hold the data. A switch over a sealed type needs no default, because the compiler knows every case.
  • The operations live outside the types, as functions with a case for each type. The classic form puts size in each class as a method. Both are composites: the client calls size on any entry and does not test whether it is a leaf.
  • List.of makes the children immutable, so a directory cannot gain itself as a child after it is built, and the tree has no cycles.
using System.Text;

Entry project = new Directory("project",
    new File("readme.md", 200),
    new Directory("src", new File("main.go", 1200), new File("util.go", 300)));
var output = new StringBuilder();
project.Write(output, 0);
Console.Write(output);

abstract class Entry(string name)
{
    public string Name { get; } = name;
    public abstract long Size();
    public abstract void Write(StringBuilder output, int depth);
}

sealed class File(string name, long size) : Entry(name)
{
    public override long Size() => size;

    public override void Write(StringBuilder output, int depth) =>
        output.AppendLine($"{new string(' ', 2 * depth)}{Name} {size}");
}

sealed class Directory(string name, params Entry[] children) : Entry(name)
{
    private readonly List<Entry> _children = [.. children];

    public override long Size() => _children.Sum(child => child.Size());

    public override void Write(StringBuilder output, int depth)
    {
        output.AppendLine($"{new string(' ', 2 * depth)}{Name}/ {Size()}");
        foreach (var child in _children)
        {
            child.Write(output, depth + 1);
        }
    }
}
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. The classic form, with an abstract class for the component and primary constructors for the data.
  • Each operation is an abstract method, so a new kind of entry is one class. A new operation changes every class. This is the side of the expression problem that object-oriented code favours.
  • File here is the class of this program, not System.IO.File. Name lookup finds the types that the program declares before the namespaces of the implicit using directives, so the program compiles with no clash.
JavaScriptGitHub
class File {
  constructor(name, size) {
    this.name = name;
    this.bytes = size;
  }

  size() {
    return this.bytes;
  }

  lines(depth = 0) {
    return [`${"  ".repeat(depth)}${this.name} ${this.bytes}`];
  }
}

class Directory {
  constructor(name, ...children) {
    this.name = name;
    this.children = children;
  }

  size() {
    return this.children.reduce((total, child) => total + child.size(), 0);
  }

  lines(depth = 0) {
    return [`${"  ".repeat(depth)}${this.name}/ ${this.size()}`, ...this.children.flatMap((child) => child.lines(depth + 1))];
  }
}

const project = new Directory(
  "project",
  new File("readme.md", 200),
  new Directory("src", new File("main.go", 1200), new File("util.go", 300)),
);
console.log(project.lines().join("\n"));
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. Two classes with the same two methods. No base class is needed, because a call such as child.size() works on any object that has the method.
  • Nothing declares the component interface. A child that lacks lines fails only when the program reaches it. The TypeScript file names the two cases in a type.
  • flatMap joins the lines of all children into one array, so each level returns a flat list.
TypeScriptGitHub
type Entry =
  | { readonly kind: "file"; readonly name: string; readonly size: number }
  | { readonly kind: "dir"; readonly name: string; readonly children: readonly Entry[] };

function size(entry: Entry): number {
  switch (entry.kind) {
    case "file":
      return entry.size;
    case "dir":
      return entry.children.reduce((total, child) => total + size(child), 0);
  }
}

function lines(entry: Entry, depth = 0): string[] {
  const indent = "  ".repeat(depth);
  switch (entry.kind) {
    case "file":
      return [`${indent}${entry.name} ${entry.size}`];
    case "dir":
      return [`${indent}${entry.name}/ ${size(entry)}`, ...entry.children.flatMap((child) => lines(child, depth + 1))];
  }
}

const file = (name: string, size: number): Entry => ({ kind: "file", name, size });
const dir = (name: string, ...children: Entry[]): Entry => ({ kind: "dir", name, children });

const project = dir("project", file("readme.md", 200), dir("src", file("main.go", 1200), file("util.go", 300)));
console.log(lines(project).join("\n"));
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. A discriminated union in place of a class hierarchy. The kind property tells the cases apart, and a switch on it narrows the type in each branch.
  • Each operation is a function with one case for each kind of entry. With strict on, the compiler reports a function that does not return in every case. So a third kind of entry is a compile error in each function that does not handle it.
  • This is the other side of the expression problem. A new operation is one new function. A new kind of entry changes every function (see the node).
package main

import (
	"fmt"
	"strings"
)

// Entry is the component.
type Entry interface {
	Size() int
	Lines(depth int) []string
}

type File struct {
	Name  string
	Bytes int
}

type Directory struct {
	Name     string
	Children []Entry
}

func (f File) Size() int { return f.Bytes }

func (f File) Lines(depth int) []string {
	return []string{fmt.Sprintf("%s%s %d", strings.Repeat("  ", depth), f.Name, f.Bytes)}
}

func (d *Directory) Size() int {
	total := 0
	for _, child := range d.Children {
		total += child.Size()
	}
	return total
}

func (d *Directory) Lines(depth int) []string {
	lines := []string{fmt.Sprintf("%s%s/ %d", strings.Repeat("  ", depth), d.Name, d.Size())}
	for _, child := range d.Children {
		lines = append(lines, child.Lines(depth+1)...)
	}
	return lines
}

func main() {
	project := &Directory{"project", []Entry{
		File{"readme.md", 200},
		&Directory{"src", []Entry{File{"main.go", 1200}, File{"util.go", 300}}},
	}}
	fmt.Println(strings.Join(project.Lines(0), "\n"))
}
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. An interface is the component, and both types satisfy it. A directory holds a slice of the interface type, so it can hold files and directories.
  • Directory has pointer receivers, so a program can add children to a directory that is already in the tree. A File is a value, because it has no children to change.
  • The standard library has the same shape in io/fs: a directory and a file are both opened as an fs.File, and fs.WalkDir walks the tree.
RustGitHub
enum Entry {
    File { name: String, size: u64 },
    Directory { name: String, children: Vec<Entry> },
}

use Entry::{Directory, File};

impl Entry {
    fn size(&self) -> u64 {
        match self {
            File { size, .. } => *size,
            Directory { children, .. } => children.iter().map(Entry::size).sum(),
        }
    }

    fn lines(&self, depth: usize, out: &mut Vec<String>) {
        let indent = "  ".repeat(depth);
        match self {
            File { name, size } => out.push(format!("{indent}{name} {size}")),
            Directory { name, children } => {
                out.push(format!("{indent}{name}/ {}", self.size()));
                for child in children {
                    child.lines(depth + 1, out);
                }
            }
        }
    }
}

fn file(name: &str, size: u64) -> Entry {
    File { name: name.into(), size }
}

fn dir(name: &str, children: Vec<Entry>) -> Entry {
    Directory { name: name.into(), children }
}

fn main() {
    let project = dir("project", vec![file("readme.md", 200), dir("src", vec![file("main.go", 1200), file("util.go", 300)])]);
    let mut out = Vec::new();
    project.lines(0, &mut out);
    println!("{}", out.join("\n"));
}
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. An enum with one variant for the leaf and one for the composite. A match must cover every variant, so the compiler finds each operation that a new variant would break.
  • A Directory owns its children in a Vec<Entry>. Ownership makes a cycle impossible here: an entry cannot own itself. A tree with links to the parent needs Rc for the children and Weak for the parent, as the Rust book shows.
  • A trait object form, with Vec<Box<dyn Entry>> and a trait for the operations, is the classic form. It lets code outside the crate add kinds of entries, and it makes new operations harder to add.
CREATE TABLE entry (id INTEGER PRIMARY KEY, parent INTEGER REFERENCES entry (id), name TEXT, size INTEGER);
INSERT INTO entry VALUES (1, NULL, 'project', NULL), (2, 1, 'readme.md', 200), (3, 1, 'src', NULL),
    (4, 3, 'main.go', 1200), (5, 3, 'util.go', 300);

WITH RECURSIVE
    tree (id, depth, path) AS (
        SELECT id, 0, printf('%05d', id) FROM entry WHERE parent IS NULL
        UNION ALL
        SELECT e.id, t.depth + 1, t.path || '/' || printf('%05d', e.id)
        FROM entry e JOIN tree t ON e.parent = t.id
    ),
    total (id, size) AS (
        SELECT t.id, (SELECT sum(e.size) FROM tree d JOIN entry e ON e.id = d.id
                      WHERE d.path = t.path OR d.path LIKE t.path || '/%')
        FROM tree t
    )
SELECT printf('%s%s%s %d', substr('        ', 1, 2 * t.depth), e.name,
              CASE WHEN e.size IS NULL THEN '/' ELSE '' END, s.size)
FROM tree t JOIN entry e ON e.id = t.id JOIN total s ON s.id = t.id
ORDER BY t.path;
Output
project/ 1700
  readme.md 200
  src/ 1500
    main.go 1200
    util.go 300
  • Verdict: idiom. A table where each row names its parent stores the tree, and a recursive common table expression walks it. The same query handles a file and a directory: a directory has no size of its own, and its total is the sum over the rows below it.
  • The path column orders the rows as a depth-first walk, so the output reads like the other examples.
  • A cycle in the parent column makes this query run without end, because each step makes a row with a longer path. A condition such as t.depth < 100 in the recursive part stops it. The example runs in SQLite.

Consequences

Design Patterns lists these consequences.1 The pattern defines class hierarchies of primitive and composite objects, and wherever client code expects a primitive object, it can take a composite. The client code is shorter, because it does not test what it holds. Kinds of components are cheap to add, because a class that implements the component interface works with the existing composites. The liability follows from this. The design can be too general. It is harder to restrict a composite to certain kinds of children, and the type system cannot help, so the check moves to run time.1

Cycles. A composite that can gain children after it is built can gain itself, directly or through a child. Each operation then recurses without end. In Python, the stack grows until the interpreter raises RecursionError:4

This code raises RecursionError, on purpose.

class Directory:
    def __init__(self, name):
        self.name = name
        self.children = []

    def add(self, child):
        self.children.append(child)

    def size(self):
        return sum(child.size() for child in self.children)


project = Directory("project")
src = Directory("src")
project.add(src)
src.add(project)  # a cycle: src is inside project, and project is inside src
print(project.size())

The fix is a check in add. A composite must not gain a child that is itself or one of its ancestors. With links to the parent, the check walks up from the composite to the root. AWT does this in Container.checkAddToSelf, and it throws IllegalArgumentException with the message "adding container's parent to itself".5 The DOM standard has the same rule. Insertion throws a HierarchyRequestError when the node to insert is an inclusive ancestor of the parent.6 Without parent links, search the child's subtree for the composite:

class Directory:
    def __init__(self, name):
        self.name = name
        self.children = []

    def contains(self, entry):
        return any(child is entry or child.contains(entry) for child in self.children)

    def add(self, child):
        if child is self or child.contains(self):
            raise ValueError(f"cannot add {child.name} inside itself")
        self.children.append(child)


project = Directory("project")
src = Directory("src")
project.add(src)
try:
    src.add(project)
except ValueError as error:
    print(f"error: {error}")
Output
error: cannot add project inside itself

An immutable tree has no cycles, because a node can hold only nodes that exist before it. The Java and Rust examples are immutable after construction. In Rust, a node owns its children, so a node cannot own itself (see Ownership and borrowing). A parent link in Rust needs Rc for the children and Weak for the parent, so that the two directions do not keep each other alive.7

Parent links. Design Patterns describes explicit parent references as a help for moving up the tree and for deleting a component.1 They also add an invariant. Each child must appear in its parent's list, and in no other list. AWT keeps the invariant in addImpl. A component that already has a parent is removed from that parent before it joins the new one.5

Depth. Each level of the tree is one level of the call stack. CPython limits the depth of the stack and raises RecursionError above the limit, which sys.getrecursionlimit returns.34 A tree that comes from user data, such as nested JSON or a deep directory, can pass that limit. Walk such a tree with an explicit stack.

Cost of an operation. In the examples, size of a directory walks its subtree each time. lines calls size at each level, so a deep tree does the same sums many times. A composite can cache its total and clear the cache when a child changes. The cost is a link to the parent and code that keeps the cache correct.1

When not to use it

Do not use the pattern when the structure is flat. A list of items needs a loop, not a tree.

Do not use it when parts and wholes have different operations. If most methods mean something for a directory and nothing for a file, a common interface forces empty methods or errors on the leaf. Use two types, and a function that handles each.

Do not use it to model a graph. A composite is a tree: each child has one parent. Shared children or cycles need a graph with an explicit visited set.

Do not build a class hierarchy when the kinds are fixed and the operations change often. A sum type with functions is shorter in that case, as the table above shows.

Recursive data in a table. SQL stores a tree as rows that name their parents. A recursive common table expression walks it, starting from the root and joining each level to the next.10 The SQL example file computes the totals this way.

Iterator. An iterator can walk a composite and give each entry in turn, so the client needs no recursion. Design Patterns lists Iterator as related.1 See Iterator.

Visitor. A visitor puts an operation in one class with a method for each kind of component. In a language without sum types, it gives the functional side of the expression problem: a new operation is one class.12

Decorator. A decorator has one child, and a composite has many. Both forward calls to what they hold, and they are often used together, with a common component class.1 See Decorator pattern.

Builder. A builder often makes a composite, and hides the calls that link the nodes.1 See Builder pattern.

Chain of Responsibility. The parent links of a composite can form a chain. A request that a component does not handle passes up to its parent.1

Refactoring. Kerievsky's refactoring Replace Implicit Tree with Composite starts from code that builds a tree as strings or nested primitive data, as in the problem above. It moves that code to component classes.12

Known uses

  • OpenJDK AWT: java.awt.Container extends java.awt.Component, and holds a list of components, which can be containers.11 In Container.java at jdk-25+36, checkAddToSelf walks the parent links and throws when the new child is the container or one of its ancestors. addImpl removes a child from its old parent before it adds it. validateTree lays out the container and then recurses into each child container.5
  • The DOM: an element is a node with child nodes, and text is a node with none. The insertion algorithm rejects a node that is an ancestor of the parent, so the document stays a tree.6

References

  1. Gamma, Helm, Johnson and Vlissides, Design Patterns, Elements of Reusable Object-Oriented Software, Addison-Wesley, 1994, Chapter 4, Composite (Intent, Motivation, Participants, Consequences, Implementation, Related Patterns)
  2. Philip Wadler, The Expression Problem, message to the java-genericity mailing list, November 12, 1998, the first paragraphs (cases as rows, functions as columns)
  3. The Python Standard Library, sys, Python 3.14, sys.getrecursionlimit and sys.setrecursionlimit
  4. The Python Standard Library, Built-in Exceptions, Python 3.14, RecursionError
  5. OpenJDK jdk-25+36 source, java/awt/Container.java, checkAddToSelf, lines 499 to 507; addImpl, lines 1099 to 1119; validateTree, lines 1712 to 1737
  6. DOM Standard, WHATWG, 4.2.3 Mutation algorithms, ensure pre-insertion validity (step 2, HierarchyRequestError)
  7. The Rust Programming Language, chapter 15.6, Reference Cycles Can Leak Memory, Creating a Tree Data Structure, a Node with Child Nodes; Adding a Reference from a Child to Its Parent
  8. TypeScript Handbook, Narrowing, Discriminated unions
  9. The Java Language Specification, Java SE 25 Edition, 8.1.1.2 sealed, non-sealed, and final Classes
  10. SQLite documentation, The WITH Clause, Recursive Common Table Expressions
  11. Java SE 25 API, java.awt.Container, class description; add
  12. Joshua Kerievsky, Refactoring to Patterns, Addison-Wesley, 2004, Chapter 7, Simplification, Replace Implicit Tree with Composite

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/HE663P/text.yaml