fix: typo
This commit is contained in:
parent
95aec2cf93
commit
6e7d76f4d8
2 changed files with 6 additions and 6 deletions
|
|
@ -17,12 +17,12 @@ partial def addSmartUnfoldingDefAux (preDef : PreDefinition) (recArgPos : Nat) :
|
|||
}
|
||||
where
|
||||
/--
|
||||
Auxiliary method for annotating `match`-alternatives with `markSmartUnfoldingMatch` and `markSmartUnfoldigMatchAlt`.
|
||||
Auxiliary method for annotating `match`-alternatives with `markSmartUnfoldingMatch` and `markSmartUnfoldingMatchAlt`.
|
||||
|
||||
It uses the following approach:
|
||||
- Whenever it finds a `match` application `e` s.t. `recArgHasLooseBVarsAt preDef.declName recArgPos e`,
|
||||
it marks the `match` with `markSmartUnfoldingMatch`, and each alternative that does not contain a nested marked `match`
|
||||
is marked with `markSmartUnfoldigMatchAlt`.
|
||||
is marked with `markSmartUnfoldingMatchAlt`.
|
||||
|
||||
Recall that the condition `recArgHasLooseBVarsAt preDef.declName recArgPos e` is the one used at `mkBRecOn`.
|
||||
-/
|
||||
|
|
@ -52,7 +52,7 @@ where
|
|||
let containsSUnfoldMatch := Option.isSome <| altBody.find? fun e => smartUnfoldingMatch? e |>.isSome
|
||||
if !containsSUnfoldMatch then
|
||||
let altBody ← mkLambdaFVars xs[numParams:xs.size] altBody
|
||||
let altBody := markSmartUnfoldigMatchAlt altBody
|
||||
let altBody := markSmartUnfoldingMatchAlt altBody
|
||||
mkLambdaFVars xs[0:numParams] altBody
|
||||
else
|
||||
mkLambdaFVars xs altBody
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ def smartUnfoldingMatch? (e : Expr) : Option Expr :=
|
|||
annotation? `sunfoldMatch e
|
||||
|
||||
/-- Add auxiliary annotation to indicate expression `e` (a `match` alternative rhs) was successfully reduced by smart unfolding. -/
|
||||
def markSmartUnfoldigMatchAlt (e : Expr) : Expr :=
|
||||
def markSmartUnfoldingMatchAlt (e : Expr) : Expr :=
|
||||
mkAnnotation `sunfoldMatchAlt e
|
||||
|
||||
def smartUnfoldingMatchAlt? (e : Expr) : Option Expr :=
|
||||
|
|
@ -472,7 +472,7 @@ partial def whnfCore (e : Expr) : MetaM Expr :=
|
|||
| _ => unreachable!
|
||||
|
||||
/--
|
||||
Recall that `_sunfold` auxiliary definitions contains the markers: `markSmartUnfoldigMatch` (*) and `markSmartUnfoldigMatchAlt` (**).
|
||||
Recall that `_sunfold` auxiliary definitions contains the markers: `markSmartUnfoldingMatch` (*) and `markSmartUnfoldingMatchAlt` (**).
|
||||
For example, consider the following definition
|
||||
```
|
||||
def r (i j : Nat) : Nat :=
|
||||
|
|
@ -496,7 +496,7 @@ partial def whnfCore (e : Expr) : MetaM Expr :=
|
|||
| Nat.succ j => (**) r i j
|
||||
```
|
||||
|
||||
`match` expressions marked with `markSmartUnfoldigMatch` (*) must be reduced, otherwise the resulting term is not definitionally
|
||||
`match` expressions marked with `markSmartUnfoldingMatch` (*) must be reduced, otherwise the resulting term is not definitionally
|
||||
equal to the given expression. The recursion may be interrupted as soon as the annotation `markSmartUnfoldingAlt` (**) is reached.
|
||||
|
||||
For example, the term `r i j.succ.succ` reduces to the definitionally equal term `i + i * r i j`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue