Search Options


Contents

SEARCH OPTIONS WINDOW

SCREEN FLOW

Search Screen Flow Diagram

LOGICAL DATA FLOW

Search Logical Data Flow Diagram

SEARCH DATA

reset

SEARCH DATA OPTIONS fields:

OR

QUOTE


SEARCH CRITERIA fields:

Search-In-What

Format

Oper

Search-For-What

Or

Table: Valid Combinations of Oper, Search-In-What and Format:

FORMAT Types:

SEARCH DOMAIN fields:

From Chap/Sec and Thru Chap/Sec

About Metamath Chapters and Sections

SEARCH PREFERENCES

reset

EXCLUSION PREFERENCES

Labels

Min Times Used In Proofs

Min Hyps and Max Hyps

Max Search Results

Must Be Unifiable With Step

Use Related Chapter/Section Hierarchy
Search-Proximity Scoring


EXTENDED SEARCH PREFERENCES

Min Completed Search Results

Check First N Search Results

Max Incomplete Hyps

Max Prev Steps Checked

Reuse Derivation Steps

OUTPUT PREFERENCES

Max Elapsed Seconds

Show Unification Substitutions

Auto-Select (Update Proof Step)

Output Sort Sequence



SEARCH OPTIONS WINDOW


Here is a mock-up of the Search Options screen. Note the SEARCH DATA and SEARCH PREFERENCES  sections. Search Data must be entered befor each search -- or restored via the saved data on the PrevSearchData menu, whereas the SEARCH PREFERENCES are retained from one search to the next.

  mmj2 Search Options THEOREM XXXXXXXXXXXX LOC_AFTER XXXXXXXXXXXX STEP XXXXXX
 File  Cancel  Edit  Other  PrevSearchData  Queries  Tools  Help

 ____SEARCH_DATA____________ //reset\\    Text-Separators: OR: OR   QUOTE: "
  Search-In-What      Format        Oper   Search-For-What                 Or
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
  From Chap |.....................|+| Sec |..............................|+|
  Thru Chap |.....................|+| Sec |..............................|+|
 ____SEARCH PREFERENCES_____
//reset\\
 Exclusion: Labels: XXXXXXXXXXXXXXXXX Extended Search:
   99999 Min Times Used In Proofs     99999 Min Completed Search Results
   99999 Min Hyps                     99999 Check First N Search Results
   99999 Max Hyps                     99999 Max Incomplete Hyps
  
99999 Max Search Results           99999 Max Prev Steps Checked
      
X Must Be Unifiable With Step      X Reuse Derivation Steps
       X Use Chapter/Sec. Hierarchy        Output 
       X Search-Proximity Scoring     99999 Max Elapsed Seconds
                                         
X Show Unification Subst.
                                              X Auto-Select (Update Proof Step)
   Output Sort Seq: |.....................................................|+|
//new   \\ //refine\\ //halt  \\ //goto proof\\ //goto step\\
\\search// \\search// \\search// \\assistant // \\selector //





SCREEN FLOW


Here is how the three screens interact:


Search Screen Flow Diagram

SSS_Screen_Flow.jpg

Addition of the Search Options window is the primary enhancement we're making to the Step Selector Search.

Key points:



LOGICAL DATA FLOW

Here is how the Search Options with the Proof Worksheet and the Sorted Assertion List used by the Proof Assistant to produce Step Selector Search results.  

Search Logical Data Flow Diagram

SSS_Logical_Data_Flow_1.jpg

1. SELECT DOMAIN ASSRT: The Search Domain parameters are combined with the Proof Worksheet's theorem's location to build a list of Candidate Assertions using a Sorted Assertion List as input. The Sorted Assertion List (shown twice on the diagram) is also used in the Extended Search process and is sorted by Number of Hyps (not including VarHyps), ascending, and mObjSeq (sequence within the system, which is equivalent to order of appearance within the loaded .mm file -- which can be supplemented by the Theorem Loader feature that adds theorems after the initial load).

2. FILTER EXCLUDED ASSRT: The Exclusion Preferences are applied to the list of Candidate Assertions to generate an Assertion Search List.
Must Be Unifiable With Step is one of the (default) Exclusion Preferences. "Completed Search Results"  items have unifiable assertions whose hypotheses are fully satisfied by the Hyp field of the designated proof step (i.e. no missing Hyps) , and for these Search Result items the following occurs:
3. APPLY SEARCH CRITERIA: The Search Criteria are applied to the Assertion Search List to produce a Selected Assertion List of size not to exceed the Max Search Results option. 

Also, if
Max Search Results has not been exceeded when the Assertion Search List search is complete the remaining search results may be generated using the Search-Proximity Scoring option. If "On" it will add a non-zero score to Assertions not meeting the Search Criteria but which are in the same Section as (i.e. are near to) a selected Assertion; these Assertions will appear in the Search Results after Assertions that meet the Search Criteria.

4. FINALIZE SEARCH RESULTS: The Selected Assertion List is sorted according to the Output Sort Sequence option to generate the Search Results List.

5. EXTENDED SEARCH: If Extended Search is "On" and fewer than Min Completed Search Results have been found, the Extended Search Preferences are used to scan the Search Results List looking for assertions that are:

Unifiable but which have more hypotheses than were provided by the Hyp field of the designated proof step; and
Whose missing hypotheses can be satisfied by either
Once found these assertions are:
6. AUTO-SELECT: If Auto-Select is "On" , the first Completed Search Result in the Search Results List is passed to the Proof Assistant to update the designated proof step in the Proof Worksheet, and if necessary, to generate hypothesis proof steps.

7. STEP SELECTOR SEARCH DIALOG: Displays the Sorted Results list. The user can can select a unifiable assertion from the Search Results List to update the Proof Worksheet, or return to the Search Options window to perform a new search or refine the current search.

8. SEARCH OPTIONS:  The "Refine Search" button performs another search using new search criteria using the output Search Result List from the last search as input. Or, a New Search can be initiated, either for the designated proof step or as a unrelated (global )search. The user can also jump back to the Proof Assistant or back to the Step Selector Search dialog to re-view the most recent search results (Note: all windows can be open at the same time though only one can be active at once.)

9. PROOF ASSISTANT: A selected Search Result assertion can be used to update the designated proof step on the Proof Worksheet -- and if necessary, to generate missing hypothesis steps. Or, if no assertion was selected the Proof Worksheet is simply unified and re-displayed. New, reused and refined searches can then be initiated.



SEARCH DATA


 ____SEARCH_DATA____________ ||reset||    Text-Separators: OR: OR   QUOTE: "
  Search-In-What      Format        Oper   Search-For-What                 Or
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X
 |...............|+| |.........|+| |..|+| |XXXXXXXXXXXXXXXXXXXXXXXXXXXX|+| X



reset
The reset button resets the Search Data to the default settings.



The Search Data has three parts: Search Data Options fieldsSearch Criteria fields and the Search Domain fields.

SEARCH DATA OPTIONS fields:

OR
QUOTE



SEARCH CRITERIA fields:

Search Criteria Line Data: Search-In-What, Format, Oper, Search-For-What and Or: Up to four lines of search criteria data may be entered. By default the search criteria lines are "AND"ed together, but you can toggle-on the Or field on a line to indicate that the next line is to be "OR"ed with it.

Evaluation of the array of search criteria lines and the individual search terms in a Search-For-What field proceeds from top-to-bottom, then left-to-right.
To simplify input, the pulldown lists are linked in a hierarchy: when a Search-In-What list item is selected the contents of the Format and Oper pulldown lists are updated to reflect only the valid choices. IMPORTANT NOTE: The PrevSearchData menu lets you select any of the nine sets of Search Criteria line used in previous searches -- or a reset of the search criteria lines to the default state (empty).

Search-In-What lets you choose what part of the Metamath assertion statements to search, such as "Formulas($a$e$p)". See: Table: Valid Combinations of Oper, Search-In-What and Format.

Formatspecifies the structural view of the data applied in the search comparisons. For example, each formula is stored in mmj2 as a parse tree and as a list of non-whitespace tokens; for search purposes a character string can be constructed from a list of non-whitespace tokens with a single blank character between each token.)

Oper lets you specify relational operators for the Format types ParseExpr and ParseStmt, and boolean operators (blank or "not" ) for all other Format types. 



Table: Valid Combinations of Oper, Search-In-What and Format:
Search-In-What(Rows)/
Format(Columns)
Oper(Cells)
ParseExpr
ParseStmt
CharString
RegExpr
Formulas($a$e$p) -- Axiom,
Logical Hypothesis and Provable
Assertion Formulas
<
>
<>
==
<
>
<>
==
blank
not
blank
not
Formulas($a$p) -- Axiom and
Provable Assertion Formulas
<
>
<>
==
<
>
<>
==
blank
not
blank
not
Formulas($e) -- Logical Hypothesis
Formulas
<
>
<>
==
<
>
<>
==
blank
not
blank
not
Comments($( $)) -- Comments preceding
Axiom and Provable Assertion statements.
n/a
n/a
blank
not
blank
not
Labels($a$e$p) -- Axiom,
Logical Hypothesis and Provable
Assertion Labels
n/a
n/a
blank
not
blank
not
Labels($a$p) -- Axiom and Provable
Assertion Labels
n/a
n/a
blank
not
blank
not
Labels($e) -- Logical Hypothesis
Labels Labels
n/a
n/a
blank
not
blank
not
Labels(RPN $=) -- Lists of Labels in RPN
order comprising a Metamath proof;
n/a
n/a
blank
not
blank
not




Search-For-What is used to enter one or more search terms in a given Format.

Or Toggle-on to indicate that the next line is to be "OR"ed with the line.
 
FORMAT Types:


 ParseExpr and ParseStmt

These formats refer to the parse trees stored by mmj2 for each formula. When ParseExpr is specified a formula's parse tree is (unification) searched looking for a matching sub-tree (including the tree as a whole); these may be of any Metamath syntax Type (e.g. in set.mm, excluding the MathBoxes, the valid syntax Types are wff, set and class.) ParseStmt refers to an entire formula parse tree, and of course, when searching set.mm it must always be a "wff" (or whatever Provable Logic Statment Type is used by the .mm file.) 

Operators <=, <, >=, >, =, ==, <>, and NA may only be applied to the ParseExpr and ParseStmtFormats. They refer to the relationships between formulas as defined by the unification operation applied to an assertion's formulas' parse trees/sub-trees and the parse tree generated for the Search-For-What field (((This may seem to be a trifle complicated but the actuality is simpler than the explanation...)))

Table: ParseExpr and ParseStmt Oper Values:
Oper
Meaning (X refers to Assertion Formula)
X
Oper
Search-For-What
<=
Search-For-What is InstanceOf X
( ph -> ps )
ph
( ph -> ps )
&W1
<=
<=
<=
<=
( ps -> ch )
( ps -> ch )
&W1        
( ps -> ch )
<
Search-For-What is StrictInstanceOf X
ph
<
( ps -> ch )
>=
X is InstanceOf Search-For-What ( ph -> ps )
( ph -> ps )
( ph -> ps )
&W1
>=
>=
>=
>=
( ps -> ch )
ph         
&W1        
( ps -> ch )

>
X is StrictInstanceOf Search-For-What
( ph -> ps )
>
ch
=
X and Search-For-What are InstanceOf each other (i.e. equal, except  for variable names)
( ph -> ps )
<>
( ch -> th )
==
X is IdenticalTo Search-For-What
( ph -> ps )
==
( ph -> ps )
<>
Search-For-What is strictInstanceOf X or X is StrictInstanceOf Search-For-What ph
( ps -> ch )
<>
<>
( ps -> ch )
ph
NA
Search-For-What is N/A X ( ph -> ps )
NA
( ph <-> ps )



CharString



RegExpr




SEARCH DOMAIN fields:

  From Chap |.....................|+| Sec |..............................|+|
  Thru Chap |.....................|+| Sec |..............................|+|

From Chap/Sec and Thru Chap/Sec These pulldown lists are used to specify the start and end of the range of related Chapters and/or Sections used to restrict the search domain. The default setting is from the first Chapter/Section of the loaded Metamath file thru the Chapter/Section  of the Theorem being proved on the Proof Assistant -- though never to include the Theorem itself, or subsequent assertions; or if the Theorem is new and LOC_AFTER was used then up thru the LOC_AFTER statement but none of the subsequent assertions. The user may alter the From and Thru Chapter/Sections, but Thru must not be past the Theorem being proved. If a new From/Thru range is input then the search domain includes the From/Thru Chapters and/or Sections plus the Chapter or Section of the Theorem being proved -- this last detail allows for Mathbox users to add their theorems to the search domain along with a From/Thru range. Finally...From/Thru Sections may be left blank, in which case the granularity of the range is the Chapter level; otherwise granularity is set to the Section level.



About Metamath Chapters and Sections:

Metamath Chapters are denoted by special Comment lines like this:

$(
#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
                           Propositional calculus
#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
$)

Metamath Sections are denoted by special Comment lines like this:

$(
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        Recursively define primitive wffs for propositional calculus
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$)

mmj2 captures the Chapter/Sections by default, unless the following RunParm command is input:

BookManagerEnabled,no

mmj2 defines a Section relationship as the use by one Section of another Section's math objects -- symbols and statements. Specifically, a proof reference to an assertion (logic or syntax) defined in another Section is considered "use" of that Section. In addition, a statement's formula's use of symbols defined in another Section is considered "use" of that Section.

mmj2 Chapter relationships are computed from the Section relationships via set union operations: A Chapter is related to the set of Chapters of the Sections to which it is related.


You can see the mmj2 Chapter/Section data by inserting the following RunParm commands into your RunParms.txt file:

PrintBookManagerChapters
*PrintBookManagerSections
*PrintBookManagerSectionDetails,*

Note that mmj2 breaks down each Metamath Section into four sections: Symbols, VarHyps, Syntax and Logic. For Search Option usage we will treat all four "sub-sections" as a unit. To convert the mmj2 Section numbers into indexes we do an integer divide by 4 and discard the remainder.

Here are Chapter/Section lists from mmj2 after some text-editing to remove extraneous data:
Chapters.txt
Sections.txt


SEARCH PREFERENCES


____SEARCH PREFERENCES_____ //reset\\
 Exclusion: Labels: XXXXXXXXXXXXXXXXX Extended Search:
   99999 Min Times Used In Proofs     99999 Min Completed Search Results
   99999 Min Hyps                     99999 Check First N Search Results
   99999 Max Hyps                     99999 Max Incomplete Hyps
  
99999 Max Search Results           99999 Max Prev Steps Checked
      
X Must Be Unifiable With Step      X Reuse Derivation Steps
       X Use Chapter/Sec. Hierarchy        Output
       X Search-Proximity Scoring     99999 Max Elapsed Seconds
                                          X Show Unification Subst.
                                              X Auto-Select (Update Proof Step)
   Output Sort Seq: |.....................................................|+|


reset The reset button resets the Search Preferences to the default settings.



The Search Preferences area has three sections: Exclusion Preferences, Extended Search Preferences and Output Preferences.


EXCLUSION PREFERENCES - These are search criteria which remain in force until changed by the user. The name, "Exclusion" is somewhat of a misnomer since only Labels and Max Search Results cause exclusion of an assertion from the Search Results if satisfied; the rest cause exclusion if not satisfied; the most important characteristic to remember is that unlike the Search Data criteria, the Exclusion Preferences remain in force from one search to the next until changed or reset.

Labels
Min Times Used In Proofs
Min Hyps and MaxHyps
Max Search Results

Must Be Unifiable With Step

Use Related Chapter/Section Hierarchy Toggle On to specify that the search domain is to be restricted to a hierarchy of related Chapters and/or Sections of the input Metamath file -- plus the Chapter or Section of the Theorem being proved -- this last detail allows for Mathbox users to add their theorems to the search domain along with a From/Thru range.


Related Chapter/Section Hierarchy Diagram
SSS_Rel_Chap_Sec_1.jpg


Search-Proximity ScoringToggle-on to indicate that:


EXTENDED SEARCH PREFERENCES

Min Completed Search Results

Check First N Search Results

Max Incomplete Hyps

Max Prev Steps Checked
Reuse Derivation Steps



OUTPUT PREFERENCES

Output Sort Sequence

SORT KEY FIELDS TABLE
MObjSeq Metamath Object Sequence Number: corresponds to position within the input Metamath file. A higher number indicates a more advanced assertion which may be more desirable in a proof step.
Nbr Hyps Number of Logical Hypotheses in assertion. Fewer hypotheses tends to result in shorter proofs. Approximately 95% of set.mm assertions have two or fewer hypotheses.
Complexity
Combination of two Sort Key fields: ParseDepth and Formula Length. Combined here to simplify usage and documentation. "Complexity(D)" means ParseDepth(D) followed by FormulaLength(D).
ParseDepth = Assertion's conclusion's formula's parse tree depth. Corresponds roughly to formula complexity and hence, specificity. Because in standard practice the designated proof step has already been unified with each assertion in the Search Results List, a greater Parse Depth corresponds to a higher degree of similarity -- and hence, increased likelihood of usefulness in the designated proof step.

See mmj.lang.Stmt.getExprParseTree().getMaxDepth().
FormulaLength
= Assertion's conclusion's formula length (in tokens, not characters). Corresponds roughly to formula complexity.
Popularity = Number of times assertion used in proofs of other assertions.
Score This is a ranking number based on the search results and search preferences/criteria:
  • 000 = Assertion not selected (initial Score value)
  • 030 = Assertion excluded
  • 030 = Assertion not excluded, but also not selected
  • 040 = Assertion selected by virtue of Search-Proximity Scoring
  • 050 = Assertion satisfies search criteria, if any, but is not a Completed Search Result.
  • 100 = Assertion is a Completed Search Result: it unifies with the designated proof step and there are no missing hypotheses.

SORT SEQUENCE TABLE
SORT
ID
Default
Sort?
1
2
3
4
5
1
Yes
Score(D) Complexity(D) Popularity(D) Nbr Hyps MObjSeq(D)
2
Score(D) Popularity(D) Complexity(D) Nbr Hyps MObjSeq(D)
3
Score(D) Nbr Hyps Complexity(D) Popularity(D) MObjSeq(D)
4
Score(D) Nbr Hyps Popularity(D) Complexity(D) MObjSeq(D)
5

Score(D) Complexity(D) MObjSeq(D)

6

Score(D)
Popularity(D) MObjSeq(D)

7
Score(D) Nbr Hyps MObjSeq(D)

8
Score(D) MObjSeq(D)





Max Elapsed Seconds
Show Unification Substitutions
Auto-Select (Update Proof Step)