Questions on use and formulation of logical operations, including both functions for programming and for mathematical operations.
Questions tagged [logic]
158 questions
7
votes
3 answers
How to realize a formal grammar in Mathematica?
This is important because translators and compilers are based on formal grammars.
Solid textbooks on algorithmic lanquages include a chapter or an appendix devoted to
formal grammars.
Let us consider a formal grammar
from the cited Wiki article…
user64494
- 26,149
- 4
- 27
- 56
6
votes
3 answers
What exactly is Implies? Is it a logical test?
I ran the following to simplify my logical test (expecting something in terms of And and Or ...)
FullSimplify[Not[a] || (a && b)]
and was surprised to see
$a \Rightarrow b$ (*Implies[a, b]*) .
I thought "implies" is a statement you deduce from a…
QuantumDot
- 19,601
- 7
- 45
- 121
5
votes
3 answers
Apply Complement to a list of matrices
With a list of defined matrices
list={a,b,c,d}
How can I apply Complement to obtain
Complement[list,{b,c}]=={a,d}
Phillip Dukes
- 938
- 5
- 18
3
votes
2 answers
Boolean value of proposition assuming previous boolean values of parts of the proposition
Is it possible to ask Mathematica to give us the boolean value of a proposition assuming the boolean value of some parts of it?
For instance, give the boolean value of $p\vee q$ assuming that $p$ is true and $q$ is false.
Concept7
- 139
- 1
3
votes
1 answer
How can we express more complex logical expressions in Mathematica?
How can we use quantifiers to express something a bit more complex such as - for example - the definition of limit:
$$\forall \epsilon >0\hspace{2mm} \exists \delta >0 \hspace{.5mm} :\hspace{.5mm} 0<|x-a|<\delta \implies |f(x)-L|<\epsilon$$
It's not…
Red Banana
- 5,329
- 2
- 29
- 47
3
votes
1 answer
Is it possible to resolve this proposition?
Executing this code (see MSE for its background)
ForAll[{a, b, c}, Implies[ForAll[x, -1 <= x <= 1, RealAbs[a*x^2 + b*x + c] <= 1],
ForAll[x, -1 <= x <= 1, RealAbs[c*x^2 + b*x + a] <= 2]]]
Resolve[%, Reals]
, I obtain
Beep:The kernel Local has…
user64494
- 26,149
- 4
- 27
- 56
2
votes
1 answer
Implies cannot find an answer
I have a simple relation and I try to find if P implies Q or not. I expect to get True because it is somehow obvious for me.
P1 = j == i && j < 0 && t >= -j
Q = t>0
FullSimplify[ Reduce[ForAll[{i, j, t}, Implies[ P1 , Q]]]]
When I run this I get an…
Azzurro94
- 499
- 2
- 9
2
votes
0 answers
Logic - why isn't 'True' doing what I expect it to?
I have the following code
test[variable_: 0] := Module[{},
If[variable != True, Print["worked"]];
];
test2[variable_: 0] := Module[{},
If[variable == True, Print["worked"]];
];
If I run
test2[True]
I get "worked" as I expect.
But…
Tomi
- 4,366
- 16
- 31
2
votes
2 answers
Discarding a triple because of the absence of monotonicity
Sorry for the title, but I can not think of a better one.
Starting informally, monotonicity says that if the number of votes for i is greater that the number of votes for j, the number of seats for i must be greater or equal to the number of seats…
cyrille.piatecki
- 4,582
- 13
- 26
2
votes
0 answers
Translating arguments into Predicate Logic
Consider the paragraph given below.
If all the boy friends are either HH or NN, then there are no CC.but Jone is a CC. therefore some boy friends are not NN..
a) translate the following arguments into Predicate Logic
b) using the change of…
user48264
- 21
- 1
1
vote
1 answer
Resolving a logical statement
I would like to test whether f[n] > 0 and f[n + 1] > 0 implies f[n + 2] > 0.
This is what I tried:
f[n] == n*f[n - 2] + f[n - 1];
Resolve[ForAll[n, Implies[n > 0 && f[n - 2] > 0 && f[n - 1] > 0, f[n] > 0]], Reals]
I was expecting output True, but…
user31953
- 13
- 4
1
vote
2 answers
How to unfolding (expand) logical expression?
How to expand the following expression
(b == 0 || b == \[Pi] ) && (a == 0 || a == \[Pi])) || (3 a == 2 \[Pi] &&
3 b == 4 \[Pi]) || (3 a == 4 \[Pi] && 3 b == 2 \[Pi])
to the following…
M.K
- 255
- 1
- 7
1
vote
1 answer
Checking whether statement A implies statement B
I would like to ask Mathematica "does statement A imply statement B?" and get a yes or no (true or false) answer whenever one exists.
I have entered the input Reduce[ Implies[x>0 && y>0 , xy > 0] ]. The output I was expecting was true. The output I…
Ubiquitous
- 863
- 2
- 7
- 15
0
votes
2 answers
PEANO Integers using successor function
I'd like to define the integers and operations on it by using terms. Starting from
zero->init[] and nth->succ[n-1th] where succ[] is the successor function.
I believe the operations could be implemented as…
Chris
- 3
- 1
0
votes
1 answer
First Order/Higher Order Logical Forward reasoning in Mathematica (Mathematica for FOL/HOL knowledge base)?
I am trying to develop Artificial Intelligence system that can automatically discover and apply reasoning patterns, templates, strategies (there is even theory for that - Cognitive Task Analysis). While the details of my effort are in development…
TomR
- 101
- 2