Non-redundant implicational base of formal context with constraints using SAT

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 non-redundant regarding to the formal context. Non-redundant 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 non-redundant implication base of a formal context with some constraints which restricting the formal context. In this case, non-redundant 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 non-redundant 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 c, 2014;Rocco, Hernandez-Perdomo & 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, Hernandez-Perdomo & 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).
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 c, 2014;Ganter & Obiedkov, 2016).Implicational base of a formal context is a set of attribute implications which are sound, complete, and non-redundant.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.Non-redundant 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 non-redundant implicational base (Hidayat, bin Ahmad & Ishak bin Desa, 2021;Hidayat, 2005).In the non-redundant 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 background-inferring 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 attribute-values 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 non-redundant 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 constraint-inferring problem.
The next problem is how to solve the constraint-inferring 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 background-inferring problem is successfully encoded into SAT (satisfiability) problem.The SAT problem is an interesting problem in computer science which is NP-complete (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ánchez-Rubio, 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 non-redundant 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 constraint-inferring 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 G Â M. G is a set of objects, whereas M is a set of attributes.For g 2 G and m 2 M, ðg; mÞ 2 I or gIm means that the object g has the attribute m (Ganter & Wille, 1999;Wille, 2005;Škopljanac Mačina & Blaškovi c, 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 2 G and attribute m 2 M. We cross the cell if ðg; mÞ 2 I. Recall Fig. 1.The figure shows a formal context of "bodies of water" (Wille, 2005) (Ganter & Wille, 1999;Ganter, 1996;Hidayat, 2005).
A triple ðg; m; wÞ 2 I means that attribute m 2 M of object g 2 G has values w 2 W.
In the real world, most of the data is in the many-valued context.However, methods in the formal context analysis are only applied to the one-valued context of a formal context.Therefore, we need to transform the many-value context into a one-valued context.Scaling is a method to transform a many-valued context into a one-valued context.
A scaling transforms a many-valued context into a one-valued context by some scales which are also formal contexts.We call the one-valued context a derived context (Ganter & Wille, 1999;Wille, 2005).Definition 4. A scale for attribute m 2 M of a many-valued context ðG; M; W; IÞ is a onevalued context S m ¼ ðG m ; M m ; I m Þ with G m fw j ðg; m; wÞ 2 I; g 2 Gg (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 many-valued context ðG; M; W; IÞ and scales S m for all m 2 M is a context ðG; N; JÞ where (Wille, 2005 (Ganter & Wille, 1999;Wille, 2005).
An attribute implication holds a formal context ðG; M; IÞ if each object g 2 G respects the attribute implication.
Let L a set of attribute implications over a formal context ðG; M; IÞ.We call L an implicational base of the formal context if the set is sound, complete, and non-redundant.Definition 8.A set of attribute implications 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 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 L , and non-redundant, if there is no attribute implication in L which can be inferred from the others in L .

Implicational base of many-valued context
In many-valued context, we define the background-inferring problem which is whether an attribute implication holding in its derived-context is implied by the other ones holding also in the derived-context together with its scales.Definition 9. Let L a set of attributes implications which hold in the derived context from a many-valued context ðG; M; W; IÞ and scales S m for all m 2 M, H information representing the scales, and A ) B an attribute implication which also holds in the derived context.The background-inferring problem is whether (Hidayat, bin Ahmad & Ishak bin Desa, 2021): It means that all models of L and H are also models of A ) 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 2 W. A label in W is a pair , x; v .where x 2 W and v 2 D x , which means that a value v is assigned to a variable x (Tsang, 2014).
which means that values v 1 , v 2 , . .., v n are assigned to variables x 1 , x 2 , . .., x n , respectively (Tsang, 2014).Definition 12. Let S ¼ fx 1 ; x 2 ; . . .; x n g.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 , x 1 ; v 1 .; , x 2 ; v 2 .; . . .; , 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 2 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 constraint-inferring problem which is next step of this research.

Constraint-inferring problem defining
In this step, we will define the constraint-inferring problem.The constraint-inferring 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 constraint-inferring problem into an equivalent SAT problem.We will solve the constraint-inferring problem by solving the SAT problem using SAT Solver.
Constraint-inferring problem definition and encoding into SAT problem is required by the proposed method which will generate a non-redundant 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.

Implementation
We develop a method and a software code to generate a non-redundant implicational base of formal context with constraints.The main part of the software is to solve constraint-inferring 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 non-redundant implications correctly.

Experiment
We perform an experiment to generate a non-redundant 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 constraint-inferring problem, and encoding the constraint-inferring problem into the SAT problem.From the parts, we develop a method to generate a non-redundant 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 ¼ fx P j P Mg 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 M for each object in G.A constraint can be written as follows: where D & 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 ¼ fstagnant; runningg P 2 ¼ finland; maritimeg, and Then, the constraints can be defined as follows: An object g 2 G satisfies a constraint C fx P g if the attributes combination belonging to g in P 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 fstagnantg, finlandg and fconstantg, which are assigned to x P 1 in C fx P 1 g , x P 2 in C fx P 2 g , and x P 3 in C fx P 3 g , respectively.
Definition 14.An object g 2 G of formal context ðG; M; IÞ satisfies a constraint C fx P g where P M if a compound label L fx P g ¼ ð , x P ; fgg I \ P .Þ satisfies the constraint.Definition 15.A formal context ðG; M; IÞ satisfies a constraint C fx P g if for all g 2 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 fx P g 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: Recall Example 1.The constraints C fx P 1 g , C fx P 2 g , and C fx P 3 g 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 fx P g .A formal context ðG; M; IÞ satisfies a constraint ðG P ; M P ; I P Þ if for all g 2 G, there is g P 2 G P such that fgg I \ M P ¼ fg P g I P .
Proof.First, we will prove that ðG; M; IÞ satisfies ðG P ; M P ; I P Þ if for all g 2 G, g satisfies C fx P g .Second, we will prove that for any g 2 G, there is g P 2 G P such that fgg I \ M P ¼ fg P g I P .The proof is as follows: (G,M, I) satisfies ðG P ; M P ; where R is a representation of the constraints (Hidayat, 2013).Refer to Eq. ( 5), expression in Eq. ( 8) also means that every model of

Background-inferring problem is also constraint-inferring problem
If we make comparison between background-inferring problem and constraint-inferring problem, the difference is the information of R and H . Fortunately, if both are similar, we can consider the constraint-inferring problem as the background-inferring problem.It will be proven that information of background in the background-inferring problem is also constraint.Proposition 2. H in the background-inferring problem is also information of constraints which the derived context satisfies (Hidayat, 2013).
Proof.H in the background-inferring problem is information of scales.Thus, we will prove that scales are constraints which its derived-context satisfies.
Let ðG; N; JÞ a derived context of many-valued context ðG; M; W; IÞ and S m ¼ ðG m ; M m ; I m Þ a scale for an attribute m 2 M. ðG; N; JÞ satisfies the constraint Let g 2 G and w 2 W such that ðg; m; wÞ 2 I.By definition, we know that w 2 G m and for all n 2 M m N, ðg; nÞ 2 J if ðw; nÞ 2 I m .Thus, fgg J [ M m ¼ fwg I m .
Therefore, for all g 2 G, there is always w 2 G m where ðg; m; wÞ 2 I, such that fgg J \ M m ¼ fwg I m .Then, ðG; N; JÞ satisfies the constraint S m ¼ ðG m ; M m ; I m Þ (Hidayat, 2013).

Encoding constraint-inferring problem into SAT problem
From Proposition 2, we can conclude that constraint-inferring problem is also background-inferring problem.Therefore the constraint-inferring problem can encod into a SAT problem using encoding of the background-inferring problem in Hidayat, bin Ahmad & Ishak bin Desa (2021) by replacing the information of background with the constraints as follows: if and only if the following propositional formulae are satisfiable:

NON-REDUNDANT IMPLICATIONAL BASE
In this section we present a proposed method to generate a non-redundant 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 non-redundant 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 (constraint-inferring problem).
Figure 4 shows a flowchart to generate the non-redundant implicational base, where: B" is a method to generate a new non-redundant and sound attributeimplication, which is adopted from stem-base algorithm.
The output of the flowchart is a set of attribute implication 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 constraint-inferring problem in this implementation are as follows: 1) encoding the constraint-inferring problem into SAT problem in Eqs. ( 10)-( 12) 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 non-redundant 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 non-redundant 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 ¼ fstagnant; runningg, P 2 ¼ finland; maritimeg, and P 3 ¼ fconstant; temporaryg.The constraints can be expressed as follows: C fx P 1 g ¼ fð , x P 1 ; fstagnantgÞ; ð , x P 1 ; frunninggÞg C fx P 2 g ¼ fð , x P 2 ; finlandgÞ; ð , x P 2 ; fmaritimegÞg C fx P 3 g ¼ fð , x P 3 ; fconstantgÞ; ð , x P 3 ; ftemporarygÞg Constraints C fx P 1 g , C fx P 2 g , and C fx P 3 g 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) ftemporaryg ) fnatural; stagnant; inlandg 2) fmaritimeg ) fnatural; stagnant; constantg 3) frunningg ) finland; constantg 4) fstagnant; running; inland; constantg ) fnatural; artificial; maritime; temporaryg 5) fartificialg ) finland; constantg 6) fnatural; stagnant; inland; constant; temporaryg ) fartificial; running; maritimeg 7) fnatural; stagnant; inland; maritime; constantg ) fartificial; running; temporaryg 8) fnatural; artificial; inland; constantg ) fstagnant; running; maritime; temporaryg The attribute implications will be referred to as r 1 ; r 2 ; …; and r 8 , respectively.Non-redundant implicational base will be generated by the proposed method with five cases as follows: without constraint (Case 1) with constraint C fx P 1 g (Case 2) with constraint C fx P 2 g (Case 3) with constraint C fx P 3 g (Case 4) with constraint C fx P 1 g , C fx P 2 g , and C fx P 3 g (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.
Hidayat et al. ( 2024), PeerJ Comput.Sci., DOI 10.7717/peerj-cs.180615/37 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 fx P 1 g At iteration 4 (row 4), the generated attribute implication A ) B is fstagnant; running; inland; constantg ) fnatural; artificial; maritime; temporaryg and L ¼ fr 1 ; r 2 ; r 3 g Let D a model of L [ fC fx P 1 g g. -fnatural; stagnant; inland; maritime; constantg ) fartificial; running; temporaryg 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 ) B is: frunningg ) finland; constantg and L ¼ fr 1 ; r 2 g or L contains the followings: -ftemporaryg ) fnatural; stagnant; inlandg (r 1 ) Let D a model of L [ fC fx P 1 g ; C fx P 2 g ; C fx P 3 g g.Because of constraint C fx P 1 g , there are two possibilities of D:

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 ¼ fdicotyledon; monocotyledong -P 2 ¼ flives in water; lives on landg • Formal context of "small natural number" (Ganter & Wille, 1999) Constraints for the following attributes: -P 1 ¼ fodd; eveng -P 2 ¼ fgreater than 2; greater than 5g -P 3 ¼ fprime; squareg • Formal context of "implicit information" (Fu, 2016) Constraints for the following attributes: • Formal context of "object shapes" (Marín et al., 2021) Constraints for the following attributes: -P 1 ¼ fwhite; blackg -P 2 ¼ flarge; smallg -P 3 ¼ fcircle; square; triangleg • Formal context of "failures event" (Rocco, Hernandez-Perdomo & Mun, 2020) Constraints for the following attributes: -P 1 ¼ fdaytime; afternoong -P 2 ¼ fSERC; TRE; WECCg -P 3 ¼ fWeather; Technical; Attackg 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.
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, two-constraints case is adding constraint for P 2 to oneconstraint one and three-constraints case is adding constraint for P 3 to two-constraints 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 non-redundant 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.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 ¼ fa 1 ; a 2 ; . . .; a k g 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 fx Pa g ¼ fð , x P a ; fa 1 gÞ; ð , x P a ; fa 2 gÞ; . . .; ð , x P a ; fa k gÞg Let a class attribute "Label of activity" in the "Healthy older people" dataset.The formal context of "Healthy older people" has the following constraint: 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 non-redundant 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   Table 3 Health datasets from UCI machine learning repository.
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.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 non-redundant 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 non-redundant 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 non-redundant 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 non-redundant 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.

Figure 4
Figure 4 Flowchart of generating a non-redundant implicational base of formal context with constraints.Full-size  DOI: 10.7717/peerj-cs.1806/fig-4 there are two possibilities of D: * frunning; maritimeg D ! frunning; maritime; natural; stagnant; constantg D, because of r 2 !frunning; stagnantg D !D contradicts constraint C fx P 1 g !D is not a model of L [ fC fx P 1 g ; C fx P 2 g ; C fx P 3 g g * frunning; inlandg D Because of constraint C fx P 3 g , there are also 2 possibilities of D: ⋅ frunning; inland; temporaryg D ! frunning; inland; temporary; natural; stagnantg D, because of r 1 !frunning; stagnantg D !D contradicts constraint C fx P 1 g !D is not a model of L [ fC fx P 1 g ; C fx P 2 g ; C fx P 3 g g ⋅ frunning; inland; constantg D Thus, frunningg D and D is a model of L [ fC fx P 1 g ; C fx P 2 g ; C fx P 3 g g !frunning; inland; constantg D !B frunning; inland; constantg D !D is model of A ) B Therefore, A ) B, which is frunningg ) finland; constantg, is redundant.

Figure 10
Figure 10 Number of attribute implications of implicational base generated by the proposed method in Experiment 2. Full-size  DOI: 10.7717/peerj-cs.1806/fig-10

Figure 12
Figure 12 Number of attribute implications of implicational base in Experiment 3 where the number of attribute implication without constraint is more than 1,000.Full-size  DOI: 10.7717/peerj-cs.1806/fig-12

Figure 13
Figure 13 Comparison between percentage of redundant attribute implications and percentage of class attributes of formal contexts in Experiment 3. Full-size  DOI: 10.7717/peerj-cs.1806/fig-13 Wille (2005)le (1999)is a set of objects of a formal context ðG; M; IÞ, thenGanter & Wille (1999),Wille (2005), Škopljanac Mačina & Blaškovi c (2014): 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 G then A I means "all attributes that belong to all objects in A".If B M then B I means that "all objects that have all attributes in B".Definition 3. A many-valued 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 G Â M Â W where ðg; m; wÞ 2 I and ðg; m; vÞ 2 I implies w ¼ v Ganter & Wille (1999)ion over formal context ðG; M; IÞ is in the form A ) B where A; B M. A ) 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 itGanter & Wille (1999).An object g 2 G respect the attribute implications if and only if the set of its attributes is a model of the attribute implication.
fx P g ¼ ð , x P ; fgg I \ P .Þ satisfies C fx P g if there is a compound label ð , x P ; A .Þ 2 C fx P g , such that fgg I \ P ¼ A if there is g P 2 G P , which is associated to the compound label, such that fgg I \ P ¼ fg P g I P if there is g P 2 G P , such that fgg I \ M P ¼ fg P g I PCONSTRAINT-INFERRING PROBLEMSuppose there is a formal context and there are some constraints where the formal context satisfies.Let A ) B an attribute implication and L a set of attribute implications where all of the attribute implications hold in the formal context.Constraint-inferring problem is whether A ) B can be inferred from L and the constraints.Definition 16.Given an attribute implication A ) B, which holds in a formal context ðG; M; IÞ, a set of attribute implications L which also hold in the formal context, and n constraints C fx P 1 g ; C fx P 2 g ; . . .; C fx Pn g which the formal context satisfies.The constraintinferring problem is whether: Hidayat et al. (2024), PeerJ Comput.Sci., DOI 10.7717/peerj-cs.1806if a compound label L is information of constraints C fx P 1 g , C fx P 2 g , and C fx P 3 g .L [ R ⊭frunningg ) finland; constantg, if only if the following formulae are satisfiable: where p m is a propositional variable corresponding to an attribute m 2 M of formal context ðG; M; IÞ.Example 3. Recall Example 1 and Example 2. Suppose L consists of the following attribute implications:

Table 1
Comparison of non-redundant implicational base with different constraints.