3

Is it possible to construct different systems of logic in Coq or Agda?

I ask because I'm interested in using a proof assistant to construct (and verify) theorems in things like many-valued logics, relevant logics, and conditional logics in Graham Priest's 2nd edition of An Introduction to Non-Classical Logic (I keep going back to over the years in my free time).

It seems like intuitionistic logic is definitely possible in Coq given it was developed alongside the calculus of constructions, but I'm curious if Coq (or Agda) could be used for other logics.

A part of my gut says, "It wouldn't be possible to do logics that use fewer rules of inference or swap out intuitionistic rules for incompatible rules (eg, removing the principle of explosion)." However, another part of my gut says, "Machines using binary gates can still represent & simulate quantum processes, so it may be possible for Coq to represent logics incompatible with it's own implementation."

Any references to good papers/books/lectures/etc. are happily welcome.

jbapple
  • 3,390
  • 18
  • 21

1 Answers1

6

You can define many non-classical logics in Coq (and I assume Agda too), even if they are incompatible with the logic of your proof assistant, but you need to define the concept of inference yourself. That is, you can't rely on Coq formulas, you need to define your own language. And you can't rely on Coq logic, you need to define what counts as a proof. You still use Coq as a meta-language though.

Here is a silly example in Coq with a very restricted language.

(* well-formed formulas *)
Inductive formula : Set :=
  | T : formula
  | AND : formula -> formula -> formula.

(* axioms and rules of inference *) Inductive provable : formula -> Prop := | TisProvable : provable T | ANDI : forall f1 f2, provable f1 -> provable f2 -> provable (AND f1 f2) | ANDEl : forall f1 f2, provable (AND f1 f2) -> provable f1 | ANDEr : forall f1 f2, provable (AND f1 f2) -> provable f2.

You can now show, using the meta-theory of Coq, that provable f for some specific formulas f, or in other words, you can prove theorems of this logic I just made up.

Lemma ANDTTT : provable (AND (AND T T) T).
Proof.
  apply ANDI.
  - apply ANDI; exact TisProvable.
  - exact TisProvable.
Qed.

You can even make Coq automatically prove such simple lemmas:

#[export] Hint Resolve TisProvable ANDI ANDEl ANDEr : provableHints.

Lemma ANDTTT_auto : provable (AND (AND T T) T). Proof. eauto with provableHints. Qed.


Some examples of non-classical logics implemented in Coq:

Ana Borges
  • 176
  • 4