Introduction. In this paper we are concerned with the metamathematics of the first order theory of rings Ro and integral domains JDo. The purpose of the paper is to characterize derivability from Ro and JDo respectively by algebraic notions pertaining to the theory of polynomial ideals. The essential tool from logic needed is an improved version of Gentzen's extended Hauptsatz to be derived in ?I. ??II and III contain some remarks and introduce new notations. In ?IV we prove a syntactical counterpart of Hilbert's Nullstellensatz. Although this syntactical result could easily be proved with the aid of Hilbert's Nullstellensatz and the completeness theorem we think that its metamathematical proof has some interest in itself (see Lemma 4*). In ?V we combine the results of ??I and IV in order to prove an algebraic version of Gentzen's extended Hauptsatz for Ro and JDo. Applications of the techniques developed in ??I-IV are presented in ??VI and VII. Lemma 4*, a constructive version of Lemma 4, has been suggested by G. Kreisel. There is an interesting application of Lemma 4* to a problem considered by G. Kreisel. This application lies somewhat outside the scope of this paper, hence we omit it. It will be presented, together with some related topics, in a separate note. NOTATIONS. (1) By I and R we denote the set of integers and the set of rationals respectively. I[xj, .. ., xj] and R[xl, ... , xj] (or briefly I[x], R[x]) are the rings of polynomials in the variables xl, .. ., xn, with coefficients in I and R respectively. Notions such as prime ideal, primary decomposition, basis of an ideal will be used frequently. For details concerning them we refer to [4]. (2) At many places, vectors whose components are terms (from a certain theory) will be used. For particular vectors such as (xi, .. ., xn), (Yi, ..., Ym) we will use sometimes the abbreviations xn, x and Ymi, Y (3) Let gl, .. ., gn be polynomials in R[x]; by B(g1,. ..., gn) we denote the ideal consisting of all polynomials of the form 21 higi with hi E R[x] for i ? n. If g1 ,... gn E I[x] then B*(gl,.. ., gn) denotes the ideal consisting of all polynomials 21 higi with hi E I[x] for i < n. Several notations will be introduced as they will be needed, as, e.g. at the end of ?111. (4) Existential and universal quantifiers will be denoted by ] and V respectively but in order to save space we delete the V in formulas and write universal quantification over x more simply as (x); at some places a sequence of universal quantifiers