complexity theory – For every non-trivial language $A$ and every finite strict subset $B subsetneq A$, it’s holds that $A le_m A setminus B$

It’s claim 1 from Bader Abu Radi‘s solution to this question.

My solution (have no idea how wrong it is):
$B$ finite $Rightarrow$ $Bin R Rightarrow$ exists TM $langle M_Brangle$ that halts $B$.
Let’s define reduction $f$ from $A$ to $A setminus B$, in the following way $f(langle M_Brangle , x)=langle M_Arangle$

When $M_A$ implemented on input $w$ like this:

  1. Run $M_B$ on $w$ and answer on the same way

$xin B Rightarrow M_B$ accept $xRightarrow M_A$ accept $xRightarrow xin M_A$

$xnotin B Rightarrow M_B$ reject $xRightarrow M_A$ reject $xRightarrow xnotin M_A$

So the reduction $A le_m A setminus B$ true.

As I wrote early not sure how wrong is it, additionaly what’re the changes that should be done to proof the second claim ($A setminus B le_m A$) from the same answer.

complexity theory – State whether the language is in $R$, $RE$, etc. The intuition for the solution

The intuition is that finite languages are very simple in the sense that throwing a finite number of words from a language does not affect membership in $text{R}$ or in $overline{text{RE}}$, etc. Therefore, since $L^{geq k}$ is the result of throwing a finite number of words from $L$, we get that:

  1. $L(M)^{geq k} in text{RE}$, and
  2. $overline{HP}^{geq k} notin text{RE}$.

So the language $L = { langle M rangle: exists k: L(M)^{geq k} = overline{HP}^{geq k}}$ must be empty.


Formally speaking, we have the following claims:

Claim 1: For every non-trivial language $A$, and every finite strict subset $Bsubsetneq A$, it holds that $A leq_m A setminus B$.

Hint for the proof of claim 1: $B$ is finite and thus decidable. Therefore, given input $x$ for the reduction, we can check whether $xin B$. Then you can proceed easily. Think where to map inputs $x$ from $B$, and where to map inputs $x$ from $overline{B}$.

We also have the following similar claim which could be useful.

Claim 2: For every non-trivial language $A$, and every finite strict subset $Bsubsetneq A$, it holds that $Asetminus B leq_m A $.

Given the above claims, we’re done. Indeed, $overline{HP} notin text{RE}$, and for every $k$, $overline{HP}^{geq k} = overline{HP}setminus {win overline{HP} : |w| < k}$. That is, $overline{HP}^{geq k}$ equals a non-trivial infinite language minus a finite subset, and so by claim 1, $overline{HP}^{geq k} notin text{RE}$. Also, it holds that $L(M)^{geq k} in RE$ for every machine $M$ (this is easy, you can prove that directly using standard closure properties and the fact that $L(M)^{geq k} = L(M)setminus { win L(M): |w| < k}$. Alternatively, you can use claim 2 but you have to be careful regarding the edge cases where $L(M)$ is trivial, etc.). Therefore, it cannot be the case that there is a machine $M$ with $L(M)^{geq k} = overline{HP}^{geq k}$.

migration – Migrate Site collection across versions with different language packs

I have a task to recreate a SP2019 on-prem farm. Originally it was installed with Polish language, so both Central Adm and the site are in Polish. Now the idea is to have the English version installed, but separately install Polish language pack, so Central Adm will stay English but the main Site collection will be in Polish.

The question is about data migration: can I simply backup & restore this SPSite on this new farm installation, or will there be a version mismatch?

If this is off the table, what other possibility remains? Manual recreation? Is there some PS script which could help me with migrating data?

internationalisation – Internationalization – how to handle situation where landing url implies different language than previously chosen settings

Well say I have a website example.com – it allows people (writers) to post their own content which they can link to later for readers: example.com/my-blog-title would be such a link.

Now in the process of internationalization the interface is adapted to the users (readers + writers) preferred language. This setting can be chosen done -when a reader is logged in- at their profile page (thus not having the limit to one device upon loggin in at another device the settings is correct).

Further if a language is chosen the url is changed to reflect that. This is done for SEO purposes: example.com/en-us.

Thus if a writer has his language set to french the url to his content would be example.com/fr-fr/my-blog-title. And if he changes his interface to english the content would still be there, also under example.com/en-us/my-blog-title. (I now realize blog seems to imply text, but it’s important to remember that the content is always visible in any language – it’s the interface that changes).

However this creates a weird situation, where (say) a reader has set his language to English. yet a reader is directly linking his post example.com/fr-fr/my-blog-title, what should then happen?

  1. Redirect url to example.com/en-en/my-blog-title – but this might be confusing to readers that the urls don’t match?
  2. Ignore the language from the URL and use user’s prefered language instead – but then the same url links to different languages, and what happens on links inside that page?
  3. Ignore the user’s prefered language and use the exact url. – But then the website might confuse readers as they can no longer find their familiar buttons when they don’t understand the language.

What is the generally accepted solution for this?

google pixel – Prevent Android from changing language based on location

I’m on vacation in a different country on a trip that did not include knowing a new language.

It’s not everywhere but enough to be annoying. Latest, changing language of buttons on a Google Form that’s never seen the language during its creation or previous uses. Before that, suggested videos on YouTube are all in Spanish.

Pixel 5 Android 11

c++ – insert binary heap in C language without using sub functions and imported libraries

the code must be in C language ,
After adding it should be converted back into heap shape ,
enter image description here

struct node {
     int key;
     struct node * parent, * left_link, * right_link;
};
struct heap {
struct node * root;
struct node * last_added;
}

void heap_insert(struct heap *heap,int key){
//-- the code --
}

complexity theory – How can I simulate nested WHILE loops in a theoretical programming language to show Turing completeness?

PRE-WORK-POST is a theoretical programming language with the following structure, where P,Q and R are LOOP program:

$$text{PRE} P text{WORK} Q text{POST} R text{END}$$

First $P$ is executed. Then $Q$ is executed until $x_0 neq 0$. Finally $R$ is executed. I have to prove that PRE-WORK-POST is Turing complete and I have chosen to prove that I can simulate any WHILE program through a PRE-WORK-POST program. I’m stuck on one of the tasks. Given that $P1$ and $P2$ are both WHILE program, then $P1;P2$ is also a WHILE program (by definition). How can I simulate this using PRE-WORK-POST? I’m not really sure how I can do this since LOOP programs don’t allow for nested loops.

automata – Unique decipherability of infinite regular language

Can we design an algorithm to test if a infinite regular language is a code?

We have the S-P algorithm to determinate if a finite language is a code. But how about the infinite part of regular languages?
If we have a regex which describes our set of words, then is it possible to modify the S-P algorithm to work on an infinite set without creating Pattern Matching Machines? If it helps, let the regex use only ‘* | ()’ as special symbols.

I thought about making an algorithm which would work based on a PMM, but it isn’t as trivial as the S-P algorithm for finite sets, checking the suffixes of strings with matching prefix. The algorithm would be creating a PMM from the regex and traversing it for the search of suffixes etc. like in the S-P algorithm.

language design – Why do “checked exceptions”, i.e., “value-or-error return values”, work well in Rust and Go but not in Java?

From a scientific point of view, checked exceptions can be seen as alternative return values, e.g.

Exactly. They can be seen that way, and they should be but they aren’t.

Using an Error type like is common in Rust, Elm, Haskell, and in some sub-communities in Scala or a special error value as in Go is just an alternative return value indicated in the type system. A checked exception is like an alternative return value, but it doesn’t use the normal way of returning values, it is a completely separate, very different way of “returning values”. It also sits outside of the type system, and bolts on a completely separate “checked exception” system onto the type system.

But most importantly, it is not just an alternative return value, it is also an alternative control flow.

Another problem with the specific way checked exceptions are implemented in Java, is that they are anti-modular. That is, however, not a fundamental problem of checked exceptions, unlike the ones I mentioned above. There is an idea of Modular Anchored Exceptions, for example, where you can specify something like

int foo() throws like bar { return bar(); }

And you don’t have to know (and leak!) which precise exceptions bar can throw. You can even do something like throws like bar except ArrayOutOfBoundsException when you are handling some errors yourself.

core language – Broken ValueQ function in Mma12.2?

The behavior of ValueQ has changed in version 12.2. In fact, you can provide a Method -> "Legacy" option to match the behavior the function had in Version 12.1 and earlier:

reproducing old behavior

The Details portion of the documentation for ValueQ now states that the default method in the 12.2 implementation (Automatic) effectively uses "OwnValuesPresent" if expr is a symbol and "SymbolDefinitionsPresent" otherwise (which means that “one or more symbols have any sort of definition present”). As I understand it, g(x) is not a symbol, so the latter is used.