Realisability
Emmanuel Beffara
Laboratoire dโInformatique de Grenoble
QComical school, November 2025, Nancy
The objects at stake
Computational objects
Logical statements
Relations between them
Logical validity
What does it mean for a logical statement to be valid?
- It is true โ assumes a notion of truthโ: an objective
valuation of statements, a concept of model, etc.
- It is provable โ assumes a notion of proofโ: a structured
argument which follows valid deduction steps
- It has evidences โ assumes a notion of observable consequences, a
notion of experiment
- It cannot be contradicted โ assumes a notion a dialogue,
interaction rules between an argument and a counter-argument
The content of proofs
Intuitively, there can be different proofs of a given statement.
But what makes two proofs different, and why does it matter?
- Different syntax โ but this is not satisfactory unless one
postulates a useful notion of equivalence
- Different normal forms โ a particular kind of equivalence, internal
to the proof language
- Different behaviours โ produces different dialogues or
experiments
This induces different forms of constructivism in logic
- From a proof of โx,โP(x), one can
compute an a such
that P(a) is
valid
- From a proof of a statement, one can compute an effective argument
strategy
Computational consistency
What does it mean for a program to be valid?
- It does not crash โ assumes a basic notion of failureโ: run-time
error, divergenceโฆ
- It respects its specification โ assumes a formal notion of
specification and a definition of what it means to respect one
- It validates a suite of tests โ describes validity as expected
behaviour in reference situations
- It is written correctly โ static typing, relies on the validity of
typing rules
Universality and decidability
There is no perfect approach to program correctness.
- Any Turing-complete language must have space for invalid programs
(cf.ย halting problem).
- Any meaningful computational property is undecidable (cf.ย Riceโs
theorem).
- A type system is useful for practical purposes if type checking is
decidable.
So there has to be cases where correctness for a type is established
by ad-hoc semantic means (e.g.ย unsafe chunks in statically
typed code).
Analytic vs synthetic, a priori vs a
posteriori
Two useful categorisations of conceptsโ:
- Synthetic notions rely on the meaning of
objects while analytic notions rely on their intrinsic
structure,
- A priori notions rely on the potential consequences
while a posteriori notions rely on explicit facts
| A priori |
Error-freeness |
Validity wrt specification |
| A posteriori |
Exit code |
Well-typedness |
Inspired by Girard (2017)
Realisability as a method
Chooseโ:
- a computational model
- a language of formulas
- a relation of realisationโ: pโโฉโP means that
- p is a witness of
P (as a logical
statement)
- p respects P (as a specification)
The kinds of results we are afterโ:
- adequacyโ: if P
is provable, then P has a
realiser
- consistencyโ: the set of realised formulas is
consistent
- specificationโ: describe the behaviour of the realisers of
P
- identify logical principles that a class of models realise
Intuitionistic
realisability
Minimal logic
Hilbert-style proofs
We start with an explicit notion of proof (so-called โsyntheticโ and
โa prioriโ), in the style of Hilbert.
Proofs derive sequents of the shape ๐ฏโโขโP where ๐ฏ is a set of formulas (seen as a
theory) and P is a
formula (the conclusion).
- axiomโ: if Pโโโ๐ฏ
then ๐ฏโโขโP
- modus ponensโ: if ๐ฏโโขโPโโโQ and
๐ฏโโขโP then ๐ฏโโขโQ
- logical axiom schemesโ:
- ๐โ:โPโโโQโโโP
- ๐โ:โ(PโโโQโโโR)โโโ(PโโโQ)โโโPโโโR
Enjoys deductionโ: ๐ฏ,โPโโขโQ if and
only if ๐ฏโโขโPโโโQ.
Heyting algebras โ basic structure
A notion of โtruth valueโ for minimal logic.
Definition
A Heyting algebra is a lattice H with โค and โฅ,
with an operator โ that is adjoint to
the meetย โงโ: aโ
โงโ
bโโคโcโโโaโโคโbโโโc
Properties
- For all a and b, aโโคโb if and only if aโโโbโ=โโค.
- Soundnessโ: if โโขโP is
provable then its interpretation โฆPโง is โค in all Heyting algebras (by induction on
proofs)
- Completenessโ: if โฆPโงโ=โโค
in all interpretation in Heyting algebras, then โโขโP is provable (using a syntactic
model)
Heyting algebras โ more connectives
Absurdity โฅ
- characterised by the axiom scheme โฅโโโP
- naturally interpreted by the minimum in a HA
Conjunction Pโ
โงโ
Q and disjunction Pโ
โจโ
Q
- interpreted by the meet and join in a HA
- axiom schemes for conjunctionโ: PโโโQโโโPโ
โงโ
Q,
Pโ
โงโ
QโโโP,
Pโ
โงโ
QโโโQ
- axiom schemes for disjunctionโ: PโโโPโ
โจโ
Q, QโโโPโ
โจโ
Q, (PโโโR)โโโ(QโโโR)โโโPโ
โจโ
QโโโR
- disjunction propertyโ: if โโขโPโ
โจโ
Q then โโขโP or โโขโQ
Negation ยฌP
- defined as ยฌPโ:=โPโโโโฅ
- enjoys non-contradictionโ: โโขโยฌ(Pโ
โงโ
ยฌP)
- does not enjoy excluded middleโ: Pโ
โจโ
ยฌP is not provable
Heyting algebras โ quantifiers
Proof rules
- generalisationโ: if ๐ฏโโขโP and ฮฑ does not occur in ๐ฏ then ๐ฏโโขโโฮฑ.P
- specialisationโ: if ๐ฏโโขโโฮฑ.P then
๐ฏโโขโP[ฮฑโ:=โt]
Interpretation
- โฆโฮฑ.Pโงโ=โโvโฆP[ฮฑโ:=โv]โง
(assuming the algebra has arbitrary meets)
- predicates are functions with values in H
- first order quantifies over a given structure
- second order quantifies over H
Exerciseโ: minimal logic is weaker than
classical
The BHK approach to
logical validity
The Brouwer-Heyting-Kolmogorov
interpretation
- A proof of Pโ
โงโ
Q
consists of a proof of P and a
proof of Q
- A proof of Pโ
โจโ
Q
consists of the information of left or right and a
proof of that side
- A proof of PโโโQ
is a way to turn a proof of P
into a proof of Q
- A proof of โxโโโS,โP(x)
consists of an element eโโโS and a proof of P(e).
- A proof of โxโโโS,โP(x)
is a way to turn each element eโโโS into a proof of P(e).
- There is no proof of โฅ.
Heyting (1931), Kolmogoroff (1932)
BHKโ: explicit and implicit requirements
The BHK interpretation does not prescribe a particular mathematical
structure, nor a general interpretation of atomic statements.
- Functions should be effective (computable).
- Quantification requires the domain to be suitable to
computation.
- The interpretation of atomic formulas depends on the context
- basic arithmetical equalities may be interpreted as
computations
- decidable predicates can be justified by proof certificates of some
kind
- or consider that true atomic statements need no further
justification
It does interpret proofsโ:
- The disjunction property is explicit in the interpretation of โจ.
- The identity function is a generic proof of PโโโP.
- There are two simple proofs of PโโโPโ
โจโ
P (left
and right injections).
BHKโ: some observations
Synthetic approachโ: interpret each statement in a domain that
depends on the shape of the formula
| conjunction |
cartesian product |
| disjunction |
disjoint union |
| implication |
function space |
| existential |
dependent sum |
| universal |
dependent product |
The basis of denotational semantics, requires suitable
restrictions on function spaces to get good properties. Requires subtle
constructs to handle quantification.
Analytic approachโ: define a common structure, independent of
formulas, to interpret everything.
The basis of realisability, requires some coding and a form
of effectiveness for functions. Supports higher-order quantification
through uniformity.
Kleeneโs realisability
An implementation of the BHK principles for intuitionistic
arithmetic.
Defines the statement nโโฉโP (n realises P) by induction on Pโ:
- โจm,โnโฉโโฉโPโ
โงโ
Q
if mโโฉโP and nโโฉโQ
- โจ0,โmโฉโโฉโPโ
โจโ
Q if
mโโฉโP
- โจ1,โmโฉโโฉโPโ
โจโ
Q if
mโโฉโQ
- mโโฉโPโโโQ if for
all n, if nโโฉโP then ฯm(n)โโฉโQ
- โจm,โnโฉโโฉโโx.P
if nโโฉโP[xโ:=โm]
- mโโฉโโx.P
if for all n, ฯm(n)โโฉโP[xโ:=โn]
- mโโฉโsโ=โt if โโโจโsโ=โt (with
s and t closed)
where โจโ
,โโ
โฉ is a bijection of โยฒ to โ and ฯ is en enumeration of recursive
functions.
The strength of Kleeneโs realisability
Heyting arithmetic HA is intuitionistic logic with first-order
quantification and Peanoโs axioms for basic arithmetic.
Anything provable in HA is realisable.
The following statement (known as Markovโs principle) is
realisable, given a total decidable predicate Pโ: ยฌยฌโn,โP(n)โโโโn,โP(n)
The statement โx.(H(x)โ
โจโ
ยฌH(x)),
where H(n) means that
ฯn(n)
is defined, is classically true but not realisable.
Hence its negation is realisable but classically false!
See for instance Troelstra and van Dalen
(1988)
Partial combinatory
algebras
Abstracting the computation model
Kleeneโs construction relies on an enumeration of recursive functions
in natural numbers, but this is nothing deeper that a coding trick.
Definition
A partial combinatory structure is a set A equipped with a partial binary
operation โ
โ:โAโ
รโ
AโโโA.
- โ
associates to the left and is
implicitโ: abcd
means ((aโ
โ
โ
b)โ
โ
โ
c)โ
โ
โ
d,
- eโ means that the value of
expression e is defined,
- e1โโโe2
means that e1 and
e2 are either both
undefined or both defined and equal.
A partial combinatory algebra (PCA) is a partial combinatory
structure that is combinatorially completeโ:
- for every applicative expression e over A with variables x1,โโฆ,โxn
there is an aโโโA
such that ab1โฏbnโโโe[x1โ:=โb1,โโฆ,โxnโ:=โbn]
for all b1,โโฆ,โbnโโโA.
This element a is written
ฮปx1โฆxn.e.
Facts about PCAs
Completeness
Combinatorial completeness is equivalent to the existence of ๐ and ๐ such that
- for all x,โyโโโA, ๐xโ and ๐xyโ=โx
- for all x,โy,โzโโโA,
๐xyโ and
๐xyzโ=โxz(yz)
Examples
- Given an enumeration ฯ of
recursive functions, the operation aโ
โ
โ
bโ=โฯa(b)
makes โ a PCA (the so-called
first Kleene algebra)
The set of closed normal ฮป-terms, with Mโ
โ
โ
N defined as the normal
form of the term (M)N
is a PCA.
The set of closed ฮป-terms quotiented by ฮฒ-equivalence is a PCA
(where application is actually total).
Adequacyโ: typing implies realisation. Formally, if M is a ฮป-term and P is a type, then โโขโMโ:โP implies MโโฉโP.
Heyting arithmetic in a PCA
Kleeneโs construction can be carried out in any PCA, with some
encoding of dataโ:
- pairs can be represented as โจa,โbโฉโ=โฮปp.(p)ab,
projectors are ฯ1โ=โฮปxy.x
and ฯ2โ=โฮปxy.y,
- natural numbers can be represented as Church numerals โnโโ=โฮปfx.fnx.
Hence the definitionโ:
- aโโฉโPโ
โงโ
Q if ฯ1aโโฉโP
and ฯ2aโโฉโQ
- aโโฉโPโโโQ if for
all b such that bโโฉโP we have abโโฉโQ
- aโโฉโโx.P
if there is an nโโโโ
such that ฯ1aโ=โโnโ
and ฯ2aโโฉโP[xโ:=โn]
- aโโฉโโx.P
if for all nโโโโ,
aโnโโโฉโP[xโ:=โn]
- aโโฉโsโ=โt if โโโจโsโ=โt (with
s and t closed)
Second order and encoding of data
The interpretation of arithmetic in a PCA relies on ad-hoc encodings
of data types (pairs, natural numbers).
These can be specified using second-order
quantificationโ:
- Consider a PCA A and
formulas on โ and โ with parameters in subsets of A.
- Define aโโฉโs if
aโโโs for sโโโA โparameters specify a
realisation predicate explicitly.
- Define aโโฉโโฮฑ.P as aโโฉโP[ฮฑโ:=โv]
for all sets vโโโA โ
realising a second-order universal means realizing all instances
uniformly.
We can prove some specification resultsโ:
- tโโฉโโฮฑ.(ฮฑโโโฮฑ)
iff t is the identity
function, i.e.ย for all aโโโA, tโ
โ
โ
aโ=โa.
- โฮฑ.(ฮฑโโโฮฑโโโฮฑ)
has two generic realisers, ฮปxy.x and
ฮปxy.y.
- โฮฑ.((ฮฑโโโฮฑ)โโโฮฑโโโฮฑ)
has Church numerals as generic realisers.
We keep this fuzzy for now.
Plan
The situation so farโ:
- PCAs as a generic presentation of models of purely
functional computation,
- an implementation of the BHK principles, modulo an encoding of
first-order structures as computational objects.
What comes nextโ:
- why full classical logic does nothing interesting in PCAs,
- how we can extend the technique to get constructive content for
classical logic.
Classical reasoning
and control flow
Intuitionistic negation
By definition, there can be no witness for absurdity โฅ.
This makes negation ยฌP
(defined as Pโโโโฅ)
degenerateโ:
- If P is realisable, then
there can be no realiser of ยฌP.
- If P is not realisable,
then anything realises ยฌP.
The set of realisers of ยฌP
is either empty or full, so one cannot extract any information from a
proof of a negation, apart from its existence.
Classical negation and disjunction
In classical logic, negation is considered involutiveโ:
- ยฌยฌP is equivalent to P โ elimination of double
negation
- Pโ
โจโ
ยฌP holds for
all P โ excluded middle
- ((PโโโQ)โโโP)โโโP
holds for all P and Q โ Peirceโs law
Factโ: classical disjunction is incompatible with an effective
intuitionistic disjunction property.
- If Pโ
โจโ
ยฌP was
uniformly realised, then the realiser would have to always choose the
same side independently of P,
which is nonsense.
- If Pโ
โจโ
ยฌP was
realised for all P as a
function of P, it would imply
that all predicates are decidable, which cannot be effective.
The Devilโs interpretation
- Devil
-
If you accept my deal, I will either give you a billion dollars, or
offer you anything you desire in exchange for a billion dollars.
- Mortal
-
I accept your deal.
- Devil
-
Fine ! Bring me a billion dollars and I will grant all your wishes.
Many years pass, the Mortal does a lot of questionable things and
finally assembles a billion dollars in a briefcase.
- Mortal
-
Here is a billion dollars, now grant me my wish !
The Devil takes the briefcase, then the world trembles and the Mortal
finds himself in a familiar situation.
- Devil
-
If you accept my deal, I will either give you a billion dollars, or
offer you anything you desire in exchange for a billion dollars.
- Mortal
-
I accept your deal.
- Devil
-
Fine ! Here is a billion dollars
The Devil hands the Mortal a briefcase with a billion dollars in
it.
After Wadler (2003), after Selinger
Computing with continuations
The Devilโs interpretation involves answering the same question
several times, that is returning several times from a given
computation.
Formally, we now work in a ฮป-calculus extended with extra constants
to handle controlโ:
- termsโ: M,โN,โโฆโ:=โxโ
โฃโ
ฮปx.Mโ
โฃโ
(M)Nโ
โฃโ
๐โ
โฃโ
๐คฯ
- stacksโ: ฯ, ฯ, โฆ := M โ
M โฏ M
Execution now concerns closed terms applied to closed stacksโ:
| push |
(M)Nโ
โโ
ฯ |
โป |
Mโ
โโ
Nโ
โ
โ
ฯ |
| pop |
ฮปx.Mโ
โโ
Nโ
โ
โ
ฯ |
โป |
M[xโ:=โN]โ
โโ
ฯ |
| save |
๐โ
โโ
Mโ
โ
โ
ฯ |
โป |
Mโ
โโ
๐คฯโ
โ
โ
ฯ |
| restore |
๐คฯโ
โโ
Mโ
โ
โ
ฯ |
โป |
Mโ
โโ
ฯ |
An abstract formulation of call with current continuation
(from Scheme), which can be used to implement various control
structuresโ: exceptions etc.
Typing continuations
A few observations on (๐)Mโ
โโ
ฯโโปโMโ
โโ
๐คฯโ
โ
โ
ฯโ:
- (๐)M can return
several times in its context ฯ, by calling the continuations
๐คฯ that
๐ creates.
- A term ๐คฯ discards the
context in which it is called, so it never returns.
If (๐)M behaves
well for a type A, then the
๐คฯ that it
creates expects values of type A and do not return at all, so it
behaves well for any type.
- kฯ
respects the type AโโโB for any B
- M respects the type (AโโโB)โโโA
- ๐ respects the type ((AโโโB)โโโA)โโโA
The control operator ๐
realises Peirceโs law.
Classical
realisability
Realisability in interactive context
Execution is an interaction between a program and an
environment, witnessing a given type means interacting correctly with
opponents for that type.
Pick a pole โซซ
โ a set of states Mโ
โโ
ฯ such that sโโปโtโโโโซซ implies sโโโโซซ
Define orthogonality as Mโโซซโฯ when Mโ
โโ
ฯโโโโซซ
โ M and ฯ are orthogonal when they interact
correctly for โซซ
Induces an observation equivalenceโ: MโโโN if {M}โซซโ=โ{N}โซซ
โ M and N are equivalent when the pass the
same tests
A behaviour is a set of terms A such that Aโโซซโโซซโ=โA
Remark that, if โซซ is empty, there
are two behavioursโ: empty and full.
Realisability through falsity values
The realisability structure relies on defining characteristic tests
for logical formulas.
MโโฉโP means
that for all ฯโโโโฆPโง
we have Mโโซซโฯ
โฆPโง is the falsity
value of P, defined
inductively on P
| โฆPโโโQโง |
= |
{Mโ
โ
โ
ฯโ
โฃโ
MโโฉโP,โฯโโโโฆQโง} |
| โฆโx.Pโง |
= |
โvโฆP[xโ:=โv]โง |
Quantification is interpreted uniformly,
- in a particular structure for first order (as in model theory),
- in sets of stacks for second order.
This is compatible with the previous approachโ:
- MโโฉโPโโโQ implies
(M)NโโฉโQ for
all NโโฉโP
- Mโโฉโโx.P
when MโโฉโP[xโ:=โv]
for all values v
Adequacyโ: if the typing judgement โโขโMโ:โP is provable then
MโโฉโP for any choice
of โซซ.
Realising classical principles
The formula โฅ is โฮฑ.ฮฑ, so โฆโฅโง is the set of all stacks,
Mโโฉโโฅ means that Mโ
โโ
ฯ is in โซซ whatever ฯ is.
Consider a formula P
and a stack ฯโโโโฆPโง,
then
- for all MโโฉโP we
have Mโ
โโ
ฯโโโโซซ by
definition
- for all stack ฯ, we have
๐คฯโ
โโ
Mโ
โ
โ
ฯโโปโMโ
โโ
ฯโโโโซซ
so ๐คฯโโฉโPโโโQ
and (๐คฯ)MโโฉโQ
for whatever type Q
- for all Nโโฉโ(PโโโQ)โโโP
we have ๐โ
โโ
Nโ
โ
โ
ฯโโปโNโ
โโ
๐คฯโ
โ
โ
ฯโโโโซซ
- hence ๐โโฉโ((PโโโQ)โโโP)โโโP
Finally, we have ๐โโฉโโฮฑ.โฮฒ.((ฮฑโโโฮฒ)โโโฮฑ)โโโฮฑ,
as expected.
If we extend the typing rules with a schema โโขโ๐โ:โ((ฮฑโโโฮฒ)โโโฮฑ)โโโฮฑ,
then adequacy remains and we get proof language for all classical
logic.
Proof-like terms
Assume โซซ is not empty and take an
arbitrary Mโ
โโ
ฯโโโโซซ.
Then (๐คฯ)M
is a realiser for โฅ.
Waitโฆ What?
We need a criterion to distinguish โactualโ realisers in the set of
computational objects.
Definition
A proof-like term (or quasi-proof) is a closed term
that has no occurrence of a ๐คฯ.
Now we can make more precise statementsโ:
- A formula P is
realisable given pole โซซ if it
is realised by a proof-like term.
- A formula is universally realisable if there is a
proof-like term that realises it for any choice of โซซ.
Specification of data types
Using second order quantification, we can characterise
behavioursโ:
| unit |
โฮฑ.ฮฑโโโฮฑ |
Iโ
โโ
tโ
โ
โ
ฯโโปโtโ
โโ
ฯ |
| bool |
โฮฑ.ฮฑโโโฮฑโโโฮฑ |
Bโ
โโ
t0โ
โ
โ
t1โ
โ
โ
ฯโโปโtbโ
โโ
ฯ |
| Pโ
รโ
Q |
โฮฑ.(PโโโQโโโฮฑ)โโโฮฑ |
โจM,โNโฉโ
โโ
pโ
โ
โ
ฯโโปโpโ
โโ
Mโ
โ
โ
Nโ
โ
โ
ฯ |
| Pโ
โจโ
Q |
โฮฑ.(Pโโโฮฑ)โโโ(Qโโโฮฑ)โโโฮฑ |
Dโ
โโ
fโ
โ
โ
gโ
โ
โ
ฯโโปโfโ
โโ
Mโ
โ
โ
ฯ
or gโ
โโ
Nโ
โ
โ
ฯ |
|
|
with MโโฉโP and NโโฉโQ |
Example reasoning for booleans (note that second order quantification
ranges over falsity values, that is sets of stacks)โ:
- Assume Bโโฉโโฮฑ.ฮฑโโโฮฑโโโฮฑ
for all choices of โซซ.
- Pick arbitrary t0, t1 and ฯ.
- Define โโซซโโ:=โ{Mโ
โโ
ฯโ
โฃโ
โbโโโ{0,โ1},โMโ
โโ
ฯโโปโtbโ
โโ
ฯ}.
- Instantiate ฮฑ as {ฯ}.
- Check that we have tbโโฉโ{ฯ}
for each bโโโ{0,โ1}.
- Since Bโโฉโ{ฯ}โโโ{ฯ}โโโ{ฯ}
we have Bโ
โโ
t0โ
โ
โ
t1โ
โ
โ
ฯ.
- By definition of โซซ this implies
that Bโ
โโ
t0โ
โ
โ
t1โ
โ
โ
ฯโโปโtbโ
โโ
ฯ
for some b.
Excluded middle
Define Tโ:=โฮปf.ฮปg.๐(ฮปk.f(ฮปa.k(ga))).
Then T has type โฮฑ.โฮฒ.(ยฌฮฑโโโฮฒ)โโโ(ฮฑโโโฮฒ)โโโฮฒ,
that is โฮฑ.ยฌฮฑโ
โจโ
ฮฑ.
It implements a kind of exception handlerโ:
| Tโ
โโ
fโ
โ
โ
gโ
โ
โ
ฯ |
โป |
fโ
โโ
๐g,โฯโ
โ
โ
ฯ |
try f with
๐ โ g |
| ๐g,โฯโ
โโ
aโ
โ
โ
ฯ |
โป |
gโ
โโ
aโ
โ
โ
ฯ |
raise ๐(a) |
It can be generalised to more complex structures.
A bit of model
theory
First order in realisability
General structure
The logical language can be extended to include first orderโ:
- pick a first-order language (common choicesโ: arithmetic, set
theory)
- atomic formulas have the shape ฮฑ(t1,โโฆ,โtn)
where ฮฑ is a predicate symbol
or variable of arity n
- interpret first-order terms and quantifiers in a structure โณ
- a predicate of arity n is
interpreted as a function in โณnโโโ๐ซ(ฮ )
Equality
- Definable ร la Leibnizโ: (sโ=โt)โ:=โโฮฑ.(ฮฑ(t)โโโฮฑ(u))
- When sโ=โt holds
in the interpretation structure, ฮปx.xโโฉโsโ=โt.
Realisability models
Pick a language and an interpretation structure โณ.
Consistency
Given a first-order language and interpretation, each pole โซซ induces a theory ๐ฏโซซโ: the set of formulas
realised by proof-like terms.
- A pole โซซ is consistent if
๐ฏโซซ is, that is
โฅโโโ๐ฏโซซ
On falsity values, define the relation aโโฒโb when aโโโb is realised by a
proof-like term.
- The relation โฒ is a preorder.
- It extends โ (is aโโโb then ฮปx.xโโฉโaโโโb).
- It makes the set of falsity values a Boolean algebra.
Then ๐ฏโซซ is the
set of formulas interpreted by โค in
this Boolean algebra.
Models
Models of ๐ฏโซซ are
realisability models induced by โซซ.
- Realisability models satisfy all axioms of second-order logic.
- In the degenerate โโซซโโ=โโ
, they are
equivalent to โณ.
Arithmetics
Consider the particular case of arithmetic, with โ as the interpretation
structure.
- Given two closed first-order terms s and t, โฆsโ=โtโง is โฆโฮฑ.ฮฑโโโฮฑโง if
โโโจโsโ=โt,
it is โฆโคโโโโฅโง if โโโจโsโโ โt.
- Horn clauses โx1โฏโxmE1โโโโฏโโโEnโโโG
(where the Ei and G are equalities or โฅ) which are true in โ are universally realised.
- In particular, all axioms of basic arithmetic hold in realisability
models.
Define ๐(n)โ:=โโฮฑ.((โx.ฮฑ(x)โโโฮฑ(xโ
+โ
1))โโโฮฑ(0)โโโฮฑ(n)).
- ๐(42) specifies a Church
numerals that iterates 42 times
- The recurrence axiom โx.๐(x) generally
does not hold โ it would be a term that behaves like all
numbers at the same time.
Arithmetic statements can be relativised to ๐โ: define โ๐x.P
as โx.๐(x)โโโP.
- Stating that an operation is internal to ๐ means computing itโ: โ๐m.โ๐n.๐(mโ
+โ
n)
- Mathematical statements specify behavioursโ: โ๐p.โ๐q.(pโ
รโ
qโ=โnโโโpโ=โ1โ
โจโ
qโ=โ1)
Realisability models contain models of second-order arithmetic, plus
other objects.
Model theoretic axioms
The axiom of choice
โR.(โ๐n.โ๐m.R(n,โm)โโโโF.โ๐nโโโN.โ!๐p.(F(n,โp)โ
โงโ
R(n,โp)))
Krivine knows how to realise this by extending the language with an
extra instruction (essentially memoizing calls to R to make sure that F is properly functional), yet most
realisability models do not satisfy it.
For each nโโโโ,
define โn(x) as the
formula xโ
+โ
1โโคโn
(where xโโคโy is โt.xโ
+โ
tโ=โy).
- Then โx.โn(x)โโโ(xโ=โ0โ
โจโ
โฏโ
โจโ
xโ=โnโ
โโ
1)
is not universally realised.
- Further study of ๐ฏโซซ, assuming โx.ยฌ๐(x) is
realised, reveals that the โn cannot be
well-ordered, which refutes the axiom of choice.
- Considered as subsets of โ, they form a sequence where each
element strictly injects into the next. This also contradicts the
continuum hypothesis.
The
foundation axiom in set theory
On the language of set theory, consider the foundation axiom โa.(โx.(xโโโaโโโP(x))โโโP(a))โโโโa.P(a)
- It is the type of a fixed pointโ: Y such that Yฯโโปโฯ(Yฯ)
- Proving that ฯ is well
typed is equivalent to proving that recursion terminates.
Generalising the construction
The construction of classical realisability is clever but it looks
ad-hoc in various ways, we look for cleaner structure.
Inclusion of falsity values reflects all the basic
structureโ:
- โฆQโงโโโโฆPโง when
Q is a subtype of P
- {M}โซซโโโโฆPโง when
M is a realiser of P
- {M}โซซโโโ{N}โซซ
when M somehow reduces to
N
Falsity values form a complete lattice.
For most purposes, a term M can be identified with the falsity
value {M}โซซ of tests
that it passes.
Implicative structures
Definition
- An implicative structure is a complete lattice (A,โโค) equipped with an operator
โโโโ:โAโ
รโ
AโโโA
that
- is contravariant on the leftโ: aโโคโaโฒ implies aโฒโโโbโโคโaโโโb
- commutes to meets on the rightโ: aโโโโBโ=โโbโโโB(aโโโb)
- Application is defined by adjunction on the arrowโ:
aโ
โ
โ
bโ:=โโ{cโ
โฃโ
aโโคโbโโโc}
so that for all c, aโ
โ
โ
bโโคโc iff
aโโคโbโโโc.
Examples
- If โซซ is a pole, the set โฑ of sets of stacks (falsity values)
is an implicative structure with aโโคโb if aโโโb and
aโโโbโ:=โ{Mโ
โ
โ
ฯโ
โฃโ
Mโโโaโซซ,โฯโโโb},
and aโ
โ
โ
bโ=โ{ฯโ
โฃโ
โMโโโbโซซ,โMโ
โ
โ
ฯโโโa}.
- If ๐ is a complete Heyting
algebra, then aโโโbโ:=โโ{cโ
โฃโ
cโ
โงโ
aโโคโb}
makes it an implicative structure and โ
is โง.
- If ๐ is a PCA, then ๐ซ(๐) with aโโโbโ:=โ{pโ
โฃโ
โqโโโa,โpqโโโb}
is (almost) an implicative structure
and aโ
โ
โ
bโ=โ{pโ
โ
โ
qโ
โฃโ
pโโโa,โqโโโb}.
General observations
Elements of an implicative represent behaviours, they can be seen
indifferently as types or as programs.
The structure allows to define combinators by their specification
in any structure (but some may be degenerate)โ:
- ๐โ:=โโa,โbโ
aโโโbโโโa
- ๐โ:=โโa,โb,โcโ
(aโโโbโโโc)โโโ(aโโโb)โโโaโโโc
- ๐โ:=โโa,โbโ
((aโโโb)โโโa)โโโa
Any function fโ:โ๐โโโ๐ induces
an element ฮปfโ:=โโa(aโโโf(a)),
all ฮป-terms can be interpreted this way.
Computational properties appear abstractlyโ:
- (aโโโb)aโโคโb
hence (ฮปf)aโโคโf(a)
โ ฮฒ-reduction
- aโโคโbโโโab
hence aโโคโฮป(bโโฆโab)
โ ฮท-expansion
The implicative structure includes uniform and non-uniform
constructsโ:
- the product Aโ
รโ
Bโ:=โโฮฑ.(AโโโBโโโฮฑ)โโโฮฑ
is a constructive conjunction
- the meet Aโ
โงโ
B is
a uniform conjunction (a.k.a. intersection type)
- Aโ
โงโ
BโโโAโ
รโ
B
is always realised, the reverse only in degenerate models
Separators and consistency
Definition
A separator of an implicative structure ๐ is a subset ๐ฎโโโ๐ that
- is upwards closedโ: if bโโฅโaโโโ๐ฎ then
bโโโ๐ฎ,
- contains ๐ and ๐,
- is stable under modus ponensโ: if aโโโbโโโ๐ฎ and
aโโโ๐ฎ then bโโโ๐ฎ.
A separator ๐ฎ is
consistent if โฅโโโ๐ฎ,
classical if ๐โโโ๐ฎ.
- The first condition recalls the one on poles, it accounts for
execution dynamics and logical consequence.
- The other two are analogue to provability rules in Hilbert-style
proofs.
- Stability under modus ponens implies stability under
application, hence all pure ฮป-terms are representable in all
separators.
Entailment in implicative algebras
Given a implicative structure ๐ and a separator ๐ฎ, define entailment as
aโข๐ฎb
when (aโโโb)โโโ๐ฎ.
- Entailment is a preorder.
- It extends โค (since aโโคโb implies ฮปx.xโโคโaโโโb).
- The quotient ๐/๐ฎ
of ๐ under the associated
equivalence is a Heyting algebra.
- It is a Boolean algebra if ๐โโโ๐ฎ.
Usual model-theoretic techniques followโ:
- If โฅโโโ๐ฎ then the theory
๐ฏ๐ฎ of
formulas interpreted by โค in ๐/๐ฎ is consistent.
- If ๐ฎ is maximal among
consistent separators, then ๐/๐ฎ is the 2-element
Boolean algebra and ๐ฏ๐ฎ is
complete.
This applies even when ๐ฎ is
not classical.
Models of
concurrency
Process algebrasโ: CCS
We use a formal language to represent programs that interact by
message passingโ:
| a.P,
ฤ.P |
action prefix |
| PโโฅโQ, Pโ
+โ
Q, 1 |
parallel composition, choice, stop |
| !P |
replication |
| (ฮฝa)P |
name restriction |
One can define the dynamics as a reduction up to structural
congruenceโ:
(a.Pโ
+โ
Pโฒ)โโฅโ(ฤ.Qโ
+โ
Qโฒ)โโถโPโโฅโQ
Structural congruence โก makes โฅ a commutative monoid law with 1 as neutral and makes name restriction
behave right.
Non-determinism is unavoidableโ:
ฤ.1โโฅโa.Qโโฅโa.Rโโถโ1โโฅโQโโฅโa.R
ฤ.1โโฅโa.Qโโฅโa.Rโโถโ1โโฅโa.QโโฅโR
Process algebrasโ: the ฯ-calculus
An extension of CCS where actions can communicate names
which can be used themselves for communication.
Notationโ:
- a(x).P
means โreceive a name on channel on a, bind it to x then do Pโ
- ab.P
means โsend the name b on
channel a then do Pโ
Name passing can reveal new possible interactions
a(x).xc.1โโฅโab.1โโฅโb(z).Pโโถโbc.1โโฅโ1โโฅโb(z).Pโโถโ1โโฅโ1โโฅโP[zโ:=โc]
Name passing represents โmobileโ processes, with dynamic
connections.
- It is expressive enough to implement the ฮป-calculus.
- It has variantsโ: polyadic, asynchronousโฆ
- It has various type disciplines
The world of process calculi is a mess
Many languages with various design choices
- more or less higher order
- more or less synchronous
- various restrictions on name passing
Many ways to define equivalence of processes
- various forms of test
- a zoo of notions of bisimilarity
Many encodings with various invariants
- translations between various calculi
- embeddings of ฮป-calculi
And let us not speak (yet) about type systems.
Models of concurrency, traditionally
Event structuresโ:
- events are points in a partial order
- configurations are particular sets of events (partial runs
as histories)
- structures are sets of configurations with consistency
conditions
Closely related to Scottโs domains, Girardโs coherence spaces,
etc.
More recently exploited in concurrent games.
Operational semantics, CCS as a modelโ:
- use terms of a basic language to interpret programs from other
languages
- structure the space using a notion of refinementโ:
(bi)simulation
Blurs the boundary between programs and typesโ:
- specifications are themselves processesโ:
program P respects a
specification S if P and S are bisimilar;
- a process is identified with the space of its observable
behaviours.
The programme
We want a properly logical description of processes behavioursโ:
- Algebraic structure โ for properly composing things
- Semantics โ insights on the meaning of process constructs
- Typing โ static description of dynamic objects, invariants
We aim for an analytic approachโ:
- start from a model of interaction with few constraints a
priori,
- be agnostic on the notion of refinement at work,
- extract logical principles from the structure.
We look for the minimal logic for concurrency.
Logics for process
behaviours
Logics for concurrent processes
One assigns types to different elements of the language in
order to put constraints on the set of allowed expressions and thus
statically ensure properties of termsโ:
- compatibility between senders and receivers,
- control on name usage,
- guarantees on global good behaviour,
- respect of communication protocolsโฆ
Usually guided by computational concerns rather than logical
consistency.
Sangiorgi and Walker (2001)
We would like to fit all these in a general realisability framework,
which has to be linear.
The example of session types
Session types describe the communication discipline on names.
- aโ:โAโ
โโ
B means
โsend a name x on a then behave as A on x and as B on a, independentlyโ
- aโ:โAโโธโB means
โreceive a name x on a then behave as B on a, assuming the environment behaves
as A on xโ
- aโ:โ๐ means โterminate the
session on aโ
The logic for these behaviours is linearโ:
| Pโโทโฮโโขโbโ:โA
โ Qโโทโฮโโขโaโ:โB |
โโ (ฮฝb)(Pโโฅโab.Q)โโทโฮ,โฮโโขโaโ:โAโ
โโ
B |
| Pโโทโฮ,โxโ:โA,โaโ:โBโโขโbโ:โC |
โโ a(x).Pโโทโฮ,โaโ:โAโ
โโ
Bโโขโbโ:โC |
| Pโโทโฮ,โxโ:โAโโขโaโ:โB |
โโ a(x).Pโโทโฮโโขโaโ:โAโโธโB |
| Pโโทโฮโโขโaโ:โA
โ Qโโทโฮ,โbโ:โBโโขโcโ:โC |
โโ (ฮฝb)(Pโโฅโab.Q)โโทโฮ,โฮโโขโcโ:โC |
|
โโ 1โโทโโโขโaโ:โ๐ |
| Pโโทโฮโโขโaโ:โA |
โโ Pโโทโฮ,โbโ:โ1โโขโaโ:โA |
| Pโโทโฮ,โaโ:โAโโขโbโ:โB
โ Qโโทโฮโโขโaโ:โA |
โโ (ฮฝa)(PโโฅโQ)โโทโฮ,โฮโโขโbโ:โB |
- This can be extended to full linear logic.
- It is very โsyntheticโ and forces functional behaviours.
Honda (1993), Caires, Pfenning, and Toninho (2016)
Testing as orthogonality
Consider a process algebra and define an observation as a set โซซ of processes, abstractly considered as
well-behaved.
- may testingโ: โโซซโโ=โ{Pโ
โฃโ
โR,โPโถ*ฯโโฅโR}
(where ฯ is a special action
to represent success)
- fair testingโ: โโซซโโ=โ{Pโ
โฃโ
โPโถ*Q,โโR,โQโถ*ฯโโฅโR}
- terminationโ: โซซ is the set of terms
that have no infinite run
- many other choices
Deduce orthogonalityโ:
- PโโซซโQ if PโโฅโQโโโโซซ
- PโโโQ if {P}โซซโ=โ{Q}โซซ
Orthogonal sets form a complete lattice of behaviours.
Combinations of behaviours
Start with parallel composition of independent behaviours.
- Assume a pair of injections โ,โrโ:โNโโโN
over names, with disjoint images โ split the set of name into
independent name spaces
- If P is a term, write
P[โ] for P renamed by โ
- Define multiplicative conjunction by its generatorsโ: Aโ
โโ
Bโ:=โ{P[โ]โโฅโQ[r];โPโโโA,โQโโโB}โโซซโโซซ
- Define implication by dualityโ: AโโธโBโ:=โ(Aโ
โโ
Bโซซ)โซซโ=โ{P[โ]โโฅโQ[r];โPโโโA,โQโโโBโซซ}โซซ
- Deduce application by adjunctionโ: Aโ
โโ
BโโคโC iff
AโโคโBโโธโC,
Aโ
โโ
Bโ=โ{(ฮฝโ)(PโโฅโQ[โ])[rโ1];โPโโโA,โQโโโB}โโซซโโซซ
This makes A nice structure compatible with multiplicative linear
logic.
Other logical constructs can be built on topโ:
- modalities โจaโฉA
and [a]A for
behaviours that start with an action a
- exponential modalities !A
and ?A for replicable
processes
Linear conjunctive
algebras
Conjunctive structures
Basic structure
A conjunctive structure consists in
- a complete lattice (๐,โโค)
โ behaviours ordered by refinement
- a monotonic binary operator โ โ
parallel composition of independent behaviours
- a contravariant unary operator (โ
)โฅ โ dual behaviour
Add a few natural conditions.
A conjunctive structure is involutive if aโฅโฅโ=โa for all
aโโโ๐.
Derived operators
- aโโธโbโ:=โ(aโ
โโ
bโฅ)โฅ
โ processes that react well to an offer of a and expectation of b
- aโ
โโ
bโ:=โโ{c;โaโโคโbโโธโc}
โ an abstract notion of application among realizers
- By construction, aโ
โโ
bโโคโc iff
aโโคโbโโโc.
Linear conjunctive algebras
This structure allows for defining particular inhabitants of ๐, following the ideas of
implicative algebrasโ:
| ๐ฌ1 |
โaโ
aโโธโ(aโ
โโ
a) |
contraction |
| ๐ฌ2 |
โa,โbโ
(aโ
โโ
b)โโธโa |
weakening |
| ๐ฌ3 |
โa,โbโ
(aโ
โโ
b)โโธโ(bโ
โโ
a) |
commutativity |
| ๐ฌ4 |
โa,โb,โcโ
(aโโธโb)โโธโ(cโ
โโ
a)โโธโ(cโ
โโ
b) |
functoriality |
| ๐ฌ5 |
โa,โb,โcโ
(aโ
โโ
(bโ
โโ
c))โโธโ((aโ
โโ
b)โ
โโ
c)) |
associativity |
Conjunctive
algebras
A separator is a subset ๐ฎโโโ๐ that is upwards
closed, stable under modus ponens (for the implication โธ) and contains ๐ฌ1,โโฆ,โ๐ฌ5.
This is essentially equivalent to an implicative algebra.
Linear
conjunctive algebras
Removing ๐ฌ1 and
๐ฌ2 from the
requirement on separators yields a linear conjunctive
algebra.
- This models multiplicative linear logic.
- Extra constructs and axioms can be included to handle full linear
logic.
Instances of linear conjunctive algebras
Phase spaces (the analogue of Heyting algebras for linear
logic)โ:
- take a commutative monoid M and a subset โฅโโโM
- define orthogonalityโ: xโโฅโy iff xyโโโM
- set ๐โ:=โ{aโฅ;โaโโโM}
and aโ
โโ
bโ:=โ{xy;โxโโโa,โyโโโb}โฅโฅ
Coherence spaces (a standard model for proofs in linear
logic)โ:
- for x,โyโโโโ, set
xโฅy iff โฏ(xโ
โฉโ
y)โโคโ1
- set ๐โ:=โ{aโฅ;โaโโโ๐ซ(โ)}
- set aโ
โโ
bโ:=โ{xโ
รโ
y;โxโโโa,โyโโโb}โฅโฅ
for some bijection โจ,โฉโ:โโ2โโโโ
โฆ up to some details
Lattices of process behaviours
- take โ as explained before for a
generic composition structure
- add actions in โ to interpret
session types
Open questions
We get a suitable structure to fit process behaviours, butโฆ
References
Beffara, Emmanuel. 2006.
โA Concurrent Model for Linear
Logic.โ In
21st International Conference on Mathematical
Foundations of Programming Semantics (MFPS), 155:147โ68. Electronic
Notes in Theoretical Computer Science.
https://doi.org/10.1016/j.entcs.2005.11.055.
Beffara, Emmanuel, Fรฉlix Castro, Mauricio Guillermo, and รtienne Miquey.
2023.
โConcurrent Realizability on Conjunctive Structures.โ
In
8th International Conference on Formal Structures for Computation
and Deduction (FSCD 2023), edited by Marco Gaboardi and Femke van
Raamsdonk, 260:28:1โ21. Leibniz International Proceedings in Informatics
(LIPIcs). Dagstuhl, Germanyโ: Schloss Dagstuhl โ Leibniz-Zentrum fรผr
Informatik.
https://doi.org/10.4230/LIPIcs.FSCD.2023.28.
Caires, Luรญs, Frank Pfenning, and Bernardo Toninho. 2016.
โLinear
Logic Propositions as Session Types.โ Mathematical Structures
in Computer Science 26 (3)โ: 367โ423.
https://doi.org/10.1017/S0960129514000218.
Girard, Jean-Yves. 2017.
โTranscendental Syntax Iโ: Deterministic
Case.โ Mathematical Structures in Computer Science 27
(5)โ: 827โ49.
https://doi.org/10.1017/S0960129515000407.
Griffin, Timothy G. 1990.
โA Formulae-as-Type Notion of
Control.โ In
Proceedings of the 17th ACM SIGPLAN-SIGACT
Symposium on Principles of Programming Languages, 47โ58. POPL โ90.
San Francisco, California, USAโ: Association for Computing Machinery.
https://doi.org/10.1145/96709.96714.
Heyting, Arend. 1931.
โDie intuitionistische Grundlegung der
Mathematik.โ Erkenntnis 2 (1)โ: 106โ15.
https://doi.org/10.1007/BF02028143.
Honda, Kohei. 1993.
โTypes for Dyadic Interaction.โ In
CONCURโ93, edited by Eike Best, 715:509โ23. Lecture Notes in
Computer Science. Springer Berlin Heidelberg.
https://doi.org/10.1007/3-540-57208-2_35.
Johansson, Ingebrigt. 1937.
โDer Minimalkalkรผl, ein reduzierter
intuitionistischer Formalismus.โ Compositio Mathematica
4โ: 119โ36.
https://www.numdam.org/item/CM_1937__4__119_0/.
Kleene, Stephen Cole. 1945.
โOn the Interpretation of
Intuitionistic Number Theory.โ The Journal of Symbolic
Logic 10 (4)โ: 109โ24.
https://doi.org/10.2307/2269016.
Kolmogoroff, A. 1932.
โZur Deutung der intuitionistischen
Logik.โ Mathematische Zeitschrift 35 (1)โ: 58โ65.
https://doi.org/10.1007/BF01186549.
Krivine, Jean-Louis. 2009.
โRealizability in Classical
Logic.โ Panoramas Et Synthรจses, Interactive models of
computation and program behavior, 27โ: 197โ229.
https://hal.archives-ouvertes.fr/hal-00154500.
Miquel, Alexandre. 2020.
โImplicative Algebrasโ: A New Foundation
for Realizability and Forcing.โ Mathematical Structures in
Computer Science 30 (5)โ: 458โ510.
https://doi.org/10.1017/S0960129520000079.
Miquey, รtienne. 2020.
โRevisiting the Duality of Computationโ: An
Algebraic Analysis of Classical Realizability Models.โ In
CSL
2020. Barcelone, Spain.
https://hal.archives-ouvertes.fr/hal-02305560.
Sangiorgi, Davide, and David Walker. 2001.
The ฯ-Calculusโ: A Theory
of Mobile Processes. Cambridge University Press.
http://www.cs.unibo.it/~sangio/Book_pi.html.
Troelstra, Anne Sjerp, and Dirk van Dalen. 1988. Constructivism in
mathematics. Studies in logic and the foundations of mathematics
121, 123. Amsterdam New York Oxford [etc.]โ: North-Holland.
Wadler, Philip. 2003.
โCall-by-Value Is Dual to
Call-by-Name.โ In
Proceedings of the Eighth ACM SIGPLAN
International Conference on Functional Programming, 189โ201. ICFP
โ03. New York, NY, USAโ: Association for Computing Machinery.
https://doi.org/10.1145/944705.944723.