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
5 answers

Why is a list containing objects False when value tested?

I would expect an empty list to value test as False, but I'm a bit confused why a reference for a list containing an object reports as False also when value tested as in the following example: >>> weapon = [] >>> weapon == True False >>>…
Vin Breau
  • 269
  • 3
  • 17
1
vote
3 answers

C : 0 & 1 combinations using recursion

I want to list combinations of o & 1 recursively using c depending on variables number (number) the output I want is 000 001 010 011 100 101 110 111 I've tried many algorithms the last one is : void permute(unsigned number) { if(number ==…
1
vote
5 answers

Python: How to chain boolean tests to get False as soon as it gets the first False

After having a lot of trouble trying to reduce nested ifs (and a script that stopped working), I realized perhaps I am having the wrong idea of what and how boolean stuff works in python. I had this (working fine but contorted): if (not gotside): …
heltonbiker
  • 26,657
  • 28
  • 137
  • 252
1
vote
1 answer

4 bit binary number multiplier by 3 (mod 16)

I have a question in a past paper which asks to design as a minimised sum of products, and using only NAND gates, a circuit which takes 4 bit binary input and multiplies that number by 3 (mod 16) Here is the truth table I have derived Inputs …
sam
  • 2,469
  • 8
  • 37
  • 57
0
votes
2 answers

Creating Truth Table with Python IndexError:list out of range

Trying to make a Truth table through Python using itertools but keep getting same error Heres my code so far import sys import itertools def gen_constants(numvar): l = [] for i in itertools.product([False, True], repeat=numvar): …
0
votes
4 answers

Is there an easy way to learn truth tables?

I'm following an online tutorial for Ruby and I'm at a point where it's mentioning truth tables and how I need to learn them before proceeding. Is there an easy way to learn them? Do I just need to learn what constitutes as true and false?
Keva161
  • 2,623
  • 9
  • 44
  • 68
0
votes
3 answers

Can anybody explain the contrapositive

I'm trying to construct a contrapositive for the following statement: If A is 0 or B is 0, then A*B is 0. Here is my attempt: If A*B is not 0, then A is not 0 or B is not 0. The original statement is true, but the contrapositive is false since both…
Kiril
  • 39,672
  • 31
  • 167
  • 226
0
votes
0 answers

How to construct XOR of A and B

I am having trouble turning this truth table into a logic…
geek_n
  • 1
0
votes
0 answers

SOP Boolean expression of state variable and output of a Moore FSM

Disclaimer: I'm studying for an exam, but I don't have to hand in anything. I have the state transition diagram of the FSM and its states encoding: I want to find the Sum-Of-Products Boolean expression of S10 , S11 and ouput y. I've drawn…
0
votes
0 answers

QCA package error when generating truth table with more than 7 causal conditions in R Studio

I am currently writing my Master thesis and I'm conducting an fsQCA using the QCA package in R Studio. In total, I have 9 causal conditions which I all calibrated already. However, I found out that whenever I exceed 7 causal conditions while…
0
votes
1 answer

How to coerce a truth table into a dataset or in tibble

I have a dataset where I am training on to coerce as dataset (foundable in the onòy in SetMethods package) library(QCA) library(SetMethods) data(SCHF) # Get the truth table for the presence of the outcome: TT_y <- truthTable(SCHF, outcome =…
12666727b9
  • 1,133
  • 1
  • 8
  • 22
0
votes
0 answers

Specify DC cover with espresso_exprs

I'm just getting started learning pyeda, and fairly new to python in general. I have a very complex partially-defined Boolean expression (80~140 variables, 10K terms) that's too big to express as a truth table, but I can express it pretty easily as…
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
0
votes
1 answer

boolean expression from truth table

I want to convert truth table to boolean expression : for example , this is the table a b a+b>0 0 1 1 1 0 1 I want to get the following output: (¬a ^b ) ∨ (a ^¬b) I am thinking about using…
Sena j
  • 25
  • 5
0
votes
0 answers

two-variable output truth table for two-variable input

I have 2-bit variable that is needed to be converted in another one. I made such a table i1 i2 | o1 o2 0 0 | x x 0 1 | 0 1 1 0 | 1 0 1 1 | 0 1 But I cannot figure out how to do it except something like (o1(i1,i2)&0b01 << 1) | (o2(i1,i2)…
lazba
  • 129
  • 9
0
votes
1 answer

selecting some rows from Truth Table

I am using Truths class to generate a truth table : https://github.com/tr3buchet/truths However I could not enumerate all rows or extract rows with correct evaluation of expression? Is there a way to do that ? I received this error : AttributeError:…
Sena j
  • 25
  • 5