∀ {m : Type → Type} [inst : Monad m] [inst_1 : Lean.MonadQuotation m] (xs : Lean.TSyntaxArray `term) (i : ℕ),
  IntermediateField.mkInsertTerm.run✝ xs i =
    if h : i + 1 = Array.size xs then do
      let info ← Lean.MonadRef.mkInfoFromRefPos
      let scp ← Lean.getCurrMacroScope
      let quotCtx ← Lean.MonadQuotation.getContext
      pure
          {
            raw :=
              Lean.Syntax.node2 info `Lean.Parser.Term.app
                (Lean.Syntax.ident info "singleton".toRawSubstring' (Lean.addMacroScope quotCtx `singleton scp)
                  [Lean.Syntax.Preresolved.decl `Singleton.singleton []])
                (Lean.Syntax.node1 info `null xs[i].raw) }
    else
      if h : i < Array.size xs then do
        let __do_lift ← IntermediateField.mkInsertTerm.run✝¹ xs (i + 1)
        let info ← Lean.MonadRef.mkInfoFromRefPos
        let scp ← Lean.getCurrMacroScope
        let quotCtx ← Lean.MonadQuotation.getContext
        pure
            {
              raw :=
                Lean.Syntax.node2 info `Lean.Parser.Term.app
                  (Lean.Syntax.ident info "insert".toRawSubstring' (Lean.addMacroScope quotCtx `insert scp)
                    [Lean.Syntax.Preresolved.decl `Insert.insert []])
                  (Lean.Syntax.node2 info `null xs[i].raw __do_lift.raw) }
      else do
        let info ← Lean.MonadRef.mkInfoFromRefPos
        let scp ← Lean.getCurrMacroScope
        let quotCtx ← Lean.MonadQuotation.getContext
        pure
            {
              raw :=
                Lean.Syntax.ident info "EmptyCollection.emptyCollection".toRawSubstring'
                  (Lean.addMacroScope quotCtx `EmptyCollection.emptyCollection scp)
                  [Lean.Syntax.Preresolved.decl `EmptyCollection.emptyCollection []] }