## command line – cl date function working differently in Intel and M1 machines

I have a shell script to calculate the number of days from a particular date:

``````echo D\$(((\$(date +%s)-\$(date +%s --date "2018-01-01"))/(3600*24)))
``````

On my 2019 MBP (Intel), it works. On my 2020 Mac mini (M1), it doesn’t.

The error:

``````date: illegal time format
usage: date (-jnRu) (-d dst) (-r seconds) (-t west) (-v(+|-)val(ymwdHMS)) ...
(-f fmt date | (((mm)dd)HH)MM((cc)yy)(.ss)) (+format)
/usr/local/bin/days: line 1: (1614815225-)/(3600*24): syntax error: operand expected (error token is ")/(3600*24)")
``````

The man pages are different. On the MBP it’s

``````DATE(1) User Commands DATE(1)
``````

On the Mac mini it’s

``````DATE(1)  BSD General Commands Manual  DATE(1)
``````
1. What’s going on here?
2. How do I get back the old functionality?

## python – Alternatives to copying the folder created with venv for many machines to use the environment

I have around 30 machines and I plan to use them all to run a distributed training python script.They all have the same username, in case this helps. I am on Windows and need to use the GPU in case this helps too. They all have the same python version and software installations necessary but I would need them to have the same version modules installed (pandas, matplotlib, etc).

My approach: I initially used one machine to run `python -m venv myenv` and then did `pip install -r requirements.txt`. I put the folder in a network drive and had all machine change directory to that network drive. Since they all have the same username I though it would be ok. It worked on a couple of them but not all of them. The alternative solution would be to have all machines run the command `python -m venv myenv` “pip install -r requirements.txt“` but wouldn’t this not be ideal? What if I have to add a module? Does anyone have any suggestions?

## turing machines – Solution to the halting problem

The halting problem claims that it is impossible to having a machine that will always be able to predict if machine
will halt with a given input. However, it is proven impossible due to machine giving a output when it does not halt.
The machine does not need to give an output it could loop on forever which would still be a valid answer to the halting
machine prediction.

In this case
begin{align} emptyset & = loop forever without output \ P(M) & = {M,M} \ H(M,i) & = {halt} when it halts and H(M,i) = emptyset when it does not halt \ N(i) & = {halt} when it get’s {not halt} and {} when it get’s input {halt} \ X(M) & = N(H(P(M))) \ end{align}

All machines can work on their own therefore all result are included.
This solves the problem as it is not possible to negate the absence of an output therefore both machine X and H will loop forever and H was right.

begin{align} X(X) & = N(H(P(X))) \ & = N(H(X,X)) \ & = N(emptyset) \ & = emptyset end{align}

$$H(X,X) = X(X) = emptyset$$

Assume the opposite $$H(X,X) = {halt}$$

begin{align} X(X) & = N(H(P(X))) \ & = N(H(X,X)) \ & = N({halt}) \ & = emptyset end{align}

This is a contradiction H predicted $$X(X)$$ would $${halt}$$ but it did not

The answer the question then relies on what is the question is it on the output or the state of the machine. This solution also preserves the concept of infinite
recursion not giving a output even at the infinite state.

To further add on, this would mean given any input with infinite time and resource if $$H(M,i) = {halt}$$ it means there exist a finite solution (or a error from a real-life perspective).
If on the other hand $$H(M,i) = emptyset$$, then the input is not valid and has infinite recursion in it’s input (this could be the machine or the input in a real-life perspective).
The halting problem specifically looked into only the concept of machine looping forever I added real life perspective as an additional note.

The setup of X does have this problem but I assume that is a design issue:

begin{align} X(M) & = N(H(P(M))) \ & = N(H(M,M)) \ & = N({halt}) \ & = N(emptyset) \ & = emptyset end{align}

begin{align} X(M) & = N(H(P(M))) \ & = N(H(M,M)) \ & = N(emptyset) \ & = emptyset end{align}

$$X(i) = emptyset$$

Solution to $$NH$$

It is not the same as negating the result of $$H$$:

begin{align} NH(M,i) & = N(H(M,i)) \ & = N({halt}) : N(emptyset) \ & = emptyset : emptyset end{align}

You can reverse the output of the original halting machine but this will give you two possible solution. this is
how you get only one solution:

begin{align} emptyset_{1} & = halt without output \ NH(NH,NH) & = {not halt} end{align}

$$NH(M,i) = {not halt}$$ when it halts and $$NH(M,i) = emptyset_{1}$$ when it does not halt

begin{align} NX(X) & = N(NH(P(X))) \ & = N(NH(X,X)) \ & = N({not halt}) \ & = {halt} end{align}

$$NH(X,X) ne NX(X)$$

Assume the opposite $$NH(X,X) = emptyset_{1}$$

begin{align} NX(X) & = N(NH(P(X))) \ & = N(NH(X,X)) \ & = N(emptyset_{1}) \ & = emptyset_{1} end{align}

This is a contradiction $$NH$$ predicted it will halt and it did therefore $$NH(X,X)$$ can only output $${not halt} and halt$$
This solution also preserves the concept of reverse infinite recursion is a solution that halts.

Similar proof as before:

begin{align} NX(M) & = N(H(P(M))) \ & = N(NH(M,M)) \ & = N({not halt}) \ & = {halt} end{align}

begin{align} NX(M) & = N(H(P(M))) \ & = N(H(M,M)) \ & = N(emptyset_{1}) \ & = emptyset_{1} end{align}

$$NX(i) = {{halt},emptyset_{1}}$$

$$X(i)$$ always loops forever $$NX(i)$$ will halt with or without output $${halt}$$

Conclusion

The above shows that both $$H$$ and $$NH$$ are decidable and computers can answer any question when given infinite time and resource.

## virtual machines – Set computer name of Win 10 VM in Azure Scale Set from specialized image

I have a Win 10 Pro specialized image in a Shared Image Gallery I’m using as a base for a Scale Set. Everything works well except all the VM’s Win computer name are the same which confuses the server app I’m using.

How do I configure a Scale Set to auto set the computer (not resource) name of each VM?

## complexity theory – Time constructible function T in equivalence of Turing Machines

I’m reading Computational Complexity by Arora and Barak and I had a doubt regarding a statement made about the equivalence of Turing Machines:

For every $$f : {0, 1}^∗ → {0, 1}$$ and time-constructible $$T : N → N$$, if $$f$$ is computable in time $$T (n)$$
by a $$TM M$$ using alphabet $$Gamma$$ then it is computable in time $$4log|Gamma|T (n)$$ by a $$TM tilde{M}$$ using the
alphabet {$$0, 1, square, B$$}.

Specifically, what if any role $$T$$ being time constructible has here.

The proof (sketch) encodes $$Gamma$$ in binary, and uses a larger register to simulate $$M’$$s transition function, and also a counter. But I don’t think $$T$$ being time constructible comes into play. Could someone confirm/ or tell me if I’m missing something?

## turing machines – Deteremine if Language is in \$R\$ or \$RE\$

The language is in RE: simply generate all inputs $$x$$ with $$|x|le 10000$$ (they are finitely many), and simulate $$T$$ on all inputs in parallel. Whenever one simulation halts, accept.

The language is not in co-RE, as otherwise it would be decidable and we could solve the Halting problem.
Indeed, to decide whether a Turing machine $$T$$ halts on empty input, we could create a new machine $$M$$ that simulates $$T$$ if $$x=varepsilon$$ and does not halt otherwise. Then $$M in L$$ if an only if $$T(varepsilon)$$ halts.

## turing machines – halting problem vs watchdog

I have a theory that all finite state machines can be monitored by a second turing machine with infinite tape to determine if the state of the first machine was repeated thus reaching the conclusion that the finite state machine must be looping. I’m fairly confident that this is not a new idea but I could not find anything relevant through all my searches and reading here. Knowing that all modern digital computer hardware has finite RAM and local storage, we can make the statement that all modern digital computers are equivalent to an arbitrary large FSM.

for example, a program that outputs all the non-negative integers {0,1,2,…}
this program will never halt if it is run on a turing machine with infinite tape. however, this program would eventually overflow and rollover to 0 on a machine with finite ram. assuming that an overflow does not halt. this machine also does not halt. however, the implementation with finite RAM can be monitored by another turing machine that records a copy of the contents of RAM in a new dictionary file on the second turing machine with infinite tape. you could in theory then run a program on the second machine that checks if any new state exists in the dictionary. if it exists in the dictionary then output a warning message that the FSM is looping. I believe the implication of this conclusion is that the halting problem must have a turing machine with infinite tape as a requirement for the halting problem to remain undecidable. This is equivalent to the statement that any modern computer hardware can in theory have a watchdog process that monitors a sandbox that has allocated a very small limited RAM for repeating patterns to confirm that a program is in fact undecidable. an example of this is hardware PRNG which always loops and the period can be determined by another process on the same machine. Is there a name for this conjecture?

## turing machines – this language and acceptance by queue automaton

I don’t know how to prove or show that:

$$L_1 = {xx|x in Sigma^ast}$$ (that can be accepted by queue automaton)

If it would be possible, show by deterministic queue automaton, if not, by non-deterministic queue automaton.

If it’s not that hard (and if I can), please give me a hint.

## turing machines – Explain the simulation of an if else statement in LOOP

I’m learning about LOOP program and in my book I have the following command which is simulated by a LOOP program:

$$text{if} x_i = 0 text{then} text{P1} text{else} text{P2} text{end}$$

This is simulated in LOOP as:
begin{align} &x_n := 1; \ & x_{n+1} := 1; \ &text{loop} x_i text{do} x_n := x_n -1 text{end}; \ &text{loop} x_n text{do} x_{n+1} := x_{n+1} -1 text{end}; \ &text{loop} x_n text{do} text{P1} text{end}; \ &text{loop} x_{n+1} text{do} text{P2} text{end}; \ &x_n := 0; \ & x_{n+1} := 0; \ end{align}

There is no commentary for the code and I’m not sure how this even simulates the original if statement.

## turing machines – Correct terminology for \$P1;P2\$?

This question is about the correct terminology. Let $$P1$$ and $$P2$$ be two LOOP programs. Then $$P1;P2$$ is also a LOOP program, which executes $$P1$$ and then executes $$P2$$. Would this be called concatenation of LOOP programs or nested LOOP programs?

I know the answer has to be concatenation because nested would mean having a LOOP program inside another LOOP program. This is not the same as what is written above. Therefore, the answer has to be the former. I just wanted to make sure that concatenation is the correct term here or is there another, more proper term?