Sindbad~EG File Manager
����; � TeX output 2002.10.11:0821� ������ ���R �� ����fb�� �X����N� G� cmbx12�Solving�z�F��aGor�F�unctions��#�� �����@ cmti12�Michael�35Be��ffeson��� �� ����-�
cmcsc10�San���Jose�St��32a�te���University���� �42Ma��32th���&�Computer�Science���� ��fSan���Jose,�CA�95192��� �"� �� �3��)��N� cmbx12�Abstract�����4 �*K�`y
�3
cmr10�Buc��!h�b�M�erger�5has�emphasized�that�automated�deduction�in��!v�olv�es�5computa-��
����4 tion,��1pro��!ving,�and�solving.�When�the�ob� ��ject�to�b�M�e�\solv�ed�for"�is�a�func-����4 tion,�#�second-order�unication�can�b�M�e�a�v��!ery�p�o��!w�erful�#�and�general�solution����4 to�M�ol.��AAn�algorithm�for�second-order�unication�w��!as�giv�en�in�(�8��y�).�This�algo-����4 rithm�|�is�no��!w�b�M�eing�implemen�ted�in�the�source�co�M�de�of�Otter;�this�algorithm����4 diers���from�the�earlier�algorithm�giv��!en�b�y�Pietrzyk�olski�(�22��
�4).�Sev�eral�ex-����4 amples��are�giv��!en�to�illustrate�the�wide�range�of�p�M�oten�tial�applications����4 of�zCthis�algorithm�and�its�implemen��!tation�in�a�p�M�o�w�erful�clausal�theorem����4 pro��!v�er,�
�including�the�abilit��!y�to�manipulate�quan�tiers�at�the�clausal�lev�el,����4 so��'that�denitions�in��!v�olving��'quan�tiers�can�b�M�e�con�v�enien�tly�used�in�pro�M�ofs.����4 Since�W�predicates�are�considered�as�Bo�M�olean-v��dDalued�functions,�solving�for����4 functions��\includes�solving�for�predicates,�and�second-order�unication�can����4 help��:rst-order�pro��!v�ers��:with�pro�M�ofs�b��!y�induction.�Other�examples�sho�w����4 pro�M�ofs�N�in�whic��!h�the�function�to�b�e�solv��!ed�for�is�a�one-to-one�corresp�on-����4 dence��d(in�set�theory)�or�a�group�isomorphism.�There�is�also�a�detailed����4 comparison���of�the�new�second-order�unication�algorithm�with�the�older����4 one.�������K� cmsy8���������4 �KEYW��!ORDS:�n�automated�deduction,�computer�pro�M�ofs,�unication,�second-����4 order,��fOtter��� �$ �� �=��N� ff cmbx12�In���tro�s3duction��� �� �X�Q cmr12�In��previous�w��rork�(�4���;��7��
��),�the�author�has�fo�S�cused�atten�tion�on�the�relation�b�S�e-��� �� t��rw�een�A�computation�and�logic�in�automated�deduction.�In�the�dev��relopmen�t�A�of���� �The��ffor�ema�,�ߦBuc��rh�b�S�erger�(�13����)�w�as�guided�b�y�his�vision�that�mathematics�in�v�olv�es���� �thr��ffe�e��_�essen��rtial�comp�S�onen�ts:�logic�(pro�ving),�computation,�and��solving�.�Solving�� �����#g��^��O!� cmsy7�����( �K�`y
cmr10�Researc���h�UUsupp�Gorted�b�y�NSF�gran�t�n�um�b�Ger�CCR-0204362.��� ��� *�� ���R ��� ��=�Solving��fF��eor�F�unctions���� ���� �� �means�&�nding�an����g� cmmi12�x��with�certain�desired�prop�S�erties.�Often�the�\solving"�step�of��� �� a�=�pro�S�of�is�the�\k��rey"�step,�the�one�that�seems�to�demand�\creativit�y".�Buc�h-���� b�S�erger���emphasizes�the�imp�ortance�of�adding�(man��ry)�sp�ecial-purp�ose�\solv��rers"���� to��a�computerized�mathematical�system.�In�this�pap�S�er,�b��ry�con�trast,�w�e�wish�to���� fo�S�cus�+�on��gener��ffal��solution�tec��rhniques,�as�opp�osed�to�sp�ecial�algorithms�that�apply���� to��a�sp�S�ecic�mathematical�theory��V.����!��Solving��prefers�to�tec��rhniques�for�instan�tiating�a�v��X�ariable.�The�traditional�metho�S�d���� of�<yinstan��rtiating�v��X�ariables�used�in�automated�deduction�is�unication.�It�is�kno�wn���� that,��with�resp�S�ect�to�rst-order�logic,�this�metho�d�is�\univ��rersal",�in�the�sense���� that�J�there�are�completeness�theorems�for�v��X�arious�systems�of�inference�in�whic��rh���� unication�ȗis�used�to�instan��rtiate�the�v��X�ariables.�F��Vor�example,�binary�resolution���� with�wmunication�is�complete,�and�bac��rkw�ards�wmapplication�of�the�Gen��rtzen�sequen�t-���� calculus�trules,�guided�b��ry�unication,�is�complete.�But�when�w�e�go�to�mathemat-���� ics,�unication�do�S�es�not�seem�to�do�the�job.�F��Vor�example,�if�w��re�w�an�t�an��x��suc�h���� that��i�x����2�|{Y cmr8�2�����+���ax��+��b�UR�=�0,�w��re�need�the�quadratic�theorem,�not�unication.�Therefore,���� as��Buc��rh�b�S�erger�has�emphasized,�sp�ecial-purp�ose�solv��rers�are�required�to�deal�with���� the��dieren��rt�sp�S�ecialized�branc�hes�of�mathematics.����!��Our���fo�S�cus�in�this�pap�er�is�on�situations�where�w��re�need�to�\solv�e�for"�a�function,���� rather�#�than�an�elemen��rt�or�ob� �ject.�W��Ve�will�exhibit�a�n�um�b�S�er�of�examples�of�pro�ofs���� of���this�kind,�to�illustrate�the�claim�that�\solving�for�a�function"�is�a�theme�that���� p�S�ermeates�A�dieren��rt�branc�hes�of�mathematics.�Just�as�this�is�a�general�theme���� in�FQmathematics,�there�is�a�general�to�S�ol�in�logic�to�help�with�this�kind�of�pro�of.���� There�is�a�w��rell-kno�wn�\unication�algorithm"�whic��rh�can�b�S�e�though�t�of�as�solving���� equations�!b�S�et��rw�een�terms�denoting�ob� �jects.�There�is�also���-calculus,�whic�h�lets�us���� dene���terms�for�denoting�functions.�There�is�a�w��ra�y���(in�fact,�more�than�one�w��ra�y)���� to���generalize�the�unication�algorithm�so�that�it�can�b�S�e�though��rt�of�as�solving���� equations��@b�S�et��rw�een�terms�denoting�functions,�rather�than�ob� �jects.�This�is�kno�wn���� as�se��ffc�ond-or�der�35unic�ation�.����!��Our�9Lmotiv��X�ation�in�this�pap�S�er�is�to�sho��rw�that,�ev�en�though�sp�S�ecial-purp�ose���� solv��rers��are�useful�for�sp�S�ecialized�mathematics,�w�e�can�get�some�surprising�(and���� in� �some�cases�unexp�S�ected)�results�from�general�metho�ds�based�on�second-order���� unication.����!��The�|<problems�addressed�here�are:�Ho��rw�are�the�existing�notions�of�second-���� order�8unication�related?�Can�second-order�unication�b�S�e�fruitfully�used�in�a���� rst-order���theorem-pro��rv�er?�Whic�h�is�the�b�S�est�notion�of�unication�to�use�in���� automated��deduction?�Is�it�feasible�to�add�second-order�unication�to�an�existing���� pro��rv�er��y(Otter),�whic��rh�already�has�a�large�group�of�users?�Ho�w�can�w�e�exp�S�ect���� this��capabilit��ry�to�b�S�e�useful�in�automated�deduction?����!��These�|questions�ha��rv�e�|not�b�S�een�answ��rered�un�til�no�w.�One�reason�for�this�is���� that�the�ma� �jorit��ry�of�w�ork�in�automated�deduction�has�b�S�een�done�(so�far)�b�y���� rst-order��theorem�pro��rv�ers,��but�second-order�unication�has�so�far�b�S�een�(incor-���� rectly)���view��red�as�incompatible�with�rst-order�pro�v�ers.�Another�reason�is�that���� serious�{.automated�deduction�has�so�far�b�S�een�done�in�theories�with�a�single�short���� list�m
of�axioms,�referring�to�only�one�kind�of�mathematical�ob� �jects,�rather�than�in���� more���complex�mathematical�en��rvironmen�ts,���where�second-order�unication�migh��rt�����
��� ���R ��� ����M.��fJ.�Beeson���� ���� �� �pro��rv�e���helpful.�A��|third�reason�is�that�second-order�unication�is�considered�in-��� �� ecien��rt�(it�pro�S�duces�innitely�man�y�uniers,�it�necessarily�pro�S�duces�redundan�t���� uniers,��it�in��rv�olv�es��an�exp�S�onen��rtial�searc�h,�etc.)����!��The��main�p�S�oin��rts�of�the�pap�er�are����!��(i)�A&Second-order�unication�can�b�S�e�though��rt�of�as�\solving�for�a�function",�that���� is,�?�nding�a�term�that�denes�a�function�with�desired�prop�S�erties�to�complete�a���� pro�S�of.����!��(ii)��PSome�mathematical�problems�that�ma��ry�not�app�S�ear�to�ha�v�e�the�form�of���� \solving�_�for�a�function"�can�b�S�e�recast�in�that�form,�so�that�second-order�uni-���� cation�H,can�b�S�e�used�on�them.�Others�are�naturally�of�that�form.�A�Hv��rery�general���� \solv��rer"� Xcan�b�S�e�useful,�b�ecause�solving�for�functions�o�ccurs�generally�in�mathe-���� matics.����!��(iii)�a�Second-order�unication�can�b�S�e�implemen��rted�and�used�in�Otter,�a�rst-���� order�edtheorem-pro��rv�er�already�widely�used�(�19����).�There�is�nothing�strange�or�di-���� cult��kab�S�out�using���-calculus�and�\second-order"�unication�in�a�rst-order�pro��rv�er.���� Sample��pro�S�ofs�pro�duced�b��ry�the�new�implemen�tation�in�Otter�are�exhibited.����!��(iv)�.FT��Vec��rhnical�diculties�concerning�eciency�,�non-termination,�redundancy�,���� etc.,�p�are�minimized�if�w��re�use�the�notion�of�unication�in�tro�S�duced�in�(�8���)�rather���� than��the�one�in�(�22����;��18����).�These�notions�are�compared�here.����!��(v)��Quan��rtication�can�b�S�e�dened�in�terms�of���-calculus,�and�second-order���� unication�Dgmak��res�it�p�S�ossible�to�use�quan�tiers�in�Otter�pro�S�ofs�at�the�clausal���� lev��rel.�T:This�is�v�ery�imp�S�ortan�t�as�it�will�enable�Otter�to�w�ork�with�denitions���� in��rv�olving���quan�tiers,�suc�h�as�the�relation�\�u��divides��v�n9�"�on�the�natural�n�um�b�S�ers.����!��(vi)��Set�theory�to�S�o�is�naturally�treated�as�a�branc��rh�of���-calculus.�This�is�not���� an��original�idea�but�go�S�es�bac��rk�to�Ch�urc�h.����!��W��Ve��
shall�giv��re�a�motiv��X�ating�example.�In�undergraduate�courses�in�algebra,�what���� is��Ftaugh��rt�as�\group�theory"�usually�in�v�olv�es�the�study�of�groups�and�subgroups.���� See���e.g.�the�rst�45�pages�of�(�15����)�for�the�mathematics�in�question.�The�notation���� �a����2��2 cmmi8�n�� �Ϲis��in��rtro�S�duced,�where��n��is�a�natural�n�um�b�S�er,�and�one�of�the�early�theorems�is���� Lagrange's��theorem,�according�to�whic��rh�the�order�of�a�subgroup��H��i�of�a�nite���� group�au�G��divides�the�order�of��G�.�This�theorem�in��rv�olv�es�augroups,�subgroups,�and���� natural��n��rum�b�S�ers.�Its�pro�of�b�egins�b��ry�sho�wing�that�eac�h�coset��H� �Va��is�in�one-to-one���� corresp�S�ondence��bwith��H� �V�.�That�is,�there�exists�a�function��f��a�mapping��H����one-to-���� one��on��rto��H� �Va�.�That�function,�of�course,�is��x:xa�.�The�pro�S�of�therefore�in�v�olv�es�a���� small��amoun��rt�of�set�theory�to�deal�with�cosets�and�one-to-one�corresp�S�ondences,���� as�Ow��rell�as�enough�n�um�b�S�er�theory�to�deal�with�\divides".�W��Ve�will�sho�w�in�the�last���� section��\of�this�pap�S�er�that�second-order�unication�can�instan��rtiate�the�v��X�ariable��f���� �prop�S�erly��to�do�the�k��rey�step�of�this�pro�of�automatically��V.����!��Buc��rh�b�S�erger's�oaim�in�dev��reloping��The��ffor�ema�o�has�b�een�to�dev��relop�an�in�teractiv�e���� en��rvironmen�t� �in�whic��rh�h�umans�can�dev�elop�computer-c�hec�k�ed�pro�S�ofs�in�a�math-���� ematical��0con��rtext�lik�e�this,�in�whic�h�(elemen�ts�of� �8)�sev�eral�dieren�t�branc�hes�of���� mathematics���are�a��rv��X�ailable�at�the�same�time.�One�dicult�y�in�suc�h�an�en�terprise���� is��]that�the�pro�S�of-c��rhec�k�er��]ma�y�require�an�unacceptably�large�lev�el�of�detail.�P�eo-���� ple�,refer�to�the�\expansion�factor",�b��ry�whic�h�a�page�of�pro�S�of�written�b�y�and���� for�w�h��rumans�expands�to�ten�or�more�pages�of�computer-c�hec�k��X�able�pro�S�ofs.�If�the����� G�� ���R ��� ��=�Solving��fF��eor�F�unctions���� ���� �� �details�Hcould�b�S�e�tak��ren�care�of�automatically��V,�that�w�ould�adv��X�ance�the�sub� �ject.�On��� �� the��other�hand,�some�researc��rhers�in�automated�deduction�ha�v�e�fo�S�cused�on�the���� attempt�m�to�ha��rv�e�m�the�computer�pro��rv�e�m�results�not�previously�pro��rv�ed�m�b�y�h�umans.���� So��far,�these�eorts�ha��rv�e��b�S�een�successful�only�in�areas�that�can�b�e�axiomatized���� b��ry�0ma�few�simple�axioms,�and�studied�in�isolation�from�the�rest�of�mathematics.���� W��Ve��view�our�w��rork�as�directed�to�w�ards�op�S�ening�up�wider�horizons�to�automated���� deduction��in�the�future,�not�necessarily�just�as�supp�S�ort�for�pro�of-c��rhec�king.��$ �� �Solving�fffor�functions�in�mathematics��� �� �In�`this�section,�w��re�will�illustrate�the�theme�that�\solving�for�functions"�o�S�ccurs���� across���the�b�S�oard�in�dieren��rt�branc�hes�of�mathematics.�W��Ve�ha�v�e�already�giv�en�the���� example�]�of�Lagrange's�theorem�in�algebra.�The�con��rtext�of�Lagrange's�theorem�is���� t��rypical��%of�a�great�deal�of�mathematics:�a�little�set�theory��V,�a�little�n�um�b�S�er�theory��V,���� sometimes��a�little�calculus.�Tw��ro�kinds�of�ob� �jects�are�considered�(n�um�b�S�ers�and���� elemen��rts���of�the�group),�along�with�sets�of�ob� �jects�(subgroups),�functions�from���� ob� �jects�1Nto�ob�jects�(isomorphisms,�etc.),�and�functions�from�ob�jects�to�n��rum�b�S�ers���� (the�̄order�of�an�elemen��rt),�and�ev�en�functions�from�sets�of�ob� �jects�to�n�um�b�S�ers�(the���� order�5�of�a�group,�the�index�of�a�subgroup).�Ob� �jects�of�greater�complexit��ry�than���� that��iare�not�required.�The�recen��rtly�announced�p�S�olynomial-time�primalit�y�test���� (�1���),��for�example,�whic��rh�w�as�hailed�in�the��New���Y���ork�Times���(Aug.�8,�2002)�as�the���� b�S�est��,result�in�computer�science�in�the�past�ten�y��rears,�is�actually�mathematics�of���� the��sort�just�describ�S�ed.�One�needs�in��rtegers,�in�tegers�mo�S�d��p�,�and�p�olynomials�o��rv�er���� �Z����p���]�,���groups�and�their�orders,�but�nothing�more�complicated.�F��Vermat's�conjecture���� and�"Dits�long�and�complex�pro�S�of�not��rwithstanding,�if�automated�deduction�could���� deal��successfully�with�the�simple�kinds�of�con��rtexts�just�describ�S�ed,�the�sub� �ject���� w��rould��adv��X�ance�rapidly��V.����!��W��Ve�R�b�S�egin�with�set�theory�.�Consider��S�)�=�UR�!",�
cmsy10�f�n��:��P��ƹ(�n�)�g�,�R�where��P��b�is�some�prop�S�ert��ry���� of��_in��rtegers.�F��Vor�simplicit�y�let�us�just�consider�sets�of�in�tegers.�The�c�haracteristic���� function�f�����S��
��is�dened�b��ry������S���(�n�)�'R=�1�fif��n�'R�2��S� �,�f0�if��n�'R�62��S��.�fWhat�is�the�relation���� b�S�et��rw�een�������S�� ���and��S� �?�The�logician�Alonzo�Ch��rurc�h��suggested�that�in�fact�the�set��is���� �just���its�c��rharacteristic�function.�(See�the�App�S�endix�of�(�2���).)�According�to�Ch�urc�h,���� an��ry��#set�is�a�b�S�o�olean-v��X�alued��#function,�and��n�3��2��S�L��is��#just�an�abbreviation�for���� �����S���(�n�)���=���true��'5�.���If�w��re�tak�e�this�view,�sets�are�functions,�and�can�b�S�e�dened�b�y���� ��-terms.���Finding�a�set�with�certain�desired�prop�S�erties�b�ecomes�a�sp�ecial�case�of���� solving�g"for�functions.�The�\list�notation"��f�a;���b;�c�g�g"�for�a�nite�set�can�b�S�e�regarded���� as�B�an�abbreviation�for�a�function�dened�b��ry�cases:�if��x��is��a�,�b�,�or��c�,�the�v��X�alue�is���� �true�,��else�it�is��false�.����!��One��gcan�also�use�tuple�notation��h�x;���y�n9�i��and�dene�Cartesian�pro�S�ducts.�Since�our���� in��rterest��Kis�not�foundational,�w�e�ignore�the�issue�of�whether�and�ho�w�tuples�can�b�S�e���� dened���in�terms�of�sets.�W��Ve�assume�that���p�����>2�@� cmbx8�0���&3�and���p�����1����are�pairing�functions�suc��rh�that���� �h��p�����0����i�z� ��;�����p�����1����g�z��i�UR�=��z� ��.�,�W��Ve�sa��ry��A�����P���UR�������n9�=��������B�ǭ�if�there�is�a�one-to-one�corresp�S�ondence�b�et��rw�een�,��A���� �and��a�B� ��.�A��Ksimple�theorem�in�this�sub� �ject�(just�ab�S�out�the�simplest�set-theoretical���� theorem��I���can�think�of� �8)�is�that��A�,����B�����P���6�������O�=�����&��B�����A�.��(\�����P����������=����� UW"�is�read�\equip�S�ollen��rt").���� Ho��rw�d]do�w�e�pro�v�e�that�theorem?�By�solving�for�a�function��f��\�that�maps��A������B����� +ˠ� ���R ��� ����M.��fJ.�Beeson���� ���� �� �one-to-one�2�on��rto��B��p��3j�A�.�W��Ve�migh�t�lik�e�to�write�that�function�as���h�x;���y�n9�i�:�h�y�;�x�i�,�2�but��� �� according�w�to�the�usual�notation�for���-terms,�that�is�not�a�syn��rtactically�correct���� term.��jWhat�w��re�w�an�t�w�ould�b�S�e�formally�written�as��z� ��:�h��p�����1����i�(�z��)�;�����p�����0����g�(�z��)�i�.��jThis�term���� arises�4naturally�as�the�solution�to�a�certain�second-order�unication�problem,���� but��there�is�no�space�here�for�the�details.����!��T��Vurning�A�to�n��rum�b�S�er�A�theory�,�let�us�consider�the�relation��n�j�m�.�T�o�dene�this���� set�å(or�its�c��rharacteristic�function),�w�e�need�an�existen�tial�quan�tier:��n�j�m��means���� �9�k�g�(�n������k��o�=�UR�m�).��<W��Ve�shall�tak��re�up�this�example�in�a�subsequen�t�section,�and�sho�w���� that��]when�the�existen��rtial�quan�tier�is�dened�using���-calculus,�second-order���� unication��can�use�this�denition�to�v��rerify�that�2�j�6�automatically��V.����!��Consider��a�related�but�more�dicult�example,�the�theorem�that�t��rw�o��p�S�ositiv�e���� in��rtegers�H�n��and��m��ha�v�e�a�greatest�common�divisor.�That�is,�there�exists�a�n�um�b�S�er���� �k��/�suc��rh�that��k��divides�b�S�oth��n��and��m�,�and�an��ry�other�in�teger��j�+�that�divides�b�S�oth��n���� �and����m��also�divides��k�g�.�W��Ve�kno��rw,�from�our�mathematical�education,�t�w�o�dieren�t���� w��ra�ys��to�instan��rtiate��k�g�:�as�the�least�n�um�b�S�er�of�the�form��n���+��m�,��where����and���� ����are�(p�S�ositiv��re�or�negativ�e)�in�tegers;�or�as�the�result�of�the�Euclidean�algorithm���� �E� ��(�n;���m�).��9It�seems�that�neither�denition�of��k�V�will�b�S�e�pro�duced�b��ry�unication,���� ev��ren�{�though�the�existence�of�gcd's�follo�ws�in�rst-order�logic�from�the�rst-order���� v��rersion���of�P�eano's�axioms.�Is�that�a�sligh�t�m�ystery��V,�since�unication�is�complete���� for��rst-order�logic?�It�should�not�b�S�e:�Let�us�abbreviate�b��ry��Q�(�n;���m;�e�)��the�form�ula���� that�Ҙsa��rys��e��is�the�gcd�of��n��and��m�.�Then�there�are�certain�instances�of�induction���� (sa��ry��for�simplicit�y�there�is�just�one)��� ��}��I�Fչ:=�UR�8�n�(�P��ƹ(�n�)��!��P��(�n����+�1))�UR�!�8�mP��(�m�)���� suc��rh�z�that�in�rst�order�logic,��I��G�^��Z� ܞ� �J��>��8�m;���n�9�eQ�(�n;�m;�e�).�z�Here��Z�W`�is�the�con-��� �� junction���of�the�non-induction�axioms�of�arithmetic.�Once�the�prop�S�er�form��rula�or���� form��rulas��0�P����is�disco�v�ered,�then�resolution�driv�en�b�y�unication�can,�of�course,���� nd��(the�pro�S�of.�Our�p�oin��rt�here�is�that�nding�this�pro�of�in��rv�olv�es��(as�its�main�task���� the��disco��rv�ery�of�the�appropriate�instance�of�induction�to�use.�No�w�the�prop�S�ert�y���� �P��p�is�H�just�a�b�S�o�olean-v��X�alued�H�function,�and�therefore�second-order�unication�can���� (p�S�oten��rtially)��nd�it.�W��Ve�w�ould�try�to�unify�the�conclusion�of�the�instance�of�in-���� duction,�ː�P��ƹ(�m�),�with�the�theorem�to�b�S�e�pro��rv�ed,�ːin�order�to�nd�an�instan��rtiation���� of��P��ƹ.�Here��P��n�w��rould�b�S�e�regarded�as�a�v��X�ariable�(for�a�function).����!��W��Ve��seem�to�need�t��rw�o��sorts�or�t��ryp�S�es:�n�um�b�S�ers�and�functions.�But�sev�eral�sorts���� (or�Eev��ren�innitely�man�y)�can�b�S�e�reduced�to�rst-order,�using�in�this�case�a�unary���� predicate����N�@�(�x�)�for�the�n��rum�b�S�ers.���W��Ve�could,�if�w��re�lik�ed,�use�another�predicate�for���� functions��from�n��rum�b�S�ers��to�b�o�oleans,�etc.�����2�y����UT�����#�X��^��y����( �The���distinction�b�Get���w�een���rst-order�and�higher-order�logics�is�not�as�imp�ortan���t�as�man�y�� �� p�Geople��assume.�Syn���tactically�the�t�w�o�are�in�tertranslatable,�using�unary�predicates�to�distin-���� guish��Ethe�t���yp�Ges.�The�dierence�arises�in�the��(� ':
cmti10�semantics�.�The�second-order�P�eano�axioms,�for���� example,��ha���v�e�an�instance�of�induction�for�eac�h�subset�of�the�in�tegers,�of�whic�h�there�are���� uncoun���tably��man�y��*�.�The�rst-order�v�ersion�of�the�P�eano�axioms�has�induction�only�for�those���� subsets�� that�can�b�Ge�dened�b���y�rst-order�form�ulas�in�a�xed�language.�Man�y�instances�of���� induction�j�are�th���us�omitted{hence�there�are�non-standard�mo�Gdels.�There�are�no�non-standard���� mo�Gdels�+?of�the�second-order�P���eano�axioms,�as�P�eano�himself�pro�v�ed:�these�axioms�c�haracterize����� =�� ���R ��� ��=�Solving��fF��eor�F�unctions���� ���� ��!���P��reople���sa�y�that�Otter�\can't�do�induction".�But�induction,�with�resp�S�ect�to��� �� rst-order�QKform��rulae,�just�in�v�olv�es�deduction�from�rst-order�axioms,�and�Otter���� is� as�go�S�o�d� at�that�as�at�an��ry�other�kind�of�rst-order�logic.�If�the�user�is�willing���� to��5sp�S�ecify�what�instances�of�induction�are�required,�those�instances�can�b�e�giv��ren���� as�2�axioms�to�Otter,�suitably�Sk��rolemized,�and�Otter�can�nd�the�pro�S�of,�at�least���� in�K5some�examples�I�Kha��rv�e�K5tried.�What�Otter�cannot�do�is�nd�the�correct�instance���� of�6�induction.�This�is�a�problem�in�\solving�for�functions",�since�the�instance�of���� induction��to�b�S�e�found�is�a�b�o�olean-v��X�alued�function.�In�some�cases,�second-order���� unication��can�nd�the�required�instance.����!��One�Jproblem�here�is�that�w��re�often�w�an�t�to�pro�v�e�a�quan�tied�statemen�t���� b��ry��9induction.�F��Vor�example�in�the�case�of�the�existence�of�gcds,�the�conclusion���� �Q�(�n;���m;�e�)��in��rv�olv�es�a�quan�tier.�The�general�plan�in�automated�deduction�has���� b�S�een��to�replace�quan��rtiers�b�y�functions.�Usually�this�is�done�b�y�using�sym�b�S�ols�for���� Sk��rolem�Vkfunctions.�But�if���-terms�are�in�use,�it�is�p�S�ossible�to�deal�with�quan�tiers���� more�mdirectly��V,�using�second-order�unication�to�guide�the�pro�S�of.�W�e�amplify�this���� p�S�oin��rt��in�detail�in�a�subsequen�t�section.��#V�� �Second-order�ffunication��1ȍ� �W��Ve���fo�S�cus�on�the�attempt�to�extend�unication�to�instan��rtiate�v��X�ariables�for�func-���� tions�b��ry�means�of���-terms.�This�is�lo�S�osely�kno�wn�as��higher-or��ffder�P�unic�ation�.�It���� has�w�b�S�een�pursued�in�the�past�in�the�con��rtext�of�formal�systems�based�on�t�yp�S�ed���� ��-calculus,��(so�that�functions�and�functionals�of�an��ry�\nite�t�yp�S�e"�can�b�e�consid-���� ered.�CIW��Ve�call�our�unication�\second-order"�since,�formally�,�w��re�prefer�a�frame-���� w��rork���without�t�yp�S�es.�This�is�not�essen�tial;�our�w�ork�can�b�S�e�em�b�S�edded�in�sev�eral���� dieren��rt��formalisms.�In�(�22����),�Pietrzyk�olski�ga�v�e�an�algorithm�for�second-order���� unication,�iwhic��rh�w�e�here�call���-unication.�This�w�as�extended�to�t�yp�S�e�theory�in���� (�23����).���Huet�sho��rw�ed���in�(�18��)�that���-uniabilit��ry�is�more�ecien�t�than���-unication,���� and�Vsubsequen��rtly���-uniabilit�y�w�as�used�in�the�implemen�tation�of�Co�S�q.�Huet���� pro��rv�ed��a�completeness�theorem�for���-unication�relativ��re�to�t�yp�S�ed���-calculus.����!����-unication,�� and�the�completeness�theorem�for�it,�are�for�t��ryp�S�ed���-calculus���� without��denition�b��ry�cases.�If�w�e�try�to�use���-unication�to�nd�an��f���suc�h�that���� �f�G��(0)�UR=�0,��sit�will�giv��re�us�t�w�o�answ�ers:��f��Q�=�UR�x:�0�and��f��=�UR�x:x�.�If�w��re�then�ask�for���� an����f�鱹suc��rh�that��f�G��(0)���=�0���and��f��(1)���=�2,���neither�of�these�solutions�will�do,�and���� indeed�K�no�solution�is�giv��ren�b�y�a�pure���-term.�Ho�w�ev�er,�if�w�e�lo�S�ok�for�solutions���� in��rv�olving�6�if-then-else,�it�is�easy�to�dene�suc��rh�a�function.�This�example�is�a�fairly���� represen��rtativ�e���one,�illustrating�the�t��rw�o���metho�S�ds�\pro� �jection"�and�\imitation"���� used��in�the�denition�of���-unication.����!��In��(�8���),�a�notion�of�second-order�unication�is�giv��ren�that�allo�ws�the�construction���� of��functions�using�denition�b��ry�cases.�Here�w�e�call�this�notion�D-unication,�to���� distinguish��Tit�from���-unication.�W��Ve�use���cases�����(�n;���m;�x;�y�n9�)��Tto�mean�\if��n�UR�=��m��T�then���� �x�,��else��y�n9�".�This�unication�in��rv�olv�es��making�the�\minimal�commitmen��rt"�needed���� to��smeet�the�conditions.�Th��rus,�if�w�e�use�it�to�solv�e�the�problem�of�nding��f� r�suc�h���㍑ �the���in���tegers�up�to�isomorphism.�But�seman�tics�are�not�imp�Gortan�t�for�automated�deduction,�� �� whic���h�UUis�an�inheren�tly�syn�tactic�en�terprise.����� P�� ���R ��� ����M.��fJ.�Beeson���� ���� �� �that��1�f�G��(0)���=�0,�the�answ��rer�w�e�get�is��f��=����x:��cases��_K�(�x;����0�;��0�;�Y��p�(�x�)),�where��Y�O��is�a��� �� fresh�l�v��X�ariable.�In��rtuitiv�ely�l�this�means,�\if��x�UR�=�0�l�then�0,�else�undetermined".�Here���� \undetermined"�b�is�dieren��rt�from�\undened",�but�the�idea�is�similar�to�\not�y�et���� dened".���It�means�that�further�v��X�alues�of��f�ʹcan�b�S�e�sp�ecied�b��ry�instan�tiating�the���� new�O�v��X�ariable��Y��p�.�This�answ��rer�is�\more�general"�than�the�t�w�o�answ�ers��x:�0�and���� �x:x��7�giv��ren�b�y�Huet's�algorithm,�in�the�sense�that�they�can�b�S�e�obtained�from�it�b�y���� instan��rtiating����Y�J��in�dieren�t�w�a�ys.�In�(�8���),�a�most-general-unier�theorem�is�pro�v�ed,���� according�O[to�whic��rh,�if�terms��t��and��s��(sa�y�in�t�yp�S�ed���-calculus�with�denition���� b��ry�t�cases)�unify�at�all,�then�they�ha�v�e�a�unique�most�general�unier.�This�is���� a���satisfying�generalization�of�the�most-general-unier�prop�S�ert��ry�of�Robinson's���� \ordinary"��unication.����!��An�hgimp�S�ortan��rt�idea�in�D-unication�is�that�of��r��ffestrictions��on�a�v��X�ariable.�A���� restriction�k�is�a�pair�consisting�of�a�v��X�ariable�and�a�(p�S�ossibly�empt��ry)�list�of�con-���� stan��rts.�z�Note�that�if�a�problem�expressed�in�rst-order�logic�using�quan�tiers���� is��^con��rv�erted�to�clausal�form,�some�of�the�originally-b�S�ound�v��X�ariables�are�con-���� v��rerted�-�to�constan�ts,�so�the�concept�\constan�t"�here�includes�what�sometimes���� are�v�called�\ob� �ject�v��X�ariables",�and�the�concept�\v�ariable"�here�includes�what�is���� sometimes��called�\meta��rv��X�ariable".�The�idea�is�that�the�list�of�constan�ts�paired���� with�ǒ�x��are��forbidden��Cto��x�.�����2�z��� ��Unication�ǒis�not�allo��rw�ed�ǒto�assign�a�v��X�ariable��x��a���� v��X�alue�(Xthat�con��rtains�a�constan�t�forbidden�to��x�.�T��Vo�mak�e�this�sensible,�the�input���� to��mthe�unication�algorithm�has�to�include�an��envir��ffonment�,�whic��rh�is�a�nite�list���� of�u�restrictions.�Since�D-unication�can�in��rtro�S�duce�new�v��X�ariables,�not�men�tioned���� in�0mthe�input�en��rvironmen�t,�0mthe�output�of�the�unication�algorithm�is�not�only�a���� substitution��but�also�an��output�6�envir��ffonment�.�The�substitution���\�unies��t��and��s���� �relativ��re���to�en�vironmen�t��E�]��if�for�some�substitution����whose�restriction�to��E��is���� the�57iden��rtit�y��V,�w�e�ha�v�e��t�n9��;�=��s��.�57That�is,�it�is�p�S�ossible�to�extend����p�to�giv��re�the���� new�nv��X�ariables�v�alues�suc��rh�that,�under�the�extended�substitution,��t��and��s��b�S�ecome���� equal.����!��W��Ve��\will�state�the�most-general-unier�theorem,�whic��rh�is�the�nicest�prop�S�ert�y���� of��OD-unication.�Before�the�theorem�can�b�S�e�stated,�the�notion�of�\most�general���� substitution"���m��rust�b�S�e�dened.�Here�are�the�denition�and�the�theorem,�tak�en���� from��(�8���).��� ���� �Denition:���R���Giv��ren��an�en�vironmen�t��E� ��,���C<�is�more�general�than���,�relativ�e�to��E� ��,�if���� there�jis�a�substitution������suc��rh�that���S��F��=��f���on��E� ��.�That�is,�for�all�v��X�ariables��X��in���� the�մen��rvironmen�t��E� ��,�w�e�ha�v�e��X� ��S������P��������������=������J�X��.�Here��p�����P���UR�������n9�=��������q�C�means��px�UR�=��q�n9x�,�where��x��is���� a��v��X�ariable�not�in��p��or��q�n9�.���� �R��ffemark�.�VIn�this�denition,�the�phrase�\�px�UR�=��q�n9x�"�Vmeans�that��px�UR�=��q�x�V�is�pro��rv��X�able���� in��the���-calculus�with�denition�b��ry�cases�(b�S�e�it�a�t�yp�S�ed�v�ersion�or�the�un�t�yp�S�ed���� theory���-D�considered�in�(�8���)).�� �����#�X��^��z����( �T��*�ec���hnically�,�F�one�has�to�decide�whether��
�b>