Documentation

LeanSearchClient.Syntax

LeanSearchClient #

In this file, we provide syntax for search using the leansearch API and the Moogle API. from within Lean. It allows you to search for Lean tactics and theorems using natural language.

We provide syntax to make a query and generate TryThis options to click or use a code action to use the results.

The queries are of three forms. For leansearch these are:

The corresponding syntax for Moogle is:

In all cases results are displayed in the Lean Infoview and clicking these replaces the query text. In the cases of a query for tactics only valid tactics are displayed.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                Instances For
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      Equations
                                      Instances For
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Search LeanSearch from within Lean. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                  #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                  
                                                  example := #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                  
                                                  example : 3 ≤ 5 := by
                                                    #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                    sorry
                                                  
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For

                                                      Search Moogle from within Lean. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                      #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                      
                                                      example := #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                      
                                                      example : 3 ≤ 5 := by
                                                        #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                        sorry
                                                      
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For

                                                          Search either Moogle or LeanSearch from within Lean, depending on the option leansearchclient.backend. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                          #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                          
                                                          example := #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                          
                                                          example : 3 ≤ 5 := by
                                                            #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                            sorry
                                                          
                                                          In tactic mode, if the query string is not supplied, then [LeanStateSearch](https://premise-search.com) is queried based on the goal state.
                                                          
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For

                                                              Search LeanSearch from within Lean. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                              #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                              
                                                              example := #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                              
                                                              example : 3 ≤ 5 := by
                                                                #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                sorry
                                                              
                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For

                                                                  Search Moogle from within Lean. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                                  #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                  
                                                                  example := #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                  
                                                                  example : 3 ≤ 5 := by
                                                                    #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                    sorry
                                                                  
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For

                                                                      Search either Moogle or LeanSearch from within Lean, depending on the option leansearchclient.backend. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                                      #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                      
                                                                      example := #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                      
                                                                      example : 3 ≤ 5 := by
                                                                        #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                        sorry
                                                                      
                                                                      In tactic mode, if the query string is not supplied, then [LeanStateSearch](https://premise-search.com) is queried based on the goal state.
                                                                      
                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For

                                                                          Search LeanSearch from within Lean. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                                          #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                          
                                                                          example := #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                          
                                                                          example : 3 ≤ 5 := by
                                                                            #leansearch "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                            sorry
                                                                          
                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For
                                                                            Equations
                                                                            • One or more equations did not get rendered due to their size.
                                                                            Instances For

                                                                              Search Moogle from within Lean. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                                              #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                              
                                                                              example := #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                              
                                                                              example : 3 ≤ 5 := by
                                                                                #moogle "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                                sorry
                                                                              
                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For
                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For

                                                                                  Search LeanStateSearch from within Lean. Your current main goal is sent as query. The revision to search can be set using the statesearch.revision option. The number of results can be set using the statesearch.queries option.

                                                                                  Hint: If you want to modify the query, you need to use the web interface.

                                                                                  set_option statesearch.queries 1
                                                                                  set_option statesearch.revision "v4.16.0"
                                                                                  
                                                                                  example : 0 ≤ 1 := by
                                                                                    #statesearch
                                                                                    sorry
                                                                                  
                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For

                                                                                      Search either Moogle or LeanSearch from within Lean, depending on the option leansearchclient.backend. Queries should be a string that ends with a . or ?. This works as a command, as a term and as a tactic as in the following examples. In tactic mode, only valid tactics are displayed.

                                                                                      #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                                      
                                                                                      example := #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                                      
                                                                                      example : 3 ≤ 5 := by
                                                                                        #search "If a natural number n is less than m, then the successor of n is less than the successor of m."
                                                                                        sorry
                                                                                      
                                                                                      In tactic mode, if the query string is not supplied, then [LeanStateSearch](https://premise-search.com) is queried based on the goal state.
                                                                                      
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For
                                                                                        Equations
                                                                                        • One or more equations did not get rendered due to their size.
                                                                                        Instances For