您如何确定在coq中调用介绍的术语

您如何确定在coq中调用介绍的术语,coq,Coq,我是coq的初学者,所以这可能是一个微不足道的问题。有时候,当我写一个定理的时候,我不知道我需要在哪些术语上调用介绍。一个简单的例子 Theorem silly1 : forall (n m o p : nat), n = m -> [n;o] = [n;p] -> [n;o] = [m;p]. Proof. intros n m o p eq1 eq2. rewrite <- eq1. apply eq2. Qed. 所以我想我要问的是…当我开始

我是coq的初学者,所以这可能是一个微不足道的问题。有时候,当我写一个定理的时候,我不知道我需要在哪些术语上调用介绍。一个简单的例子

Theorem silly1 : forall (n m o p : nat),
  n = m  ->
  [n;o] = [n;p] ->
  [n;o] = [m;p].
Proof.
  intros n m o p eq1 eq2.
  rewrite <- eq1.
  apply eq2.  Qed.

所以我想我要问的是…当我开始证明一个定理时,我应该如何通过目标进行推理,以确定我需要在哪些术语上称为简介?

gallais所指的例子如下

Theorem example_1 : forall A B, (A -> B) -> A -> B.
Proof. intros ? ? H1. apply H1. Qed.

Theorem example_2 : forall A B, (A -> B) -> A -> B.
Proof. intros ? ? H1 H2. apply H1. apply H2. Qed.

Print example_1.
Print example_2.
另一个可能出现问题的例子是在使用归纳法之前使用介绍法。这使得归纳假说有所不同

Fixpoint reverse_helper {A : Type} (l1 l2 : list A) : list A :=
  match l1 with
  | nil => l2
  | cons x l1 => reverse_helper l1 (cons x l2)
  end.

Theorem example_3 : forall A (l1 l2 : list A), reverse_helper l1 l2 = app (reverse_helper l1 nil) l2.
Proof. intros. induction l1. simpl. reflexivity. simpl. try rewrite IHl1. Abort.

Theorem example_4 : forall A (l1 l2 : list A), reverse_helper l1 l2 = app (reverse_helper l1 nil) l2.
Proof. induction l1. intros. simpl. reflexivity. intros. simpl. rewrite (IHl1 (cons a l2)). rewrite (IHl1 (cons a nil)). Admitted.
否则,您应该尽可能使用介绍。除非你这样做,否则你将无法使用任何被量化的东西或暗示的前因

顺便说一下

H1 : A1
...
Hn : An
___
B
相当于

H1: A1, ..., Hn: An ⊢ B.

当你以交互方式证明某件事时,你使用的是从结论开始的后续演算,然后再回到假设。

如果你引入了太多的论点,最糟糕的情况是生成的证明项是错误的。这没有问题。
H1: A1, ..., Hn: An ⊢ B.