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
0 votes
0 answers
35 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
  • 440
2 votes
1 answer
105 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
0 votes
0 answers
25 views

How can I combine an identity predicate with first-order predicates while using FindEquationalProof

I am trying out some of the automated theorem proving in mathematica, and for my test case am working with Tarski and Sczerba's (mostly) first-order axiomatization of Affine Geometry, which has just ...
Jason Turner's user avatar
2 votes
1 answer
75 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
31 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
  • 8,973
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,149
5 votes
1 answer
148 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
159 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
  • 197
2 votes
1 answer
154 views

Field axioms in Mathematica

I don't understand the result of AxiomaticTheory["FieldAxioms", "Axioms"] ...
user64494's user avatar
  • 23.2k
0 votes
1 answer
47 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
110 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,037
2 votes
1 answer
292 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
99 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,037
2 votes
3 answers
251 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
  • 23.2k
5 votes
2 answers
177 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
  • 37.7k
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
110 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
122 views

How to unfolding (expand) logical expression?

How to expand the following expression ...
M.K's user avatar
  • 255
0 votes
0 answers
53 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
116 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
330 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
  • 453
3 votes
1 answer
58 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,122
2 votes
4 answers
163 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,037
0 votes
0 answers
38 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
85 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,037
1 vote
1 answer
40 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
204 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
229 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
162 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
  • 23.2k
-1 votes
2 answers
156 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
64 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,125
0 votes
1 answer
120 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
199 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
  • 988
1 vote
1 answer
87 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
396 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
109 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
2 votes
0 answers
58 views

Determine if a mathematical statement always holds

I know that $\exists a,a\in\mathbb{Z}\land a+1>a$ is always true, and $\forall a,a\in\mathbb{Z}\Rightarrow a+1>a$ is also always true; I try to use function ...
Ethan's user avatar
  • 225
1 vote
1 answer
190 views

How can I show that the equation holds?

Suppose we have the following data: $ r=\frac{vk}{h^2}$ $u[i,j]$ is a function of two variables with $i,j$ integers. $\frac{u[i,j+1]-u[i,j]}{k}=v\frac{u[i+1,j]-2u[i,j]+u[i-1,j]}{h^2}$ Then I would ...
dmtri's user avatar
  • 530
16 votes
0 answers
201 views

Reduce[Sin[x]==0,x] splitting odd and even multiples of Pi

as from Title, I'm wondering why Mathematica does not automatically give a single, simple solution for the problem Reduce[Sin[x] == 0, x] for which I obtain the ...
Luca Ferroglio's user avatar
0 votes
1 answer
168 views

Defining relations between functions in Mathematica

I would like to find a way to implement the following in Mathematica: Let $F$ be the set of real functions $f_1,f_2,\ldots f_n$. The function $\min$ is defined as follows... $$\min F=f_i\iff \forall ...
R. Burton's user avatar
  • 145
1 vote
0 answers
75 views

Is there simplest and universal way to ask Mathematica to give you in which cases it is True and in which False? [closed]

This question emerged from this comment. This answer explains how to do that with particular equation with several steps but I am interested if there exists more simple and universal method to just ...
vasili111's user avatar
  • 1,139
5 votes
2 answers
958 views

Why I am not getting True when testing equation?

My input is: $ \frac{1}{a^x}==(\frac{1}{a})^x $ I want to get output: True But getting output: $ a^{-x}==\left(\frac{1}{a}\right)^x $ Question: How to get ...
vasili111's user avatar
  • 1,139
1 vote
1 answer
94 views

Convert ProofNotes to $ \mathrm\LaTeX $ logic expression

The following code will generate some ProofNotes: ...
Ethan's user avatar
  • 225
7 votes
1 answer
214 views

Using logical equivalence to prove PL statements

I'm trying to use those Logical equivalence as axioms to prove some PL statements, In this case I followed the examples in the documentation that didn't use the build-in logic functions$\{\text{And}[,]...
Ethan's user avatar
  • 225
1 vote
1 answer
140 views

Using Select and AllTrue to filter elements of a large nested list based on relations between elements of the smaller nested lists

I tried searching but all similar questions seemed to be based around one Boolean logical statement. I'm dealing with a nested list of pairs partitions of integers, such that the sum of the two ...
Nick Macleod's user avatar
1 vote
1 answer
86 views

TrueQ returning False on true, non-numerical statement

I'm trying to test the following logical statement: state = {{1,1,1}}; Or[state != 0, state != Null] but it's returning False ...
Natavi's user avatar
  • 13
0 votes
0 answers
187 views

Completely expand and simplify logical expressions?

Consider a logical expression such as expr = (a == b + q - w || c == d) && (q + c - d == w || e == r); I wonder if there is a function that would ...
Kagaratsch's user avatar
  • 11.9k
2 votes
0 answers
104 views

How do I transform a 1st order logic formula into Skolem normal form? [closed]

I have a predicate calculus (first-order logic) problem. I have the formula $\qquad \forall x[\neg P(x) \land \forall y \neg Q(x,y) \rightarrow \forall x \forall y R(x,y,z)]$ I want to express ...
Elvin's user avatar
  • 141