HepLean Documentation

Lean.Elab.MatchExpr

match_expr alternative. Recall that it has the following structure.

| (ident "@")? ident bindeIdent* => rhs

Example:

| c@Eq _ a b => f c a b
  • some c if there is a variable binding to the function symbol being matched. c is the variable name.

  • funName : Lean.Ident

    Function being matched.

  • Pattern variables. The list uses none for representing _, and some a for pattern variable a.

  • right-hand-side for the alternative.

  • Store the auxliary continuation function for each right-hand-side.

  • actuals : List Lean.Term

    Actual value to be passed as an argument.

Instances For

    match_expr else-alternative. Recall that it has the following structure.

    | _ => rhs
    
    Instances For

      Converts syntax representing a match_expr else-alternative into an ElseAlt.

      Equations
      Instances For

        Converts syntax representing a match_expr alternative into an Alt.

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

          Returns the function names of alternatives that do not have any pattern variable left.

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

            Returns true if there is at least one alternative whose next pattern variable is not a _.

            Equations
            Instances For

              Returns the first alternative whose function name is funName and does not have pattern variables left to match.

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

                Removes alternatives that do not have any pattern variable left to be matched. For the ones that still have pattern variables, remove the first one, and save actual if the removed pattern variable is not a _.

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

                  Creates a fresh identifier for representing the continuation function used to execute the RHS of the given alternative, and stores it in the field k.

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

                    Generates parameters for the continuation function used to execute the RHS of the given alternative.

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

                      Generates the actual arguments for invoking the auxiliary continuation function associated with the given alternative. The arguments are the actuals stored in alt. discr is also an argument if alt.var? is not none.

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

                          Generates an if-then-else tree for implementing a match_expr with discriminant discr, alternatives alts, and else-alternative elseAlt.

                          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