@@ -430,7 +430,7 @@ where
430430 let some K ← guessBaseFieldForNormedSpace F
431431 | throwError "Couldn't find a `NormedSpace` structure on `{F}`"
432432 let tgtMod ← mkAppOptM ``modelWithCornersSelf #[K, none, F, none, none]
433- mkAppM ``ModelWithCorners.prod #[baseModel, tgtMod]
433+ mkAppM ``ModelWithCorners.prod #[baseModel, tgtMod]
434434 | _ =>
435435 throwError s! "{ e} is a TotalSpace { F} { V} , but { V} is not a pi type --- \
436436 could not infer base of the bundle"
@@ -440,18 +440,14 @@ where
440440 match_expr V with
441441 | TangentSpace _k _ _E _ _ _H _ I M _ _ => do
442442 trace[Elab.DiffGeo.MDiff] "`{ V} ` is the total space of the `TangentBundle` of `{ M} `"
443- let srcIT : Term ← Term.exprToSyntax I
444- let resTerm : Term ← ``(ModelWithCorners.tangent $srcIT)
445- Term.elabTerm resTerm none
443+ mkAppM ``ModelWithCorners.tangent #[I]
446444 | _ => throwError "`{V}` is not a `TangentSpace`"
447445 /-- Attempt to find a model on a `TangentBundle` -/
448446 fromTangentBundle : TermElabM Expr := do
449447 match_expr e with
450448 | TangentBundle _k _ _E _ _ _H _ I M _ _ => do
451449 trace[Elab.DiffGeo.MDiff] "`{ e} ` is a `TangentBundle` over model `{ I} ` on `{ M} `"
452- let srcIT : Term ← Term.exprToSyntax I
453- let resTerm : Term ← ``(ModelWithCorners.tangent $srcIT)
454- Term.elabTerm resTerm none
450+ mkAppM ``ModelWithCorners.tangent #[I]
455451 | _ => throwError "`{e}` is not a `TangentBundle`"
456452 /-- Attempt to find the trivial model on a normed space. -/
457453 fromNormedSpace : TermElabM FindModelResult := do
@@ -534,18 +530,13 @@ where
534530 -- the standard model with corners.
535531 -- Therefore, we only check definitional equality at reducible transparency.
536532 let (k, _E, _F) ← isCLMReduciblyDefeqCoefficients e
537- let eK : Term ← Term.exprToSyntax k
538- let eT : Term ← Term.exprToSyntax e
539- let iTerm : Term ← ``(𝓘($eK, $eT))
540- Term.elabTerm iTerm none
533+ mkAppOptM ``modelWithCornersSelf #[k, none, e, none, none]
541534 /-- Attempt to find a model with corners on a Euclidean space, half-space or quadrant -/
542535 fromEuclideanSpace : TermElabM Expr := do
543536 -- We don't use `match_expr` to avoid importing `EuclideanHalfSpace`.
544537 match (← instantiateMVars e).cleanupAnnotations with
545538 | mkApp2 (.const `EuclideanSpace _) k _n =>
546- let eK : Term ← Term.exprToSyntax k
547- let eT : Term ← Term.exprToSyntax e
548- Term.elabTerm (← ``(𝓘($eK, $eT))) none
539+ mkAppOptM ``modelWithCornersSelf #[k, none, e, none, none]
549540 | mkApp2 (.const `EuclideanHalfSpace _) n _ =>
550541 mkAppOptM `modelWithCornersEuclideanHalfSpace #[n, none]
551542 | mkApp (.const `EuclideanQuadrant _) n =>
@@ -606,9 +597,7 @@ where
606597 | _ => return none
607598 if let some (k, R) := searchNormedAlgebra then
608599 trace[Elab.DiffGeo.MDiff] "found a normed algebra: `{ α} ` is a normed `{ k} `-algebra"
609- let eK : Term ← Term.exprToSyntax k
610- let eR : Term ← Term.exprToSyntax R
611- Term.elabTerm (← ``(𝓘($eK, $eR))) none
600+ mkAppOptM ``modelWithCornersSelf #[k, none, R, none, none]
612601 else
613602 trace[Elab.DiffGeo.MDiff] "`{ α} ` is not a normed algebra on the nose: try via a space of \
614603 continuous linear maps"
@@ -633,9 +622,7 @@ where
633622 match normedSpace? with
634623 | some (k, _R) =>
635624 trace[Elab.DiffGeo.MDiff] "found a normed space: `{ V} ` is a normed space over `{ k} `"
636- let eK : Term ← Term.exprToSyntax k
637- let eα : Term ← Term.exprToSyntax α
638- Term.elabTerm (← ``(𝓘($eK, $eα))) none
625+ mkAppOptM ``modelWithCornersSelf #[k, none, α, none, none]
639626 | _ => throwError "Found no `NormedSpace` structure on `{V}` among local instances"
640627 else
641628 -- NB. If further instances of `NormedAlgebra` arise in practice, adding another check
@@ -724,10 +711,7 @@ where
724711 | _ => throwError "`{e}` is not a sphere in a real normed space"
725712 /-- Attempt to find a model with corners from a normed field.
726713 We attempt to find a global instance here. -/
727- fromNormedField : TermElabM Expr := do
728- let eT : Term ← Term.exprToSyntax e
729- let iTerm : Term ← ``(𝓘($eT, $eT))
730- Term.elabTerm iTerm none
714+ fromNormedField : TermElabM Expr := mkAppOptM ``modelWithCornersSelf #[e, none, e, none, none]
731715
732716/-- Try to find a `ModelWithCorners` instance on a type (represented by an expression `e`),
733717using the local context to infer the appropriate instance.
@@ -802,10 +786,7 @@ where
802786 throwError "`{e}` is a product of normed spaces, so there are two potential models with \
803787 corners\n For now, please specify the model by hand."
804788 -- Otherwise, we are not a normed space, and normally form the product model.
805- let eTerm : Term ← Term.exprToSyntax srcE
806- let fTerm : Term ← Term.exprToSyntax srcF
807- let iTerm : Term ← ``(ModelWithCorners.prod $eTerm $fTerm)
808- return some { model := ← Term.elabTerm iTerm none }
789+ return some { model := ← mkAppM ``ModelWithCorners.prod #[srcE, srcF] }
809790 | Sum E F =>
810791 trace[Elab.DiffGeo.MDiff] "Expression `{ e} ` is a direct sum of `{ E} ` and `{ F} `\n \
811792 We assume the models match, and only look into the first summand"
0 commit comments