4.45 Search hypothesis

Search hypothesis

Syntax

  sh(P,A)
  sh(P)

with:

Use

This command allows to search among the hypotheses, for the ones which satisfy certain criteria.

Argument P represents what the parts of a hypothesis must verify so that it is selected. Argument P must be a group of sub-formulae separated by the 3 special operators _and, _or, _not.

For example: if P is (var1 __and var2) __or var3, the hypotheses containing either both var1 and var2, or var3 are selected

Formulae with wildcards are accepted.

A represents what the entire hypothesis is to verify, in the same language as before.

For example, (a = b) __or (a b) selects the hypotheses which are either equalities or implications.

Beware!! Inside a __not, the use of __and and __or is not recognised. In the same way, A must not be the equivalent of a term such as ((a = b) __and (a b)), otherwise no hypothesis would be selected.

The argument A may be omitted.

If one of the elements of P is a variable, then the hypotheses that are found must contain the variable in question.

For example sh(var) selects the hypotheses containing var, but not var$i or my_var (here var is considered as a formula, and not as a string of letters).

A classical use consists in searching all the hypotheses which refer to a given variable.

Example

Given the following situation:


 
    Hypothesis  
        ENS = {e1,e2,e3,e4,e5} &  
        ENS: FIN(NATURAL*{ENS.enum}) &  
        not(ENS = {}) &  
        xx: 1..10 &  
        yy: 1..10 &  
        zz: 1..100 &  
        tt: ENS &  
        uu: ENS &  
        not(uu = tt) &  
        uu: {e1,e2,e3,e4} => tt = e5 &  
        uu = e5 => tt = e1 &  
        1<=xx &  
        xx<=10 &  
        1<=yy &  
        yy<=10 &  
        1<=zz &  
        zz<=100  
    Goal  
        not(uu = e1)  
 


We begin by searching all the hypotheses which contain the uu variable.


 
PRI> sh(uu)  
 


The result obtained is:


 
Searching all Hypothesis that:  
  contain uu  
  match with a  
Starting search...  
Found hypothesis List is  
        uu = e5 => tt = e1 &  
        uu: {e1,e2,e3,e4} => tt = e5 &  
        not(uu = tt) &  
        uu: ENS  
End of found hypothesis  
 


The message match with a is displayed because, when parameter A is omitted, the hypotheses must coincide with the wildcard a pattern.

We then search the hypotheses which refer simultaneously to uu and tt.


 
PRI> sh(uu _and tt)  
 


The result obtained is the following:


 
Searching all Hypothesis that:  
  contain uu _and tt  
  match with a  
Starting search...  
Found hypothesis List is  
        uu = e5 => tt = e1 &  
        uu: {e1,e2,e3,e4} => tt = e5 &  
        not(uu = tt)  
End of found hypothesis  
 


We now search all the hypotheses which refer to the variable uu or which contain the expression not(a) (a is a wildcard).


 
PRI> sh(uu _or not(a))  
 


The selected hypotheses are:


 
Searching all Hypothesis that:  
  contain uu _or not(a)  
  match with a  
Starting search...  
Found hypothesis List is  
        uu = e5 => tt = e1 &  
        uu: {e1,e2,e3,e4} => tt = e5 &  
        not(uu = tt) &  
        uu: ENS  
End of found hypothesis  
 


Finally, we search the hypotheses which refer to the variable uu and whose form is a : b or a = b.


 
PRI> sh(uu, (a:b _or a=b))  
 


The selected hypotheses are:


 
Searching all Hypothesis that:  
  contain uu  
  match with a: b  
Starting search...  
Found hypothesis List is  
        uu: ENS  
End of found hypothesis