Escolar Documentos
Profissional Documentos
Cultura Documentos
Natal-RN
December 2019
Joel Felipe Ferreira Gomes
Advisor
Prof. João Marcos
Natal-RN
December 2019
Universidade Federal do Rio Grande do Norte - UFRN
Sistema de Bibliotecas - SISBI
Catalogação de Publicação na Fonte. UFRN - Biblioteca Setorial Prof. Ronaldo Xavier de Arruda - CCET
It would be impossible to conceive this work without the support provided by the
professors who have spent my academic life inside this university, both from IMD and
DIMAp. Thus, special thanks to João Marcos, Umberto Rivieccio, Gibeon Aquino, Ath-
anasios “Thanos” Tsouanas, André Britto and Antônio “Tonhão” Igor.
Thanks to my family for all the love and support, and for with standing all the
difficulties encountered – Edilene Pereira Ferreira Gomes, Hareton Ribeiro Gomes, Daniel
Henrique Ferreira Gomes and Rafael de Jesus Ferreira Gomes. In addition, thanks to Enid
Nazareth Pereira Ferreira for the long distance support, and a special thanks to Raissa
Pereira for being present in all keys moments, helping me to keep my sanity.
Thanks to Paulo Lopes, Hugo Oliveira, Cinthia Katiane, Thales Gomes, Fagner Dias,
Allan Gonçalves and Gustavo Bezerra for all the discussions, conversations, memes and
for friendship throughout my journey on the Computer Science course.
Last but not least, thanks to Vitor Greati for help me make this work, and for all
the conversations, discussions, sleepless nights, and shared future plans, still fuzzy but
hopefully promising.
“And when at last the work is done
Don’t sit down it’s time to dig another one”
Roger Waters
Extração automática de cálculos de Hilbert associados
aos fragmentos da lógica clássica
Resumo
A lógica clássica pode ser definida como a lógica induzida pelo clone completo sobre
{0, 1}. A menos de um isomorfismo, qualquer outra lógica 2-valorada pode então ser
vista como uma sublógica / fragmento da lógica clássica. Ainda há muito pouco con-
hecimento sobre a combinação mínima de tais fragmentos (cf. (MARCELINO; CALEIRO;
MARCOS, 2018)), que em princípio pode ser obtida simplesmente unindo-se os cálculos
de Hilbert correspondentes. Em 1941, Emil Post estudou o reticulado de todos os clones
2-valorados, ordenados sobre inclusão (cf. (POST, 1941)). Este reticulado - infinitamente
contável, mas constituído de membros gerados finitamente - constituiu desde então uma
fonte inestimável de informações e insights sobre as relações entre as sub-lógicas da lógica
clássica. Em (RAUTENBERG, 1981), Wolfgang Rautenberg explorou a classificação de
Post para demonstrar que toda lógica 2-valorada é fortemente axiomatizável; vale a pena
notar que esta demonstração induz um procedimento eficaz para produzir um cálculo de
Hilbert para qualquer fragmento da lógica clássica. Este trabalho propõe implementar um
sistema Web que é capaz de receber como entrada um conjunto de operações 2-valoradas
e retornar ao usuário o cálculo de Hilbert associado. A implementação do procedimento
para produzir o cálculo de Hilbert associado à entrada informada será feita utilizando a
linguagem de programação Haskell e distribuído como uma API RESTful. Além disso,
será feito um Website, a ser usado livremente pela comunidade, que receberá as entradas
do usuário, consumirá a API, e informará o resultado do procedimento citado, baseado
nas entradas que o usuário forneceu.
Abstract
The classical logic can be defined as the logic induced by the complete clone over {0, 1}.
Up to isomorphism, any other 2-valued logic may then be seen as a sublogic / fragment of
classical logic. There is still very little common knowledge about the minimal combination
of such fragments (cf. (MARCELINO; CALEIRO; MARCOS, 2018)), which in principle may be
obtained by simply merging the corresponding Hilbert calculi. In 1941, Emil Post studied
the lattice of all the 2-valued clones, ordered under inclusion (cf. ( POST, 1941)). This lat-
tice —countably infinite yet constituted of finitely generated members— has constituted
ever since an invaluable source of information and insights about the relationships among
the sublogics of classical logic. In (RAUTENBERG, 1981), Wolfgang Rautenberg explored
Post’s classification in proving that every 2-valued logic is strongly finitely axiomatizable;
it is worth noting that this proof carries along an effective procedure for producing a
Hilbert calculus to any fragment of classical logic. This work proposes to implement a
Web system that is able to receive as input a set of 2-valued operations and return to the
user the Hilbert Calculus associated. The implementation of the procedure to produce
the Hilbert Calculus associated with the reported input will be done using the Haskell
programming language and distributed as a RESTful API. In addition, a Website will be
made, to be used freely by the community, which will receive the user inputs, consume
the API, and inform the result of the cited procedure, based on the inputs that the user
provided.
1 Post’s Lattice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 18
2 PLLP Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 22
3 Rautenberg Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 24
1 Truth Table of ¬ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 25
2 Truth Table of 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 25
3 Truth Table of 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 26
4 Truth Table of ∨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 28
5 Truth Table of ∧ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 30
6 Truth Table of ↔3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 34
7 Truth Table of d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 37
8 Truth Table of ka . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 40
9 Truth Table of ki . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 41
10 Truth Table of ak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 42
11 Truth Table of ad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 43
List of abbreviations and initials
1 CMP Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 23
Contents
1 Introduction p. 15
2 Theoretical Framework p. 17
2.1 Clones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 17
4.3 Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p. 59
5 Concluding Remarks p. 62
References p. 63
1 Introduction
The implementation of this procedure was never done. Now that we know that Hilbert
Calculi provide the most appropriate and simple environment for defining combinations
of logics to support the study of complex systems derived by that combinations, the
implementation of such an axiomatization procedure proves to be very important.
To understand the purpose of this work and its implications, some definitions are
fundamental, like the concepts of clones, the logic induced by a clone, Post’s lattice, and
Hilbert calculi, which will be formally presented in the Chapter 2.
In order for the algorithm to be implemented, we first have to, given a set F of
operations on {0, 1}, find the clone in Post’s lattice to which this set belongs. This problem
is referred to as Post’s Lattice Localization Problem (PLLP), the proposed solution is
presented in Section 3.1.
After finding out which clone in the Post’s Lattice the user-supplied set of operations
refers to, we use the Rautenberg algorithm (RAUTENBERG, 1981) to return the corres-
ponding Hilbert calculus. The algorithm is presented in Section 3.2.
16
In addition, it was necessary to implement the concepts and the algorithm presented
computationally. The implementation was done using the Haskell programming language,
and it will be explained in the Section 4.1.
The algorithm of the procedure to produce the Hilbert Calculus associated with the
informed set of 2-valued operations was distributed as a API RESTful, which can be ac-
cessed on http://logicapi.lolita.dimap.ufrn.br/, and described in details in Section
4.2.
In addition, a Website was made, to be used freely by the community, which will
receive the user inputs, consume the API, and inform the result of the cited procedure,
based on the inputs that the user provided, which can be accessed on http://logicapps.
lolita.dimap.ufrn.br/, and described in details in Section 4.3.
17
2 Theoretical Framework
The purpose of this work is to exhibit an algorithm for the extraction the Hilbert
calculi associated to fragments of classical logic. Some topics treated here require a theor-
etical background and are thus explored in this section: Clones, Post’s Lattice, Classical
logic and its fragments, Hilbert calculus.
2.1 Clones
The set of all clones on a set A, ordered by the inclusion relation, defines a lattice.
When |A| > 2, the cardinality of this set is equal to that of the continuum. However, for
|A| = 2, Emil Post (POST, 1941) showed that the number of clones on {0, 1} is denumerable
and, even more, that each such clone is generated by a finite set of operations on A. In
this case, the corresponding lattice is called Post’s Lattice (Figure 1).
From the results obtained by Emil Post (POST, 1941), mentioned above, we have
that all fragments of Classical Logic are organized into a lattice ordered by inclusion,
which gives a basis to several studies on the characteristics and interrelationships of these
fragments. One such study was carried out by Wolfgang Rautenberg (RAUTENBERG,
1981), who showed that every fragment of Classical Logic is strongly finitely axiomatizable.
In order to understand this result, some definitions concerning Hilbert calculi are needed.
20
The logic induced by a Hilbert calculus H = �Σ, R�, LH = �Σ, �H � is such that, for
each Γ ⊆ LΣ (P ), Γ �H is the least set that contains Γ and is closed under all apliciations
of instaces of the instance rules in R, that is, if �Δ, ϕ� ∈ R and σ : P → LΣ (P ) is such
that Δσ ⊆ Γ �H then ϕ σ ∈ Γ �H . Strongly axiomatizing a logic L = �Σ, �L � means
finding a Hilbert calculus H such that �L = �H .
The result by Rautenberg means that, for each fragment L of Classical Logic, there is
a Hilbert calculus H such that �L = �H and the set of schematic rules of H is finite. An
example is the clone-induced logic generated by the singleton {∨}, which is axiomatized
by the following schematic rules: �{P }, P ∨ Q�, �{P ∨ P }, P �, �{P ∨ Q}, Q ∨ P �, �{P ∨
(Q ∨ R)}, (P ∨ Q) ∨ R�, where P, Q, R ∈ L∨ . In order to make rules easier to view, they
will be shown as follows:
P P ∨P P ∨Q P ∨ (Q ∨ R)
P ∨Q P Q∨P (P ∨ Q) ∨ R
21
The first step of the extraction of Hilbert calculus from a set of boolean functions is,
given the set F of functions on {0, 1}, find to which clone in Post’s Lattice the Clo {0,1} (F )
corresponds. This problem is the Post’s Lattice Localization Problem (PLLP). After find-
ing it, we use the Rautenberg algorithm to return the corresponding Hilbert calculus.
The Post’s Lattice Localization Problem (PLLP) may be thus described: given a finite
set F of operations on the set {0, 1}, to find, in the Post’s lattice P = �B ∗ , ⊆�, the B ∈ B ∗
such that Clo{0,1} (F ) = B. The proposed solution is based on the fact that the lattice has
finite and infinite sections, thus consisting of the following steps:
1. Check if Clo{0,1} (F ) = B for some B ∈ B ∗ of the finite sections, that is, for some
green clone B on Figure 2, in any order. If so, return such B.
2. Otherwise, check, in the infinite sections, from top to bottom, if B ⊆ Clo {0,1} (F )
for some B ∈ B ∗ , that is, the red clones on Figure 2. If so, return B.
Note that the main condition involved in both steps listed above refers to whether
one clone is contained in another, given the knowledge of its basic sets of operations. A
stronger condition, clone equality, gives rise to the problem known in the literature as
the Term Equivalence Problem (TEP) (BERGMAN; JUEDES, 2001). By the definition of
clone generated by a set of operations, we have that, for finite sets of operations F 1 and
F2 on {0, 1}, if F1 ⊆ Clo{0,1} (F2 ), then Clo{0,1} (F1 ) ⊆ Clo{0,1} (F2 ). Thereby, the TEP
translates into the following question: given the finite sets F1 e F2 of operations on {0, 1},
is it the case that F2 ⊆ Clo{0,1} (F1 ) and F1 ⊆ Clo{0,1} (F2 )?
22
To answer that, the conditions involved may be further simplified by reducing TEP to
the Clone Membership Problem (CMP): given a finite set F of operations on {0, 1} and
a operation g : {0, 1}k → {0, 1}, k ∈ ω + , verify if g ∈ Clo{0,1} (F). The solution to CMP
{0,1}
uses two theoretical results. The first says that Clon (F) is the smallest set of operations
on {0, 1} such that contains the n-ary projections and is closed by compositions on the
set F, which characterizes a finite specification since F is finite. The second result is an
{0,1}
application of the Kleene fixed-point theorem, and ensures that Clo n (F), because it
is characterized by a finite specification, can be generated in finite time, starting with
the set of n-ary projections and applying the compositions with the functions on F. The
algorithm presented in Algorithm 1 is based directly on this idea to solve the CMP.
23
As shown, the resolution of the CMP implies the resolution of the PLLP according to
the presented method and, therefore, it was implemented in Appendix A.
The algorithm is presented recursively, in which the base cases are the green (trivial
cases) and yellow (main cases) painted cases in Figure 3, and the recursive part consists
in the blue cases. Vitor Greati, in (GREATI, 2019), prove that, for each Hilbert calculus
H presented in the Section 3.2.1 and 3.2.2, �L = �H , for the corresponding clone L.
Rautenberg (RAUTENBERG, 1981) prove that, for each Hilbert calculus H presented in
the Section 3.2.3, �L = �H , for the corresponding clone L.
24
Listed below are the Hilbert calculi associated with the cases considered trivial by
Rautenberg, because the corresponding clones are characterized by low arity connectives
and little interaction, so the Hilbert calculi that axiomatize these clones have few rules.
These cases are those related to the clones Ri of Post’s Lattice.
25
Since this clone is generated by ∅, then it has only projections, so, given that com-
position of projections are projections, and all the projections are in the clone, so it has
no axiomatic rules.
This clone is generated by only one unary connective ¬, commonly known as logical
negation. This connective is characterized by the following truth table:
A ¬A
0 1
1 0
The following are the inference rules that axiomatize this clone. They are presented
in (MARCELINO; CALEIRO; MARCOS, 2018).
P ¬(¬P ) P ¬P (R4 )
(R41 ) (R42 ) 3
¬(¬P ) P Q
This clone is generated by only one nullary connective 1, commonly known as logical
truth. This connective is characterized by the following truth table:
1
1
The following is the inference rule that axiomatize this clone. It is presented in
(RAUTENBERG, 1981).
(R61 )
1
26
This clone is generated by only one nullary connective 0, commonly known as logical
falsity. This connective is characterized by the following truth table:
0
0
The following is the inference rule that axiomatize this clone. It is presented in
(RAUTENBERG, 1981).
0 (R8 )
1
P
This clone is generated by two nullary connective: 0 and 1. These connectives are
characterized by the truth tables in Table 3 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.1.3 and 3.2.1.4.
0 (R8 ) (R61 )
1
P 1
This clone is generated by the connectives: ¬ and 0. These connectives are character-
ized by the truth tables in Table 1 and Table 3, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.1.2 plus an interaction rule between the connectives.
P ¬(¬P ) P ¬P (R4 )
(R41 ) (R42 ) 3 (R131 )
¬(¬P ) P Q ¬0
Listed below are the Hilbert calculi associated with the cases considered the main ones
by Rautenberg, because the clones that expand the clones of these cases, use, according
to Rautenberg, the Hilbert calculi of these clones to generate their own Hilbert calculi.
These cases are those related to the clones Si , Pi , Aj , Cj , Lk , Dl and Fn∞ of Post’s Lattice.
This clone is generated by only one binary connective ∨, commonly known as logical
disjunction. This connective is characterized by the following truth table:
28
A B A∨B
0 0 0
0 1 0
1 0 0
1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
in (RAUTENBERG, 1981).
P (S2 ) P ∨ P (S2 ) P ∨Q P ∨ (Q ∨ R)
1 2 (S23 ) (S24 )
P ∨Q P Q∨P (P ∨ Q) ∨ R
This clone is generated by the connectives ∨ and 1. These connectives are character-
ized by the truth tables in Table 4 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.1 and 3.2.1.3.
P (S2 ) P ∨ P (S2 ) P ∨Q P ∨ (Q ∨ R)
1 2 (S23 ) (S24 ) (R61 )
P ∨Q P Q∨P (P ∨ Q) ∨ R 1
This clone is generated by the connectives ∨ and 0. These connectives are character-
ized by the truth tables in Table 4 and Table 3, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.1 plus an interaction rule between the connectives,
presented in (RAUTENBERG, 1981).
This clone is generated by the connectives ∨, 0 and 1. These connectives are charac-
terized by the truth tables in Table 4, Table 3 and Table 2 respectively.
29
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.3 and 3.2.1.3.
This clone is generated by only one binary connective ∧, commonly known as logical
conjunction. This connective is characterized by the following truth table:
30
A B A∧B
0 0 0
0 1 1
1 0 1
1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
in (RAUTENBERG, 1981).
P Q P ∧Q P ∧Q
(P21 ) (P22 ) (P23 )
P ∧Q P Q
This clone is generated by the connectives ∧ and 0. These connectives are character-
ized by the truth tables in Table 5 and Table 3, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.5 and 3.2.1.4.
P Q P ∧Q P ∧Q 0 (R8 )
(P21 ) (P22 ) (P23 ) 1
P ∧Q P Q P
This clone is generated by the connectives ∧ and 1. These connectives are character-
ized by the truth tables in Table 5 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.5 and 3.2.1.3.
P Q P ∧Q P ∧Q
(P21 ) (P22 ) (P23 ) (R61 )
P ∧Q P Q 1
This clone is generated by the connectives ∧, 0 and 1. These connectives are charac-
terized by the truth tables in Table 5, Table 3 and Table 2, respectively.
31
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.6 and 3.2.1.3.
P Q P ∧Q P ∧Q 0 (R8 )
(P21 ) (P22 ) (P23 ) 1 (R61 )
P ∧Q P Q P 1
This clone is generated by the connectives ∨ and ∧. These connectives are character-
ized by the truth tables in Table 4 and Table 5, respectively.
32
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.1 and some interaction rules between the connectives,
presented in (RAUTENBERG, 1981).
This clone is generated by the connectives ∨, ∧ and 0. These connectives are charac-
terized by the truth tables in Table 4, Table 5 and Table 3, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.9 and an interaction rule between the connectives,
presented in (RAUTENBERG, 1981).
This clone is generated by the connectives ∨, ∧ and 1. These connectives are charac-
terized by the truth tables in Table 4, Table 5 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.9 and Section 3.2.1.3.
This clone is generated by the connectives ∨, ∧, 0 and 1. These connectives are char-
acterized by the truth tables in Table 4, Table 5, Table 3 and Table 2, respectively.
33
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.10 and Section 3.2.1.3.
A B C ↔3 (A, B, C)
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
in (RAUTENBERG, 1981).
P Q R ↔3 (P, Q, R) ↔3 (P, Q, R)
(L41 ) (L42 ) (L43 )
↔3 (P, Q, R) ↔3 (Q, P, R) ↔3 (P, R, Q)
P ↔3 (P, Q, Q) ↔3 (P, Q, ↔3 (R, S, T ))
(L44 ) (L45 ) (L46 )
↔3 (P, Q, Q) P ↔3 (↔3 (P, Q, R), S, T )
This clone is generated by the connectives ↔3 and 1. These connectives are charac-
terized by the truth tables in Table 6 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.13 and 3.2.1.3.
P Q R ↔3 (P, Q, R) ↔3 (P, Q, R)
(L41 ) (L42 ) (L43 ) (R61 )
↔3 (P, Q, R) ↔3 (Q, P, R) ↔3 (P, R, Q) 1
P ↔3 (P, Q, Q) ↔3 (P, Q, ↔3 (R, S, T ))
(L44 ) (L45 ) (L46 )
↔3 (P, Q, Q) P ↔3 (↔3 (P, Q, R), S, T )
35
This clone is generated by the connectives ↔3 and 0. These connectives are charac-
terized by the truth tables in Table 6 and Table 3, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.13 and 3.2.1.4.
P Q R ↔3 (P, Q, R) ↔3 (P, Q, R) 0 (R8 )
(L41 ) (L42 ) (L43 ) 1
↔3 (P, Q, R) ↔3 (Q, P, R) ↔3 (P, R, Q) P
P ↔3 (P, Q, Q) ↔3 (P, Q, ↔3 (R, S, T ))
(L44 ) (L45 ) (L46 )
↔3 (P, Q, Q) P ↔3 (↔3 (P, Q, R), S, T )
This clone is generated by the connectives ↔3 , 0 and 1. These connectives are char-
acterized by the truth tables in Table 6, Table 3 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.15 and 3.2.1.3.
P Q R ↔3 (P, Q, R) ↔3 (P, Q, R) 0 (R8 )
(L41 ) (L42 ) (L43 ) 1
↔3 (P, Q, R) ↔3 (Q, P, R) ↔3 (P, R, Q) P
P ↔3 (P, Q, Q) ↔3 (P, Q, ↔3 (R, S, T ))
(L44 ) (L45 ) (L46 ) (R61 )
↔3 (P, Q, Q) P ↔3 (↔3 (P, Q, R), S, T ) 1
This clone is generated by the connectives ↔3 and ¬. These connectives are charac-
terized by the truth tables in Table 6 and Table 1, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.13 and 3.2.1.2, adding some interaction rules between
the connectives, presented in (RAUTENBERG, 1981).
36
P Q R ↔3 (P, Q, R) ↔3 (P, Q, R)
(L41 ) (L42 ) (L43 )
↔3 (P, Q, R) ↔3 (Q, P, R) ↔3 (P, R, Q)
P ↔3 (P, Q, Q) ↔3 (P, Q, ↔3 (R, S, T ))
(L44 ) (L45 ) (L46 )
↔3 (P, Q, Q) P ↔3 (↔3 (P, Q, R), S, T )
P ¬(¬P ) P ¬(P )
(R41 ) (R42 ) (R43 )
¬(¬P ) P Q
↔3 (¬(P ), Q, R) ¬(↔3 (P, Q, R))
(L51 ) (L52 )
¬(↔3 (P, Q, R)) ↔3 (¬(P ), Q, R)
A B C d(A, B, C)
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
in (RAUTENBERG, 1981).
P Q d(Q, P, P ) P
(D21 ) (D22 ) (D23 )
d(P, Q, R) P d(Q, P, P )
d(S, T, d(P, Q, R)) d(A, B, d(P, Q, d(R, S, T )))
(D24 ) (D25 )
d(T, S, d(Q, P, R)) d(A, B, d(d(P, Q, R), d(P, Q, S), T ))
d(S, T, d(P, Q, R)) d(A, B, d(d(P, Q, R), d(P, Q, S), T ))
(D26 ) (D27 )
d(T, S, d(P, R, Q)) d(A, B, d(P, Q, d(R, S, T )))
This clone is generated by the connectives d and ¬. These connectives are character-
ized by the truth tables in Table 7 and Table 1, respectively.
The following are the inference rules that axiomatize this clone. They are the union of
rules showed in the Section 3.2.2.18 and some interaction rules between the connectives,
presented in (RAUTENBERG, 1981).
P Q d(Q, P, P ) P
(D21 ) (D22 ) (D23 )
d(P, Q, R) P d(Q, P, P )
38
d(S, T, d(P, Q, R)) d(A, B, d(P, Q, d(R, S, T )))
(D24 ) (D25 )
d(T, S, d(Q, P, R)) d(A, B, d(d(P, Q, R), d(P, Q, S), T ))
d(S, T, d(P, Q, R)) d(A, B, d(d(P, Q, R), d(P, Q, S), T ))
(D26 ) (D27 )
d(T, S, d(P, R, Q)) d(A, B, d(P, Q, d(R, S, T )))
d(R, S, d(Q, P, ¬(P ))) d(R, S, Q)
(D31 ) (D32 )
d(R, S, Q) d(R, S, d(Q, P, ¬(P )))
This clone is generated by the connectives d and ↔3 . These connectives are charac-
terized by the truth tables in Table 7 and Table 6, respectively.
The inference rules that axiomatize this clone are the union of rules showed in the Sec-
tion 3.2.2.18 and 3.2.2.13, adding the following interaction rules between the connectives,
presented by me and Vitor Greati in (GREATI, 2019).
This clone is generated by only one ternary connective ka, which is defined as
ka(x, y, z) = x ∧ (y ∨ z). This connective is characterized by the following truth table:
40
A B C ka(A, B, C)
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
in (RAUTENBERG, 1981).
This clone is generated by the connectives ka and 0. These connectives are character-
ized by the truth tables in Table 8 and Table 3, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.21 and an interaction rule between the connectives,
presented in (RAUTENBERG, 1981).
This clone is generated by only one ternary connective ki, which is defined as
ki(x, y, z) = x ∧ (y → z), in which → is commonly known as logical conditional. This
connective is characterized by the following truth table:
A B C ki(A, B, C)
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
in (RAUTENBERG, 1981).
This clone is generated by the connectives ki and 0. These connectives are character-
ized by the truth tables in Table 9 and Table 3, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.23 and an interaction rule between the connectives,
42
This clone is generated by only one ternary connective ak, which is defined as
ak(x, y, z) = x ∨ (y ∧ z). This connective is characterized by the following truth table:
A B C ak(A, B, C)
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
in (RAUTENBERG, 1981).
This clone is generated by the connectives ak and 1. These connectives are charac-
terized by the truth tables in Table 10 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.25 and 3.2.1.3.
ak(P, P, P ) ak(ak(R, P, Q), S, S) ak(Q, P, P )
(F21 ) (F22 ) (F23 )
P ak(ak(R, P, P ), S, S) ak(P, Q, Q)
P ak(ak(R, P, Q), S, S) ak(ak(R, Q, Q), P, P )
(F24 ) (F25 ) (F26 )
ak(Q, P, P ) ak(ak(R, Q, Q), S, S) ak(R, ak(Q, P, P ), ak(Q, P, P ))
ak(ak(R, P, P ), S, S) ak(ak(R, Q, Q), S, S)
(F27 ) (R61 )
ak(ak(R, P, Q), S, S) 1
This clone is generated by only one ternary connective ad, which is defined as
ad(x, y, z) = x ∨ (y ∧ ¬z). This connective is characterized by the following truth table:
A B C ad(A, B, C)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
The following are the inferences rule that axiomatize this clone. They are presented
44
in (RAUTENBERG, 1981).
Q ad(Q, A, P ) ad(S, Q, S)
(F11 ) (F12 ) (F13 )
ad(Q, A, P ) ad(A, Q, A) ad(S, ad(Q, A, P ), S)
ad(P, P, P ) P ad(Q, A, P ) ad(P, B, R) ad(Q, A, P )
(F14 ) (F15 ) (F16 )
P Q ad(Q, B, R)
ad(P, Q, P ) A ad(S, ad(Q, A, P ), S)
(F17 ) (F18 ) (F19 )
ad(Q, P, Q) ad(ad(P, A, Q), A, P ) ad(S, ad(A, Q, A), S)
ad(S, A, S) ad(P, ad(Q, R, Q), P )
(F110 ) (F111 )
ad(S, ad(ad(P, A, Q), A, P ), S) ad(ad(P, Q, P ), R, ad(P, Q, P ))
ad(S, P, S), ad(S, ad(Q, A, P ), S)
(F112 )
ad(S, Q, S)
ad(A, B, T )
(F113 )
ad(ad(P, A, ad(P, A, ad(Q, A, P ))), B, T )
ad(A, B, T )
(F114 )
ad(ad(ad(R, A, P ), A, ad(ad(R, A, Q), A, P )), B, T )
ad(ad(Q, R, Q), A, P )
(F115 )
ad(ad(Q, A, P ), ad(R, A, P ), ad(Q, A, P ))
ad(ad(Q, A, P ), ad(R, A, P ), ad(Q, A, P ))
(F116 )
ad(ad(Q, R, Q), A, P )
ad(ad(R, B, Q), A, P )
(F117 )
ad(ad(R, A, P ), ad(R, B, Q), ad(R, A, P ))
ad(ad(R, A, P ), ad(R, B, Q), ad(R, A, P ))
(F118 )
ad(ad(R, B, Q), A, P )
ad(S, ad(P, B, R), S), ad(S, ad(Q, A, P ), S)
(F119 )
ad(S, ad(Q, B, R), S)
ad(S, ad(A, B, T ), S)
(F120 )
ad(S, ad(ad(P, A, ad(P, A, ad(Q, A, P ))), B, T ), S)
ad(S, ad(ad(Q, R, Q), A, P ), S)
(F121 )
ad(S, ad(ad(Q, A, P ), ad(R, A, P ), ad(Q, A, P )), S)
ad(S, ad(ad(Q, A, P ), ad(R, A, P ), ad(Q, A, P )), S)
(F122 )
ad(S, ad(ad(Q, R, Q), A, P ), S)
ad(S, ad(ad(R, B, Q), A, P ), S)
(F123 )
ad(S, ad(ad(R, A, P ), ad(R, P, Q), ad(R, A, Q)), S)
ad(S, ad(ad(R, A, P ), ad(R, P, Q), ad(R, A, Q)), S)
(F124 )
ad(S, ad(ad(R, B, Q), A, P ), S)
ad(S, ad(A, B, T ), S)
(F125 )
ad(S, ad(ad(ad(ad(R, A, P ), A, ad(Q, A, P )), A, ad(ad(R, A, Q), A, P )), B, T ), S)
45
This clone is generated by the connectives ad and 1. These connectives are charac-
terized by the truth tables in Table 11 and Table 2, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.27 and 3.2.1.3.
This clone is generated by the connectives ki and ∨. These connectives are character-
ized by the truth tables in Table 5 and Table 9, respectively.
The following are the inference rules that axiomatize this clone. They are the union
of rules showed in the Section 3.2.2.23 and an interaction rule between the connectives,
presented in (RAUTENBERG, 1981).
This clone is generated by the connectives ki, ∨ and 0. These connectives are charac-
terized by the truth tables in Table 9, Table 4 and Table 3, respectively.
The Hilbert calculus that axiomatizes this clone contains all the showed in the Section
3.2.2.29, and the following rule:
ki(T, S, 0)
(C30 )
ki(T, S, R)
This clone is generated by the connectives ki, ∨ and 1. These connectives are charac-
terized by the truth tables in Table 9, Table 4 and Table 2, respectively.
The inference rules that axiomatize this clone are the union of rules showed in the
Section 3.2.2.29 and 3.2.1.3.
47
This clone is generated by the connectives ki, ∨, 0 and 1. These connectives are char-
acterized by the truth tables in Table 9, Table 4, Table 3 and Table 2, respectively.
The inference rules that axiomatize this clone are the union of rules showed in the
Section 3.2.2.30 and 3.2.1.3.
For the other cases, we divide them into four possibilities: (1) the clone is a monotonic
expansion of the S2 , (2) the clone is a expansion of F1∞ or F4∞ , (3) the clone is a expansion
of F5∞ or F8∞ , (4) the clone is a expansion of F6∞ or F7∞
Besides that, we will need the definition of the clones Fim (1 ≤ i ≤ 8)(m ≥ 2). A clone
Fim is the expansion of Fi∞ with the connective dm witch may be described by:
m
�
dm (x0 , . . . , xm ) = (x0 ∧ · · · ∧ xi−1 ∧ xi+1 ∧ · · · ∧ xm ) (3.1)
i=0
m−1
� m
�
dm (x0 , . . . , xm ) = (xi ∨ xj ) (3.2)
i=0 j=i+1
For this case, we will suppose that B = Clo{0,1} (F) for some F, such that F = {∨, #},
for some n-ary monotonic connective #. Given that, every monotonic connective can be
� �
written as #(x1 , . . . , xn ) = C∈C i∈C xi , where C is the set of clauses of #, Rautenberg
(RAUTENBERG, 1981) shows that the Hilbert calculus that axiomatizes this clone contains
the rules of Section 3.2.2.1 and, for m = |C|, and for all 1 ≤ k ≤ m the following rules:
� �
S ∨ ( i∈C1 xi ) . . . S ∨ ( i∈Cm xi ) S ∨ #(x1 , . . . , xn )
(B0 ) � (Bk )
S ∨ #(x1 , . . . , xn ) S ∨ ( i∈Ck xi )
As an example, we have the clone A4 = Clo{0,1} ({∨, ∧}). Given that A ∧ B can be
written as ∧(A, B), such that, C = {{A}, {B}}, therefore the inference rules are the
following:
Another example, is the clone F2∞ = Clo{0,1} ({ak}). Given that ak(A, B, B) = A ∨ B,
49
and C = {{A, B}, {A, C}}, therefore ak(A, B, C) = ∧(∨(A, B), ∨(A, C)). So, replacing
the ∨ in rules of Section 3.2.2.1 for ak(A, B, B) and adding the rules listed above with
the corresponding C, the rules are exactly the ones listed in Section 3.2.2.25.
�m
1. dm (x1 , . . . , xm ) = i=0 αi , where αi = (x0 ∧ · · · ∧ xi−1 ∧ xi+1 ∧ · · · ∧ xm ) replacing
all occurrences of A ∧ B for ka(A, B, B). Based on equation 3.1.
�m−1 �m
2. dm (x1 , . . . , xm ) = i=0 j=i+1 ad(xi , xj , xi ). Given that A ∨ B = ad(A, B, A).
Based on equation 3.2.
�m
3. dm (x1 , . . . , xm ) = i=0 γi , where γi = (x0 ∧ · · · ∧ xi−1 ∧ xi+1 ∧ · · · ∧ xm ) replacing all
occurrences of A ∧ B for ki(A, A, B). Based on equation 3.1.
For the clones F1m , we will suppose that B = Clo{0,1} (F) for some F, such that
�
F = {ad, dm }. By the Normal Form Lemma dm (x1 , . . . , xm ) = C∈C adi∈C xi , where C is
the set of clauses of dm , then Rautenberg (RAUTENBERG, 1981) shows that the Hilbert
calculus that axiomatizes this clone contains all the rules of Section 3.2.2.27 and, for
n = |C|, for all 1 ≤ k ≤ n, where Pk = adi∈Ck xi and Q = dm (x1 , . . . , xm ), the following
rules:
ad(T, S, P1 ) ad(T, S, Q)
(B0 ) (Bk )
ad(T, S, ad(P1 , P2 , ad(P1 , P3 , · · · ad(P1 , Pn , Q) · · · ))) ad(T, S, Pk )
For the clones F4m , we will suppose that B = Clo{0,1} (F) for some F, such that
F = {ad, 1, dm }. The Hilbert calculus that axiomatizes these clones contains all the rules
listed above, and the rule of Section 3.2.1.3.
As an example of expansion of F1∞ , consider the clone F12 = Clo{0,1} ({ad, d2 }), whose
set of clauses of d2 is C = {{A, B}, {A, C}, {B, C}}, therefore
d2 (A, B, C) = ∧(∨(A, B), ∨(A, C), ∨(B, C)) = ∧(ad(A, B, A), ad(A, C, A), ad(B, C, B))
50
So, the inference rules, in this case, are: all the rules of Section 3.2.2.27, plus the following
rules:
ad(T, S, ad(A, B, A))
(F120 )
ad(T, S, ad(ad(A, B, A), ad(A, C, A), ad(ad(A, B, A), ad(B, C, B), d2 (A, B, C))))
ad(T, S, d2 (A, B, C)) ad(T, S, d2 (A, B, C)) ad(T, S, d2 (A, B, C))
(F121 ) (F122 ) (F123 )
ad(T, S, ad(A, B, A)) ad(T, S, ad(A, C, A)) ad(T, S, ad(B, C, B))
For the clones F5m , we will suppose that B = Clo{0,1} (F) for some F, such that
�
F = {ki, dm }. By the Normal Form Lemma dm (x1 , . . . , xm ) = C∈C kii∈C xi , where C is
the set of clauses of dm , Rautenberg (RAUTENBERG, 1981) shows that the Hilbert calculus
that axiomatizes this clone contains all the rules of Section 3.2.2.23 and, for n = |C|, for
all 1 ≤ k ≤ n, where Pk = kii∈Ck xi and Q = dm (x1 , . . . , xm ), the following rules:
ki(T, S, Q)
(B0 )
ki(T, S, ki(Q, ki(Q, P1 , R), ki(Q, ki(Q, P2 , R), · · · ki(Q, ki(Q, Pn , R), R) · · · )))
ki(T, S, Pk )
(Bk )
ki(T, S, Q)
For the clones F8m , we will suppose that B = Clo{0,1} (F) for some F, such that
F = {ad, 0, dm }. The Hilbert calculus that axiomatizes this clone contains all the rules
listed above, and the following rule:
ki(T, S, 0)
(B0 )
ki(T, S, R)
As an example of expansion of F5∞ , consider the clone F52 = Clo{0,1} ({ki, d2 }), such
that, the set of clauses of d2 is C = {{A, B}, {A, C}, {B, C}}, therefore
d2 (A, B, C) = ∨(∧(A, B), ∧(A, C), ∧(B, C)) = ∨(ki(A, A, B), ki(A, A, C), ki(B, B, C))
Given that, P1 = ki(A, A, B), P2 = ki(A, A, C), P3 = ki(B, B, C) and Q = d2 (A, B, C),
the inference rules are all the rules of Section 3.2.2.23, plus the following rules:
ki(T, S, Q)
(F520 )
ki(T, S, ki(Q, ki(Q, P1 , R), ki(Q, ki(Q, P2 , R), ki(Q, ki(Q, P3 , R), R))))
ki(T, S, ki(A, A, B)) ki(T, S, ki(A, A, C)) ki(T, S, ki(B, B, C))
(F521 ) (F522 ) (F523 )
ki(T, S, d2 (A, B, C)) ki(T, S, d2 (A, B, C)) ki(T, S, d2 (A, B, C))
51
For the clones F6m , we will suppose that B = Clo{0,1} (F) for some F, such that
�
F = {ka, dm }. By the Normal Form Lemma dm (x1 , . . . , xm ) = C∈C kai∈C xi , where C is
the set of clauses of dm , Rautenberg (RAUTENBERG, 1981) shows that the Hilbert calculus
that axiomatizes this clone contains all the rules of Section 3.2.2.23 and, for n = |C|, for
all 1 ≤ k ≤ n, where Pk = kai∈Ck xi and Q = dm (x1 , . . . , xm ), the following rules:
ka(T, S, Q) ka(T, S, Pk )
(B0 ) (Bk )
ka(T, S, ka(Q, P1 , ka(Q, P2 , · · · ka(Q, Pn−1 , Pn ) · · · ))) ka(T, S, Q)
For the clones F7m , we will suppose that B = Clo{0,1} (F) for some F, such that
F = {ka, 0, dm }. The Hilbert calculus that axiomatizes this clone contains all the rules
listed above, and the following extra rule:
ka(T, S, 0)
(B0 )
ka(T, S, R)
As an example of expansion of F6∞ , we have the clone F62 = Clo{0,1} ({ka, d2 }), such
that, the set of clauses of d2 is C = {{A, B}, {A, C}, {B, C}}, therefore
d2 (A, B, C) = ∨(∧(A, B), ∧(A, C), ∧(B, C)) = ∨(ka(A, B, B), ka(A, C, C), ka(B, C, C))
Given that, P1 = ka(A, B, B), P2 = ka(A, C, C), P3 = ka(B, C, C) and Q = d2 (A, B, C),
the inference rules are all the rules of Section 3.2.2.23, plus the following rules:
ka(T, S, Q)
(B0 )
ka(T, S, ka(Q, P1 , ka(Q, P2 , ka(Q, Pn−1 , Pn ))))
ka(T, S, ka(A, B, B)) ka(T, S, ka(A, C, C)) ka(T, S, ka(B, C, C))
(F521 ) (F522 ) (F523 )
ka(T, S, d2 (A, B, C)) ka(T, S, d2 (A, B, C)) ka(T, S, d2 (A, B, C))
4 A computational implementation
of extraction of a Hilbert calculus
The algorithm of the procedure to produce the Hilbert Calculus associated with the
informed set of 2-valued operations was implemented using the Haskell programming
language and was distributed as a API RESTful, in addition a website was made, to be
freely used by the community, which will receive the user inputs, consume the API, and
inform the result of the cited procedure, based on the inputs that the user provided.
The concepts presented in Chapter 2 implemented using Haskell and the first one is
that of a schematic formula, which could be just a variable A, B, or could be a compound
formula such as A ∧ B, A → B, where ∧ and → are function symbols.
data Formula =
Var String |
Op Symbol [Formula]
The following are examples of schematic formulas, where the connective ∧ and ∨
are represented by the symbols ∗ and +, respectively. The list of all symbols and their
associated connectives are in Appendix C.
For each connective we have an interpretation, as explained in Section 2.3, and, for
each interpretation, we have an associated truth table. So, the interpretation in Haskell
is a set of mappings from a function symbol to a truth table.
interpretation.
-- Set of truth-values V
type V a = S.Set a
-- Set of designated values D
type D a = S.Set a
-- Matrix values
type Values a = (V a, D a)
-- Matrix by definition �V, D, ·M �
data Matrix a = Matrix {
values :: Values a,
interpretation :: Interpretation a
}
The example below describes the matrix for the clone Clo{0,1} ({∧}), described in
Section 3.2.2.5. The list of the matrices for all clones are in Appendix D.
Inference rules, as explained in Section 2.4, are described as a set of rules, where each
rule �Γ, ϕ� ∈ R, Γ is the rule’s set of premises, whereas ϕ is the rule’s conclusion.
-- Rule �Γ, ϕ�
data Rule = Rule {
premises :: S.Set Formula, -- Γ
conclusion :: Formula -- ϕ
}
-- Inference Rules R
type InferenceRules = S.Set Rule
The example below describes the inference rules of the Hilbert calculus that axiomat-
izes the clone Clo{0,1} ({∧}), described in Section 3.2.2.5.
56
An example is the Hilbert calculus that axiomatizes the clone Clo {0,1} ({∧}), described
by p2Axiomatization.
The list of all Hilbert calculi that axiomatize each fragment of classical logic, showed
in section 3.2, are in Appendix E.
Using all these definitions, we can now implement the proposed algorithm for CMP
in Haskell, showed in the Algorithm 1, which is in the Appendix A. Consequently, we
have the algorithm for TEP, applying the CMP algorithm twice, swapping the inputs, as
explained in section 3.1. Therefore, the algorithm is:
Given that, the PLLP algorithm, showed in the Figure 2, is the following:
The Rauntenberg algorithm is similar, changing the TEP checking for a signature
equality checking, and changing the CMP checking for a signature expansion checking,
so, for each input, the output is some of the axiomatizations presented in Appendix E.
Fielding (FIELDING, 2000) introduced and defined the style of REST (Representational
State Transfer) architecture, whose central abstraction is called resource. A resource is
anything that has a URI (Uniform Resource Identifier), which is an identifier that satisfies
the formatting requirements. The model deals with an abstraction of the web architecture,
that is, it consists of rules that, when followed, allow the creation of a project with well
defined interfaces.
When we create web services using the REST architecture style, we are creating a
RESTful application. RESTful web services expose resources through URIs and use HTTP
methods to create, return, change, and delete their resources.
tablished by an application, so that other applications can use the functionality of this
application without having to know details of the software implementation. Therefore,
APIs allow interoperability between applications, in other words, communication between
applications and between users.
An API was built to facilitate communication between the site and the Haskell al-
gorithm so that the Rautenberg Algorithm was computed separately from the site in a
separate module. In addition, auxiliary routes have been created to support the other
apps of the site.
• /logic/{connectives} : The main service, which is responsible for returning the Hil-
bert calculus associated with the informed set of 2-valued operations in connectives.
Ex.: /logic/[{"symbol":"+","k":2}]
• /clomem/{clone1 }/{clone2 }/{typ} : Service responsible for check if, given the clones
on {0, 1} clone1 and clone2, if the value of typ is “one” then check if the connectives
in clone2 are in clone1, if the value of typ is “two” then check if the connectives
in clone1 are in clone2, finally, if the value of typ is “three” then check if the con-
nectives in clone2 are the same of clone1. Ex.: /clomem/[{"symbol":"*","k":
2}]/[{"symbol":"+","k":2}]/"one"
59
4.3 Website
A Website was created in order to make the following tools available to the community.
• Fragment Axiomatization – The main tool, which returns the Hilbert Calculus as-
sociated with the reported connectives. (The main algorithm of this work)
• Clone Comparison – Given the A and B connective sets, the tool checks to see if
Clo{0,1} (A) ⊆ Clo{0,1} (B), Clo{0,1} (A) ⊇ Clo{0,1} (B) or both. (CMP algorithm)
• Soundness Check – Tool that checks the soundness of the list of informed rules
according to the interpretation of the informed connectives.
5 Concluding Remarks
In order to be able to automatically extract Hilbert Calculi for classical logic frag-
ments, we implemented the PLLP, TEP and CMP algorithms, in Section 4.1, to find
which clone in the Post lattice the user is requesting the calculus.
Finally, the API containing the above algorithm, as well as other features, is available
at http://logicapi.lolita.dimap.ufrn.br/ and the website is available at http://
logicapps.lolita.dimap.ufrn.br/. Examples of use of the site can be found in the
Figures 4, 5, 6 and 7.
References
GREATI, V. Hilbert calculi for the main fragments of classical logic. Undergraduate
Monograph in Computer Science, Universidade Federal do Rio Grande do Norte, 2019.
Available at https://monografias.ufrn.br/jspui/. 2019.
-- | Given a base set as initial state A and B another base set of functions over {0,1}, determine
-- if B is in the clone generated by A.
isInClone :: (MonadThrow m) => Matrix Int -> Matrix Int -> m Bool
isInClone baseA baseB =
do
aritiesB <- return $ interpretationArities (interpretation baseB)
projections <- mapM ((flip generateProjections) (fst (values baseA))) (S.toList aritiesB)
let startState = Clone (S.fromList $ concat projections) in
evalState (isInClone_ baseB baseA) startState
-- | Given a base set as initial state A and B another base set of functions over {0,1}, determine
-- if B is in the clone generated by A.
isInClone_ :: (MonadThrow m) => Matrix Int -> Matrix Int -> State (CloneGenerationState Int) (m Bool)
isInClone_ baseB baseA =
do
fs <- get
let aritiesB = S.toList $ interpretationArities (interpretation baseB)
opsBaseA = M.elems (interpretation baseA)
opsBaseB = S.fromList $ M.elems (interpretation baseB)
-- | truth tables per arity
ttsByArity k = filter ((k==) . truthTableArity) (S.toList $ functions fs)
-- | all superpositions arity k with head tt
allsuperpose tt k = mapM (superpose tt) (replicateM (truthTableArity tt) (ttsByArity k))
-- | all superposition of arity k using heads in baseA
superposeInBase k = mapM (flip allsuperpose k) opsBaseA in
do
case mapM superposeInBase aritiesB of
Left e -> undefined
Right deltaToConcat ->
let delta = S.fromList (concat (concat deltaToConcat))
union = S.union delta (functions fs) in
if opsBaseB `S.isSubsetOf` union then
return $ return True
else if union `S.isSubsetOf` functions fs then
return $ return False
else
return $ evalState (isInClone_ baseB baseA) (Clone union)
65
connectives = [zero, one, implies, negation, and_, or_, ka, ki, ad, ak, xor, d]
-- R4 Axiomatization - 2(\lnot)
r4_1 = read "{P} | -(-(P))" :: Rule
r4_2 = read "{-(-(P))} | P" :: Rule
r4_3 = read "{P, -(P)} | Q" :: Rule
r4Axiomatization = [r4_1, r4_2, r4_3]
r4Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList r4Axiomatization)
-- R6 Axiomatization - 2(1)
r6_1 = read "{} | .()" :: Rule
r6Axiomatization = [r6_1]
r6Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList r6Axiomatization)
-- R8 Axiomatization - 2(0)
r8_1 = read "{$()} | P" :: Rule
r8Axiomatization = [r8_1]
r8Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList r8Axiomatization)
-- S2 Axiomatization - 2(v)
s2_1 = read "{P} | +(P, Q)" :: Rule
s2_2 = read "{+(P, P)} | P" :: Rule
s2_3 = read "{+(P, Q)} | +(Q, P)" :: Rule
s2_4 = read "{+(P, +(Q, R))} | +(+(P, Q), R)" :: Rule
s2Axiomatization = [s2_1, s2_2, s2_3, s2_4]
s2Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList s2Axiomatization)
-- S4 Axiomatization - 2(v, 1)
s4_0 = read "{} | .()" :: Rule
s4Axiomatization = s4_0 : s2Axiomatization
s4Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList s4Axiomatization)
71
-- S5 Axiomatization - 2(v, 0)
s5_0 = read "{+(P, $())} | P" :: Rule
s5Axiomatization = s5_0 : s2Axiomatization
s5Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList s5Axiomatization)
-- S6 Axiomatization - 2(v, 0, 1)
s6_0 = read "{} | .()" :: Rule
s6Axiomatization = s6_0 : s5Axiomatization
s6Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList s6Axiomatization)
-- P2 Axiomatization - 2(^)
p2_1 = read "{P, Q} | *(P, Q)" :: Rule
p2_2 = read "{*(P, Q)} | P" :: Rule
p2_3 = read "{*(P, Q)} | Q" :: Rule
p2Axiomatization = [p2_1, p2_2, p2_3]
p2Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList p2Axiomatization)
-- P4 Axiomatization - 2(^, 0)
p4_0 = read "{$()} | P" :: Rule
p4Axiomatization = p4_0 : p2Axiomatization
p4Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList p4Axiomatization)
-- P5 Axiomatization - 2(^, 1)
p5_0 = read "{} | .()" :: Rule
p5Axiomatization = p5_0 : p2Axiomatization
p5Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList p5Axiomatization)
-- P6 Axiomatization - 2(^, 0, 1)
p6_0 = read "{} | .()" :: Rule
p6Axiomatization = p6_0 : p4Axiomatization
p6Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList p6Axiomatization)
-- A4 Axiomatization - 2(v, ^)
a4_5 = read "{+(R, P), +(R, Q)} | +(R, *(P, Q))" :: Rule
a4_6 = read "{+(R, *(P, Q))} | +(R, P)" :: Rule
a4_7 = read "{+(R, *(P, Q))} | +(R, Q)" :: Rule
a4Axiomatization = s2Axiomatization ++ [a4_5, a4_6, a4_7]
a4Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList a4Axiomatization)
-- A2 Axiomatization - 2(v, ^, 1)
a2_0 = read "{} | .()" :: Rule
a2Axiomatization = a2_0 : a4Axiomatization
a2Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList a2Axiomatization)
-- A3 Axiomatization - 2(v, ^, 0)
a3Axiomatization = p2Axiomatization ++ s5Axiomatization
a3Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList a3Axiomatization)
-- A1 Axiomatization - 2(v, ^, 0, 1)
a1_0 = read "{} | .()" :: Rule
a1Axiomatization = a1_0 : a3Axiomatization
a1Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList a1Axiomatization)
72
f5Axiomatization = [f5_1, f5_2, f5_3, f5_4, f5_5, f5_6, f5_7, f5_8, f5_9]
f5Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList f5Axiomatization)
f1_15 = read "{+-(S, P, S), +-(S, +-(Q, A, P), S)} | +-(S, Q, S)" :: Rule
f1_16 = read "{+-(S, A, S)} | +-(S, +-(+-(P, A, Q), A, P), S)" :: Rule
f1_17 = read "{+-(S, +-(A, B, T), S)} | +-(S, +-(+-(+-(+-(R, A, P), A, +-(Q, A, P)), A,
+-(+-(R, A, Q), A, P)), B, T), S)" :: Rule
f1_18 = read "{+-(S, +-(A, B, T), S)} | +-(S, +-(+-(P, A, +-(P, A, +-(Q, A, P))), B, T), S)"::Rule
f1_19 = read "{+-(S, +-(Q, A, P), S)} | +-(S, +-(A, Q, A), S)" :: Rule
f1_20 = read "{+-(S, Q, S)} | +-(S, +-(Q, A, P), S)" :: Rule
f1_21 = read "{+-(S, +-(+-(Q, R, Q), A, P), S)} | +-(S, +-(+-(Q, A, P), +-(R, A, P), +-(Q, A, P)), S)"
:: Rule
f1_22 = read "{+-(S, +-(+-(Q, A, P), +-(R, A, P), +-(Q, A, P)), S)} | +-(S, +-(+-(Q, R, Q), A, P), S)"
:: Rule
f1_23 = read "{+-(S, +-(P, B, R), S), +-(S, +-(Q, A, P), S)} | +-(S, +-(Q, B, R), S)" :: Rule
f1_24 = read "{+-(S, +-(+-(R, B, Q), A, P), S)} | +-(S, +-(+-(R, A, P), +-(R, P, Q), +-(R, A, Q)), S)"
:: Rule
f1_25 = read "{+-(S, +-(+-(R, A, P), +-(R, P, Q), +-(R, A, Q)), S)} | +-(S, +-(+-(R, B, Q), A, P), S)"
:: Rule
f1Axiomatization = [f1_1, f1_2, f1_3, f1_4, f1_5, f1_6, f1_7, f1_8, f1_9, f1_10, f1_11, f1_12, f1_13,
f1_14, f1_15, f1_16, f1_17, f1_18, f1_19, f1_20, f1_21, f1_22, f1_23, f1_24, f1_25]
f1Signature = fromRight M.empty $ sigmaFromConseqRelation (S.fromList f1Axiomatization)