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
0
votes
0 answers

What formulas would I put into the formula bar on excel to find the truth table?

The Boolean expression is (BvC)v~(~B^A)=Q what formulas would I use? Please share picture if possible Sample For instance that would be the truth table for the Boolean expression (A XOR B)C AND= Q Or (A ⊕ B) C^= Q
0
votes
4 answers

How to use bitwise operators to return a 0 or 1

My function takes in a 32 bit int and I need to return a 0 or 1 if that number has a 1 in any even position. I cant use any conditional statements I also can only access 8 bits at a time. Here is an example input: 10001000 01011101 00000000…
David
  • 175
  • 1
  • 4
  • 8
0
votes
0 answers

Proposition formula splitting method? -Truth table generator(py)

I have been working on this project and came to this trouble on the process of obtaining the parts of the formula for a separate evaluation. Like for example: (~p>~q)^(~(p^q)) I should get: (~p) (~q) (~p>~q) (p^q) (~(p^q)) (~p>~q)^(~(p^q)) I…
0
votes
0 answers

Produce a truth table set of n values, but I have only one problem

def make_tt_ins(n): if n == 0: return [] elif n == 1: return [False, True] else: prev_set = make_tt_ins(n - 1) full_set = cross_multiply(prev_set, [False, True]) return full_set def cross_multiply(s1, s2): …
0
votes
0 answers

Code in C that generates all possible testcases of given inputs for a Truthtable

I need a simple algorithm that generates all possible test cases for a certain value of inputs. For example, inputs a and b, would have possible cases being: 0,0 0,1 1,0 and 1,1. The number of inputs should be 2^n, but I am having trouble figuring…
0
votes
1 answer

This says its having two 2bit inputs so how to find the truth table

Question 2 A logic circuit is given two 2-bit binary numbers A and B as its inputs. The circuit consists of two outputs Y1 and Y2. The output values of YI and Y2 are obtained as follows: If A
0
votes
2 answers

why z3 solver give bool variable "none", how to get rid of it?

I am new to Z3py. I am trying to list all satisfied solutions to a bool formula (or to get the truth table which generate only True). My code is here, inspired from another answer finding all satisfying models: from z3 import * A1, B1, B2, C1, C2,…
0
votes
2 answers

How to iterate a dynamic nested loop over a particular values as its range, in python?

If I take a boolean expression and number of input variables from user, then how can I evaluate the expression (to create its truth table) by using dynamic nested loops instead of doing it like this: expression= "a and (b or a)" inputs=2 if…
0
votes
0 answers

How to print the truth table of a logic gate using linked list

I'm trying print the truth table of a logic gate. I have to use a linked list and a specific structure. typedef struct data { int value; struct data * next; } Data; typedef Data * DataList; int myandlst(DataList *list); int report(DataList…
Joe Durner
  • 27
  • 3
0
votes
0 answers

Programm in C that uses linked lists for printing truth tables

Here is a program I have build : int mynand(int a, int b); int mynor(int a, int b); int myxor(int a, int b); int report(CallBack f , char *gates); int main( ) { CallBack myfunctions[] = {myand, myor, myxor, mynand, mynor}; char…
0
votes
1 answer

A logic circuit is given two 2-bit binary numbers A and Bas its inputs. The circuit consists of two outputs Y1 and Y2

A logic circuit is given two 2-bit binary numbers A and Bas its inputs. The circuit consists of two outputs Y1 and Y2. The output values of Y1 and Y2 are obtained as follows: If A
Nirosh
  • 63
  • 8
0
votes
1 answer

finding an expression from a truth table

I have a truth table like this: a b sel O F F F F F F T F F T F F F T T T T F F T T F T F T T F T T T T T so O is…
john_w
  • 693
  • 1
  • 6
  • 25
0
votes
0 answers

3-value truth-table with R functions. conditional?

I want to construct a truthtable with R tidyverse functions mutate(), case_when() and expand_grid(). Here I define a custom operator %->% for the "conditional" logical connective (->, "if p then q" AKA "p imples q".) I also try to consider R's…
knb
  • 9,138
  • 4
  • 58
  • 85
0
votes
1 answer

Is there a better way to transform a data frame into a "truth table" than looping through it?

I have a view in Redshift that I'm reading from to create a data frame. The table is structured like the following with about 49k records: session_id timestamp event_text session1 2020-07-07 06:45:45.012 event-A session1 2020-07-10…
transposeglobal
  • 491
  • 4
  • 14
0
votes
1 answer

Simplify if-elif-else-if-else conditional structure into a single if-else

This would not be a problem for me if this was a "regular" program, however I am working with program synthesis and I have to have a code as compact as possible. Consider the pseudocode below: if A: return 'n' elif B: return 'y' else: if…