Questions tagged [truthtable]

A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and propositional calculus—to compute the functional values of logical expressions on each of their functional arguments, that is, on each combination of values taken by their logical variables.

In particular, truth tables can be used to tell whether a propositional expression is true for all legitimate input values, that is, logically valid.

Practically, a truth table is composed of one column for each input variable (for example, A and B), and one final column for all of the possible results of the logical operation that the table is meant to represent (for example, A XOR B). Each row of the truth table therefore contains one possible configuration of the input variables (for instance, A=true B=false), and the result of the operation for those values.

210 questions
1
vote
1 answer

Make loop def for varying sizes

So I´m making a basic truth table function. In this example, the formula has 4 values and thus needs 4 loops. Is there any way for me to make a def that takes the number of values in the formula and makes a loop for it? def Formula1(a,b,c,d): …
1
vote
1 answer

Boolean Expressions with nested NAND Gates?

I have a problem with some homework, for my Advanced Digital Design course, in which I have to create the truth table and find the Boolean expression for a provided circuit (image is linked below). I was able to create the truth table and I think…
1
vote
4 answers

Optimal implementation of truth table

I have identified a truth table such as the one below prev_state| input1 | input2 |next_state| Action (def/new) |(Disable/Enable)|(Off/On)| | def | D | Off | def | Nothing def | D | On …
Satrapes
  • 183
  • 1
  • 18
1
vote
1 answer

Boolean Truth Table C++

(p -> q) <-> [( r ^ t ) v (not) s] This equation was given by my teacher for us to code a truth table for. I already ran the checks for this by the teacher, but I'm having issues trying to populate the arrays: bool p[32] = { false }; bool q[32] = {…
Bailey0314
  • 21
  • 1
  • 1
  • 5
1
vote
1 answer

Python Generate truthtable from expression containing Numeric value and comparators

I am trying to generate test cases from a boolean expression which may contain numerical values and comparators, e.g.: (10 < a) and (c == 5) truth tables seems like a good approach and generation output might look like this: > a, c, result > 11,…
S. Pech
  • 23
  • 4
1
vote
1 answer

How to create a truth table based on table of values in r

I am trying to create a script that will create a truth table based on different values. Example The truth table for this would be I'm fairly new to r. I know it has a lot of great capabilities when it comes to data analysis, but this would help a…
Santi
  • 381
  • 1
  • 3
  • 7
1
vote
1 answer

Generate truth tables in Maxima

I know Maxima can evaluate logical expressions, e.g.: false and true or not true will evaluate to false This is great, but how can I generate truth tables containing every interpretation of all variables? For example, I'd want A and B or not B to…
Frithjof
  • 2,214
  • 1
  • 17
  • 38
1
vote
1 answer

Gen for a custom data type in Haskell

I was trying to make a truth table for a list of strings. Say, I have a list ["a","b"] and as an output, I want [[("a",True),("b",True)], [("a",True),("b",False)], [("a",False),("b",True)], [("a",False),("b",False)]] Each of those instances in the…
Sajid Anower
  • 171
  • 1
  • 1
  • 5
1
vote
1 answer

Truth table with 5 inputs and 3 outputs

I have to make a truth table with 5 inputs and 3 outputs, something like this: A B C D E red green blue 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 . . . . 1 1 0 1 0 0 1 1 . . . 1 1 1 1 1 1 0 …
lepsztyk
  • 53
  • 2
  • 6
1
vote
3 answers

Minimum number of checks to validate a truth table

I have a java program where I want to validate if any of 3 booleans is false. I want to figure out the smallest expression I can write to check against the permutations. if(!(needsWork && (needsApproval || isAdmin) )) I think this is enough…
Woot4Moo
  • 23,987
  • 16
  • 94
  • 151
1
vote
2 answers

Digital Logic - truth tables

I am trying to solve these problems with truth tables using the formulas below. I am having a problem with the NOT to NAND I think i got the first 2 problems correct using: AND is equivalent to NOR, AND is equivalent to NAND The equations for AND,…
user249375
1
vote
2 answers

Generate possible truth values of variables in array

I have an array with variables var variables = ['a', 'b', 'c']. I want to change the output to [ { 'a': true, 'b': true, 'c': true }, ... ] What I want is to get an array of objects with all the possible truth values to these…
Jamgreen
  • 10,329
  • 29
  • 113
  • 224
1
vote
2 answers

Putting All Logical Expression Variables Into An Array

I am writing a program that will print the truth table of an expression. Currently my code takes a logical expression and turns it into the two arrays as shown in input. I need help in meeting the following output for my algorithm Example: Logical…
Mrgoog
  • 29
  • 3
1
vote
2 answers

CLISP Program to determine the truth table is inconsistent, valid or invalid

I just have a small problem on the loop catching the condition on the generated truth table.. so you input a logical expression then it turns it into a truth table where it also interprets if it is valid or invalid or inconsistent. So far this is…
1
vote
1 answer

convert truthTable result into Boolean statement

I am trying to convert back the result of the truth-table into a Boolean statement. For those who are not familiar I am going to write it detail. I have a vector of string in a format like below. All string members inside vector have an equal…
H'H
  • 1,638
  • 1
  • 15
  • 39