Sindbad~EG File Manager

Current Path : /usr/home/beeson/public_html/michaelbeeson/research/papers/
Upload File :
Current File : /usr/home/beeson/public_html/michaelbeeson/research/papers/Unify.dvi

����;� TeX output 2000.10.09:2133������z#f����ܚ�5#f����ܚ��|,����N�ffcmbx12�Unication�ffin�Lam���b�s3da-Calculus��"�%��ʶ��K�`y

cmr10�Mic���hael�UUBeeson���i���a>�&o���		cmr9�Departmen��9t�Tof�Mathematics�and�Computer�Science������ZSan�TJose�State�Univ��9ersit�y������San�TJose,�California�95192,�USA������email:�Tb�A�eeson@mathcs.sjsu.edu�� �����[s��'t�:		cmbx9�Abstract.����&��A�;new�;Vunication�algorithm�is�in��9tro�A�duced,�whic�h�(unlik�e�pre-����[s�vious�N�algorithms�for�unication�in��)5��"		cmmi9��-calculus)�shares�the�pleasan��9t�prop�A�er-����[s�ties��<of�rst-order�unication.�Pro�A�ofs�of�these�prop�erties�are�giv��9en,�in�par-����[s�ticular��uniqueness�of�the�answ��9er�and�the�most-general-unier�prop�A�ert�y��:�.����[s�This��unication�algorithm�can�b�A�e�used�to�generalize�rst-order�pro�of-����[s�searc��9h���algorithms�to�second-order�logic,�making�p�A�ossible�for�example�a����[s�straighforw��9ard�Ttreatmen�t�of�McCarth�y's�circumscription�sc�hema.���؍��?�;��N�cmbx12�1��S@In��tro�`duction���&��?�The��torigins�of�this�w���ork�lie�partly�in�an�attempt�to�build�a�theorem-pro�v�er�capa-����?ble��Dof�implemen���ting�John�McCarth�y's�w�ork�on�circumscription.�Circumscription����?is��a�second-order�axiom�sc���hema,�and�cannot,�in�its�full�generalit�y��*�,�b�Ge�reduced����?to��9rst-order.�Indeed,�it�do�Ges�not�seem�an���y�easier�to�build�a�theorem-pro�v�er�to����?handle�7:all�cases�of�circumscription�than�to�handle�second-order�logic�in�general.����NSecond-order�&�logic�uses��
�b>

cmmi10��-terms�to�dene�predicates,�and�hence�an���y�attempt����?to���mec���hanize�second-order�logic�necessarily�will�in�v�olv�e�unication�of���-terms.����?Huet�M[�Huet�UU1975��,��]�in���tro�Gduced�an�algorithm�for�unifying�terms�in���-calculus,�and����?Miller��and�Nadath���ur�[�Miller�UUand�Nadath�ur��ZUb]�in�tro�Gduced�an�extension�of�Prolog����?to��a�fragmen���t�of�second-order�logic�(in�fact�higher-order�logic)�based�on�a�similar����?unication���algorithm.�Ho���w�ev�er,���it�turned�out�that�Huet's�algorithm�isn't�enough����?to�$zhandle�circumscription.�The�dicult���y�is�not�hard�to�understand:�Supp�Gose�w�e����?w���an�t�l�Q�(1)��t=�1�and��Q�(2)�=�0�(�Q��can�b�Ge�though���t�of�as�a�predicate�b�y�treating�1����?as��Etrue�and�0�as�false).�Huet's�unication,�giv���en�the�problem��Q�(1)�BS=�1,��Eis�only����?going��to�pro�Gduce��x:�1�and��x:x��as�p�ossible�v��q�alues�of��Q�,�neither�one�of�whic���h����?satises��׵Q�(2)���=�0.�Moreo���v�er,�it�is�unpleasan�t�that�Huet's�notion�of�unication����?do�Ges���not�ha���v�e���\most�general�uniers".�These�diculties�are�related;�when�the����?righ���t�notion�of�unication�is�dened,�there�are�\more"�uniers,�and�there�is�also����?a�E�\minimal"�or�\most�general"�unier,�of�whic���h�all�the�others�are�\extensions".����NThis� �pap�Ger�con���tains�the�denition�of�this�new�unication�algorithm,�and�the����?pro�Gof�UUthat�it�alw���a�ys�UUpro�duces�a�most�general�unier.���&���?�2��S@Related��W���ork���&��?�This��funication�algorithm�can�b�Ge�used�to�extend�to�second-order�logic�the�\bac���k-����?w���ards�UUGen�tzen"�theorem-pro�v�er�describ�Ged�for�rst-order�logic�in�[�Beeson�1991��5�@].�����*�z#f����ܚ�5#f����ܚ��N�As��far�as�I���kno���w,�the�new�unication�algorithm�presen�ted�here�mak�es�p�Gos-����?sible��the�rst�direct�implemen���tation�of�circumscription,�i.e.�using�second-order����?logic�}Idirectly�in�pro�Gof�searc���h.�Lifsc�hitz�has�giv�en�a�metho�Gd�of�reducing�some����?cases�8�of�circumscription�to�rst-order�logic,�where�it�seems�certain�that�existing����?theorem-pro���v�ers�X`could�handle�the�transformed�problem,�although�the�exp�Gerimen���t����?hasn't�>nactually�b�Geen�carried�out([�Lifsc���hitz�UU1985��<1�]).�A�>2theorem-pro���v�er�>ndescrib�ed����?in��[�Bak���er-Ginsb�Gerg�UU1989��[nE]�and�[�Ginsb�Gerg�UU1989��>�%]�is�related�to�circumscription�via����?Lifsc���hitz's�
result,�but�do�Ges�not�in�v�olv�e�circumscription�in�its�mec�hanism.�Exp�Ger-����?imen���ts�/�with�this�algorithm�in�automatic�deduction�b�y�circumscription�will�b�Ge����?describ�Ged�UUelsewhere.��̍���?�3��S@�=DF��
cmmib10��-Calculus��and�denition�b��y�cases��̍��?�W��*�e�>�are�in���terested�in�applications�of�unication�to�v��q�arious�logical�systems,�in-����?cluding���second-order�logic�and�v��q�arious�t���yp�Ge�theories.�All�of�these�logics�can�b�e����?expressed��Bas�subsystems�of���-calculus,�so�it�is�natural�to�study�unication�in�the����?general� @setting�of���-calculus.�The�system�of���-calculus�for�whic���h�w�e�solv�e�the����?unication�m�problem�is�an�extension�of�the�usual���-calculus.�W��*�e�call�this�system����?�D�G�.��It�is�formed�b���y�adding�to�the�ordinary���-calculus�a�new�constan�t���"V

cmbx10�d��for�de-����?nition�7b���y�cases,�and�the�follo�wing�reduction�rules.�In�these�rules,�equalit�y�means����?\reduces�UUto".�������d�(�x;���x;�a;�b�)��=��a��j������d�(�x;���y�[�;�Z��y�;�Z��x�)��=��Z�x�����O��d�(�x;���y�[�;�y�;�x�)��=��x����ʺ[�d�(�x;���y�[�;�a;�a�)��=��a����?�T��*�aking�j��Z����=�ꕵx:x��and��Z��=�ꕵx:a�,�the�last�t���w�o�j�rules�follo���w�as�equalities�from�the����?second,���but�as�reduction�rules�instead�of�just�equalities�they�are�not�sup�Ger
uous.����?W��*�e��also�migh���t�consider�a�rule�similar�to���`�-reduction,�namely�,�for�distinct�normal����?terms�UU�t��and��s�,�������d�(�t;���s;�a;�b�)��=��b��j��?�but�UUthis�rule�is�not�needed�in�our�system.����^��ٓ�Rcmr7�1������N�A�M�natural�M�question�is�whether��D���satises�the�Ch���urc�h-Rosser�M�theorem.�J.����?W.�0�Klop�sho���w�ed�0�that�it�do�Ges�not�(priv��q�ate�corresp�ondence).�Equalit���y�of�terms����?in��B�D��_�is�dened�b���y�the�transitiv�e�closure�of�the�relation�\�a��and��b��ha�v�e�a�com-����?mon�1reduct".�Klop's�coun���terexample�to�Ch�urc�h-Rosser�lea�v�es�op�Gen�the�question����?whether�_	normal�forms�are�unique�in��D�G�,�and�indeed�lea���v�es�_	op�en�the�p�ossibilit���y����?that�g�t���w�o�terms�not�con�taining��d�,�whic�h�ha�v�e�no�common�reduct�in���[ٲ-calculus,����?migh���t���still�b�Ge�equal�in��D��.�Indeed,�for�all�w���e�kno�w�at�this�p�Goin�t,��T��and��F��migh�t����?b�Ge�}Oequal�in��D��.�The�follo���wing�sho�ws�that�this�is�not�the�case:��D��l�is�consisten�t����?and��indeed�is�a�conserv��q�ativ���e�extension�of���[ٲ,�for�equations�b�Get�w�een�closed�terms.��?��t�ff8�ϟ
L͍��������-=�(�Aa�cmr6�1�����
�The�2Q��V��-calculus�in��9v�olv�es�2Qa�constan��9t����)�and�the�reduction�rules���������+����		cmsy9�!����T��and������	��!����F����
�when�������and���5>�are�distinct�closed�normal�terms.�See�[�Barendregt�T1981��B�z],�p.�396�for����
the�Tclassical�results�ab�A�out���V��-calculus.�����
w�z#f����ܚ�5#f����ܚ��?�Theorem.���� p�0J

cmsl10�Let�?=�P����and��Q��b�Ge�t���w�o�?=closed�terms�not�con���taining��d�,�and�supp�ose����?�P�*��=���Q�UU�in��D�G�-calculus.�Then��P��=���Q��already�in���-calculus.��ŭ��N�The���pro�Gof�of�this�theorem�is�long�and�tec���hnical,�and�the�strict�length�limit����?on�Spap�Gers�in�this�v���olume�prohibits�its�inclusion.�T��*�o�a�v�oid�dep�Gendency�on�this����?result,��}one�can�w���ork�instead�in�a�t�yp�Ged���-calculus.�T��*�o�b�e�sp�ecic,�w���e�consider����?simply-t���yp�Ged���-calculus�with�one�ground�t�yp�Ge,�as�describ�ed�in�App�endix�A��}of����?[�Barendregt�UU1981��H#�].�S�T��*�o�this�system�w���e�can�consisten�tly�add�a�constan�t��d��of�eac�h����?sensible��>t���yp�Ge�suc�h�that�in��d�(�a;���b;�x;�y�[ٲ),��>�a��and��b��are�of�ground�t�yp�Ge�and��x��and��y���are����?of�^�the�same�t���yp�Ge�(not�necessarily�ground),�and�p�ostulate�the�la���ws��d�(�a;���b;�x;�y�[ٲ)��=��x����?�if�'o�a���=��b��and��y��H�otherwise.�Then�the�t���yp�Ged�v�ersions�of�the��d�-la�ws�of��D�n��are�v��q�alid.����?The���reader�with�doubts�ab�Gout�the�theorem�just�stated�can�read�the�rest�of�the����?pap�Ger�UUas�b�eing�ab�out�this�system�of�t���yp�ed���-calculus�instead�of��D��.����NW��*�e�j�write��t����T͍����
!",�

cmsy10����+3�����=�����
�,�s��to�mean��tx���=��sx�,�j�where��x��is�a�v��q�ariable�not�con���tained�in��t��or����?�s�.����^��2���/�Note���that�extensional�equalit���y�is�preserv�ed�under�reduction:�if��a����T͍��b�����+3���b��=������,�b��and��a����?�reduces�UUto��a���^��O!�cmsy7�0��#��and��b��reduces�to��b���^��0���then��aa���^��0�����T͍���Q����+3����Q�=�����#��b���^��0���9�.����NThe�UUsecond��d�-rule�ab�Go���v�e�UUthen�tak���es�the�form��n0�����x:�d�(�x;���a;�Z��a;�Z�x�)����T͍�������+3�����=�����
UN�Z����?�This�#=form�of�the�rule�will�b�Ge�used�in�the�most-general-unier�calculation�in�a����?subsequen���t�UUsection.���Z���?�4��S@Lam��b�`da��Calculus�and�Logic���Z��?�It���is�w���ell-kno�wn���that�second-order�logic�can�b�Ge�dened�in�lam���b�da-calculus�(see����?[�Barendregt�UU1981��H#�],�Rp.�570,�for�basic�references,�and�[�Pra���witz�UU1967��9y]�for�full�de-����?tails).�� W��*�e�sp�Gecify�a�few�notational�matters�that�will�b�e�needed�to�supp�ort�the����?pro�Gofs�UUin�this�pap�er.����NIt�#will�b�Ge�con���v�enien�t�#to�consider���-calculus�as�enlarged�with�a�sto�c���k�of�con-����?stan���ts,��as�w�ell�as�v��q�ariables.�T��*�ec�hnically�w�e�can�just�regard�half�of�the�usual����?v��q�ariables���as�\constan���ts";�unication�will�only�instan�tiate�the�v��q�ariables,�but�not����?the��Sconstan���ts.�Note�that�constan�ts�can�still�b�Ge�used�for���-abstraction,�i.e.�from����?within�UUthe���-calculus�they�are�just�lik���e�v��q�ariables.����NWhen���logic�is�translated�in���to�lam�b�Gda-calculus,�the�\ob��8ject�v��q�ariables"�(v�ari-����?ables��Aof�the�logic)�b�Gecome�constan���ts�in�lam�b�Gda-calculus,�as�do�the�constan�ts�and����?function�{�sym���b�Gols�and�predicate�sym�b�Gols�of�the�logic.�Also�the�quan�tiers�and�log-����?ical���sym���b�Gols�suc�h�as��^��and��!��b�Gecome�constan�ts�or�constan�t�terms�(con�taining�no����?v��q�ariables)�7�of���-calculus.�The�v�ariables�of���-calculus�are�used�as�\meta���v�ariables"����?to�'�range�o���v�er�'�terms�of�logic.�When�w���e�lo�Gok�for�a�pro�of�of�a�theorem��9�xA�(�x�),�w���e����?rst�1replace��x��b���y�a�meta�v��q�ariable��X��and�searc�h�for�a�pro�Gof�of��A�(�X�).�W��*�e�hop�e����?that��ev���en�tually�unication�will�\instan�tiate"��X�ɲto�some�term.�In���-calculus,�the��?�ډff8�ϟ
L͍��������-=�2�����
�The�(���R��-reduction�rule�in���-calculus�sa��9ys�that�(�x:t�)�x��reduces�to��t�.�This�is�not�a�rule����
of�.�the�usual����calculus,�but�it�has�b�A�een�extensiv��9ely�studied.�W��:�e�delib�erately�use����
the�A�relation��t�����=���������������=�����?P�s��rather�than�equiv��|ralence�in���R��-calculus,�to�a��9v�oid�A�the�tec��9hnical����
complications��of�adding���R��-reduction�and�the��d�-rules�to���-calculus�at�the�same�time.�����>�z#f����ܚ�5#f����ܚ��?�logical��hmeta���v��q�ariable��X��L�b�Gecomes�a�v�ariable,�and�the�ob��8ject�v�ariable��x��of�the�logic����?b�Gecomes�UUa�constan���t�of���-calculus.��
\��NSecond-order��7logic�has�t���w�o��7kinds�of�v��q�ariables,�rst-order�and�second-order.�It����?is���customary�to�use�capital�letters�for�second-order�v��q�ariables.�This�con
icts�with����?the���Prolog�con���v�en�tion,���in�whic���h�capital�letters�are�used�for�meta�v��q�ariables.�W��*�e����?therefore�0�use�b�Goldface�for�logical�meta���v��q�ariables;�but�in���-calculus,�w�e�use�lo�w�er-����?case���letters�for�v��q�ariables,�as�usual.�Second-order�logic�p�Germits�the�formation�of����?��-terms�%mwhic���h�are�though�t�of�as�comprehension�terms,�i.e.��x:a�(�x�)�in�tuitiv�ely����?represen���ts�ԗthe�set�of��x��suc�h�that��a�(�x�).�Suc�h�terms�translate�directly�in�to���-terms����?of�L��-calculus,�where�a���-term�is�though���t�of�as�a�predicate,�taking�v��q�alues��T�:�or��F�.��
\��NIn�r�logic,�predicates�and�functions�can�ha���v�e�r�more�than�one�argumen���t,�but�in����?��-calculus,���\currying"�is�used;�that�is,��f���(�x;���y�[ٲ)�is�an�abbreviation�for�(�f�x�)�y�[ٲ.�Th���us����?the�UUtranslation�of�an�atomic�form���ula��P�c��(�x;���y�[ٲ)�will�b�Ge�in�curried�form.��%̍��?�5��S@A��New�Unication�Algorithm��̍�?�Huet�0p�Goin���ted�out�in�[�Huet�UU1975��,��]�that�equations�in�v�olving�second-order�v��q�ariables����?in�}�general�ha���v�e�}�man�y�solutions,�ev�en�if�w�e�require�the�solutions�to�b�Ge�denable�b�y����?��-terms.�}/F��*�or�example,��X���(1)�	�=�1�}/could�b�Ge�solv���ed�b�y��X��f�=�	��x:x��or�b�y��X��f�=�	��x:�1.����?Hence,��he�said,�w���e�cannot�exp�Gect�unique�\most�general�uniers"�as�in�rst-order����?logic,�e�and�he�w���en�t�e�on�to�giv���e�a�unication�algorithm�that�pro�Gduces�man�y�unifying����?substitutions.��As�p�Goin���ted�out�in�the�in�tro�Gduction,�in�applications�the�solutions����?pro�Gduced�D�b���y�Huet's�algorithm�do�not�suce,�partly�b�ecause�the�algorithm�do�es����?not�UUpro�Gduce�terms�for�functions�dened�b���y�cases,�but�only�b�y�pure���-terms.��
\��NOne�a�approac���h�to�the�problem,�whic�h�I�a�rst�tried,�is�to�allo�w�terms�for�func-����?tions�?that�are�only�partially�dened.�This�probably�w���orks,�but�it�requires�man�y����?details,��}as�the�necessary�formal�systems�are�not�in�the�literature.�Here�w���e�tak�e����?a���dieren���t�approac�h:�w�e�allo�w�unication�to�pro�Gduce�answ�ers�con�taining�a�new����?v��q�ariable.�d�Instead�of�ha���ving�some�v�alues�(whic���h�aren't�needed�to�solv�e�the�equa-����?tion�q�at�hand)�b�Ge�undened,�w���e�just�lea�v�e�them���':

cmti10�unsp��}'e�cie�d�,�q�b�y�using�a�new�free����?v��q�ariable.��
\��NT��*�o�Q�lead�up�to�the�denition�of�unication,�w���e�will�giv�e�an�imp�Gortan�t�case�of����?the�W�denition�rst.�Consider�the�problem�of�unifying��X���(�t�)�with��s�,�where��X� ��is�a����?v��q�ariable��and��t��and��s��are�constan���t�terms.�T��*�o�solv�e�this�unication�problem,�w�e�let����?�Y���b�Ge���a�new�v��q�ariable�and�tak���e��X�<��=�sܵx:�d�(�x;���t;�s;�Y�8�x�).���More�precisely��*�,�w�e�return����?the�Xsubstitution����%�whose�v��q�alue�on��X� �is�the�term��x:�d�(�x;���t;�s;�Y�8�x�).�XThink�of�this����?as�UU\if��x���=��t�UU�then��s��else�unsp�Gecied".����NT��*�o��	understand�this�denition,�consider�an�example:�when�w���e�unify��X���(0)�with����?1,���w���e�get��X�q�=�N��x:�d�(�x;����0�;��1�;�Y�8�x�),���whic�h�tak�es�the�v��q�alue�1�at�0,�and�elsewhere�is����?\unsp�Gecied",��that�is,�has�the�v��q�alue��Y�8�x��where��Y�X��is�a�new�v�ariable.�By�con���trast,����?Huet's���unication�w���ould�giv�e�only�the�constan�t�function��X��"�=�/@�x:�1.�Consider�a����?second�ߠexample:�unify��X���(1)�with�1.�Huet's�unication�w���ould�giv�e�t�w�o�distinct����?answ���ers:��>�X�9Բ=�p�x:�1�and��X��=�p�x:x�.�Our�answ���er�is�\more�general"�than�eac�h�of����?these,�Q�and�more�general�than�innitely�man���y�other�sp�Gecial�answ�ers�obtained�b�y�����-!�z#f����ܚ�5#f����ܚ��?�sp�Gecifying�c�other�v��q�alues�of��X�,��than��X���(1).�The�\most�general"�answ���er�sp�ecies����?only�UU�X���(1),�lea���ving�the�other�v��q�alues�unsp�Gecied.����NHo���w�ev�er,��Ein�that�denition�of�what�it�means�to�unify��X���(�t�)�and��s�,�it�is�imp�Gor-����?tan���t���that��t��and��s��w�ere�constan�t�terms.�Consider�the�problem�of�unifying��X���(�z�p��)����?and��a�(�z�p��),�where��a��is�constan���t.�Do�w�e�w�an�t��X��ֲ=���x:�d�(�x;���z�p�;�a�(�z��)�;�Y�8�x�)?��W��*�ell,�in����?some���cases�w���e�migh�t,�but�in�other�cases�w�e�w�an�t��X���=�K��x:�(�a�(�x�)�m�_��Y�8�x�).���F��*�or�ex-����?ample,�7~if�w���e�are�trying�to�pro�v�e�in�second-order�logic�that��9�X���(�a�(�z�p��)���!��X��(�z�p��),�7~w���e����?will��rst�replace��X�R�b���y�a�meta�v��q�ariable��X����and�then�try�to�unify��X�(�z�p��)�with��a�(�z��).����?W��*�e��5w���an�t�to�get��X��Ų=���z�p�:a�(�z��)�or�some�answ���er�more�general�than�that,�suc�h�as����?�X����=���z�p�:�(�a�(�z��)�8�_��Y�8�(�z�p��)).����NThis��Oraises�an�issue�whic���h�could/should�ha�v�e�b�Geen�considered�already�in�ordi-����?nary���unication.�When�a�theorem-pro���v�er���replaces�a�quan���tier�b�y�a�meta�v��q�ariable,����?there��is�restriction�on�the�(ob��8ject)�v��q�ariables�that�can�o�Gccur�in�the�answ���er�sub-����?stitution��when�it�is�ev���en�tually��found.�In�the�ab�Go���v�e��example,�when��X�㥲is�replaced����?b���y�M��X�,�the�restriction�is�that�the�ev�en�tual�v��q�alue�of��X��is�not�allo�w�ed�to�con�tain�a����?free�Z5o�Gccurrence�of��z�p��.�In�[�Beeson�UU1991��5�@],�a�simply-programmed�inference�program����?allo���ws�-�\wrong"�unications�to�b�Ge�temp�orarily�considered�and�rejected�later.�An����?impro���v�emen�t��,to�the�program,�suggested�b���y�N.�Shank��q�ar,�k�eeps�trac�k�of�these����?restrictions�iCand�rejects�unications�that�violate�them�immediately��*�.�Considering����?unication��Rin�second-order�logic�or�lam���b�Gda-calculus�brings�this�\tric�k"�in�to�fo-����?cus:���it�should�b�Ge�part�of�the��denition��of�unication.�That�is,�unication�tak���es����?place��relativ���e�to�a�nite�set�of�restrictions�on�the�p�Gossible�v��q�alues�of�v�ariables;����?these��restrictions�are�part�of�the�input�to�the�unication�algorithm.�Whether�w���e����?tak���e�댵X����=���z�p��(�a�(�z��)�eO�_��Y�8�(�z�p��)�or��X����=���z��d�(�x;���z�;�a�(�z��)�;�Y�8�x�)��will�dep�Gend�on�whether��z�\#�is����?forbidden��to��X����or�not,�i.e.�whether��X��is�restricted�from�taking�v��q�alues�dep�Gending����?on�UU�z�p��.����NW��*�e�UUno���w�mak�e�these�ideas�precise.���΍�?�Denitions.����A��ܲrestriction���is�a�pair�consisting�of�a�v��q�ariable�(of�lam���b�Gda-calculus)����?and��a�(p�Gossibly�empt���y)�list�of�constan�ts.����^��3���	a�An��en�vironmen�t��is�a�nite�list�of����?restrictions.����^��4���LT�If���h�x;���r�G�i��is�a�mem���b�er�of�the�en���vironmen�t���E�cn�w�e�sa�y�that�the�v��q�ariable����?�x���o�Gccurs�in��E�A��or��is�men���tioned�in��E����,�and�that�all�the�mem�b�Gers�of�the�list��r����?�are����forbidden�to��x��in��E����.�W��*�e�sa���y�a�comp�Gound�term��t��is��forbidden�to��x��in��E����?�if��it�con���tains�a�free�o�Gccurrence�of�an�y�constan�t�that�is�forbidden�to��x��in��E����.�A����?�substitution���is�a�function�from�v��q�ariables�to�terms.�The�substitution���M��is��legal�for����?en���vironmen�t��tE��J�pro�vided���[ٲ(�X���)��is�dened�for�all��X�yV�that�o�Gccur�in��E�D�and�that����(�X���)����?�do�Ges�_#not�con���tain�free�o�ccurrences�of�an���y�v��q�ariable�or�constan�t�forbidden�to��X�(�in����?�E����.��^The�substitution���:7�unies��terms��t��and��s��relativ���e�to��E�q��if�for�some�substitution����?��UU�whose�restriction�to��E����is�the�iden���tit�y��*�,�UUw�e�ha�v�e��t�[����=��s��.����^��5�����΍�N�The���inputs�to�the�unication�algorithm�are�t���w�o���terms��t��and��s��to�b�Ge�unied����?and���an�en���vironmen�t��޵E����.�W��*�e�sa���y�that��t��and��s��are�to�b�Ge�unied�\relativ�e�to"�the�en-��?�,��ff8�ϟ
L͍��������-=�3�����
�In��9tuitiv�ely��:�,��the�ev��9en�tual��v��|ralue�of�the�v�ariable�is�not�allo��9w�ed��to�dep�A�end�on�the�mem��9b�ers����
of�Tthe�list.�����������-=�4�����
�In��9tuitiv�ely��:�,�%�an�en��9vironmen�t�%�lists�all�the�v��|rariables�in�use�so�far,�whether�or�not�their����
ev��9en�tual�Tv��|ralues�are�restricted,�together�with�an��9y�restrictions�so�far�imp�A�osed.�����������-=�5�����
�That�Tis,��t��p�=����s�g��for�some�v��|ralues�of�the�the�v�ariables�not�in��E��2�.�����=��z#f����ܚ�5#f����ܚ��?�vironmen���t�?��E����.�One�output�of�the�unication�algorithm�is�a�substitution����o�whic�h����?is�,�legal�for��E����,�suc���h�that��t���=�.9�s�[ٲ.�The�usual�notion�of�unication�is�obtained����?b���y�ptaking�an�en�vironmen�t��E���with�no�restrictions�on�an�y�of�the�v��q�ariables�o�Gccur-����?ring�Ӧin��E����.�But�note�that�the�use�of�restrictions,�ev���en�in�rst-order�unication,����?corresp�Gonds�UUto�the�actual�use�of�unication�in�theorem-pro���ving.�����NThe�g�unication�algorithm�has�a�second�output,�whic���h�is�a�new�en�vironmen�t����?enlarging�O�the�input�en���vironmen�t�O��E����.�Here�\enlarging"�means�simply�that�new����?v��q�ariables�UUma���y�ha�v�e�b�Geen�added.����NThe�_Nalgorithm�pro�Gduces�an�answ���er�substitution�only�if�it�succeeds.�It�can����?also�x�fail,�b���y�terminating�but�pro�Gducing�a�sp�ecial�signal�for�failure�instead�of�an����?answ���er��Ysubstitution�and�new�en�vironmen�t.�And,�at�least��a��priori�,�it�migh�t�fail����?to�UUterminate.����NW��*�e��no���w�giv�e�the�precise�denition�of�our�unication�algorithm.�W��*�e�will�sup-����?press�
�men���tion�of�the�en�vironmen�t,�b�Goth�in�input�and�output,�writing���unify����(�t;���s�)����?as���usual�to�denote�the�output�substitution���[ٲ.�When�it�is�necessary�to�men���tion����?the��.en���vironmen�t�it�will�b�Ge�b�y�w�a�y�of�\�z� Ųis�forbidden�to��x�",�whic�h�means�\�z� Ųis�for-����?bidden���to��x��in��E����,�where��E�|i�is�the�input�en���vironmen�t".���When�w���e�sa�y��*�,�\�Y�!��is�a�new����?v��q�ariable",�Pw���e�mean�that��Y����is�a�v�ariable�not�o�Gccurring�in�the�input�en���vironmen�t����?�E����,��Uand�it�is�implicit�that�the�output�en���vironmen�t��Uwill�include�the�new�v��q�ariable����?�Y�8�.�UUIt�m���ust�b�Ge�remem�b�Gered�that��failure��is�a�p�ossible�result�of���unify��i�(�t;���s�).����NIf�g?�a��and��b��are�terms�con���taining�no�v��q�ariables,�and��a���=��b�g?�in��D�G�,�then���unify��S�(�a;���b�)����?succeeds,�xpro�Gducing�the�empt���y�substitution.�If��a��and��b��are�terms�con�taining�no����?v��q�ariables�1and�not�con���taining��d�,�and��a��and��b��reduce�to�distinct�normal�forms,����?then��UU�unify��i�(�a;���b�)�UUfails.����^��6������N�If�2��a��and��b��are�literally�iden���tical�terms�(whic�h�ma�y�con�tain�v��q�ariables)�then�����?�unify��X��(�a;���b�)�UUsucceeds,�pro�Gducing�the�iden���tit�y�UUsubstitution.����NNext,��Sif�either�input�term�p�Germits�a�����-reduction�at�top�lev���el,�the�follo�wing����?rules�UUare�used:���m	����/��unify���梲(�t;����(�x:a�)�s�)��=���unify��~,�(�t;�a�[�s=x�])�������/��unify���梲((�x:a�)�t;���s�)��=���unify��~,�(�a�[�t=x�]�;�s�)��<��NNext,��rthere�are�t���w�o��rclauses�in�the�denition�of��unify��for�eac���h�of�the�reduction����?rules�UUin���v�olving��d�.�These�rules�tak�e�the�forms�������A��unify�����(�t;���s�)��=���unify��~,�(�t�����0���9�;�s�)������A��unify�����(�s;���t�)��=���unify��~,�(�s;�t�����0���9�)��m	��?where��R�t��is�the�left�side�of�the�reduction�rule�and��s��is�the�righ���t�side.�F��*�rom�no�w����?on,���w���e�will�b�Ge�dealing�with�inputs�whic�h,�while�not�necessarily�normal,�p�Germit����?no�UUreduction�at�top-lev���el.��?��9�ff8�ϟ
L͍��������-=�6�����
�The�+�restriction�to��d�-free�terms�is�necessary�b�A�ecause�of�the�failure�of�Ch��9urc�h-Rosser����
in�T�D�A��;�if�one�uses�t��9yp�ed���-calculus�one�can�disp�ense�with�this.�����P{�z#f����ܚ�5#f����ܚ��N�T��*�o��unify��X���(�t�)�and��s�,�where��t��and��s��are�not�forbidden�to��X��,�w���e�tak�e��X���=����?�x�d�(�x;���t;�s;�Y�8�x�).��T��*�o�unify��X���(�t����1��|s�;���t����2���)��and��s�,�where��t����1��|s�;�t����2��_�and��s��are�not�forbidden����?to�UU�X���,�w���e�tak�e��m����&�X����=���x����1��|s�x����2���(�d�(�x����1���;���t����1���;��d�(�x����2���;�t����2���;�s;�Y����2���x�)�;�Y����1���x�)��m���?where�PߵY����1���R�and��Y����2���are�new�v��q�ariables,�and�similarly�for�unifying��X���(�t����1��|s�;����:�:�:����;���t����	0e�rcmmi7�n��q~�)�and����?�s�.��$���NW��*�e�UUha���v�e�to�dene�when�t�w�o���-terms�unify��*�.�W�e�ha���v�e��I	�����unify������(�x:t;���x:s�)��=���unify��~,�(�t;�s�)�;����?�but�GXw���e�also�need�to�unify�t�w�o���-terms�with�dieren�t�b�Gound�v��q�ariables�after�suit-����?able��renaming�of�the�b�Gound�v��q�ariables.�The�simplest�w���a�y��to�handle�this�is�to����?dene��m�����%w�unify���܋�(�x:a;���y�[�:b�)��=���unify��~,�(�a�[�z�p�=x�]�;�b�[�z�=y�[ٲ])��m���?where�UU�z���is�a�new�v��q�ariable,�i.e.�not�con���tained�in��a��or��b�.����NIn���-calculus,�there�are�no�function�and�predicate�sym���b�Gols,�except�the�appli-����?cation��	term�formation�sym���b�Gol,��Ap�.�Ocially��x�(�y�[ٲ)�is�the�term��Ap�(�x;���y��).�Here�our����?denition���corresp�Gonds�to�Robinson�unication.�T��*�o�unify��ts��with��pq�[ٲ,�w���e�rst�unify����?�t��L�with��p�.�If�this�fails,�w���e�fail.�If�it�succeeds�with�substitution���[ٲ,�w�e�then�unify����?�s�5�and��\�q�[���.�Note,�ho���w�ev�er,�that�the�output�en�vironmen�t�of�the�rst�unication����?b�Gecomes�c�the�input�en���vironmen�t�c�for�the�second�unication.�The�output�is�the����?result�UUof�the�second�unication.����NThe�y�ab�Go���v�e�clauses�dene��rst-or��}'der��unic�ation�.�This�notion�of�unication����?will�2supp�Gort�rst-order�inference�(since�it�generalizes�Robinson�unication),�but����?it�
�is�not�y���et�sucien�t�to�supp�Gort�second-order�inference,�in�particular�the�cir-����?cumscription��jexamples.�Consider�for�example�the�inference�problem�in�whic���h�w�e����?ha���v�e�ס�az�ظ!��A�X���z�p��.�W��*�e�w���an�t�סto�nd�a�v��q�alue�for��X����more�general�than��X�i#�=��z�p�:az��.����?If,�]for�example,�w���e�also�ha�v�e��bz�D��!���X���z�ͧ�w�e�should�b�Ge�able�to�nd�b�y�t�w�o�succes-����?siv���e�_unications,�something�more�general�than��X��?�=��]�z�p�:�(�az����_�?b�bz��).�_The�follo�wing����?additional�UUclause�in�the�denition�of�unication�will�p�Germit�this:����NT��*�o�/Punify��X���z���and��az�p��,�where��z��is�a�constan���t�forbidden�to��X���,�w�e�tak�e��X��E�=����?�z�p�:�(�az���_�>{�Y�8�z��),�]�where��Y����is�a�new�v��q�ariable.�(The�con���v�en�tion�]�here�is�that��z��U�can�b�Ge����?a�
Zsingle�v��q�ariable�or�can�b�Ge��z����1���'�:���:�:��|jz����n��q~�.)�More�generally��*�,�if��s��is�a�term�con���taining����?a�^constan���t�(or�constan�ts)��z�~��forbidden�to��X���,�to�unify��X�z�~��and��s�,�w���e�tak�e��X��^�=����?�z�p�:�(�s�PP�_��Y�8�z��).�x~The�constan���t��z���will�b�Ge�forbidden�to��Y��b�in�the�output�en�vironmen�t,����?along�UUwith�an���y�other�constan�ts�forbidden�to��X���.����NNote�-�that�the�substitution������whic���h�has�b�Geen�dened�in�this�last�clause�to����?unify�<Et���w�o�terms��t��and��s��need�not�satisfy��t�"�=���s�[ٲ,�since�with��t��=��X���z��ܲand��s��=��az����?�w���e��Uha�v�e��t��E�=��l�az�̸_��5�Y�8�z�H�and��s��=��l�az�p��.�But�if�w���e�dene����to�b�Ge�the�substitution����?giving��յY����(whic���h�is�not�part�of�the�input�en�vironmen�t)�the�v��q�alue��z�p�:�F��then�w�e����?ha���v�e�UU�t�[����=��s��,�UUso����.�do�Ges�unify��t��and��s�.����NThere�}�are�also�mixed�cases,�where�some�of�the�v��q�ariables�are�forbidden�to��X����?�and�tTsome�are�not.�F��*�or�example,�to�unify��X���xz���and��axz�p��,�where��z��is�forbidden�to����?�X��~�and�$��x��is�not,�w���e�tak�e��X��o�=� ��x:�d�(�x;���t;��(�axz�3��_���Y�8�z�p��)�;�U�x�),�$�where��Y�]��and��U�;��are����?fresh�UUv��q�ariables.�The�general�case�is�only�notationally�more�complex.�����^��z#f����ܚ�5#f����ܚ��N�Note���that�unication�can�fail�to�terminate�on�inputs�whic���h�ha�v�e�no�normal����?form;�Ŀfor�example���unify��{Ӳ(�
��q;���x�)�fails�to�terminate�where��
�E0�is�an���y�term�with�an����?innite�`�����-reduction�sequence.�On�the�other�hand���unify����(�
��q;���
��)�`�do�Ges�succeed.�Usu-����?ally�Ntw���e�will�b�Ge�in�terested�in�unifying�normal�terms,�and�in�that�case�unication����?alw���a�ys�UUterminates,�as�the�follo���wing�theorem�sho�ws.���g��?�Theorem.����Let�YD�t��and��s��b�Ge�normal�terms,�and�let��E����b�e�an�en���vironmen�t�YDcon�taining����?all���v��q�ariables�in��t��or��s�.�Then���unify��e�(�t;���s�)��terminates,�and�unies��t��and��s��relativ���e����?to�UU�E����.����?�Pr��}'o�of���:�ԷBy�induction�on�the�complexit���y�(depth)�of��t��and��s�.�Since�they�are�normal����?terms,�H�all�subterms�are�normal,�and�the�clauses�of��unify��that�corresp�Gond�to�re-����?duction�iDrules�are�nev���er�used.�The�other�clauses�mak�e�recursiv�e�calls�only�to��unify����?�applied�{to�subterms�of��t��and��s�,�whic���h�b�y�induction�h�yp�Gothesis�do�terminate.�W��*�e����?still�a�ha���v�e�to�pro�v�e�that���unify����(�t;���s�)�unies��t��and��s�.�This�is�ob�vious�for�Robinson����?unication,�M�but�no���w�the�denition�of�\unies"�is�more�general,�in�v�olving�\some����?v��q�alues��of�the�new�v�ariables",�so�there�is�something�to�b�Ge�pro���v�ed,��ev�en�for�the�old����?clauses���in�the�denition.�The�induction�steps�corresp�Gonding�to�the�new�clauses����?ha���v�e���b�Geen�giv���en�ab�o���v�e,���in�the�course�of�the�denition.�Consider�the�pro�of�that�����?�unify��X��(�ts;���pq�[ٲ)�ȣreally�unies��ts��and��pq��.�Let�����=���D�unify��>X�(�t;���p�).�Then�b���y�h�yp�Gothesis����?�t�[����=��p�����for�some����whic���h�is�the�iden�tit�y�on�the�input�en�vironmen�t��E����.�Let����?��蟲=���ؾunify��}�(�s�͠;���q�[���).���By�induction�h���yp�Gothesis��s�[��!��"��=��صq����J��for���some����whic���h�is����?the��iden���tit�y�on��E������^��0��aƲ,�the�en�vironmen�t�including��E��"�and�an�y�new�v��q�ariables�in�tro-����?duced���b���y���[ٲ.�Since��E�[j�con�tains�all�v��q�ariables�in��s��and��q�[ٲ,���餲is�the�iden�tit�y�on�an�y����?new��v��q�ariables�in���tro�Gduced�b�y���[ٲ,�and�since��E������^��0�����is�the�input�en�vironmen�t�for�the����?call�Igpro�Gducing���!Dz,����@�is�the�iden���tit�y�Igon�an���y�new�v��q�ariables�in�tro�Gduced�b�y���!Dz.�Dene����?�����=�-��[��O��=���!���,��the�union�of�these�t���w�o��disjoin�t�substitutions.�Then�w�e�will�pro�v�e����?(�ts�)��[��!��0x�=��\(�pq��)������.�v�Note�that����#�=��\����since����is�non-iden���tit�y�v�only�on�new����?v��q�ariables�>�in���tro�Gduced�b�y���[ٲ,�but���`��is�the�iden�tit�y�on�these�v��q�ariables.�W��*�e�calculate����?as�UUfollo���ws:��ـ����м�(�ts�)��[��!�������_в=���������3(�t�[��!����)(�s�����)������_�=����������~(�t�[��!��)(�s����)������_�=����������~(�t�[��!Dz)(�s����)������_�=���������nF(�p�[��!Dz)(�q�����)������_�=���������nF(�p�[��!��)(�q�����)������_�=����������t(�p�[��!����)(�s�����)������_�=�������(�pq�[ٲ)���!��������?�Since�UU��[��w�is�the�output�substitution���unify��i�(�ts;���pq��),�this�completes�the�pro�Gof.��z͍��?�6��S@The��Most�General�Unier��z͍�?�Since�S�substitutions�are�functions�whose�v��q�alues�are�terms,�equalit���y�b�Get�w�een�sub-����?stitutions�v-is�dened�in�terms�of�equaltiy�of�terms.�In�systems�allo���wing���-terms,�����	o�z#f����ܚ�5#f����ܚ��?�equalit���y��Dof�terms�in�v�olv�es�the�notion�of�reduction,�rather�than�syn�tactic�iden�tit�y��*�,����?so���the�notion�of�equalit���y�of�substitutions�is�corresp�Gondingly�more�complicated.����?In�4�the�applications�w���e�ha�v�e�in�mind,�v��q�ariables�will�denote�functions�or�predi-����?cates,�w�not�only�individuals.�Therefore,�the�substition�whic���h�giv�es�a�v��q�ariable�the����?v��q�alue�()�t��should�b�Ge�equal�to�the�substitution�whic���h�giv�es�the�same�v��q�ariable�the����?v��q�alue��s�,�if��s��and��t��are�extensionally�equal.�As�explained�ab�Go���v�e,��w�e�write��t����T͍�������+3�����=�����
UN�s��to����?mean�Wʵtx��1�=��sx�,�where��x��is�a�v��q�ariable�not�con���tained�in��t��or��s�.�W��*�e�no�w�dene�t�w�o����?substitutions����5-�and����to�b�Ge�a��e��}'qual�4�on�an�envir�onment��E����pro���vided����GX����T͍��������+3������=�����0�X���for����?all�UUv��q�ariables��X�7�in��E����.����NThe�}notion�of�one�substitution�b�Geing�\more�general"�than�another�is�dened����?almost��zas�usual.�The�usual�denition�is�this:���'��is�more�general�than����if�there����?is� Xa�substitution��
����suc���h�that���G
����=�q��.�The�fact�that�our�unication�algorithm����?in���tro�Gduces�UU\new"�v��q�ariables�requires�relativizing�this�denition,�as�follo�ws:���d��?�Denition.����Giv���en��an�en�vironmen�t��E����,�����is�more�general�than���,�relativ�e�to��E����,����?if��)there�is�a�substitution��
�4a�suc���h�that���G
���=�M�on��E����.�That�is,�for�all�v��q�ariables��X����?�in�UUthe�nite�set��E����,�w���e�ha�v�e��X����G
����T͍��UP����+3���UP�=�����
ㆵX��.����N�It���will�sometimes�happ�Gen�that��
��%�is�dened�on�v��q�ariables�not�in�the�original����?en���vironmen�t��7�E����.�F��*�or�example,�if���"T�is�the�substitution�pro�Gduced�b���y�unifying�terms����?�t�L^�and��s�,�and��E���is�the�set�of�v��q�ariables�o�Gccurring�in��t��or��s�,�then��
�ږ�ma���y�b�e�dened����?on�UUsome�of�the�\new"�v��q�ariables�in���tro�Gduced�b�y�the�unication�algorithm.����NBecause���reduction�is�allo���w�ed���in�determining�equalit���y��*�,�the�concept�of�one����?substitution��>b�Geing�more�general�than�another�is�more�complex�than�in�rst-order����?logic,�UUas�the�follo���wing�example�will�illustrate.����?�Example��[�:��*Consider�the�problem��X���(1)�*x=�1.��*The�answ���er�substitution�is��X��Z�=����?�x:�d�(�x;����1�;��1�;�Y�8�(�x�)).���Both�the�answ���ers�pro�Gduced�b�y�Huet's�algorithm�can�b�Ge�ob-����?tained,�IRup�to�extensional�equiv��q�alence,�from�this�answ���er�b�y�instan�tiating��Y��6�to����?one��of�the�v��q�alues��Y����=���x:x��or��Y��=���x:�1.�If�w���e�substitute�these�v��q�alues�for��Y�Vr�and����?reduce�UUto�normal�form,�w���e�obtain��q�����۾d�(�x;����1�;��1�;��(�x:x�)(1))��=��d�(�x;����1�;��1�;�x�)��=��x�������d�(�x;����1�;��1�;��(�x:�1)(1))��=��d�(�x;����1�;��1�;��1)��=�1��w���?Hence��the�answ���er�substitution�pro�Gduced�b�y�our�second-order�unication�algo-����?rithm��
is�more�general�than�eac���h�of�Huet's�t�w�o�answ�ers.�It�is�also�more�general����?than�UUan���y�of�the�innitely�man�y�v��q�ariable-free�solutions,�suc�h�as��q����{g�X����=���x:�d�(�x;����1�;��1�;��d�(�x;��2�;��0�;��3))����?.����?�Theorem.����(Most���general�unier)�Let��E�0��b�Ge�an�en���vironmen�t.���Supp�ose�that��p��and����?�q����are�\normal�terms�in��D�G�.�Supp�ose�that�for�some�substitution����$�legal�for��E����,��p����?�and����q�[��<��are�iden���tical.�Then��p��and��q�Qq�unify��*�,�and�the�answ�er�substitution�is�legal�for����?�E����,�UUand�more�general�than���G�.����?�Pr��}'o�of���:��uThe�pro�Gof�is�b���y�induction�on�the�complexit�y�of�the�term��p�.�If��p��is�a����?v��q�ariable,�F/then���unify���C�(�p;���q�[ٲ)�succeeds�with�answ���er�substitution����giv�en�b�y��p���=��q�[ٲ.�����
~��z#f����ܚ�5#f����ܚ��?�T��*�ak���e��ߵ�p�=��T��G�.�Then�to�sho�w���p�=��T����it�will�suce�to�sho�w��p�p�=��T�p�G�,�since����is����?the�[�iden���tit�y�on�v��q�ariables�other�than��p�.�But��p�X�=��ֵq�[����since��p��=��q�[ٲ,�and��q���=��ֵp����?�b���y�|-h�yp�Gothesis,�so��p���=�ֵp��J�as�desired.�The�case�when��q���is�a�v��q�ariable�is�treated����?similarly��*�.�UUW�e�ma���y�henceforth�supp�Gose�that�neither��p��nor��q��.�is�a�v��q�ariable.����NSupp�Gose�hM�p��is�a�constan���t.�Then��p��j�is��p�.�Therefore��q�[���is�also��p�,�so��q��&�(since����?it���isn't�a�v��q�ariable)�is��p��to�Go.�Hence���unify�����(�p;���q�[ٲ)�succeeds,�returning�the�iden���tit�y����?substitution.�UUSimilarly�if��q��.�is�constan���t.����NNo���w�E�w�e�ma�y�assume�that��p��and��q����are�b�Goth���-terms�or�application�terms.����?Since�#�p�V@�and��q�[���are�iden���tical,�either�b�Goth��p��and��q�j��are�application�terms,�or�b�oth����?of�UUthem�are����terms.����NLet��=�X���b�Ge�a�v��q�ariable�and�let������=���unify��j��(�X���(�s�)�;���t�),��=where��t��and��s��are�normal����?terms�UUnot�forbidden�to��X�7�in��E����.�Then�b���y�denition�of�unication,��������,�X������=��z�p�:�d�(�x;���s;�t;�Y�8�(�x�))�����X�(1)�����O��?where�UU�Y��9�is�a�new�v��q�ariable�(outside��E����).�Supp�Gose��Q�����Y��X���(�s�)��5�=���t�����X��(2)������?W��*�e�UUw���an�t�to�nd�a�substitution����q�suc�h�that���5�=�����q�on��E����.�By�(2)�w�e�ha�v�e�������(�X����G�)(�s��)��=��t�����X��(3)������?Dene�.B���^�so�that��Y�8��N4�=���X����G�,�and��Z����=���Z��u_�for�.Ball�v��q�ariables��Z��^�in�the�en���vironmen�t����?�E���(including�UUthe�case��Z�~4�=���X���).�Calculate:���Q������;w�X�����������=�������(�x:�d�(�x;���s;�t;�Y�8�(�x�))������������=������Եx:�d�(�x;���s��;�t�;��(�Y�8���)(�x�))�����������=������Եx:�d�(�x;���s�G;�t�;��(�Y�8����)(�x�))�����������=������Եx:�d�(�x;���s�G;�t�;��(�X�����)(�x�))�����������=������Եx:�d�(�x;���s�G;��(�X�����)(�s��)�;��(�X�����)(�x�))�������?b���y�%B(3).�In�view�of�the�iden�tit�y��Z����T͍��ؾ����+3���ؾ�=������~�x:�d�(�x;���a;�Z��a;�Z�x�),�%B(whic���h�is�just�another����?expression�UUof�the�second��d�-rule),�applied�with��Z�~4�=���X����G�,�w���e�ha�v�e�������X����N4�=���X�����?�Note��that�this�is�the�step�requiring�the�use�of�extensional�equalit���y��*�.�W�e�cannot����?mak���e��this�step�go�through�using�only�����-reduction�in�the�denition�of�equalit�y�of����?substitutions;��and�in�view�of�the�examples,�this�seems�quite�natural.�The�case�in����?whic���h�UUw�e�ha�v�e��t����1��|s�;����:�:�:����;���t����n���Ӳinstead�of��t��is�handled�similarly��*�.����NNo���w��consider�the�case�of�unifying��X���(�z�p��)�and��s�,�where��X�K�is�a�v��q�ariable�and��z��is�a����?constan���t��gforbidden�to��X��I�in��E����,�and��s��con�tains��z�p��.�By�h�yp�Gothesis,�(�X�����)(�z�p���)��=�(�s��).����?Since���z��0�is�constan���t,��z�p��[��=�޵z��,��so�(�X����G�)�z��u�=�(�s��).��Since���d��is�legal�for��X��{�in��E����,�b���y����?h���yp�Gothesis,�V5�X�����R�do�es�not�con���tain��z�p��.�Let��a�ȍ�=��w�D�:s�[�w�=z�p��],�so��a��do�Ges�not�con���tain��z��.������u�z#f����ܚ�5#f����ܚ��?�Therefore���X�������T͍���m����+3����m�=�����.۵a�G�,�i.e.�(�X��G�)�w��3�=��P(�a��)�w��=��P�s�[�w�D�=z�p��]��for�an���y�v��q�ariable�or�constan�t����?�w�D�.����NLet����b�Ge�the�result�of�the�unication�algorithm,�so��X���z�7��=���az�Ӹ_��<�Y�8�z�p��.�Dene������?�to�UUagree�with����r�on�v��q�ariables�o�Gccurring�in��E����,�and��Y�8��N4�=���z�p��F�.�Then����~������X�����w�������3�=������_(�z�p��(�az��w�_�8�Y�8�z��)����)�w����������3�=������_(�z�p��((�a���)�z��w�_�8�F�)�w����������3�=������_(�z�p��((�a���)�z��))�w����������3�=������_(�a���)�w����������3�=������_(�a�G�)�w����������3�=������_(�X����G�)�w�������N�Therefore�x��X�������T͍��������+3������=�����Q�X�����as�desired.�On�an���y�v��q�ariable��U����other�than��X��,�w���e�ha�v�e����?(�U����)�w���=�E4�U���P�=�(�U��G�)�w�D�.�:�Hence����P�=������as�substitutions.�This�completes�the����?cases�UUcorresp�Gonding�to�the�new�clauses�in�the�denition�of�unication.����NW��*�e�estill�ha���v�e�eto�c���hec�k�ethe�cases�corresp�Gonding�to�ordinary�unication.�Con-����?sider���the�case�when��p�t��=��f���(�t����1��|s�;���t����2���)���and��q��Ѳ=�t��f��(�s����1��|s�;���s����2���).���In���-calculus,�there�are�no����?function��sym���b�Gols��p��}'er�M�se��except�the�binary�sym�b�Gol��ap��for�application.�Usually����?w���e���don't�write��ap��explicitly�but�just�write��p�(�q�[ٲ)�or��pq�"̲for���ap�����(�p;���q��).�So�ocially����?the���only�p�Gossibilit���y�here�is��f�ڧ�=����ap�����;�but�this�one�case�is�as�dicult�as�the�general����?case�UUin�rst-order�unication,�of�course.����NLet�o����=���unify����(�p;���q�[ٲ).�W��*�e�w���an�t�to�sho�w�that�for�some����0�w�e�ha�v�e���y�=����G�.�W��*�e����?ha���v�e,�UUb�y�denition�of�the�unication�algorithm,�����=������1��|s�����2���Ȳwhere��������f�����1��C��=����unify��~,�(�t����1��|s�;���s����1���)�����X�(4)�����L����-.�����2��C��=����unify��~,�(�t����2��|s�����1���;���s����2�������1���)�����X�(5)������?Assume�UU�p�5�=���q�[��G�.�Then������I��t����1��|s��5�=���s����1��������X��(6)��������I��t����2��|s��5�=���s����2��������X��(7)������?Then�UUb���y�induction�h�yp�Gothesis,�(4),�and�(6),�w�e�ha�v�e�for�some������1��|s�,������b��5�=�������1��|s�����1������X��(8)������?By�UU(7)�and�(8),�w���e�ha�v�e������_ҵt����2��|s�����1�������1��C��=���s����2�������1�������1������X��(9)������?By�UU(5)�and�the�induction�h���yp�Gothesis,�w�e�ha�v�e�for�some��������*����2��|s��N4�=�������1�������1������X��(10)������?By�UU(9),�w���e�ha�v�e������ݵ�N4�=�������1��|s�����2�����=�������1�������1��C��=���������z#f����ܚ�5#f����ܚ��?�This�~Ocompletes�the�case�in�whic���h��p��and��q��(�are�binary�comp�Gound�terms�with�the����?same�Йfunction�sym���b�Gol.�In�case��p��and��q�,r�are�unary�comp�ound�terms�with�the�same����?function���sym���b�Gol,�apply�the�induction�h�yp�Gothesis�to�the�argumen�ts.�In�case��p��is����?a���v��q�ariable�not�o�Gccurring�in��q�[ٲ,�the�answ���er�substitution������=���unify��Q�(�p;���q��)���is�giv���en����?b���y���p���=��q�[ٲ,�and����is�the�iden���tit�y�on�other�v��q�ariables.�Since�b�y�h�yp�Gothesis��p�5�=���q�[���,����?w���e��ha�v�e��p�Ul�=�O�p�G�.�Since����is�the�iden�tit�y�on�other�v��q�ariables�than��p�,�w�e�ha�v�e����?��5�=����G�,�UUso����r�itself�is�the�desired�����.�This�completes�the�pro�of.�� ��?�7��S@Unication��and�Second-Order�Logic���?�W��*�e�\�no���w�return�to�the�connection�b�Get�w�een�unication�and�second-order�logic.����?An��oinno�Gcen���t�victim�of�the�15-page�length�limit�for�this�pap�er�w���as�the�detailed����?description�
�of�the�v���ersion�of�second-order�logic�w�e�use.�The�follo�wing�remarks����?will�UUha���v�e�to�suce:�� ���NEac���h��of�the�four�quan�tier�rules�has�to�b�Ge�tak�en�t�wice,�once�for�rst-order����?quan���tiers�9�and�once�for�second-order�quan�tiers.�In�addition�there�are�the���-����?rules:�����������<$���R}��*��)���A�[�t=x�]���gҟw�fe8O��	(֍��*��)���(�x:A�)�t�������X�������<$��έ)�G;���A�[�t=x�]���)������~�w�feA���	(֍�G;����(�x:A�)�t���)���������(��N�These�$frules�p�Germit�us�to�reduce���-terms�when�trying�to�construct�a�pro�of����?b�Gottom-up.�c8These�rules�w���ere�implemen�ted�at�the�same�time�as�rst-order�logic,�in����?the�B�pro���v�er���-�

cmcsc10�GENTZEN�B��[�Beeson�UU1991��5�@],�but�only�simple�second-order�deductions����?could���b�Ge�p�erformed�b���y��GENTZEN�,�b�ecause�a�p�o���w�erful���second-order�unication����?algorithm��w���as�missing.��GENTZEN����could�nd�the�correct�instances�of�mathe-����?matical�4�induction�for�certain�pro�Gofs,�but�could�not�do�circumscription�pro�ofs,����?for�UUexample.����NW��*�e�̋dene�a�system��LD��of�second�order�logic�with�denition�b���y�cases.�The����?in���tuitiv�e�UUidea�is��a���E�d�(�x;���y�[�;�a;�b�)��=��a��UU�if���x��=��y���8else��6b��a�?�In�UUsecond-order�logic,�w���e�can�tak�e��A,�����d�(�x;���y�[�;�A;�B��q�)��=�(�x��=��y�"�!��A�)�8�^��(�x���6�=��y��!��B��q�)����?so�sit�is�not�necessary�to�add�a�constan���t��d��to�second-order�logic.�Ho�w�ev�er,�since����?�d��޲gures�in�our�unication�algorithm�and�hence�in�our�theorem-pro���v�er,���the����?implemen���ted�UUv�ersion�of�second-order�logic�do�Ges�con�tain�a�constan�t��d�.����NThe�쪵�-rules�allo���w�us�to�reduce���-terms,�but�in��LD��w�e�also�need�to�reduce����?�d�-terms.�UUTherefore��LD��includes�the�follo���wing�rules,�whic�h�w�e�call�the��d�-rules:����򍍍���<$���Cb��*��)���A���-�w�feM�G�	(֍�*��)���d�(�x;���x;�A;�B��q�)���������
�Ӡz#f����ܚ�5#f����ܚ���������<$��Η��x���6�=��y�[�;����*��)��B���?�w�feM)#�	(֍�*��)���d�(�x;���y�[�;�A;�B��q�)������޿�������<$��Η��y�"�6�=���x;����*��)��B���?�w�feM)#�	(֍�*��)���d�(�x;���y�[�;�A;�B��q�)��������0������<$�����B��q;����*��)���C����E�w�fe{��	(֍x���6�=��y�[�;����d�(�x;�y�;�A;�B��q�)�;��*��=�>��C�������������<$����B��q;����*��)���C����E�w�fe{��	(֍y�"�6�=���x;����d�(�x;�y�[�;�A;�B��q�)�;��*��=�>�C�������������<$���A;����*��)���C����ǟw�fe_z�	(֍�d�(�x;���x;�A;�B��q�)�;��*��=�>��C�������ȍ�?�Note�5kthat�if��d�(�x;���y�[�;�A;�B��q�)�5kis�regarded�as�an�abbreviation,�these�rules�are�deriv���ed����?rules�tyof�inference.�It�follo���ws�that�pro�Gofs�in��LD��can�b�e�translated�in���to�pro�ofs����?in�4ӾL�;�moreo���v�er�4�the�same�is�true�of�cut-free�pro�Gofs.�It�is�therefore�a�matter�of����?con���v�enience�UUonly�whether�w���e�tak�e��d��as�dened�or�primitiv�e.����NExtend���second-order�logic�b���y�allo�wing�\meta�v��q�ariables"�to�stand�in�place�of����?terms.��ICall�this�system��LDM�.�Second-order�logic��LD��and�its�extension��LDM����?�can�b�b�Ge�translated�in���to���-calculus�b�y�standard�tec�hniques.�W��*�e�will�b�Ge�explicit����?ab�Gout��othose�\standard�tec���hniques."�W��*�e�distinguish�some�of�the�v��q�ariables�of���-����?calculus���and�call�them��c��}'onstants�,�agreeing�not�to�use�them�for�other�purp�Goses.����?W��*�e��jthen�sp�Gecify�some�constan���ts�of���-calculus�to�stand�for�the�prop�ositional����?connectiv���es�["and�for��8��and��9�.�W��*�e�denote�these�constan�ts�b�y�the�same�sym�b�Gols��8����?�and�UU�9�.�Then�the�translation��A���^��0��#��of��A��is�giv���en�b�y��鍒�<A(�8�xA�)�����0���Q�=���8�(�x:A�����0���9�)�����<A(�9�xA�)�����0���Q�=���9�(�x:A�����0���9�)����?The�8`translation�comm���utes�with�the�prop�Gositional�connectiv�es.�Iden�tifying�for-����?m���ulas�5Iof�second-order�logic�with�their�translations,�w�e�can�regard�unication�as����?dened�O�on�form���ulas�of�second-order�logic.�Predicate�sym�b�Gols�are�simply�constan�ts����?of�UU��-calculus.��?*��?�Lemma.����Let��^�A��and��B�p��b�Ge�t���w�o��^form�ulas�of�second-order�logic��LDM�.�Supp�Gose�����?�unify��X��(�A;���B��q�)�UU�succeeds�with�answ���er�substitution���G�.�Then��LD��pro�v�es��A�5�)���B��q�G�.����?�Pr��}'o�of���:��mBy�induction�on�the�computation�of���unify��D��(�A;���B��q�).�Note�that�this�is�a����?sensible��^induction,�since�when���unify��!Qвis�called�on�t���w�o��^form�ulas�of�second-order����?logic,��the�recursiv���e�calls�alw�a�ys�ha�v�e�argumen�ts�whic�h�are�form�ulas�of�second-����?order���logic�as�w���ell.�This�is�so�ev�en�when�w�e�regard��8�xA��as�an�abbreviation�for����?the�UU��-term��8�(�x:A�),�b�Gecause��x:A��is�a�form���ula�of�second-order�logic.����NThe�Y$only�in���teresting�cases�are�the�steps�corresp�Gonding�to�the�new�clauses�in����?the�^denition�of�unication.�Consider�the�case�of���unify���r�(�X���t;���s�),�where��t��and��s����?�are�UUnot�forbidden�to��X���.�Then���5�=����unify��~,�(�X�t;���s�)�is�giv���en�b�y��鍒�1��X����5�=���x:�d�(�x;���t;�s;�Y�8�(�x�))������1�z#f����ܚ�5#f����ܚ��?�where�UU�Y��9�is�a�new�v��q�ariable.�W��*�e�ha���v�e�UUthe�follo���wing�deriv�ation�in��LD�:��o����'����ํ�x��s���)��s���׍��\�:���g���O����\p���\�:�d�(�t;���t;�s;�Y�8�(�t�))���)��s�����B׍��N���g���l�/���\p���N�(�x:�d�(�x;���t;�s;�Y�8�(�x�)))�t���)��s���������N�No���w���consider�the�case�of���unify��\�(�X���z�p�;���az��),���where��z���is�constan�t�and�forbidden����?to�UU�X�7�and�do�Ges�not�o�ccur�in��a�.�Then�w���e�ha�v�e�the�follo�wing�deriv��q�ation�in��LD�:��'f3���������]����t덑S�ѵaz�7��)���az����,$�F��)��F���3���p����Ä�!~)����⍍�p�F��)��az������3���S�џ��Ä�J�����⍍�]�۵az��w�_�8�F���)��az������3���N���Ä�V�����\p���N�w�D�(�aw�}ø_�8�F�)�z���)��Az�����B׍��N���g���V������7���`D��X���z�p��5�)���az������'f2��N�This�UUcompletes�the�pro�Gof.�������?�8��S@Automated��Deduction�in�Second-Order�Logic������?�Robinson's��uunication�algorithm�is�the�k���ey�to�theorem-pro�ving�in�rst-order����?logic,�� whether�one�com���bines�it�with�resolution�or�with�\bac�kw�ards�Gen�tzen"����?metho�Gds,���or�uses�it�in�an�equational�theorem-pro���v�er.���The�extensions�to�the�uni-����?cation��<algorithm�in���tro�Gduced�here�will�ha�v�e�applications�in�automated�deduction,����?also�g�indep�Genden���t�of�whether�one�uses�resolution�or�some�other�metho�d�of�pro�of����?searc���h.����NIn��[�Beeson�UU1991��5�@]�one�can�nd�the�Prolog�source�co�Gde�for�a�theorem-pro���v�er����?for��Frst-order�logic,�based�on�b�Gottom-up�construction�of�cut-free�pro�ofs�in�a����?Gen���tzen��7sequen�t�calculus.�The�pro�v�er�uses�meta�v��q�ariables�to�stand�for�as-y�et-����?undetermined�Cterms,�and�instan���tiates�these�meta�v��q�ariables�b�y�unication�when����?the�m�pro�Gof�construction�reac���hes�leaf�no�des�of�the�pro�of�tree�(axioms).�W��*�e�will����?not�M�assume�familiarit���y�with�this�pro�v�er,�but�only�with�the�general�idea�of�bac�k-����?w���ards���pro�Gof-searc�h�in�a�sequen�t�calculus,�in�tro�Gducing�meta�v��q�ariables�when�(cer-����?tain)�46quan���tiers�are�stripp�Ged�a�w�a�y��*�,�and�instan�tiating�the�meta�v��q�ariables�later�b�y����?unication.��dThe�pro���v�er��ddescrib�Ged�in�[�Beeson�UU1991��5�@]�can�b�e�extended�to�second-����?order�elogic�b���y�c�hanging�the�unication�algorithm�to�the�one�giv�en�in�this�pap�Ger.����NW��*�e�UUwill�describ�Ge�ho���w�it�pro�v�es�the�theorem���,���6��a���6�=��b��)�9�X���(�X��(�a�)�8�^�:�X���(�b�))�:����?�First,��ithe�quan���tier�will�b�Ge�\op�ened�up"�and�the�v��q�ariable��X��K�replaced�b���y�a����?meta���v��q�ariable.���In�[�Beeson�UU1991��5�@]�w�e�used�capital�letters�for�meta�v��q�ariables;�this����?clashes���with�the�con���v�en�tion���that�capital�letters�are�used�in�second-order�logic�for����?second-order�UUv��q�ariables,�so�here�w���e�use��X��for�a�meta�v��q�ariable.�The�goal�is�no�w���,����:�a���6�=��b��)��X�(�a�)�8�^�:�X�(�b�)�:����?�This�UUgoal�is�divided�in���to�t�w�o�goals,������s�a���6�=��b��)��X�(�a�)�����X�(11)��������T�z#f����ܚ�5#f����ܚ��?�and��
z����˝�a���6�=��b��)�:�X�(�b�)�����X�(12)����z���?�GENTZEN���will��w���ork�on�11�rst.�It�will�unify��X�(�a�)�with��true�,�instan�tiating�the����?meta���v��q�ariable�UU�X��as������o]�X���=��x:�d�(�x;���a;���true��^/�;��Y�I��x�)�����X�(13)������?pro�Gducing�UUthe�new�goal���^���/�a���6�=��b��)��x:�d�(�x;���a;���true��^/�;��Y�I��x�)�a:����?�The�UUclause�implemen���ting�the��)����-rule�then�applies,�reducing�the�goal�to�����4i�a���6�=��b��)��d�(�a;���a;���true��^/�;��Y�I��x�)�:����?�Then�UUa��d�-rule�applies,�pro�Gducing�the�goal�����`�a���6�=��b��)���true�����?�whic���h��Ris�an�axiom.�No�w��GENTZEN��;�b�Gegins�to�w�ork�on�(12),�with�the�meta�v��q�ari-����?able�UU�X�instan���tiated�as�in�13.�Sp�Gecically��*�,�the�goal�is��������a���6�=��b��)�:�x:�d�(�x;���a;���true��^/�;��Y�I��x�)�b����?�The�UUrule��)��:��is�applied,�pro�Gducing�the�goal������ڵx:�d�(�x;���a;���true��^/�;��Y�I��x�)�b;�a���6�=��b��)���false�����?�The�UU����)��rules�is�applied,�pro�Gducing�the�goal������i�d�(�b;���a;���true��^/�;��Y�I��b�)�;�a���6�=��b��)���false�����?�One�UUof�the��d�-rules�no���w�applies,�pro�Gducing�the�new�goal����À�Y�I��b;���a���6�=��b��)���false�����?�The�UUaxiom�clause�no���w�mak�es�a�call�to���unify��i�(�Y�I��b;�����false��Ť�),�instan�tiating��Y���as�����8��Y����=���y�[�:�d�(�y�;���b;���false��Ť�;��Z�y�[ٲ)����?for�Na�new�meta���v��q�ariable��Z�.�This�mak�es�the�attempt�to�pro�v�e��X�a�*W�^�:�X�b�N�succeed,����?returning�UUthe�answ���er�substitution������X����=���x:�d�(�x;���a;���true��^/�;�y�[�:�d�(�y�;���b;���false��Ť�;��Z�y�[ٲ)�x�)��z���NThe�UUpro�Gof�pro�duced,�rewritten�in�tree�form,�is�as�follo���ws,�with������t���=��x:�d�(�x;���a;���true��^/�;�y�[�:�d�(�y�;���b;���false�����;��Z�y�[ٲ)�x�)��:������ܠz#f����ܚ�5#f���XJ���!꣍���},�����򍍟���|��a���6�=��b��)���true��������?���g��������\p���?�a���6�=��b��)��d�(�a;���a;���true��^/�;�y�[�:�d�(�y�;���b;���false�����;��Z�y�[ٲ)�����B׍��?���g���������7������a���6�=��b��)��ta������}+�����򍍤�`��������ํ��U���false��rn�)����false����׍��/ف���g����)���\p���/فd�(�b;���b;���false�����;��Z�y�[ٲ)�;�a���6�=��b��)���false������B׍��"d����g��������\p���"d��(�y�[�:�d�(�y�;���b;���false�����;��Z�y�[ٲ))�b;�a���6�=��b��)���false������B׍������g��������\p����d�(�b;���a;���true��^/�;��(�y�[�:�d�(�y�;���b;���false�����;��Z�y�[ٲ))�b�)�;�a���6�=��b��)���false������B׍������g���������7���L
ʵa���6�=��b;���tb��)���false�����������L
ʟ��g���V������7���\��a���6�=��b��)�:�tb���������������g���
`�����7���漿a���6�=��b��)��ta�8�^�:�tb�����������ܟ��g���j\􎎟\p�����a���6�=��b��)�9�X���(�X�a�8�^�:�X���b�)�����Fmw��NThis��pro�Gof�illustrates�the�use�of�the�rst�new�clause�in�the�denition�of����?unication.�UUThe�circumscription�examples�use�the�second�new�clause�as�w���ell.�� ��?�References������?�[Bak��9er-Ginsb�A�erg�T1989]�����,A.�ǤBak��9er�and�M.�Ginsb�A�erg.�-.A��vtheorem�pro�v�er�for�prioritized����F��circumscription.�͛�2�j��		cmti9�Pr��o�c�e�e�dings���of�the�Eleventh�International�Joint�Confer��enc�e���on�A�Îr-����F��ticial�N<Intel�x�ligenc��e�,�Tpp.�463{467,�Morgan�Kaufmann,�Los�Altos,�Calif.�(1989).������?[Barendregt�T1981]�����H.��WP��:�.�Barendregt.�m
�The���L��amb�da�Calculus:�Its�Syntax�and�Semantics�.����F��North-Holland,�TAmsterdam�(1981).������?[Beeson�T1991]���z�6M.�@�Beeson.���Some�applications�of�Gen��9tzen's�pro�A�of�theory�in�automated����F��deduction.���In�9�Sc��9hro�A�eder-Heister�(ed.),��Extensions�Z�of�L��o�gic�Z�Pr�o�gr�amming�,�9�Lecture����F��Notes�HCin�Articial�In��9telligence��475�,�Springer-V��:�erlag,�Berlin/�Heidelb�A�erg/�New�Y�ork����F��(1991).������?[Ginsb�A�erg�T1989]����.M.�gCGinsb�A�erg.��A�gcircumscriptiv��9e�theorem�pro�v�er.���A�Îrticial��HIntel�x�ligenc��e����F���39�,�TNo.�2�(1989).������?[Huet�T1975]���r�:G.�0�Huet.�l=A�0�unication�algorithm�for�t��9yp�A�ed���-calculus.��The��or�etic�al�g�Com-����F��puter�N<Scienc��e�T�1��(1975)�27{52.������?[Lifsc��9hitz�T1985]�����QV.�>�Lifsc��9hitz.��Computing�circumscription.��Pr��o�c�e�e�dings�_�of�the�Ninth����F��International��&Joint�Confer��enc�e��&on�A�Îrticial�Intel�x�ligenc��e�,���pp.�121{127,�Morgan�Kauf-����F��mann,�TLos�Altos,�Calif.�(1985).������?[McCarth��9y�T1986]�����jJ.�,McCarth��9y��:�.��1Applications�of�circumscription�to�formalizing����F��common-sense�Tkno��9wledge.���A�Îrticial�N<Intel�x�ligenc��e��28��(1986)�89{116.������?[Miller�Tand�Nadath��9ur]�����D.�H�Miller�and�G.�Nadath��9ur.���An�Ov�erview�of���-Prolog���In��Pr��o-����F��c��e�e�dings���of�the�Fifth�International�Symp��osium�on�L�o�gic�Pr�o�gr�amming,�Se�attle,�A�Îugust����F��1988�.������?[Pra��9witz�T1967]���}��D.��-Pra��9witz.��9Completeness�and�Hauptsatz�for�second�order�logic.��The��o-����F��ria�N<33�,�T246-258.�����Վ���;�z#f���=DF��
cmmib10�;��N�cmbx12�2�j��		cmti9�+����		cmsy9�)5��"		cmmi9�(�Aa�cmr6�'t�:		cmbx9�&o���		cmr9� p�0J

cmsl10��':

cmti10��"V

cmbx10���N�ffcmbx12��-�

cmcsc10�
!",�

cmsy10�O!�cmsy7�
�b>

cmmi10�	0e�rcmmi7�K�`y

cmr10�ٓ�Rcmr7��~����

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists