Use an abstract class to share the unchangeable alignment flag and the rule that the reported length equals the rendered text's length. This small class inheritance hierarchy will also serve the numeric software classes in part (d). The Java interface explicitly declares toString() so that the display contract is visible even though all Java software objects already inherit that object method.
interface Data {
    boolean leftJustified();
    int length();
    String toString();
}

abstract class AbstractData implements Data {
    private final boolean leftj;

    protected AbstractData(boolean leftj) { this.leftj = leftj; }

    public final boolean leftJustified() { return leftj; }
    public final int length() { return toString().length(); }
    public abstract String toString();
}

final class StringData extends AbstractData {
    private final String text;

    public StringData(String s, boolean leftj) {
        super(leftj);
        if (s == null) throw new IllegalArgumentException("null text");
        text = s;
    }

    public String toString() { return text; }
}
There are no setters, and the stored String data type value is an immutable object, so StringData is itself an immutable object. Its object constructor rejects a null reference instead of deferring failure until display. Consequently,
First determine the width of each column by finding the longest rendered String data type value in it. Independently determine the number of rows as the largest column size. An empty column has width zero. Then traverse rows first and columns second: render a present entry with spaces on the appropriate side, or render an absent entry as an entire column of spaces. Put one separating space between adjacent columns and a newline after each row. In particular, an exhausted column must not shift later entries into its position.
Here is executable Java for the algorithm. Column, defined in part (e), is an ordinary list of Data. The object interface in part (c) supplies the three queries used below. Each query sees stable content during this call; concurrent changes to formatting are outside this contract.
static String replicate(char c, int n) {
    StringBuilder s = new StringBuilder();
    for (int i = 0; i < n; ++i) s.append(c);
    return s.toString();
}

static String printData(List<Column> columns) {
    int[] width = new int[columns.size()];
    int rows = 0;
    for (int c = 0; c < columns.size(); ++c) {
        Column column = columns.get(c);
        rows = Math.max(rows, column.size());
        for (Data d : column)
            width[c] = Math.max(width[c], d.length());
    }
    StringBuilder out = new StringBuilder();
    for (int r = 0; r < rows; ++r) {
        for (int c = 0; c < columns.size(); ++c) {
            if (c != 0) out.append(' ');
            Column column = columns.get(c);
            if (r >= column.size()) {
                out.append(replicate(' ', width[c]));
            } else {
                Data d = column.get(r);
                String text = d.toString();
                String pad = replicate(' ', width[c] - text.length());
                out.append(d.leftJustified() ? text + pad : pad + text);
            }
        }
        out.append('\n');
    }
    return out.toString();
}
The algorithm uses the stipulated fixed-width characters and assumes entries contain no embedded newlines. If the column widths are and , every emitted row has the same width,
An empty collection, or a collection consisting entirely of empty columns, gives the empty String data type value. Spaces at the end of a short last row are harmless and preserve the rectangular layout.
An immutable object has no changeable observable state after its object constructor finishes. Two clients may hold references to the same immutable object, but neither can change what the other observes. Thus sharing an immutable object avoids the interference normally associated with reference aliasing: for example, sharing a Java String is safe because a text-changing operation returns another software object rather than modifying that String data type value.
A final reference alone does not establish an immutable object: it prevents reassignment of that reference, but its referent could still be mutable. An immutable object must also protect any reachable mutable state, for instance through defensive copying. With that qualification, the essential answer is
Fix a deterministic, single-tape Turing machine with tape cells indexed by the integers. A precise definition is the tuple
Here is a nonempty finite set of control states, a finite tape alphabet with a designated blank symbol , the input alphabet, the initial control state, and distinct halting control states. The transition function is total on the displayed domain. The Turing machine instruction means to write over the scanned , enter control state , and move the head one cell in direction .
A Turing machine configuration is , where , is the head position, and is the tape-content function, equal to outside a finite set. Its next-configuration relation is
if , with for and for , and
There is no successor to either halting Turing machine configuration.
For input , the initial Turing machine configuration is , where for and is blank elsewhere. In particular, the initial tape for the empty word is entirely blank. The recognized formal language is
The relation permits any finite number of transitions. An input outside may reach the rejecting control state or run forever; recognition does not require halting on every input.
is a co-recursively enumerable language, is not a recursively enumerable language, and is not a decidable language. The stipulated order on halting times includes .
First, failure has a finite witness. For valid machine descriptions,
Indeed, a strict inequality forces the first halting time to be finite. The second can be either a larger finite time or infinity. Whether the displayed condition holds for fixed is decidable by a finite simulation, including the initial configurations when .
Enumerate all pairs and perform these finite tests by dovetailing, accepting the complement of a set of on finding a witness. Equivalently, at stage , inspect all inputs of length at most through transitions. A genuine violation eventually appears; if there is no violation, the procedure never accepts. Malformed descriptions or differing input alphabets can be recognized and accepted as nonmembers immediately. Thus the complement is a recursively enumerable language, proving that is a co-recursively enumerable language.
For non-enumerability, use the standard result that the complement of a set of the halting problem
is not a recursively enumerable language. Given , effectively construct two Turing machines over the same fixed input alphabet. On every input , let ignore and simulate on the fixed word , halting precisely when that simulation halts. Let loop forever on every input.
If does not halt on , both halting times are infinity for every , so the pair belongs to . If halts on , the first halting time is finite while the second is infinity, so the pair does not belong to . Therefore
This is a many-one reduction from non-halting to the pointwise running-time domination problem. Were a recursively enumerable language, constructing the pair and running its recognizer would recognize non-halting, contradicting the stated result. Hence is not a recursively enumerable language. Since every decidable language is a recursively enumerable language, is also undecidable.
A nondeterministic pushdown automaton is a tuple
Here is a nonempty finite set of control states, a finite input alphabet, a finite stack alphabet, the initial control state, the initial stack symbol, and the final control states. The notation requires each transition to have only finitely many choices. Since the domain is finite, the whole transition specification is finite.
A pushdown automaton configuration is , recording the control state, unread input word, and stack contents. Write the top of the stack on the left. For , the one-step relation is
An epsilon transition instead has
Thus a move replaces the top stack symbol by the word , whose leftmost symbol becomes the new top. It consumes one input symbol or no input symbol. Under this convention there is no move from an empty stack.
For acceptance by final state, the recognized formal language is
Here allows any finite number of moves, including zero. The entire input must have been consumed; the final stack need not be empty. Acceptance requires at least one such run of the nondeterministic pushdown automaton.
No: regular languages are not closed under countably infinite intersection. Let and put
The first term in has regular expression , where the fixed power means copies. The second term is a finite language, a finite union of single words. Their union is therefore a regular language.
If , then for each either or belongs to the second term, so . If , choose . It belongs to neither term of . Consequently
The formal language is not a regular language. Indeed, for a proposed pumping length , the pumping lemma for regular languages applied to must pump a nonempty block consisting only of zeros. Repeating that block increases the number of zeros without increasing the number of ones, leaving . This contradiction proves the counterexample. Finite intersection closure does not extend to this infinite intersection of regular languages.
Let be a deterministic finite automaton recognizing . Construct a nondeterministic finite automaton with automaton state set . Its second coordinate records whether the extra zero has already been consumed. Start at and make exactly the automaton states in accepting.
For each , , and , include the ordinary automaton transition
Also include the extra automaton transition
This consumes the inserted zero without changing the simulated automaton state of . At a zero in layer zero, both the ordinary and extra choices are available. There are no automaton transitions from layer one back to layer zero.
If , run on in layer zero, consume the extra zero by the displayed automaton transition, and run on in layer one. The resulting run accepts in .
Conversely, every accepting run of starts in layer zero and finishes in layer one, so it uses exactly one extra automaton transition. Split its input as at that move. Removing that consumed zero leaves precisely a run of on , ending in . Hence . The construction also permits an insertion at either end, including insertion into the empty word.
Therefore . Since has automaton states, is a regular language. This is a single-symbol insertion into a regular language.

Pinned article: Introduction to the OurBigBook Project

Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
We have two killer features:
  1. topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculus
    Articles of different users are sorted by upvote within each article page. This feature is a bit like:
    • a Wikipedia where each user can have their own version of each article
    • a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
    This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.
    Figure 1.
    Screenshot of the "Derivative" topic page
    . View it live at: ourbigbook.com/go/topic/derivative
  2. local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:
    This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
    Figure 5. . You can also edit articles on the Web editor without installing anything locally.
    Video 3.
    Edit locally and publish demo
    . Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension.
  3. https://raw.githubusercontent.com/ourbigbook/ourbigbook-media/master/feature/x/hilbert-space-arrow.png
  4. Infinitely deep tables of contents:
    Figure 6.
    Dynamic article tree with infinitely deep table of contents
    .
    Descendant pages can also show up as toplevel e.g.: ourbigbook.com/cirosantilli/chordate-subclade
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact