Rewriting according to the equality in hypothesis
eh(a,
A,
f)
with:
This command enables us to replace a by A, either in the current goal , or in all the hypotheses, or in the h hypothesis.
Keyword _h enables us to use an equality of which we only know one member (right or left). In this case, the last satisfactory equality in hypothesis, is used.
If
f
=
Hyp(h),
the
goal
becomes:
H ⇒ G
where
H
is
obtained
by
replacing
a
by
A
in
the
hypothesis
h,
if
it
exists.
If
f
=
AllHyp,
the
goal
becomes:
H ⇒ G
where
H
is
obtained
by
replacing
a
by
A
in
all
the
hypotheses.
If
f
=
Goal,
the
goal
becomes:
G′
where G′ is obtained by replacing a by A in all the hypotheses.
A proof often fails because an equality has not been used. The automatic provers have to take precautions with rewriting using equalities; indeed, this can generate loops (see chapter 2.9 page §). However, the interactive prover can perform such rewritings, which are applied from time to time and under user control.
When a goal is rewritten, the interactive command may contradict a normalisation performed by the automatic prover; if we restart in automatic mode, this will immediately redo the inverse transform.
Nonetheless, the command can be useful if the user uses other interactive commands on the rewritten goal, before calling the automatic prover.
Given the following situation:
Hypothesis ENS = {e1,e2,e3,e4,e5} & ENS: FIN(NATURAL*{ENS.enum}) & not(ENS = {}) & tt: ENS & zz: ENS & not(zz = tt) & #kk.(kk: ENS & not(kk = zz) & not(kk = tt)) & zz: {e1,e2,e3,e4} => tt = e5 & zz = e5 => tt = e1 & zz = e5 or zz = e1 & uu = zz & !vv.(vv: ENS & (not(zz = vv) or not(tt = vv)) => zz = vv) Goal uu = e5 => zz = e1
|
It is possible to substitute uu by zz in the goal.
PRI> eh(uu,zz,Goal) Starting use Equality in Hypothesis
|
the goal becomes:
Goal zz = e5 => zz = e1
|
It is possible to perform the substitution for a hypothesis
PRI> eh(zz,uu,Hyp(zz = e5 or zz = e1)) Starting use Equality in Hypothesis
|
The goal becomes:
Goal uu = e5 or uu = e1 => (zz = e5 => zz = e1)
|
It is possible to perform the substitution for all the hypotheses.
PRI> eh(zz,uu,AllHyp) Starting use Equality in Hypothesis
|
All the new hypotheses appear as antecedent of the current goal:
Goal uu: ENS & not(uu = tt) & #kk.(kk: ENS & not(kk = uu) & not(kk = tt)) & (uu: {e1,e2,e3,e4} => tt = e5) & (uu = e5 => tt = e1) & (uu = e5 or uu = e1) & !vv.(vv: ENS & (not(uu = vv) or not(tt = vv)) => uu = vv) => (uu = e5 or uu = e1 => ( zz = e5 => zz = e1))
|
Given the following situation:
Hypothesis ENS = {e1,e2,e3,e4,e5} & ENS: FIN(NATURAL*{ENS.enum}) & not(ENS = {}) & zz: ENS & uu = tt or uu = zz & tt: {e1,e2,e3,e4} => zz = e5 & zz = e5 => tt: {e1,e2,e3,e4} & tt = e5 => zz = e1 & zz = e1 => tt = e5 & zz = e5 Goal e2 = e5 or e2 = zz
|
If the user wants to use an equality with e5 as right member, without taking care of the left member:
PRI> eh(_h,e5,Goal) Starting use Equality in Hypothesis
|
using the equality zz = e5, the goal becomes:
Goal e2 = e5 or e2 = e5
|
If the user wishes to use the last equality whose left member is zz:
PRI> eh(zz,_h,Goal) Starting use Equality in Hypothesis
|
the goal becomes:
Goal e2 = e5 or e2 = e5
|
The goal is indeed transformed, using the hypothesis zz = e5.