Nonredundant implicational base of formal context with constraints using SAT
 Published
 Accepted
 Received
 Academic Editor
 GuiBin Bian
 Subject Areas
 Artificial Intelligence, Data Mining and Machine Learning, Data Science
 Keywords
 Implicational base, Formal context, SAT problem, Attribute implication, Formal concept analysis
 Copyright
 © 2024 Hidayat et al.
 Licence
 This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, reproduction and adaptation in any medium and for any purpose provided that it is properly attributed. For attribution, the original author(s), title, publication source (PeerJ Computer Science) and either DOI or URL of the article must be cited.
 Cite this article
 2024. Nonredundant implicational base of formal context with constraints using SAT. PeerJ Computer Science 10:e1806 https://doi.org/10.7717/peerjcs.1806
Abstract
An implicational base is knowledge extracted from a formal context. The implicational base of a formal context consists of attribute implications which are sound, complete, and nonredundant regarding to the formal context. Nonredundant means that each attribute implication in the implication base cannot be inferred from the others. However, sometimes some attribute implications in the implication base can be inferred from the others together with a prior knowledge. Regarding knowledge discovery, such attribute implications should be not considered as new knowledge and ignored from the implicational base. In other words, such attribute implications are redundant based on prior knowledge. One sort of prior knowledge is a set of constraints that restricts some attributes in data. In formal context, constraints restrict some attributes of objects in the formal context. This article proposes a method to generate nonredundant implication base of a formal context with some constraints which restricting the formal context. In this case, nonredundant implicational base means that the implicational base does not contain all attribute implications which can be inferred from the others together with information of the constraints. This article also proposes a formulation to check the redundant attribute implications and encoding the problem into satisfiability (SAT) problem such that the problem can be solved by SAT Solver, a software which can solve a SAT problem. After implementation, an experiment shows that the proposed method is able to check the redundant attribute implication and generates a nonredundant implicational base of formal context with constraints.
Introduction
Formal context is a simple data type representing data. A formal context consists of a set of objects, a set of attributes, and a relation between both sets. The relation shows which attributes belong to each object. Visually, a formal context can be represented by a cross table where rows represent objects, columns represent attributes, and cells represent the relation (Ganter & Wille, 1999; Wille, 2005; Škopljanac Mačina & Blašković, 2014; Rocco, HernandezPerdomo & Mun, 2020; Bhuyan, Karmakar & Hazarika, 2018). Figure 1 is an example of formal context represented by a cross table.
Formal concept analysis (FCA) studies how to extract knowledge from a formal context and has been applied to many areas of data since a formal context is capable to represent any kinds of data. Some research has been conducted to extract knowledge from any data which is formulated in a formal context (Moulahi, 2021; Xu et al., 2019; Marín et al., 2021; Gély et al., 2022; Yan & Li, 2022; Zou et al., 2020; Janostik & Konecny, 2020; Atencia et al., 2020; Kötters & Eklund, 2020; Rocco, HernandezPerdomo & Mun, 2020; Kumar Mishra, Joshi & Mathur, 2020; Albahli & Melton, 2016). Therefore, formal concept analysis has been considered to be a method in knowledge discovery (Kumar, 2011).
Furthermore, formal concept analysis is promising method in knowledge discovery. Some research of application of formal concept analysis includes knowledge extraction, knowledge representation, and using of extracted knowledge. As a method in knowledge discovery, application of formal concept analysis and formal context covers many research domains including computer science and other domains. In computer science, some studies were successful to apply formal concept analysis for solving some problems in many subdomains, e.g., datamining (Aragón, Medina & RamírezPoussa, 2022; Hao et al., 2023), machine learning (Janostik, Konecny & Krajča, 2022), data science (Bazin et al., 2022), intelligent system (Shao et al., 2023), information retrieval (OjedaHernández, LópezRodríguez & Mora, 2023; Khattak et al., 2021), natural language processing (Marín et al., 2021; Jain, Seeja & Jindal, 2020), decision support system (Wei et al., 2020), recommendation system (Liu et al., 2022), semantic web (Jindal, Seeja & Jain, 2020), cloud computing (Khemili, Hajlaoui & Omri, 2022), data structure (Ferré & Cellier, 2020), mobile application (Kwon et al., 2021), software engineering (Carbonnel et al., 2020), and robotic (Zhang et al., 2023). In addition, some successful studies to apply formal concept analysis were in other domains, e.g., engineering (Rocco, HernandezPerdomo & Mun, 2020), mathematics (Jäkel & Schmidt, 2022; Rocco, HernandezPerdomo & Mun, 2020), biology (Gély et al., 2022), psychology (Belohlavek & Mikula, 2022), medicine (Md Saleh, Ab Ghani & Jilani, 2022), business (Wajnberg et al., 2018; Ravi, Ravi & Prasad, 2017; Acharjya & Das, 2017), and social science (Lang & Yao, 2023; Hao et al., 2021; Gao et al., 2021).
Implicational base is a kind of knowledge generated from formal context (Wille, 2005; Hidayat, bin Ahmad & Ishak bin Desa, 2021; Škopljanac Mačina & Blašković, 2014; Ganter & Obiedkov, 2016). Implicational base of a formal context is a set of attribute implications which are sound, complete, and nonredundant. Sound means that all of the attribute implications holds the formal context. Complete means that any attribute implications, which also hold the formal context, can be inferred from some attribute implications in the set. Nonredundant means that there is no attribute implication in the set which can be inferred from the others. Attribute implication is knowledge in the form of rule showing attribute dependencies. Some research in application of formal concept analysis extracted knowledge in this form Baixeries et al. (2018), Wei et al. (2020) and Dubois et al. (2021).
Recently, reducing generated knowledge for increasing its quality is concerned in formal concept analysis. Moreover, the size of the knowledge is sometime very large (Mouakher & Ben Yahia, 2019; Kuznetsov & Makhalova, 2018). The objective of this concern is to obtain interesting knowledge only. Some studies used prior knowledge to achieve it Pang et al. (2023), Zou et al. (2020), Ch, Dias & Vieira (2015). The prior knowledge is used as background knowledge in the process of formal concept analysis. Several studies used background knowledge to remove redundant knowledge which can be inferred from the background knowledge (Hidayat, bin Ahmad & Ishak bin Desa, 2021; Krishnan & Cherukuri, 2019; Sumangali & Kumar, 2019; Stumme, 1996; Belohlávek & Vychodil, 2008a; Viaud et al., 2016). An example of this study is to generate nonredundant implicational base (Hidayat, bin Ahmad & Ishak bin Desa, 2021; Hidayat, 2005). In the nonredundant implicational base, some attribute implications in an implicational base are ignored if they can be inferred from some other attribute implications together with the background knowledge (Hidayat, bin Ahmad & Ishak bin Desa, 2021; Hidayat, 2005). In Hidayat, bin Ahmad & Ishak bin Desa (2021), the problem to check whether an attribute implication is implied by some other attribute implications together with background knowledge is called a backgroundinferring problem.
A constraint is another form of prior knowledge which will cause redundant knowledge. A constraint is restriction of data and the data has to satisfy the constraint. In case of formal context, a constraint restricts some attributevalues of a formal context. An example of constraint in formal concept analysis is attribute dependency (Belohlávek, Sklenar & Zacpal, 2004; Belohlávek & Sklenar, 2005; Belohlávek & Vychodil, 2008b) where values of some attributes depend on another or some others. Let a formal context satisfy some constraints. This implies that information of the constraints will exist in the formal context. Unfortunately, the information will appear in an implicational base as generated knowledge in formal concept analysis. In other words, the implicational base will contain some attribute implications which can be inferred from the others together with information of the constraints. The attribute implications can be considered as redundant attribute implications based on the constraints.
To improve the quality of implicational base, it is necessary to remove the kind of redundant attribute implications. Thus, the implicational base becomes nonredundant based on some constraints. The important problem in this case is to check whether an attribute implication is redundant. In this article, it will be called constraintinferring problem.
The next problem is how to solve the constraintinferring problem. It is very important in implementation to solve the problem. An alternative solution is to encode the problem into satisfiability problem (SAT problem) such that it can be solved by the SAT solver, a specific software to solve the SAT problem. Recently, many SAT solvers can solve SAT problems with a large number of both clauses and variables in reasonable time. In Hidayat, bin Ahmad & Ishak bin Desa (2021) the backgroundinferring problem is successfully encoded into SAT (satisfiability) problem. The SAT problem is an interesting problem in computer science which is NPcomplete (Biere et al., 2009). Many studies concerning this area have been conducted (Sohanghpurwala, Hassan & Athanas, 2017) where some of the studies do not only concern in the theoretical aspect but also in implementation and application (Ojeda, 2023; Zha, Chang & Noda, 2022; Alonso, Sánchez & SánchezRubio, 2022; Ramamoorthy & Jayagowri, 2021; Mayank & Mondal, 2020). Some algorithms and some SAT solvers have been developed to solve the SAT problem (Fu et al., 2022; Berend, Golan & Twitto, 2022; Bian et al., 2020; Li et al., 2020; Molnár et al., 2020).
This article will propose a method to generate a nonredundant implicational base of formal context together with some constraints using SAT. This article will also propose a formulation of constraint which is suitable for any constraints and formal contexts such that it will be easy to define a constraintinferring problem and to encode the problem into SAT problem. The proposed method will use a SAT solver to solve the SAT problem.
Foundation
Formal context
We will define some terminologies related to formal context. For the definition of formal context, we rewrite some definitions from our previous works in Hidayat, bin Ahmad & Ishak bin Desa (2021). A formal context is defined as triple $(G,M,I)$ which represents a finite set of objects G, a finite set of attributes M, and a relation I between G and M. The relation I shows some attributes belonging to each object.
Definition 1. A formal context is defined as a triple $(G,M,I)$ which consists of two nonempty sets G and M, and a relation $I\subseteq G\times M$. G is a set of objects, whereas M is a set of attributes. For $g\in G$ and $m\in M$, $(g,m)\in I$ or $gIm$ means that the object $g$ has the attribute $m$ (Ganter & Wille, 1999; Wille, 2005; Škopljanac Mačina & Blašković, 2014).
A cross table can represent a formal context $(G,M,I)$, with rows representing G and columns representing M. A cell of the table in row $g$ and column $m$ represents a relation I of object $g\in G$ and attribute $m\in M$. We cross the cell if $(g,m)\in I$. Recall Fig. 1. The figure shows a formal context of “bodies of water” (Wille, 2005).
Definition 2. If $A\in G$ is a set of objects of a formal context $(G,M,I)$, then Ganter & Wille (1999), Wille (2005), Škopljanac Mačina & Blašković (2014):
(1) $${A}^{I}=\{m\mid (g,m)\in I,\mathrm{\forall}g\in A\}$$
Reversely, if $B\subseteq M$ is a set of attributes, then:
(2) $${B}^{I}=\{g\mid (g,m)\in I,\mathrm{\forall}m\in B\}$$
Notation ${A}^{II}$ refers to $({A}^{I}{)}^{I}$.
The symbol I in $(.{)}^{I}$ refers to I in the formal context $(G,M,I)$. If $A\subseteq G$ then ${A}^{I}$ means “all attributes that belong to all objects in A”. If $B\subseteq M$ then ${B}^{I}$ means that “all objects that have all attributes in B”.
Definition 3. A manyvalued context is a quadruple $(G,M,W,I)$ which consists of a set of objects G, a set of attributes M, a set of attribute values W, and a ternary relation $I\subseteq G\times M\times W$ where $(g,m,w)\in I$ and $(g,m,v)\in I$ implies $w=v$ (Ganter & Wille, 1999; Ganter, 1996; Hidayat, 2005).
A triple $(g,m,w)\in I$ means that attribute $m\in M$ of object $g\in G$ has values $w\in W$.
In the real world, most of the data is in the manyvalued context. However, methods in the formal context analysis are only applied to the onevalued context of a formal context. Therefore, we need to transform the manyvalue context into a onevalued context. Scaling is a method to transform a manyvalued context into a onevalued context.
A scaling transforms a manyvalued context into a onevalued context by some scales which are also formal contexts. We call the onevalued context a derived context (Ganter & Wille, 1999; Wille, 2005).
Definition 4. A scale for attribute $m\in M$ of a manyvalued context $(G,M,W,I)$ is a onevalued context ${S}_{m}=({G}_{m},{M}_{m},{I}_{m})$ with ${G}_{m}\subseteq \{w\mid (g,m,w)\in I,g\in G\}$ (Ganter & Wille, 1999; Wille, 2005).
A scale ${S}_{m}=({G}_{m},{M}_{m},{I}_{m})$ interprets some values in ${G}_{m}$ of an attribute $m$ to some new attributes ${M}_{m}$. ${I}_{m}$ represents the interpretation.
Definition 5. A derived context in the scaling of the manyvalued context $(G,M,W,I)$ and scales ${S}_{m}$ for all $m\in M$ is a context $(G,N,J)$ where (Wille, 2005)
(3) $$N=\bigcup _{m\in M}{M}_{m}$$and for $g\in G$ and $n\in N$:
(4) $$(g,n)\in J\phantom{\rule{thickmathspace}{0ex}}if\phantom{\rule{thickmathspace}{0ex}}and\phantom{\rule{thickmathspace}{0ex}}only\phantom{\rule{thickmathspace}{0ex}}if\phantom{\rule{thickmathspace}{0ex}}(g,m,w)\in I\phantom{\rule{thickmathspace}{0ex}}and\phantom{\rule{thickmathspace}{0ex}}(w,n)\in {I}_{m}$$
Attribute implication and implicational base
An attribute implication over formal context $(G,M,I)$ is in the form $A\Rightarrow B$ where $A,B\subseteq M$. $A\Rightarrow B$ means that every object having all attributes in A has also all attributes in B. The attribute implication holds in the formal context if and only if each object respects it Ganter & Wille (1999). An object $g\in G$ respect the attribute implications if and only if the set of its attributes is a model of the attribute implication.
Definition 6. Let $A,B,T\subseteq M$. T is a model of attribute implication $A\Rightarrow B$ if and only if $A\u2288T$ or $B\subseteq T$ (Ganter & Wille, 1999; Wille, 2005).
Definition 7. An object $g\in G$ respects $A\Rightarrow B$ over $(G,M,I)$ if and only if $\{g{\}}^{I}$ is a model of the attribute implication (Ganter & Wille, 1999; Wille, 2005).
An attribute implication holds a formal context $(G,M,I)$ if each object $g\in G$ respects the attribute implication.
Let $\mathcal{L}$ a set of attribute implications over a formal context $(G,M,I)$. We call $\mathcal{L}$ an implicational base of the formal context if the set is sound, complete, and nonredundant.
Definition 8. A set of attribute implications $\mathcal{L}$ is an implicational base of formal context $(G,M,I)$ if the following holds: (Ganter & Wille, 1999; Wille, 2005)
sound, if each attribute implication in $\mathcal{L}$ holds the formal context
complete, if there is no attribute implication which holds the formal context, unless the attribute implication can be inferred from some attribute implications in $\mathcal{L}$, and
nonredundant, if there is no attribute implication in $\mathcal{L}$ which can be inferred from the others in $\mathcal{L}$.
Implicational base of manyvalued context
In manyvalued context, we define the backgroundinferring problem which is whether an attribute implication holding in its derivedcontext is implied by the other ones holding also in the derivedcontext together with its scales.
Definition 9. Let $\mathcal{L}$ a set of attributes implications which hold in the derived context from a manyvalued context $(G,M,W,I)$ and scales ${S}_{m}$ for all $m\in M$, $\mathcal{H}$ information representing the scales, and $A\Rightarrow B$ an attribute implication which also holds in the derived context. The backgroundinferring problem is whether (Hidayat, bin Ahmad & Ishak bin Desa, 2021):
(5) $$\mathcal{L}\cup \mathcal{H}\models A\Rightarrow B$$
It means that all models of $\mathcal{L}$ and $\mathcal{H}$ are also models of $A\Rightarrow B$ (Ganter, 1996; Hidayat, bin Ahmad & Ishak bin Desa, 2021).
Constraint
A constraint on a set of variables is a restriction on the values that they can take simultaneously. A constraint can be represented in many ways. However, a constraint can be represented as a set which contains all the legal compound labels for the subject variables (Tsang, 2014).
Definition 10. Let W a finite set of variables and ${D}_{x}$ a domain of $x\in W$. A label in W is a pair $<x,v>$ where $x\in W$ and $v\in {D}_{x}$, which means that a value $v$ is assigned to a variable $x$ (Tsang, 2014).
Definition 11. Let $<{x}_{i},{v}_{i}>$ a label in W. A compound label over W is
(6) $${L}_{W}=\left(<{x}_{1},{v}_{1}>,<{x}_{2},{v}_{2}>,\dots ,<{x}_{n},{v}_{n}>\right)$$
which means that values ${v}_{1}$, ${v}_{2}$, $\dots $, ${v}_{n}$ are assigned to variables ${x}_{1}$, ${x}_{2}$, $\dots $, ${x}_{n}$, respectively (Tsang, 2014).
Definition 12. Let $S=\{{x}_{1},{x}_{2},\dots ,{x}_{n}\}$. A constraint on set S, denoted by ${C}_{s}$, is a set of legal compound labels, where each compound label is in the form of $\left(<{x}_{1},{v}_{1}>,<{x}_{2},{v}_{2}>,\dots ,<{x}_{n},{v}_{n}>\right)$ (Tsang, 2014).
Definition 13. Let S and W finite sets. A compound label ${L}_{W}$ satisfies ${C}_{S}$ if there is a compound label $L\in {C}_{S}$ such that every pair $<x,v>$ in L is also a pair in ${L}_{W}$ (Tsang, 2014).
Methods
Figure 2 shows steps of this research. Explanations of the steps are as follows:
1. Constraints formulation
In this step, we formalize constraints for a formal context mathematically. A constraint will be represented by a mathematical model. The model has to be concise such that it can represent all possible constraints for any formal contexts. Furthermore, we represents the model into a formal context.
Representation of constraints is needed in this research such that it can represent any real problem of constraints where a formal context satisfies. In addition, the representation will be used to define constraintinferring problem which is next step of this research.
2. Constraintinferring problem defining
In this step, we will define the constraintinferring problem. The constraintinferring problem is whether an attribute implication of implicational base of formal context can be inferred from the others together with some constraints which the formal constraint satisfies. In this step, we also propose an encoding of the problem into SAT problem. By the encoding, we can express the constraintinferring problem into an equivalent SAT problem. We will solve the constraintinferring problem by solving the SAT problem using SAT Solver.
Constraintinferring problem definition and encoding into SAT problem is required by the proposed method which will generate a nonredundant implicational base. It will be implemented as a procedure to detect a redundant attribute implication, an attribute implication which can be inferred from the others together with constraints, such that the proposed method will ignore and remove the attribute implication from implicational base.
3. Implementation
We develop a method and a software code to generate a nonredundant implicational base of formal context with constraints. The main part of the software is to solve constraintinferring problem for each attribute implication. For this purpose, the software will encode the problem into the SAT problem then solve it by a SAT solver.
Using this implementation, we will do experiments to prove that the proposed method is able to generate nonredundant implications correctly.
4. Experiment
We perform an experiment to generate a nonredundant implicational base of some formal contexts where there are some constraints which the formal context satisfies. This experiment also show how the proposed method is exactly able to remove all redundant attribute implications.
Preliminary result of this research had been presented in the IEEE 6th International Conference on Information Technology to obtain some comments and suggestions from scientific community. Thus, some portions of text in this article were previously published as a part of article presented in the conference (Hidayat, 2013). Part of this research which were presented in the conference article are formulation of constraints, defining of constraintinferring problem, and encoding the constraintinferring problem into the SAT problem. From the parts, we develop a method to generate a nonredundant implicational base, implement or code the method into Java programming language, and conduct experiment.
Formal context with constraints
Constraints for a formal context
Suppose we have a formal context $(G,M,I)$. We define a variable set $S=\{{x}_{P}\mid P\subseteq M\}$ where the domain for each variable ${x}_{P}$ is ${D}_{P}={2}^{P}$. Now we can give a constraint to restrict some attributes of $P\subseteq M$ for each object in G. A constraint can be written as follows:
(7) $${C}_{\{{x}_{P}\}}=\{(<{x}_{P},{v}_{P}>)\mid {v}_{P}\in D\}$$where $D\subset {D}_{P}$ consisting allowed values to ${X}_{P}$.
Example 1. Recall the formal context of “Bodies of Water” in Fig. 1. From the existing knowledge, there are some restrictions for some attributes. Attribute stagnant and attribute running, for example, have a restriction that each object absolutely has only one of both attributes. Objects tarn, lagoon, and lake, for instances, have attribute stagnant but do not have attribute running, whereas objects trickle, stream, and torrent, for instances, have attribute running but do not have attribute stagnant. Attribute inland and attribute maritime have a similar restriction, and also attribute constant and attribute temporary. Therefore, we have three constraints for the formal context.
Let:
${P}_{1}=\{stagnant,running\}$
${P}_{2}=\{inland,maritime\}$, and
${P}_{3}=\{constant,temporary\}$.
Then, the constraints can be defined as follows:
${C}_{\{{x}_{{P}_{1}}\}}=\{(<{x}_{{P}_{1}},\{stagnant\}>),(<{x}_{{P}_{1}},\{running\}>)\}$
${C}_{\{{x}_{{P}_{2}}\}}=\{(<{x}_{{P}_{2}},\{inland\}>),(<{x}_{{P}_{2}},\{maritime\}>)\}$
${C}_{\{{x}_{{P}_{3}}\}}=\{(<{x}_{{P}_{3}},\{constant\}>),(<{x}_{{P}_{3}},\{temporary\}>)\}$
An object $g\in G$ satisfies a constraint ${C}_{\{{x}_{P}\}}$ if the attributes combination belonging to $g$ in $P\subseteq M$ is a value assigned to ${x}_{P}$ in the constraint. For example, object $tarn$ satisfies three constraints in Example 1 since attributes combination belonging to the object in ${P}_{1}$, ${P}_{2}$, and ${P}_{3}$ are $\{stagnant\}$, $\{inland\}$ and $\{constant\}$, which are assigned to ${x}_{{P}_{1}}$ in ${C}_{\{{x}_{{P}_{1}}\}}$, ${x}_{{P}_{3}}$ in ${C}_{\{{x}_{{P}_{3}}\}}$, and ${x}_{{P}_{3}}$ in ${C}_{\{{x}_{{P}_{3}}\}}$, respectively.
Definition 14. An object $g\in G$ of formal context $(G,M,I)$ satisfies a constraint ${C}_{\{{x}_{P}\}}$ where $P\subseteq M$ if a compound label ${L}_{\{{x}_{P}\}}=(<{x}_{P},\{g{\}}^{I}\cap P>)$ satisfies the constraint.
Definition 15. A formal context $(G,M,I)$ satisfies a constraint ${C}_{\{{x}_{P}\}}$ if for all $g\in G$, $g$ satisfies the constraint.
It is trivial to check that the formal context of “bodies of water” satisfies the three constraints in Example 1.
Representing a constraint as a formal context
Interestingly, a constraint can be represented by a formal context. Let ${C}_{\{{x}_{P}\}}$ a constraint of formal context $(G,M,I)$. The constraint can be represented as a formal context $({G}_{P},{M}_{P},{I}_{P})$ which is defined as follows:
${G}_{P}={C}_{\{{x}_{P}\}}$
${M}_{P}=P$
$(g,m)\in {I}_{P}$ for $g\in {G}_{p}$ and $m\in {M}_{P}$ if $g=(<{x}_{P},A>)\in {C}_{\{{x}_{P}\}}$ and $m\in A$
Example 2. Recall Example 1. The constraints ${C}_{\{{x}_{{P}_{1}}\}}$, ${C}_{\{{x}_{{P}_{2}}\}}$, and ${C}_{\{{x}_{{P}_{3}}\}}$ are represented by the formal contexts in Fig. 3.
By the representation, each object of the formal context representing a constraint is associated to a label of the constraint.
Proposition 1. Let $({G}_{P},{M}_{P},{I}_{P})$ a representation of constraint ${C}_{\{{x}_{P}\}}$. A formal context $(G,M,I)$ satisfies a constraint $({G}_{P},{M}_{P},{I}_{P})$ if for all $g\in G$, there is ${g}_{P}\in {G}_{P}$ such that $\{g{\}}^{I}\cap {M}_{P}=\{{g}_{P}{\}}^{{I}_{P}}$.
Proof. First, we will prove that $(G,M,I)$ satisfies $({G}_{P},{M}_{P},{I}_{P})$ if for all $g\in G$, $g$ satisfies ${C}_{\{{x}_{P}\}}$. Second, we will prove that for any $g\in G$, there is ${g}_{P}\in {G}_{P}$ such that $\{g{\}}^{I}\cap {M}_{P}=\{{g}_{P}{\}}^{{I}_{P}}$. The proof is as follows:
• (G,M, I) satisfies $({G}_{P},{M}_{P},{I}_{P})$
if $(G,M,I)$ satisfies ${C}_{\{{x}_{P}\}}$
if for all $g\in G$, $g$ satisfies ${C}_{\{{x}_{P}\}}$
• $g\in G$ satisfies ${C}_{\{{x}_{P}\}}$
if a compound label ${L}_{\{{x}_{P}\}}=(<{x}_{P},\{g{\}}^{I}\cap P>)$ satisfies ${C}_{\{{x}_{P}\}}$
if there is a compound label $(<{x}_{P},A>)\in {C}_{\{{x}_{P}\}}$, such that $\{g{\}}^{I}\cap P=A$
if there is ${g}_{P}\in {G}_{P}$, which is associated to the compound label, such that $\{g{\}}^{I}\cap P=\{{g}_{P}{\}}^{{I}_{P}}$
if there is ${g}_{P}\in {G}_{P}$, such that $\{g{\}}^{I}\cap {M}_{P}=\{{g}_{P}{\}}^{{I}_{P}}$
Constraintinferring problem
Suppose there is a formal context and there are some constraints where the formal context satisfies. Let $A\Rightarrow B$ an attribute implication and $\mathcal{L}$ a set of attribute implications where all of the attribute implications hold in the formal context. Constraintinferring problem is whether $A\Rightarrow B$ can be inferred from $\mathcal{L}$ and the constraints.
Definition 16. Given an attribute implication $A\Rightarrow B$, which holds in a formal context $(G,M,I)$, a set of attribute implications $\mathcal{L}$ which also hold in the formal context, and $n$ constraints ${C}_{\{{x}_{{P}_{1}}\}},{C}_{\{{x}_{{P}_{2}}\}},\dots ,{C}_{\{{x}_{{P}_{n}}\}}$ which the formal context satisfies. The constraintinferring problem is whether:
(8) $$\mathcal{L}\cup \mathcal{R}\models A\Rightarrow B$$where $\mathcal{R}$ is a representation of the constraints (Hidayat, 2013).
Refer to Eq. (5), expression in Eq. (8) also means that every model of $\mathcal{L}\cup \mathcal{R}$ is also model of $A\Rightarrow B$.
Backgroundinferring problem is also constraintinferring problem
If we make comparison between backgroundinferring problem and constraintinferring problem, the difference is the information of $\mathcal{R}$ and $\mathcal{H}$. Fortunately, if both are similar, we can consider the constraintinferring problem as the backgroundinferring problem. It will be proven that information of background in the backgroundinferring problem is also constraint.
Proposition 2. $\mathcal{H}$ in the backgroundinferring problem is also information of constraints which the derived context satisfies (Hidayat, 2013).
Proof. $\mathcal{H}$ in the backgroundinferring problem is information of scales. Thus, we will prove that scales are constraints which its derivedcontext satisfies.
Let $(G,N,J)$ a derived context of manyvalued context $(G,M,W,I)$ and ${S}_{m}=({G}_{m},{M}_{m},{I}_{m})$ a scale for an attribute $m\in M$. $(G,N,J)$ satisfies the constraint ${S}_{m}=({G}_{m},{M}_{m},{I}_{m})$ if for all $g\in G$, there is ${g}_{m}\in {G}_{m}$ such that $\{g{\}}^{J}\cap {M}_{m}=\{{g}_{m}{\}}^{{I}_{m}}$ (Proposition 1).
Let $g\in G$ and $w\in W$ such that $(g,m,w)\in I$. By definition, we know that $w\in {G}_{m}$ and for all $n\in {M}_{m}\subseteq N$, $(g,n)\in J$ if $(w,n)\in {I}_{m}$. Thus, $\{g{\}}^{J}\cup {M}_{m}=\{w{\}}^{{I}_{m}}$.
Therefore, for all $g\in G$, there is always $w\in {G}_{m}$ where $(g,m,w)\in I$, such that $\{g{\}}^{J}\cap {M}_{m}=\{w{\}}^{{I}_{m}}$. Then, $(G,N,J)$ satisfies the constraint ${S}_{m}=({G}_{m},{M}_{m},{I}_{m})$ (Hidayat, 2013).
Encoding constraintinferring problem into SAT problem
From Proposition 2, we can conclude that constraintinferring problem is also backgroundinferring problem. Therefore the constraintinferring problem can encod into a SAT problem using encoding of the backgroundinferring problem in Hidayat, bin Ahmad & Ishak bin Desa (2021) by replacing the information of background with the constraints as follows:
(9) $$\mathcal{L}\cup \mathcal{R}\u22adA\Rightarrow B$$if and only if the following propositional formulae are satisfiable:
(10) $$\underset{d\in D}{\bigwedge}(\underset{c\in C}{\bigwedge}({p}_{c}\to {p}_{d}))\mathrm{f}\mathrm{o}\mathrm{r}\phantom{\rule{thinmathspace}{0ex}}\mathrm{e}\mathrm{a}\mathrm{c}\mathrm{h}\phantom{\rule{thinmathspace}{0ex}}C\Rightarrow D\in \mathcal{L}$$
(11) $$\underset{g\in {G}_{p}}{\bigvee}(\left(\underset{a\in \{g{\}}^{I}}{\bigwedge}{p}_{a}\right)\wedge \left(\underset{a\in {M}_{p}\mathrm{\setminus}\{g{\}}^{I}}{\bigwedge}\mathrm{\neg}{p}_{a}\right))\mathrm{f}\mathrm{o}\mathrm{r}\phantom{\rule{thinmathspace}{0ex}}\mathrm{e}\mathrm{a}\mathrm{c}\mathrm{h}\phantom{\rule{thinmathspace}{0ex}}\mathrm{c}\mathrm{o}\mathrm{n}\mathrm{s}\mathrm{t}\mathrm{r}\mathrm{a}\mathrm{i}\mathrm{n}\mathrm{t}\phantom{\rule{thinmathspace}{0ex}}({G}_{p},{M}_{p},{I}_{p})\phantom{\rule{thinmathspace}{0ex}}\mathrm{i}\mathrm{n}\phantom{\rule{thinmathspace}{0ex}}\mathcal{R}$$
(12) $$\mathrm{\neg}\left(\underset{b\in B}{\bigwedge}(\underset{a\in A}{\bigwedge}{p}_{a}\to pb)\right)$$where ${p}_{m}$ is a propositional variable corresponding to an attribute $m\in M$ of formal context $(G,M,I)$.
Example 3. Recall Example 1 and Example 2. Suppose $\mathcal{L}$ consists of the following attribute implications:
$\{temporary\}\Rightarrow \{natural,stagnant,inland\}$
$\{maritime\}\Rightarrow \{natural,stagnant,constant\}$
and $\mathcal{R}$ is information of constraints ${C}_{\{{x}_{{P}_{1}}\}}$, ${C}_{\{{x}_{{P}_{2}}\}}$, and ${C}_{\{{x}_{{P}_{3}}\}}$. $\mathcal{L}\cup \mathcal{R}\u22ad\{running\}\Rightarrow \{inland,constant\}$, if only if the following formulae are satisfiable:
$$({p}_{temporary}\to {p}_{natural})\wedge ({p}_{temporary}\to {p}_{stagnant})\wedge ({p}_{temporary}\to {p}_{inland})\phantom{\rule{0ex}{0ex}}({p}_{maritime}\to {p}_{natural})\wedge ({p}_{maritime}\to {p}_{stagnant})\wedge ({p}_{maritime}\to {p}_{constant})\phantom{\rule{0ex}{0ex}}({p}_{stagnant}\wedge \mathrm{\neg}{p}_{running})\vee (\mathrm{\neg}{p}_{stagnant}\wedge {p}_{running})\phantom{\rule{0ex}{0ex}}({p}_{inland}\wedge \mathrm{\neg}{p}_{maritime})\vee (\mathrm{\neg}{p}_{inland}\wedge {p}_{maritime})\phantom{\rule{0ex}{0ex}}({p}_{constant}\wedge \mathrm{\neg}{p}_{temporary})\vee (\mathrm{\neg}{p}_{constant}\wedge {p}_{temporary})\phantom{\rule{0ex}{0ex}}\mathrm{\neg}\left(({p}_{running}\to {p}_{inland})\wedge ({p}_{running}\to {p}_{constant})\right)$$
Nonredundant implicational base
In this section we present a proposed method to generate a nonredundant implicational base of formal context with some constraints where the formal context satisfies the constraints. We also present an implementation of the proposed method.
The proposed method is adopted from stem base algorithm (Ganter & Wille, 1999; Ganter & Obiedkov, 2016). Stem base algorithm is an algorithm to generate an implicational base of a formal context. Stem base algorithm is iterative process. Each iteration will generate an attribute implication which is sound and nonredundant based on all attribute implications generated in previous iteration. The algorithm ensures that after complete iteration, all generated attribute implications are complete.
The difference between the proposed method and the original algorithm is a decision whether a generated attribute implication in each iteration will be added into the implicational base or not. The attribute implication is added if and only if it can be inferred from all attribute implications generated in previous iteration together with the constraints (constraintinferring problem).
Figure 4 shows a flowchart to generate the nonredundant implicational base, where:

F is a formal context
$\mathcal{C}$ is a set of constraints
“Get $A\Rightarrow B$” is a method to generate a new nonredundant and sound attributeimplication, which is adopted from stembase algorithm.
$\mathcal{L}\cup \mathcal{R}\u22adA\Rightarrow B$ is negation of constraintinferring problem.
The output of the flowchart is a set of attribute implication $\mathcal{L}$.
We implement the flowchart in Fig. 4 in Java Programming Language. We use the sat4j library (http://sat4j.org) as an SAT solver to solve an SAT problem. An SAT problem solved by the SAT solver has to be in conjunctive normal form (CNF). Thus, in this implementation we have to convert the SAT problem in Eqs. (10)–(12) into CNF. Therefore, the steps of solving a constraintinferring problem in this implementation are as follows:

1)

2)
converting the SAT problem into CNF

3)
solving the SAT problem in CNF using sat4j.
Experiment
Here we elaborate an experiment to show that the proposed method and its implementation work. In this experiment, we will generate nonredundant implicational base of some formal contexts with constraints using the implementation described in the previous section. The experimental results will be proved that they are correct.
Experiment 1
In this experiment, we will generate nonredundant implicational base of formal context of “bodies of water” in Fig. 1 using the proposed method without and with constraints. The result will be compared with implicational base generated by stem base algorithm to see all removed attribute implications. And then, all removed attribute implications generated by proposed method will be proved that they are redundant based on corresponding constraints.
Recall the formal context in Example 1. Attributes of the formal context are $natural$, $artificial$, $stagnant$, $running$, $inland$, $maritime$, $constant$, $temporary$. From current knowledge, there are some constraints for the following attributes:
$stagnant$ and $running$
$inland$ and $maritime$
$constant$ and $temporary$
where constraints of each pair of the attributes are as follows that every object of the formal context has exactly one attribute of each pair. Let ${P}_{1}=\{stagnant,running\}$, ${P}_{2}=\{inland,maritime\}$, and ${P}_{3}=\{constant,temporary\}$. The constraints can be expressed as follows:
${C}_{\{{x}_{{P}_{1}}\}}=\{(<{x}_{{P}_{1}},\{stagnant\}),(<{x}_{{P}_{1}},\{running\})\}$
${C}_{\{{x}_{{P}_{2}}\}}=\{(<{x}_{{P}_{2}},\{inland\}),(<{x}_{{P}_{2}},\{maritime\})\}$
${C}_{\{{x}_{{P}_{3}}\}}=\{(<{x}_{{P}_{3}},\{constant\}),(<{x}_{{P}_{3}},\{temporary\})\}$
Constraints ${C}_{\{{x}_{{P}_{1}}\}}$, ${C}_{\{{x}_{{P}_{1}}\}}$, and ${C}_{\{{x}_{{P}_{1}}\}}$ are represented by formal context in Fig. 3.
The following are all attribute implications of implicational base of formal context using stem base algorithm:

1)
$\{temporary\}\Rightarrow \{natural,stagnant,inland\}$

2)
$\{maritime\}\Rightarrow \{natural,stagnant,constant\}$

3)
$\{running\}\Rightarrow \{inland,constant\}$

4)
$\{stagnant,running,inland,constant\}\Rightarrow \{natural,artificial,maritime,temporary\}$

5)
$\{artificial\}\Rightarrow \{inland,constant\}$

6)
$\{natural,stagnant,inland,constant,temporary\}\Rightarrow \{artificial,running,maritime\}$

7)
$\{natural,stagnant,inland,maritime,constant\}\Rightarrow \{artificial,running,temporary\}$

8)
$\{natural,artificial,inland,constant\}\Rightarrow \{stagnant,running,maritime,temporary\}$
The attribute implications will be referred to as ${r}_{1},{r}_{2},...,\phantom{\rule{thinmathspace}{0ex}}\mathrm{a}\mathrm{n}\mathrm{d}\phantom{\rule{thinmathspace}{0ex}}{\mathrm{r}}_{8}$, respectively.
Nonredundant implicational base will be generated by the proposed method with five cases as follows:
without constraint (Case 1)
with constraint ${C}_{\{{x}_{{P}_{1}}\}}$ (Case 2)
with constraint ${C}_{\{{x}_{{P}_{2}}\}}$ (Case 3)
with constraint ${C}_{\{{x}_{{P}_{3}}\}}$ (Case 4)
with constraint ${C}_{\{{x}_{{P}_{1}}\}}$, ${C}_{\{{x}_{{P}_{2}}\}}$, and ${C}_{\{{x}_{{P}_{3}}\}}$ (Case 5)
Table 1 shows the attribute implications of implicational base of each case. First column is for implicational base generated by stem base algorithm and the others are for implicational base generated by proposed method for case 1, case 2,…, case 5, respectively. Each row represents the existence of each attribute implication of implicational base generated by stem base algorithm. Unchecked means that the attribute implication is considered as redundant and removed from implicational base. For example, attribute implication ${r}_{4}$, ${r}_{7}$, and ${r}_{6}$ are redundant attribute implications in implicational base of case 2, case 3, and case 4, respectively. Each row also refers to iteration of the proposed method in Fig. 4.
Attribute implication  Case 1  Case 2  Case 3  Case 4  Case 5 

${r}_{1}$  $\u2713$  $\u2713$  $\u2713$  $\u2713$  $\u2713$ 
${r}_{2}$  $\u2713$  $\u2713$  $\u2713$  $\u2713$  $\u2713$ 
${r}_{3}$  $\u2713$  $\u2713$  $\u2713$  $\u2713$  
${r}_{4}$  $\u2713$  $\u2713$  $\u2713$  
${r}_{5}$  $\u2713$  $\u2713$  $\u2713$  $\u2713$  $\u2713$ 
${r}_{6}$  $\u2713$  $\u2713$  $\u2713$  
${r}_{7}$  $\u2713$  $\u2713$  $\u2713$  
${r}_{8}$  $\u2713$  $\u2713$  $\u2713$  $\u2713$  $\u2713$ 
For case 1, the proposed method gives the same attribute implications generated by stem base algorithm. It proves that the proposed method gives the correct result. Regarding the other cases, the followings are proof of the redundant attribute implications for each case:
• Case 2: constraint ${C}_{\{{x}_{{P}_{1}}\}}$
At iteration 4 (row 4), the generated attribute implication $A\Rightarrow B$ is
$$\{stagnant,running,inland,constant\}\Rightarrow \{natural,artificial,maritime,temporary\}$$and $\mathcal{L}=\{{r}_{1},{r}_{2},{r}_{3}\}$
Let D a model of $\mathcal{L}\cup \{{C}_{\{{x}_{{P}_{1}}\}}\}$. The followings are consequences:
$\to \{stagnant,running\}\u2288D$, because of constraint ${C}_{\{{x}_{{P}_{1}}\}}$
$\to \{stagnant,running,inland,constant\}\u2288D$
$\to A\u2288D$
$\to $ D is a model of $A\Rightarrow B$
Therefore, $A\Rightarrow B$ is redundant.
• Case 3: constraint ${C}_{\{{x}_{{P}_{2}}\}}$
At iteration 7 (row 7), the generated attribute implication $A\Rightarrow B$ is
$$\{natural,stagnant,inland,maritime,constant\}\Rightarrow \{artificial,running,temporary\}$$and $\mathcal{L}=\{{r}_{1},{r}_{2},{r}_{3},{r}_{4},{r}_{5},{r}_{6}\}$.
Let D a model of $\mathcal{L}\cup \{{C}_{\{{x}_{{P}_{2}}\}}\}$. The followings are consequences:
$\to \{inland,maritime\}\u2288D$, because of constraint ${C}_{\{{x}_{{P}_{2}}\}}$
$\to \{natural,stagnant,inland,maritime,constant\}\u2288D$
$\to A\u2288D$
$\to $ D is a model of $A\Rightarrow B$
Therefore, $A\Rightarrow B$ is redundant.
• Case 4: constraint ${C}_{\{{x}_{{P}_{3}}\}}$
At iteration 6 (row 6), the generated attribute implication $A\Rightarrow B$ is
$$\{natural,stagnant,inland,constant,temporary\}\Rightarrow \{artificial,running,maritime\}$$and $\mathcal{L}=\{{r}_{1},{r}_{2},{r}_{3},{r}_{4},{r}_{5}\}$.
Let D a model of $\mathcal{L}\cup \{{C}_{\{{x}_{{P}_{3}}\}}\}$. The followings are consequences:
$\to \{constant,temporary\}\u2288D$, because of constraint ${C}_{\{{x}_{{P}_{3}}\}}$
$\to \{natural,stagnant,inland,constant,temporary\}\u2288D$
$\to A\u2288D$
$\to $ D is a model of $A\Rightarrow B$
Therefore, $A\Rightarrow B$ is redundant.
• Case 5: constraint ${C}_{\{{x}_{{P}_{1}}\}}$, ${C}_{\{{x}_{{P}_{2}}\}}$, and ${C}_{\{{x}_{{P}_{3}}\}}$
There are four redundant attribute implications as follows:
– $\{running\}\Rightarrow \{inland,constant\}$
– $\{stagnant,running,inland,constant\}\Rightarrow \{natural,artificial,maritime,temporary\}$
– $\{natural,stagnant,inland,constant,temporary\}\Rightarrow \{artificial,running,maritime\}$
– $\{natural,stagnant,inland,maritime,constant\}\Rightarrow \{artificial,running,temporary\}$
Last three attribute implications are same with redundant attribute implications in three previous cases. The proof are also same. Thus, only first attribute implication will be proved.
At iteration 3 (row), the generated attribute implication $A\Rightarrow B$ is:
$$\{running\}\Rightarrow \{inland,constant\}$$and $\mathcal{L}=\{{r}_{1},{r}_{2}\}$ or $\mathcal{L}$ contains the followings:
– $\{temporary\}\Rightarrow \{natural,stagnant,inland\}$ ( ${r}_{1}$)
– $\{maritime\}\Rightarrow \{natural,stagnant,constant\}$ ( ${r}_{2}$)
Let D a model of $\mathcal{L}\cup \{{C}_{\{{x}_{{P}_{1}}\}},{C}_{\{{x}_{{P}_{2}}\}},{C}_{\{{x}_{{P}_{3}}\}}\}$. Because of constraint ${C}_{\{{x}_{{P}_{1}}\}}$, there are two possibilities of D:
– $\{stagnant\}\subseteq D$
$\to \{running\}\u2288D$ because of ${C}_{\{{x}_{{P}_{1}}\}}$
$\to A=\{running\}\u2288D$
$\to $ D is a model of $A\Rightarrow B$
– $\{running\}\subseteq D$
Because of constraint ${C}_{\{{x}_{{P}_{2}}\}}$, there are two possibilities of D:
∗ $\{running,maritime\}\subseteq D$
$\to \{running,maritime,natural,stagnant,constant\}\subseteq D$, because of ${r}_{2}$
$\to \{running,stagnant\}\subseteq D$
$\to $ D contradicts constraint ${C}_{\{{x}_{{P}_{1}}\}}$
$\to $ D is not a model of $\mathcal{L}\cup \{{C}_{\{{x}_{{P}_{1}}\}},{C}_{\{{x}_{{P}_{2}}\}},{C}_{\{{x}_{{P}_{3}}\}}\}$
∗ $\{running,inland\}\subseteq D$
Because of constraint ${C}_{\{{x}_{{P}_{3}}\}}$, there are also 2 possibilities of D:
⋅ $\{running,inland,temporary\}\subseteq D$
$\to \{running,inland,temporary,natural,stagnant\}\subseteq D$, because of ${r}_{1}$
$\to \{running,stagnant\}\subseteq D$
$\to $ D contradicts constraint ${C}_{\{{x}_{{P}_{1}}\}}$
$\to $ D is not a model of $\mathcal{L}\cup \{{C}_{\{{x}_{{P}_{1}}\}},{C}_{\{{x}_{{P}_{2}}\}},{C}_{\{{x}_{{P}_{3}}\}}\}$
⋅ $\{running,inland,constant\}\subseteq D$
Thus, $\{running\}\subseteq D$ and D is a model of $\mathcal{L}\cup \{{C}_{\{{x}_{{P}_{1}}\}},{C}_{\{{x}_{{P}_{2}}\}},{C}_{\{{x}_{{P}_{3}}\}}\}$
$\to \{running,inland,constant\}\subseteq D$
$\to B\subseteq \{running,inland,constant\}\subseteq D$
$\to $ D is model of $A\Rightarrow B$
Therefore, $A\Rightarrow B$, which is $\{running\}\Rightarrow \{inland,constant\}$, is redundant.
Experiment 2
In this experiment, we will show that the number of attribute implications in implicational base of formal context generated by the proposed method will decrease according to the number of constraints which the formal context satisfies. It happens because some attribute implications are redundant or can be inferred from the other attribute implications together with the constraint, such that they are ignored from implicational base.
In this experiment, the proposed method will generate implicational base of five formal contexts with corresponding constraints. The constraints are defined based on common existing knowledge or description of the formal context in data source. The formal contexts and constraints are as follows:
• Formal context of “living in water” (Wille, 1984)
Constraints for the following attributes:
– ${P}_{1}=\{dicotyledon,monocotyledon\}$
– ${P}_{2}=\{lives\phantom{\rule{thickmathspace}{0ex}}in\phantom{\rule{thickmathspace}{0ex}}water,lives\phantom{\rule{thickmathspace}{0ex}}on\phantom{\rule{thickmathspace}{0ex}}land\}$
• Formal context of “small natural number” (Ganter & Wille, 1999)
Constraints for the following attributes:
– ${P}_{1}=\{odd,even\}$
– ${P}_{2}=\{greater\phantom{\rule{thickmathspace}{0ex}}than\phantom{\rule{thickmathspace}{0ex}}2,greater\phantom{\rule{thickmathspace}{0ex}}than\phantom{\rule{thickmathspace}{0ex}}5\}$
– ${P}_{3}=\{prime,square\}$
• Formal context of “implicit information” (Fu, 2016)
Constraints for the following attributes:
– ${P}_{1}=\{Wastewater,Sludge\}$
– ${P}_{2}=\{Pressurised,Gravity\}$
– ${P}_{3}=\{Underground,Aboveground\}$
• Formal context of “object shapes” (Marín et al., 2021)
Constraints for the following attributes:
– ${P}_{1}=\{white,black\}$
– ${P}_{2}=\{large,small\}$
– ${P}_{3}=\{circle,square,triangle\}$
• Formal context of “failures event” (Rocco, HernandezPerdomo & Mun, 2020)
Constraints for the following attributes:
– ${P}_{1}=\{daytime,afternoon\}$
– ${P}_{2}=\{SERC,TRE,WECC\}$
– ${P}_{3}=\{Weather,Technical,Attack\}$
The formal context and their constraints are shown in Figs. 5–9, respectively.
For each formal context, some implicational bases are generated using stem base algorithm and the proposed method with no constraint, one constraint for ${P}_{1}$, two constraints for ${P}_{1}$ and ${P}_{2}$, and three constraints for ${P}_{1}$, ${P}_{2}$, and ${P}_{3}$. The number of attribute implications for each implicational base are presented by Table 2.
Formal context  Stem base algorithm  Proposed method  

No constraint  One constraint  Two constraints  Three constraints  
Living in water  11  11  10  9  
Small natural number  8  8  7  6  5 
Implicit information  7  7  6  5  4 
Object shapes  11  11  10  7  3 
Failures event  15  15  13  10  7 
Table 2 shows that the number of attribute implications of implicational base decreases when the number of constraints increases. Figure 10 illustrates the reduction. According to design of this experiment, twoconstraints case is adding constraint for ${P}_{2}$ to oneconstraint one and threeconstraints case is adding constraint for ${P}_{3}$ to twoconstraints one. Thus, we can conclude that the more the constraints, the less the attribute implications of implicational base.
Therefore, the proposed method works properly. More constraints possibly imply more redundant attribute implications. The proposed method is able to check such attribute implications. It is proved by the result of this experiment.
Experiment 3
In this experiment, we will apply the proposed method for large data. We select some datasets from UCI Machine Learning Repository. Specifically, we only focus on health datasets. Table 3 shows some health datasets from the repository for this experiment. Column instances and attributes represent number of instances and attributes, respectively.
A formal context will be created from each dataset. An instance of dataset becomes an object of the formal context whereas an attribute of dataset becomes some attributes of the formal context. The number of attributes of formal context depends on the interpretation of each value of each attribute in the dataset. To focus on generating the nonredundant implicational base, the creation process of each formal context is not explained in this article. However, we show the important information of the formal context in Table 4. Column attributes represent the number of attributes of formal context. Certainly, the number differs with the number of attributes of corresponding dataset.
Formal context  Objects  Attributes  Class attributes 

Acute inflammations  120  19  4 
Breast cancer Wisconsin  699  38  2 
Heart disease  297  46  2 
Healthy older people  231  33  4 
Hepatitis C virus (HCV)  589  42  5 
Audiology  200  185  24 
Autistic spectrum disorder screening data for adolescent  104  87  2 
Autistic spectrum disorder screening data for children  292  104  2 
Breast cancer  277  43  2 
Breast tissue  106  39  6 
Caesarian section classification  80  18  2 
Cervical cancer (Risk Factors)  858  107  2 
Contraceptive method choice  1,473  29  3 
Cryotherapy  90  25  2 
Diabetic retinopathy debrecen  1,151  71  2 
EEG eye state  14,980  72  2 
Exasens  100  26  3 
Fertility  100  30  2 
Heart failure clinical records  299  36  2 
Hepatitis  135  38  2 
Liver disorders  345  18  3 
Lung cancer  32  223  3 
Lymphography  148  66  4 
Mammographic mass  830  24  2 
Postoperative patient  87  27  3 
Primary tumor  164  39  6 
SPECT heart  267  46  2 
Statlog (Heart)  270  38  2 
Thyroid disease  8,861  52  6 
Table 4 also shows the number of class attributes (column ‘class attributes’). Class attributes are attributes of formal context as interpretation of class attributes of dataset. As classification data which is described in UCI repository, each dataset in this experiment has one class attribute or more. A value in class attribute of a dataset refers to a class of an instance. To maintain the class information, a class attribute in formal context corresponds to a class in class attribute of corresponding dataset. For example, Audiology dataset has a class attribute whose name is class. The class attribute has 24 possible values which means that there are 24 classes of instances. Therefore, there are 24 class attributes in the formal context of Audiology.
Because of some class attributes, there will be a constraint of the attributes. The constraint is that each object of formal context will have exactly one of the class attributes. For example, there are class attributes of formal context of “Healthy older people” where the class attributes are Label of activity: sit on bed, Label of activity: sit on chair, Label of activity: lying, and Label of activity: ambulating, which correspond to class attribute of “Label of activity” in the “Healthy older people” dataset. Undoubtedly, each object in this formal context will have exactly one of the attributes.
Thus, in general, each formal context in this experiment has constraints on class attributes where each constraint is related to a class attribute of corresponding dataset. Let ${P}_{a}=\{{a}_{1},{a}_{2},\dots ,{a}_{k}\}\subseteq M$ a set of class attributes of formal context $(G,M,I)$ where ${P}_{a}$ is related to a class attribute $a$ of corresponding dataset. Then, there is a constraint for ${P}_{a}$ as follows:
$${C}_{\{{x}_{{P}_{a}}\}}=\{(<{x}_{{P}_{a}},\{{a}_{1}\}),(<{x}_{{P}_{a}},\{{a}_{2}\}),\dots ,(<{x}_{{P}_{a}},\{{a}_{k}\})\}$$
Let $a$ class attribute “Label of activity” in the “Healthy older people” dataset. The formal context of “Healthy older people” has the following constraint:
$${C}_{\{{x}_{{P}_{a}}\}}=\left\{\begin{array}{c}(<{x}_{{P}_{a}},\{Labelofactivity:sitonbed\}),(<{x}_{{P}_{a}},\{Labelofactivity:sitonchair\}),\\ (<{x}_{{P}_{a}},\{Labelofactivity:lying\}),(<{x}_{{P}_{a}},\{Labelofactivity:ambulating\})\end{array}\right\}$$
Fortunately, all formal contexts in this experiment have one constraint only, except formal context of “Acute Inflammation”. The formal context has two constraints.
Therefore, in this experiment we generate a nonredundant implicational base of each formal context created from health datasets using the proposed method where constraints are on class attributes of the formal context. As comparable, we also generate an implicational base of same formal context using stembase algorithm which do not consider any constraints. Table 5 shows number of attribute implications of both implicational bases as the result of this experiment. The table also shows number of redundant attribute implications which is the difference between both. Percentage of redundancy in the table is ratio of the number of redundant attribute implications to the number of attribute implications without constraint.
Formal context  Number of attribute implications  Percentage of redundancy  

Without constraints  With constraints  Redundant  
Acute inflammations  69  43  26  38% 
Breast cancer Wisconsin  713  637  76  11% 
Heart disease  4,494  3,300  1,194  27% 
Healthy older people  122  103  19  16% 
Hepatitis C virus (HCV)  1,453  1,378  75  5% 
Audiology  1,691  1,349  342  20% 
Autistic spectrum disorder screening data for adolescent  124  123  1  1% 
Autistic spectrum disorder screening Data for children  2,130  1,909  221  10% 
Breast cancer  3,300  3,129  171  5% 
Breast tissue  122  98  24  20% 
Caesarian section classification  73  61  12  16% 
Cervical cancer (Risk Factors)  700  646  54  8% 
Contraceptive method choice  1,529  1,221  308  20% 
Cryotherapy  225  175  50  22% 
Diabetic retinopathy debrecen  7,297  7,046  251  3% 
EEG eye state  81  42  39  48% 
Exasens  52  46  6  12% 
Fertility  681  567  114  17% 
Heart failure clinical records  5,183  3,605  1,578  30% 
Hepatitis  3,096  2,920  176  6% 
Liver disorders  52  48  4  8% 
Lung cancer  361  357  4  1% 
Lymphography  251  245  6  2% 
Mammographic mass  277  218  59  21% 
Postoperative patient  522  391  131  25% 
Primary tumor  2,492  2,294  198  8% 
SPECT heart  2,290  2,199  91  4% 
Statlog (Heart)  5,029  3,563  1,466  29% 
Thyroid disease  3,215  2,727  488  15% 
From the table, we obtain that the proposed method can reduce the number of attribute implications of implicational base effectively. The reduction shown in the table is described more clearly in Figs. 11 and 12 by comparing the number of attribute implications without constraint (generated by stem base algorithm) and the number of attribute implications with constraint(s) (generated by proposed method). The figures also inform us that the reduction of each formal context varies even the reduction is expressed by the percentage of redundancy as described in Fig. 13.
Let percentage of class attributes a ratio of number of class attributes to number of attributes for a formal context, Fig. 13 also shows that there is no correlation between percentage of redundancy and percentage of class attributes. More precisely, the correlation coefficient of both is 0.240. Moreover, there is also no correlation between the percentage of redundancy and either number of objects, number of attributes, or number of class attributes. Table 6 presents correlation coefficients between the percentage of redundancy and the parameters of formal context.
Number of objects  Number of attributes  Number of class attributes  Percentage of class attributes  Percentage of redundancy  

Number of objects  1  
Number of attributes  0.040  1  
Number of class attributes  −0.026  0.470  1  
Percentage of class attributes  −0.132  −0.395  0.380  1  
Percentage of redundancy  0.461  −0.258  0.047  0.240  1 
Therefore, reduction of number of attribute implications depends on redundancy of some attribute implications with others in implicational base of formal context together with constraints which the formal context satisfies. It implies that the proposed method can check redundant attribute implications and remove them from implicational base to obtain the high quality of generated knowledge.
Summary of experiment
In Experiment 1, we prove that the method proposed in this research is successful to check all redundant attribute implications and ignore them such that it can generate a nonredundant implicational base of formal context. Every ignored attribute implication has been proved that it is redundant. We also show which constraints cause the redundancy since these redundancies are caused by constraints which the formal context satisfies.
In the experiments also, more specifically in Experiment 2, we show that more constraints imply more attribute implications ignored by the proposed method. Since constraints are our existing knowledge regarding to the formal context, more constraints we know mean more attribute implications actually representing our knowledge. Consequently, more attribute implications are redundant and will be ignored. Therefore, the proposed method is effective to generate a nonredundant implicational base of formal context with constraint.
In addition, in Experiment 3 we also show that the proposed method successfully works for formal contexts from large data. The proposed method can reduce the number of attribute implications of implicational base if there are one or more constraints which the formal context satisfies. Since the proposed method has been proved that it gives a correct result in Experiment 1, we assume that the proposed method can also check and ignore redundant attribute implications of implicational base of the large formal contexts. Consequently, the proposed method is also effective to generate a nonredundant implicational base of large formal context.
Last but not least, the proposed method can generate an implicational base in higher quality than one generated by the stembase algorithm which is mainstream algorithm in generating an implicational base in formal context analysis. The higher quality is achieved by ignoring all redundant attribute implications which can be inferred from constraints as existing knowledge. To support the conclusion, in these experiments we generate implicational base using the proposed method and the algorithm for same formal context and then compare both implicational bases.
Conclusion and future works
We successfully proposed a method to generate a nonredundant implicational base of formal context with information of constraints which the formal context satisfies. This method will ignore some redundant attribute implications and remove them from the implicational base. A redundant attribute implication is attribute implication which can be inferred from the others together with the constraints. This method will improve the quality of knowledge generated by formal concept analysis, in this case is implicational base, because the constraints are a prior knowledge which is already known. Therefore, the generated knowledge is really new as expected in knowledge discovery. This will intensify the role of formal context analysis in this area.
In this article, we successfully formalized a mathematical model of constraints of formal context. This model is able to represent any constraints since it enumerates all possible values as restrictions of attributes of a formal context. Using this model, a problem to check whether an attribute implication is redundant based on constraints can be defined and encoded into a SAT problem. Thus, the proposed method can be applied to any constraints of formal context.
We also successfully defined the redundancy of an attribute implication as constraintinferring problem. In this article, we proposed an encoding the problem into a SAT problem. With this encoding we can solve the problem using the SAT solver. After implementation of the proposed method, we successfully conducted experiments to show that the proposed method is able to generate the nonredundant implicational base using this encoding.
Some experiments with real data of formal context with constraints are be implemented in our next research. From these experiments we will show that we can reduce the size and also improve the quality of implicational base by ignoring some redundant attribute implications which can be inferred from others in the implicational base together with the constraints.
Supplemental Information
Generating a nonredundant implicational base of formal context with constraints.
The code is in Java Programming Language. It requires SAT4J Core library (available at http://www.sat4j.org/maven234/org.ow2.sat4j.core/index.html).
This Java implementation is for generating a nonredundant implicational base of a formal context which is restricted by some constraints. It includes an implementation for encoding a constraintinferring problem into a SAT problem and solving the SAT problem using a SAT solver.