Adjunction Based Categorical Logic Programming - Ed Morehouse

58
. . Adjunction Based Categorical Logic Programming Ed Morehouse Wesleyan University March 30, 2012

Transcript of Adjunction Based Categorical Logic Programming - Ed Morehouse

Page 1: Adjunction Based Categorical Logic Programming - Ed Morehouse

.

.Adjunction Based Categorical Logic Programming

Ed Morehouse

Wesleyan University

March 30, 2012

Page 2: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Outline

...1 A Brief History of Logic Programming

...2 Proof Search in Proof Theory

...3 Adjunctions in Categorical Proof Theory

...4 Connective Chirality and Search Strategy

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 3: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

...1 A Brief History of Logic Programming

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 4: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

In the beginning there was PROLOG

PROLOG has:

the logic of Horn clauses

operational semantics of resolution

denotational semantics based in model theory (classical logic)

Weaknesses:

to be practical, incorporates extra-logical features (e.g. assert/retract, cut)

not clear how to extend to other logics

“logic programming is logic plus control” – Kowalski

How to get the logic to do more of the work?

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 5: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

In the beginning there was PROLOG

PROLOG has:

the logic of Horn clauses

operational semantics of resolution

denotational semantics based in model theory (classical logic)

Weaknesses:

to be practical, incorporates extra-logical features (e.g. assert/retract, cut)

not clear how to extend to other logics

“logic programming is logic plus control” – Kowalski

How to get the logic to do more of the work?

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 6: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

In the beginning there was PROLOG

PROLOG has:

the logic of Horn clauses

operational semantics of resolution

denotational semantics based in model theory (classical logic)

Weaknesses:

to be practical, incorporates extra-logical features (e.g. assert/retract, cut)

not clear how to extend to other logics

“logic programming is logic plus control” – Kowalski

How to get the logic to do more of the work?

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 7: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

The Miller Revolution

Dale Miller realized the connective of implication could interpret scoping andmodules [Mil89]:

The goal D ⊃ G could mean, “try to satisfy the goal G in the current environmentaugmented by the local assumption D”.

But not classically:

G1∨ (D⊃G2) ≡ G1∨¬D∨G2 ≡ (D⊃G1)∨G2 ≡ (D⊃G1)∨ (D⊃G2)

Intuitionistic logic makes a natural choice.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 8: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

The Miller Revolution

Dale Miller realized the connective of implication could interpret scoping andmodules [Mil89]:

The goal D ⊃ G could mean, “try to satisfy the goal G in the current environmentaugmented by the local assumption D”.

But not classically:

G1∨ (D⊃G2) ≡ G1∨¬D∨G2 ≡ (D⊃G1)∨G2 ≡ (D⊃G1)∨ (D⊃G2)

Intuitionistic logic makes a natural choice.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 9: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Abstract Logic Programming Languages

Miller et al [Mil+91] proposed an operational semantics for goal-directed proofsearch in intuitionistic logic by taking inversions of natural deduction introductionrules (sequent right rules) as search instructions (⊢ ):

SUCCESS : Γ ⊢ ⊤ alwaysFAILURE : Γ ⊢ ⊥ never

BOTH : Γ ⊢ A ∧ B only if Γ ⊢ A and Γ ⊢ BEITHER : Γ ⊢ A ∨ B only if Γ ⊢ A or Γ ⊢ B

AUGMENT : Γ ⊢ A ⊃ B only if Γ , A ⊢ BGENERIC : Γ ⊢ ∀𝑥 ∶ X . A only if Γ ⊢ A [𝑥↦𝑒] for 𝑒 ∉ FV(Γ , A)

INSTANCE : Γ ⊢ ∃𝑥 ∶ X . A only if Γ ⊢ A [𝑥↦𝑡] for some 𝑡 ∶ X

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 10: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Abstract Logic Programming Languages

Miller et al [Mil+91] proposed an operational semantics for goal-directed proofsearch in intuitionistic logic by taking inversions of natural deduction introductionrules (sequent right rules) as search instructions (⊢ ):

Easy to understand and implementNot complete (eg: A ∨ B ⊬ A ∨ B)They then investigated fragments of intuitionistic logics for which it is complete,calling them “abstract logic programming languages”.The largest such fragment they identified, “hereditarily Harrop logic”, is insome sense maximal (via interpolation) [Har94].Not a complete specification: what to do with atomic goals?A natural goal-directed choice is backward-chaining – cf. Coq’s apply tactic

These ideas led to the development of λ-PROLOG.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 11: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

...2 Proof Search in Proof Theory

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 12: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Proof Theory and Proof Search

Proof search in proof theory is an active field, with surprisingly little interaction withlogic programming.

A common approach: invent clever (often complicated) sequent calculi withstructural properties that facilitate proof search (eg: contraction-free [Dyc92],permutation-free [DP96], focused [How98] [Sim12] ).

Unfortunately, all that cleverness tends to make them difficult to reason about

Being “far from” natural deduction, it can be non-trivial to show equivalence,cut-admissibility; to add proof terms, etc.

But this work need be done only once, so this approach is certainly workable(cf. Coq’s firstorder tactic)

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 13: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Proof Theory and Proof Search

Proof search in proof theory is an active field, with surprisingly little interaction withlogic programming.

A common approach: invent clever (often complicated) sequent calculi withstructural properties that facilitate proof search (eg: contraction-free [Dyc92],permutation-free [DP96], focused [How98] [Sim12] ).

Unfortunately, all that cleverness tends to make them difficult to reason about

Being “far from” natural deduction, it can be non-trivial to show equivalence,cut-admissibility; to add proof terms, etc.

But this work need be done only once, so this approach is certainly workable(cf. Coq’s firstorder tactic)

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 14: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Search Strategies in Sequent Calculi

A different approach: stick with a simple sequent calculus “close to” naturaldeduction and add a layer of search strategy on top.

This approach can describe Miller’s uniform proof(goal-directed strategy),Simmons’ structural focalization (via erasure), potentially others.

We investigate this approach in a categorical setting.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 15: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Why Categorical Proof Theory?

Advantages of categorical proof theory:

Categorical logic / type theory a very active field, with many powerful toolsfrom category theory proper

Allows us to choose how much syntax we care about (eg: “projections insteadof variables” (open-α-equivalence) [AM89], normal proof-term equivalence(βη-equivalence) [Law69] [See83], proof-term rewriting [Gha95] [Gar09] )

Structural properties can be built-in (eg: interpreting contexts as cartesianproducts realize weakening as projection and contraction as internal diagonal)

Mostly does away with distinction between natural deduction and sequentcalculus (N.D. derivations and S.C. proofs are just arrows)

Uniform treatment of semantics: build a generic model in the classifyingcategory of a logic, then models are simply functors [LS86]

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 16: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

...3 Adjunctions in Categorical Proof Theory

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 17: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Adjointness in Foundations

Each connective of first-order intuitionistic logic is determined by an adjunction(thanks Bill Lawvere! [Law69])

It turns out that this fact alone is enough to ensure many good properties of thelogic:

harmony (local soundness and completeness)

permutation conversions of ⊥ , ∨ , ∃normalizability of natural deduction derivations (thanks Dag Prawitz! [Pra65])

sequent cut elimination

etc. (?)

Most inference rules and properties of first-order intuitionistic natural deduction andsequent calculus arise uniformly from the adjoint formulations of the connectives.So we can generate proof theory from category theory.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 18: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Adjointness in Foundations

Each connective of first-order intuitionistic logic is determined by an adjunction(thanks Bill Lawvere! [Law69])

It turns out that this fact alone is enough to ensure many good properties of thelogic:

harmony (local soundness and completeness)

permutation conversions of ⊥ , ∨ , ∃normalizability of natural deduction derivations (thanks Dag Prawitz! [Pra65])

sequent cut elimination

etc. (?)

Most inference rules and properties of first-order intuitionistic natural deduction andsequent calculus arise uniformly from the adjoint formulations of the connectives.So we can generate proof theory from category theory.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 19: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Example Right Connective

Conjunction isan introduction and two elimination inference rules:

A BA ∧ B ∧+ A ∧ B

A ∧− A ∧ BB ∧−

which are harmonious:

𝒟 𝒟

∧ ∧∧

⟹∧

𝒟

ℰ∧ ⟹∧

ℰ∧ ∧

ℰ∧ ∧

∧ ∧

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 20: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Example Right Connective

Conjunction isa cartesian product, i.e. the right adjoint to a diagonal functor (∆ ⊣ ∧):

Γ ∧ Γ𝒟 ∧𝒟

%%KKKKK

KKKKKK

KKKKK

Prop ∶ Γ ⟨𝒟 ,𝒟 ⟩//

∆( )

OO

A ∧ B

Prop × Prop ∶ ∆Γ (𝒟 ,𝒟 ) //

∆⟨𝒟 ,𝒟 ⟩%%KK

KKKK

KKKK

KKKK

KK(A , B)

∆(A ∧ B)

( , )( , )

OO

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 21: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Introduction Rule

In the syntax of derivations, this tells us that there is a natural bijection:

∆Γ𝒟

(A , B)♭

⟼Γ

∆Γ𝒟

(A , B)∧(A , B)

The natural isomophism −♭ is interchangable for ∧+By being a natural isomorphism, it is automatically invertible

The rule determines an arrow from the major premise to the conclusion ofthe rule in one category (Prop) from an arrow (derivation) determined by theminor premise in another category (Prop × Prop).

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 22: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Introduction Rule

In the syntax of derivations, this tells us that there is a natural bijection:

Γ𝒟A

Γ𝒟B

♭⟼

Γ

Γ𝒟A

Γ𝒟B

A ∧ B ∧+∗

The natural isomophism −♭ is interchangable for ∧+By being a natural isomorphism, it is automatically invertible

The rule determines an arrow from the major premise to the conclusion ofthe rule in one category (Prop) from an arrow (derivation) determined by theminor premise in another category (Prop × Prop).

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 23: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Introduction Rule

In the syntax of derivations, this tells us that there is a natural bijection:

Γ𝒟A

Γ𝒟B

♭⟼

Γ

Γ𝒟A

Γ𝒟B

A ∧ B ∧+∗

The natural isomophism −♭ is interchangable for ∧+By being a natural isomorphism, it is automatically invertible

The rule determines an arrow from the major premise to the conclusion ofthe rule in one category (Prop) from an arrow (derivation) determined by theminor premise in another category (Prop × Prop).

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 24: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Elimination Rule

The counit of the adjunction ε is the ordered pair of projections inProp × Prop:

A B ⟼A ∧ BA 𝑓𝑠𝑡 A ∧ B

B 𝑠𝑛𝑑

This is exactly the ordered pair of elimination rules for ∧.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 25: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Elimination Rule

The counit of the adjunction ε is the ordered pair of projections inProp × Prop:

A B ⟼A ∧ BA ∧− A ∧ B

B ∧−

This is exactly the ordered pair of elimination rules for ∧.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 26: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Local Soundness

We can now see how the local reduction (in Prop × Prop !):

𝒟 𝒟

∧ ∧ ∗

𝒟 𝒟

∧ ∧ ∗

∧⟹∧

𝒟 𝒟

is natural deduction notation for:

∆((𝒟 , 𝒟 )♭) ⋅ ε(A , B) = (𝒟 , 𝒟 )

This is the universal property of the counit.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 27: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Local Soundness

We can now see how the local reduction (in Prop × Prop !):

𝒟 𝒟

∧ ∧ ∗

𝒟 𝒟

∧ ∧ ∗

∧⟹∧

𝒟 𝒟

is natural deduction notation for:

∆((𝒟 , 𝒟 )♭) ⋅ ε(A , B) = (𝒟 , 𝒟 )

This is the universal property of the counit.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 28: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Local Completeness

Similarly, the local expansion:

ℰ∧ ⟹∧

ℰ∧ ∧

ℰ∧ ∧

∧ ∧ ∗

is natural deduction notation for:

ℰ = (ℰ♯)♭ ( )♭

= (∆ℰ ⋅ ε(Α , Β))♭

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 29: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Natural Deduction for Right Connectives

Pleasingly, the same relationship holds for all the connectives defined by rightadjoint functors (⊤ , ∧ , ⊃ , ∀1). We call them right connectives.

introduction rule corresponds to taking the adjoint complement −♭

elimination rule corresponds to composing the component of the counit εlocal reduction corresponds to taking the shortcut βlocal expansion corresponds to conjugating −♯ with β

1almostEd Morehouse Adjunction Based Categorical Logic Programming

Page 30: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Natural Deduction for Left Connectives

The situation for connectives defined by left adjoint functors (⊥ , ∨ , ∃), leftconnectives, is nearly dual but there is a complication:

Intuitionistic derivations are asymmetrical : they must have a single conclusion butmay have multiple premisses.

Because the natural bijections of left connectives are determined by “arrows out of”rather than “arrows into” them, it is necessary to ensure that their elimination rulesare compatible with contexts.

This requires satisfying the distributive law and Frobenius reciprocity :

Γ , A ∨ B ≡ (Γ ∧ A) ∨ (Γ ∧ B) Γ , ∃𝑥 . A ≡ ∃𝑥 . Γ ∧ A

Categorically, we get this for free in BCCC (categry of (small) bicartesian closedcategories and functors) – Thanks Nobuo Yoneda!

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 31: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Natural Deduction for Left Connectives

The situation for connectives defined by left adjoint functors (⊥ , ∨ , ∃), leftconnectives, is nearly dual but there is a complication:

Intuitionistic derivations are asymmetrical : they must have a single conclusion butmay have multiple premisses.

Because the natural bijections of left connectives are determined by “arrows out of”rather than “arrows into” them, it is necessary to ensure that their elimination rulesare compatible with contexts.

This requires satisfying the distributive law and Frobenius reciprocity :

Γ , A ∨ B ≡ (Γ ∧ A) ∨ (Γ ∧ B) Γ , ∃𝑥 . A ≡ ∃𝑥 . Γ ∧ A

Categorically, we get this for free in BCCC (categry of (small) bicartesian closedcategories and functors) – Thanks Nobuo Yoneda!

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 32: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Natural Deduction for Left Connectives

The situation for connectives defined by left adjoint functors (⊥ , ∨ , ∃), leftconnectives, is nearly dual but there is a complication:

Intuitionistic derivations are asymmetrical : they must have a single conclusion butmay have multiple premisses.

Because the natural bijections of left connectives are determined by “arrows out of”rather than “arrows into” them, it is necessary to ensure that their elimination rulesare compatible with contexts.

This requires satisfying the distributive law and Frobenius reciprocity :

Γ , A ∨ B ≡ (Γ ∧ A) ∨ (Γ ∧ B) Γ , ∃𝑥 . A ≡ ∃𝑥 . Γ ∧ A

Categorically, we get this for free in BCCC (categry of (small) bicartesian closedcategories and functors) – Thanks Nobuo Yoneda!

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 33: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Natural Deduction for Left Connectives

The situation for connectives defined by left adjoint functors (⊥ , ∨ , ∃), leftconnectives, is nearly dual but there is a complication:

Intuitionistic derivations are asymmetrical : they must have a single conclusion butmay have multiple premisses.

Because the natural bijections of left connectives are determined by “arrows out of”rather than “arrows into” them, it is necessary to ensure that their elimination rulesare compatible with contexts.

This requires satisfying the distributive law and Frobenius reciprocity :

Γ , A ∨ B ≡ (Γ ∧ A) ∨ (Γ ∧ B) Γ , ∃𝑥 . A ≡ ∃𝑥 . Γ ∧ A

Categorically, we get this for free in BCCC (categry of (small) bicartesian closedcategories and functors) – Thanks Nobuo Yoneda!

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 34: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Example Left Connective

Existential quantification isa pair of inference rules:

𝑡 ∶ X A[𝑥↦𝑡]∃𝑥 ∶ X . A ∃+ ∃𝑥 ∶ X . A

[𝑒 ∶ X] [A[𝑥↦𝑒]]𝒟B

B ∃−

𝑒 may not occur outside of 𝒟 or in any open premise

which satisfy:local soundnesslocal completenesspermutation conversion

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 35: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Example Left Connective

Existential quantification isin a hyperdoctrine, the left adjoint to a typing-context weakening (∃�� ⊣ ��∗):

��∗(∃𝑥 ∶ X . A)

∗( 𝒟)

''OOOOO

OOOOOO

OOOOOO

OO

⇓Prop(Φ , 𝑥 ∶ X) ∶ A 𝒟

//

( )

OO

��∗B

Prop(Φ) ∶ ∃𝑥 ∶ X . A 𝒟 //

∃ ∶ .𝒟''OO

OOOOOO

OOOOOO

OOOOO

B

∃𝑥 ∶ X . ��∗B

( )

OO

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 36: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Elimination Rule

In the syntax of derivations, this tells us that there is a natural bijection:

A𝒟

��∗(B)♯

⟼∃��(A)

A𝒟

��∗(B)B

But this is not interchangeable for ∃−. The problem is that there is in general anambient logical context, Γ, that may be used in both branches. Given:

ℰ ∶ Prop(Φ) (Γ → ∃𝑥 ∶ X . A) 𝒟 ∶ Prop(Φ , 𝑥 ∶ X) (��∗Γ ∧ A → ��∗(B))we get the rule we want if we can fill the gap 𝑓:

Γ ⟨ ,ℰ⟩ // Γ ∧ ∃𝑥 ∶ X . A //______ ∃𝑥 ∶ X . (��∗Γ ∧ A) 𝒟♯// B

This is just Frobenius reciprocity (context distributivity for ∃).Ed Morehouse Adjunction Based Categorical Logic Programming

Page 37: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Elimination Rule

In the syntax of derivations, this tells us that there is a natural bijection:

A𝒟B

♯⟼

∃𝑥 ∶ X . A

A𝒟B

B ∃−∗

But this is not interchangeable for ∃−. The problem is that there is in general anambient logical context, Γ, that may be used in both branches. Given:

ℰ ∶ Prop(Φ) (Γ → ∃𝑥 ∶ X . A) 𝒟 ∶ Prop(Φ , 𝑥 ∶ X) (��∗Γ ∧ A → ��∗(B))we get the rule we want if we can fill the gap 𝑓:

Γ ⟨ ,ℰ⟩ // Γ ∧ ∃𝑥 ∶ X . A //______ ∃𝑥 ∶ X . (��∗Γ ∧ A) 𝒟♯// B

This is just Frobenius reciprocity (context distributivity for ∃).Ed Morehouse Adjunction Based Categorical Logic Programming

Page 38: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Elimination Rule

In the syntax of derivations, this tells us that there is a natural bijection:

A𝒟B

♯⟼

∃𝑥 ∶ X . A

A𝒟B

B ∃−∗

But this is not interchangeable for ∃−. The problem is that there is in general anambient logical context, Γ, that may be used in both branches. Given:

ℰ ∶ Prop(Φ) (Γ → ∃𝑥 ∶ X . A) 𝒟 ∶ Prop(Φ , 𝑥 ∶ X) (��∗Γ ∧ A → ��∗(B))we get the rule we want if we can fill the gap 𝑓:

Γ ⟨ ,ℰ⟩ // Γ ∧ ∃𝑥 ∶ X . A //______ ∃𝑥 ∶ X . (��∗Γ ∧ A) 𝒟♯// B

This is just Frobenius reciprocity (context distributivity for ∃).Ed Morehouse Adjunction Based Categorical Logic Programming

Page 39: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Elimination Rule

In the syntax of derivations, this tells us that there is a natural bijection:

A𝒟B

♯⟼

∃𝑥 ∶ X . A

A𝒟B

B ∃−∗

But this is not interchangeable for ∃−. The problem is that there is in general anambient logical context, Γ, that may be used in both branches. Given:

ℰ ∶ Prop(Φ) (Γ → ∃𝑥 ∶ X . A) 𝒟 ∶ Prop(Φ , 𝑥 ∶ X) (��∗Γ ∧ A → ��∗(B))we get the rule we want if we can fill the gap 𝑓:

Γ ⟨ ,ℰ⟩ // Γ ∧ ∃𝑥 ∶ X . A //______ ∃𝑥 ∶ X . (��∗Γ ∧ A) 𝒟♯// B

This is just Frobenius reciprocity (context distributivity for ∃).Ed Morehouse Adjunction Based Categorical Logic Programming

Page 40: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Elimination Rule

In the syntax of derivations, this tells us that there is a natural bijection:

A𝒟B

♯⟼

∃𝑥 ∶ X . A

A𝒟B

B ∃−∗

But this is not interchangeable for ∃−. The problem is that there is in general anambient logical context, Γ, that may be used in both branches. Given:

ℰ ∶ Prop(Φ) (Γ → ∃𝑥 ∶ X . A) 𝒟 ∶ Prop(Φ , 𝑥 ∶ X) (��∗Γ ∧ A → ��∗(B))we get the rule we want if we can fill the gap 𝑓:

Γ ⟨ ,ℰ⟩ // Γ ∧ ∃𝑥 ∶ X . A //______ ∃𝑥 ∶ X . (��∗Γ ∧ A) 𝒟♯// B

This is just Frobenius reciprocity (context distributivity for ∃).Ed Morehouse Adjunction Based Categorical Logic Programming

Page 41: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Introduction Rule

The unit of the adjunction η:

A ⟼A

��∗(∃𝑥 ∶ X . A) ∃+∗

Also not interchangeable for ∃+: lives in the wrong category (Prop(Φ , 𝑥 ∶ X)).But it can be reindexed along any term-in-context Φ ⊢ 𝑡 ∶ X

∃ ∶ . ∗(∃ ∶ . ) ∃ ∶ .

( )

OO

[ ↦ ]

∗( ( ))

OO

, ∶oo oojj

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 42: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Introduction Rule

The unit of the adjunction η:

A ⟼A

��∗(∃𝑥 ∶ X . A) ∃+∗

Also not interchangeable for ∃+: lives in the wrong category (Prop(Φ , 𝑥 ∶ X)).But it can be reindexed along any term-in-context Φ ⊢ 𝑡 ∶ X

∃ ∶ . ∗(∃ ∶ . ) ∃ ∶ .

( )

OO

[ ↦ ]

∗( ( ))

OO

, ∶oo oojj

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 43: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Permutation Conversion

Local reductions and expansions are pretty straightforward.

We point out the permutation conversion required for the proof ofnormalizability:

∃ ∶ .

[ ]𝒟 ∗ ∃

ℰ⟹∃

∃ ∶ .

[ ]𝒟 ∗ ∗ℰ ∗

Categorically, this is the forward direction of:

𝒟♯ ⋅ ℰ = (𝒟 ⋅ ��∗(ℰ))♯

which is a direct consequence of the nautrality of the bijection of theadjunction.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 44: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Deriving the Permutation Conversion

Local reductions and expansions are pretty straightforward.

We point out the permutation conversion required for the proof ofnormalizability:

∃ ∶ .

[ ]𝒟 ∗ ∃

ℰ⟹∃

∃ ∶ .

[ ]𝒟 ∗ ∗ℰ ∗

Categorically, this is the forward direction of:

𝒟♯ ⋅ ℰ = (𝒟 ⋅ ��∗(ℰ))♯

which is a direct consequence of the nautrality of the bijection of theadjunction.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 45: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Categorical Sequent Calculus

These ideas extend directly to sequent calculi “close to” natural deduction.

We have used this to give categorical operational interpretation to Miller’sconnectives as search instructions.

Points to note:

Right rules of right connectives and left rules of left connectives (“eigenrules”)take adjoint complements, (modulo left context distribution) so are invertible

Most “anderrules” compose a (co)unit, those for the quantifiers allow us todelay the choice of instantiating term (cf: Coq’s “e”-tactics)

Left rule for ⊃ a bit different (incorporates a built-in cut), restricting this leads tovarious (partial) proof search strategies (eg: backward and forward chaining)

Free hyperdoctrine (indexed bicartesian closed category) provides acategorical generic model for proof search

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 46: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Categorical Sequent Calculus

These ideas extend directly to sequent calculi “close to” natural deduction.

We have used this to give categorical operational interpretation to Miller’sconnectives as search instructions.

Points to note:

Right rules of right connectives and left rules of left connectives (“eigenrules”)take adjoint complements, (modulo left context distribution) so are invertible

Most “anderrules” compose a (co)unit, those for the quantifiers allow us todelay the choice of instantiating term (cf: Coq’s “e”-tactics)

Left rule for ⊃ a bit different (incorporates a built-in cut), restricting this leads tovarious (partial) proof search strategies (eg: backward and forward chaining)

Free hyperdoctrine (indexed bicartesian closed category) provides acategorical generic model for proof search

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 47: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

...4 Connective Chirality and Search Strategy

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 48: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Constructivity of Intuitionistic Logic

Can be understood to mean:

Disjuntion Property

⊢ A ∨ B ⟺ ⊢ A or ⊢ B

Existence Property

⊢ ∃𝑥 ∶ X . A ⟺ ⊢ A [𝑥↦𝑡] for some 𝑡 ∶ X

By analogy, we add:

Falsity Property⊢ ⊥ ⟺ never

which simply expresses consistency.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 49: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Constructivity of Intuitionistic Logic

Can be understood to mean:

Disjuntion Property

⊢ A ∨ B ⟺ ⊢ A or ⊢ B

Existence Property

⊢ ∃𝑥 ∶ X . A ⟺ ⊢ A [𝑥↦𝑡] for some 𝑡 ∶ X

By analogy, we add:

Falsity Property⊢ ⊥ ⟺ never

which simply expresses consistency.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 50: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Constructivity of Intuitionistic Logic

In the ’60’s, Kleene and Harrop noticed:

Strong Disjuntion Property: If Γ contains no strictly positive disjunctionthen:

Γ ⊢ A ∨ B ⟺ Γ ⊢ A or Γ ⊢ B

Strong Existence Property: If Γ contains no strictly positive disjunction orexistential then:

Γ ⊢ ∃𝑥 ∶ X . A ⟺ Γ ⊢ A [𝑥↦𝑡] for some 𝑡 ∶ X

Continuing the analogy:

Strong Falsity Property: If Γ contains no strictly positive ⊥ (negation) then:

Γ ⊢ ⊥ ⟺ never

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 51: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Constructivity of Intuitionistic Logic

In the ’60’s, Kleene and Harrop noticed:

Strong Disjuntion Property: If Γ contains no strictly positive disjunctionthen:

Γ ⊢ A ∨ B ⟺ Γ ⊢ A or Γ ⊢ B

Strong Existence Property: If Γ contains no strictly positive disjunction orexistential then:

Γ ⊢ ∃𝑥 ∶ X . A ⟺ Γ ⊢ A [𝑥↦𝑡] for some 𝑡 ∶ X

Continuing the analogy:

Strong Falsity Property: If Γ contains no strictly positive ⊥ (negation) then:

Γ ⊢ ⊥ ⟺ never

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 52: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Constructive Sequents

This gives a sufficient condition for the invertibility of right rules of leftconnectives.

Recall that right rules of right connectives are always invertible by the naturalbijections of their adjunctions.

By restricting left connectives to occur only positively on the right and onlynegatively on the left of a sequent we have a system where all right rules areinvertible. We call these “constructive sequents”.

This validates the completeness of goal directed search for constructivesequents.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 53: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Constructive Sequents

This gives a sufficient condition for the invertibility of right rules of leftconnectives.

Recall that right rules of right connectives are always invertible by the naturalbijections of their adjunctions.

By restricting left connectives to occur only positively on the right and onlynegatively on the left of a sequent we have a system where all right rules areinvertible. We call these “constructive sequents”.

This validates the completeness of goal directed search for constructivesequents.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 54: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Hereditarily Harrop Logic

Recursive grammar for constructive sequents

Let 𝒟 and 𝒢 be the sets of constructive antecedents (“program formulae”) andconstructive succedents (“goal formulae”).

They may be defined by the recursive grammars:

D ⩴ P | ⊤ | D ∧ D | ∀𝑥 ∶ X . D | G ⊃ DG ⩴ P | ⊤ | ⊥ | G ∧ G | G ∨ G | ∀𝑥 ∶ X . G | ∃𝑥 ∶ X . G | D ⊃ G

where P is the class of atomic propositions.

This is essentially the same as hereditarily Harrop program and goal formula, whichdon’t contain ⊤ and ⊥, respectively (the enrichment is of little practical use).

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 55: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Hereditarily Harrop Logic

Recursive grammar for constructive sequents

Let 𝒟 and 𝒢 be the sets of constructive antecedents (“program formulae”) andconstructive succedents (“goal formulae”).

They may be defined by the recursive grammars:

D ⩴ P | ⊤ | D ∧ D | ∀𝑥 ∶ X . D | G ⊃ DG ⩴ P | ⊤ | ⊥ | G ∧ G | G ∨ G | ∀𝑥 ∶ X . G | ∃𝑥 ∶ X . G | D ⊃ G

where P is the class of atomic propositions.

This is essentially the same as hereditarily Harrop program and goal formula, whichdon’t contain ⊤ and ⊥, respectively (the enrichment is of little practical use).

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 56: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Goal Directed Search for Atoms

Recall only right propositions may occur positively in constructive contexts(antecedents)

Positive occurrences of right connectives can be rewritten by the naturalbijection of their adjunction

In particular, constructive contexts can be rewritten with the propositions instrictly positive position all atoms

This allows a strategy of goal directed search for atoms

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 57: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

Backward Chaining

𝑥 ∶ X𝑥 ∶ X

Γ ⟹ G(P σ = Pσ)Γ , P ⟹ P

𝑖𝑛𝑖𝑡

Γ , G ⊃ P ⟹ P⊃L

⋮ ∀L

Γ , ∀�� ∶ X . G ⊃ P ⟹ P∀L

Γ ⟹ P 𝑐L⋮ ∗R

Categorically, this corresponds to pre-composing an arrow named by a programclause with a derivation of an instance of the goal.

Ed Morehouse Adjunction Based Categorical Logic Programming

Page 58: Adjunction Based Categorical Logic Programming - Ed Morehouse

A Brief History of Logic Programming Proof Search in Proof Theory Adjunctions in Categorical Proof Theory Connective Chirality and Search Strategy References

References..

Andrea Asperti and Simone Martini. “Projections Instead of Variables: acategory theoretic interpretation of logic programs”. In: InternationalConference for Logic Programming. MIT Press, 1989.Roy Dyckhoff. “Contraction-Free Sequent Calculi for Intuitionistic Logic”.In: Journal of Symbolic Logic 57.3 (1992), pp. 795–807.Roy Dyckhoff and Luís Pinto. “Uniform Proofs and Natural Deductions”.In: International Conference on Automated Deduction. 1994.Roy Dyckhoff and Luís Pinto. A Permutation-Free Sequent Calculus forIntuitionistic Logic. Tech. rep. St. Andrews University, 1996.Richard Garner. “Two-Dimensional Models of Type Theory”. In:Mathematical Structures in Computer Science 19.4 (2009), 687–736.url: http://arxiv.org/abs/0808.2122v2.Neil Ghani. “Adjoint Rewriting”. PhD thesis. University of Edinburgh,1995.James Harland. “A Proof-theoretic Analysis of Goal-directed Provability”.In: Journal of Logic and Computation 4.1 (1994), pp. 69–88.Jacob Howe. “Proof Search Issues in Some Non-Classical Logics”.PhD thesis. University of St. Andrews, 1998.Joachim Lambek and Philip Scott. Introduction to Higher OrderCategorical Logic. Cambridge University Press, 1986.F. William Lawvere. “Adjointness in Foundations”. In: Dialectica 23(1969).Dale Miller. “A Logical Analysis of Modules in Logic Programming”. In:Journal of Logic Programming 6 (1989), pp. 79–108.Dale Miller et al. “Uniform Proofs as a Foundation for LogicProgramming”. In: Annals of Pure and Applied Logic 51 (1991).Dag Prawitz. Natural Deduction: A Proof-Theoretical Study . StockholmStudies in Philosophy 3. Almqvist and Wiksell, 1965.Robert Seely. “Hyperdoctrines, Natural Deduction and the BeckCondition”. In: Zeitscrift für Mathematische Logik und Grundlagen derMathematik (1983).Robert J. Simmons. “Structural Focalization”. In: (2012).

Ed Morehouse Adjunction Based Categorical Logic Programming