Extended Boolean Logic

Find the results of the following substitutions. Just give the answer and explain the reasons if the result is undefined:

a) (βˆ€π‘₯)(𝑓(π‘₯) < 7)[π‘₯ ≔ 7]

b) (βˆ€π‘¦)(𝑓(π‘₯) < 7)[π‘₯ ≔ 7]

There is nothing to substitute x to on both questions and will be therefore undefined?

Upper bound on Boolean circuits

Oded Goldreich states in his book Computational Complexity that the number of Boolean circuits having v vertices and s edges is at most $ (2\cdot {v\choose 2 }+v)^s$ (page 40).

I understand the term $ 2\cdot {v\choose 2 }$ as choosing two nodes and then the direction of the edge connecting them. This process is to be repeated $ s$ times as the number of edges.

But I don’t understand the “extra” $ v$ inside the parentheses.

What this $ v$ account for?

Are Boolean expressions fast evaluated in Google sheet formulas?

Suppose I have the following expression repeated in a long column:

=IF(OR($  U2=""; COUNT(aHugeRange)=0); ""; SUM(aHugeRange)) 

I would like to avoid performing COUNT() and SUM() as much as possible to increase performance.

Will COUNT(), SUM() be ever executed for the rows where $ U is empty?

Will the following modification work differently?

=IF($  U2=""; ""; IF(COUNT(aHugeRange)=0; ""; SUM(aHugeRange))) 

Understanding the simplification of a boolean expression

ABC+A^BC+^ABC+^AB^C ^ = Not 

I was reading a book about digital systems and it said that i could supress ABC because it belongs to BC but i can’t just look to the expression and have a clear understanding of how this works.

I can look for this expression A+A^B and imagine that A^B can be a extension of A but in the case above exist more than just 2 variables to see the explanation given by the book clear.

Counting models satisfying a boolean formula

I’m trying to implement the #2-SAT algorithm from the paper “Counting Satisfying Assignments in 2-SAT and 3-SAT”. A few lines into the algorithm description the authors denotes a sub algorithm and claims “The function $ C_E$ computes #2-SAT by exhaustive search. It will be applied only to formulas of size ≀ 4 and can thus b e safely assumed to run in O(1) time”. The size of formulas is referred to the number of clauses.

I’ve been trying to find this exhaustive search algorithm that computes a #2-sat instance with number of clauses less than 4. But the results only returns algorithms for generally solving/counting models for #2 or #3-SAT and does not talk about a special case when size ≀ 4. First of all, is this claim true? Since the paper was published by a well known journal, I guess it is. But if so, does anyone know about this special case?

Use Drupal’s Views Boolean Filter on Custom Views field?

How do I use Drupal’s core Boolean filter on a custom views field?

I have tried some different approaches, and am thinking maybe it’s not about the value being returned so much as needed functions? As is I cannot evaluate the True or False states for views Boolean filters.

MYMODULE.views.inc:

// This field does not exist in database. // See /my_module/src/Plugin/views/field/CustomField.php. $  data['table']['custom_field'] = [   'title' => t('Custom Field'),   'click sortable' => TRUE,   'field' => [     'title' => t('Custom Field'),     'id' => 'custom_field',   ],   'filter' => [     'title' => t('Custom Field Filter'),     'field' => 'other_field',     // My field can return true or false as needed.     'id' => 'boolean',   ], ]; 

CustomField.php:

public function render(ResultRow $  values) {   if (some calculation) {     // return true   }   else {     // return false   } } 

Just returning a value does not seem to be enough for views to filter by… Looking at the boolean field docs, I’m wondering if I need to structure all the functions and options as well? init(), $ this->formats, etc.?

Thinking of boolean variables as sets, and $\mathbf{P=NP=co-NP}$?

This is an algorithm I came up with, that seeks to solve the ‘Boolean Tautology Problem’ in polynomial time, using $ 3-DNF$ clauses. I am posting this algorithm here seeking advice, and correction, if any can be provided.

I treat boolean variables as sets. The set itself denotes the variable to be $ true$ , and complement of the set denotes the variable to be $ false$ . $ \bigcap$ of sets denotes $ \land(AND)$ of the variables, and $ \bigcup$ of sets denotes $ \lor(OR)$ of the variables.

The sets are arranged so that they perfectly intersect, and every section is a boolean expression. Here are some examples(using upto $ 4$ sets/variables, since drawing more clutters the picture) :

$ 3$ variable example :

enter image description here

$ 4$ variable example :

enter image description here

Now, each clause in $ 3-DNF$ has $ 3$ literals(using the exact $ 3-DNF$ version). So, there are only $ 4$ possible cases for the literals :
1) All $ 3$ literals are positive – $ (a\land b\land c)$
2) $ 1$ literal negative, rest positive – $ (\lnot i\land j\land k)$
3) $ 2$ literals negative, remaining positive – $ (\lnot p\land\lnot q\land r)$
4) All $ 3$ literals negative – $ (\lnot x\land\lnot y\land\lnot z)$

Any $ 3-DNF$ expression consists of $ \lor$ of these $ 4$ kinds of clauses, and each clause itself is a subset of our total set of variables. Each clause highlights a certain part of the Venn Diagram of the set of variables. So, a tautological expression will have clauses that highlight the entirety of the Venn Diagram. The important part is that using $ 3-DNF$ , the total set can be highlighted only using these specific sets, and not just any arbitrarily small subset.

The way the algorithm works is by highlighting all such clauses found within the expression, and their intersections with all such other subsets. The reasoning is that since only the $ 4$ clause cases can highlight their respective subsets in the Venn Diagram, upon highlighting one such clause, other clauses which may intersect with it also have portions that need to be highlighted. Since the possible highlighter subsets are limited to the $ 4$ kinds of clauses, we just need to check intersections between them, two at a time.

Implementation :
The implementation would be as follows(given a $ 3-DNF$ expression with $ n$ variables) :
1) Create a graph, starting with all possible clauses as beginning nodes.(total number of clauses $ =8\times {n\choose 3}$ )
2) Create a set of children nodes for each parent node, by adding one more literal each to the parent clause.
3) For each such child, there is a dual child which has the negation of that literal.
4) Using these children as parents, follow procedure (2).
5) Continue this process until you have exhausted your variables, or have $ 6$ literals in your last created children nodes (intersection between two $ 3-DNF$ clauses).
6) A child can have multiple parents.

An example case of graph building is shown below. The directed arrow represents parent-to-child relation. Dual children are attached to the same relation for ease of view. The graph shown is partially built, so as to not clutter.

enter image description here

Solving :
Now, on to the solving the $ 3-DNF$ expression :
1) Scan through the expression and take up each clause.
2) For each clause, mark the corresponding node as true.
3) If a parent node is true, all child nodes are marked true.
4) If both dual children are true, the parent is marked true.
5) If every node is marked true, the expression is a tautology, otherwise not.

Remarks :
Step (3) of the solver ensures that if a particular clause is true, then all possible intersections of it, and any other clause also gets marked true. Since the graph stops building child nodes once those nodes have $ 6$ literals, we deal only with cases of intersection of two clauses. E.g.
$ (a\land b\land c)\land (\lnot d\land e\land\lnot f)=(a\land b\land c\land\lnot d\land e\land\lnot f)$
It should be obvious that if common literals exist in these clauses then it results in less than $ 6$ literals in the child clause. We do not need to check for intersections of more than two clauses, since the intersection will be contained within the intersection of two clauses each, since each true assignment is in disjunction with others.

Time Complexity :
Since we stop at child nodes with $ 6$ literals each, no matter the value of $ n$ , the number of variables, it is obviously polynomially bounded.

Closing words :
Please read through the method, and do tell me if there are any errors, or logical leaps that I made, or if the algorithm does actually work, which would be great.

EDIT : Added some subtitles for paragraphs.

Must a function in lambda-calculus which inputs a boolean function be defined in a certian way?

This question is my best attempt to get at a more general question about what one can get from terms in the lambda calculus.

Using the church encoding, we define booleans by $ \texttt{true} = \lambda x,y.x$ and $ \texttt{false} = \lambda x,y.y$

Define the set of terms $ Bool = \{\texttt{true}, \texttt{false}\}$ , and let $ Bool \to Bool = \{g \; | \; \text{if } b \in Bool \text{ then } g \; b \in Bool\}$

Let $ f$ be a term with the property that if $ g \in Bool \to Bool$ then $ f \; g$ normalizes to a boolean.

Intuitively, I believe $ f$ can be either a constant function or it can use $ g$ . Precisely: Is it true that any such f satisfies one of the following properties:

  • There exists some term $ b \in Bool$ so that for any $ g \in Bool \to Bool$ , $ f \; g = b $

  • There exists some term $ b \in Bool$ so that for any $ g \in Bool \to Bool$ , $ f \; g = g \; b $

  • There exists some term $ b \in Bool$ so that for any $ g \in Bool \to Bool$ , $ f \; g = not (g \; b) $

(where $ a = b$ means that $ a$ normalizes to $ b$ )

Updating boolean matrix results in whole column being updated

I have the following code:

adjMat = 5*[5*[False]]  def addEdge(u,v):     print u-1, v-1     adjMat[u-1][v-1] = True     adjMat[v-1][u-1] = True  addEdge(0,1) 

when I print I get this:

[True, True, False, False, False] [True, True, False, False, False] [True, True, False, False, False] [True, True, False, False, False] [True, True, False, False, False] 

Which makes no sense since I am expecting this:

[False, True, False, False, False] [True, False, False, False, False] [False, False, False, False, False] [False, False, False, False, False] [False, False, False, False, False] 

What is going on?