ある仮説が存在し、別の仮説が存在しない場合にルールを適用したい。この状態を確認するにはどうすればよいですか?
例えば:
Variable X Y : Prop.
Axiom A: X -> Y.
Axiom B: X -> Z.
Ltac more_detail :=
match goal with
|[H1:X,<not H2:Y>|-_] =>
let H' := fresh "DET" in assert Y as H'
by (apply A;assumption)
|[H1:X,<not H2:Z>|-_] =>
let H' := fresh "DET" in assert Z as H'
by (apply B;assumption)
end.
そのような、この目標のために:
> Goal X->True. intros.
H:X
=====
True
more_detail.
2 番目の仮説 DET を導入します。
H:X
DET:Y
DET0:Z
=====
True
そして、連続する呼び出しmore_detail.
は失敗します。
ただし、とmore_detail.
の両方が存在することを常に確認する必要があります。つまり、一方のみが存在する場合は、別のルールを実行する必要があります。Y
Z
Goal X->Y->True. intros.
H:X
H1:Y
=====
True
> more_detail.
H:X
H1:Y
DET:Z
=====
True
と:
> Goal X->Z->True. intros.
H:X
H0:Z
=====
True
> more_detail.
H:X
H0:Z
DET:Y
=====
True