分号在Coq中的奇怪行为

| 我在理解为什么我的Coq代码没有达到我期望的以下代码时遇到问题。 我试图使该示例尽可能简化,但是当我使它变得更加简单时,该问题就不再出现。 它使用的是CompCert 1.8文件。 这在Coq 8.2-pl2下发生在我身上。 这是代码:
Require Import Axioms.
Require Import Coqlib.
Require Import Integers.
Require Import Values.
Require Import Asm.

Definition foo (ofs: int) (c: code) : Prop :=
  c <> nil /\\ ofs <> Int.zero.

Inductive some_prop: nat -> Prop :=
| some_prop_ctor :
  forall n other_n ofs c lo hi ofs_ra ofs_link,
    some_prop n ->
    foo ofs c ->
    find_instr (Int.unsigned ofs) c <> Some (Pallocframe lo hi ofs_ra ofs_link) ->
    find_instr (Int.unsigned ofs) c <> Some (Pfreeframe lo hi ofs_ra ofs_link) ->
    some_prop other_n
.

Lemma simplified:
  forall n other_n ofs c,
  some_prop n ->
  foo ofs c ->
  find_instr (Int.unsigned ofs) c = Some Pret ->
  some_prop other_n.
Proof.
  intros.
这不起作用:
  eapply some_prop_ctor
    with (lo:=0) (hi:=0) (ofs_ra:=Int.zero) (ofs_link:=Int.zero);
      eauto; rewrite H1; discriminate.
rewrite H1
上失败,原因是:
Error:
Found no subterm matching \"find_instr (Int.unsigned ofs) c\" in the current goal.
这可以工作:
  eapply some_prop_ctor
    with (lo:=0) (hi:=0) (ofs_ra:=Int.zero) (ofs_link:=Int.zero);
      eauto.
  rewrite H1; discriminate.
  rewrite H1; discriminate.
Qed.
另外,在5分之后,我的目标如下:
2 subgoals
n : nat
other_n : nat
ofs : int
c : code
H : some_prop n
H0 : foo ofs c
H1 : find_instr (Int.unsigned ofs) c = Some Pret
______________________________________(1/2)
find_instr (Int.unsigned ofs) c <> Some (Pallocframe 0 0 Int.zero Int.zero)


______________________________________(2/2)
find_instr (Int.unsigned ofs) c <> Some (Pfreeframe 0 0 Int.zero Int.zero)
因此,
rewrite H1; discriminate
两次都有效,但是
eauto
后用分号“管道”它不起作用。 我希望这个问题至少有意义。谢谢! 完整代码:
Require Import Axioms.
Require Import Coqlib.
Require Import Integers.
Require Import Values.
Require Import Asm.

Definition foo (ofs: int) (c: code) : Prop :=
  c <> nil /\\ ofs <> Int.zero.

Inductive some_prop: nat -> Prop :=
| some_prop_ctor :
  forall n other_n ofs c lo hi ofs_ra ofs_link,
    some_prop n ->
    foo ofs c ->
    find_instr (Int.unsigned ofs) c <> Some (Pallocframe lo hi ofs_ra ofs_link) ->
    find_instr (Int.unsigned ofs) c <> Some (Pfreeframe lo hi ofs_ra ofs_link) ->
    some_prop other_n
.

Lemma simplified:
  forall n other_n ofs c,
  some_prop n ->
  foo ofs c ->
  find_instr (Int.unsigned ofs) c = Some Pret ->
  some_prop other_n.
Proof.
  intros.
(*** This does not work:
  eapply some_prop_ctor
    with (lo:=0) (hi:=0) (ofs_ra:=Int.zero) (ofs_link:=Int.zero);
      eauto; rewrite H1; discriminate.
***)
  eapply some_prop_ctor
    with (lo:=0) (hi:=0) (ofs_ra:=Int.zero) (ofs_link:=Int.zero);
      eauto.    
  rewrite H1; discriminate.
  rewrite H1; discriminate.
Qed.
    
已邀请:
因此,这可能是我自己的问题的答案(感谢#coq IRC频道上的某人): 可能的情况是,存在变量的统一直到happen10才发生 因此,通过分号,可能会阻止ѭ11和ѭ12统一。 但是我发现写
...; eauto; subst; rewrite H1; discriminate.
是可以的。在这种情况下,“ 14”将迫使存在变量统一,从而释放重写的能力。     

要回复问题请先登录注册