Documentation

Mathlib.Tactic.CrossRefAttribute

Cross-reference attributes #

This file provides attributes for tagging Mathlib results with cross-references to entries in external mathematical databases:

Each attribute records the cross-reference in an environment extension and appends a link to the declaration's docstring.

The shared infrastructure (Database, Tag, tagExt, addCrossRefDoc, traceCrossRefs) is database-agnostic; per-database code defines a parser, the attribute syntax, and the trace command.

The supported external databases

Instances For

    The base URL for an external database's tag pages. Always ends with /.

    Equations
    Instances For

      A cross-reference from a Mathlib declaration to an entry in an external database.

      • declName : Lean.Name

        The name of the declaration carrying the cross-reference.

      • database : Database

        The external database the entry belongs to.

      • tag : String

        The database identifier.

      • comment : String

        An optional comment supplied with the attribute.

      Instances For
        Equations
        Instances For
          Equations
          Instances For

            The environment extension storing all cross-references. addImportedFn is a constant function to avoid a performance overhead during initialization.

            def Mathlib.CrossRef.addTagEntry {m : TypeType} [Lean.MonadEnv m] (declName : Lean.Name) (db : Database) (tag comment : String) :

            addTagEntry declName db tag comment records a cross-reference for declName in tagExt.

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

              Append a cross-reference link to the docstring of decl and record it in tagExt. This is the database-agnostic core of every cross-reference attribute's add handler.

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

                Stacks (and Kerodon) parser #

                @[reducible, inline]

                stacksTag is the node kind of Stacks Project Tags: a sequence of digits and uppercase letters.

                Equations
                Instances For

                  The main parser for Stacks Project Tags: it accepts any sequence of 4 digits or uppercase letters.

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

                    The main parser for Stacks Project Tags: it accepts any sequence of 4 digits or uppercase letters.

                    Equations
                    Instances For

                      The main parser for Stacks Project Tags: it accepts any sequence of 4 digits or uppercase letters.

                      Equations
                      Instances For

                        Wikidata parser #

                        @[reducible, inline]

                        wikidataId is the node kind of Wikidata identifiers: the letter Q followed by digits.

                        Equations
                        Instances For

                          The main parser for Wikidata identifiers: it accepts Q followed by one or more digits.

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

                            The main parser for Wikidata identifiers: it accepts Q followed by one or more digits.

                            Equations
                            Instances For

                              LMFDB parser #

                              @[reducible, inline]

                              lmfdbId is the node kind of LMFDB identifiers: lower case words with . in between. The words can also contain underscores and digits.

                              Equations
                              Instances For

                                The main parser for LMFDB identifiers: it accepts lower case words with . in between. The words can also contain underscores and digits.

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

                                  The main parser for LMFDB identifiers: it accepts lower case words with . in between. The words can also contain underscores and digits.

                                  Equations
                                  Instances For

                                    The main parser for LMFDB identifiers: it accepts lower case words with . in between. The words can also contain underscores and digits.

                                    Equations
                                    Instances For

                                      DLMF parser #

                                      @[reducible, inline]

                                      dlmfId is the node kind of DLMF references: generally <chapter_no>.<section_no>.E<equation_no> (e.g. 5.4.E1). See https://dlmf.nist.gov/help/cite for more details on the permalink format. Note that while underscores are not mentioned in the DLMF permalink table, they are supported and present in some actual links for equations.

                                      Equations
                                      Instances For

                                        The main parser for DLMF references: generally <chapter_no>.<section_no>.E<equation_no> (e.g. 5.4.E1). See https://dlmf.nist.gov/help/cite for more details on the permalink format. Note that while underscores are not mentioned in the DLMF permalink table, they are supported and present in some actual links for equations.

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

                                          The main parser for DLMF references: generally <chapter_no>.<section_no>.E<equation_no> (e.g. 5.4.E1). See https://dlmf.nist.gov/help/cite for more details on the permalink format. Note that while underscores are not mentioned in the DLMF permalink table, they are supported and present in some actual links for equations.

                                          Equations
                                          Instances For

                                            The main parser for DLMF references: generally <chapter_no>.<section_no>.E<equation_no> (e.g. 5.4.E1). See https://dlmf.nist.gov/help/cite for more details on the permalink format. Note that while underscores are not mentioned in the DLMF permalink table, they are supported and present in some actual links for equations.

                                            Equations
                                            Instances For

                                              Extract the underlying tag as a string from a stacksTag node.

                                              Equations
                                              Instances For

                                                Extract the underlying identifier as a string from a wikidataId node.

                                                Equations
                                                Instances For

                                                  Extract the underlying identifier as a string from a lmfdbId node.

                                                  Equations
                                                  Instances For

                                                    Extract the underlying identifier as a string from a dlmfId node.

                                                    Equations
                                                    Instances For

                                                      Stacks / Kerodon attribute #

                                                      The syntax category for the database name.

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

                                                          The syntax for a "kerodon" database identifier in a @[kerodon] attribute.

                                                          Equations
                                                          Instances For

                                                            The syntax for a "stacks" database identifier in a @[stacks] attribute.

                                                            Equations
                                                            Instances For

                                                              The stacksTag attribute. Use it as @[kerodon TAG "Optional comment"] or @[stacks TAG "Optional comment"] depending on the database you are referencing.

                                                              The TAG is mandatory and should be a sequence of 4 digits or uppercase letters.

                                                              See the Tags page in the Stacks project or Tags page in the Kerodon project for more details.

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

                                                                Wikidata attribute #

                                                                The wikidata attribute. Use it as @[wikidata Q12345 "Optional comment"] to associate a Mathlib declaration with the corresponding Wikidata item.

                                                                The identifier must be the letter Q followed by one or more digits.

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

                                                                  LMFDB attribute #

                                                                  The lmfdb attribute. Use it as @[lmfdb foo.bar "Optional comment"] to associate a Mathlib declaration with the corresponding LMFDB item.

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

                                                                    DLMF attribute #

                                                                    The dlmf attribute. Use it as @[dlmf 5.4.E1 "Optional comment"] to associate a Mathlib declaration with the corresponding DLMF item.

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

                                                                      traceCrossRefs db verbose prints the cross-references of database db and inlines the declaration types if verbose is true.

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

                                                                        #stacks_tags retrieves all declarations that have the stacks attribute.

                                                                        For each found declaration, it prints a line

                                                                        'declaration_name' corresponds to tag 'declaration_tag'.
                                                                        

                                                                        The variant #stacks_tags! also adds the theorem statement (for theorems) or declaration type (for definitions, structures, instances, etc.) after each summary line.

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

                                                                          The #kerodon_tags command retrieves all declarations that have the kerodon attribute.

                                                                          For each found declaration, it prints a line

                                                                          'declaration_name' corresponds to tag 'declaration_tag'.
                                                                          

                                                                          The variant #kerodon_tags! also adds the theorem statement (for theorems) or declaration type (for definitions, structures, instances, etc.) after each summary line.

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

                                                                            The #wikidata_tags command retrieves all declarations that have the wikidata attribute.

                                                                            For each found declaration, it prints a line

                                                                            'declaration_name' corresponds to tag 'declaration_tag'.
                                                                            

                                                                            The variant #wikidata_tags! also adds the theorem statement (for theorems) or declaration type (for definitions, structures, instances, etc.) after each summary line.

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

                                                                              The #lmfdb_tags command retrieves all declarations that have the lmfdb attribute.

                                                                              For each found declaration, it prints a line

                                                                              'declaration_name' corresponds to tag 'declaration_tag'.
                                                                              

                                                                              The variant #lmfdb_tags! also adds the theorem statement (for theorems) or declaration type (for definitions, structures, instances, etc.) after each summary line.

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

                                                                                The #dlmf_tags command retrieves all declarations that have the dlmf attribute.

                                                                                For each found declaration, it prints a line

                                                                                'declaration_name' corresponds to tag 'declaration_tag'.
                                                                                

                                                                                The variant #dlmf_tags! also adds the theorem statement (for theorems) or declaration type (for definitions, structures, instances, etc.) after each summary line.

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