Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Conditional proposition 1: If it is sunny, then I'll go.
Conditional proposition 2: I will go unless it is not sunny.
Let's decompose them as simple propositions.
A: It is sunny.
B: I will go.
Thus re-write the previous 2 conditional propositions:
1: If A, then B
2: B, unless not A
In my opinion, the truth table for each of them are:
1:
A--------B--------Proposition 1
T--------T-------------T
T--------F-------------F
F--------T-------------T
F--------F-------------T
2:
A--------B--------Proposition 2
T--------T-------------T
T--------F-------------F
F--------T-------------F <---- here is the difference.
F--------F-------------T
So I think these 2 statements are not equivalent, but the famous Discrete Mathematics and its Applications by Kenneth H. Rosen indicates that they are equivalent.
Could someone shed some light on this?
Another post is made here:
https://math.stackexchange.com/questions/129691/are-these-two-statements-equivalent
I think the issue is the word "unless." Unless is really describing when something is not true.
Conditional proposition 1: If it is sunny, then I'll go.
Conditional proposition 2: I will go unless it is not sunny. I.E. If it is not sunny, I will not go.
1: If A, then B
2: If Not B, then Not A
A ⇒ B is the same as ¬B ⇒ ¬A. I can't remember the exact name of the law, but it's easy to derive. Use the implication law to convert it to ¬A ∨ B and B ∨ ¬A and the commutative law will change B ∨ ¬A to ¬A ∨ B
Related
In the car industry you have thousand of different variants of components available to choose from when you buy a car. Not every component is combinable, so for each car there exist a lot of rules that are expressed in propositional logic. In my case each car has between 2000 and 4000 rules.
They look like this:
A → B ∨ C ∨ D
C → ¬F
F ∧ G → D
...
where "∧" = "and" / "∨" = "or" / "¬" = "not" / "→" = "implication".
With the tool "limboole" (http://fmv.jku.at/limboole/) I am able to to convert the propositional logic expressions into conjunctive normal form (CNF). This is needed in case I have to use a SAT solver.
Now, I would like to check the buildability feasibility for specific components within the rule set. For example, for each of the following expressions or combinations, I would like to check if the are feasible within the rule set.
(A) ∧ (B)
(A) ∧ (C ∨ F)
(B ∨ G)
...
My question is how to solve this problem. I asked a similar questions before (Tool to solve propositional logic / boolean expressions (SAT Solver?)), but with a different focus and now I am stuck again. Or I just do not understand it.
One option is to calculate all solutions with an ALLSAT approach of the rule set. Then I could check if each combination is part of any solution. If yes, I can derive that this specific combination is feasible.
Another option would be, that I add the combination to the rule set and then run a normal SAT solver. But I would have to do it for each expression I want to check.
What do you think is the most elegant or rather easiest way to solve this problem?
The best method which is known to me is to use "incremental solving under assumptions" technique. It was motivated by the same problem you have: multiple SAT instances (CNF formulae) which have some common subformulae.
Formally, you have some core Boolean formula C in CNF. And you have a set of assumptions {A_i}, i=1..n, where A_i is a Boolean formula in CNF also.
On the step 0 you provide to the solver your core formula C. It tries to solve it, says a result to you and save its state (lets call this state as core-state). If formula C is satisfiable, on the step i you provide assumption A_i to the solver and it continues its execution from the core-state. Actually, it tries to solve a formula C ∧ A_i but not from the beginning.
You can find a bunch of papers related to this topic easily, where much information is located. Also, you can check you favorite SAT-solver for the support of this technique.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
How do I get from premise ~~(AvB) to ~~(BvA).
Been working on it for a long time but I haven't found the solution yet. Appreciate the help!
Let <-> denote equivalence. We have,
~~(A v B) <-> A v B ; law of double negation
A v B <-> B v A ; because v is commutative
B v A <-> ~~(B v A) ; again, double negation
Thus
~~(A v B) <-> ~~(B v A)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
If the sun shines then it is true that I get wet if it rains.
If the sun shines then it is summer.
It is not summer.
Therefore, I get wet if the sun shines.
I. A proposition symbol represents something that can be either true or false. For example claims 1, 2, and 4. Above, there are statements like “the sun shines” that can be either true or false. Define a propositional symbol for each of these statements.
II. Translate 1, 2, 3 and 4 to propositional logic sentences using your proposition symbols from (i).
Using CLP(B) in SICStus Prolog or SWI to to prove the final implication from the preceding statements:
?- sat(Sun =< (Wet =< Rain)),
sat(Sun =< Summer),
sat(~Summer),
taut(Sun =< Wet, T).
yielding:
...
T = 1,
...
This shows that the final implication follows from the previous statements.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I have to write a rule square(S) in Prolog that tests if a number S is the square of an integer returning false (ex. square(3)) or true (ex. square(4)).
I used already a rule that generates all integers between 0 and M:
isInteger(X,M) :- between(0,M,X).
Using this generator I have to write the rule square(S). How can I do it?
Thanks
This probably will not work as a solution for your homework, but here is one of many ways to do it using constraint logic programming in ECLiPSe CLP Prolog:
:- lib(gfd).
square(S) :-
sqr(_) #= S.
It means: S is a square if it's an integer and some other value (we don't care what value, so we use "throw-out" variable _) squared equals S.
All modern Prolog systems supports constraint logic programming, and the code will be similar to above.
To solve it your way, you just need to check if S is the product of your generated integer multiplied by itself. So you could do it like this:
isInteger(X,M) :- between(0,M,X).
square(N) :-
isInteger(X, N),
N is X * X.
I came up with another possible solution, using the sqrt arithmetical function from SWI-Prolog but I think there must be a more elegant one.
I initially expected it would be as simple as X is sqrt(4), integer(X). However, this doesn't work (at least not in SWI-Prolog 7.1.4), because X is unified with the float 2.0 and integer(2.0) is false (since integer is checking the data type, not the value of the number). But this works:
square_of_integer(N) :-
Int is rationalize(sqrt(N)),
integer(Int).
It depends on first giving a representation of N as a rational (which, in SWI-Prolog, 'are represented by the compound term rdiv(N,M)'). 2 is rationalize(2.0), i.e., rationalize evaluates to an integer for round numbers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
I'm reading about an algorithm (it's a path-finding algorithm based on A*), and it contains a mathematical symbol I'm unfamiliar with: ∀
Here is the context:
v(s) ≥ g(s) = mins'∈pred(s)(v(s') + c(s', s)) ∀s ≠ sstart
Can someone explain the meaning of ∀?
That's the "forall" (for all) symbol, as seen in Wikipedia's table of mathematical symbols or the Unicode forall character (\u2200, ∀).
The upside-down A symbol is the universal quantifier from predicate logic. (Also see the more complete discussion of the first-order predicate calculus.) As others noted, it means that the stated assertions holds "for all instances" of the given variable (here, s). You'll soon run into its sibling, the backwards capital E, which is the existential quantifier, meaning "there exists at least one" of the given variable conforming to the related assertion.
If you're interested in logic, you might enjoy the book Logic and Databases: The Roots of Relational Theory by C.J. Date. There are several chapters covering these quantifiers and their logical implications. You don't have to be working with databases to benefit from this book's coverage of logic.
In math, ∀ means FOR ALL.
Unicode character (\u2200, ∀).
Can be read, "For all s such that s does not equal s[start]"
yes, these are the well-known quantifiers used in math. Another example is ∃ which reads as "exists".
http://en.wikipedia.org/wiki/Quantification