boolean algebra – Functions expressible in conjunctive normal form, but with XOR replacing OR

What are all the functions $f:{0,1}^nrightarrow{0,1}$ that can be expressed as a product of affine Boolean functions? For example, if $x_1,x_2,x_3in{0,1}$ then $x_1x_2x_3oplus x_2x_3 oplus x_2=(x_1oplus x_2)(x_1oplus 1)(x_3oplus 1)$. Here $oplus$ denotes the XOR operation.

I would guess that not any function can be written this way. Has this been worked out? Is there any normal form other than algebraic normal form that uses the XOR (not counting the Fourier transform)?

boolean algebra – Doubt regarding the physical folding of a two dimensional K-map

While grouping terms in a k-map, if we pair terms on the first row with the ones on the last, it can be interpreted as the folding the 2-D map in the form of a cylinder, along the horizontal axis.

Similarly, if we pair terms on the leftmost column with the ones on the rightmost column, it can be interpreted as the folding the 2-D map in the form of a cylinder, along the vertical axis.

But when we group the four terms to form a quad, each on the corner, what does it physically mean?

Set a boolean (single on/off checkbox) value while creating a node

Sorry for late response, but I had the same problem few days ago. What worked for me was first of all creating the node and then setting the boolean value:

$node = Node::create((
        'type' => 'calendar_data',
        'title' => 'testing finaly 1111111111111111111111111 ',
        'field_current_month' => date('Y-m-d'),
    ));
$node->field_date_type_value->value = true,

$node->save();

The ‘inline’ field setting didn’t work neither for some other fields for me. But the explicit version is working very well.

graphs – Number of possible boolean functions in a DAG of lookup tables?

A K-input lookup table (K-LUT) can represent any function with K boolean inputs and a single boolean output. The number of possible functions represented by this LUT is $2^{2^K}$ according to this previous question, and other online resources.

I am interested in finding the number of possible functions represented by a directed acyclic graph of LUTs. A simple example is shown below:

simple network of 2-LUTs

I am also interested in more complicated DAGs with non-uniform LUT sizes and more interesting connectivities of the input. For example, when one input is connected more than once, or when an input is connected to deeper levels of the DAG. Also, I am interested in DAGs with multiple outputs as well.

This feels like it is a solved problem but I can’t find anything that computes the number of possible functions that are described by these structures.

posets – Which Boolean lattices have a left-to-right symmetric drawing?

This question is inspired by a similar MSE question about partition lattices.

Question: Which finite Boolean lattices have a symmetric drawing on the 2D plane?

By a symmetric drawing of a lattice, I mean the usual Hasse diagram, with the elements as vertices and the cover relation shown as upward edges, with the following conditions:

  • no two elements are drawn in the same location,
  • no edge $uv$ is drawn through some other element $w$,
  • the drawing is symmetric about the $y$ axis (considering the vertices as points and edges as lines, either straight or curved — but if curved, the curves must obey the symmetry).

To set the stage, we observe that $B_1$ to $B_4$ have symmetric drawings. $B_3$ is well-known, but $B_4$ is not obvious. Note that although Boolean lattices are graded, we allow elements of the same rank to be drawn at different heights (14 and 23 on the right).

Symmetric drawings of B3 and B4

Can we at least settle the question for $B_5$?

A more general question (answers to this would also be welcome): Is there an efficient method of deciding whether a given lattice admits a symmetric drawing, and (possibly) producing such a drawing?

optimization – Boolean condition as constraint of a continuous optimisation problem?

Let $Theta$ be the space of real invertible $ntimes n$-matrices, and for $thetainTheta$ write $theta_iinmathbb{R}^n$ for the $i^{mathrm{th}}$ row of $theta$, i.e. $theta=(theta_1|cdots|theta_n)^intercal$.

We search for a matrix $theta_starinTheta$ that satisfies the following two conditions:

$$tag{1}textbf{A:}qquad theta_star quadtext{ solves } qquad left(min_{thetainTheta} quad f(theta) qquad text{s.t.} quad |theta_1|_2 = ldots = |theta_n|_2=1right), qquad textbf{and}$$

$$tag{2}textbf{B:}qquad theta_star quadtext{ is }quad text{such that } qquad big|mathrm{diag}(theta_star)^{-1}cdotmathrm{offdiag}(theta_star)big| , < , 1.$$

Here, $mathrm{diag}(theta_star)$ denotes the diagonal matrix whose diagonal is that of $theta_star$, and $mathrm{offdiag}(theta_star):=theta_star – mathrm{diag}(theta_star)$.

(Assume that $mathrm{diag}(theta_star)$ is invertible and $|cdot|$ is the Frobenius norm on $Theta$.)

Question: Are you aware of a natural way to add the Boolean condition B — which any minimizer $theta_star$ of A either fulfils or not — as an additional constraint to the optimisation problem A so as to combine both conditions A$,&,$B into a single, “naturally solvable” constrained optimisation problem to which $theta_star$ is a solution?

(I’m not familiar with mathematical optimisation, so apologies if this question is very naive or unclear.)

mysql – SQL always returns true for a boolean query executed from Java

When I execute a sequel query from Java and store the boolean returned, the query always returns True which shouldn’t be the case at all. So I emptied the table and fired the query again, and yet it returns True for the emptied table. I have attached a picture of the table.

This is my code on java for the query.

boolean avail = st.execute("SELECT EXISTS(SELECT * from sales WHERE product='"+n+"' AND ord_date='"+sqlDate+"');");
```(!(the tables's name is 'sales')(1))(1)


  (1): https://i.stack.imgur.com/4vllL.png

centos8 – PHP ftp_put() expects parameter 1 to be resource, boolean given when trying to upload a file to a remote ftp server

I’m trying to upload a submitted CV from job applicants to a remote ftp server.

I’ve wrapped all the steps into “if…else echo” statements and they are all successful (fopen, ftp_connect, ftp_login), but it gets stuck at the fpt_fput statement with this error:

ftp_put() expects parameter 1 to be resource, boolean given in /var/www/*******/phpmailer/sendmail.php on line 286

I’ve checked whether it could be SELinux, but it’s not running on that server.

Here is the code for that section in the php file:

$location = "uploads/" . $finalCV;
//move_uploaded_file($_FILES('applCV')('tmp_name'), $location);

//Move uploaded & renamed CV to server
if($fp = fopen($location, 'r'))
  echo "File Open Successful. ";
  else {
    echo "File Open Unsuccessful. ";
  }

if($conn_id = ftp_connect("some.server"))
  echo "FTP Connection Established Successfully. ";
else {
  echo "FTP Connection Failed. ";
  }

$ftpuser = "wynand";
$ftppasswd = "********";

if($login = ftp_login($conn_id, $ftpuser, $ftppasswd)) {
  echo "FTP Login Successful. ";
}
 else {
   echo "FTP Login Unsuccessful. ";
 }

if(ftp_put($login, $location, $fp, FTP_ASCII)) {
  echo "Successfully uploaded CV. ";
}
  else {
    echo "There was a problem uploading CV. ";
  }