可判定性的要点和重要性

发布于 2024-09-27 19:03:29 字数 307 浏览 3 评论 0原文

如果 TM 识别该语言并进入“接受”或“拒绝”状态,则该语言是可判定的。作为一名开发人员。我认为这很重要,因为这意味着我们可以确定程序是否包含缓冲区溢出或死锁。此外,以下问题是不可判定的:

  • 程序是否访问过未初始化的变量。
  • 两个上下文无关语法是否描述相同的语言?
  • 如果子例程的参数通过引用或复制结果传递,这有什么不同吗?

就可判定性而言,您认为可判定性的关键点是什么以及为什么可判定性很重要(特别是对于开发人员)。

注意:答案中的要点很好 - 我可以自己查找主题。我只想知道其中的要点是什么。

A language is decidable If a TM recognises the language and goes into an Accept or Reject state. As a dev. I think this is important as it would mean we could determine if a program contains buffer overflows or deadlocks. Also, the following problems are Un-Decidable:

  • Does a program ever access an uninitialized variable.
  • Do two context free grammars describe the same langauge.
  • Does it make a difference if parameters to a subroutine are passed by reference or by copy-result

In terms of Decidability what would you say are the key points to Decidability and why is Decidability important (particularly to a developer).

Note: Bullet points are fine in answers - I can look up the topics myself. I just want to know what are the main points.

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

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

发布评论

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

评论(2

梦亿 2024-10-04 19:03:29

也许这属于 cstheory 交易所,但无论如何我都会尝试一下。

关键点是:有些问题是不可判定的,即无法通过算法解决,因此应该通过其他方法来解决。这些问题中有许多与计算机语言有关的“元问题”,例如 检测病毒

确定问题不可判定后,有几种可能的行动方案:

  1. 某些问题可能是半可判定的,即有一种半算法可以解决某些情况,但在其他情况下永远循环。实现半算法时,在其上放置一个计时器,并在时间用完时返回无应答
  2. 通过简化问题,仅解决问题的几个关键部分。
  3. 2+当问题变得过于复杂时询问用户输入。
  4. 使用大多数都能得到正确答案的启发式方法。
  5. 使用不同的语言,也许是非图灵完备的语言。

1 到 3 是流行的自动推理工具,包括程序验证器。 4 是病毒扫描程序的作用。当允许用户编写脚本来自动化大型系统时,5 是一个不错的选择 ;不要给他们完整的 JavaScript/Scheme/Lua/任何东西,而是给他们一个不允许无限递归/循环的受限子集。

Maybe this belongs in the cstheory exchange, but I'll have a go at it anyway.

The key point is: some problems are undecidable, i.e. not solvable by an algorithm, so they should be tackled by other methods. Among these problems are many "meta-problems" concerning computer languages, for instance the problem of detecting a virus.

Having determined that a problem is undecidable, there are several possible courses of action:

  1. Some problems may be semi-decidable, i.e. there is a semi-algorithm that solves some cases, but loops forever on other cases. When implementing a semi-algorithm, put a timer on it and return no answer when the time runs out.
  2. Solve only a few, hopefully crucial parts of the problem by simplifying it.
  3. 2 + ask the user for input when the problem becomes too complex.
  4. Use a heuristic that gets the correct answer most of the time.
  5. Use a different language, perhaps a non-Turing complete one.

1 to 3 are popular for automated reasoning tools, including program verifiers. 4 is what virus scanners do. 5 is a good choice when allowing users to write scripts to automate a larger system; instead of giving them full JavaScript/Scheme/Lua/whatever, give them a restricted subset that does not allow unbounded recursion/loops.

找回味觉 2024-10-04 19:03:29

假设您必须编写一些满足条件的软件:“在运行时,任何函数都不得直接或间接调用自身”。

该条件是不可判定的,但更具限制性的条件可能是可判定的,例如:“不得使用函数指针,并且函数不得包含直接或间接对自身的调用”。

这是为了强调,有时可以用灵活性来换取可判定性,以便系统的某些必需属性可以变得可执行。

如果一种编程语言是可判定的,那么总是可以判定一个程序是否是该语言的有效程序。

但即使一个程序对于该语言来说是有效的程序,仍然无法确定该程序是否会导致缓冲区溢出或死锁。

Suppose you have to write some software that satisfies the condition: "at runtime no function shall ever end up calling itself directly or indirectly".

That condition would be undecidable, but a more restrictive condition may be decidable, for instance something like: "no function pointers shall be used and no function shall contain calls to itself directly or indirectly".

This is to highlight that sometimes it is possible to trade flexibility for decidability, so that certain required properties of the system may become enforceable.

If a programming language is decidable, then it will always be possible to decide whether a program is a valid program for that language or not.

But even if a program is a valid program for that language, it remains undecidable whether that program may incur a buffer overflow or a deadlock.

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