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.

A topic identifying a π-Base project.

Instances For

    The string such that https://{topic.urlSubdomain}.pi-base.org is the base URL of the π-Base project identified by this topic.

    Equations
    Instances For

      The display label used in docstring links and trace output. Used in Database.label.

      Equations
      Instances For

        A lowercase short name for the given database. Used in Database.shortName. Useful when exporting to JSON.

        Equations
        Instances For

          The supported external databases

          Instances For
            Equations
            Instances For

              The URL for an external database entry, where id is the identifier recorded in Tag.tag.

              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

                                                π-Base parser #

                                                @[reducible, inline]

                                                pibaseId is the node kind of π-Base identifiers: one of the letters P, S, or T, followed by exactly six digits.

                                                Equations
                                                Instances For

                                                  The main parser for π-Base identifiers: it accepts canonical property, space, and theorem identifiers, such as P000001, S000023, and T000010.

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

                                                    The main parser for π-Base identifiers: it accepts canonical property, space, and theorem identifiers, such as P000001, S000023, and T000010.

                                                    Equations
                                                    Instances For

                                                      The main parser for π-Base identifiers: it accepts canonical property, space, and theorem identifiers, such as P000001, S000023, and T000010.

                                                      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 pibaseId 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

                                                                                        π-Base attribute #

                                                                                        The topic identifying a π-Base database. Possible values:

                                                                                        This list will be expanded in the future.

                                                                                        Equations
                                                                                        Instances For
                                                                                          def Mathlib.CrossRef.getPiBaseTopic? :
                                                                                          Lean.TSyntax `Mathlib.CrossRef.pibaseTopicOption PiBaseTopic

                                                                                          Get the PiBaseTopic from a syntax key.

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

                                                                                            The pibase attribute. Use it as @[pibase <topic> P000001 "Optional comment"] to associate a Mathlib declaration with the corresponding π-Base property, space, or theorem.

                                                                                            Each <topic> identifies a different π-Base database. The possible values of <topic> are:

                                                                                            This list will be expanded in the future.

                                                                                            The identifier must start with P, S, or T, followed by exactly six digits.

                                                                                            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 #pibase_tags topic command retrieves all declarations that have the pibase attribute with the given topic.

                                                                                                          For each found declaration, it prints a line

                                                                                                          'declaration_name' corresponds to tag 'declaration_tag'.
                                                                                                          

                                                                                                          The variant #pibase_tags! topic 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