卡在逻辑基金会的Mapp案件中

发布于 2025-02-12 16:02:32 字数 2283 浏览 0 评论 0原文

我正在教自己通过逻辑基础课程使用COQ证明助手。

我被困在试图证明泵送引理的mapp情况下。

Lemma pumping : forall T (re : reg_exp T) s,
  s =~ re ->
  pumping_constant re <= length s ->
  exists s1 s2 s3,
    s = s1 ++ s2 ++ s3 /\
    s2 <> [] /\
    length s1 + length s2 <= pumping_constant re /\
    forall m, s1 ++ napp m s2 ++ s3 =~ re.

到目前为止,我的方法是在假设pupping_constant re1 + pumping_constant re2&lt; =长度S1 +长度S2的假设上应用add_le_case &lt; =长度S1 \/ pumping_constant re2&lt; =长度S2 。

Proof.
  intros T re s Hmatch.
  induction Hmatch
    as [ | x | s1 re1 s2 re2 Hmatch1 IH1 Hmatch2 IH2
       | s1 re1 re2 Hmatch IH | re1 s2 re2 Hmatch IH
       | re | s1 s2 re Hmatch1 IH1 Hmatch2 IH2 ].
  - (* MEmpty -- omitted *)
  - (* MChar -- omitted *)
  - (* MApp *)
    intro Hlength. simpl in Hlength. 
    rewrite app_length in Hlength. 
    pose proof (add_le_cases (pumping_constant re1) 
                             (pumping_constant re2) 
                             (length s1) 
                             (length s2) 
                             Hlength) as [Hre1ineq | Hre2ineq].

情况pumping_constant re1&lt; =长度S1导致了一个简单的目标。情况pumping_constant re2&lt; =长度S2是一个更难破解的坚果。

    -- (* pumping_constant re1 <= length s1 -- omitted *)
    -- (* pumping_constant re2 <= length s2. *)
      pose proof (IH2 Hre2ineq) as [s1' [s3' [s4' [
      Hs2eq [Hs3'len [Hlens1's3' Hnapp]]]]]].
      exists (s1++s1'), s3', s4'. repeat split.
      --- rewrite Hs2eq. repeat rewrite <- app_assoc.
          reflexivity.
      --- assumption.
      --- (* stuck *)

我必须证明长度(S1 ++ S1') +长度S3'&lt; = pupping_constant(App Re1 re2)(或长度S1 +长度S1' +长度S1' +长度S3'&lt; = pupping_constant re1 + pumping_constant re2在简化后),但似乎没有任何假设有用。排除归纳假设,直到我证明我当前的目标才能达到:

Hre2ineq: pumping_constant re2 <= length s2
Hlength: pumping_constant re1 + pumping_constant re2 <= length s1 + length s2
Hlens1's3': length s1' + length s3' <= pumping_constant re2
Hs2eq: s2 = s1' ++ s3' ++ s4'
Hs3'len: s3' <> [ ]

我在正确的轨道上选择(s1 ++ s1'),s3',s4'。还是死胡同?如果不是死胡同,我该如何更接近证明我当前的目标?

I am teaching myself to use the Coq proof assistant through the Logical Foundations course.

I am stuck trying to prove the MApp case of the pumping lemma.

Lemma pumping : forall T (re : reg_exp T) s,
  s =~ re ->
  pumping_constant re <= length s ->
  exists s1 s2 s3,
    s = s1 ++ s2 ++ s3 /\
    s2 <> [] /\
    length s1 + length s2 <= pumping_constant re /\
    forall m, s1 ++ napp m s2 ++ s3 =~ re.

My approach so far has been to apply add_le_cases on the assumption that pumping_constant re1 + pumping_constant re2 <= length s1 + length s2 in order to deduce that pumping_constant re1 <= length s1 \/ pumping_constant re2 <= length s2.

Proof.
  intros T re s Hmatch.
  induction Hmatch
    as [ | x | s1 re1 s2 re2 Hmatch1 IH1 Hmatch2 IH2
       | s1 re1 re2 Hmatch IH | re1 s2 re2 Hmatch IH
       | re | s1 s2 re Hmatch1 IH1 Hmatch2 IH2 ].
  - (* MEmpty -- omitted *)
  - (* MChar -- omitted *)
  - (* MApp *)
    intro Hlength. simpl in Hlength. 
    rewrite app_length in Hlength. 
    pose proof (add_le_cases (pumping_constant re1) 
                             (pumping_constant re2) 
                             (length s1) 
                             (length s2) 
                             Hlength) as [Hre1ineq | Hre2ineq].

The case pumping_constant re1 <= length s1 led to an easy goal. The case pumping_constant re2 <= length s2, however, is a tougher nut to crack.

    -- (* pumping_constant re1 <= length s1 -- omitted *)
    -- (* pumping_constant re2 <= length s2. *)
      pose proof (IH2 Hre2ineq) as [s1' [s3' [s4' [
      Hs2eq [Hs3'len [Hlens1's3' Hnapp]]]]]].
      exists (s1++s1'), s3', s4'. repeat split.
      --- rewrite Hs2eq. repeat rewrite <- app_assoc.
          reflexivity.
      --- assumption.
      --- (* stuck *)

I have to prove length (s1 ++ s1') + length s3' <= pumping_constant (App re1 re2) (or length s1 + length s1' + length s3' <= pumping_constant re1 + pumping_constant re2 after simplification) but it doesn't seem like any of the assumptions are helpful. Excluding the inductive hypotheses, which are not reachable until I prove my current goal, I am left with:

Hre2ineq: pumping_constant re2 <= length s2
Hlength: pumping_constant re1 + pumping_constant re2 <= length s1 + length s2
Hlens1's3': length s1' + length s3' <= pumping_constant re2
Hs2eq: s2 = s1' ++ s3' ++ s4'
Hs3'len: s3' <> [ ]

Am I on the correct track by picking exists (s1++s1'), s3', s4' or is it a dead end? If it's not a dead end, how can I get closer to proving my current goal?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文