目前广泛使用的压缩算法的定点

发布于 2024-08-03 00:28:27 字数 258 浏览 1 评论 0原文

我想知道是否存在一种当今常用的压缩算法,它包含一个固定点,即身份文件。

为了解释一下,我们调用 C : byte[] -> byte[] 表示压缩算法的函数。我想知道是否存在(以及它是什么,是否可以在合理的时间内确定)一个文件 f 使得

C(f) = f

即,当使用当今常用的合适的、广为人知的压缩算法压缩时,该文件将自行生成结果。

你知道这样的现象吗?

I was wondering if there is a compression algorithm, in common use today, that contains a fixed point, i.e., an identity file.

To explain, let's call C : byte[] -> byte[] a function that represents the compression algorithm. I want to know if there exists (and what it is, if it is possible to determine in reasonable time) a file f such that

C(f) = f

That is, a file that, when compressed by a suitable, widely-known compression algorithm in common use nowadays, will produce itself as the result.

Do you know of such a phenomenon?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不必你懂 2024-08-10 00:28:27

警告:答案相当迂腐。

在很多情况下 D(f) = f(D 被定义为减压)。然而,压缩的定义并不精确。对于大多数压缩算法,压缩算法的不同实现将给出不同的输出文件(不同大小)。考虑两个程序 1 和 2。为了实现完全互操作性,对于所有有效 F,D1(F) 必须等于 D2(F)。同样,D2(C2(f)) == D2(C1( F)) == D1(C1(F)) == D1(C2(F)),对于所有有效的 F。然而,C1(F) == C2(F) 是完全没有必要的,事实上这种情况很少见案件。

因此,如果您实际压缩此类奎因,则不太可能最终得到相同的文件,除非您使用用于生成它的相同程序来执行此操作(这不太可能,因为此类奎因通常是手工制作的,而 C(F) 甚至从未被测试过)。

虽然可以(事实上,微不足道!)生成一个对于某些 F 而言 C(F) == F 的程序,但大多数人倾向于将更明确定义的情况指出为 quines,其中 D(F) == F (因为 D1(F)==D2(F) 对于 F 格式的所有有效、兼容的解压缩,假设 F 有效)。

因此,可能存在 C(F) == F 的情况,但通常这是错误的问题,您应该询问 D(F) == F 的情况...其他回答该问题的人已提供。

Warning: Rather pedantic answer.

There are many cases where D(f) = f (D being defined as decompression). However, compression is not as precisely defined. For most compression algorithms, different implementations of the compression algorithm will give different output files (of varying sizes). Consider two programs, 1 and 2. For full interoperability, it is necessary that D1(F) must equal D2(F) for all valid F. Similarly, it is necessary that D2(C2(f)) == D2(C1(F)) == D1(C1(F)) == D1(C2(F)), for all valid F. However it is totally unnecessary that C1(F) == C2(F), and this is in fact rarely the case.

So, you are unlikely to, if you actually compress such quines, to end up with the same file, unless you use the same program to do so that was used to generate it (which is unlikely, since such quines are usually hand-crafted, with C(F) never even being tested).

While it is possible (indeed, trivial!) to produce a program for which C(F) == F for some F, most people tend to instead point out as quines the more well-defined case where D(F) == F (since D1(F)==D2(F) for all valid, compatible decompression of the format of F, assuming F is valid).

So, there are likely cases where C(F) == F, but generally this is the wrong question to ask, and you should instead ask for cases where D(F) == F...which other people who answered the question have provided.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文