如何对字符串上的布尔等式进行模式匹配,同时在Coq证明中获得所需的命题等式?

如何对字符串上的布尔等式进行模式匹配,同时在Coq证明中获得所需的命题等式?,coq,equality,substitution,lambda-calculus,theorem-proving,Coq,Equality,Substitution,Lambda Calculus,Theorem Proving,我一直在尝试证明SF中的substi_正确定理,因为我不知道如何在布尔等式上拆分,同时将其断言为命题等式 Theorem substi_correct : forall s x t t', [x:=s]t = t' <-> substi s x t t'. Proof. intros. split. + generalize dependent t'. induction t; intros. - simpl in H. subst.

我一直在尝试证明SF中的substi_正确定理,因为我不知道如何在布尔等式上拆分,同时将其断言为命题等式

Theorem substi_correct : forall s x t t',
  [x:=s]t = t' <-> substi s x t t'.
Proof.
  intros. 
  split. 
  + generalize dependent t'.
    induction t; intros.
    - simpl in H.
      subst.
      case (eqb_string x0 s0).
      * constructor. (*Doesn't work*)
在地图第五章中,我们证明,除了一个错误的案例

Theorem eqb_string_true_iff : forall x y : string,
    eqb_string x y = true <-> x = y.
定理eqb\u string\u true\u iff:forall x y:string,
等式b_字符串x y=true x=y。

但是当模式匹配在(eqb_string x0 s0)上时,我如何使用then以便继续?我应该在证明中使用这个引理,还是有更简单的方法来进行?

您可以使用
析构函数的变体和
eqn:
子句来添加一个假设,记住您所处的情况:

  destruct (eqb_string x0 s0) eqn:Ex0s0  (* <-- You can pick any name for the equation here *)
  - (* Ex0s0 : eqb_string x0 s0 = true *)
    apply eqb_string_true_iff in Ex0s0.
    ...
  - (* Ex0s0 : eqb_string x0 s0 = false *)
    apply eqb_string_false_iff in Ex0s0.
    ...
destruct(eqb_字符串x0 s0)eqn:Ex0s0(*
  destruct (eqb_string x0 s0) eqn:Ex0s0  (* <-- You can pick any name for the equation here *)
  - (* Ex0s0 : eqb_string x0 s0 = true *)
    apply eqb_string_true_iff in Ex0s0.
    ...
  - (* Ex0s0 : eqb_string x0 s0 = false *)
    apply eqb_string_false_iff in Ex0s0.
    ...