I want to apply the rule when some hypothesis is present and the other is not. How can I check this condition?
For instance:
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.
Thus, for this purpose:
> Goal X->True. intros.
H:X
=====
True
more_detail. will present the second DET hypothesis:
H:X
DET:Y
DET0:Z
=====
True
And the serial call more_detail.will fail.
However, more_detail.it must always guarantee that both Y, and Z, i.e. if only one of them is present, it should run a rule for the other:
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
Necto source
share