Return true
if e
is a lcProof
application.
Recall that we use lcProof
to erase all nested proofs.
Equations
- Lean.Compiler.LCNF.ToLCNF.isLCProof e = e.isAppOfArity `lcProof 1
Instances For
Create the temporary lcProof
Equations
- Lean.Compiler.LCNF.ToLCNF.mkLcProof p = Lean.mkApp (Lean.mkConst `lcProof) p
Instances For
Auxiliary inductive datatype for constructing LCNF Code
objects.
The toLCNF
function maintains a sequence of elements that is eventually
converted into Code
.
- jp: Lean.Compiler.LCNF.FunDecl → Lean.Compiler.LCNF.ToLCNF.Element
- fun: Lean.Compiler.LCNF.FunDecl → Lean.Compiler.LCNF.ToLCNF.Element
- let: Lean.Compiler.LCNF.LetDecl → Lean.Compiler.LCNF.ToLCNF.Element
- cases: Lean.Compiler.LCNF.Param → Lean.Compiler.LCNF.Cases → Lean.Compiler.LCNF.ToLCNF.Element
- unreach: Lean.Compiler.LCNF.Param → Lean.Compiler.LCNF.ToLCNF.Element
Instances For
Equations
- Lean.Compiler.LCNF.ToLCNF.instInhabitedElement = { default := Lean.Compiler.LCNF.ToLCNF.Element.jp default }
State for BindCasesM
monad
Mapping from _alt.<idx>
variables to new join points
Instances For
This method returns code that at each exit point of cases
, it jumps to jpDecl
.
It is similar to Code.bind
, but we add special support for inlineMatcher
.
The inlineMatcher
function inlines the auxiliary _match_<idx>
declarations.
To make sure there is no code duplication, inlineMatcher
creates auxiliary declarations _alt.<idx>
.
We can say the _alt.<idx>
declarations are pre join points. For each auxiliary declaration used at
an exit point of cases
, this method creates an new auxiliary join point that invokes _alt.<idx>
,
and then jumps to jpDecl
. The goal is to make sure the auxiliary join point is the only occurrence
of _alt.<idx>
, then simp
will inline it.
That is, our goal is to try to promote the pre join points _alt.<idx>
into a proper join point.
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
- Lean.Compiler.LCNF.ToLCNF.seqToCode seq k = Lean.Compiler.LCNF.ToLCNF.seqToCode.go seq seq.size k
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
- lctx : Lean.LocalContext
Local context containing the original Lean types (not LCNF ones).
Cache from Lean regular expression to LCNF argument.
- typeCache : Std.HashMap Lean.Expr Lean.Expr
toLCNFType
cache - isTypeFormerTypeCache : Std.HashMap Lean.Expr Bool
isTypeFormerType cache
LCNF sequence, we chain it to create a LCNF
Code
object.- toAny : Lean.FVarIdSet
Fields that are type formers must be replaced with
◾
in the resulting code. Otherwise, we have data occurring in types. When converting acasesOn
into LCNF, we add constructor fields that are types and type formers into this set. SeevisitCases
.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add LCNF element to the current sequence
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
- Lean.Compiler.LCNF.ToLCNF.letValueToArg e prefixName = do let __do_lift ← Lean.Compiler.LCNF.ToLCNF.mkAuxLetDecl e prefixName pure (Lean.Compiler.LCNF.Arg.fvar __do_lift)
Instances For
Create Code
that executes the current seq
and then returns result
Equations
- One or more equations did not get rendered due to their size.
- Lean.Compiler.LCNF.ToLCNF.toCode (Lean.Compiler.LCNF.Arg.fvar fvarId) = do let __do_lift ← get liftM (Lean.Compiler.LCNF.ToLCNF.seqToCode __do_lift.seq (Lean.Compiler.LCNF.Code.return fvarId))
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
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
Create a new local declaration using a Lean regular type.
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.
- Lean.Compiler.LCNF.ToLCNF.visitLambda.go e xs ps = pure (ps, e.instantiateRev xs)
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Eta-expand with n
lambdas.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Eta reduce implicits. We use this function to eliminate introduced by the implicit lambda feature,
where it generates terms such as fun {α} => ReaderT.pure
Equations
Instances For
Put the given expression in LCNF
.
- Nested proofs are replaced with
lcProof
-applications. - Eta-expand applications of declarations that satisfy
shouldEtaExpand
. - Put computationally relevant expressions in A-normal form.
Equations
- Lean.Compiler.LCNF.toLCNF e = Lean.Compiler.LCNF.ToLCNF.run do let __do_lift ← Lean.Compiler.LCNF.ToLCNF.toLCNF.visit e Lean.Compiler.LCNF.ToLCNF.toCode __do_lift
Instances For
Giving f
a constant .const declName us
, convert args
into args'
, and return .const declName us args'
Eta expand if under applied, otherwise apply k
If args.size == arity
, then just return app
.
Otherwise return
let k := app
k args[arity:]
Visit a matcher
/casesOn
alternative.