match_expr
alternative. Recall that it has the following structure.
| (ident "@")? ident bindeIdent* => rhs
Example:
| c@Eq _ a b => f c a b
- var? : Option Lean.Ident
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.
- pvars : List (Option Lean.Ident)
Pattern variables. The list uses
none
for representing_
, andsome a
for pattern variablea
. - rhs : Lean.Syntax
right-hand-side for the alternative.
- k : Lean.Ident
Store the auxliary continuation function for each right-hand-side.
Actual value to be passed as an argument.
Instances For
match_expr
else-alternative. Recall that it has the following structure.
| _ => rhs
- rhs : Lean.Syntax
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
- Lean.Elab.Term.MatchExpr.shouldSaveActual alts = alts.any fun (alt : Lean.Elab.Term.MatchExpr.Alt) => match alt.pvars with | some val :: tail => true | x => false
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
- Lean.Elab.Term.MatchExpr.toDoubleQuotedName ident = { raw := (Lean.mkNode `Lean.Parser.Term.doubleQuotedName #[Lean.mkAtom "`", Lean.mkAtom "`", ident.raw]).raw }
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.