Skip to content

Commit

Permalink
fix monomorphization issue
Browse files Browse the repository at this point in the history
  • Loading branch information
PratherConid committed May 18, 2024
1 parent c2a2c0a commit dbf2ad7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Auto/Translation/Monomorphization.lean
Original file line number Diff line number Diff line change
Expand Up @@ -912,9 +912,6 @@ where
let (uvalids, s) ← (fvarRepMFactAction lis).run { ciMap := monoSt.ciMap }
for ⟨proof, ty, _⟩ in uvalids do
trace[auto.mono.printResult] "Monomorphized :: {proof} : {ty}"
let exlis := s.exprMap.toList.map (fun (e, id) => (id, e))
let cilis ← s.ciIdMap.toList.mapM (fun (ci, id) => do return (id, ← MetaState.runMetaM ci.toExpr))
let polyVal := HashMap.ofList (exlis ++ cilis)
let tyCans := s.tyCanMap.toArray.map Prod.snd
-- Inhabited types
let startTime ← IO.monoMsNow
Expand All @@ -929,6 +926,9 @@ where
let startTime ← IO.monoMsNow
trace[auto.mono] "Monomorphization of inductive types took {(← IO.monoMsNow) - startTime}ms"
let (inductiveVals, s) ← (fvarRepMInductAction inductiveVals).run s
let exlis := s.exprMap.toList.map (fun (e, id) => (id, e))
let cilis ← s.ciIdMap.toList.mapM (fun (ci, id) => do return (id, ← MetaState.runMetaM ci.toExpr))
let polyVal := HashMap.ofList (exlis ++ cilis)
return (s.ffvars, Reif.State.mk uvalids polyVal s.tyCanMap inhs inductiveVals none)
fvarRepMFactAction (lis : Array LemmaInst) : FVarRep.FVarRepM (Array UMonoFact) := lis.filterMapM (fun li => do
let liTypeRep? ← FVarRep.replacePolyWithFVar li.type
Expand All @@ -948,7 +948,7 @@ where
let projs ← projs.mapM (fun arr => arr.mapM (fun e => do
match ← FVarRep.replacePolyWithFVar e with
| .inl e => return e
-- If monomorphization fails on one constructor, then fail immediately
-- If monomorphization fails on one projection, then fail immediately
| .inr m => throwError m))
return ⟨name, type, ctors, projs⟩))
ignoreNonQuasiHigherOrder : CoreM Bool := do
Expand Down
2 changes: 1 addition & 1 deletion Auto/Translation/ReifM.lean
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abbrev ReifM := StateT State MetaM

/--
Given an expression `e`, if it's a `fvar` and is in `polyVal`,
return its value recorded in `polyVal`. Otherwise return `e`
return its value recorded in `exprFVarVal`. Otherwise return `e`
-/
@[inline] def resolveVal (e : Expr) : ReifM Expr :=
match e with
Expand Down

0 comments on commit dbf2ad7

Please sign in to comment.