Algorithmic Structuring of Cut-free Proofs?Matthias Baaz?? Richard Zach???Technische Universitat Wien, AustriaAbstract. The problem of algorithmic structuring of proofs in the sequentcalculi LK and LKB (LK where blocks of quantiers can be introduced inone step) is investigated, where a distinction is made between linear proofsand proofs in tree form. In this framework, structuring coincides with theintroduction of cuts into a proof. The algorithmic solvability of this problemcan be reduced to the question of k=l-compressibility:\Given a proof of  !  of length k, and l  k: Is there is a proofof  !  of length  l?"When restricted to proofs with universal or existential cuts, this problem isshown to be (1) undecidable for linear or tree-like LK-proofs (correspondsto the undecidability of second order unication), (2) undecidable for lin-ear LKB-proofs (corresponds to the undecidability of semi-unication), and(3) decidable for tree-like LKB-proofs (corresponds to a decidable subprob-lem of semi-unication).1 IntroductionMost classical algorithms in proof theory eliminate the structure of given proofsto extract information, e.g., Herbrand disjunctions (as obtained via cut-eliminationor the "-theorem), or normal forms of functional interpretations. The problem ofstructuring of proofs is inverse to these procedures: How to structure a proof bydecomposition and introduction of propositions?In sequent calculi, structuring of proofs can be identied with the insertion ofcuts into a proof. This provides us with a general basis for formal approaches to theproblem above. All usual cut-elimination procedures for rst order logic found in theliterature (such as those of Gentzen [1934] and Tait [1968], where substitution isthe only operation on terms) produce cut-free proofs of increased term complexityrelative to the original proof. If we view the structuring problem as the inverseproblem to cut-elimination and restrict ourselves to such procedures, we can ofcourse nd a simpler proof with cuts that yields the given proof after cut-eliminationif such a proof exists. Such procedures, however, depend on specic methods for cut-elimination, and the view of proofs as literal objects.Since we would actually like to disregard term structure in favour of proof struc-ture (i.e., we would like to consider proofs as schemata of a certain form, and asequivalent up to substitutions), we take a more general approach here: given a proofand end sequent, we ask for a shorter proof with possibly increased structure. Insequent calculus this corresponds to the introduction of stronger cuts (if the proofcannot be abbreviated trivially, of course). We will be able to solve this problem ifwe can construct a procedure that solves the following central question:? in: E. Borger, G. Jager, H. Kleine Buning, S. Martini, M. M. Richter (Eds.). ComputerScience Logic. Selected papers from CSL'92, LNCS, Springer, Berlin, 1993, pp. 29{42?? Technische Universitat Wien, Institut fur Algebra und Diskrete Mathematik E118.2,Wiedner Hauptstrae 8{10, A-1040 Wien, Austria, baaz@logic.tuwien.ac.at??? Technische Universitat Wien, Institut fur Computersprachen E185.2, Resselgasse 3/1,A-1040 Wien, Austria, zach@logic.tuwien.ac.at1 1.1. k=l-Compressibility Given a proof of  !  of length k, and l  k: Is thereis a proof of  !  of length  l?In what follows, we study proofs in LK and LKB (LK where blocks of quantierscan be introduced in one step) considered as acyclic graphs (not only tree-like proofs).We restrict ourselves to the fragments with only universal or existential cuts (thecut formulas are pure universal or existential formulas), denoted LK and LKB ,respectively. We show that k=l-compressibility is(1) undecidable for LK-proofs,(2) undecidable for linear LKB -proofs, but is(3) decidable for tree-like LKB -proofs.Since we consider k=l-compressibility as central, and since bounds on cut elim-ination do only depend on the length of the given proof, it makes no dierencewhether the given proof is cut-free or not. However, structuring of cut-free proofs isimportant to computer science, where deduction systems are usually quantier-free.In the following, we assume familiarity with Buss [1991] and Krajicek andPudlak [1988]2 Basic denitionsWe follow Buss [1991] in the denition of sequent calculus LK, with the exceptionthat axioms and weakenings are restricted to atomic formulas.The calculus LKB is LK with the rules (8:left) and (8:right) replaced byA(t1; : : : ; tr);   ! (8x1) : : : (8xr)A(x1; : : : ; xr);   !  8B : leftand   ! ;A(b1; : : : ; br)  ! ; (8x1) : : : (8xr)A(x1; : : : ; xr) 8B : rightrespectively (b1, : : : , br must not occur in the lower sequent). (9-left) and (9-right)are analogously replaced by (9B-left) and (9B-right).2.1. Definition A (linear) proof is a directed acyclic graph s.t.(1) every node is labeled with a sequent and the name of a rule of inference,(2) every node with indegree 0 is labeled by an axiom sequent,(3) exactly one node has outdegree 0 (labeled by the end sequent),(4) all other nodes have outdegree  1, and(5) if an edge connects a node labeled by sequent R to a node labeled by S, then Ris a premise to the inference associated with S, and the edge is labeled by L orR according to whether R is the left or right premise of the rule, and unlabeledif the rule has only one premise.A proof is called tree-like if it is a tree, i.e., if every node has outdegree 1. Thelength of a proof is the number of its nodes. For simplicity, we identify nodes withthe sequents they are labeled with.2.2. Definition A proof analysis is like a proof except that nodes are only labeledwith names of inference rules, and nodes corresponding to axioms and weakeningsadditionally carry the corresponding predicate symbol.A proof realizes a proof analysis P with end sequent  ! , if there is a bijectionbetween the nodes and edges in the proof and the proof analysis s.t. corresponding2 nodes are labeled by the same rule names, axioms and weakening formulas have thepredicate symbol determined by the corresponding label in P , corresponding edgeshave the same labels, and the end sequent of the proof is  ! . If there is such aproof, P is called realizable with end sequent  ! .The decision problem of whether a given proof analysis with end sequent can berealized by a proof is called the realizability problem.The decision problem of whether there is a proof of a given sequent of length  kis called the k-provability problem.2.3. Remark It is easily seen that the decidability of realizability implies decidabilityof k-provability (enumerate all proof analyses up to length k), which in turn impliesthe decidability of k=l-compressibility, but the converse is not immediately obvious.Consider the class of proof analyses with undecidable realizability problem given inKrajicek and Pudlak [1988], x5: The end sequents A ! A;P (sn0) are triviallyderivable by one weakening, and hence k-provability is decidable. To see that the un-decidability of k-provability need not imply the undecidability of k=l-compressibility,consider a system of rst order logic with all true formulas as axioms and with soundrules: k-provability is undecidable, but k=l-compressibility is decidable.2.4. Remark The restriction to atomic axioms and weakenings makes the use ofproof analyses easier, since we can do without a number of case distinctions: In thecut-free case, the end sequent determines the logical form of all formulas, but in thepresence of cuts and non-atomic axioms and weakenings, we only have a bound on thelogical complexity of the cut-formulas (by Parikh [1973], Theorem 2). Consequentlywe have to add information on the logical form of cut-formulas to the proof analyses.3 k=l-Compressibility is undecidable for LKWe derive the undecidability of k=l-compressibility for LK from the undecidabiltyof k-provability: To establish the undecidability of k-provability, we associate witha non-recursive r.e. set X  ! a sequence of proof analyses Pi and end sequentsi ! i, i 2 !, s.t.n 2 X () Pn is realizable with end sequent n ! n;and, furthermore, that all proofs of n ! n for n 2 ! nX are longer than Pn.In fact, there is a recursive superset X of X such that n ! n is provable forall n 2 X, since k-provability for cut-free proofs is decidable (cf. Krajicek andPudlak [1988], Theorem 6.1). If n ! n is of the form  ! ;A(sn(0)), thenX is even conite.To show that k=l-compressibility is undecidable, it suces to bound the lengthof the proofs of n !  n. This is the statement of the following theorem, which canbe gathered from Buss [1991]:3.1. Theorem For every r.e. set X 6= ; there is a formula AX (c) and k 2 ! s.t.n 2 X i ! AX(sn(0)) has an LK- (by construction LK-) proof of length k and! A(sn(0)) has an LK- (by construction LK-) proof of length k+1 for all n 2 !.Proof. Every r.e. set X  ! can be represented by a set of partial substi-tution equations obeying the special restriction s.t., n 2 X i [ f1 = sn(0)ghas a solution (Buss [1991], Theorem 3). The proof of this fact is via Matijacevic'sTheorem by encoding diophantine equations as partial substitution equations. Let [ f1 = sn(0)g be the set of equations characterizing the r.e. set X.In the proof of the Main Theorem of Buss [1991] a formula AX (sn(0)) and aninteger N are constructed s.t. ! AX (sn(0)) has an LK-proof of  N steps i the3 above equations have a solution, and is provable in N + 1 steps, if all but one of theequations have a solution (Section 4, see in particular p. 93, rst paragraph). Therst part of the theorem now follows from the fact that the system encodes X andhence is solvable i n 2 X. For the second part, we replace 1 by sr(0) for somer 2 X, r 6= n. Then sr(0) = sn(0) is the only equation not satised (regardless ofwhether n 2 X or not).The proofs constructed are all tree-like, use only existential cuts, atomic axiomsand atomic weakenings. The central Propositon 8 of Buss [1991] (as noted there)can be adapted to the non-tree-like case. Hence the arguments extend to the case oflinear LK-proofs. 23.2. Corollary k=l-Compressibility is undecidable for LK-proofs (whether lin-ear or tree-like).3.3. Remark If the end sequent contains only unary function symbols, k=l-com-pressibility is decidable: cf. Parikh [1973], Theorem 1 for the case of one and Far-mer [1991], Corollary 5.20 for several unary function symbols. It is also decidableif we are looking for shorter proofs with quantier-free cuts (cf. Krajicek andPudlak [1988], Section 2).3.4. Remark The theorem shows that, in the worst case, we have to pay for intro-duced structure by a signicant|in fact non-recursive|increase in the term struc-ture, even in decidable subcases. This situation could be alleviated by taking intoaccount known properties of the function symbols, such as associativity and com-mutativity.4 k=l-Compressibility is undecidable for linear LKB -proofsTo be able to deal with block inferences of quantiers, we introduce the concept ofsemi-unication:4.1. Definition (cf. Baaz [1993],Kfoury et al. [1990], Pudlak [1988]) A substi-tution  is called a semi-unier of the semi-unication problem f(s1; t1);: : : , (sp; tp)gi there exist 1, : : : , p such that s1 = t11, : : : , sp = tpp. In other words, asemi-unier makes the si substitution instances of the corresponding ti.4.2. Example  = f(x; f(x; x))=z is a semi-unier of  f(x; z); f(x; f(x; y)) be-cause f(x; z)f(x; f(x; x))=z = f(x; f(x; y))f(x; f(x; x))=z	f(x; x)=y	:There is no semi-unier of  f(x; y); f(x; f(x; y)), since no simultaneous substitutionwill make the left side a substitution instance of the right side.4.3. Theorem Realizability is undecidable for linear LKB -analyses.This follows immediately from the undecidability of semi-unication (Kfoury etal. [1990]) and the following proposition:4.4. Proposition Let the language contain a binary function symbol f . For everysemi-unication problem = (s1; t1); : : : ; (sp; tp)	, there is a proof analysis P and a sequent  !  , s.t. there is an LKB -proof realizing P with end sequent !  i is solvable. 4 Proof. First note that the semi-unication problem can be reduced to a semi-unication problem (s1; t); : : : ; (sp; t) with si = f(  f(ai1 ; ai2) : : : si) : : : aip) andt = f(  f(t1; t2); : : : tp), where aij are new free variables.Let A (a1; : : : ; an)  P (t)^  (P (s1)^ : : :^P (sp)  Q), where all free variablesare among a1, : : : , an and do not occur in Q. We sketch the construction of a proofanalysis as follows: 8>>;propositional inferences(a) A (a1; : : : ; an) ! A (a1; : : : ; an)(a+ 1) (8x1) : : : (8xn)A (x1; : : : ; xn)! A (a1; : : : ; an)8>>>>;propositional inferences includingpropositional cuts from (a+ 1)(b) (8x1) : : : (8xn)A (x1; : : : ; xn)! P (t)(b+ 1) (8x1) : : : (8xn)A (x1; : : : ; xn)! (8y1) : : : (8ym)R(y1; : : : ; ym)8>>>>;propositional inferences includingpropositional cuts from (a + 1)(c) P (s1); : : : ; P (sp); (8x1) : : : (8xn)A (x1; : : : ; xn)! Q8>>>>;p (8B-left)-inferences, exchangesand contractions from (c)(d) (8z1) : : : (8zs)R0(z1; : : : ; zs); (8x1) : : : (8xn)A (x1; : : : ; xn)! Q(e) (8x1) : : : (8xn)A (x1; : : : ; xn); (8x1) : : : (8xn)A (x1; : : : ; xn)! Q(e+ 1) (8x1) : : : (8xn)A (x1; : : : ; xn)! QHere, (a + 1) is obtained from (a) by (8B :left), (b + 1) from (b) by (8B :right),(e) from (b + 1) and (d) by cut, and (e + 1) from (e) by contraction. Note that(8y1) : : : (8ym)R(y1; : : : ; ym)  (8z1) : : : (8zs)R0(z1; : : : ; zs) by the cut rule and hence is forced to be a semi-unier. The label (a+1) is ancestor of both sides of the cut,the skeleton is therefore not in tree form. (The length of the skeleton is linear in n.)24.5. Remark If p = 1, then the realizability of this analysis is decidable (cf. Pud-lak [1988], Theorem (i)).4.6. Remark Note that we do not, and indeed cannot, have a result like this:For every r.e. set X  ! there is a proof analysis PX and a sequent X ! X ; AX(a)s.t. there is an LKB -proof realizing PX with end sequent X ! X ; AX (sn(0)) in 2 X.This follows from the fact that for every proof analysis P and every sequent  ! with free variable a, there is a semi-unication problem =  s1(a); t1(a); : : : ;  sp(a); tp(a)	s.t. P is realizable by an LK-proof with end sequent ( ! )fsn(0)=ag i fsn(0)=ag has a solution.But fsn(0)=ag is either solvable for all n  m and unsolvable for n < m, or foronly one n. To see this, calculate the most general semi-unier  of f(s1; a); f(t1; a); : : : ;  f(sp ; a); f(tp; a)	5 (see below, Proposition 5.4).  assigns to a either a term of the form sm(0) (onesolution for n = m) or one of the form sm(b) (a solution for every n  m) (cf.Baaz [1993]).For LK, such an undecidable proof analysis exists, cf. Krajicek and Pud-lak [1988], Section 5.4.7. Theorem k=l-Compressibility is undecidable for linear LKB -proofs.Proof. We exhibit a class C of semi-unication problems whose solvability is un-decidable and then show that for 2 C there is a sequent  !  s.t.(1)  !  has a proof (with cut) of length l i has a solution, and(2)  !  has a proof of length l + C.Let C consist of = f(s1; t); (s2; t)g where(1) (8x1; : : : ; xn)A (x1; : : : ; xn)! Q is valid for A  P (t)^  P (s1)^P (s2)  Q,(2) s, t1, t2 are pairwise not uniable.We have to prove that C has the desired property that the proof analysis in Propo-sition 4.4 describes an optimal proof of (8x)A (x) ! Q if is solvable, and thatproofs are longer if has no solution. Then we construct a longer proof analysisthat is realizable by an LKB -proof with the same end sequent for all 2 C.First of all, C is undecidable because of the following: (a) By Theorem (ii) ofPudlak [1988], every semi-unication problem can be translated into a problemof the form = f(s01; t0); (s02; t0)g. Every such problem can in turn be rewrittenas 0 =  f(g(a); s1); f(a; t);  f(h(a); s2); f(a; t)	, where a is a new variable. 0obviously has the same solutions as , but the components of the two equations arepairwise not uniable.(b) Validity of (8x)A (x) ! Q is decidable. This follows from the fact that thefollowing resolution proof exists i (8x)A (x)! Q is valid:fP (t)2g fP (t)1g f:P (s1);:P (s2); Qgf:P (s2)1; Qg 1fQg 2 fQg2 idwhere 1, 2 are renamings of variables. Consequently the following equations hold:P (t)112 = P (s1)12(since P (t)11 = P (s1)1)P (t)22 = P (s2)12The crucial point for the encoding of semi-unication problems by the proof analysisand end sequent (8x)A (x) ! Q is that (8x)A (x) is \produced" only once, i.e.,that (a + 1) is ancestor to both premises of the cut (d). We can force this to bethe case by replacing A (a) by :2rA (a), where r is suciently large to make aseparate deduction|by copying the part of the analysis above (a + 1)|too costly.Let (8x):2rA (x)! A0 be the sequent at (a+1). We have (1) :2rA (x) ! A0for some  and (2) Q has to be derived from A0. Take the shortest derivations of (1)and (2). The shortest derivation of Q must contain a quantied cut, since s1, s2, tare pairwise not uniable. If (s1; t); (s2; t) is not semi-uniable, one universal orexistential cut is not sucient. The universal cut in the analysis given in the proofof Proposition 4.4 is the simplest possible one(This is intuitively clear, a rigorousproof would use analoga to Propositions 4{9 of Buss [1991]).6 Now we show that there is a uniform way of deriving valid sequents(8x):2rA (x)! Q(which of course is longer than the one using the solution to the semi-unicationproblem ). Given 1, 2, 1, 2 from the above resolution deduction, the followinggives a proof: 8>>;propositional inferences(a) :2rA(a1; : : : ; an)! A(a1; : : : ; an)(a+ 1) (8x1) : : : (8xn):2rA(x1; : : : ; xn)! A(a1; : : : ; an)8>>>>;propositional inferences includingpropositional cuts from (a + 1)(b) (8x1) : : : (8xn):2rA(x1; : : : ; xn)! P (t)(b+ 1) (8x1) : : : (8xn):2rA(x1; : : : ; xn)! (8y1) : : : (8ym)P (t)() P (t)112 ! P (t)112(+ 1) (8x1) : : : (8xn)P (t)! P (t)112() P (t)22 ! P (t)22( + 1) (8x1) : : : (8xn)P (t)! P (t)22( ) (8x1) : : : (8xn)P (t)! P (t)112 ^ P (t)228>>>>>;propositional inferences includingpropositional cuts from (a + 1)(c) P (s1) ^ P (s2); (8x1) : : : (8xn):2rA (x1; : : : ; xn)! Q(c+ 1) (9x1) : : : (9xn) P (s1) ^P (s2); (8x1) : : : (8xn):2rA (x1; : : : ; xn)! Q8>>;propositional inferences() P (s1)12 ^ P (s2)12 ! P (s1)12 ^ P (s2)12( + 1) P (s1)12 ^ P (s2)12 ! (9x1) : : : (9xn) P (s1) ^P (s2)8>>;cut from ( ) and ( + 1)(") (8x1) : : : (8xn)P (t)! (9x1) : : : (9xn) P (s1) ^ P (s2)8>>;two cuts from (b+ 1), (c+ 1), (")(e) (8x1) : : : (8xn):2rA (x1; : : : ; xn); (8x1) : : : (8xn):2rA (x1; : : : ; xn)! Q(e + 1) (8x1) : : : (8xn):2rA (x1; : : : ; xn)! QFor the cut resulting in ("), recall that P (t)112 = P (s1)12 and P (t)22 =P (s2)12. 25 k=l-Compressibility is decidable for tree-like LKB -proofsFor tree-like LKB -analyses there is a procedure to decide realizability, given theanalysis and end sequent. This procedure uses special semi-unication problems7 to determine the term structure of the proof. These problems are decidable, andfurthermore a most general solution can be found, which guarantees term-minimalproofs.5.1. Definition A semi-unier  of a semi-unication problem is called mostgeneral semi-unier, if every semi-unier 0 of can be written as , for somesubstitution . The most general semi-unier is unique up to renaming of variables.In contrast to second order unication, semi-unication has the property thatmost general semi-uniers exist, if any exist at all:5.2. Proposition There is an algorithm computing the most general semi-unierof a given semi-unication problem if any semi-unier for exists.See Baaz [1993] orKfoury et al. [1990] for details. The algorithmworks roughlyas follows: Let f(s1; t1); : : : ; (sn; tn)g be the given semi-unication problem, and leti be disjoint canonical renamings of the variables in ti. Unify tii with si. Applythe resulting unier to the problem and repeat the process, until the unier is only arenaming of variables or until unication fails, in which case there is no semi-unier.The procedure will not always terminate, since semi-unication is undecidable, butwill produce a most general semi-unier if there is any semi-unier. In what followswe will only use a decidable class of semi-unication problems for which the algorithmterminates after one step:5.3. Definition Let t be a term and a1, : : : , an be a sequence of variables.t  ha1; : : : ; ani := f(: : : f(f(t; a1); a2) : : :an)5.4. Proposition Let be a semi-unication problem of the form s1  ha1; : : : ; ani; t1  ha1; : : : ; ani; : : : ;  sr  ha1; : : : ; ani; tr  ha1; : : : ; ani	;where the variables in s1, : : : , sr are among a1, : : : , an, and let i be disjoint canon-ical renamings of the variables in ti. Let  be the most general unier of s1  ha1; : : : ; ani; t1  ha1; : : : ; ani1; : : : ;  sr  ha1; : : : ; ani; tr  ha1; : : : ; anir	;If  exists, then  is also a most general semi-unier of , otherwise is unsolvable.Proof.  is also a most general unier of f(s1; t101); : : : ; (sr ; tr0r)g, where 0iis a renaming of the variables occuring in ti other than a1, : : : , an. Let ti ti(a1; : : : ; an; b1; : : : ; bm). Thenti = ti(a1; : : : ; an; b1; : : : ; bm)(b1, : : : , bm do not occur in s1, : : : , sr !) andsi = ti(a1; : : : ; an; b10i; : : : ; bm0i): 25.5. Proposition Let P be a tree-like proof analysis with given end sequent. Ifthere is an LKB-proof D realizing P , then there also is a proof D0 with the followingproperties:(1) D0 is regular (no two strong quantier inferences have the same eigenvariableand eigenvariables do not occur in the end sequent).8 (2) If P contains a sequence of applications of (8B:left) to the same formula, thenD0 introduces all quantiers in the rst of these applications, and all follow-ing (8B:left) inferences in the sequence are empty introductions. Similarly for(9B:right)(3) If P contains a sequence of applications of (8B:right) to the same formula, thenD0 introduces all quantiers in the last of these applications, and all preced-ing (8B:right) inferences in the sequence are empty introductions. Similarly for(9B:left)Proof. (1) In a tree-like proof, eigenvariables can be renamed to ensure regularity.(2), (3) If strong quantier inferences are moved downwards and weak quantierinferences are moved upwards in a regular proof tree, the eigenvariable conditionscan be protected by renaming. 25.6. Theorem Realizability is decidable for tree-like LKB -proof analyses.Proof. Given a tree-like proof analysis P and an end sequent  ! , we constructa preproof (P; ! ). A preproof is an assignment of formulas to the nodes ofthe analysis P such that all inferences except quantier inferences introducing cut-formulas are in correct form (i.e., valid applications of the rules), and a substitutionfor free variables will \correct" the cuts as well. is term-minimal, i.e., ifD is a proofrealizing P , then D can be written as , for some substitution . The constructionis similar to the construction of cut-free term-minimal tree-like proofs in Krajicekand Pudlak [1988], Section 2.Constructing a preproof Since LKB -analyses contain the names of predi-cates in axioms and weakenings, the logical structure of a proof is uniquely deter-mined (cf. Proposition 5.5) except for the quantier prex of the cut formulas inuniversal and existential cuts. We index the universal and existential cuts by 1,2, : : :(1) Determine the propositional structure of from P . Use dierent free variablesfor every term position in the predicates. For quantier prexes use special quan-tier prex variables (8Bi), (9Bi).(2) Unify the end sequent of with  ! , and proceed upwards in the proof treeas follows:(a) Unify conclusions of propositional inferences, exchanges, contractions, andweakenings with the respective premises.(b) In strong quantier inferences not introducing cut formulas, e.g.,  0 ! 0; A0  ! ; (8x1) : : : (8xn)A(x1; : : : ; xn) (8B :right)unify   ,  with   0,0, and A(c1; : : : ; cn) with A0, where c1, : : : , cn arenew free variables which are handled as constants to avoid substitution intoeigenvariables, similarly for (9B :left).(c) In weak quantier inferences not introducing cut formulas, e.g.,A0;   0 ! 0(8x1) : : : (8xn)A(x1; : : : ; xn);   !  (8B :left)unify   ,  with   0,0, and A(z1; : : : ; zn) with A0, where z1, : : : , zn are newvariables, similarly for (9B :right).(d) Unify A and A0 in axiomsA! A0 and unify the cut formulas in the premisesof a cut. 9 As can easily be seen, the steps in the construction are all as general as possible andthe restrictions imposed by the unications are all necessary. If the procedure failsto nd a preproof (i.e., one of the unications fails or eigenvariable conditions areviolated), P is not realizable with end sequent  ! .To complete the preproof to a proof we now have to determine the quantierprexes and the term structure of the universal and existential cut formulas. Werst illustrate this:5.7. Example .... 1 ! 1; A1 1 ! 1; (8B-)A .... 2 ! 2; (8B-)A;A2 2 ! 2; (8B-)A; (8B-)A  2 ! 2; (8B-)A ....A3;  3 ! 3(8B-)A; 3 ! 3 ....A4;  4 ! 4(8B-)A; 4 ! 4....(8B-)A; 5 ! 5 2;  5 ! 2;5Let P1 (P2) denote the part of the preproof above the end sequent and below  ().If  is an extension of the preproof to a proof, then (a) the eigenvariables of () donot occur in P1 and (b) the eigenvariables of () do not occur in P2. This leadsto the semiunication problem(A2  hai; A1  hai); (A3  hai; A1  hai); (A4  hai; A1  hai)	;where a are the free variables in P1. Let 1 be the most general semi-unier. Next,determine the most general semi-unier 2 of(A31  hbi; A11  hbi); (A41  hbi; A11  hbi)	;where b are the free variables in P21. We obtain:A112 = A(c1; : : : ; cr)A212 = A(g1(d1; : : : ; ds); : : : ; gr(d1; : : : ; ds))A312 = A(g1(t1; : : : ; ts); : : : ; gr(t1; : : : ; ts))A412 = A(g1(t01; : : : ; t0s); : : : ; gr(t01; : : : ; t0s))Since the ci do not occur in P212, ci can be replaced by gi(d01; : : : ; d0s). Finally, re-place (8B-)A by (8z1 : : : zs)A(g1(z1; : : : ; zs); : : : ; gr(z1; : : : ; zs)). (Any permutationof z1 : : : zs can be chosen.)Correction of cuts To correct cuts in the general case, we associate witheach universal or existential cut i the set of strong propositional premises Prms(i)and weak propositional premises Prmw(i). Recall that 8 (9)-introduction is strong(weak) on the right side and weak (strong) on the left side. Thus, Prms(i) is theset of those formulas Aj that are ancestors to the cut formula on the strong sideof the cut (A1, A2 in Example 5.7), and Prmw(i) is the set of those formulas Ajthat are ancestors to the cut formula on the weak side of the cut (A4, A5). LetD = Si Prms(i)Dene a partial order  on D, according to where in the proof Aj is quantiedto yield the cut formula (8Bi)A: Aj  Ak if Aj is quantied below Ak (A2  A1).The exclusion area D(Aj ) of the proof corresponding to Aj is the part above the endsequent and below the premise of this quantier inference (D(A1) = P1, D(A2) =P2). 10 Balancing cuts Select a maximal element Aj 2 D and compute the mostgeneral semi-unier j of the problem(Ak  ha1; : : : ; ani; Aj  ha1; : : : ; ani) Ak 2 Prmw(i)	[[ (Al  ha1; : : : ; ani; Aj  ha1; : : : ; ani) Al 2 Prms(i); Aj 6 Al	where Aj 2 Prms(i) and a1; : : : ; an are the free variables in D(Aj). Apply j tothe preproof and repeat this process for D := (D nAj)j until D = ;.Call a free variable in Aj critical for Aj if it does not occur in D(Aj) and letcrit(Aj) be the set of all free variables critical for Aj . A variable is critical for thecut i if it is critical for one of its strong premises.The critical variables of a strong premise Aj of j are the potential eigenvariablesfor the introduction of quantiers on Aj: The above semi-unications make all strongand weak premises A0 in D(Aj ) corresponding to the same cut as Aj substitutioninstances of Aj (A2 is a substitution instance of A1, and A3, A4 are substitutioninstances of both A1, A2). By the *-construction in the semi-unication problemsabove, if A0 = Aj for some substitution , then  only acts on crit(Aj). Note thatthe critical variables fulll the eigenvariable condition.If Aj and Ak are two premises of the cut i, then the critical variables of Aj donot occur in Ak and vice versa (If c 2 crit(Aj) and Aj  Ak then c occurs in D(Ak)and hence cannot be critical for Ak. If c would occur in Ak, then it would also occurin a weak premise of the cut (by the above semi-unications), but this premise isin D(Aj). If, on the other hand, Ak is in D(Aj), then c does not occur in Ak bydenition). Critical variables for one cut premise are not critical variables for anyother cut (For any two premises Aj and Ak, either Aj is in D(Ak) or vice versa).Unifying premises Now let Aj(c1; : : : ; cs) be one of the possibly several -minimal strong premises of the cut i, where c1, : : : , cs are the critical variablesof Aj. Aj is the least general of the strong premises and therefore determines theterm structure of the cut formula (A2 in the example). Unify every other premiseA0 of i with Aj, where  is a a disjoint canonical renaming of the critical vari-ables of Aj. The unier acts only on critical variables of this cut. This makes allstrong premises of i equal up to renaming of critical variables. Recall that theweak premises are substitution instances of Aj and hence, are now of the formAj(t1; : : : ; ts). Replace the cut formula (8Bi)A by (8v1) : : : (8vs)A(v1; : : : ; vs) ((9Bi)A by (9v1) : : : (9vs)A(v1; : : : ; vs)). Repeat this step for every cut in the preproof.The resulting proof is uniquely determined up to the order of the quantiers in cutformulas.The unifying of premises may in uence other cuts, but since critical variablesare disjoint for dierent cuts, this has no eect on other cuts being balanced orunied. All correction steps with exception of the last one are most general andforced by the information provided by the proof analysis and end sequent. Hence, ifthe correction fails at any step, or if eigenvariable conditions on variables introducedin the construction of the preproof are violated, there is no proof extending thepreproof. 25.8. Corollary k-Provability is decidable for LKB .5.9. Corollary k=l-Compressibility is decidable for LKB .5.10. Remark The term depth d0 of the constructed proof can be very roughlybounded by d0  d  2mll , where d is the maximal term depth and m the num-ber of quantied variables in the given end sequent  ! , and l is the length ofthe proof analysis.The construction of the preproof for  !  introduces at most m new variablesin each step, and at mostml overall. The correction of a strong premise introduces at11 most (l 1)v variables, where v is the current number of variables. The disappearanceof a variable in a unication step increses the term depth at most by a factor of 2.If every bound variable occurs only once in the end sequent, then d0 = d.6 ConclusionTwo fundamental distinctions have been made in this paper:(a) The distinction between systems that introduce one (or any xed number)quantier and systems that introduce blocks (an unknown number) of quantiers ofthe same type in one introduction. Our results show that a committment on the formof these blocks of quantiers, while irrelevant for cut elimination, is disadvantageousfor the algorithmic introduction of cuts into a given proof. This is generally thecase with constructions that depend on operations on the term structure, e.g. whengeneralizing proofs, and is essentially due to the fact that second order unicationproblems (that correspond to single introduction of quantiers) do not have mostgeneral solutions, in contrast to semi-unication problems (that correspond to blockintroduction of quantiers, cf. Baaz [1993])(b) The distinctions between linear and tree-like ways to write proofs. Until the1950s, linear notation of proofs was commonplace in logic, but since then has almostdisappeared. In computer science, linear proofs have been reintroduced, cf. reso-lution deductions where one and the same clause is used several times. The morespace ecient linear notation, however, has serious drawbacks when the relationshipbetween quantiers in a given proof is investigated.The problem of structuring of proofs itself will be of importance to computerscience, since it is closely related to structuring of programs. If we conceive of proofcomplexity as the degree of entanglement (e.g., as the topological genus of the proofanalysis, cf. Statman [1974]), then structuring means algorithmic simplication.For proof theory, the signicance of the problem is that it enables us to separatemodel-theoretically indistinguishable systems according to their structural proper-ties (cf. (a), (b) above). For a detailed discussion of this aspect, cf. G. Kreisel'spostscript to Baaz and Pudlak [1993].ReferencesBaaz, M.[1993] Note on the existence of most general semi-uniers. In Arithmetic, ProofTheory and Computational Complexity, P. Clote and J. Krajcek, editors, pp.19{28. Oxford University Press.Baaz, M. and P. Pudlak.[1993] Kreisel's conjecture for L91. In Arithmetic, Proof Theory and ComputationalComplexity, P. Clote and J. Krajcek, editors, pp. 29{59. Oxford UniversityPress.Buss, S. R.[1991] The undecidability of k-provability. Ann. Pure Appl. Logic, 53, 75{102.Farmer, W. M.[1991] A unication-theoretic method for investigating the k-provability problem.Ann. Pure Appl. Logic, 51, 173{214.Gentzen, G.[1934] Untersuchungen uber das logische Schlieen I{II. Math. Z., 39, 176{210,405{431.Kfoury, A. J., J. Tiuryn, and P. Urzyczyn.[1990] The undecidability of the semi-unication problem. In Proc. 22nd ACMSTOC, pp. 468{476. journal version to appear in Inf. Comp.12 Krajicek, J. and P. Pudlak.[1988] The number of proof lines and the size of proofs in rst order logic. Arch.Math. Logic, 27, 69{84.Parikh, R. J.[1973] Some results on the length of proofs. Trans. Am. Math. Soc., 177, 29{36.Pudlak, P.[1988] On a unication problem related to Kreisel's conjecture. Comm. Math. Univ.Carol., 29(3), 551{556.Statman, R.[1974] Structural Complexity of Proofs. PhD thesis, Stanford University.Tait, W. W.[1968] Normal derivability in classical logic. In The Syntax and Semantics ofInnitary Languages, J. Barwise, editor, pp. 204{236. Springer, Berlin.