The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1
vote
1answer
26 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
56 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
34 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 ...
1
vote
0answers
61 views

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

I have a predicate calculus (1st 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 wamt to express this ...
18
votes
0answers
361 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
50 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 ...
4
votes
2answers
169 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
70 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
78 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
87 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 ...
5
votes
1answer
138 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
63 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
218 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 ...
5
votes
3answers
157 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
102 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
52 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
113 views

Is it possible to resolve this proposition?

Executing this code (see MSE for its background) ...
4
votes
2answers
131 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
376 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
24 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
45 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
123 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
250 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 ...
1
vote
1answer
46 views

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 (...
0
votes
0answers
53 views

How to check if two subspaces are conjugate?

I want to check if there exists an element $g \in SL(2,\mathbb{R})^2$ such that $Ad(g) \mathfrak{h} = \mathfrak{h}_\lambda$ for some given subalgebras $\mathfrak{h},\mathfrak{h}_\lambda \subset \...
0
votes
1answer
46 views

Help with actions in EventHandler

I am trying to write a program where the user types on the keyboard in a specified location, and Mathematica outputs what you are currently typing, plus a prediction that is updated in real time of ...
1
vote
1answer
30 views

List of elements joined by OR condition

A simple command Or[f[1], f[2], f[3]] gives f[1] || f[2] || f[3] How this can be done automatically? I try ...
6
votes
7answers
363 views

Given list of associations, generate a list of all common associations

Given a list of parameters and associated values, how can I generate a list of all common associations? For instance, given ...
4
votes
2answers
137 views

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}
0
votes
0answers
44 views

Speeding up multiple conditional summations

I have situation where I have a matrix H, and want to build a set of ODEs dependent on the values of the eigenvalues, let me illustrate: ...
0
votes
1answer
99 views

For loop from a continous position [closed]

I have a matrix A, which has its elements being function of m, say A[m_]={m, -m*m+2, 5x+m, 3*m+2, -m*m*m, -3+m, m, 5*m*m-4*m, 2*m*m*m} Now, there is a double ...
1
vote
0answers
53 views

How to write down existence and uniqueness?

Mathematica has strong commands ForAlland Exists. However, I face difficulties, trying to express "existence and uniqueness" in ...
2
votes
2answers
59 views

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 ...
2
votes
1answer
173 views

How to create logical matrix in Mathematica? [closed]

Is it possible to create logical Matrices in Mathematica as it is possible in Matlab with false(nrow,ncol) or true(nrow,ncol)? ...
3
votes
1answer
82 views

Reduce redundant conditions all the way

I would expect Reduce[(b == 0) || (a == 0 && b == 0)] to give b==0 since the second argument of ...
0
votes
1answer
83 views

What's wrong with my logic statement here?

tl;dr: pls fix my spaghetti code Hi all. I'm a physics undergrad and I work in a lab at my university doing gamma spec. Mostly for fun/learning to program, I'm trying to write a module that reads the ...
2
votes
0answers
90 views

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 ...
1
vote
1answer
97 views

Choose numerical values according to given rules

General problem Given a set of logical expressions I need to find numbers with a margin between pairs that obey the logical rules. Example For the expression $m=n=o,p=q$ with a margin of 10 the ...
0
votes
1answer
87 views

How to solve this problem in Mathematica?

Let's say we have some 4-character strings: fxhg eagc aceh chbe beca From those strings we want to get the correct passcode. Each of the string contains two ...
3
votes
2answers
242 views

How to explain `False == x && True == x`

Execute the following code: ...
0
votes
1answer
60 views

The position of the quantifier

I know this is a logical operation in discrete mathematics. ...
2
votes
2answers
84 views

Logical test of a single symbol against multiple values

I'm currently trying a function that behaves differently depending on what kind of Type string you enter. This string can have six different values, let's say "A", "B", "C", "D", "E" and "F". What I ...
12
votes
1answer
263 views

Why isn't Orderless an Attribute of And?

In standard logic And is a commutative operator. Still, in Mathematica, And doesn't have the ...
0
votes
2answers
101 views

Comparing two matrices in an If block

I want to find out for what value of n MatrixPower[u, n] == IdentityMatrix[3] ...
5
votes
0answers
331 views

FuzzyLogic in Mathematica

Just a question for my information. What package do I need to load or to buy to be able to use fuzzy logic in Mathematica? I tried << FuzzyLogic but ...
1
vote
1answer
305 views

Splitting Logical Expression in list of expressions

I have long results of a Reduce statement in the form of {(expr1) || (expr2) || (expr3) || ...} I am looking for a way to split ...
2
votes
1answer
295 views

How to do symbolic logic in Mathematica

I'm currently in Symbolic Logic with homework assignments (not asking for people to do my homework for me) with questions such as the following: (derive the conclusion using the eighteen rules of ...
1
vote
1answer
96 views

How to use recursion to find a logical dual

I want to make a little function that goes through a propositional formula and gives it's dual. Here is what I currently have: ...
0
votes
2answers
87 views

How to prove that an equation can be divided by any n?

I'm new to Mathematica and came across with the problem. I can't prove that (for example) 2*n is always even no matter what n is....