reference request – Compression bounds on the Copeland-Erdös constant

Motivation:

Given the set of prime numbers $mathbb{P} subset mathbb{N}$, the Copeland-Erdös constant $mathcal{C}$ is defined as (1):

begin{equation}
mathcal{C} = sum_{n=1}^infty p_n cdot 10^{-(n+ sum_{k=1}^n lfloor log_{10} p_k rfloor} tag{1}
end{equation}

where $p_n$ is the nth prime number.

Now, it is generally known that $mathcal{C}$ is normal and that normal numbers are finite-state incompressible. As machine learning systems are finite-state machines it occurred to me that prime formulas are not PAC-learnable by machine learning systems regardless of their computational power (5). While there are probably several approaches to this question, compression bounds driven by the Shannon source coding theorem seem natural to me as it demonstrates that in the asymptotic limit it is impossible to compress i.i.d. data such that the average number of bits per symbol is less than the Shannon entropy of the source.

Question:

Might there be an effective information-theoretic approach to normal numbers motivated by the Shannon source coding theorem? In principle, such an approach would allow us to derive compression bounds for any normal number.

To clarify what I mean, I have added a description of my attempts to find an effective information-theoretic definition of normal numbers.

An information-theoretic approach to normal numbers:

An information-theoretic definition of normal number:

Given the alphabet $Sigma$ with $lvert Sigma rvert = alpha$ and $X = Sigma^{infty}$ we may define:

begin{equation}
Sigma^n cap X_N := bigcup_{w_i in Sigma^n} w_i cap {x_i}_{i=1}^{N-n+1} tag{2}
end{equation}

where $x_i = X((i-1)cdot n, i cdot n -1)$ and $limlimits_{N to infty} X_N = X$.

In this context, $X$ is normal to base $alpha$ if for any $Z_N sim U(Sigma^n cap X_N)$ with $N gg n$ the average amount of information gained from observing each digit in $Z_N$ converges to:

begin{equation}
log_2 lvert Sigma^n rvert = n cdot log_2 lvert Sigma rvert tag{3}
end{equation}

as $N to infty$.

Proof of equivalence with the usual definition:

From a frequentist perspective, we may define the probabilities:

begin{equation}
forall w_i in Sigma^n, p_{w_i} = lim_{N to infty} frac{mathcal{N}(X_N,w_i)}{N-n+1} = frac{1}{|Sigma^n|} tag{4}
end{equation}

where $mathcal{N}(X_N,w_i)$ counts the number of times the string $w_i$ appears as a substring of $X_N$.

We have a uniform distribution over $Sigma^n$ in the sense that:

begin{equation}
forall w_i, w_{j neq i} in Sigma^n, p_{w_i} = p_{w_{j neq i}} tag{5}
end{equation}

Now, we define the random variable $Z_N sim U(Sigma^n cap X_N)$ whose Shannon entropy is given by:

begin{equation}
H(Z_N) = – sum_{i=1}^{lvert Sigma^n rvert} P(Z_N = w_i) log_2 P(Z_N = w_i) tag{6}
end{equation}

(6) is defined for sufficiently large $N$ since:

begin{equation}
forall w_i in Sigma^n forall epsilon > 0 exists m in mathbb{N} forall N geq m, Biglvert P(Z_N = w_i) – frac{1}{|Sigma^n|} Bigrvert = Biglvert frac{mathcal{N}(X_N,w_i)}{N-n+1} – frac{1}{|Sigma^n|} Bigrvert < epsilon tag{7}
end{equation}

and therefore we have:

begin{equation}
lim_{N to infty} H(Z_N) = log_2 lvert Sigma^n rvert = n cdot log_2 lvert Sigma rvert tag{8}
end{equation}

Application to the Copeland-Erdös constant:

Given that $mathcal{C}$ is normal in base-10, it is finite-state incompressible. In particular, if $mathcal{A}$ is the description language for all finite-state automata(which includes all learnable programs) then we may deduce that for large $N$ (6):

begin{equation}
mathbb{E}(K_{mathcal{A}}(mathcal{C}_N)) sim N cdot log_2 (10) tag{9}
end{equation}

where $mathcal{C}_N$ denotes the first $N$ digits of $mathcal{C}$ and $K(cdot)$ denotes prefix-free Kolmogorov Complexity. From (9) we may deduce that a prime formula is not PAC-learnable.

References:

  1. Copeland, A. H. and Erdős, P. “Note on Normal Numbers.” Bull. Amer. Math. Soc. 52, 857-860, 1946.
  2. A. N. Kolmogorov Three approaches to the quantitative definition of information. Problems of Information and Transmission, 1(1):1–7, 1965
  3. Olivier Rioul. This is IT: A Primer on Shannon’s Entropy and Information. Séminaire Poincaré. 2018.
  4. Edward Witten. A Mini-Introduction To Information Theory. 2019.
  5. Shai Shalev-Shwartz and Shai Ben-David. Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press. 2014.
  6. Peter Grünwald and Paul Vitányi. Shannon Information and Kolmogorov Complexity. 2010.

jquery – Updating sharepoint list items with batch pnp, in bad request

I’ve used this guide to create my batch and update the items.

var list = pnp.sp.web.lists.getByTitle("Categories");
list.getListItemEntityTypeFullName().then(entityTypeFullName => {
    var batch = pnp.sp.createBatch();
    $(`.${css.SortContent} table tbody tr`).each(function (ind, con) {
        var id: any = $(con).attr("data-catid");
        var newOrder: any = parseInt($(con).find(`.cat_select :selected`).text());
        list.items.getById(id).inBatch(batch).update({
            Order: newOrder
        }, "*", entityTypeFullName).then(() => {
            console.log("test");
        });
    });
    batch.execute().then(r => {
        console.log(r);
    }).catch((e) => {
        console.log(e);
    });
});

Information: There are 3 tr‘s inside the body. In my test, they give these results:

id = 1; newOrder = 2
id = 2; newOrder = 1
id = 3; newOrder = 3

When I run the code, this is the following result:

console.log(test) never runs
console.log(r) logs undefined
console.log(e) never runs

If I log batch just before it’s executed, I’m able to see 3 items inside. So I know the items are added to the batch.

But the items are never updated, and all I get is.

Error: Error making HttpClient request in queryable: (400) Bad Request

Image of the batch log:

enter image description here

Can anyone tell me what I’m doing wrong?

Update: It looks like "X-HTTP-Method": "MERGE" is missing.

enter image description here

kubuntu – How do I stop KDE wallet password request when connected remotely through VNC

I am using Kubuntu 20.04 (but had same issue in Kubuntu 18.04). I am running TigerVNC server on it and whenever I connect to the VNC server, I sometimes get a KDE Wallet popup requesting a password (image). It always shows up when I open Google Chrome. This doesn’t happen when I am using the PC physically.

Based on my understanding, the KDE Wallet is the password manager for KDE plasma and it has the same master password as your login by default. When you login physically, the KDE wallet gets unlocked. This doesn’t happen with VNC and whenever you open an application that needs to use the wallet, it will request for password. Is there a way to unlock the KDE Wallet at the creation of the VNC server or whenever a user connects to the server?

fa.functional analysis – Reference request for type of specific integral equation in two variable:

Consider the following integral equation:

$$int_0^infty K(t,y)phi(t,x)dt=0$$

Here, $K(t,y)$ is trigonometric kernel and
$phi(t,x)$ is monotonic wrt x ( for fixed t).

I want to find the dependence of y on x , i.e. $y=f(x)$.

I want some methods and references on how to deal with such problems in general.

c# – Use Request with Fileupload in Controller

I wrote a fileupload function for my application. Basically the application is a web based folder structure, which has files included.

I don’t know, but I am not happy with it. Is it too long? Can I do some parts easier? Is the logging ok? So many questions… The FileModel is inerhiting from ParentModel.

   public ActionResult FileUpload()
        {
            int id = Convert.ToInt32(base.Request.Form("id"));
            bool isJson = Convert.ToBoolean(base.Request.Form("isJson"));
            try
            {
                if (id < 1)
                {
                    id = Convert.ToInt32(base.Request.Form("folderId"));
                }
                if (id < 1)
                {
                    Logging.LogToFile("Could not load " + id ".", 3);
                    base.Response.StatusCode = 500;
                    return Json(new
                    {
                        success = false,
                        errFileUploadMsg = string.Concat(DateTime.Now, " Folder ID ", id, " couldn't load. Please try again.")
                    }, JsonRequestBehavior.AllowGet);
                }
                ParentModel pm = new ParentModel
                {
                    Files = new Files()
                };
                
                Files fm = pm.Files;
                int lastPosition = _mainFolderRepository.GetLastNumberOfFileInFolder(id);
                int position = ((lastPosition.GetType() != typeof(DBNull)) ? (lastPosition + 1) : 0);
                
                for (int i = 0; i < base.Request.Files.Count; i++)
                {
                    HttpPostedFileBase file = base.Request.Files(i);
                    Stream str = base.Request.Files(i).InputStream;
                    BinaryReader br = new BinaryReader(str);
                    byte() FileBytes = br.ReadBytes((int)str.Length);
                    fm.FullTextSearch = "";
                    fm.File = FileBytes;
                    fm.ContentLength = file.ContentLength;
                    fm.FileName = Path.GetFileName(file.FileName);
                    
                    if (Regex.IsMatch(fm.FileName, "\d+_\d+"))
                    {
                        string() fileNameSections = Path.GetFileNameWithoutExtension(fm.FileName).Split(' ')(0).Split('_');
                        if (fileNameSections(0).All(char.IsDigit) && fileNameSections(1).All(char.IsDigit))
                        {
                            fm.FileName = fm.FileName.Replace("_", "/");
                        }
                    }
                    
                    if (_mainFolderRepository.IsFileNameInFolder(id, fm.FileName))
                    {
                        int fileIdForChange = _mainFolderRepository.GetFileId(id, fm.FileName);
                        _mainFolderRepository.UpdateFile(fileIdForChange, fm.File, fm.ContentLength);
                    }
                    else
                    {
                        if (!Helper.CheckIfExtensionStringAllowed(Path.GetExtension(file.FileName).ToLower()))
                        {
                            throw new FileFormatException(fm.Extension);
                        }
                        fm.Extension = Path.GetExtension(file.FileName).ToLower();

                        if ((fm.Extension == ".pdf" || fm.Extension == ".doc" || fm.Extension == ".docx") && fm.File.Length != 0)
                        {
                            fm.VolltextSuche = ConverterController.ConvertFileToText(fm.File, fm.FileName, fm.Extension);
                        }
                        _mainFolderRepository.FileUpload(fm.File, fm.ContentLength, fm.FileName, "", "", base.User.Identity.Name, DateTime.Now, isPublic: false, fm.Extension, id, fm.RessortId, position, fm.FullTextSearch, "");
                    }
                    position++;
                }
            }
            catch (FileFormatException ex)
            {
                Logging.LogToFile(ex, 3);
                if (!isJson)
                {
                    base.TempData("Error") = string.Concat(DateTime.Now, " - Extension ", ex.Message, " not allowed.");
                    return RedirectToAction("Index", "MainFolder");
                }
                base.Response.StatusCode = 500;
                return Json(new
                {
                    success = false,
                    errFileUploadMsg = string.Concat(DateTime.Now, " - Extension ", ex.Message, " not allowed.")
                }, JsonRequestBehavior.AllowGet);
            }
            return RedirectToAction("Index", "MainFolder");
        }

tls – API request sent out under HTTPS becoming to HTTP on our firewall end

We have set up one api request, and we set our firewall only allow the api with HTTPS pass. When our visitor visits my app, they can see the traffic out from their firewall is under HTTPS, but when it reaches to our firewall, it becomes to under HTTP not HTTPS and our firewall blocks it so.

Does anyone know what’s the possible issue there? Why the request coming out with HTTPS becomes HTTP to our firewall end?

c# – Correct way to handle client request authentication

I would like to get your opinion on the problem I am having, my question on SO was closed so I think this forum might be more fitting.

I am currently developing a API using .NET 5 and C#. The problem I am facing is that the clients I need to GET/POST etc. to require different types of authentication, being:

  • API Key
  • Client certificate
  • OAuth

Each of the clients have at least one of these and maybe two (API Key + other). I am struggling to figure out how to implement these calls. I have thought of a few ideas but I am not sure if any of them will actually suffice. I am using HttpClient to make the calls to the external clients. These will all come from a single service or controller. I cannot split them out into a different service or controller for each type of auth.

Here is what I have thought of:

  • Using an if or switch statement, apply the necessary configuration depending on the required auth type. This is by far the worst idea, there will be so much repetition. No DRY here.
  • Using HttpClient handlers. In effect, creating three handlers (one for each type of auth) and letting the request activate the correct handler when it is being passed through.
  • Using a typed client. But this only allows one HttpClient to be related to a single service. I need all three to be available to any service.
  • Using simple middleware in the API to handle the requests and their authentication as necessary.

Does anyone have any suggestions on how to do this and if any of the above methods would be preferable?

reference request – Sum of reciprocals of friable (i.e. smooth) numbers

Consider the `logarithmic’ sum $$F(x,y) = sum_{n > x, , n text{ is }ytext{-friable}} frac{1}{n}.$$
I would expect that this sum was studied in the multiplicative number theory literature and would appreciate a reference for its asymptotics.

I know how I would go about this myself (study the corresponding Perron integral via saddle point analysis or other approaches, depending on the parameters). It is also not hard to work out $F$‘s order of magnitude, using Hildebrand and Tenenbaum’s results on $Psi(cx,y)/Psi(x,y)$ where $Psi(x,y) = #{n le x: n text{ is } y text{-friable}}$.

reference request – Notation for algebraic tangles

The Conway notation for rational knots is well known. I could use one for the more general algebraic tangles. As the name already says, one could build one out of tangle addition $+$, multiplication $*$, and the simple tangles over- and undercrossing ($o,u$). More elegant would be multiplication, 90° rotation ($r()$) and overcrossing, you would only need three symbols, one for the overcrossing and two for bracketing. Note that I assume mutations are equal: $r(r(t))=t$ for any tangle $t$.

The real problem is that I would also need a complete set of rules telling me if two tangles are the same (modulo Reidemeister moves), ideally by rewriting any tangle formula in some minimal canonic form (defined whatever way). For example (symbolically) for any tangle $t$, $(t*o+u)*o=r(t)$, i.e. you can rotate a tangle with three additional crossings. Note e.g. also $(u*u+u*u)*o=(u+u)*(o+o)+o$ and it’s not obvious which version should be declared canonic (or even if always the one with the least number of crossings should be canonic – the Borromei rings with one crossing cut out, i.e. five crossings, is an algebraic tangle, but seven crossings are needed to make it from ${u,o,+,*}$).

Surely such a system already exists?