## In theory, should neuromorphic computers be more efficient than traditional computers when performing logic?

There is this general sentiment about neuromorphic computers that they are simply "more efficient" than von Neuman.

I’ve heard a lot of talk about neuromorphic computers in the context of machine learning.
But, is there any research into performing logic and maths in general on such computers? How would one translate arithmetic, logic and algorithms and into "instructions" for a neuromorphic computer, if there are no logic structures in the hardware itself?

It is common to draw parallels with a brain in this context, so here’s one: Brains are great at recognising faces and such, but I don’t think I can do maths faster than an Arduino (and that thing doesn’t need much energy).

## why does bool(9) or any other no. except 1&0 with bool give the output true and why not false in python ? What is the logic behind it?

In Python programming when i write bool(1) the output is true while when i write bool(0) the output is false. But when i write any other number with bool it turns out to be true.

## What does it mean to “show algebraically” in propositional logic?

The biconditional operator $$\iff$$ of Propositional Logic can be defined by the identity

$$p \iff q \equiv (\lnot p \lor q) \land (\lnot q \lor p) \quad (1.1)$$

Use the identity $$(1.1)$$ and identities from the list on page 2, to show algebraically that

$$p \iff q \equiv (\lnot p \land \lnot q) \lor (q \land p)$$

State which identity you are using at each step.

What does this question mean by asking to "show algebraically"? I have tried referring to my notes and online search but no luck with a definition! These propositions are already algebraic, are they not? Having some issues understanding the wording of the question. This is from a mock university test. I’m assuming it wants me to demonstrate using a truth table?

## Difference between the logic and the type system of a proof assistant?

In Comparing Mathematical Provers (section 4.1), Wiedijk classifies logics and type systems of different proof assistants? I do not see what he means by type system of the assistant. He only says:

A system is only considered typed when the types are first class objects that occur in variable declarations and quantifiers.

I can only think of types in goals. For instance, in Isabelle if you write a goal using variables (I don’t think you "declare" variables", you can check the type of these variables. But this type is certainly a type in the logic I’m using.

It would be interesting to clarify this and apply this example in the cases of Isabelle, Coq and Metamath (which is untyped and apparently based on proof trees, which could give a hint).

## Help with reviewing locking logic for sync system

I’m implementing a sync algorithm where multiple apps sync files with a data source. Syncing is already working and has been for several years so there’s no issue with this.

Now I want to implement a way to lock the data source, to tell clients that they shouldn’t write to it anymore. This will be used to upgrade the data source – i.e. upgrade its structure, move folders around, etc. which needs to be done when nothing else is syncing.

So I came up with the following algorithm, inspired by [SQLite 3 locking mechanism][1], but changed to take into account that it’s network based.

There are three types of locks, and a client request a lock by POSTing a file to the data source. The locks are:

• SYNCING: The client is syncing – any other client can still read or write to the data source. There can be multiple SYNCING locks.
• PENDING: The client wants to acquire an exclusive lock on the data source – any other clients can still read or write to the data source, but no new SYNCING lock can be posted. There can be multiple PENDING locks.
• EXCLUSIVE: The client has locked the data source – no other client can read or write to it. There can be only one EXCLUSIVE lock.

And it would work like so:

• When a client starts syncing with the data source, they acquire a SYNCING lock. When a client finishes syncing, they release the SYNCING lock they’ve created
• When a client needs to lock the data source, it first posts a PENDING lock. When a PENDING lock is present, no new SYNCING or PENDING locks can be posted. Clients that are syncing however can complete the process. The client who has acquired a PENDING lock will poll the data source and wait for all SYNCING lock to be released. When they are all gone, the client checks for all the PENDING locks – if there are others, the client checks the timestamps of these other locks and if his lock is not the oldest one, it deletes it and exit. Locking failed, and it will need to try again later.
• If the PENDING lock is the oldest, then the client posts an EXCLUSIVE lock. At this point, no other client can post any other lock.

I’m wondering if I overlook something with this system, like I’m wondering if there could be some race conditions in some cases?

For now, I’m not dealing with clients that post a lock then crash, there will be some logic to clean up. At this point, I just want to make sure that this system will only allow one client to acquire an EXCLUSIVE lock. Any ideas?

## Is it possible to work out rotate in degrees per second based on this rotate logic?

I have this code to rotate an object towards another at a given speed.

    /// <summary>     /// Rotate towards the target.     /// </summary>     /// <param name="lookPosition"></param>     private void RotateTowardsTarget(Vector3 lookPosition)     {         // Determine which direction to rotate towards         Vector3 targetDirection = lookPosition - transform.position;          // The step size is equal to speed times frame time.         float singleStep = weaponRotationSpeed * Time.deltaTime;          // Rotate the forward vector towards the target direction by one step         Vector3 newDirection =             Vector3.RotateTowards(turretYRotation.transform.forward, targetDirection, singleStep, 0.0f);          // Draw a ray pointing at our target in         //Debug.DrawRay(turretYRotation.transform.position, newDirection, Color.red, 3);          newDirection.y = 0;         // Calculate a rotation a step closer to the target and applies rotation to this object         turretYRotation.transform.rotation = Quaternion.LookRotation(newDirection);     } 

And I’d like to convert this to a “Degrees per second” to give the user useful feedback on how quickly it rotates. Is there a formulae I can apply to work it out?

## I am unable to understand the logic behind the code (I’ve added exact queries as comments in the code)

Our local ninja Naruto is learning to make shadow-clones of himself and is facing a dilemma. He only has a limited amount of energy (e) to spare that he must entirely distribute among all of his clones. Moreover, each clone requires at least a certain amount of energy to function (m) . Your job is to count the number of different ways he can create shadow clones. Example:

e=7;m=2

ans = 4

The following possibilities occur: Make 1 clone with 7 energy

Make 2 clones with 2, 5 energy

Make 2 clones with 3, 4 energy

Make 3 clones with 2, 2, 3 energy.

Note: <2, 5> is the same as <5, 2>. Make sure the ways are not counted multiple times because of different ordering.

int count(int n, int k){     if((n<k)||(k<1)) return 0;     else if ((n==k)||(k==1)) return 1;     else return count(n-1,k-1)+ count(n-k,k);   // logic behind this? }  int main() {     int e,m;            // e is total energy and m is min energy per clone     scanf("%d %d", &e, &m);     int max_clones= e/m;     int i,ans=0;     for(i=1;i<=max_clones;i++){         int available = e - ((m-1)*i);   // why is it (m-1)*i instead of m*i         ans += count(available, i);     }     return 0; } 

## Books for learning about Digital logic, circuits, logic design etc

I am a computer science student and I have some courses names “Fundamental of electronics and digital systems, Logic design and switching circuits, System analysis and design “. I searched for books that may help me for these course and I found one named ” Digital logic and computer design by Mano”. I was wondering if anyone could suggest me some more books that will help me to master these topics. Thanks

## Show that exist a finite set of clauses F in first-order logic that Res*(F) is infinite

A predicate-logic resolution derivation of a clause $$C$$ from a set of clauses $$F$$ is a sequence of clauses $$C_1,\dots,C_m$$, with $$C_m = C$$ such that each $$C_i$$ is either a clause of $$F$$ (possibly with the variables renamed) or follows by a resolution step from two preceding clauses $$C_j ,C_k$$, with $$j, k < i$$. We write $$\operatorname{Res}^*(F)$$ for the set of clauses $$C$$ such that there is a derivation of $$C$$ from $$F$$.

The question is to give an example of a finite set of clauses $$F$$ in first-order logic such that $$\operatorname{Res}^*(F)$$ is infinite.

Any help would be appreciated!

## Logic behind a single-tape NTM solving the TSP in $O({n}^4)$ time at most

I was going through the classic text “Introduction to Automata Theory, Languages, and Computation” by Hofcroft, Ullman, Motwani where I came across a claim that a “single-tape NTM can solving the TSP in $$O({n}^4)$$ time at most” where $$n$$ is the length of the input given to the turing machine (an instance of the TSP). The authors have assumed the encoding scheme as follows:

The TSP’s problem could be couched as: “Given this graph $$G$$ and limit $$W$$ , does $$G$$ have a hamiltonian circuit of weight $$W$$ or less?”

Let us consider a possible code for the graphs and weight limits that could be the input. The code has five symbols, $$0$$, $$1$$, the left and right parentheses, and the comma.

1. Assign integers $$1$$ through $$m$$ to the nodes.

2. Begin the code with the value of $$m$$ in binary and the weight limit $$W$$ in binary, separated by a comma.

3. If there is an edge between nodes $$i$$ and $$j$$ with weight $$w$$, place $$(i, j, w)$$ in the code. The integers $$i$$, $$j$$ , and $$w$$ are coded in binary. The order of $$i$$ and $$j$$ within an edge, and the order of the edges within the code are immaterial. Thus, one of the possible codes for the graph of Fig. with limit $$W = 40$$ is

$$100, 101000(1, 10, 1111)(1, 11, 1010)(10, 11, 1100)(10, 100, 10100)(11, 100, 10010)$$

The authors move to the claim as follows:

It appears that all ways to solve the TSP involve trying essentially all cycles and computing their total weight. By being clever, we can eliminate some obviously bad choices. But it seems that no matter what we do, we must examine an exponential number of cycles before we can conclude that there is none with the desired weight limit $$W$$ , or to find one if we are unlucky in the order in which we consider the cycles.

On the other hand, if we had a nondeterministic computer, we could guess a permutation of the nodes, and compute the total weight for the cycle of nodes in that order. If there were a real computer that was nondeterministic, no branch would use more than $$O(n)$$ steps if the input was of length $$n$$. On a multitape $$NTM$$, we can guess a permutation in $$O({n}^2)$$ steps and check its total weight in a similar amount of time. Thus, a single-tape $$NTM$$ can solve the TSP in $$O({n}^4)$$ time at most.

I cannot understand the part of the above paragraph in bold. Let me focus on the points of my problem.

1. What do they mean that the branch would take no more than $$O(n)$$ ?
2. On a multitape $$NTM$$, how can we guess a permutation in $$O({n}^2)$$ steps ?
3. How are we getting the final $$O({n}^4)$$ ?

I neither get the logic nor the computation of the complexity as very little is written in the text.