1. Introduction
The desire to create an automaton capable of imitating human behavior is long-standing. In ancient Greece, Philon of Byzantium developed an automaton in the form of a life-size maid to serve wine and water mixed in exact proportions [Vasileiadou and Kalligeropoulos, 2007].
Since decision-making is an integral part of human life, an effort to develop machines capable of not only imitating, but also reasoning and solving problems has generated interest in the philosophy, science, engineering and media. Technological evolution allowed the search for systems capable of imitating human reasoning to gain attention after the mid-20th century [Foote, 2022].
Artificial intelligence (AI) brings together all approaches and tools that add the capacity of computer systems to perform tasks associated with human intelligence, such as learning, reasoning, problem solving, perception, identification, analysis, association, diagnosis and decision making [Jiang et al., 2022].
Classical formal logic is one of the pillars of computational systems and, by extension, one of the fundamental tools used in the development of AI algorithms [Thomason, 2024]. This logic does not accept contradiction. But the real world does not work like that.
Contradictions appear as different fields of science evolve and become more complex. Since Heraclitus in ancient Greece, several philosophers have dedicated efforts to the study of contradiction, which allowed the emergence of several non classical logic, such as Fuzzy, Dynamic Semantics, Quantum, and Paraconsistent Logic (PL) [De Carvalho Junior et al., 2024].
PL includes inconsistencies in its structure, allowing contradictory situations to be handled without incurring triviality [Da Silva Filho et al., 2011]. Paraconsistent Annotated Logic by 2-value annotation (PAL2v), sometimes also referred to as Paraconsistent Annotated Evidential logic (PAL ϵτ), makes use of two values, or degrees of evidence, to better express knowledge about a proposition [Da Silva Filho, 2012]. Researchers’ interest in PAL2v to develop systems capable of dealing with conflicting, contradictory, uncertain, or noise-contaminated data has increased. PAL2v has been used in several areas of human reasoning, such as biology, logistics, statistical process control, robotics, expert systems, and AI [De Carvalho Junior et al., 2024].
Algorithms built with PAL2v have been used in a wide variety of applications, such as for the characterization of skin cancer lesions [Garcia et al., 2019] and choosing the best route in data communication systems [Da Silva Filho et al., 2021]. Artificial neural networks (ANN) built with PAL2v neurons, or paraconsistent neural networks (PNN), were used for identification [De Carvalho Junior et al., 2021] and control of rotating inverted pendulum systems [De Carvalho Junior et al., 2023], and for the Detection of nitrogen oxide emissions (NOx) in Petrochemical Combustion Systems [Rodrigues et al., 2024]. Recently, a new technology for gesture recognition using surface electromyography (sEMG) signals designed with random forest algorithms using PAL2v (Paraconsistent Random Forest - PRF) [Favieiro and Balbinot, 2019] showed promising results, compared to other techniques [Favieiro et al., 2025].
Here we propose and describe Paraconsistent-Lib, a userfriendly Python library to support the development of PAL2v reasoning, the outputs, and examples of application. The paper is structured as follows: In
Section 2, we provide a review of PAL2v, while in
Section 3, we describe the implementation details of the Paraconsistent-Lib. In
Section 4, we describe the two examples of the application of Paraconsistent-Lib. Finally, in
Section 5, we draw some final remarks and provide insights into future developments of the library.
2. PAL2v Review
PL receives the term “annotated” (PAL) when the evidence of a proposition P is represented by annotation through a lattice of four vertices [Da Silva Filho, 2012]. The four extreme logic states indicated at the vertices of the PAL lattice are True (t), False (F), Paracomplete (⊥), and Inconsistent (⊤) [De Carvalho Junior et al, 2024].
PAL2v uses an ordained pair of values (
µ1,
µ2), normalized between [0,1], to deliver greater precision in representing the evidence of a proposition
P in a lattice diagram. The first input,
µ, (or
µ1) represents the degree of favorable evidence. The complement of the second input (
µ2), is named the degree of unfavorable evidence (
λ), calculated by Equation (1).
Through transformations in a Unitary Quadrant of the Cartesian Plane (UQCP) and some algebraic interpretations, as well explained in [Da Silva Filho, 2012], The PAL2v result in coordinate form
ϵτ = (
DC,DCT) can be obtained, according to Equation (2) and Eq (3).
Figure 1 presents the projection of
μ and
λ values inside the PAL2v lattice, the horizontal (
DC) and vertical (
DCT) axes, and ετ(
DC,DCT) output.
where
DC is the certainty degree, and
DCT is the contradiction degree, with values in the interval of [-1,1]. The range of certainty values in which the
DC can vary without being limited by
DCT, called certainty interval (
φ) is calculated by Equation (4).
A single PAL2v output can be obtained by reducing the contradictions to calculate the projection of vector (
D) on the
Dc axis, known as the real certainty degree (
DCR). This can be calculated according to Eqs. (5) to (7). The center of the PAL2v lattice, where both
Dc and
DCT are equal to zero is called “undefined”.
In the Para-analyzer algorithm, the PAL2v diagram divided by regions, called paraconsistent logical states. The most common application is to consider 12 logical states. This algorithm can be used for classification or in the decision-making process, as used to decide the direction of robots [De Carvalho Junior et al, 2024].
Figure 2 presents the four maximum corners (t, F, ⊤,⊥) and the internal eight logical states.
More complex algorithms can be designed, such as the
ParaExtrCTX, PAL2v Filter, paraconsistent analysis network (PANnet) and paraconsistent neural networks (PNN) if the PAL2v results are normalized in the interval [0,1], as Eqs. (8) to (11), and built in form of a structured code, called paraconsistent analysis node (PAN) [De Carvalho Junior et al, 2024].
Figure 3 presents the PAN symbol.
Paraconsistent artificial neural cells (PANC) can be built by adding rules and equations to the basic PAN. The most common are the standard paraconsistent artificial neural cell (PANCS), paraconsistent neural cell of learning (PANCL), the cell of learning by contradiction extraction (PANCLCTX) and the decision cell (PANCD) [Da Silva Filho 2012, De Carvalho Junior et al, 2024].
One direct application of the PAN is the
ParaExtrCTX [Da Silva Filho et al, 2011]. It consists of a recurrent analysis of a numerical vector dataset by a PAN, as the flowchart presented in
Figure 4. This algorithm works according to the following steps:
First, the dataset is normalized between [0,1].
Take the highest (μmax) and lowest (μmin) values of the dataset.
Let μ = μmax. Let λ = μmin.
Calculate μER.
Remove from the dataset the values used in the PAN analysis.
Add the current μER to the dataset.
Return to step 2 until only one value remains in the dataset, which will be the final output of the ParaExtrCTX analysis.
ParaExtrCTX is good to extract contradictions between samples of the same measurement or variable [De Carvalho Junior et al, 2024].
Figure 4.
ParaExtrCTX flowchartl.
Figure 4.
ParaExtrCTX flowchartl.
3. Paraconsistent-Lib Overview
Paraconsistent-Lib implements PAL2v rules and equations, enabling the modeling of reasoning systems that naturally deal with inconsistencies and uncertainties. The library offers a modular architecture based on pluggable logic blocks, facilitating the composition of complex inference networks [Da Cruz; Alves; Carvalho Junior, 2025]. It was designed and tested in Python 3.9 or superior releases, and can be installed as:
pip install paraconsistent
Paraconsistent-Lib requires just three inputs: µ and λ values and a factor of control called FtC. The default value is 0.5. This variable is involved in 2 key aspects.
In the current version, Paraconsistent-Lib can deliver outputs as a Para-analyzer, offering the results of the 12 states, a PAN offering all the outputs calculated as the Eqs. (1) to (11) or a PANCd. It is important to use the correct notation for inputs and outputs when using the Paraconsistent-Lib, as presented in
Table 1.
Table 1.
Fields and terms of Paraconsistent-Lib.
Table 1.
Fields and terms of Paraconsistent-Lib.
4. Applications
In this section we present some examples of how to use the Paraconsistent-Lib and applications.
4.1. Testing the Library
The following code is a simple demonstration of how to use the Paraconsistent-Lib. After importing the library, a PAL2v block called “b” is created. Then we set the FtC, µ and λ values. subsequently, all output variables are displayed, or just one of them (µER in this case).
Figure 6 present the results. Note that output “Regions” shows 11 logical states as “False” and only one as “True”, while “label” output presents only the true state (
Q┬→t in this case).
4.2. ParaExtrCTX Algorithm for Network Delay Estimation
The most common network test is the “ping” command, which sends Internet Control Message Protocol (ICMP) requests and wait for responses. The size and number of messages can be configured. Normally the number of packets sent, received, and lost are informed, as well as the maximum, minimum, and average delay. This information can be used to evaluate the quality of access to servers, the connection service, especially those sensitive to delays such as streaming, and to diagnose network infrastructure in a local area (LAN) or long distance (WAN).
Here we present a direct use of the
ParaExtrCTX, to present an alternative and more effective metric instead of the simple arithmetic mean, after extracting contradictions from a set of samples. The full algorithm is available in
Appendix A.
The algorithm starts requesting the Internet Protocol (IP) address or HyperText Markup Language (HTML) link, the number, and size of packets. The default values are the google address (
www.google.com), 10 packets of 500 Bytes each. Them, the algorithm normalize the delay values, run the
ParaExtrCTX, denormalizes, and presents the results, as the example in
Figure 7 for the Cloudflare Domain Name Server (DNS), from the script running in Google Colab notebook. By extracting contradictions between values,
ParaExtrCTX tends to present more conservative results than arithmetic mean.
4.3. PANnet For Best Route Selection
Another way to use the Paraconsistent-Lib is to design and build PANnets. Here, inspired by [Da Silva Filho et al., 2021], we present a simple algorithm using the Paraconsistent-Lib to build a PANnet of four cells, analyzing the network parameters and providing the selection of the right route using the decision_output (S1) at the last cell.
The topology of the PANnet is presented in
Figure 8. In this case, a PANnet analyzes five metrics to present one single indicator (
S1) of the best route A or B. The weight of the decision (
μER4) is also provided. If
μER4 is higher than
FtC, route A is selected. If
μER4 is lower than
FtC, route B is the best choice. But if
μER4 is equal to
FtC, it is undefined, so keep the previous selected route.
The five categories are the normalized values of:
Complement of Reception jitter (μ1).
Transmission jitter (λ1).
Complement of average round trip time (RTT) of the route (μ2).
Processing consumption (λ2), and
Complement of Packet loss (μ3).
The PANnet for the proposed topology is as simple as the following code.
# Create the PANnet
PAN1.input.mu = mu1
PAN1.input.lam = lam1
PAN2.input.mu = mu2
PAN2.input.lam = lam2
PAN3.input.mu = mu3
PAN3.input.lam = PAN1.complete.muER
PAN4.input.mu = PAN3.complete.muER
PAN4.input.lam = PAN2.complete.muER
Appendix B present the entire code. The rest of code is to collect the data, normalize the values and print the results.
Figure 9 presents 3 examples.
5. Conclusions
Paraconsistent-Lib is a novel library that addresses the need of having a simple, practical, open-source, Python API to support the creation of PAL2v reasoning. Users can define just the pair of evidences (μ,λ) and one factor of adjustMENT (FtC) to get three types of outputs. One of the 12 states of the Para-analyser, values of most standard PAN equations including (DC, DCT, DCR, μE, μECT, μER, φ) or a decision from PANCD. Paraconsistent-Lib is a valuable addition to the open-source software that supportS PAL2v reasoning, and it is expected to highly facilitate the definition, analysis and interpretation of paraconsistent analysis in a wide variety of AI, decision making, data and knowledge-driven applications. Three examples of applications were also explored in this paper, to encourage researchers who plans to consider PAL2v in their projects to use this novel library, by making the code design easier. In future releases, we plan to extend Paraconsistent-Lib to support additional PAL2v rules and equations to include other types of PAL2v algorithms and PANCs.
Appendix B


References
- VASILEIADOU, Soultana; KALLIGEROPOULOS, Dimitrios. Myth, theory and technology of automatic control in ancient Greece. In: 2007 European Control Conference (ECC). IEEE, 2007. p. 249-256. [CrossRef]
- FOOTE, Keith D. The history of machine learning and its convergent trajectory towards AI. Machine learning and the city: Applications in architecture and urban design, p. 129-142, 2022. [CrossRef]
- JIANG, Yuchen et al. Quo vadis artificial intelligence?. Discover Artificial Intelligence, v. 2, n. 1, p. 4, 2022. [CrossRef]
- THOMASON, Richmond, Logic-Based Artificial Intelligence, The Stanford Encyclopedia of Philosophy, 2024, Edward N. Zalta & Uri Nodelman (eds.). Available at: <https://plato.stanford.edu/archives/spr2024/entries/logic-ai/>. Access in: nov 13, 2025.
- DE CARVALHO JUNIOR, Arnaldo et al. A comprehensive review on paraconsistent annotated evidential logic: Algorithms, Applications, and Perspectives. Engineering Applications of Artificial Intelligence, v. 127, p. 107342, 2024. [CrossRef]
- DA SILVA FILHO, Joao Inacio et al. Paraconsistent algorithm extractor of contradiction effects-paraextrctrctr. Journal of Software Engineering and Applications, v. 4, n. 10, p. 579-584, 2011. [CrossRef]
- GARCIA, Dorotéa Vilanova et al. Analysis of Raman spectroscopy data with algorithms based on paraconsistent logic for characterization of skin cancer lesions. Vibrational Spectroscopy, v. 103, p. 102929, 2019. [CrossRef]
- DA SILVA FILHO, João Inácio et al. Paraconsistent annotated logic algorithms applied in management and control of communication network routes. Sensors, v. 21, n. 12, p. 4219, 2021. [CrossRef]
- DA SILVA FILHO, João Inácio. Treatment of uncertainties with algorithms of the paraconsistent annotated logic. Journal of Intelligent Learning Systems and Applications, v. 4, n. 2, p. 144-153, 2012. Available at: https://d1wqtxts1xzle7.cloudfront.net/33131119/Treatment_of_Uncertainties_with_Algorithms_of_the_Paraconsistent_Annotated_Logic-libre.pdf. Access in nov 14, 2025. [CrossRef]
- DE CARVALHO, Arnaldo et al. Rotary inverted pendulum identification for control by paraconsistent neural network. IEEE Access, v. 9, p. 74155-74167, 2021. [CrossRef]
- DE CARVALHO JUNIOR, Arnaldo et al. Model reference control by recurrent neural network built with paraconsistent neurons for trajectory tracking of a rotary inverted pendulum. Applied Soft Computing, v. 133, p. 109927, 2023. [CrossRef]
- RODRIGUES, Marcos Carneiro et al. Paraconsistent Artificial Neural Network (PANnet) applied to the Detection of (NOx) Nitrogen Oxides Emissions in Petrochemical Combustion Systems. Brazilian Archives of Biology and Technology, v. 67, p. e24240601, 2024. [CrossRef]
- 13. FAVIEIRO, Gabriela W.; BALBINOT, Alexandre. Paraconsistent random forest: An alternative approach for dealing with uncertain data. IEEE Access, v. 7, p. 147914-147927, 2019. [CrossRef]
- FAVIEIRO, Gabriela Winkler; TOSIN, Maurício Cagliari; BALBINOT, Alexandre. A strategy based on paraconsistent random forest for sEMG gesture recognition systems robust to contaminated data. Computers in Biology and Medicine, v. 195, p. 110596, 2025. [CrossRef]
- DA CRUZ, Diego Oliveira; ALVES, Bruno. Da Silva; CARVALHO JUNIOR, Arnaldo. Paraconsistent-Lib, Python Library, EAILAB, IFSP, Sao Paulo - Brazil, 2025. Available at: https://eailab-ifsp.github.io/Paraconsistent-Lib/. Access in nov 14, 2025.
|
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).