Skip to main content

Questions tagged [logic]

Questions on use and formulation of logical operations, including both functions for programming and for mathematical operations.

Filter by
Sorted by
Tagged with
-3 votes
2 answers
205 views

How to solve this geometric problem with Mathematica?

I try to solve the following problem, making use of 14.0 on Windows 10 Let a triangle $\Delta$ (a contour with its interior) be chosen in the unit square $S$. To prove that the closure of the ...
user64494's user avatar
  • 26.7k
5 votes
2 answers
127 views

Simplifying a logical expression with multivariate polynomials

I have several expressions similar to a (a b + c d) != 0 || b (a b + c d) != 0 || c (a b + c d) != 0 || d (a b + c d) != 0 and I would like to reduce them ...
მამუკა ჯიბლაძე's user avatar
5 votes
1 answer
125 views

Can we find validity proofs by means of rules of inference with FindEquationalProof?

Can we find proofs such as: Using FindEquationalProof? My guess is "yes" but I don't know what would be the "axioms" here nor how would we write this in Mathematica.
Red Banana's user avatar
  • 5,401
4 votes
4 answers
99 views

Why does FindInstance require specifying variables, and how to transform a list of logical expressions into the list of its variables [duplicate]

It would be convenient to have a function VarsfromLogical which out of {a+b>c,c+d==a} outputs {a,b,c,d} Incidentally, I use ...
florin's user avatar
  • 1,798
1 vote
1 answer
45 views

Performing logical reasoning to find minimum function between two functions

Consider the following two expressions: f[x_,y_] := (1+x) g[x_,y_] := (1+x*y^2) x,y are bounded in a unit hypercube. (Ignore ...
BabaYaga's user avatar
  • 1,888
9 votes
2 answers
1k views

Can Mathematica perform logical reasoning?

The question goes like this: Ms. Li has just moved into a new home and plans to buy several potted plants at once. Her thoughts are as follows: Buy either Green Radish or Podocarpus. Buy at least ...
csn899's user avatar
  • 4,315
2 votes
1 answer
60 views

FromLetterNumber and "" bug or intended behaviour

DigitQ behaviour appears consistent "" is treated as 0 by DigitQ` ...
IntroductionToProbability's user avatar
3 votes
1 answer
74 views

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{....
Red Banana's user avatar
  • 5,401
1 vote
2 answers
124 views

Defining a Boolean Region [duplicate]

I'd like to define a new region that is "within direct sight" of a certain point within an existing region. For the example below, the regions highlighted in red from the black point are not ...
Tomi's user avatar
  • 4,438
3 votes
1 answer
103 views

How to get the function-basis as they appear in the expression?

I have the following expression containing functions eg. Log, PolyLog etc, ...
BabaYaga's user avatar
  • 1,888
2 votes
2 answers
309 views

How to simplify logical expression?

I would like to simplify (a == c && c != 0) || (a == 0 && c == 0) to a == c How can I do that?
Cindy9's user avatar
  • 21
1 vote
1 answer
161 views

How can I Xor two decimal numbers?

I want to take two numbers, say 200 and 101, and transform them into their binary form. Then XOR them together and transform the result back into the decimal form. The result in this case should be ...
Alexei Boulbitch's user avatar
0 votes
0 answers
55 views

BooleanConvert: Boolean decision tree

The BooleanConvert function includes an available form called "Boolean decision tree": BDT. What is the formal logical definition of a Boolean decision tree as used here? What is the ...
ShyPerson's user avatar
  • 495
0 votes
0 answers
42 views

Symbolic solutions to systems of Boolean constraints?

Is it possible to solve a system of Boolean constraints symbolically? I'm trying to solve systems like the following, where $X$ is the unknown Boolean expression I'm trying to find, $a, b, c$ are the ...
ShyPerson's user avatar
  • 495
2 votes
1 answer
121 views

Is there a function which tests whether a Boolean expression is an inequality?

For something I am doing in Mathematica, it would be very helpful to have a function f[] which, when applied to an atomic Boolean expression, returns True if the Boolean expression is an inequality, ...
user871418's user avatar
2 votes
1 answer
81 views

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. ...
Azzurro94's user avatar
  • 499
1 vote
0 answers
34 views

How to count the number of disjoint regions covered by a Boolean expression?

Consider the following Boolean expression as an example: ...
user13892's user avatar
  • 9,443
0 votes
1 answer
60 views

Does applying Reduce result in an equivalence or a oneway implication or both? [closed]

If I type something like this into Mathematica: ...
Mats Granvik's user avatar
  • 1,159
5 votes
1 answer
188 views

Generating language from grammar

To be concrete, consider the following formal grammar: $$S \rightarrow aSb$$ $$S \rightarrow \varepsilon$$ The language generated by this grammar is $L = \{ a^n b^n | n \geq 0 \}$. How can I implement ...
Integral's user avatar
  • 423
2 votes
1 answer
178 views

Make a plot of the nth prime divided by n*log(n) ,for n from 2to1000 [closed]

ListPlot[Table[RandomReal[n, Prime[1000]]/n*log (n), {n, 2, 1000}]] this is all i can do.
Ratheesh's user avatar
  • 317
2 votes
1 answer
209 views

Field axioms in Mathematica

I don't understand the result of AxiomaticTheory["FieldAxioms", "Axioms"] ...
user64494's user avatar
  • 26.7k
0 votes
1 answer
48 views

Need help with Assumptions for an integral

I want to solve this Log, Integrate[2a Log[-a+((A0 + (y-y1)²)^½, {y1, 0,b}] But Mathematica only gives me long conditional expressions or imaginary numbers. I (my thinking which can be wrong) assume I ...
M S's user avatar
  • 1
6 votes
2 answers
117 views

How to solve logic problem with a joker sometimes tell truth and sometimes lie?

If there are only truth teller and liar, I used to solve with BooleanConvert or SatisfiabilityInstances. However for this one, ...
timhu's user avatar
  • 101
2 votes
1 answer
92 views

Evaluation process of And, Or,

Small questions about evaluation process of And, Or. code 1) ...
imida k's user avatar
  • 4,295
2 votes
1 answer
295 views

What's wrong with or? [closed]

Consider Clear[x]; x = 2; x < 2.9 || x > 3.1 This yields True So, everything is o. k. (interesting) But when you replace ...
user7427029's user avatar
2 votes
1 answer
101 views

Simple way to express disjunction likes x==a || x==b || x==c ||

Is there a simple, shorter way to express x==1||x==2||x==3... ? For example, suppose that there is a roulette having integers 1 to 10 1> assigin 10% for 1 to 8 ...
imida k's user avatar
  • 4,295
2 votes
3 answers
268 views

How to prove or disprove an inequality with Mathematica?

I mean there exist $\lambda>0, x\in \mathbb R$ s.t. the inequality $$ \frac{3^{\lambda } e^x+e^{3 x}+1}{2^{\lambda } e^{2 x}}<\frac{1}{10^{100}}$$ is valid. Here are my unsuccessful attempts. <...
user64494's user avatar
  • 26.7k
5 votes
2 answers
206 views

Logical functions with no arguments

I am trying to understand how logical functions are evaluated if no arguments are passed to them. {Or[], Nor[], And[], Nand[], Xor[], Xnor[]} {False, True, True, ...
Syed's user avatar
  • 55.4k
1 vote
0 answers
36 views

Reduce works for simple inequalities in Reals but not in Integers

In the domain of Reals Reduce correctly reduces the system to True: ...
Pavel Perikov's user avatar
1 vote
2 answers
118 views

How to transfer the logical expression to list of list?

As described in the title, I would wondering: How to transfer the solutions give by the following code ...
M.K's user avatar
  • 255
1 vote
2 answers
147 views

How to unfolding (expand) logical expression?

How to expand the following expression ...
M.K's user avatar
  • 255
0 votes
0 answers
60 views

Ordinal arithmetic

How can I compute with ordinals in mathematica? For instance, I'd like to query $2+\omega > 1 + 2 \omega$.
user1868607's user avatar
1 vote
1 answer
119 views

How to convert this Mathematica expression to another, as described here?

I am working on a function of which the core will consist of something like: ...
nilo de roock's user avatar
6 votes
1 answer
358 views

How can I self-define a keyboard entry for 3-dot "Because"?

In Mathematica, there already exists a keyboard entry for 3-dot "Therefore", which provides great convenience for input as shown below. However, I find it a little odd that for its ...
AlbertLew's user avatar
  • 483
3 votes
1 answer
62 views

Intermediate results from SatisfiabilityInstances

I have a large logical expression, with roughly 100 boolean variables. I am interested in the solution with the smallest numbers of True. It seems there is no such ...
Mario Krenn's user avatar
  • 2,182
2 votes
4 answers
168 views

For all x in {1,2,3}, x is bigger than 4

I am new to ForAll or Exists command. Resolve[ForAll[x, Element[x, Reals], x > 4]] gives ...
imida k's user avatar
  • 4,295
0 votes
0 answers
39 views

LogitModelFit for predicting Categorical Variable

I was wondering how can I use LogitModelFit to predict the probability of a categorical variable based on non-categorially variables ?
Pjana's user avatar
  • 41
1 vote
0 answers
87 views

TautologyQ like feature that also works for inequalities

If a=b and b=c, then a=c. So in mathematica, TautologyQ[(a == b) && (b == c) \[Implies] a == c, {a, b, c}] yields 'True'. If a<b and b<c, then a<c....
imida k's user avatar
  • 4,295
1 vote
1 answer
42 views

Conditional tab view

I'd like to create a tabview with conditions on it, rather than put the tabview inside an If statement, to reduce the length of my code. i.e. ...
Daniel's user avatar
  • 53
1 vote
1 answer
217 views

How can I change the Mathematica programming for creating a Venn Diagram?

I am working on using Venn diagram to explain logic and logical connections between sets. After coming upon these answers: Create a Venn Diagram, How to plot Venn diagrams with Mathematica?, which I ...
Peter Burbery's user avatar
19 votes
2 answers
1k views

How can I use Mathematica to solve a complex truth-teller/liar logic problem?

I have a logic puzzle I want to convert to Mathematica to solve: Person A states, "Exactly two people are truth-tellers," Person B states, "I and Person C are truth-tellers." ...
Peter Burbery's user avatar
5 votes
0 answers
235 views

Incorrect result by DSolve

For real $x$ consider the trivial equation $$|y'(x)|=-|x|.$$ Since the left side is always positive and the right always negative, there is no solution. Let's try ...
JHT's user avatar
  • 1,005
3 votes
1 answer
178 views

Axiomatizing naturals

Trying to implement the naturals in Mathematica, I follow E. Mendelson, Introduction to Mathematical Logic, Ch. 3, Par. 1. Here is my code for the axioms (exept the induction axiom) ...
user64494's user avatar
  • 26.7k
-1 votes
2 answers
212 views

How to check if solution to NSolve exists?

I'm trying to created a table where the entries are values of x, either given by x/.NSolve[...][[1]] or a fixed value x0 if there is no numerical solution. Is there a way to find the truth value for ...
John Smith's user avatar
2 votes
1 answer
68 views

perform logical or on sublist of a list efficiently

Given a huge list x of 0s and 1s and an increasing list i...
Leo's user avatar
  • 1,155
0 votes
1 answer
171 views

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). ...
TomR's user avatar
  • 101
2 votes
0 answers
245 views

Natural deduction with FindEquationalProof

Out of curiosity, I'm trying to implement a natural deduction prover in Mathematica using FindEquationalProof. So far, I've implemented a few of the easier rules: <...
imas145's user avatar
  • 998
1 vote
1 answer
96 views

Solving a ForAll optimization problem in Mathematica

I am trying to solve the following optimization problem in Mathematica: Minimize[{y0 + y2 m2, ForAll[x, y0+y2 x^2 >= Boole[x>0]]}, {y0,y2}] Unfortunately, ...
Thomas Ahle's user avatar
3 votes
3 answers
459 views

count conditional items in list

I have a list of the form: {1,1, (1 if x>y, -1 if y>=x), -1} I want to count the number of 1's in the list. The output I'm looking for is something of the ...
naomig's user avatar
  • 343
1 vote
1 answer
130 views

Applying functions to members of members... of lists of lists..., etc

Suppose that I have a list of depth $k$, and I want to apply a function $f$ to all elements at level $n$ - e.g. $f,\{\{\{a,b\},\{b,c\}\},\{\{c,d\}\}\},3\mapsto\{\{\{f(a),f(b)\},\{f(b),f(c)\}\},\{\{f(c)...
R. Burton's user avatar
  • 145