A tool for solving propositional logic / Boolean expressions (SAT Solver?)

I am new to the topic of propositional logic and Boolean expressions. That is why I need help. Here is my problem:

In the automotive industry, you have thousands of different component options available to choose from when you buy a car. Not every component is combined, so for every car there are many rules that are expressed in propositional logic. In my case, each car has from 2000 to 4000 rules.

They look like this:

  • A → B ∨ C ∨ D
  • C → ¬F
  • F ∧ G → D
  • ...

where "∧" = "and" / "∨" = "or" / "¬" = "not" / "→" = "implication".

Variables A, B, C, ... are associated with the components in the material specification. The data that I have consists of pairs of components with their associated variables.

Example:

  • Component_1, Component_2: (A) ∧ (B)
  • Component_1, Component_3: (A) ∧ (C ∨ F)
  • Component_3, Component_5: (B ∨ G)
  • ...

Now, my question is how to solve this problem. In particular, I would like to know if each combination of components is possible in accordance with the above rules.

  • What tool, software and algorithm can solve these problems?
  • Is there an illustrative example?
  • How can I automate it, so I can check every combination in my list?
  • Typically, what should I look for on Google to deepen my knowledge of this topic?

Many thanks for your help! Olaf

+4
source
1

, Prolog SAT Solver, SWI-Prolog, Jekejeke Minlog ..... REPL Prolog. SAT- ( ?):

/* in SWI-Prolog */
?- use_module(library(clpb)).

/* in Jekejeke Minlog */
?- use_module(library(finite/clpb)).

, : xor:

?- sat(X#Y), labeling([X,Y]).
X = 0,
Y = 1 ;
X = 1,
Y = 0.

. 3 , . .

0,1, 1,0. .

:- use_module(library(finite/clpb)).

freezer([X,Y|L],[(~X)*Y|R]) :-
   freezer(L, R).
freezer([], []).

stove([X,Y|L],[X*(~Y)|R]) :-
   stove(L, R).
stove([], []).

free([X,Y|L],[(~X)*(~Y)|R]) :-
    free(L, R).
free([], []).

allowed([X,Y,Z,T|L]) :-
   sat(~((~X)*Y*Z*(~T))),
   sat(~(X*(~Y)*(~Z)*T)),
   allowed([Z,T|L]).
allowed([_,_]).
allowed([]).

kitchen(L) :-
   freezer(L, F), card(1, F),
   stove(L, G), card(1, G),
   free(L, H), card(1, H),
   allowed(L).

, Prolog, - , SAT Prolog. , , :

?- L=[_,_,_,_,_,_], kitchen(L), labeling(L).
L = [0,1,0,0,1,0] ;
L = [1,0,0,0,0,1] ;
No
+1

Source: https://habr.com/ru/post/1689506/


All Articles