4.54 Try everywhere

Application of a series of commands to a group of proof obligations

Syntax

  te(f, m.n.p)
  te(f,m.n’)
  te(f,n”)
  te(f)

with:

Alias

  ta(f) is equivalent to te(f, Remplace.Gen.Unproved)

Use

This command allows the user to try to apply a demonstration to all the proof obligations of a component, while memorising only the demonstration which succeeded. The user normally prepares this series of commands when he is demonstrating one of the proof obligations. Different modes are proposed, so that the latest demonstration can fit well into the already existing demonstrations of every proof obligations.

Messages sent to the user indicate which proof obligations have changed. The command line of proof obligations which have been proved is also modified. Only the efficient commands ( those which have had an effect on the state of the proof) will be saved.

A series of commands can only include one force command. This force command can be placed anywhere, since the whole command line is carried out under constant force.

te(f) is equivalent to te(f, Replace.Loc.Unproved).

te(f,n”) is equivalent to te(f,Replace.n”.Unproved) with n” distinct from List(L) and O.I.

te(f,List(L)) is equivalent to te(f, m.List(L).All). Moreover the Unproved option is not available with List(L).

te(f,O.I) is equivalent to te(f,O[I..I]).

te(f,m.n’) is equivalent to te(f,m.n’.Unproved) with n’ distinct from List(L).

te(f,m.List(L)) is equivalent to te(f,m.List(L).All).

Example 1

Given the component containing clause Initialisation, operation Calculus and seven proof obligations, all unproved. The proof status is displayed with the gs command (see chapter 4.22 page §):


 
PRI> gs  
 


The user obtains:


 
State of all PO  
    Initialisation  
        PO1 Unproved    1: 1..10  
        PO2 Unproved    1: 1..100  
        PO3 Unproved    not(e5 = e1)  
        PO4 Unproved    e1 = e5  
    Calculus  
        PO1 Unproved    xx+yy-1: 1..100  
        PO2 Unproved    not(uu = e1)  
        PO3 Unproved    e1 = e5  
End  
 


The user tries to apply the command line dd & pr for all the component proof obligations, by replacing the existing command line by dd & pr, if the proof succeeds. The existing command line is ignored (argument Replace).


 
PRI> te((dd & pr), Replace.Gen.All)


the proof obligations Initialisation.1, Initialisation.2, Initialisation.3, Initialisation.4 and Calculus.1 are proved and saved.


 
Begin TryEveryWhere  
++++---  


Then, the result of the application of the command line is displayed.


 
Summary  
Calculus.1 :   Unproved --> Proved,   dd & pr  
Initialisation.4 :   Unproved --> Proved,   dd & pr  
Initialisation.3 :   Unproved --> Proved,   dd & pr  
Initialisation.2 :   Unproved --> Proved,   dd & pr  
Initialisation.1 :   Unproved --> Proved,   dd & pr  
End TryEveryWhere  
 


Using command gs (see chapter 4.22 page §), we can verify that 5 proof obligations have really been proved.


 
PRI> gs  
State of all PO  
    Initialisation  
        PO1 Proved    1: 1..10  
        PO2 Proved    1: 1..100  
        PO3 Proved    not(e5 = e1)  
        PO4 Proved    e1 = e5  
    Calculus  
        PO1 Proved    xx+yy-1: 1..100  
        PO2 Unproved  not(uu = e1)  
        PO3 Unproved  e1 = e5  
End  
 


Example 2

Given the component containing clause Initialisation, operation Analysis and six proof obligations, all unproved. The proof status is displayed with command gs (see chapter 4.22 page §):


 
PRI> gs  
 


We obtain:


 
State of all PO  
    Initialisation  
        PO1 Unproved    ff: INTEGER +-> BOOL  
        PO2 Unproved    ff(1) = TRUE  
        PO3 Unproved    xx: dom(ff)  
    Analysis  
        PO1 Unproved    a1: 1..10  
        PO2 Unproved    a1 = a2  
        PO3 Unproved    a2 <= 11  
End  
 


The user tries to apply the dd & pr command line to the proof obligations number 1 of Initialisation and number 2 and 3 of Analysis. He uses default options, that is to say Replace and All:


 
PRI> te((dd & pr),List(Initialisation.1 & Analysis.2 & Analysis.3))  
 
Begin TryEveryWhere  
+++  
Summary  
Initialisation.1 transformed   Unproved --> Proved,   dd & pr  
Analysis.2 transformed         Unproved --> Proved,   dd & pr  
Analysis.3 transformed         Unproved --> Proved,   dd & pr  
End TryEveryWhere  


Then the user uses the saved proof of proof obligation Analysis.2 to try it on Analysis.1:


 
PRI> te(Analysis.2,Analysis.1)  
 
Begin TryEveryWhere  
+  
Summary  
Analysis.1 transformed   Unproved --> Proved,   dd & pr  
End TryEveryWhere  
 


Afterwards, the user decides to try again the dd command followed by command pr on the unproved proof obligations of clause Initialisation:


 
PRI> te((dd & pr),Replace.Op(Initialisation).Unproved)  
 
Begin TryEveryWhere  
++  
Summary  
Initialisation.2 transformed   Unproved --> Proved,   dd & pr  
Initialisation.3 transformed   Unproved --> Proved,   dd & pr  
End TryEveryWhere  
 


We notice therefore that in our case, starting with proof obligations that were all unproved, it would have been better, for instance, to apply commands dd and pr to all the proof obligations of the Initialisation clause:


PRI> te((dd & pr),Replace.Initialisation[1..3].All)  
 
Begin TryEveryWhere  
+++  
Summary  
Initialisation.1 transformed   Unproved --> Proved,   dd & pr  
Initialisation.2 transformed   Unproved --> Proved,   dd & pr  
Initialisation.3 transformed   Unproved --> Proved,   dd & pr  
End TryEveryWhere  
 


To finish with, we could have used the previous proof commands only on the proof obligations whose goal matches the x : y formula, that is to say :


PRI> te((dd & pr),Replace.Patt(x : y).All)  
 
Begin TryEveryWhere  
+++  
Summary  
Initialisation.1 transformed   Unproved --> Proved,   dd & pr  
Initialisation.3 transformed   Unproved --> Proved,   dd & pr  
Analysis.1 transformed         Unproved --> Proved,   dd & pr  
End TryEveryWhere