*(This post has been modified to correct some errors and add some clarifications in response to comments from alert readers. Thanks for the corrections!)*

Today, we’re going to take a brief diversion from category theory to play with

some logic. There are some really neat connections between variant logics and category theory. I’m planning on showing a bit about the connections between category theory and one of those, called *linear logic* . But the easiest way to present things like linear logic is using a mechanism based on **sequent calculus**.

Sequent calculus is a deduction system for performing reasoning in first order propositional logic. But it’s notation and general principles are useful for all sorts of reasoning systems, including many different logics, all sorts of type theories, etc. The specific sequent calculus that I’m to talk about is sometimes called system-LK; the general category of things that use this basic kind of rules is called Gentzen systems.

The sequent calculus consists of a set of rules called *sequents*, each of which is normally written like a fraction: the top of the fraction is what you know before applying the sequent; the bottom is what you can conclude. The statements in the sequents are always of the form:

CONTEXTS, Predicates :- CONTEXTS, Predicates

The “CONTEXTS” are sets of predicates that you already know are true. The “:-” is read “entails”; it means that the *conjuction* of the statements and contexts to the left of it can prove the *disjunction* of the statements to the right of it. In predicate logic, the conjuction is logical and, and disjunction is logical or, so you can read the statements as if “,” is “∧” on the left of the “:-“, and “∨” on the right. *(Note: this paragraph was modified to correct a dumb error that I made that was pointed out by commenter Canuckistani.)*

Contexts are generally written using capital greek letters; predicates are generally written using uppercase english letters. We often put a name for an inference rule to the right of the separator line for the sequent.

For example, look at the following sequent:

Γ :- Δ

————— Weakening-Left

Γ,A :- Δ

This sequent is named Weakening-left; the top says that “Given Γ everything in Δ can be proved.”; and

the bottom says “Using Γ plus the fact that A is true, everything in Δ can be proved”. The full sequent basically says: if Δ is provable given Γ, then it will still be provable when A is added to Γ;in other words, adding a true fact won’t invalidate any proofs that were valid before the addition of A. *(Note: this paragraph was modified to correct an error pointed out by a commenter.)*

The sequent calculus is nothing but a complete set of rules that you can use to perform any inference in predicate calculus. A few quick syntactic notes, and I’ll show you the full set of rules.

1. Uppercase greek letters are contexts.

2. Uppercase english letters are *statements*.

3. Lowercase english letters are *terms*; that is, the objects that predicates

can reason about, or variables representing objects.

4. A[b] is a statement A that contains the term b in some way.

5. A[b/c] means A with the term “b” replaced by the term “c”.

——-

First, two very basic rules:

1.

———— (Identity)

A :- A

2. Γ :- A, Δ Σ, A :- Π

—————————————— (Cut)

Γ,Σ :- Δ, Π

Now, there’s a bunch of rules that have right and left counterparts. They’re duals of each other – move terms across the “:-” and switch from ∧ to ∨ or vice-versa.

3. Γ, A :- Δ

————————— (Left And 1)

Γ, A ∧ B :- Δ

4. Γ :- A, Δ

——————— ——— (Right Or 1)

Γ, :- A ∨ B, Δ

5. Γ, B :- Δ

——————— ——(Left And 2)

Γ,A ∧ B :- Δ

6. Γ :- B, Δ

——————— ——— (Right Or 2)

Γ :- A ∧ B, Δ

7. Γ, A :- Δ Σ,B :- Π

————————————— (Left Or)

Γ,Σ, A ∨ B :- Δ,Π

8. Γ :- A,Δ Σ :- B,Π

—————————— ——(Right And)

Γ,Σ :- A ∧ B, Δ,Π

9. Γ :- A,Δ

————— —— (Left Not)

Γ, ¬A :- Δ

10. Γ,A :- Δ

——————— (Right Not)

Γ :- ¬A, Δ

11. Γ :- A,Δ Σ,B :- Π

————————————— (Left Implies)

Γ, Σ, A → B :- Δ,Π

12. Γ,A[y] :- Δ *(y bound)*

————————————— (Left Forall)

Γ,∀x A[x/y] :- Δ

13. Γ :- A[y],Δ *(y free)*

————————————— (Right Forall)

Γ :- ∀x A[x/y],Δ

14. Γ, A[y] :- Δ *(y bound)*

———————————— (Left Exists)

Γ,∃x A[x/y] :- Δ

15. Γ, :- A[y], Δ *(y free)*

————————————(Right Exists)

Γ :- ∃x A[x/y], Δ

16. Γ :- Δ

—————— (Left Weakening)

Γ, A :- Δ

17. Γ :- Δ

—————— (Right Weakening)

Γ :- A, Δ

18. Γ, A, A :- Δ

——————— (Left Contraction)

Γ,A :- Δ

19. Γ :- A, A, Δ

——————— (Right Contraction)

Γ :- A, Δ

20. Γ, A, B, Δ :- Σ

————————— (Left Permutation)

Γ,B, A, Δ :- Σ

21. Γ :- Δ, A, B, Σ

————————— (Right Permutation)

Γ :- Δ B, A, Σ

Here’s an example of how we can use sequents to derive A ∨ ¬ A:

1. Context empty. Apply Identity.

2. A :- A. Apply Right Not.

3. empty :- ¬ A, A. Apply Right And 2.

4. empty : A ∨ ¬A, A. Apply Permute Right.

5. empty :- A, A ∨ ¬ A. Apply Right And 1.

6. empty :- A ∨ ¬ A, A ∨ ¬ A. Right Contraction.

7. empty :- A ∨ ¬ A

If you look *carefully* at the rules, they actually make a lot of sense. The only ones that look a bit strange are the “forall” rules; and for those, you need to remember that the variable is *free* on the top of the sequent.

A lot of logics can be described using Gentzen systems; from type theory, to temporal logics, to all manner of other systems. They’re a very powerful tool for describing all manner of inference systems.