{'fraction_non_alphanumeric': 0.06966939388879613, 'fraction_numerical': 0.015653698447153114, 'mean_word_length': 3.555766853665494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Sums of residues on algebraic surfaces and application to coding theory

In this paper, we study residues of differential 2-forms on a smooth algebraic surface over an arbitrary field and give several statements about sums of residues. Afterwards, using these results we construct algebraic-geometric codes which are an extension to surfaces of the well-known differential codes on curves. We also study some properties of these codes and extend to them some known properties for codes on curves.


Introduction
The present paper is divided in two parts. The first one is a theoretical study of residues of differential 2-forms on algebraic surfaces over an arbitrary field. The second one uses results of the first part to construct differential codes on algebraic surfaces and to study some of their properties. The reader especially interested in coding theory is encouraged to read briefly the definitions and the results of the first part and then to jump to the second part.
About residues. If the notion of residue is well-known for differential forms on curves, there is no unified definition in higher dimension. On complex varieties, one can distinguish two objects called residues in the literature. The first one appears for instance in Griffiths and Harris [12] chapter V. In this book, given an n-dimensional variety X, the residue of a meromorphic n-form ω at a point P is a complex number obtained by computing an integral on a real n-cycle. This object depends on some n-uplet of divisors whose sum contains the poles of ω in a neighborhood of P . Another definition is given in Compact complex surfaces by Barth, Hulek, Peters and Van De Ven ( [2] II.4). In this book, given an ndimensional variety X and a one-codimensional subvariety Y of X, the residue along Y of a q-form on X having a simple pole along Y is a (q − 1)-form on Y . The computation of this residue can be obtained by a combinatorial way, or by computing an integral on a real subvariety ( [2] II.4).
In algebraic geometry over an arbitrary field, several references deal with residues, for instance Hartshorne [14] or Lipman [19]. Actually their main objective is to establish duality theorems generalizing Serre's one. Thus, their first intention is not to define residues of differential forms on higher-dimensional varieties over an arbitrary field.
The goal of the first part of this paper is to generalize to surfaces over an arbitrary field, the definitions of residues given for complex varieties in [2] and in [12]. Then, we will establish results of independence on the choice of local coordinates, and focus on summation properties. Notice that Hartshorne, in [14] III.9, introduces a Grothendieck residue symbol having slightly the same properties as the Notice that almost all the references cited below, deal with the question of bounding or evaluating the parameters of some error-correcting codes. This will not be the purpose of the present paper whose objective is to give general theoretical statements extending some known results for codes on curves.
Different construction of codes on curves. In the theory of algebraic-geometric codes on curves, one can distinguish two different constructions. Functional codes are obtained by evaluating elements of a Riemann-Roch space at some set of rational points on a curve. Differential codes are obtained by evaluating residues of some rational differential forms at these points. For higher-dimensional varieties, only the functional construction has been extended and studied (see references below). The differential one does not seem to have a natural generalization and this question has never been treated before.
Motivations. There are at least three motivations for an extension to surfaces of the differential construction. The first one is historical. Indeed, the first construction of algebraic-geometric codes given by Goppa in [11] used differentials. This construction generalized that of classical Goppa codes which can be regarded as differential codes on the projective line. The second one is that the orthogonal of a functional code on a curve is a differential one. Moreover, this statement is used in almost all known algebraic decoding algorithms (see [17]). The third motivation is that, as said before, it is always interesting to have a geometric realization of a code. To finish with motivations, notice that the introduction of the above cited survey paper [20] of Little contains the following sentences.
"In a sense, the first major difference between higher dimensional varieties and curves is that points on X of dimension ≥ 2 are subvarieties of codimension ≥ 2, not divisors. This means that many familiar tools used for Goppa codes (e.g. Riemann-Roch theorems, the theory of differentials and residues etc.) do not apply exactly in the same way." Thus, finding another way of applying residues and differentials for codes on surfaces must be interesting. This is the purpose of the second part of this paper, which starts with the presentation of a construction of codes using residues of differential 2-forms on surfaces. Then, connections between these codes and the functional ones are studied. We proves that any differential code is included in the orthogonal of a functional one but that the reverse inclusion is false, which is an important difference with the theory of codes on curves. Notice that Voloch and Zarzar suggested the existence of such a difference in [32] section 3 without proving it. Finally, we prove that, as for codes on curves, a differential code can always be regarded as a functional one associated with some parameters depending on a canonical divisor.
Contents. The first part contains sections 1 to 6. In section 1, we recall the definition of one-codimensional residues along a curve C of a differential 2-form ω having C as a simple pole. Then, we define naturally the two-codimensional residue of ω along C at a smooth point P ∈ C to be the residue at P of the one-codimensional residue. In section 2, we study Laurent series expansions in two variables, in order to have a combinatorial definition for residues, which will be more convenient for computations. In section 3, we introduce new definitions of one-and two-codimensional residues holding for any rational 2-form. Then, we prove that the two-codimensional residue at a point P along a curve C ∋ P of a rational 2-form does not depend on the choice of local coordinates. In section 4, we study some properties of one-and two-codimensional residues. In section 5, we define two-codimensional residues along a curve at a singular point of it. Finally, section 6 contains three statements about summations of residues.
The second part contains sections 7 to 10. Section 7 is a quick review on the theory of codes on curves. In section 8, after a brief overview on functional codes on higher-dimensional varieties, we define differential codes on surfaces. Then, properties of these codes and their relations with functional ones are studied in section 9. Particularly, we prove that a differential code is contained in the orthogonal of a functional one. Finally, section 10 proves that the reverse inclusion may be false by treating the elementary example of the surface P 1 × P 1 .
Part 1. Residues of a rational 2-form on a smooth surface

Notations
For any irreducible variety X over a field k, we denote by k(X) its function field. If Y is a closed irreducible subvariety of X, then the local ring (resp. its maximal ideal) of regular functions in a neighborhood of Y , that is functions which are regular in at least one point of Y , is denoted by O X,Y (resp. m X,Y ). The m X,Y -adic completion of the ring O X,Y is denoted by O X,Y and its maximal ideal m X,Y O X,Y by m X,Y . For any function u ∈ O X,Y , we denote byū its restriction to Y . Recall that, if Y has codimension one in X and is not contained in the singular locus of X, then O X,Y is a discrete valuation ring with residue field k(Y ). In this situation, the valuation along Y is denoted by val Y . Finally, we denote by Ω i k(X)/k the space of k-rational differential i-forms on X.

One and two-codimensional residues
Context. In this section, k denotes an arbitrary field of arbitrary characteristic and S a smooth geometrically integral quasi-projective surface over k. Moreover, C denotes an irreducible geometrically reduced curve embedded in S and P a smooth rational point of C.
1.1. First definitions for residues. Given a 2-form ω ∈ Ω 2 k(S)/k , one can construct two objects called residues in the literature. The first one is a rational 1-form on a curve embedded in S and the second one is an element of k (or of some finite extension of it). Their definitions will be the respective purposes of definitions 1.3 and 1.4. We first need next proposition, asserting the welldefinition of one-condimensional residues (definition 1.3). Proposition 1.1. Let v be a uniformizing parameter of O S,C and ω be a rational 2-form on S having m S,C -valuation greater than or equal to −1. Then, there exists η 1 ∈ Ω 1 k(S)/k and η 2 ∈ Ω 2 k(S)/k , both regular in a neighborhood of C and such that Moreover, the differential form η 1|C ∈ Ω 1 k(C)/k is unique and depends neither on the choice of v nor on that of the decomposition (1).
Proof. We first prove the existence of a decomposition (1). Recall that (2) dim k(S) Ω 1 k(S)/k = 2 and dim k(S) Ω 2 k(S)/k = 1, (see [25] thm III. 5.4.3). Consequently, there exists a rational 1-form µ, which is non-k(S)-colinear with dv v . Thus, µ ∧ dv v = 0. From (2), there exists also a unique function f ∈ k(S) satisfying Since val C (ω) ≥ −1, the 1-form f µ has no pole along C. We obtain a decomposition (1) by setting η 1 := f µ and η 2 := 0. Obviously, this decomposition is far from being unique. Only η 1|C is unique. To prove uniqueness and independence of η 1|C under the choice of v, see [2] II.4. Even if this book only deals with complex surfaces, the very same proof holds for surfaces over an arbitrary field.  (1) for ω, the 1-form η 1|C ∈ Ω 1 k(C)/k is called the onecodimensional residue (or the 1-residue) of ω along C and denoted by res 1 C (ω) := η 1|C . Definition 1.4. Under the assumptions of proposition 1.1, let P be a k-rational point of C. The two-codimensional residue (or the 2-residue) of ω at P along C is the residue at P of the 1-residue of ω along C. That is res 2 C,P (ω) := res P (res 1 C,P (ω)). Notice that to define residues in this way, ω needs to have valuation greater than or equal to −1 along C. However, two-codimensional residues can actually be defined for any rational differential form even if it has a multiple pole along C. This will be the purpose of sections 2 to 4. Remark 1.5. It would have been natural to define 2-residues at a closed point P of C. Nevertheless, we decided to keep a more geometric point of view, even if the base field is not supposed to be algebraically closed. Notice that any geometric point of S (i.e. a closed point of S × kk ) is a rational point of S × k L for a suitable finite scalar extension L/k. Consequently, if we define residues at rational points of S, it is easy to extend this definition to geometric points using such a scalar extension. The only arithmetic statement we will need in the second part of the present paper is that, if C is defined over k and P ∈ C(k), then the 2-residue along C at P of a k-rational 2-form is in k. That is why we keep considering non-algebraically closed fields in sections 1 to 3 and 5. However, in sections 4 and 6, when we deal with properties of residues and particularly with summations of them, we work over an algebraically closed field.

Laurent series in two variables
As is well-known, the residue at a point P on a curve C of a 1-form can be computed using Laurent series expansions. The residue of a differential form at a point P is the coefficient of degree −1 of its Laurent series expansion. We look for a similar definition in the two-dimensional case. For this purpose, we introduce Laurent series in two variables.
Context. The context of this section is exactly that of section 1 (see page 4).
2.1. Laurent series expansion, the first construction. Recall that, C is assumed to be a geometrically reduced irreducible curve over k embedded in S and P a smooth rational point of C.
S,P is said to be a strong (P, C)-pair if the following conditions are satisfied.
(1) (u, v) is a system of local parameters at P .
(2) v is a uniformizing parameter of O S,C .
Proof. We will prove the existence of φ 0 : O S,C ֒→ k((u)) [[v]] entailing that of φ, thanks to the universal property of fraction fields. From [25] II.2, any element of O S,P has a unique Taylor series expansion in the variables u, v. Then, notice that O S,C and O S,P (v) are isomorphic and consider the following diagram.
The horizontal arrows in the left hand square correspond to localizations, the ones in the right hand square correspond to (v)-adic completions. Vertical arrows are obtained by applying respectively universal properties of localization and completion. We now have to prove that which is a consequence of Cohen's structure theorem (see [9] thm 7.7 or [5] thm 9 for an historical reference).

2.2.
Laurent series, the second construction. Let (u, v) be a strong (P, C)pair. Cohen's structure theorem asserts that O S,C is isomorphic to k(C) [[v]]. Unfortunately, this isomorphism is not always unique. Indeed, [5] thm 10(c) asserts that, if Char(k) > 0, then there are infinitely many subfields of O S,C which are isomorphic to the residue field k(C). Therefore, to use this isomorphism for Laurent series expansions, we have to choose a representant of k(C) which is, in some sense, related to u.
Proposition 2.3 (The field K u ). Let u ∈ O S,C whose restrictionū to C is a separating element (see [28] p. 127 for a definition) of k(C)/k. Then, there exists a unique subfield K u ⊂ O S,C containing k(u) and isomorphic to k(C) under the morphism O S,C → O S,C / m S,C . Furthermore, this field is generated over k(u) by an element y ∈ O S,C .
Proof. The extension k(C)/k(ū) is finite and separable. Thus, from the primitive element theorem, there exists a functionȳ ∈ k(C) generating k(C) over k(ū). From Hensel's lemma,ȳ lifts to an element y ∈ O S,C and the subring K u := k(u)[y] ⊂ O S,C is the expected copy of k(C). The uniqueness of K u is a consequence of the uniqueness of the Hensel Lift y ofȳ.

Proof.
Existence. Let f be an element of O S,C and f 0 be the Hensel-lift in K u of f mod m S,C . The m S,C -adic valuation of f − f 0 is greater than or equal to one. By induction, using the same reasoning on v −1 (f − f 0 ), we obtain an ]. Let j 0 be the smallest integer such that f j 0 = f j 0 . From proposition 2.3, a nonzero element of K u ⊂ O S,C has m S,C -adic valuation zero. Consequently, 0 has m S,C -adic valuation j 0 which is absurd.
The second Laurent series expansion using Cohen's structure theorem needs weaker conditions on the pair (u, v). Thus, before we define it, we give a new definition.
S,C is said to be a weak (P, C)-pair ifū is a uniformizing parameter of O C,P and v is a uniformizing parameter of O S,C . Remark 2.6. Obviously, a strong (P, C)-pair is weak, but the converse statement is false (see next example).
Example 2.7. Assume that S is the affine plane over C, the curve C is the line of equation y = 0 and P is the origin. Set u := (x+y)(x−y) x and v := xy. Then, (u, v) is a weak (P, C)-pair which is not strong. Now, we can define the second way of Laurent series expansion.
Proof. As in the proof of lemma 2.2, we just have to prove the existence of a morphism ϕ 0 : O S,C ֒→ k((u)) [[v]]. The curve C is assumed to be geometrically reduced, thus from [21] prop II.4.4 (i), the extension k(C)/k is separable, hence has a separable transcendence basis. Moreover, the functionū is a uniformizing parameter of O C,P , thus its differential dū is nonzero and, from [3] thm V.16.7.5, it is a separating element of k(C)/k. From proposition 2.3, there is an injection O S,C ֒→ K u [[v]]. Furthermore, there is a natural extension K u ֒→ k((u)), coming from the (ū)-adic completion of k(C) ∼ = K u . Applying this extension coefficientwise on K u [[v]], we obtain the morphism ϕ 0 .
Next proposition links both Laurent series expansions.
Maps γ and δ correspond respectively to the first and the second expansion. We have to prove that φ 0 = ϕ 0 , which is equivalent with γ = δ.
Recall that, from proposition 2.3, the field K u is generated over k(u) by an element y ∈ O S,C . Thus, a local morphism ] is entirely determined by the images of u, v and y. Obviously, δ sends u and v respectively on themselves and from the commutativity of the left part of the diagram, so does γ. The only nonobvious part is to prove that γ sends y on ψ(u), where ψ(ū) is the (ū)-adic expansion ofȳ.
Let F ∈ k(ū)[T ] be the minimal polynomial ofȳ over k(ū). The formal function y is the unique root of F in O S,C whose class in the residue field k(C) isȳ. Therefore, the morphism γ must send y on the unique root of [T ] whose class in the residue field k((u)) equals ψ(u), such a root is unique. Thus, γ(y) = ψ(u).

Change of coordinates.
In this subsection, we define 1-and 2-residues of any differential 2-form ω using weak (P, C)-pairs. These definitions hold even if C is a multiple pole of ω. Afterwards, we prove that the new definition of 2-residue does not depend on the choice of a weak (P, C)-pair. For that, we must describe changes of weak (P, C)-pairs.

Proof. Functionsū andx are both uniformizing parameters in
]. Both functions v and y are uniformizing parameters

General definition of two-codimensional residues
Laurent series have been introduced in section 2 because they are useful for computations. Using them, one can define 1-and 2-residues in a more general context.
Context. The context of this section is exactly that of section 1 (see page 4).
is a rational differential form and not a formal one. This is the reason why we introduced this second way of Laurent series expansion.  In this definition of one-codimensional residues, we specify the point P . This 1-form is supposed to give us information about ω only in a neighborhood of P . However, we will see in section 4.2 that this one-codimensional residue is actually a global object on C, hence independent on P . Now, we will prove the following statements.
(1) One-codimensional residues do not depend on the choice of v.
(2) Two-codimensional residues do not depend on the choice of u and v. Caution. In what follows, we sometimes deal with formal differential forms, that is objects of the form f du∧ dv, where f ∈ k((u))((v)). Using such a general point of view is necessary in some parts of next proofs (for instance that of theorem 3.6 and proposition 4.6). Definitions of one-and two-codimensional residues extend naturally to formal forms.
given by a change of variables (CV) in lemma 2.10 is well-defined and sends series (resp. formal forms) with (v)-adic valuation n ∈ Z on series (resp. formal forms) with (y)adic valuation n.
. The proof of this proposition will use forthcoming lemmas 3.7 and 3.9. First, notice the change of coordinates (CV) in lemma 2.10 can be applied in two steps. First, from (u, v) to (u, y), then from (u, y) to (x, y). That is, where γ is a series in yk((u))[[y]] y 2 k((u))[[y]] satisfying g(x, y) = γ(f (x, y), y). We will prove successively that 2-residues are invariant under (CV1) and (CV2).
The field k((u))((v)) is the (v)-adic completion of the k((u))(v) regarded as a function field over k((u)). From [28] IV.2.9, the coefficient of v −1 in h(u, v) equals that of y −1 in h(u, γ(u, y))∂γ/∂y. Remark 3.8. Notice that in the whole chapter IV of [28], the base field is assumed to be perfect, which is not true for k((u)) if Char(k) > 0. However,the proof of IV.2.9 is purely formal and holds for non-perfect base fields.
Proof. From lemma 3.7, (u, v)res 1 C,P (ω) = (u, y)res 1 C,P (ω). Thus, we only study the behavior of residues under (CV2). Decompose ω by isolating its degree −1 term, The formal form ω + has positive (y)-adic valuation. From lemma 3.5, the change of variables (CV2) does not change this valuation. Consequently, the (x, y)-1residue of ω is that of ω −1 and after applying (CV2), we have For the proof of theorem 3.6, we need also the following lemma. Proof of theorem 3.6 if Char(k) = 0. From lemma 3.7, we allready know that 1residues are invariant under (CV1). Thus, we will only study their behavior under (CV2). Consider any formal 2-form From lemma 3.9, the formal form ω inv has an invariant 1-residue under (CV), thus so is its 2-residue. We now have to study ω − . Since extraction of (x, y)-1and -2-residues are k-linear operations, we may only consider 2-forms of the form ω = φ(u)du ∧ dy y n with φ ∈ k((u)) and n ≥ 2. The formal 2-form ω has a zero (u, y)-2-residue because its (u, y)-1-residue is also zero. Then, we have to prove that its (x, y)-2-residue is zero too. Before applying (CV2), we will work a little bit more on ω. First, isolate the term in u −1 of the Laurent series φ.
The series φ has a formal primitive Φ. Set s := 1 (1−n)y n−1 , which is a primitive of 1/y n (it makes sense because Char(k) is assumed to be zero). Then, we have From lemma 3.11, the form ω r has a zero 2-residue for all pair (x, y) ∈ k((u))((v)) 2 connected to (u, v) by a change of variables (CV). Now consider ω −1 = du u ∧ dy y n and apply (CV2), and µ(x, y) The series f has the following factorization

Moreover, for every series
we define the formal logarithm of 1 + S to be This makes sense because Char(k) = 0 and this series converges for the (x)adic (resp. (y)-adic) valuation. Furthermore, d(1+S) (1+S) = d log(1 + S). Using factorization (3), we obtain From lemma 3.11, second and third term of the sum have zero (x, y)-2-residues, and the first one has zero (x, y)-1-residue, hence a zero (x, y)-2-residue.
Proof of theorem 3.6 in positive characteristic. The idea is basically the same as in the proof of invariance of residues of 1-forms on curves (c.f. [28] IV.2.9 or [24] prop II.7.5). One proves that the (x, y)-2-residue of ω is a polynomial expression in a finite family of coefficients of f . This polynomial has integer coefficients and depends neither on f nor on the base field k. Thus, using the result of the proof in characteristic zero and the principle of prolongation of algebraic identities ( [3] prop IV.3.9), we conclude that this polynomial is zero. For more details see appendix C.
Consequently, from now on, when we deal with 2-residues at P along C, we won't have to precise the (P, C)-pair.

Properties of residues
Context. In this section, k is an algebraically closed field and S a smooth geometrically integral quasi-projective surface over k. Moreover, C denotes an irreducible absolutely reduced curve embedded in S and P a point of C.
4.1. About 2-residues. Next lemma gives a necessary condition on ω to have nonzero 2-residues at P along C.
k(S)/k having the curve C as a pole. Let P ∈ C such that C is the only one pole of ω in a neighborhood of P . Then, res 2 C,P (ω) = 0. Proof. Let (u, v) be a strong (P, C)-pair and n := −val C (ω). There exists a function h ∈ O S,C such that which is regular at P , hence has zero residue at this point.

4.2.
About 1-residues. We will give a new definition for one-codimensional residues generalizing the previous one. The goal is, as said in remark 3.4, to define 1-residues as global objects on the curve C. Proof. Recall that, from [25] thm III.5.4.3, the space Ω 2 k(S)/k has dimension one over k(S). Thus, there exists a unique function f ∈ k(S) such that ω = f du ∧ dv. From corollary 2.4, one can expand f in K u ((v)), which gives expansion (4). From the construction of K u (see proposition 2.3),f −1 may be identified to a rational function on C. Thus, the 1-formf −1 dū is rational on C. To prove its independence on the choice of v, the reasoning is exactly the same as in the proof of lemma 3.7.  Let ω ∈ Ω 2 k(S)/k and u ∈ O S,C such thatū is a separating element of k(C)/k. Set µ := (u)res 1 C (ω) ∈ Ω 1 k(C)/k . Then, at each point P of C whereū is a local parameter, we have (♠) (u, v)res 1 C,P (ω) = µ and res 2 C,P (ω) = res P (µ). This remark asserts that definition 4.3 generalizes the notion one-codimensional residue (definition 3.1). Next proposition extends (♠) to any smooth point of C.
Proposition 4.6. Let ω ∈ Ω 2 k(S)/k and u ∈ O S,C such thatū is a separating element of k(C)/k, then at each smooth point Q of C, we have The functionx is a local parameter of O C,Q and for some φ ∈ k[[T ]], we havē Let σ be the Hensel-lift ofx in K u , last relation lifts in K u and gives u 0 = φ(σ). Consequently, we get a new formal expression for ω, Notice that σ ∈ O S,C and is congruent to x modulo (v). Therefore, σ expands in k((x))[[v]] as σ = x + σ 1 (x)v + σ 2 (x)v 2 + · · · Thus, the pair (σ, v) is associated with (x, v) by a change of variables (CV). Using (♣) and theorem 3.6, we conclude that Step 3. Let Q ∈ C at whichū is not regular. Set t := 1/u and notice that Thus, expansion of ω is of the form for some v and Applying the arguments of the previous steps, we conclude the proof.

Summary.
(1) A 2-residue depends only on a curve and a point. Consequently, from now on, we will deal with res 2 C,P and not (u, v)res 2 C,P (definition 3.1). (2) A 1-residue depends only on the curve and the choice of some element u of O S,C , whose restriction to C is a separating element of k(C)/k. Moreover this object gives a global information on C and in a neighborhood of a point. From now on, we will deal with (u)res 1 C (definition 4.3) and not with (u, v)res 1 C,P (definition 3.1). We will also keep using map res 1 C for 2-forms having m S,C -adic valuation greater than or equal to −1.
Corollary 4.8. Let u be a function in O S,C whose restrictionū to C is a separating element of k(C)/k. Let π : S → S be the blowup of S at P and C be the strict transform of C by π. Then, Proof. Surfaces S E and S {P } are isomorphic under π. Furthermore, recall that P is assumed to be a smooth point of C, thus π induces an isomorphism between C and C. The 1-forms (π * u)res 1 e C (π * ω) and (u)res 1 C (ω) are pullback of each other by π | e C and its inverse.

Residues along a singular curve
Context. The context of this section is that of sections 1, 2 and 3 with only one difference, the curve C may be singular at P .
Proposition 5.1. Let π : S → S be a morphism obtained by a finite sequence of blowups of S and such that the strict transform C of C by π is a desingularization of C at P . Then, the sum does not depend on the choice of the desingularization π : S → S.
We conclude by adding last equalities for all i.

Residue formulas
We look for an analogous definition of the residue formula on curves ([24] lem II.12.3 or [28] IV 3.3) in the two-dimensional case. We will give three statements about summations of 2-residues.
Context. In this section, k is an algebraically closed field and S a smooth geometrically integral projective surface over k. Proof. Let u be an element of O S,C whose restrictionū to C is a separating element of k(C). If C is smooth, then apply proposition 4.6 and the classical residue formula on curves to (u)res 1 C (ω). Else, use definition 5.2 and apply the same arguments to a morphism φ : S → S inducing a normalization of C. Remark 6.2. If val C (ω) ≥ −1, then from proposition 1.1 and definition 1.3, the 2-form ω has a 1-residue along C denoted by res 1 C (ω). Thus, in this particular situation, last theorem is an easy consequence of the classical residue formula on curves applied to the 1-form res 1 C (ω). The nonobvious part of this proposition is that the statement holds even if val C (ω) < −1. Remark 6.4. Notice that this sum is actually finite because almost all C ∈ C S,P is not a pole of ω thus the 2-residue at P along this curve is zero.
Proof. Let ω ∈ Ω 2 k(S)/k and C 1 , . . . , C n ∈ C S,P be the set of its poles in a neighborhood of P . We will prove the theorem by induction on n.
Step 1. Assume that, for each pair of curves C i , C j with i = j, their intersection multiplicity at P is one.
If n = 1. From lemma 4.1 the sum is obviously zero.
If n = 2. Let u 1 , u 2 be respectively local equations of C 1 and C 2 . Then, (u 1 , u 2 ) is a strong (P, C 2 )-pair and (u 2 , u 1 ) a strong (P, C 1 )-pair, because C 1 and C 2 are assumed to have a normal crossing at P . Thus, for some h ∈ O S,P and some positive integers n 1 and n 2 , we have Expand h in Taylor series h = h ij u i 1 u j 2 . Using the anticommutativity of the external product, a brief computation gives res 2 C 2 ,P (ω) = −res 2 C 1 ,P (ω) = h n 1 −1,n 2 −1 . If n ≥ 2. Consider π : S → S the blowup of S at P . Denote by E the exceptional divisor, by C i the strict transform of C i and by Q i the intersection point between E and C i . Points Q i 's are all distinct and curves E and C i have normal crossing at Q i . The curve E is projective and the C i 's are the only poles of π * ω which cross E. Furthermore, the previous case entails res 2 and last sum is zero from theorem 6.1.
Step 2. In the general case, a curve C i might be singular at P or intersect the other C j 's with higher multiplicity. After a finite number of blowups, using definition 5.2 and applying same arguments to the resolution tree, we get the expected result.
Remark 6.5. Notice that the valuation of π * ω along the exceptional divisor E is not always greater than or equal to −1. This valuation is given by the formula where the set C S,P is that of theorem 6.3. For a proof of this formula see [15] prop V.3.3 and V.3.6. Therefore, theorem 6.1 is necessary to conclude in the first step of last proof.
To state the third residue formula, we need to extend the definition of 2-residues at a point along a curve to 2-residues at a point along a divisor.
Definition 6.6. Let D = n 1 C 1 + · · · + n p C p be a divisor on S and ω ∈ Ω 2 k(S)/k . We define the 2-residue of ω at P to be Remark 6.7. Notice that coefficients n i 's of D are not involved in this definition. Actually, res 2 D,P depends only on the support of the D. The most logic notation would have been " res 2 Supp(D) " which is too heavy.

Part 2. Application to coding theory
Notations Let X be a variety defined over finite a field k, we denote by Div k (X) the group of rational Weil divisors on X. That is, the free abelian group spanned by irreducible one-codimensional closed subvarieties of X. If G ∈ Div k (X), then we use the following notations.
(1) G + denotes the effective part of G. (3) Ω 2 (G) denotes the Riemann-Roch space of rational 2-forms (4) If G ′ ∈ Div k (X) such that the supports of G and G ′ have no common component in a neighborhood of P , we denote by m P (G, G ′ ) ∈ Z the intersection multiplicity of these divisors at P .

About codes from curves, classical constructions
In this section C is a smooth projective absolutely irreducible curve over a finite field F q . Let G be a rational divisor on C and P 1 , . . . , P n be a family of rational points of C avoiding the support of G. Set D := P 1 +· · ·+P n ∈ Div Fq (C) and ev D : We define the codes C L (D, G) := Im(ev D ) and C Ω (D, G) := Im(res D ) called respectively functional code and differential code. Both constructions are linked by the following properties. See [27], [28] or [29] for the proofs of these statements. Relation (OR) is a consequence of the residue formula for inclusion "⊆" and of Riemann-Roch's theorem for the reverse one. This relation is used in almost all algebraic decoding algorithms (see [17]). Relation (LΩ) is a consequence of the weak approximation theorem ( [28] thm I.3.1). It allows to restrict the study of algebraic-geometric codes to only one class, for example functional codes which seems to be easier to study. The goal of this second part is to extend some of these statements to surfaces.

Algebraic-geometric codes on surfaces
From now on, S denotes a smooth geometrically integral projective surface over F q and S := S× Fq F q . Moreover, G denotes a rational divisor on S and P 1 , . . . , P n a set of rational points of S avoiding the support of G. Set ∆ := P 1 + · · · + P n . Notice that ∆ is not a divisor but a 0-cycle. Most of the difficulties we will meet come from this difference of dimension between G and ∆. 8.1. Functional codes. As said in the introduction, the functional construction of codes extends to higher-dimensional varieties (see [31] I.3.1). Define the map ev ∆ : The functional code is C L (∆, G) := Im(ev ∆ ). The study of such codes is really more complicated than that of codes on curves. Particularly, finding a minoration of the minimal distance becomes a very difficult problem. For more details about this topic, see references cited in introduction.
8.2. Differential codes. To define differential codes, we need more than G and ∆. We want to evaluate 2-residues of some rational differential forms with prescribed poles. Unfortunately, 2-residues depend not only on a point but on a flag P ∈ C ⊂ S. Thus, we have to input another divisor.
Definition 8.1. Let D ∈ Div Fq (S) and assume that D is the sum of two divisors D a , D b whose supports have no common irreducible component. Then, one can define the map res 2 Da,∆ : Da,P 1 (ω), . . . , res 2 Da,Pn (ω)). The differential code is defined by C Ω (∆, D a , D  8.3. ∆-convenience. Actually, if one chooses an arbitrary divisor D, last definition is not very convenient. Recall that, from lemma 4.1 and theorem 6.3, res 2 Da,P i (ω) is nonzero only if the supports of D + a and D + b intersect at P i . Therefore, if we want to have a code which is linked to the functional code C L (∆, G), the divisor D must be itself related to the 0-cycle ∆. We will first define the notion of ∆-convenient pair of divisors. Afterwards, we will give a criterion of ∆-convenience. Although this one may look ugly, it is actually easy to handle. Let D a , D b be a pair of F q -rational divisors on S whose supports have no common component and set D := D a + D b . From now on, F denotes the sheaf on S defined by Moreover, for all point P ∈ S, the stalk of F at P is denoted by F P (see [15] II.1 p. 62 for definition of "stalk"). Notice that H 0 (S, F) = Ω 2 (−D) ⊗ Fq F q .  Remark 8.5. Let P ∈ S and ω ∈ F P . From remark 6.9, we have Consequently, if at a point P ∈ S, the map res 2 D b ,P is O S,P -linear and satisfies (ii) and (iii), so does res 2 Da,P . (1) For each P ∈ Supp(∆), there exists an irreducible curve C smooth at P such that in a neighborhood U P of P , either (D + a ) |U P or (D + b ) |U P equals C |U P and m P (C, D − C) = 1.
(2) For each P ∈ S Supp(∆), either D * = D a or D * = D b satisfies the following conditions. For each F q -irreducible component C of D + * containing P , (a) the curve C is smooth at P , (b) this curve C appears in D * with coefficient one, (c) m P (C, D − C) ≤ 0.

Remark 8.7. In condition (2) of this criterion, the divisor D * may be zero in a neighborhood of P (actually that is what happens at almost all point P ). In this situation, conditions (2a), (2b) and (2c) are obviously satisfied.
For the proof of this proposition, we need next lemma and its corollary. Proof. Let ϕ, ψ and v be respective local equations of (ω) + C + , (ω) + C − and C in a neighborhood of P . Let u ∈ F q (S) such that (u, v) is a strong (P, C)-pair, then for some h ∈ O × S,P , we have Thus, res 1 C (ω) =hφψ −1 dū and sinceh ∈ O × C,P , we have val P (hdū) = 0. Consequently, val P (res 1 C (ω)) = val P (φ) − val P (ψ). Furthermore, Corollary 8.9. Let C be an irreducible curve embedded in S and P be a smooth point of C. Let ω ∈ Ω 2 Fq(S)/Fq such that val C (ω) ≥ −1 and m P (C, (ω)+C) ≥ −1. Then, ∀f ∈ O S,P , res 2 C,P (f ω) = f (P )res 2 C,P (ω).
Proof. Let (u, v) be a strong (P, C)-pair and f be an element of O S,P . Since val C (ω) ≥ −1, there exists ψ ∈ O S,C such that Set µ := res 1 C (ω) =ψdū. The condition val C (ω) ≥ −1 entails also res 1 C (f ω) =fψdū =f µ. From lemma 8.8, we have val P (µ) = m P (C, (ω) + C) ≥ −1. Thus, res 2 C,P (f ω) = res P (f µ) =f (P )res P (µ) = f (P )res 2 C,P (ω). Condition (ii). Let P ∈ Supp(∆) and ω ∈ F P , where F P denotes the stalk of the sheaf F at P . From (1), there is an irreducible curve C, smooth at P such that either D + a or D + b equals C in a neighborhood of P . Using remark 8.5, we may assume that D + a = C without loss of generality. Thus, C is the only one irreducible component of Supp(D + a ) in a neighborhood of P . Therefore, res 2 Da,P (ω) = res 2 C,P (ω). Consequently, val C (ω) ≥ −1 and corollary 8.9 asserts that res 2 C,P (hence res 2 Da,P ) is O S,P -linear.
Condition (iii). Let P ∈ S be a point out of the support of ∆. From remark 8.5, we may assume without loss of generality that condition (2) in proposition 8.6 is satisfied by D a (i.e. D * = D a at P ). Let C be an F q -irreducible component of Supp(D + a ) and ω ∈ F P . From (2b), val C (ω) ≥ −1 and from lemma 8.8 and (2c), we have val P (res 1 C (ω)) ≥ 0. Consequently, res 2 C,P (ω) = 0, which concludes the proof. Notice that in the definition, neither D a nor D p are assumed to be effective. In some situation it is necessary to use noneffective divisors. This happens in next example.
In section 10, we prove that in some situation, the reverse inclusion is false for any choice of a ∆-convenient pair of divisors. Thus, in general, we do not have equality. An interpretation of this statement is that, even if a pair of ∆-convenient divisors is linked to ∆, it is not involved in the functional construction. This lack of canonicity in the choice of D might be the reason of this non-equality. In a forthcoming paper, we will study how to get the whole orthogonal of a functional code, using differentials. 9.2. A differential code is functional. Recall that in section 7, we discussed about two relations denoted by (OR) and (LΩ). We just said that it is not possible to extend perfectly the orthogonality relation (OR). Nevertheless, next proposition asserts that relation (LΩ) holds on surfaces, a differential code is always a functional one associated with some canonical divisor. Recall that, the proof of (LΩ) for curves is a consequence of the weak approximation theorem. Here is the needed statement for surfaces. Proposition 9.2. Let P 1 , . . . , P m and Q 1 , . . . , Q n be two families of closed points of S and C be an irreducible curve embedded in S. Suppose that the P i 's are contained in C and the Q i 's are out of it. Then, there exists a function u ∈ F q (S) satisfying the following conditions. N.B. In the whole book of Shafarevich [25] the base field is assumed to be algebraically closed. Nevertheless the very same proof holds over an arbitrary field. Proof. Let X 1 , . . . , X r and Y 1 , . . . , Y s be respectively the irreducible components of Supp(D a ) and Supp(D b ). That is D a = m 1 X 1 + · · · + m r X r and D b = n 1 Y 1 + · · · + n s Y r for some integers m i 's and n j 's. Choose g ∈ ∩ P ∈Supp(∆) O × S,P such that g(P ) = a −1 P for all P ∈ Supp(∆). Then, replacing U by a smaller open set containing Supp(∆) and ω 0 by gω 0 , the three conditions are satisfied.
There exists a canonical divisor K such that Proof. From corollary 9.3, there exists a 2-form ω 0 satisfying (1), (2) and (3). Set K := (ω 0 ), this divisor is of the form K = −D + R where the support of R avoids that of ∆. Let ω ∈ Ω 2 (G−D), then for some function f ∈ L(K −G+D), we have ω = f ω 0 . Notice that K − G + D = G + R, then any function f ∈ L(K − G + D) is regular in a neighborhood of each P ∈ Supp(∆). Consequently, from condition (3) in corollary 9.3, we have Any differential code is actually a functional one. Notice that, if the converse statement is trivial for codes on curves, it is less easy in our situation. Indeed, to prove that a functional code is differential, we have to build a ∆-convenient pair of divisors.
9.3. Converse statement, a functional code is differential.
Step 1: Construction of D a . Choose a curve C (which may be reducible) containing the whole support of Γ and regular at each point of it and set D a := k C k where C k 's are the irreducible components of C. Finding such a curve is an interpolation problem with infinitely many solutions.
Step 2: Construction of D b . Choose another divisor D ′ interpolating all the points of Supp(Γ) and having no common component with D a . Let Λ be the 0-cycle given by the scheme-theoretic intersection D a ∩ D ′ . Unfortunately, the support of Λ might be bigger than that of Γ. Thus, we have Λ = Γ + Γ ′ where Γ ′ is an effective 0-cycle. Now choose a divisor D ′′ such that D ′′ ∩ D a = Γ ′ + Γ ′′ where Γ ′′ and Γ have disjoint supports. Set D b := D ′ − D ′′ . The pair (D a , D b ) satisfies the criterion of proposition 8.6, which concludes the proof.
Theorem 9.6. Let G be a rational divisor on S, then for some canonical divisor K and some divisor D : Proof. Lemma 9.5 asserts the existence of a ∆-convenient pair (D a , D b ). Then, construct a 2-form ω 0 using corollary 9.3. Set K := (ω 0 ). Now the result is an easy consequence of theorem 9.4.

The reverse inclusion is false
As said in section 9.1, if a differential code is included in the orthogonal of a functional one, the reverse inclusion is in general false. The study of the following example will prove this.
In this section, the surface S is the product of two projective lines S := P 1 ×P 1 . Let U be an affine chart of S with affine coordinates x, y. The complement of U in S is a union of two lines E and F . The Picard group of S is generated by the classes of E and F . Thus, without loss of generality, one can choose for G the divisor G n,m := mE + nF , with m, n ∈ Z. Finally, ∆ is defined as the formal sum of all rational points of U .
10.1. Functional codes on P 1 × P 1 . On U , the vector space L(G m,n ) may be identified with F q [x] ≤m ⊗ Fq F q [y] ≤n , where F q [t] ≤d denotes the space of polynomials in t with degree less than or equal to d. Furthermore, the functional code C L (∆, G m,n ) may be identified with a tensor product of two codes on the projective line, which are Reed-Solomon codes. Thus, where RS q (k) denotes the Reed-Solomon code over F q of length q and dimension k.

10.2.
Orthogonal of functional codes on P 1 × P 1 . In this subsection, we prove that the orthogonal of some functional code on P 1 × P 1 cannot be differential.
Proposition 10.1. Let m, n be two integers such that 0 ≤ n, m < q − 2, then for all ∆-convenient pair of divisors (D a , D b ), we have Proof. From ( ) and lemma D.1 in appendix D, we have From theorem 9.4, the code C Ω (∆, D a , D b , G m,n ) is functional. Thus, from ( ), it is a tensor product of two Reed-Solomon codes. But C L (∆, G m,n ) ⊥ is of the form A ⊗ F q q + F q q ⊗ B with A, B nonzero and strictly contained in F q q . This contradicts lemma D.2 in appendix D.
Remark 10.2. The condition 0 ≤ m, n < q − 2 asserts that in the tensor product representation C L (∆, G m,n ) = RS q (m + 1) ⊗ RS q (n + 1), none of the terms of the tensor product is zero or F q q . A solution to avoid this lack of reverse inclusion is to try to construct the orthogonal as a sum of differential codes. The purpose of next subsection is the realization of C L (∆, G m,n ) ⊥ as a sum of two differential codes associated with two distinct ∆-convenient pairs. (i) Proof. As said in last proof, relation ( ) and lemma D.1 entail C L (∆, G m,n ) ⊥ = RS q (m + 1) ⊥ ⊗ F q q + F q q ⊗ RS q (n + 1) ⊥ . Consequently, (i) + (ii) ⇒ (iii). Furthermore, by symmetry (i) ⇔ (ii). Thus, we only have prove (i). Set . This form satisfies conditions (1), (2) and (3) in corollary 9.3. Compute the divisor of ν. On U , we have (ν |U ) = −D 3|U − D 1|U , moreover D 1 ∼ qE and D 3 ∼ q(E + F ). Since the canonical class on P 1 × P 1 equals that of −2(E + F ), we have To conclude, notice that if m ≤ q −1, then 2q −2−m ≥ q −1 and RS q (2q −2−m) equals F q q .

Conclusion
This new construction of codes generalizes the differential construction of codes on curves. The main difference is that it is not always possible to realize the orthogonal of a functional code as a differential (or equivalently functional) one. A natural question comes from the study of last example.
Question 11.1. Is the orthogonal of a functional code a sum of differential codes? If yes, is there a bound on the number of differential codes involved in this sum?
Moreover, we now know that the orthogonal of a functional code might be non-functional. Consequently, the study of such codes might be interesting. Afterwards, using the (u)-adic topology of k((u)), one can define a topology of projective limit on k((u)) [[v]]. For this topology, a sequence (s (n) ) n∈N defined for all n by s (n) = j∈N s Afterwards, using a Cauchy criterion, one proves that, for this topology, a series of elements of k((u)) [[v]] converges if and only if its general term converges to zero.
Remark A.1. Notice that this topology on k((u)) [[v]] is weaker than the (v)adic one (for which the subset k((u)) is discrete). Thus, if a sequence (resp. a series) converges for the (v)-adic topology, hence converges for the projective limit topology.
Proof of lemma 3.5.
Step 1. Recall that f is of the form f = f 0 (x)+f 1 (x)v+· · · and such that f 0 has (x)-adic valuation one. We will prove that the sequence (f n ) n∈N converges to zero. Let i be a nonnegative integer, for n large enough, the coefficient of y i in f n is of the form f n 0 P i (f 0 , . . . , f i ), where P i is a polynomial which does not depend on n. Thus, for the (x)-adic topology this coefficient tends to zero. Consequently, for all Laurent series φ(u) ∈ k((u)), the series φ(f (x, y)) converges in k((x))[[y]].
Step 3. If ω is a formal form ω = h(u, v)du ∧ dv with (v)-adic valuation n ∈ Z, then we have to prove that the (y)-adic valuation of h(f, g)df ∧ dg is n too. If we prove that the (y)-adic valuation of df ∧ dg is zero, then we can conclude using step 2. For that, consider the expression This concludes the proof.
Appendix B. Proof of lemma 3.11 If ω = dA∧dB for some series A, B ∈ k((u))((v)), after a change of coordinates (CV), ω = dF ∧ dG for some other series F, G ∈ k((x))((y)). Then, in order to prove the lemma we only have to prove that the (u, v)-2-residue of ω = dA ∧ dB is zero.
Proof. Maps Jac and ρ are respectively k-bilinear antisymmetric and k-linear. Then, we can restrict the proof to the three following situations and extend it by linearity.
Let us consider these three situations.
(1) The series A and B don't have terms with negative powers of v, thus so are their partial derivatives, then ρ • Jac(A, B) = 0.
Integers m and n are positives, there is no term in v −1 , thus ρ(Jac(A, B)) = 0.
Appendix C. Proof of theorem 3.6 when k has a positive characteristic We only have to work on the points of the proof of proposition 3.6 in which we used specific properties of characteristic zero. Thus, we will study the behavior under (CV2) of differentials of the form ω = φ(u)du ∧ dy y n+1 , where φ ∈ k((u)) and n ≥ 1. Step 1. Assume that ω = u m du ∧ dy y n+1 with m ∈ N. Then, ω = (f ′ 0 (x) + f ′ 1 (x)y + · · · )(f 0 (x) + f 1 (x)y + · · · ) m dx ∧ dy y n+1 .
The (x, y)-1-residue of ω is the coefficient in y n of the series f m ∂f /∂x. This residue is of the form (x, y)res 1 C,P (ω) = P m,n (f 0 , . . . , f n , f ′ 0 , . . . , f ′ n )dx, where P m,n ∈ Z[X 0 , . . . , X n , Y 0 , . . . , Y n ] depends neither on the field k nor on f . Actually, P m,n depends only on m and n. By the same way, its coefficient of x −1 is a polynomial expression Q in the f i,j 's with 0 ≤ j ≤ n and −N ≤ i ≤ N + 1, such that Q has coefficients in Z and depends neither on k nor on f . Furthermore, if k has characteristic zero, we know from section 3 that Q vanishes on the set {f 1,0 = 0}, hence is the zero polynomial.