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
0answers
52 views

Strange behavior of FindInstance

I try to solve a problem from Kazakhstan math school competition (see it here in Russian) by ...
3
votes
1answer
50 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 ...
2
votes
4answers
148 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 ...
0
votes
0answers
24 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 ?
1
vote
0answers
75 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....
1
vote
1answer
24 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. ...
0
votes
0answers
29 views

Clarifying the syntax of FindEquationalProof

Could someone clarify the definitions of "statement" and "expression" in the manual entry for FindEquationalProof? The best I can make of it is that an expression $E$ is either a ...
1
vote
1answer
142 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 ...
17
votes
1answer
952 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." ...
5
votes
0answers
180 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 ...
3
votes
1answer
129 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) ...
-1
votes
1answer
47 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 ...
2
votes
1answer
57 views

perform logical or on sublist of a list efficiently

Given a huge list x of 0s and 1s and an increasing list i...
0
votes
1answer
51 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). ...
2
votes
0answers
90 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: <...
1
vote
1answer
52 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, ...
3
votes
3answers
188 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 ...
1
vote
1answer
38 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)...
2
votes
0answers
54 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 ...
1
vote
1answer
113 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 ...
15
votes
0answers
150 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 ...
0
votes
1answer
99 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 ...
1
vote
0answers
67 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 ...
5
votes
2answers
945 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 ...
1
vote
1answer
83 views

Convert ProofNotes to $ \mathrm\LaTeX $ logic expression

The following code will generate some ProofNotes: ...
7
votes
1answer
185 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}[,]...
1
vote
1answer
81 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 ...
1
vote
1answer
61 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 ...
0
votes
0answers
126 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 ...
2
votes
0answers
80 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 ...
23
votes
0answers
862 views

Mathematica vs. state-of-the-art SAT solvers

I found some fascinating paper by Marijn Heule and Oliver Kullmann on advances in SAT solvers and automated reasoning. In particular, the authors where able to show (a year earlier) a breakthrough ...
1
vote
1answer
57 views

Can I get mapping as output from SatisfiabilityInstances?

Consider the code: SatisfiabilityInstances[Implies[a, b], {a, b}, All] (* output *) {{True, True}, {False, True}, {False, False}} I would like to obtain the ...
5
votes
3answers
322 views

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 ...
0
votes
1answer
80 views

Why is Resolve not reducing my set?

I tried to run the following code to get the region where (v,b,r) satisfies some complicated set of inequalities. ...
0
votes
1answer
84 views

Problem with Resolve

The question is: for which values of the parameter $a$ the equations $$4^{x+1}-3\ 2^{x+3}=2^{x+4}-64 $$ and $$(a+30) \left(-9^x\right)+3^{x+4}+27^x=a \left(81-10\ 3^{x+1}\right) $$ are equivalent? ...
3
votes
0answers
146 views

How to implement projective geometry in MMA?

I'd like to implement 2D projective geometry in Mathematica, making use of the FindEquationalProof command. Up to Wiki ru.wikipedia.org (This topic is better ...
6
votes
1answer
301 views

FindEquationalProof with Logic in Wolfram Mathematica

I try to "make" proof in Wolfram Mathematica. Thats a proof: if a->b and b->c then a->c I tried ...
1
vote
1answer
81 views

How to judge whether a relation is true or false

$x$ is a real number, how to judge $x+1>x$ is true using Wolfram.
3
votes
0answers
2k views

Semantic tableaux generator

I would like to use Mathematica to automatically generate a semantic tableaux (truth tree) from a formula in propositional logic). Here is an example formula: $$(a \lor\lnot b )\land b$$ Here is ...
6
votes
3answers
284 views

Why Can't Mathematica Resolve this Simple Quantified Expression?

I've been using Mathematica as a hobbyist, off and on, for some time. So while I'm by no means an expert I've used it long enough to know that what might seem obvious to me is not necessarily obvious ...
3
votes
2answers
149 views

How to test all possible input for a logic function?

I have a logic expression: f0[a0_, a1_, a2_, a3_] := a0 And Not a1 And Not a2 And a3 Or Not a0 And a2 And a3 Or Not a0 And a1 And a3, I know I should use ...
1
vote
1answer
65 views

Logical equivalence of logical propositions that are converted from compact (implicit) notation to Mathematica code

Here is logical formula: $$\bigwedge_{i=1}^{9} \bigwedge_{n=1}^{9} \bigvee_{j=1}^{9}~p(i,j,n)$$ To use it in Mathematica I use that code: ...
3
votes
1answer
131 views

Is it possible to resolve this proposition?

Executing this code (see MSE for its background) ...
4
votes
2answers
177 views

How can I input a logical proposition using a compact (implicit) notation?

I have: $$\bigwedge_{i=1}^{9} \bigwedge_{n=1}^{9} \bigvee_{j=1}^{9}~p(i,j,n)$$ How can I write it in Wolfram Mathematica code? I tried this way, but it does not work: ...
5
votes
3answers
764 views

How to check if compound proposition is contradiction (is always false)?

I know how to check compound proposition if it is tautology with TautologyQ[]. But I have not found any function that can check if the compound proposition is ...
1
vote
1answer
41 views

How to add additional variable columns for negated variables to generated truth table

I am creating truth table for $ p\Rightarrow !q $ with: ...
0
votes
0answers
56 views

How to input truth table and generate corresponding logical expression? [duplicate]

I want to input truth table and generate the corresponding logical expression. For example, I have truth table: ...
1
vote
1answer
281 views

What is the easiest way to get truth table of logical expression?

I remember that some time ago when I entered a logical expression like $a\wedge b$ in the notebook there was an option (button or menu selection or etc.) to click and generate truth table for it ...
2
votes
1answer
276 views

How to force 2=={} as a Boolean output?

I have a code as below:- x = 2; If[x == {}, 1, 0] I want the output to be 0, but the output I got is the entire ...
2
votes
0answers
49 views

Logic - why isn't 'True' doing what I expect it to? [duplicate]

I have the following code ...