See [OPR18] for further details.
meta-level-ext.maude
: some extra functionalities for the meta-level.
theorem-proving.maude
: algorithms for proving sequent system properties.
test_g3ip.maude
: tests for intuitionistic propositional logic.
test_mlj.maude
: tests for multiconclusion intuitionistic propositional logic.
test_g3cp.maude
: tests for propositional classical logic.
test_llM.maude
: tests for the monadic system of propositional linear logic.
test_llD.maude
: tests for the dyadic system of propositional linear logic.
test_modalK.maude
: tests for the modal logics K and S4.
[ OPR18 ] | C. Olarte, E. Pimentel and C. Rocha: Proving Structural Properties of Sequent Systems in Rewriting Logic. Submitted to WRLA'18 (PDF). |
maude test_g3ip.maude
In this file, we first establish the syntax of propositional logic.
fmod SYNTAX is
pr NAT .
sort Prop . --- Atomic propositions
sort Formula . --- Formulas
subsort Prop < Formula .
--- Atomic Propositions
ops p : Nat -> Prop [ctor] .
--- Conjunction
op _/\_ : Formula Formula -> Formula [ctor assoc prec 30] .
--- Disjunction
op _\/_ : Formula Formula -> Formula [ctor assoc prec 30] .
--- False
op False : -> Formula [ctor] .
--- True
op True : -> Formula [ctor] .
--- Implication
op _-->_ : Formula Formula -> Formula [ctor prec 35] .
--- Set of Formulas
sort SFormula .
subsort Formula < SFormula .
op * : -> SFormula . *** empty set of formulas
op _;_ : SFormula SFormula -> SFormula [prec 40 ctor assoc comm id: * ] .
endfm
fmod SEQUENT is
pr SYNTAX .
inc OBJ-LOGIC .
--- Constructor for sequents .
op _|-_ : SFormula Formula -> Sequent [ctor prec 50 format(b o r o )] .
endfm
mod G3i is
pr SEQUENT .
pr META-LEVEL .
var P : Prop .
vars F G H : Formula .
vars C C' : SFormula .
--- A new "fresh" constant
op ANY : -> SFormula .
rl [I] : P ; C |- P => proved .
rl [AndL] : F /\ G ; C |- H => F ; G ; C |- H .
rl [AndR] : C |- F /\ G => (C |- F) , (C |- G) .
rl [botL] : C ; False |- H => proved .
rl [topR] : C |- True => proved .
rl [topL] : C ; True |- G => C |- G .
rl [OrL] : C ; F \/ G |- H => (C ; F |- H) , (C ; G |- H) .
rl [OrR1] : C |- F \/ G => C |- F .
rl [OrR2] : C |- F \/ G => C |- G .
rl [ImpR] : C |- F --> G => C ; F |- G .
rl [ImpL] : C ; F --> G |- H => (C ; F --> G |- F) , (C ; G |- H) .
endm
TH-INPUT
(see file theorem-proving.maude
). Such instance contains the rules we want to prove admissible and also it may contain a list of theorems that were already proved (and can be used during proofs). In the first test, we specify:
mod G3i-TEST is
inc G3i .
pr META-LEVEL .
ops modName seqType : -> Qid .
eq modName = 'G3i .
op knownTheorems : -> RuleSet .
eq knownTheorems = none .
op knownInvRules : -> QidList .
eq knownInvRules = nil .
--- Weakening
op Th-Weakening : -> Rule .
eq Th-Weakening = ( rl '_|-_['C:SFormula,'F:Formula] => '_|-_['_;_['C:SFormula,'ANY.SFormula],'F:Formula] [ label('Th-Weakening) ]. ) .
--- Contraction
op Th-Contraction : -> Rule .
eq Th-Contraction = ( rl '_|-_['_;_['C:SFormula,'C:SFormula],'F:Formula] => '_|-_['C:SFormula,'F:Formula] [ label('Th-Contraction) ]. ) .
--- Inv of implication on the right premiss (if Gamma, A->B |-C then Gamma, B |-C )
op Th-Imp : -> Rule .
eq Th-Imp = ( rl '_|-_['_;_['C:SFormula,'_-->_['F:Formula,'G:Formula]],'H:Formula] => '_|-_['_;_['C:SFormula,'G:Formula],'H:Formula] [ label('Th-Implication) ]. ) .
endm
select THEOREM-PROVING-G3i .
red invertibility .
result Result: {'AndL ; true}
{'AndR ; true}
{'I ; true}
{'ImpL ; false}
{'ImpR ; false}
{'OrL ; true}
{'OrR1 ; false}
{'OrR2 ; false}
{'botL ; true}
{'topL ; true}
{'topR ; true}
We note that the prover is not able to show that implication right (ImpR
) is invertible. For that, we first need to prove that weakening is admissible:
red admissible?(Th-Weakening) .
result Bool: true
The result for the other two theorems is the following:
red admissible?(Th-Imp) . --- invertibility of the right premiss of the implication left rule
result Bool: true
red admissible?(Th-Contraction) .
result Bool: false
We note that contraction is indeed admissible in G3ip. However, that proof requires the invertibility lemmas.
G3iW
adds to G3i
the rule for weakening:
rl [W] : C ; C' |- G => C |- G .
In this new system, we can prove the rule for implication right to be invertible:
select THEOREM-PROVING-G3iW .
red invertibility .
{'AndL ; true}
{'AndR ; true}
{'I ; true}
{'ImpL ; false}
{'ImpR ; true}
{'OrL ; true}
{'OrR1 ; false}
{'OrR2 ; false}
{'W ; false}
{'botL ; true}
{'topL ; true}
{'topR ; true}
Weakening, of course, is not invertible.
G3iInv-TEST
.
--- All the already proved invertibility theorems are assumed
mod G3iInv-TEST is
inc G3i .
pr META-LEVEL .
ops modName seqType : -> Qid .
eq modName = 'G3i .
op knownTheorems : -> RuleSet .
eq knownTheorems = Th-Imp .
op knownInvRules : -> QidList .
eq knownInvRules = 'OrL 'AndL 'AndR 'topL 'topR 'botL 'ImpR .
--- Theorem about implication (if Gamma, A->B |-C then Gamma, B |-C )
op Th-Imp : -> Rule .
eq Th-Imp = ( rl '_|-_['_;_['C:SFormula,'_-->_['F:Formula,'G:Formula]],'H:Formula] => '_|-_['_;_['C:SFormula,'G:Formula],'H:Formula] [ label('Th-Implication) ]. ) .
--- Contraction
op Th-Contraction : -> Rule .
eq Th-Contraction = ( rl '_|-_['_;_['C:SFormula,'C:SFormula],'F:Formula] => '_|-_['C:SFormula,'F:Formula] [ label('Th-Contraction) ]. ) .
endm
select THEOREM-PROVING-G3iInv .
red admissible?(Th-Contraction) .
result Bool: true
Moreover, we can analyze the permutation of rules:
red analyzePermutation .
{{'AndL ; 'AndL ; true}}
{{'AndL ; 'AndR ; true}}
{{'AndL ; 'I ; true}}
{{'AndL ; 'ImpL ; true}}
{{'AndL ; 'ImpR ; true}}
{{'AndL ; 'OrL ; true}}
{{'AndL ; 'OrR1 ; true}}
{{'AndL ; 'OrR2 ; true}}
{{'AndL ; 'botL ; true}}
{{'AndL ; 'topL ; true}}
{{'AndL ; 'topR ; true}}
{{'AndR ; 'AndL ; true}}
{{'AndR ; 'AndR ; true}}
{{'AndR ; 'I ; true}}
{{'AndR ; 'ImpL ; true}}
{{'AndR ; 'ImpR ; true}}
{{'AndR ; 'OrL ; true}}
{{'AndR ; 'OrR1 ; true}}
{{'AndR ; 'OrR2 ; true}}
{{'AndR ; 'botL ; true}}
{{'AndR ; 'topL ; true}}
{{'AndR ; 'topR ; true}}
{{'I ; 'AndL ; true}}
{{'I ; 'AndR ; true}}
{{'I ; 'I ; true}}
{{'I ; 'ImpL ; true}}
{{'I ; 'ImpR ; true}}
{{'I ; 'OrL ; true}}
{{'I ; 'OrR1 ; true}}
{{'I ; 'OrR2 ; true}}
{{'I ; 'botL ; true}}
{{'I ; 'topL ; true}}
{{'I ; 'topR ; true}}
{{'ImpL ; 'AndL ; true}}
{{'ImpL ; 'AndR ; true}}
{{'ImpL ; 'I ; true}}
{{'ImpL ; 'ImpL ; true}}
{{'ImpL ; 'ImpR ; false}}
{{'ImpL ; 'OrL ; true}}
{{'ImpL ; 'OrR1 ; true}}
{{'ImpL ; 'OrR2 ; true}}
{{'ImpL ; 'botL ; true}}
{{'ImpL ; 'topL ; true}}
{{'ImpL ; 'topR ; true}}
{{'ImpR ; 'AndL ; true}}
{{'ImpR ; 'AndR ; true}}
{{'ImpR ; 'I ; true}}
{{'ImpR ; 'ImpL ; false}}
{{'ImpR ; 'ImpR ; true}}
{{'ImpR ; 'OrL ; true}}
{{'ImpR ; 'OrR1 ; true}}
{{'ImpR ; 'OrR2 ; true}}
{{'ImpR ; 'botL ; true}}
{{'ImpR ; 'topL ; true}}
{{'ImpR ; 'topR ; true}}
{{'OrL ; 'AndL ; true}}
{{'OrL ; 'AndR ; true}}
{{'OrL ; 'I ; true}}
{{'OrL ; 'ImpL ; true}}
{{'OrL ; 'ImpR ; true}}
{{'OrL ; 'OrL ; true}}
{{'OrL ; 'OrR1 ; false}}
{{'OrL ; 'OrR2 ; false}}
{{'OrL ; 'botL ; true}}
{{'OrL ; 'topL ; true}}
{{'OrL ; 'topR ; true}}
{{'OrR1 ; 'AndL ; true}}
{{'OrR1 ; 'AndR ; true}}
{{'OrR1 ; 'I ; true}}
{{'OrR1 ; 'ImpL ; true}}
{{'OrR1 ; 'ImpR ; true}}
{{'OrR1 ; 'OrL ; true}}
{{'OrR1 ; 'OrR1 ; true}}
{{'OrR1 ; 'OrR2 ; true}}
{{'OrR1 ; 'botL ; true}}
{{'OrR1 ; 'topL ; true}}
{{'OrR1 ; 'topR ; true}}
{{'OrR2 ; 'AndL ; true}}
{{'OrR2 ; 'AndR ; true}}
{{'OrR2 ; 'I ; true}}
{{'OrR2 ; 'ImpL ; true}}
{{'OrR2 ; 'ImpR ; true}}
{{'OrR2 ; 'OrL ; true}}
{{'OrR2 ; 'OrR1 ; true}}
{{'OrR2 ; 'OrR2 ; true}}
{{'OrR2 ; 'botL ; true}}
{{'OrR2 ; 'topL ; true}}
{{'OrR2 ; 'topR ; true}}
{{'botL ; 'AndL ; true}}
{{'botL ; 'AndR ; true}}
{{'botL ; 'I ; true}}
{{'botL ; 'ImpL ; true}}
{{'botL ; 'ImpR ; true}}
{{'botL ; 'OrL ; true}}
{{'botL ; 'OrR1 ; true}}
{{'botL ; 'OrR2 ; true}}
{{'botL ; 'botL ; true}}
{{'botL ; 'topL ; true}}
{{'botL ; 'topR ; true}}
{{'topL ; 'AndL ; true}}
{{'topL ; 'AndR ; true}}
{{'topL ; 'I ; true}}
{{'topL ; 'ImpL ; true}}
{{'topL ; 'ImpR ; true}}
{{'topL ; 'OrL ; true}}
{{'topL ; 'OrR1 ; true}}
{{'topL ; 'OrR2 ; true}}
{{'topL ; 'botL ; true}}
{{'topL ; 'topL ; true}}
{{'topL ; 'topR ; true}}
{{'topR ; 'AndL ; true}}
{{'topR ; 'AndR ; true}}
{{'topR ; 'I ; true}}
{{'topR ; 'ImpL ; true}}
{{'topR ; 'ImpR ; true}}
{{'topR ; 'OrL ; true}}
{{'topR ; 'OrR1 ; true}}
{{'topR ; 'OrR2 ; true}}
{{'topR ; 'botL ; true}}
{{'topR ; 'topL ; true}}
{{'topR ; 'topR ; true}}
test_mlj.maude
.
mod mLJ is
pr SEQUENT .
pr META-LEVEL .
var P : Prop .
vars F G H : Formula .
var C C' : SFormula .
ops ANY : -> SFormula .
rl [I] : P ; C |- P ; C' => proved .
rl [AndL] : F /\ G ; C |- C' => F ; G ; C |- C' .
rl [AndR] : C |- F /\ G ; C' => (C |- F ; C') , (C |- G ; C') .
rl [botL] : C ; False |- C' => proved .
rl [topR] : C |- True ; C' => proved .
rl [topL] : C ; True |- C' => C |- C' .
rl [OrL] : C ; F \/ G |- C' => (C ; F |- C') , (C ; G |- C') .
rl [OrR] : C |- F \/ G ; C' => C |- F ; G ; C' .
rl [ImpR] : C |- (F --> G) ; C' => C ; F |- G .
rl [ImpL] : C ; F --> G |- C' => (C ; F --> G |- F ; C') , (C ; G |- C') .
endm
select THEOREM-PROVING-mLJ .
red invertibility .
result Result: {'AndL ; true}
{'AndR ; true}
{'I ; true}
{'ImpL ; true}
{'ImpR ; false}
{'OrL ; true}
{'OrR ; true}
{'botL ; true}
{'topL ; true}
{'topR ; true}
red admissible?(Th-Imp) .
result Bool: true
red admissible?(Th-WeakeningL) .
result Bool: true
red admissible?(Th-WeakeningR) .
result Bool: true
test_g3cp
.
select THEOREM-PROVING-G3c .
red invertibility .
result Result: {'AndL ; true}
{'AndR ; true}
{'I ; true}
{'ImpL ; true}
{'ImpR ; true}
{'OrL ; true}
{'OrR ; true}
{'botL ; true}
{'topL ; true}
{'topR ; true}
red admissible?(Th-Weakening) .
result Bool: true
Now that we have shown that all the rules are invertible, we can show the admissibility of Contraction:
select THEOREM-PROVING-G3cInv .
red admissible?(Th-Contraction) .
result Bool: true
Moreover, also assuming the already proved invertibility lemmas, we can show that all rules permute down:
select THEOREM-PROVING-G3cInv .
red analyzePermutation .
result Result: {{'AndL ; 'AndL ; true}}
{{'AndL ; 'AndR ; true}}
{{'AndL ; 'I ; true}}
{{'AndL ; 'ImpL ; true}}
{{'AndL ; 'ImpR ; true}}
{{'AndL ; 'OrL ; true}}
{{'AndL ; 'OrR ; true}}
{{'AndL ; 'botL ; true}}
{{'AndL ; 'topL ; true}}
{{'AndL ; 'topR ; true}}
{{'AndR ; 'AndL ; true}}
{{'AndR ; 'AndR ; true}}
{{'AndR ; 'I ; true}}
{{'AndR ; 'ImpL ; true}}
{{'AndR ; 'ImpR ; true}}
{{'AndR ; 'OrL ; true}}
{{'AndR ; 'OrR ; true}}
{{'AndR ; 'botL ; true}}
{{'AndR ; 'topL ; true}}
{{'AndR ; 'topR ; true}}
{{'I ; 'AndL ; true}}
{{'I ; 'AndR ; true}}
{{'I ; 'I ; true}}
{{'I ; 'ImpL ; true}}
{{'I ; 'ImpR ; true}}
{{'I ; 'OrL ; true}}
{{'I ; 'OrR ; true}}
{{'I ; 'botL ; true}}
{{'I ; 'topL ; true}}
{{'I ; 'topR ; true}}
{{'ImpL ; 'AndL ; true}}
{{'ImpL ; 'AndR ; true}}
{{'ImpL ; 'I ; true}}
{{'ImpL ; 'ImpL ; true}}
{{'ImpL ; 'ImpR ; true}}
{{'ImpL ; 'OrL ; true}}
{{'ImpL ; 'OrR ; true}}
{{'ImpL ; 'botL ; true}}
{{'ImpL ; 'topL ; true}}
{{'ImpL ; 'topR ; true}}
{{'ImpR ; 'AndL ; true}}
{{'ImpR ; 'AndR ; true}}
{{'ImpR ; 'I ; true}}
{{'ImpR ; 'ImpL ; true}}
{{'ImpR ; 'ImpR ; true}}
{{'ImpR ; 'OrL ; true}}
{{'ImpR ; 'OrR ; true}}
{{'ImpR ; 'botL ; true}}
{{'ImpR ; 'topL ; true}}
{{'ImpR ; 'topR ; true}}
{{'OrL ; 'AndL ; true}}
{{'OrL ; 'AndR ; true}}
{{'OrL ; 'I ; true}}
{{'OrL ; 'ImpL ; true}}
{{'OrL ; 'ImpR ; true}}
{{'OrL ; 'OrL ; true}}
{{'OrL ; 'OrR ; true}}
{{'OrL ; 'botL ; true}}
{{'OrL ; 'topL ; true}}
{{'OrL ; 'topR ; true}}
{{'OrR ; 'AndL ; true}}
{{'OrR ; 'AndR ; true}}
{{'OrR ; 'I ; true}}
{{'OrR ; 'ImpL ; true}}
{{'OrR ; 'ImpR ; true}}
{{'OrR ; 'OrL ; true}}
{{'OrR ; 'OrR ; true}}
{{'OrR ; 'botL ; true}}
{{'OrR ; 'topL ; true}}
{{'OrR ; 'topR ; true}}
{{'botL ; 'AndL ; true}}
{{'botL ; 'AndR ; true}}
{{'botL ; 'I ; true}}
{{'botL ; 'ImpL ; true}}
{{'botL ; 'ImpR ; true}}
{{'botL ; 'OrL ; true}}
{{'botL ; 'OrR ; true}}
{{'botL ; 'botL ; true}}
{{'botL ; 'topL ; true}}
{{'botL ; 'topR ; true}}
{{'topL ; 'AndL ; true}}
{{'topL ; 'AndR ; true}}
{{'topL ; 'I ; true}}
{{'topL ; 'ImpL ; true}}
{{'topL ; 'ImpR ; true}}
{{'topL ; 'OrL ; true}}
{{'topL ; 'OrR ; true}}
{{'topL ; 'botL ; true}}
{{'topL ; 'topL ; true}}
{{'topL ; 'topR ; true}}
{{'topR ; 'AndL ; true}}
{{'topR ; 'AndR ; true}}
{{'topR ; 'I ; true}}
{{'topR ; 'ImpL ; true}}
{{'topR ; 'ImpR ; true}}
{{'topR ; 'OrL ; true}}
{{'topR ; 'OrR ; true}}
{{'topR ; 'botL ; true}}
{{'topR ; 'topL ; true}}
{{'topR ; 'topR ; true}}
test_llM.maude
) and the dyadic system (file test_llD.maude
) for linear logic.
red invertibility .
result Result: {'bang ; false}
{'bot ; true}
{'init ; true}
{'one ; true}
{'par ; true}
{'plusA ; false}
{'plusB ; false}
{'quest ; false}
{'questC ; true}
{'questW ; false}
{'tensor ; false}
{'top ; true}
{'with ; true}
Moreover, the tool is able to prove that |- Gamma, ! F implies |- Gamma, F
red admissible?(Th-Bang) .
result Bool: true
select THEOREM-PROVING-LL-DYADIC .
red invertibility .
result Result: {'bang ; false}
{'bot ; true}
{'copy ; false}
{'init ; true}
{'initC ; true}
{'initC ; true}
{'one ; true}
{'par ; true}
{'plusA ; false}
{'plusB ; false}
{'quest ; false}
{'tensor ; false}
{'top ; true}
{'with ; true}
In this system, the rule ? (quest
in the output) is invertible. However, the system is not able to prove it. The reason is that such proof requires an additional lemma: the admissibility of weakening in the classical context that we proved as follows:
--- Specification of the theorem
op Th-WeakeningC : -> Rule .
eq Th-WeakeningC = ( rl '|-`[_`]_['CC:SFormula,'CL:MSFormula] => '|-`[_`]_['_;_['ANY.SFormula,'CC:SFormula],'CL:MSFormula] [ label('Th-Weakening) ]. ) .
--- Result
red admissible?(Th-WeakeningC) .
result Bool: true
The system LL-DYADIC-W
(dyadic system + weakening on the classical context) is able to prove the invertibility of ?:
select THEOREM-PROVING-LL-DYADIC-W .
red invertibility .
result Result: {'W ; false}
{'bang ; false}
{'bot ; true}
{'copy ; false}
{'init ; true}
{'initC ; true}
{'initC ; true}
{'one ; true}
{'par ; true}
{'plusA ; false}
{'plusB ; false}
{'quest ; true}
{'tensor ; false}
{'top ; true}
{'with ; true}
As in the previous examples, the permutability of rules require the invertibility lemmas already proved.
select THEOREM-PROVING-LL-DYADIC-INV .
red analyzePermutation .
test_modalK.maude
we specified sequent systems for the modal logics K and S4.
select THEOREM-PROVING-K .
red invertibility .
result Result: {'I ; true}
{'K ; false}
{'botL ; true}
{'botR ; true}
{'conjL ; true}
{'conjR ; true}
{'disjL ; true}
{'disjR ; true}
{'impL ; true}
{'impR ; true}
{'topL ; true}
{'topR ; true}
red admissible?(Th-Weakening) .
result Bool: true
--- Assuming the previous lemmas about invertibility, we prove contraction to be admissible
select THEOREM-PROVING-K-CONTRACTION .
red admissible?(Th-Contraction) .
result Bool: true
select THEOREM-PROVING-S4 .
red invertibility .
result Result: {'4 ; false}
{'I ; true}
{'K ; false}
{'T ; true}
{'botL ; true}
{'botR ; true}
{'conjL ; true}
{'conjR ; true}
{'disjL ; true}
{'disjR ; true}
{'impL ; true}
{'impR ; true}
{'topL ; true}
{'topR ; true}
red admissible?(Th-Weakening) .
result Bool: true
--- Assuming the previous lemmas about invertibility, we prove contraction to be admissible
select THEOREM-PROVING-S4-CONTRACTION .
red admissible?(Th-Contraction) .
result Bool: true