I want to apply a rule in a case when some hypothesis present, and another is not. How can I check for this condition?
For example:
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.
Such that, for this goal:
> Goal X->True. intros.
H:X
=====
True
more_detail.
would introduce a second hypothesis DET:
H:X
DET:Y
DET0:Z
=====
True
And a successive invocation more_detail.
would fail.
However more_detail.
should always ensure, that both Y
and Z
are there, i.e. if only one of them present, it should run a rule for another:
Goal X->Y->True. intros.
H:X
H1:Y
=====
True
> more_detail.
H:X
H1:Y
DET:Z
=====
True
And:
> Goal X->Z->True. intros.
H:X
H0:Z
=====
True
> more_detail.
H:X
H0:Z
DET:Y
=====
True