       TWISTED GENERATING FUNCTIONS AND NEARBY LAGRANGIANS                     3

B(Z × BO) → B(Z × BG) induced by the J-homomorphism is nullhomo-
topic. Jin proved later in [Jin20] that the same vanishing holds without
looping. We will give an alternate proof of this improvement in Section 4.
Theorem B. Let M be a closed manifold and L a closed exact Lagrangian
submanifold of T ∗ M , then the composition L → U/O → B(Z × BG) of
the stable Gauss map with (a delooping of ) the J-homomorphism U/O =
B(Z × BO) → B(Z × BG) is nullhomotopic.
   Both of these results are proved using generating functions, a classical tool
in symplectic and contact topology, which will be the main subject of this
paper. Moreover, the only essential input from Floer theory or microlocal
sheaf theory that we use is the result that π is a homotopy equivalence.
1.2. Twisted generating functions. The relevance of generating func-
tions to the study of Lagrangians can be ﬁrst seen from the following theorem
of Giroux and Latour (Theorem 2.4): for a closed manifold L, a Legendrian
immersion L → J 1 M admits a generating function (see Deﬁnition 2.1) if and
only if the stable Gauss map L → Λ0 (C∞ ) is trivial. Let us remark that
we are not able to prove that any exact Lagrangian embedding has a gener-
ating function so we cannot use the "only if" part to prove that the stable
Gauss map is trivial. To circumvent this issue, we introduce a weaker object
that we call a twisted generating function (see Deﬁnition 2.9) and prove the
following theorem.
Theorem C. Let M and L be closed manifolds. A Legendrian immersion
L → J 1 M admits a twisted generating function if and only if the stable Gauss
map L → Λ0 (C∞ ) factors up to homotopy through π : L → M .
  Note that this condition on the stable Gauss map holds for nearby La-
grangians since we know that π is a homotopy equivalence. Our concrete
model for a twisted generating function is a (directed) open cover (Mi ) of M
and a collection of generating functions (fi ) deﬁned on open sets of Mi × Rni
which glue on double intersections up to a 1-cocycle (qij ) of ﬁberwise non-
degenerate quadratic forms, namely
                      fi ⊕ qij = fj and qij ⊕ qjk = qik .
Note that the cocycle qij is valued in the space Q of non-degenerate quadratic
forms (with eigenvalues ±1), which is only a topological monoid. The theory
of principal Q-bundles and associated bundles is not completely standard
and we develop some bits of the theory that we need in Appendix A, with
inspiration from [BDR04]. It turns out that the integers (ni ) and cocycle
(qij ) are classiﬁed by a map M → Λ0 (C∞ ), so are perfectly suited to encode
the stable Gauss map. We note also that the notion of twisted generating
function is inspired by that of twisted sheaf used by the third author in
[Gui12]. Theorem C is proved in Section 2.
   Another issue is that the generating functions produced in this way (twisted
or not) are inexploitable because they may not be well-behaved at inﬁnity.
