Logicο
The logic for Stroscot is based on a two-sided linear logic sequent calculus.
Jumbo connectivesο
Common connectivesο
All of the standard operators 01βββ€β₯&β βΈβ§ in linear logic can be expressed using \(π^+\) and \(π^-\). We use our notation for them.
Operator |
Girard Notation |
Name |
Type |
---|---|---|---|
\(F\) |
\(0\) |
False (Zero) |
\(π^+ []\) |
\(1\) |
\(1\) |
One |
\(π^+ [(\#s,[] - [])]\) |
\(A \lor B\) |
\(A \oplus B\) |
Plus (coproduct, or) |
\(π^+ [(\#l,[A] - []),(\#r,[B] - [])]\) |
\(A \otimes B\) |
\(A \otimes B\) |
Times (tensor product) |
\(π^+ [(\#s,[A,B] - [])]\) |
\(A^{\otimes n}\) |
\(π^+ [(\#s,\overbrace{[A,\ldots,A]}^n - [])]\) |
||
\(\smash{\stackrel{+}{\neg}} A\) |
\(A^{\bot}\) |
Positive Negation |
\(π^+ [(\#s,[] - [A])]\) |
\({β}A\) |
\(A\) |
Up shift |
\(π^+ [(\#s,[A] - [])]\) |
\(T\) |
\(\top\) |
True (Top) |
\(π^- []\) |
\(\bot\) |
\(\bot\) |
Bottom (contradiction) |
\(π^- [(\#s,[] \multimap [])]\) |
\(A \land B\) |
\(A \with B\) |
With (product, and) |
\(π^- [(\#l,[] \multimap [A]),(\#r,[] \multimap [B])]\) |
\(A \par B\) |
\(A \par B\) |
Par (βunlessβ, classical or, parallel product, dual of tensor) |
\(π^- [(\#s,[] \multimap [A,B])]\) |
\(A^{\par n}\) |
Par power |
\(π^- [(\#s,[] \multimap \overbrace{[A,\ldots,A]}^n)]\) |
|
\(A \to B\) |
\(A \multimap B\) |
Lollipop (implication, internal hom) |
\(π^- [(\#f,[A] \multimap [B])]\) |
\(A \leftrightarrow B\) |
\(A \multimapboth B\) |
Equivalence |
\(π^- [(\#l,[A] \multimap [B]),(\#r,[B] \multimap [A])]\) |
\(\smash{\stackrel{-}{\neg}} A\) |
\(A^{\bot}\) |
Negative Negation |
\(π^- [(\#s,[A] \multimap [])]\) |
\({β}A\) |
\(A\) |
Down shift |
\(π^- [(\#s,[] \multimap [A])]\) |
The negations and shifts have identical derivation rules for each polarity, so we write \(\neg A\) and \(\smash{\updownarrow}A\) unless there is a need for the distinction.
The specific derivation rules can be derived from the jumbo connective rules and the above definitions. For ease of reference, here are the derivation rules for the common connectives:
Programming typesο
We can also write some types common from programming:
Operator |
Name |
Type |
---|---|---|
\(\text{Bool}\) |
Booleans |
\(π^+ [(\#F,[]-[]),(\#T,[]-[])]\) |
\(\text{Int}\) |
32-bit integers |
\(π^+ [(\#{-2}^{31},[]-[]),\ldots,(\#0,[]-[]),\ldots,(\#2^{31}-1,[]-[])]\) |
\(L_A\) |
Linked list of A |
\(π^+ [(\text{#nil},[]-[]),(\text{#cons},[A,L_A]-[])]\) |
\(Arr_A\) |
Arbitrarily-sized tuple of A |
\(π^+ [(\text{#0},[]-[]),(\text{#1},[A]-[]),(\text{#2},[A,A]-[]),\ldots]\) |
In general \(π^+\) can represent any algebraic data type.
Exponentialsο
Promotionο
Derelictionο
Weakeningο
Contractionο
Admissible rulesο
The following rules are derivable from the four rules above.
Weak promotion, implied by promotion and dereliction:
Digging is simply the theorems \(\bang \bang A \equiv \bang a\) and \(\whim \whim A \equiv \whim a\), but we present the sequent forms for completeness. It is implied by promotion and dereliction.
Weak promotion and digging together imply promotion.
Absorption is implied by contraction and dereliction:
Multiplexing is implied by absorption and dereliction:
Structural rulesο
Exchangeο
Cutο
Identityο
Higher-order logicο
Predicatesο
Terms consist of variables \(x\), literal values \(v\), and applications of terms to terms. Variables quantify over the universal set, smaller domains can be defined by the membership notation in Set theory.
If the term is a predicate (set) then it may be used as an atomic formula. Such an atomic formula \(t\) must satisfy the identity rule:
Interpreted predicates may be defined using other rules so long as the identity rule is derivable and the rules are consistent.
Substitutionο
\(A[\overrightarrow{x \mapsto t}]\) stands for the proposition \(A\) where all free occurrences of the variables \(\overrightarrow{x}\) have been replaced by terms \(\overrightarrow{t}\) in the appropriate domains (and bound variables have been renamed to fresh ones when necessary).
\begin{array}{c} \rule{t\vdash t\quad\Gamma \vdash \Delta}{\Gamma[\overrightarrow{x \mapsto t}] \vdash \Delta[\overrightarrow{x \mapsto t}]}{\text{sub}} \end{array}
Quantifiersο
For these the variable \(x\) must have no free occurrence in \(\Gamma\) or \(\Delta\). In code we simply refer to quantifiers \(Q\) and write \(Q^+ = \forall, Q^- = \exists\).
Definitionsο
If we define some notation \(A\defeq B\), then this means adding a pair of rules to our logic:
The notation and rules are valid only if there is a finite proof of the identity sequent \(B \vdash B\).
Infinite proof structuresο
These have βuseβ and βdefβ rules (βdefβ is short for definition). The use is a βholeβ that plugs in the derivation tree from the definition. The type of the use rule can performs a substitution on the free variables of the type of the assignment.
Set theoryο
We define \(t\in \{x\mid A\} \defeq A[x\mapsto t]\). Here the elements \(t\) of the sets are propositions; e.g. we can prove \(\bot \in \{x\mid x \leftrightarrow \bot \}\). Usually the variables in set theory range over sets. Hence we introduce new variables \(x^S\) which range over sets. Since all sets \(S\) are of the form \(\{x\mid X_S \}\) these can be translated as follows:
So for example \(t^S\in \{x^S\mid x^S \in x^S \}\) expands to \(T \in \{X \mid X \in \{x\mid X\} \}\)
We can also define set-builder notation \(\{a_1,\ldots,a_n\} = \{x\mid x = a_1 \lor \ldots \lor x=a_n\}\).
We define
We can prove the axiom schema of comprehension \(\vdash \exists y. \forall x. x\in y \leftrightarrow \phi\) for all formulas \(\phi\) with free variable \(x\).
Equalityο
Equality on sets is defined as follows:
\(A=B \defeq \forall x. (x \in A \leftrightarrow x \in B)\).
We can easily prove that this equality is an equivalence relation:
For substitution, we can prove \(!(A=B), \phi \vdash \phi[A/B]\) for any specific proposition \(\phi\).