MetaPRL Tutorial: the constructive theory

Introduction

We have now defined the parts of a constructive logic. We have:

We have defined display forms for each of these operators, and included tactics for automating their application.

At this point, we can put together a complete constructive first order logic. The process is pretty simple: we simple define a new module that extends each of the individual theories.

The Fol_ctheory interface

In the interface, we just include each of the module for the operators.

1. Create the constructive interface in the file Fol_ctheory:

extends Fol_type
extends Fol_true
extends Fol_false
extends Fol_implies
extends Fol_and
extends Fol_or
extends Fol_not
extends Fol_univ
extends Fol_all
extends Fol_exists

The Fol_ctheory implementation

The implementation includes the same theories as the interface. In addition, we establish display precedence relations that cross the module boundaries.

2. Create the implementation with the extends statements of the interface, and the following relations between the precedences in the file fol_ctheory.ml:

open Fol_implies
open Fol_and
open Fol_or
open Fol_not
open Fol_all
open Fol_exists

prec prec_implies < prec_and
prec prec_implies < prec_or
prec prec_or < prec_and
prec prec_and < prec_not
prec prec_all < prec_implies
prec prec_exists < prec_implies

At this point, we have a complete theory. Before going on to the classical theory, let's prove a simple theorem.

3. Create a theorem object:

interactive or_choice 'H :
   sequent ['ext] { 'H >- "type"{'A} } -->
   sequent ['ext] { 'H >- "type"{'B} } -->
   sequent ['ext] { 'H >- "type"{'C} } -->
   sequent ['ext] { 'H >- (('A or 'B) => 'C) => 'A => 'C }

To prove this, compile the FOL directory, and compile the editor with the new module. We can perform the initial steps of the proof using the autoT tactic, which produces the following goal.

Screen shot

The first subgoal is not proved because it requires thinning of the hypothesis ('A or 'B) => 'c. This can be performed in a single step (open the Fol_struct module first).

Screen shot

The second subgoal requires an argument. First, we decompose the hypothesis, to get the two cases.

Screen shot

The second subgoal can be proved with the trivialT tactic, which uses the nthHypT structural rule to prove the goal. For the first goal, we split the conclusion to get the the following goals.

Screen shot

These two subgoals have trivial proof using autoT.