4.56 User Simplification

Use of user-provided rewrite rules

Syntax

  us(T)
  us(T | M)

with:

Use

This command enables to use user-provided rewrite rules (from PatchProver and/or a Pmm file), either on the h hypothesis, or on all hypotheses, or finally on the current goal while minimizing memory consumption.

When a compound tactic (that is to say a list of tactics separated by semicolons) is used, rules are applied successively by going through the tactic list from left to right.

If M = Hyp(h), the goal becomes H G where H is obtained by applying the rewritings on hypotheses h, if they exist.

If M = AllHyp, the goal becomes H G where H is obtained by applying rewriting on all the hypotheses.

If M = Goal, the goal becomes G where G is obtained by rewriting the current goal G with the given rules.

The prover attempt to apply a given rewrite rule as long as it is likely to be applied.

Example

Given the following user-provided theories contained either in PatchProver or in a Pmm file:


 
        THEORY My_Simplifications IS  
 
                x: f[{a}] == {x |-> a} <: f;  
 
                (x + y)*z == (x*z + y*z)  
        END  
 
        &  
 
        THEORY Enum_Simp IS  
 
                binhyp(A : INTEGER) &  
                binhyp(B : INTEGER)  
        =>  
                (x: {A}\/{B} == (x = A) or (x = B))  
 
        END  
 


Let us consider then the following proof obligation:


 
    Hypotheses  
        ...  
        aa : INTEGER &  
        bb : INTEGER &  
        6 <= (xx+2)*3 &  
        yy: {aa,bb}  
        ...  
    Goal  
        xx: ENS => not((xx+yy)*2 : gg[{5}])  
 


We can rewrite the goal by using the rewritings from My_Simplifications:


 
PRV> us(My_Simplifications|_Goal)  
 


We get the new goal:


 
    Goal  
        xx: ENS => not({(xx*2 + yy*2) |-> 5} <: gg)  
 


We may want also, for instance, to apply only the first rewrite rule of My_Simplifications. We must thus provide the name of the rule we want to use. In our case, the name of the first rule of the My_Simplifications theory is My_Simplifications.1.


 
PRI> us(My_Simplifications.1)  
 


The goal becomes:


 
    Goal  
        xx: ENS => not({(xx+yy)*2 |-> 5} <: gg)  
 


We have only applied the first rule.

It is also possible to apply the simplifications on all the hypotheses.


 
PRI> us(My_Simplifications;Enum_Simp|_AllHyp)  
 


All the new hypotheses appear as antecedents of the current goal:


 
    Goal  
        6<=(xx*3 + xx*3) &  
        yy = aa or yy = bb  
        =>  
        xx: ENS => not((xx+yy)*2 : gg[{5}])  
 


To finish with, we may decide to simplify only one hypothese:


 
PRV> us(My_Simplifications|_Hyp(6<=(xx+2)*3))  
 


We then get:


 
    Goal  
        6<=(xx*3 + xx*3)  
        =>  
        xx: ENS => not((xx+yy)*2 : gg[{5}])