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/ImplicitTyping.dvi

����;� TeX output 2005.09.27:1615������o#f����ܚ�5#f����ܚ��v�!�src:22ImplicitTyping.tex���N�ffcmbx12�Implicit�ffT���yping�in�Lam�b�s3da�Logic��"�%���x��K�`y

cmr10�Mic���hael�UUBeeson���^��ٓ�Rcmr7�1����i����%�o���		cmr9�San�TJos������Xe�State�Univ��9ersit�y��:�,�TSan�Jos����Xe,�Calif.��������ߤN		cmtt9�beeson@cs.sjsu.edu,������www.cs.sjsu.edu/faculty/beeson��&{ҍ���[s��t�:		cmbx9�Abstract.����&��src:25ImplicitTyping.tex�Otter-lam��9b�A�da��,is�a�theorem-pro�v�er�based�on�an�un�t�yp�A�ed�logic����[s�with�+lam��9b�A�da�calculus,�called�Lam�b�A�da�Logic.�Otter-lam�b�A�da�is�built�on����[s�Otter,��=so�it�uses�resolution�pro�A�of�searc��9h,�supplemen�ted�b�y�demo�A�dulation����[s�and��paramo�A�dulation�for�equalit��9y�reasoning,�but�it�also�uses�a�new�al-����[s�gorithm,�cSlam��9b�A�da�unication,�for�instan�tiating�v��|rariables�for�functions�or����[s�predicates.�>&The�basic�idea�of�a�t��9yp�A�ed�in�terpretation�of�a�pro�A�of�is�to�\t�yp�A�e"����[s�the��&function�and�predicate�sym��9b�A�ols�b�y�sp�A�ecifying�the�legal�t�yp�A�es�of�their����[s�argumen��9ts�ּand�return�v��|ralues.�The�idea�of�\implicit�t�yping"�is�that�if�the����[s�axioms���can�b�A�e�t��9yp�ed�in�this�w��9a�y���then�the�consequences�should�b�e�t��9y-����[s�pable�H'to�A�o.�This�is�not�true�in�general�if�unrestricted�lam��9b�da�unication����[s�is�kallo��9w�ed,�but�for�a�restricted�form�of�\t�yp�A�e-safe"�lam�b�A�da�unication�it����[s�is���true.�The�main�theorem�of�the�pap�A�er�sho��9ws�that�the�abilit�y�to�t�yp�A�e����[s�pro�A�ofs�yif�the�axioms�can�b�e�t��9yp�ed�w��9orks�for�the�rules�of�inference�used����[s�b��9y�.	Otter-lam�b�A�da,�if�t�yp�A�e-safe�lam�b�A�da�unication�is�used,�and�if�demo�d-����[s�ulation�}�and�paramo�A�dulation�from�or�in��9to�v��|rariables�are�not�allo�w�ed.�All����[s�the�B�in��9teresting�pro�A�ofs�obtained�with�Otter-lam�b�A�da,�except�those�explic-����[s�itly��Bin��9v�olving�un�t�ypable�constructions�suc�h�as�xed-p�A�oin�ts,�are�co�v�ered����[s�b��9y�Tthis�theorem.�� �j���?���N�cmbx12�1��S@In��tro�`duction:��the�no-nilp�oten��ts�example�����?�src:29ImplicitTyping.tex�W��*�e���b�Gegin�with�an�example.�Consider�the�problem�of�pro���ving�that�there�are�no����?nilp�Goten���t�Celemen�ts�in�an�in�tegral�domain.�T��*�o�explain�the�problem:�an�in�tegral����?domain�
7is�a�ring��
�b>

cmmi10�R���in�whic���h��xy�"�=��0�implies��x��=�0�or��y�"�=�0,�i.e.�there�are�no�zero����?divisors.��	A���elemen���t��c��of��R�вis�called���':

cmti10�nilp��}'otent��if�for�some�p�Gositiv�e�in�teger��n�,��c���^��	0e�rcmmi7�n�����?�(i.e.,��	�c��m���ultiplied�b�y�itself��n��times)�is�zero.�Informally��*�,�one�pro�v�es�b�y�induction����?on�"�n��that��c���^��n�����is�not�zero.�The�equation�dening�exp�Gonen���tiation�is��x���^��s�(�n�)��>Ҳ=���x��{�
!",�

cmsy10���x���^��n��q~�.����?If�I��c��and��c���^��n���v�are�b�Goth�nonzero,�then�the�in���tegral�domain�axiom�implies�that��c���^��n�+1�����?�is�}also�nonzero.�It�is�a�v���ery�simple�pro�Gof,�but�it�is�in�teresting�b�Gecause�it�in�v�olv�es����?t���w�o�>��typ��}'es��of�ob��8jects,�ring�elemen���ts�and�natural�n�um�b�Gers,�and�the�pro�of�in���v�olv�es����?a���mix�of�the�algebraic�axioms�and�the�n���um�b�Ger-theoretical���axioms�(mathematical����?induction).�_�Since�the�pro�Gof�is�so�simple,�w���e�can�consider�the�issues�raised�b�y����?ha���ving�UUt�w�o�t�yp�Ges�of�ob��8jects�without�b�eing�distracted�b���y�a�complicated�pro�of.����N�src:41ImplicitTyping.texHo���w��Qare�w�e�to�formalize�this�theorem�in�rst�order�logic?�The�traditional�w�a�y����?w���ould��Ab�Ge�to�ha�v�e�t�w�o�unary�predicates��R�Dz(�x�)�and��N��(�x�),�whose�meaning�w�ould����?b�Ge�7�"�x��is�a�mem���b�er�of�the�ring��R�Dz"�and�"�x��is�a�natural�n���um�b�er",�7�resp�ectiv�ely��*�.����?Then�,the�ring�axioms�w���ould�b�Ge�\relativized�to��R�Dz",�whic�h�means�that�instead�����*�o#f����ܚ����?�I�A�I����5#f����ܚ��?�of��sa���ying��x�.��+�0�-�=�0,��w�e�w�ould�sa�y��R�Dz(�x�)�-��!��x�.��+�0�-�=�0,��or�in�clausal�form,����?��R�Dz(�x�)�j�x�*��+�0�#a=�0.���(The�v���ertical�bar�means�\or",�and�the�min�us�sign�means����?\not".)�L�Similarly��*�,�the�axiom�of�induction�w���ould�b�Ge�relativized�to��N��.�The�axiom����?of���induction�is�usually�form���ulated�using�a�sym�b�Gol��s��for�the�successor�function,�or����?\next-in���teger"�U�function.�F��*�or�example,��s�(4)��=�5.�U�The�sp�Gecic�instance�of�induction����?w���e�UUneed�for�this�pro�Gof�can�b�e�expressed�b���y�the�t�w�o�(unrelativized)�clauses��e������P�x�����o��9��6�=��0�UU�j��x�����g�@L�(�x�)��������Բ=������s�0�UU�j��x�����n��8��=��0�:����������x�����o��9��6�=��0�UU�j��x�����s�(�g�@L�(�x�))��������Ը6�=������s�0�UU�j��x�����n��8��=��0�:������?�src:53ImplicitTyping.tex�T��*�o��see�that�this�corresp�Gonds�to�induction,�think�of��g�[ٲ(�x�)�as�a�constan���t�(on�whic�h����?x�Zis�not�allo���w�ed�Zto�dep�Gend).�Then�the�middle�literal�of�the�rst�clause�is��x���^��c����=��0.����?That��Tis�the�induction�h���yp�Gothesis.�The�middle�literal�of�the�second�clause�is����?�x���^��s�(�c�)��ஸ6�=�Ǒ0.�U�That�is�the�negated�conclusion�of�the�induction�step.�W��*�e�ha���v�e�U�used��o����?�instead��of�0�for�the�natural�n���um�b�Ger��zero,�whic���h�migh�t�not�b�Ge�the�same�as�the����?ring�UUelemen���t�0.����N�src:60ImplicitTyping.texA�'traditional�8course�in�logic�w���ould�teac�h�y�ou�that�to�formalize�this�problem,����?y���ou�8�need�to�relativize�all�the�axioms�using��R�L��and��N��.�Just�to�b�Ge�explicit,�the����?relativized�UUv���ersions�of�the�induction�axioms�w�ould�b�Ge��e������Q��R�Dz(�x�)�UU�j��5�8�N��(�n�)��j��x�����o��9��6�=��0��j��x�����g�@L�(�x;n�)�����=�0��j��x�����n��8��=�0�:����������Q��R�Dz(�x�)�UU�j��5�8�N��(�n�)��j��x�����o��9��6�=��0��j��x�����s�(�g�@L�(�x;n�))��#���6�=�0��j��x�����n��8��=�0�:����������Q��R�Dz(�x�)�UU�j��5�8�N��(�n�)��j��N��(�g�[ٲ(�n;���x�))�:������?�src:67ImplicitTyping.tex�and�UUw���e�w�ould�need�additional�axioms�suc�h�as�these:�������D¸�R�Dz(�x�)�UU�j��5�8�N��(�n�)��j��R��(�x�����n��q~�)�:���������D¸�R�Dz(�x�)�UU�j��5�8�R��(�y�[ٲ)��j��R��(�x�8�+��y�[ٲ)�:���������D¸�R�Dz(�x�)�UU�j��5�8�R��(�y�[ٲ)��j��R��(�x�8���y�[ٲ)�:���������D¸�R�Dz(�x�)�UU�j��x�8�+�0��=�0�:������?�src:74ImplicitTyping.tex�and�UUso�on�for�the�other�ring�axioms.��o����?�2��S@Implicit��t��yping�in�rst�order�logic��o���?�src:77ImplicitTyping.tex�No���w���here�is�the�question:�when�formalizing�this�problem,�do�w�e�need�to�relativize����?the�'�induction�axioms�and�the�ring�axioms�using��R�Dz(�x�)�and��N��(�x�),�or�not?�Exp�Ger-����?imen���tally��*�,�T�if�w�e�put�the�unrelativized�axioms�in�to�Otter�(Otter-���is�not�needed,����?since�*�w���e�ha�v�e�explicitly�giv�en�the�pro�v�er�the�required�instance�of�induction),�w�e����?do��nd�a�pro�Gof.�What�do�es�this�pro�of�actually�pro���v�e?��Certainly�it�sho���ws�that�in����?an���y���in�tegral�domain�whose�underlying�set�is�the�natural�n�um�b�Gers,�there�are�no����?nilp�Goten���ts,��since�in�that�case�all�the�v��q�ariables�range�o�v�er�the�same�set,�and�no����?question��Pof�t���yping�arises.�W��*�e�can�pro�v�e�informally�that�an�y�coun�table�in�tegral����?domain���is�isomorphic�to�one�whose�underlying�set�is�the�natural�n���um�b�Gers.���But����?this�(�is�not�the�theorem�that�w���e�set�out�to�pro�v�e,�so�it�ma�y�app�Gear�that�w�e�m�ust����?use�UU�R�Dz(�x�),��N��(�x�),�and�relativization�to�formalize�this�problem.������o#f����ܚ������ջI�A�I�I����5#f����ܚ��N�src:84ImplicitTyping.tex�That�;�is,�ho���w�ev�er,�;�not�so.�The�metho�Gd�of�\implicit�t���yping"�sho�ws�that�under����?certain�i^circumstances�w���e�can�disp�Gense�with�unary�predicates�suc�h�as��R�}%�and��N��.����?One�Z"assigns�a�t���yp�Ge�to�eac�h�predicate,�function�sym�b�Gol,�and�constan�t�sym�b�Gol,����?telling��iwhat�the�sort�of�eac���h�argumen�t�is,�and�the�sort�of�the�v��q�alue�(in�case�of����?a�y9function;�predicates�ha���v�e�y9Bo�Golean�v��q�alue).�Sp�ecically�eac���h�argumen�t�p�Gosition����?of��|eac���h�function�or�predicate�sym�b�Gol�is�assigned�a�sort�and�the�sym�b�Gol�is�also����?assigned�42a�\v��q�alue�t���yp�Ge"�or�\return�t�yp�Ge".�F��*�or�example,�in�this�problem�the�ring����?op�Gerations���+�and����ha���v�e���the�t���yp�e�of�functions�taking�t���w�o��˵R����argumen�ts�and����?pro�Gducing�1an��R�(��v��q�alue,�whic���h�w�e�migh�t�express�as��ty�[�pe�(�R��;����+(�R�;�R��))�:�1�If�w���e�use����?�N�'0�for�the�sort�of�natural�n���um�b�Gers�then�w���e�need�to�use�a�dieren�t�sym�b�Gol�for����?addition���on�natural�n���um�b�Gers,���sa�y��ty�[�pe�(�N���;�����plus���(�N�;���N��)),�and�w���e�need�to�use�a����?dieren���t���sym�b�Gol�for�0�in�the�ring�and�zero�in��N��.�The�Sk�olem�sym�b�Gol��g�J��in�the����?induction�8axiom�has�the�t���yp�Ge�sp�ecication��ty�[�pe�(�N���;���g��(�R�Dz)).�8The�exp�onen���tiation����?function�UUhas�the�t���yp�Ge�sp�ecication��ty�[�pe�(�R��;���R����^��N���x�)).���w��N�src:98ImplicitTyping.texConstan���ts���are�considered�as�0-ary�function�sym�b�Gols,�so�they�get�assigned����?t���yp�Ges,�̬for�example��ty�[�pe�(�R��;����0)�and��ty�pe�(�N���;���o�).�W��*�e�call�a�form���ula�or�term��c��}'orr�e�ctly����?typ��}'e�d�MͲif�it�is�built�up�consisten���tly�with�these�t�yp�Ge�assignmen�ts.�Note�that�v��q�ariables����?are�8not�t���yp�Ged;�e.g.��x��w�+��y�`�is�8correctly�t�yp�Ged�no�matter�what�v��q�ariables��x��and��y����?�are.�o�T���yp�Ges�as�w�e�discuss�them�here�are�not�quite�the�same�as�t�yp�Ges�in�most����?programming�|�languages,�where�v��q�ariables�are�declared�to�ha���v�e�|�a�certain�t���yp�Ge.����?Here,��cwhen�a�v��q�ariable�o�Gccurs�in�a�form���ula,�it�inherits�a�t�yp�Ge�from�the�term�in����?whic���h�Mit�o�Gccurs,�and�if�it�o�ccurs�again�in�the�same�clause,�it�m���ust�ha�v�e�the�same����?t���yp�Ge�]9at�the�other�o�cccurence�for�the�clause�to�b�e�considered�correctly�t���yp�ed.�Once����?all���the�function�sym���b�Gols,�constan�ts,�and�predicate�sym�b�Gols�ha�v�e�b�Geen�assigned����?t���yp�Ges,�ʠone�can�c�hec�k�(man�ually)�whether�the�clauses�supplied�in�an�input�le�are����?correctly�UUt���yp�Ged.����N�src:110ImplicitTyping.texThen��none�observ���es�that�if�the�rules�of�inference�preserv�e�the�t�yping,�and�if����?the�7{axioms�are�correctly�t���yp�Ged,�and�the�pro�v�er�nds�a�pro�Gof,�then�ev�ery�step����?of��the�pro�Gof�can�b�e�correctly�t���yp�ed.�That�means�that�it�could�b�e�con���v�erted����?in���to�~�a�pro�Gof�that�used�unary�predicates�for�the�sorts.�Hence,�if�it�assists�the����?pro�Gof-nding���pro�cess�to�omit�these�unary�predicates,�it�is�all�righ���t�to�do�so.����?This�m�tec���hnique�w�as�in�tro�Gduced�long�ago�in�[4],�but�McCune�sa�ys�it�w�as�already����?folklore�)[at�that�time.�It�implies�that�the�pro�Gof�Otter�nds�using�an�input�le����?without��6relativization�actually�is�a�v��q�alid�pro�Gof�of�the�theorem,�rather�than�just����?of�UUthe�sp�Gecial�case�where�the�ring�elemen���ts�are�the�natural�n�um�b�Gers.����N�src:119ImplicitTyping.tex\Implicit��t���yping"�is�the�name�of�this�tec�hnique,�in�whic�h�unary�predicates����?whose��function�w���ould�b�Ge�to�establish�t�yping�are�omitted.�There�are�t�w�o�w�a�ys�to����?use��implicit�t���yping.�First,�w�e�could�just�omit�the�unary�predicates,�let�a�theorem-����?pro���ving�Bkprogram�nd�a�pro�Gof,�and�afterw�ards�v�erify�b�y�hand�(or�b�y�a�computer����?program)���that�the�pro�Gof�is�indeed�w���ell-t�yp�ed.���Second,�w���e�could�v�erify�that�the����?axioms���are�w���ell-t�yp�Ged,���and�pro���v�e���that�the�inference�rules�used�in�the�pro���v�er����?lead�Qpfrom�correctly�t���yp�Ged�clauses�to�correctly�t�yp�Ged�clauses.�Let�us�explore�this����?second�L�alternativ���e.�In�order�to�state�and�pro�v�e�a�theorem,�w�e�rst�giv�e�some����?denitions:������o#f����ܚ����?�IV����5#f����ܚ����?��"V

cmbx10�Denition��T1.�����@�src:127ImplicitTyping.tex�A����t���yp�Ge�8�sp�ecication��8�is�an�expr��}'ession�of�the�form��ty�[�pe�(�R��;���f���(�U���;�V�8�))�,����?wher��}'e���R��,��U��,�and��V���ar�e�\typ�e�symb�ols".�A���ny�rst-or�der�terms�not�c�ontaining�vari-����?ables�!�may�b��}'e�use�d�as�typ�e�symb�ols.�Her�e�`typ�e'�must�o�c�cur�liter�al���ly,�and��f�5Y�c�an����?b��}'e��any�symb�ol.�The�numb�er�of�ar�guments�of��f���,�her�e�shown�as�two,�c�an�b�e�any����?numb��}'er,���including�zer�o.��/͍�N�src:133ImplicitTyping.tex�The�s~t���yp�Ge��R��E�is�called�the��value���typ��}'e��of��f���.�The�sym�b�Gol��f��
�is�called�the�sym�b�Gol����?of�UUthe�t���yp�Ge�sp�ecication,�and�the�n���um�b�er�UUof�argumen���ts�of��f�h�is�the��arity�.��{�����?�Denition��T2.�����@�src:136ImplicitTyping.tex�A���t���yping��(�of�a�term�is�an�assignment�of�typ��}'es�to�the�variables����?o��}'c�curring���in�the�term�and�to�e��}'ach�subterm�of�the�term.�A���typing�of�a�liter�al�is����?similar,��[but�the�formula�itself�must�get�value�typ��}'e���b�Go�ol����.�A��Ktyping�of�a�clause�is����?an�Lassignment�that�simultane��}'ously�typ�es�al���l�the�liter�als�of�the�clause.�A�*typing����?of�>�a�term�(or�liter��}'al�or�clause�or�set�of�clauses)��t��is��correct���with�resp�Gect�to�a�list����?of�UUt���yp�Ge�sp�ecications��S�'t�pr��}'ovide�d���that��K�N�src:138ImplicitTyping.tex(i)���e��}'ach�o�c�curr�enc�e�of�a�variable�in��t��is�assigne�d�the�same�typ�e.����N�src:140ImplicitTyping.tex(ii)���e��}'ach�subterm��r��of��t��is�typ�e�d�ac�c�or�ding�to�a�typ�e�sp�e�cic�ation�in��S����.�That����?is,���if��r��is��f���(�u;���v�[ٲ)��and��f��(�u;���v�[ٲ)�,�u�,�and��v�.��ar��}'e�assigne�d�typ�es��a�,�b�,and��c��r�esp�e�ctively,����?then���ther��}'e�is�a�typ�e�sp�e�cic�ation�in��S�'t�of�the�form��ty�[�pe�(�a;���f���(�b;�c�))�.��K�N�src:144ImplicitTyping.tex(iii)���e��}'ach�o�c�curr�enc�e�of�e�ach�subterm��r���of��t��in��t��has�the�same�value�typ�e.����N�src:147ImplicitTyping.tex�In�<fthe�denition,�nothing�prev���en�ts�<f�S���from�ha���ving�more�than�one�t�yp�Ge�sp�eci-����?cation���for�the�same�function�sym���b�Gol�and�arit�y��*�.�Condition�(iii)�is�needed�in�suc�h����?a�UUcase.��K�N�src:150ImplicitTyping.texThe�}�phrase,��c��}'orr�e�ctly��typ�e�d�term�}��t�,�is�short�for�\term��t��and�a�correct�t���yping����?of�UU�t��with�resp�Gect�to�some�list�of�t���yp�e�sp�ecications�giv���en�b�y�the�con�text".����N�src:152ImplicitTyping.tex�R��}'emark�.�LAllo���wing�t�yp�Ge�sp�ecications�to�con���tains�v��q�ariables�w�ould�corresp�Gond����?to��p�Golymorphic�t���yp�es,�i.e.�o���v�erloading��of�function�sym���b�ols.�W��*�e�do�not�allo���w�suc�h����?t���ypings,��Abut�of�course�at�the�meta-lev�el�w�e�can�refer�to�a�\t�yping�of�the�form����?�i�(�U���;���U��)."�_7That�co���v�ers�_7an�y�sp�Gecic�t�yping�suc�h�as��i�(�N���;���N��),�etc.�F��*�or�rst-order����?theories,��*usually�constan���t�terms�will�suce�for�naming�the�t�yp�Ges�(whic�h�are����?then�UUusually�called��sorts��rather�than�t���yp�Ges,�as�in�\m�ulti-sorted�logic").����N�src:157ImplicitTyping.texThe���simplest�theorem�on�implicit�t���yping�concerns�the�inference�rule�of�(bi-����?nary)�UUresolution.����^��1����{�����?�Theorem��T1.���}�
�src:163ImplicitTyping.tex�Supp��}'ose��0e�ach�function�symb�ol�and�c�onstant�o�c�curring�in�a�the�ory����?�T�cS�is���assigne��}'d�a�unique�typ�e�sp�e�cic�ation,�in�such�a�way�that�al���l�the�axioms����?of����T��=�ar��}'e�c�orr�e�ctly�typ�e�d�(with�r�esp�e�ct�to�this�list�of�typ�e�sp�e�cic�ations).�Then����?c��}'onclusions�Mdr�e�ache�d�fr�om��T���by�binary�r�esolution�(using�rst-or�der�unic�ation)����?ar��}'e���also�c�orr�e�ctly�typ�e�d.��/͍�?�src:169ImplicitTyping.texR��}'emark���.���This�theorem�is�p�Gerhaps�implicit�in�[4].�W��*�e�giv���e�it�here�mainly�to����?prepare�UUthe�w���a�y�UUfor�extensions�to�lam���b�Gda�logic�in�the�next�section.��?�	���ff8�ϟ
L͍��������-=��Aa�cmr6�1�����
�In�TJthe�follo��9wing�theorem,�w�e�assume�(as�is�customary�with�resolution)�that�after�a����
theory�G#has�b�A�een�brough��9t�to�clausal�form,�the�v��|rariables�in�distinct�clauses�are�renamed����
so�Tthat�no�v��|rariable�o�A�ccurs�in�more�than�one�clause.�����0�o#f����ܚ�����/��V����5#f����ܚ��?�src:172ImplicitTyping.tex�Pr��}'o�of�.�ȝSupp�Gose�that�literal��P�c��(�r��)�resolv���es�with�literal���P�c��(�t�),�where��r���and��t��are����?terms;�o}then�there�is�a�substitution����V�suc���h�that��r�G�"�=���t�[ٲ,�the�unifying�substitution.����?Here�qH�P��ײstands�for�an���y�atomic�form�ula�and��t��and��r��e�migh�t�stand�for�sev�eral�terms�if����?�P�
��has��/more�than�one�argumen���t�p�Gosition.�Since��P�c��(�r��)�and��P�c��(�t�)�are�correctly�t���yp�ed����?b���y��h�yp�Gothesis,��r�+��and��t��m�ust�ha�v�e�the�same�v��q�alue�t�yp�Ge�(if�they�are�not�v��q�ariables).����?The�Fresult�of�the�resolution�will�b�Ge�a�disjunction�of�literals��Q�[ٸj�S�����,�Fwhere��Q��and����?�S����are��the�remaining�(unresolv���ed)�literals�in�the�clauses�that�originally�con�tained����?�P�c��(�r�G�)��+and���P��(�t�),�resp�Gectiv���ely��*�.�No�w��Q��and��S���are�correctly�t�yp�Ged�b�y�h�yp�Gothesis,����?so��w���e�just�need�to�sho�w�that�applying�the�substitution���L��to�a�correctly�t�yp�Ged����?term��Tor�literal�will�pro�Gduce�a�correctly�t���yp�ed�term�or�literal.�This�will�b�e�true����?b���y���induction�on�the�complexit�y�of�terms,�pro�vided�that�substitution���Nɲassigns����?to���eac���h�v��q�ariable��x��in�its�domain,�a�term��q����whose�v�alue�t���yp�Ge�is�the�same�as�the����?v��q�alue�Ĵt���yp�Ge�of��x��in�the�clause�in�whic�h��x��o�Gccurs.�In�rst-order�unication�(but�not����?in�#�lam���b�Gda�unication)�v��q�ariables�get�assigned�a�v�alue�in�unication�only�when����?the��/v��q�ariable�o�Gccurs�as�an�argumen���t,�either�of�a�paren�t�term�or�a�paren�t�literal.����?That��2is,�a�v��q�ariable�cannot�o�Gccur�in�the�p�osition�of�a�literal.�Th���us�when�w�e�are����?unifying�i�f���(�x;���u�)�and��f��(�q�[�;���v��),�i�x��will�get�assigned�to��q�[ٲ,�and�the�t���yp�Ge�of��x��and�the����?v��q�alue��t���yp�Ge�of��q�]��m�ust�b�Ge�the�same�since�they�are�b�oth�in�the�rst�argumen���t�place����?of�UU�f���.�That�completes�the�pro�Gof.����N�src:189ImplicitTyping.texDo�Ges��pthis�theorem�apply�to�the�no-nilp�oten���ts�example?�W��*�e�ha�v�e�to�b�Ge�careful����?ab�Gout���the�t���yp�e�sp�ecication�of�the�equalit���y�sym�b�Gol.�If�w�e�sp�Gecify��ty�[�pe�(�b�o�ol��㓵;����=����?(�R��;���R��)),��}then�w���e�cannot�use�the�same�equalit�y�sym�b�Gol�in�the�axioms�for�the����?natural��'n���um�b�Gers,�for�example��s�(�x�)�Ov�6�=�0�and��x��=��y�[ٸj�s�(�x�)��6�=��s�(�y��).��'Ho���w�ev�er,�Otter����?treats��Kan���y�sym�b�Gol�b�eginning�with�EQ��as�an�equalit���y;�=�is�a�synon�ym�for�EQ,�but����?one�8�can�also�use,�for�example�EQ2.�Therefore,�if�w���e�w�an�t�to�apply�the�theorem,����?w���e���need�to�use�t�w�o�dieren�t�equalit�y�sym�b�Gols.�Of�course,�w�e�could�just�use�=����?throughout�F�and�v���erify�afterw�ards�that�the�pro�Gof�can�b�e�correctly�t���yp�ed,�as�=�is����?nev���er���used�in�the�same�clause�for�equalit�y�b�Get�w�een�natural�n�um�b�Gers�and�equalit�y����?b�Get���w�een���ring�elemen���ts;�but�if�w�e�w�an�t�to�b�Ge�assured�in�adv��q�ance�that�an�y�pro�Gof����?Otter���will�nd�will�b�Ge�correctly�t���ypable,�then�w�e�need�to�use�dieren�t�equalit�y����?sym���b�Gols.�UUIf�w�e�do�so,�then�the�theorem�do�Ges�apply��*�.����N�src:199ImplicitTyping.texThere���are,�of�course,�more�inference�rules�than�just�binary�resolution.�Ev���en�in����?this�Fexample,�the�pro�Gof�uses�demo�dulation.�The�theorem�ab�o���v�e�Fcan�b�e�extended����?to�UUincluded�additional�rules�of�inference:��5�����?�Theorem��T2.���}�
�src:204ImplicitTyping.tex�Supp��}'ose��0e�ach�function�symb�ol�and�c�onstant�o�c�curring�in�a�the�ory����?�T��p�is��assigne��}'d�a�unique�typ�e�sp�e�cic�ation,�in�such�a�way�that�al���l�the�axioms�of����?�T���ar��}'e�S:c�orr�e�ctly�typ�e�d�(with�r�esp�e�ct�to�this�list�of�typ�e�sp�e�cic�ations).�The�typ�e����?sp��}'e�cic�ations�O�of�e��}'quality�symb�ols�must�have�the�form��ty�[�pe�(�b�Go�ol��㓵;����=�(�X�:�;�X���))�O��for����?some�mjtyp��}'e��X���.�Then�c�onclusions�r�e�ache�d�fr�om��T���by�binary�r�esolution,�hyp�err�eso-����?lution,�T�factoring����^��2�����,�demo��}'dulation,�and�p�ar�amo�dulation�(using�rst-or�der�unic�a-����?tion�c@in�applying�these�rules)�ar��}'e�also�c�orr�e�ctly�typ�e�d,�pr�ovide�d�demo�dulation�and����?p��}'ar�amo�dulation���ar�e�not�applie�d�to�or�fr�om�variables.��?��މff8�ϟ
L͍��������-=�2�����
�The�Y!rule�of�\factoring"�p�A�ermits�the�deriv��|ration�of�a�new�clause�b��9y�unifying�t�w�o�literals����
in�
�the�same�clause�that�ha��9v�e�
�the�same�sign,�and�applying�the�resulting�substitution����
to�Tthe�en��9tire�clause.�����B��o#f����ܚ����?�VI����5#f����ܚ��?�src:215ImplicitTyping.tex�R��}'emark�.�ŒThe�theorem�cannot�b�Ge�extended�to�apply�to�paramo�dulation�from����?v��q�ariables.�UUAn�example�is�giv���en�b�Gelo�w.��Q~��?�src:217ImplicitTyping.tex�Pr��}'o�of�.�n�Conclusions�reac���hed�b�y�h�yp�Gerresolution�can�also�b�e�reac���hed�b�y�binary����?resolution,��so�that�part�of�the�theorem�follo���ws�from�the�previous�theorem.�The����?results���on�factoring,�paramo�Gdulation�and�demo�dulation�follo���w�from�the�fact�that����?applying��a�substitution�pro�Gduced�b���y�unication�preserv�es�correct�t�ypings.�The����?lemma���that�w���e�need�is�that�if��p��and��r�+	�unify��*�,�then�they�ha�v�e�the�same�v��q�alue�t�yp�Ge.����?If���neither�is�a�v��q�ariable,�this�follo���ws�from�the�assumption�that�the�axioms�of��T����?�are�UUcorrectly�t���yp�Ged.�(If�one�is�a�v��q�ariable,�this�need�not�b�e�the�case.)����N�src:222ImplicitTyping.texSupp�Gose,�for�example,�that��r�WԲ=���s��is�to�b�e�used�as�a�demo�dulator�on�term����?�t�.��XThe�demo�Gdulator�is�applied�b���y�unifying��r��u�with�a�certain�subterm��p��of��t�.�Let����?��uIJb�Ge��the�substitution�that�p�erforms�this�unication,�so��p�j��=���r��[ٲ.�Then��p��and����?�r�G�,�||since�they�unify��*�,�ha���v�e�||the�same�v��q�alue�t���yp�e,�and�hence��p�,��p�[ٲ,�and��r���U�all�ha���v�e����?the���same�v��q�alue�t���yp�Ge.�The�t�yp�Ge�sp�ecication�of�equalit���y�m�ust�ha�v�e�the�form����?�ty�[�pe�(�bool�2`;����=���(�X�:�;�X���))�t�for�some�t���yp�Ge��X��;�so��r��Ųand��s��ha���v�e�t�the�same�v��q�alue�t���yp�Ge,����?so��r�G�_̲and��s��ha���v�e��the�same�v��q�alue�t���yp�Ge.�Hence��s��and��p��also�ha���v�e��the�same����?v��q�alue��1t���yp�Ge,�and�hence�the�result�of�replacing��p��in��t��b�y��s��
�(the�result�of�the����?demo�Gdulation)�UUis�a�correctly�t���yp�ed�term.����N�src:229ImplicitTyping.tex�Example�.�T�This�example�will�sho���w�that�one�cannot�allo�w�\o�v�erloading",�or����?m���ultiple�,�t�yp�Ge�sp�ecications�for�the�same�sym���b�ol,�and�still�use�implicit�t���yping����?with�ϸguaran���teed�correctness.�F��*�or�example,�supp�Gose�w�e�w�an�t�to�use��x��w�+��y�+��b�Goth����?for��fnatural�n���um�b�Gers��fand�for�in���tegers.�Thinking�of�in�tegers,�w�e�write�the�axiom����?�x����+�(��x�)�zJ=�0,���and�thinking�of�natural�n���um�b�Gers���w�e�write�1���+��x�zJ�6�=�0,�Resolving����?these�UUclauses,�w���e�nd�a�con�tradiction�up�Gon�taking��x���=�1.����N�src:236ImplicitTyping.tex�Example�.��This�example,�tak���en�from�Euclidean�geometry��*�,�sho�ws�that�the�the-����?orem�T6cannot�b�Ge�extended�to�paramo�dulation�from�v��q�ariables.�In�this�example,����?�E���Qpt�O�stands�for�equalit���y�b�Get�w�een�p�Goin�ts,��E���Ql�2`ine��stands�for�equalit�y�b�Get�w�een����?lines,�ĵ�I���(�a;���b�)�stands�for�p�Goin���t��a��inciden�t�to�line��b�,�and��p����1��|s�(�u�)�and��p����2���(�u�)�are�t���w�o����?distinct��'p�Goin���ts�on�line��u�.�The�t�yp�Ges�here�are�b�o�olean,�p�oin���t,�and�line.�Axioms����?(1)�UUand�(2)�are�correctly�t���yp�Ged:���������n�E���Qpt�(�x;���y�[ٲ)�j�I���(�x;�l�2`ine�(�x;�y��))�:������X��(1)����������۵E���Ql�2`ine�(�l�ine�(�p�1(�u�)�;���p�2(�u�))�;�u�)�:������X��(2)������?�src:242ImplicitTyping.texP���aramo�Gdulating�8�from�the�rst�clause�of�(1)�in�to�(2),�w�e�unify��x��with��l�2`ine�(�p����1��|s�(�u�)�;���p����2���(�u�)),����?and�UUth���us�deriv�e�����f�J�E���Ql�2`ine�(�y�[�;���u�)�j�I���(�l�ine�(�p�1(�u�)�;�p�2(�u�))�;�l�ine�(�l�ine�(�p�1(�u�)�;�p�2(�u�))�;�y�[ٲ))�:�����X��(3)������?�src:246ImplicitTyping.texThis�UUconclusion�is�incorrectly�t���yp�Ged�since��y��.�is�a�p�oin���t�and��u��is�a�line.����N�src:248ImplicitTyping.tex�Example�.�8�This�simpler�example�illuminates�the�situation�with�regard�to�paramo�Gd-����?ulation�R�from�v��q�ariables.�Consider�the�three�unit�clauses��x���=��a�,�R��P�c��(�b�),�and���P��(�c�).����?These�-�clauses�lead�to�a�con���tradiction�using�paramo�Gdulation�from�the�v��q�ariable����?�x�/i�and�binary�resolution.�But�without�paramo�Gdulation�from�v��q�ariables,�no�con-����?tradiction�^�can�b�Ge�deriv���ed.�This�sho�ws�that�w�e�ha�v�e�lost�rst-order�refutation����?completeness,�5already�in�the�rst�order�case,�as�the�price�of�implicit�t���yping.�But�����U��o#f����ܚ�����@��VI�A�I����5#f����ܚ��?�this�is�go�Go�d:�if�equalit���y�is�b�Get�w�een�ob��8jects�of�t�yp�Ge��A��and��P�s��is�a�predicate�on�ob-����?jects�F�of�t���yp�Ge��B��q�,�then�these�clauses�are�not�con�tradictory��*�.�This�loss�of�rst-order����?completeness�J�already�o�Gccurs�in�the�rst-order�case,�and�is�not�a�phenomenon����?sp�Gecial�UUto�lam���b�da�logic.�� �����?�3��S@Lam��b�`da��logic�and�lam�b�`da�unication������?�src:259ImplicitTyping.tex�Lam���b�Gda��logic�is�the�logical�system�one�obtains�b�y�adding�lam�b�Gda�calculus�to�rst����?order��	logic.�This�system�is�form���ulated,�and�some�fundamen�tal�metatheorems�are����?pro���v�ed,���in�[1].�The�appropriate�generalization�of�unication�to�lam���b�Gda�logic����?is��@this�notion:�t���w�o��@terms�are�said�to�b�Ge��lamb��}'da��unie�d��@�b���y�substitution���Y�if����?�t�"�=���s��,�is��Spro���v��q�able�in�lam�b�Gda�logic.�An�algorithm�for�pro�ducing�lam���b�da�unifying����?substitutions,���called��lamb��}'da���unic�ation�,���is�used�in�the�theorem�pro���v�er���Otter-��,����?whic���h�Ŵis�based�on�lam�b�Gda�logic�rather�than�rst-order�logic,�but�is�built�on����?the��Mw���ell-kno�wn�rst-order�pro�v�er�Otter�[3].�In�Otter-��,�lam�b�Gda�unication�is����?used,��Ainstead�of�only�rst-order�unication,�in�the�inference�rules�of�resolution,����?factoring,�UUparamo�Gdulation,�and�demo�dulation.��$���N�src:269ImplicitTyping.texIn�UOtter-���input�les,�w���e�write��l�2`ambda�(�x;���t�)�for��x:�t�,�and�w���e�write��Ap�(�x;�y�[ٲ)����?for�� �x��applied�to��y�[ٲ,�whic���h�is�often�abbreviated�in�tec�hnical�pap�Gers�to��x�(�y�[ٲ)�or����?ev���en�E&�xy�[ٲ.�In�this�pap�Ger,��Ap��will�alw�a�ys�b�Ge�written�explicitly��*�,�but�w�e�use�b�Goth����?�l�2`ambda�(�x;���t�)�UUand��x:�t�.����N�src:273ImplicitTyping.texOur���main�ob��8jectiv���e�in�this�section�is�to�dene�the�lam�b�Gda�unication�algo-����?rithm.�K�As�w���e�dene�it�here,�this�is�a�non-deterministic�algorithm:�it�can�return,����?in��ggeneral,�man���y�dieren�t�unifying�substitutions�for�t�w�o�giv�en�input�terms.�As����?implemen���ted��^in�Otter-lam�b�Gda,�it�returns�just�one�unier,�making�some�sp�ecic����?c���hoice�"oat�eac�h�non-deterministic�c�hoice�p�Goin�t.�As�for�ordinary�unication,�the����?input�$�is�t���w�o�$�terms��t��and��s��(this�time�terms�of�lam���b�Gda�logic)�and�the�output,����?if��.the�algorithm�succeeds,�is�a�substitution���?�suc���h�that��t�Z�=����s��is�pro���v��q�able�in����?lam���b�Gda�UUlogic.����N�src:280ImplicitTyping.texW��*�e�!rst�giv���e�the�relativ�ely�simple�clauses�in�the�denition.�These�ha�v�e�to�do����?with�UUrst-order�unication,�alpha-con���v�ersion,�UUand�b�Geta-reduction.����N�src:283ImplicitTyping.texThe��7rule�related�to�rst-order�unication�just�sa���ys�that�w�e�try�that�rst;����?for�
|example��Ap�(�x;���y�[ٲ)�unies�with��Ap�(�a;�b�)�directly�in�a�rst-order�w���a�y��*�.�
|Ho�w�ev�er,����?the��cusual�recursiv���e�calls�in�rst-order�unication�no�w�b�Gecome�recursiv�e�calls�to����?lam���b�Gda��unication.�In�other�w�ords:�to�unify��f���(�t����1��|s�;����:�:�:����;���t����n���Y�with��g�[ٲ(�s����1���;����:�:�:����;���s����m�����),�this����?clause��do�Ges�not�apply�unless��f�ڧ�=���g�v��and��n��=��m�;�in�that�case�w���e�do�the�follo�wing:����N�src:290ImplicitTyping.tex���<x

cmtt10�for�?��i���=�1��to��n��f����N�src:292ImplicitTyping.tex����a��=�?�unify�(�t����i��TL�;���s����i���)�;����N�src:294ImplicitTyping.tex���if�?�(���߲=��failure)����N�src:296ImplicitTyping.tex�)��return�?�failure;����N�src:298ImplicitTyping.tex����"�=��������8��!��;�?��g����N�src:300ImplicitTyping.tex�return�?������?�src:304ImplicitTyping.tex�Here�UUthe�call�to��unify��is�a�recursiv���e�call�to�the�algorithm�b�Geing�dened.����N�src:306ImplicitTyping.texThe�8�rule�related�to�alpha-con���v�ersion�8�sa�ys�that,�if�w�e�w�an�t�to�unify��l�2`ambda�(�z�p�;���t�)����?with�1��l�2`ambda�(�x;���s�),�let���S��b�Ge�the�substitution��z�7��:=���x��and�then�unify��t��with��s�,�re-�����g=�o#f����ܚ����?�VI�A�I�I����5#f����ܚ��?�jecting�xan���y�substitution�that�assigns�a�v��q�alue�dep�Gending�on��x�.����^��3�����If�this�unication����?succeeds�UUwith�substitution���[ٲ,�return����.����N�src:315ImplicitTyping.texThe���rule�related�to�b�Geta-reduction�sa���ys�that,�to�unify��Ap�(�l�2`ambda�(�z�p�;���s�)�;�q�[ٲ)����?with��h�t�,�w���e�rst�b�Geta-reduce�and�then�unify��*�.�That�is,�w�e�unify��s�[�z�Ly�:=���q�[ٲ]�with��t����?�and�UUreturn�the�result.����N�src:318ImplicitTyping.texLam���b�Gda��Dunication's�most�in�teresting�instructions�tell�ho�w�to�unify��Ap�(�x;���w�D�)����?with�a�term��t�,�where��t��ma���y�con�tain�the�v��q�ariable��x�,�and��t��do�Ges�not�ha�v�e�main����?sym���b�Gol�n��Ap�.�Note�that�the�o�ccurs�c���hec�k�n�of�rst-order�unication�do�es�not�apply����?in���this�case.�The�term��w�D�,�ho���w�ev�er,���ma�y�not�con�tain��x�.�In�this�case�lam�b�Gda����?unication�UUis�giv���en�b�y�the�follo�wing�non-deterministic�algorithm:��6���?�src:326ImplicitTyping.tex1.���Pic���k�a��masking��Tsubterm��q���of��t�.�That�means�a�subterm��q��suc���h�that�ev�ery����?o�Gccurrence�/of��x��in��t��is�con���tained�in�some�o�ccurrence�of��q�s�in��t�.�(So��q��\masks"�the����?o�Gccurrences��Qof��x�;�if�there�are�no�o�ccurrences�of��x��in��t�,�then��q�7*�can�b�e�an���y�subterm����?of�UU�t�,�but�see�the�next�step.)����?�src:332ImplicitTyping.tex2.���Call�lam���b�Gda�unication�to�unify��w���with��q�[ٲ.�Let���4��b�e�the�resulting�substitution.����?If��Gthis�unication�fails,�or�assigns�an���y�v��q�alue�other�than�a�v�ariable�to��x�,�return����?failure.�`wIf�it�assigns�a�v��q�ariable�to��x�,�sa���y��x�٦�:=��y��P�rev�erse�`wthe�assignmen�t�to��y�5�:=�٦�x����?�so�UUthat��x��remains�unassigned.����?�src:338ImplicitTyping.tex3.��UIf��q�[��.�o�Gccurs�more�than�once�in��t��,�then�pic���k�a�set��S�V�of�its�o�Gccurrences.�If��q����?�con���tains�M��x��then��S��!�m�ust�b�Ge�the�set�of��al���l��o�ccurrences�of��q�[���m�in��t�.�Let��z��+�b�e�a�fresh����?v��q�ariable�Cand�let��r��,�b�Ge�the�result�of�substituting��z����in��t���for�eac���h�o�ccurrence�of��q�[�����?�in�UUthe�set��S����.����?�src:344ImplicitTyping.tex4.�UUApp�Gend�the�substitution��x���:=��z�p�:���r��r�to�UU���.�and�return�the�result.����N�src:347ImplicitTyping.texThere�{�are�t���w�o�{�sources�of�non-determinism�in�the�ab�Go���v�e,�{�namely�in�steps�1�and����?3.��eThese�steps�are�made�deterministic�in�Otter-���as�follo���ws:�in�step�1,�if��x��o�Gccurs����?in���t�,�w���e�pic�k�the�largest�masking�subterm��q�h��that�o�Gccurs�as�a�second�argumen�t�of����?�Ap�.����^��4���1��If���x��o�Gccurs�in��t�,�but�no�masking�subterm�o�ccurs�as�a�second�argumen���t�of����?�Ap�,��?w���e�pic�k�the�smallest�masking�subterm.�If��x��do�Ges�not�o�ccur�in��t�,�w���e�pic�k�a����?constan���t��that�o�Gccurs�in��t�;�if�there�is�none,�w�e�fail.�In�step�3,�if��q�Fղdo�Ges�not�con�tain����?�x�,�s\then�an�imp�Gortan���t�application�of�this�c�hoice�is�to�pro�Gofs�b�y�mathematical����?induction,�where�the�c���hoice�of��q�f�corresp�Gonds�to�c�ho�Gosing�a�constan�t��n�,�replacing����?some�ǿof�the�o�Gccurrences�of��n��b���y�a�v��q�ariable,�and�deciding�to�pro�v�e�the�theorem�b�y����?induction���on�that�v��q�ariable.�Therefore�the�c���hoice�of��S��e�is�determined�b�y�heuristics����?that�y�pro���v�e�useful�in�this�case.�In�the�future�w�e�hop�Ge�to�implemen�t�a�v�ersion����?of�R�lam���b�Gda�unication�that�returns�m�ultiple�uniers�b�y�trying�dieren�t�sets��S����?�in��step�3.�Our�pro�Gofs�in�this�pap�er�apply�to�the�full�non-deterministic�lam���b�da����?unication,�UUas�w���ell�as�to�an�y�deterministic�v�ersions,�unless�otherwise�sp�Gecied.����N�src:362ImplicitTyping.tex�Example�.��;Lam���b�Gda�unication�can�lead�to�un�t�ypable�pro�Gofs,�for�example�those����?needed��to�pro�Gduce�xed�p�oin���ts�in�lam�b�Gda�calculus.�As�an�example,�if�w�e�unify��?��p�ff8�ϟ
L͍��������-=�3�����
�Care��is�called�for�in�this�clause,�as�illustrated�b��9y�the�follo�wing�example:�Unify����
�5��"		cmmi9�l�&9ambda�(�x;���y�R��)�6�with��l�ambda�(�x;���f����(�x�)).�The�\solution"��y��=��i�f��(�x�)�is�wrong,�since�substi-����
tuting�j}�y�r_�=���f����(�x�)�in��l�&9ambda�(�x;���y�R��)�giv��9es��l�ambda�(�z�c�;���f����(�x�)),�b�A�ecause�the�b�ound�v��|rariable����
is�Trenamed�to�a��9v�oid�Tcapture.�����������-=�4�����
�The�<Op�A�oin��9t�of�this�c�hoice�is�that,�if�w�e�w�an�t�the�pro�A�of�to�b�e�implicitly�t��9ypable,�then����
�q�g��should�Tb�A�e�c��9hosen�to�ha�v�e�the�same�t�yp�A�e�as��w�>�,�and��w�ST�is�a�second�argumen�t�of��Ap�.�����	x�o#f����ܚ������@�IX����5#f����ܚ��?�Ap�(�x;���y�[ٲ)��Dwith��f���(�Ap�(�x;�y�[ٲ)),�the�masking�subterm��q��is��x��itself;��w��'�is��y��so����is��y�"�:=���x�;����?�w�D���.�is�UU�x��and��t��is��Ap�(�x;���x�).�Th���us�w�e�get�the�follo�wing�result:����^��5����������x���:=��l�2`ambda�(�z�p�;���f���(�Ap�(�z�;�z��)))�<�y�"�:=���x����?�src:368ImplicitTyping.tex�T���yp�Ge�UUrestrictions�will�b�e�violated�if�w���e�ha�v�e�sp�Gecied�the�t�yping:����z>�ty�[�pe�(�B��q;���Ap�(�i�(�A;�B��)�;�A�))�:�<ty�[�pe�(�B�;�f���(�B��))�:����?�src:370ImplicitTyping.tex�V��*�ariable����x��has�t���yp�Ge��i�(�A;���B��q�),�and�v��q�ariable��y�`�has�t�yp�Ge��A�,�so�the�unication�of��x����?�and�UU�y��.�violates�t���yp�Ge�restrictions,�since��i�(�A;���B��q�)�is�not�the�same�t�yp�Ge�as��A�.�������?�Denition��T3.�����@�src:374ImplicitTyping.tex�We�a�say�that�a�p��}'articular�lamb�da�unic�ation�(of��Ap�(�X�:�;���w�D�)��with����?�t�)��wis��t���yp�Ge-safe��(with�r��}'esp�e�ct��wto�some�explicit�or�implicit�typings)�if�the�masking����?subterm�,y�q��R�sele��}'cte�d�by�lamb�da�unic�ation�has�the�same�typ�e�(with�r�esp�e�ct�to�those����?typings)��as�the�term��w�D�,�and��q���is�a�pr��}'op�er��subterm�of��t��(unless�the�two�ar��}'gu-����?ments���of��Ap��have�the�same�typ��}'e).�We�also�r�e�quir�e�that�the�value�typ�e�assigne�d����?to���Ap�(�X�:�;���w�D�)��is�the�same�as�the�value�typ��}'e�assigne�d�to��t�.����?�src:379ImplicitTyping.tex�The���example�preceding�the�denition�illustrates�a�lam���b�Gda�unication�that�is�not����?t���yp�Ge-safe���for��any��reasonable�t�yping.�The�masking�subterm�is��x�;�t�yp�Ge�safet�y�w�ould����?require���x��to�b�Ge�assigned�the�same�t���yp�e�as��y�[ٲ.�But��x��o�ccurs�as�a�rst�argumen���t����?of�6X�Ap��and��y��1�as�a�second�argumen���t�of��Ap�.�Therefore�the�t�yp�Ge�sp�ecication�of��Ap����?�w���ould�,�ha�v�e�to�b�Ge�of�the�form��ty�[�pe�(�V��9;���Ap�(�U���;�U��));�but�normally��Ap��will�ha���v�e�a����?t���yp�Ge�UUsp�ecication�of�the�form��ty�[�pe�(�B��q;���Ap�(�i�(�A;�B��)�;�A�)).����N�src:386ImplicitTyping.tex�R��}'emark�.�3A�3
discussion�of�the�relationship,�if�an���y��*�,�b�Get�w�een�lam�b�Gda�unication����?and���the�higher-t���yp�Ge�unication�algorithms�already�in�the�literature�is�b�ey���ond�the����?scop�Ge��\of�this�pap�er.�The�algorithms�apply�to�dieren���t�systems�and�ha�v�e�dieren�t����?denitions.��RSimilarly��*�,�the�exact�relationship�b�Get���w�een��Rlam�b�da��Rlogic�and�v��q�arious����?sytems���of�higher-order�logic,�if�there�is�an���y��*�,�is�b�Gey�ond�the�scop�Ge�of�this�pap�er�(or����?an���y�UUpap�Ger�of�this�length).���k���?�4��S@Implicit��t��yping�in�lam�b�`da�logic���k��?�src:392ImplicitTyping.tex�If��cw���e�consider�the�no-nilp�Goten�ts�example�in�lam�b�Gda�logic,�w�e�can�state�the�axiom����?of�smathematical�induction�in�full�generalit���y��*�,�and�Otter-lam�b�Gda�can�use�lam�b�Gda����?unication��to�nd�the�sp�Gecic�instance�of�induction�that�is�required.�(See�the����?examples��Ion�the�Otter-lam���b�Gda�w�ebsite.)�The�pro�Gof,�obtained�without�relativiz-����?ing���to�unary�predicates,�is�correctly�t���ypable.�This�is�not�an�acciden�t:�there�are����?theorems�UUab�Gout�implicit�t���yping�that�guaran�tee�it.����N�src:399ImplicitTyping.texW��*�e��rst�giv���e�an�example�to�sho�w�that�the�situation�is�not�as�straigh�tforw�ard����?as�}�in�rst-order�logic.�If�w���e�use�the�axioms�of�group�theory�in�lam�b�Gda�logic,����?m���ust�{�w�e�relativize�them�to�a�unary�predicate��G�(�x�)?�As�w�e�ha�v�e�seen�ab�Go�v�e,��?�圉ff8�ϟ
L͍��������-=�5�����
�The��gsym��9b�A�ol��i��do�es�not�ha��9v�e��gto�b�e�\dened"�here;�t��9yp�e�assignmen��9ts�can�b�e�arbitrary����
terms.���But�in��9tuitiv�ely��:�,����i�(�A;���B�r��)�could�b�A�e�though��9t�of�as�the�t�yp�A�e�of�functions�from�t�yp�A�e����
�A�T�to�t��9yp�A�e��B�r��.�����
��o#f����ܚ����?�X����5#f����ܚ��?�that��is�not�necessary�when�doing�rst-order�inference.�W��*�e�could,�for�example,����?put�S`in�some�axioms�ab�Gout�natural�n���um�b�ers,�S`and�not�relativize�them�to�a�unary����?predicate��1�N��(�x�),�and�as�long�as�our�axioms�are�correctly�t���yp�Ged,�our�pro�ofs�will����?b�Ge���correctly�t���yp�ed�to�o.�There�is,�ho���w�ev�er,���reason�to�w���orry�ab�out�this�when�w���e����?mo���v�e�UUto�lam���b�Gda�logic.����N�src:406ImplicitTyping.texIn���lam���b�Gda�calculus,�ev�ery�term�has�a�xed�p�Goin�t.�That�is,�for�ev�ery�term��F��)�w�e����?can�Z�nd�a�term��q����suc���h�that��Ap�(�F�G;���q�[ٲ)��=��q��.�Z�Another�form�of�the�xed�p�Goin���t�theorem����?sa���ys���that�for�eac�h�term��H���,�w�e�can�nd�a�term��f��{�suc�h�that��Ap�(�f��V;���x�)�(�=��H���(�f�;���x�).����?Applying���this�to�the�sp�Gecial�case�when��H���(�f��V;���x�)��=��c�&U���Ap�(�f�;���x�),���where��c��is�a����?constan���t�0oand����is�the�group�m�ultiplication,�w�e�get��Ap�(�f��V;���x�)�4B=��c�����Ap�(�f�;���x�).�0oIt����?follo���ws�X�from�the�axioms�of�group�theory�that��c��is�the�group�iden�tit�y��*�.�On�the����?other�2thand,�in�lam���b�Gda�logic�it�is�giv�en�as�an�axiom�that�there�exist�t�w�o�distinct����?ob��8jects,�ߙsa���y��c��and��d�,�and�since�eac�h�of��d��and��c��m�ust�equal�the�group�iden�tit�y��*�,����?this���leads�to�a�con���tradiction.�Lo�Gok�ed�at�mo�Gdel-theoretically��*�,�this�means�it�is����?imp�Gossible,��giv���en�a�lam�b�Gda�mo�del��M��,�to�dene�a�binary�op�eration�on��M�Բand�an����?iden���tit�y�UUelemen�t�of��M�lp�that�mak�e��M�lp�in�to�a�group.����N�src:411ImplicitTyping.texReferees���of�other�pap�Gers�ab�out�Otter-lam���b�da�ha���v�e���complained�ab�out�this����?and��hsimilar�examples.�The�referee's�p�Goin���t�ab�out�this�example�w���as�that�I��Sough�t����?to���relativize�the�group�axioms�to�a�unary�predicate��G�.�The�p�Goin���t�of�this�pap�er����?is�UUthat�there�are�go�Go�d�UUtheoretical�reasons�wh���y�I�do��not��need�to�do�that.����N�src:416ImplicitTyping.texFirst,���let�us�consider�ho���w�to�t�yp�Ge�the�relev��q�an�t�axioms.�W��*�riting��G��for�the�t�yp�Ge����?of���group�elemen���ts,�1�for�the�group�iden�tit�y��*�,�and��i�(�G;���G�)�for�the�t�yp�Ge�of�maps�from����?�G�UU�to��G�,�w���e�w�ould�ha�v�e�the�follo�wing�t�yp�Ge�sp�ecications:��͍����廵ty�[�pe�(�G;����1)�:����������ty�[�pe�(�G;�����(�G;�G�))�:����������ty�[�pe�(�G;���Ap�(�i�(�G;�G�)�;�G�)�:����������ty�[�pe�(�i�(�G;���G�)�;�l�2`ambda�(�G;�G�))�:������?�src:423ImplicitTyping.tex�In��general,�of�course,�w���e�w�an�t��ty�[�pe�(�i�(�X�:�;���Y�8�)�;�l�2`ambda�(�X�;�Y�8�)),��but�the�sp�Gecial�case����?sho���wn��Qis�enough�in�this�example.�According�to�these�t�yp�Ge�sp�ecications,�the����?axioms���are�correctly�t���ypable,�and�when�Otter-���pro�Gduces�a�pro�of,�the�pro�of����?turns�UUout�to�also�b�Ge�correctly�t���ypable.�This�is�not�an�acciden�t,�as�w�e�will�see.����N�src:426ImplicitTyping.texIn��Odening�t���yp�Ge�sp�ecications�for�lam���b�da�logic,�the�follo���wing�tec�hnicalit�y����?comes�w�up:�Normally�in�predicate�logic�w���e�tacitly�assume�that�dieren�t�sym�b�Gols����?are�|used�for�function�sym���b�Gols�and�predicate�sym�b�Gols.�Th�us��P�c��(�P��(�c�))�|w�ould�not�b�Ge����?considered���a�w���ell-formed�form�ula.�In�lam�b�Gda�logic�w�e�do�wish�to�b�Ge�able�to�dene����?prop�Gositional��7functions,�as�w���ell�as�functions�whose�v��q�alues�are�other�ob��8jects,�so�w�e����?allo���w���Ap��b�Goth�as�a�predicate�sym�b�Gol�and�a�function�sym�b�Gol.�Ho�w�ev�er,�except�for����?�Ap�,��Hw���e�follo�w�the�usual�con�v�en�tion�that�predicate�sym�b�Gols�and�function�sym�b�Gols����?use�
ldistinct�alphab�Gets.�This�is�the�reason�for�clauses�(4)�and�(5)�in�the�follo���wing����?denition.��͍���?�Denition��T4.�����@�src:434ImplicitTyping.tex�A���list�of�typ��}'e�sp�e�cic�ations��S�'t�is�c�al���le�d��coheren���t��if����?�src:437ImplicitTyping.tex(1)�۬for�e��}'ach�(pr�e�dic�ate�or�function)�symb�ol��f��;�(�exc�ept�p�ossibly��Ap��and�lamb�da)����?and���arity��n�,�it�c��}'ontains�at�most�one�typ�e�sp�e�cic�ation�of�symb�ol��f��S�and�arity��n�;�������o#f����ܚ������@�XI����5#f����ܚ��?�the���value�typ��}'e�of�a�pr�e�dic�ate�symb�ol�must�b�e��P�c�r�Gop��and�of�a�function�symb�ol,�must����?not���b��}'e��P�c�r�Gop�.��*���?�src:441ImplicitTyping.tex(2)���ty�[�pe�(�i�(�X�:�;���Y�8�)�;�l�2`ambda�(�X�;�Y�8�))���b��}'elongs�to��S�'t�if�and�only�if��H��N�src:442ImplicitTyping.tex�ty�[�pe�(�Y��9;���Ap�(�i�(�X�:�;�Y�8�)�;�X���))���b��}'elongs�to��S����.����?�src:446ImplicitTyping.tex(3)�R�al���l�typ��}'e�sp�e�cic�ations�with�symb�ol��Ap��have�the�form��ty�[�pe�(�V��9;���Ap�(�i�(�U���;�V�8�)�;�U��))�,����?for���the�same�typ��}'e��U��,�which�is�c�al���le�d�the�\gr�ound�typ�e"�of��S����.����?�src:450ImplicitTyping.tex(4)���al���l�typ��}'e�sp�e�cic�ations�with�symb�ol�lamb�da�have�the�form��H��N�ty�[�pe�(�i�(�U���;���V�8�)�;�l�2`ambda�(�U�;�V�8�))�,����^��6���Z�wher��}'e���U���is�the�gr�ound�typ�e�of��S����.����?�src:457ImplicitTyping.tex(5)��Ther��}'e�ar�e�at�most�two�typ�e�sp�e�cic�ations�in��S�v�with�symb�ol��Ap�;�if�ther�e�ar�e����?two,���then�exactly�one�must�have�value�typ��}'e��P�c�r�Gop�.��U ��N�src:460ImplicitTyping.tex�Conditions�e(2)�and�(3)�guaran���tee�that�b�Geta-reduction�carries�correctly�t�yp�Ged����?terms�UUto�correctly�t���yp�Ged�terms.��H��N�src:462ImplicitTyping.texIf�䢵S�x/�is�a�coheren���t�list��S��of�t���yp�Ge�sp�ecications,�it�mak���es�sense�to�sp�eak�of�\the����?t���yp�Ge��hassigned�to�a�term��t��b�y��S����",�if�there�is�at�least�one�t�yp�Ge�sp�ecication�in��S����?�for�~�the�main�sym���b�Gol�and�arit�y�of��t�.�Namely��*�,�unless�the�main�sym�b�Gol�of��t��is��Ap�,����?only���one�sp�Gecication�in��S���can�apply��*�,�and�if�the�main�sym���b�ol�of��t��is��Ap�,�then�w���e����?apply���the�sp�Gecication�that�do�es�not�ha���v�e���v��q�alue�t���yp�e��P�c�r�op�.�Similarly��*�,�it�mak���es����?sense��Dto�sp�Geak�of�\the�t���yp�e�assigned�to�an�atomic�form���ula�b�y��S����".�When�the�main����?sym���b�Gol��+of��t��is��Ap�,�w�e�can�sp�Geak�of�\the�t�yp�Ge�assigned�to��t��as�a�term"�or�\the����?t���yp�Ge�Ԉassigned�to��t��as�a�form�ula",�using�the�sp�Gecication�that�do�es�not�or�do�es����?ha���v�e�UU�P�c�r�Gop��for�its�v��q�alue�t���yp�e.��jg����?�Theorem��T3.���}�
�src:473ImplicitTyping.tex�L��}'et��W�S�s�b�e�a�c�oher�ent�list�of�typ�e�sp�e�cic�ations.�L�et��s��and��t��b�e�two����?c��}'orr�e�ctly��typ�e�d�terms�or�two�c�orr�e�ctly�typ�e�d�atomic�formulas�with�r�esp�e�ct�to��S����.����?L��}'et�Q��c*�b�e�a�substitution�pr�o�duc�e�d�by�suc�c�essful�typ�e-safe�lamb�da�unic�ation�of��s����?�and��ܵt�.�Then��s���and��t��ar��}'e�c�orr�e�ctly�typ�e�d,�and��S�>i�assigns�the�same�typ�e�to��s�,��t�,����?and���s�[�.����?�src:479ImplicitTyping.texExample�.�LLet��s��b�Ge��Ap�(�X�:�;���w�D�)�and��t��b�e��a�Xٲ+��b�.�LW��*�e�can�unify��s��and��t��b���y�the����?substitution��t��:M�giv���en�b�y��X�*�:=�VH�l�2`ambda�(�x;���x�>�+��b�).��tIf��ty�[�pe�(0�;�Ap�(�i�(0�;��0)�;��0))�and����?�ty�[�pe�(0�;����+(0�;��0))�~^then�these�are�correctly�t���yp�Ged�terms�and�the�t�yp�Ges�of��s��7�and��a���+��b����?�are�8�b�Goth�0.�It�ma���y�b�e�that��Ap��also�has�a�t���yp�e�sp�ecication��ty�[�pe�(�P�c�r�op;���Ap�(�i�(0�;�P�c�r�op�)�;��0)),����?used���when�the�rst�argumen���t�of��Ap��denes�a�prop�Gositional�function.�Ho�w�ev�er,����?this�UUadditional�t���yp�Ge�sp�ecication�will�not�lead�to�mis-t���yp�ed�unications.��H��?�src:485ImplicitTyping.tex�Pr��}'o�of�.�5;W��*�e�pro�Gceed�b���y�induction�on�the�length�of�the�computation�b�y�lam�b�Gda����?unication�UUof�the�substitution���[ٲ.����N�src:488ImplicitTyping.tex(i)�?NSupp�Gose��s��is�a�term��f���(�r���;���q�[ٲ)�(or�with�more�argumen���ts�to��f��),�and�either����?�f�(s�is��not��Ap�,�or��r�\�is�neither�a�v��q�ariable�nor�a�lam���b�Gda�term.�Then��t��also�as�the����?form�M��f���(�R��;���Q�)�for�some��R�a��and��Q�,�and������is�the�result�of�unifying��r��ֲwith��R��to����?get�Z�r�G�(�=��R���7!�and�then�unifying��q�[���with��Q�!Dz,�pro�Gducing�substitution����so�that����?��"�=����W��5V��.�S�By�the�induction�h���yp�Gothesis,��r��uW�is�correctly�t���yp�ed�and�gets�the�same����?t���yp�Ge�Eas��r�Wb�and��R���!Dz;�again�b�y�the�induction�h�yp�Gothesis,��q�[��!���and��Q���are�correctly��?��L�ff8�ϟ
L͍��������-=�6�����
�In��9tuitiv�ely��:�,���this�sa��9ys�that�if��z�]�has�t�yp�A�e��X�X+�and��t��has�t�yp�A�e��Y���then��l�&9ambda�(�z�c�;���t�)�has����
t��9yp�A�e�T�i�(�X�0�;���Y�8�),�the�t�yp�A�e�of�functions�from��X�ɯ�to��Y�8�.������@�o#f����ܚ����?�XI�A�I����5#f����ܚ��?�t���yp�Ged�Uand�get�the�same�t�yp�Ge�as��q�[ٲ.�Then��s�WE�=��l�f���(�r��͠;���q�[���)��l=��f���(�r��!�;���q�[���)�Uis�also����?correctly�UUt���yp�Ged.������N�src:496ImplicitTyping.tex(ii)�	RThe�argumen���t�in�(i)�also�applies�if��s��is��Ap�(�r���;���q�[ٲ)�and��t��is��Ap�(�R��;�Q�)�and����?lam���b�Gda���unication�succeeds�b�y�unifying�these�terms�as�if�they�w�ere�rst-order����?terms.����N�src:500ImplicitTyping.tex(iii)�UUIf��s��is�a�constan���t�then��s��.�is��s��and�there�is�nothing�to�pro�v�e.����N�src:502ImplicitTyping.tex(iv)��TIf��s��is�a�v��q�ariable,�what�m���ust�b�Ge�pro�v�ed�is�that��t��and��s��ha�v�e�the�same�v��q�alue����?t���yp�Ge.�gTA�gOv��q�ariable�m�ust�o�Gccur�as�an�argumen�t�of�some�term�(or�atom)�and�hence����?the�Lsituation�really�is�that�w���e�are�unifying��P�c��(�s;����:�:�:��
UO�)�with�some�term��q�[ٲ,�where��P����?�is��either�a�function�sym���b�Gol�or�a�predicate�sym�b�Gol.�If��P���is�not��Ap�,�then��q�߲m�ust����?ha���v�e�vAthe�form��P�c��(�t;����:�:�:��
UO�),�and��t��and��s��o�Gccur�in�corresp�onding�argumen���t�p�ositions����?(not�]8necessarily�the�rst�as�sho���wn).�Since�these�terms�or�atoms��P�c��(�t;����:�:�:��
UO�)�and����?�P�c��(�s;����:�:�:��
UO�)��are�correctly�t���yp�Ged,�and��S����is�coheren�t,��t��and��s��do�ha�v�e�the�same�t�yp�Ges.����?The�UUcase�when��P���is��Ap��will�b�Ge�treated�b�elo���w.����N�src:506ImplicitTyping.tex(v)�ASupp�Gose��s��is��Ap�(�r���;���q�[ٲ),�where��r���=�O��l�2`ambda�(�z�p�;�p�),�and��z����do�Ges�o�ccur�in��p�.����?Then�.��s��b�Geta-reduces�to��p�[�z�7��:=���q�[ٲ],�and�lam���b�da�unication�is�called�recursiv���ely�to����?unify�}&�p�[�z�7��:=���q�[ٲ]�with��t�.�By�induction�h���yp�Gothesis,��t�,��t��,��p�[�z�7��:=���q��],�and��p�[�z�7��:=���q��]����are����?w���ell-t�yp�Ged�(*and�are�assigned�the�same�v��q�alue�t���yp�e,�whic���h�m�ust�b�Ge�the�v��q�alue�t�yp�Ge,����?sa���y�#��V�8�,�of��p�.�Since��S��D�is�coheren�t,�the�t�yp�Ge�assigned�to��l�2`ambda�(�z�p�;���p�)�is��i�(�U���;�V�8�),����?where����U���is�the�\ground�t���yp�Ge",�the�t�yp�Ge�of�the�second�arg�of��Ap�.�The�t�yp�Ge�of��q�Qn�is����?�U��&�since���q���o�Gccurs�as�the�second�arg�of��Ap��in�the�w���ell-t�yp�ed��term��s�.�The�t���yp�e�of����?�s�,�P/whic���h�is��Ap�(�r���;���q�[ٲ),�is��V�8�.�W��*�e�m�ust�sho�w�that��s���is�w�ell-t�yp�Ged�and�assigned�the����?v��q�alue�X�t���yp�Ge��V�8�.�No�w��s��r�is��Ap�(�r�G�͠;���q�[���).�X�It�suces�to�sho�w�that��q�[���r�has�t�yp�Ge��U�o��and����?�r�G�R!�has��Ht���yp�e��i�(�U���;���V�8�).�W��*�e�rst�sho���w�that�the�t�yp�Ge�of��q�[��R!�is��U��.�Since��z�f߲has�t�yp�Ge����?�U���in��͵l�2`ambda�(�z�p�;���p�),��q�[��ܦ�o�Gccurs�in�the�same�argumen���t�p�ositions�in��p�[�z��"�:=���q�[ٲ]��ܦ�as��z����?�do�Ges�?in��p�,�and�since��z�{ֲdo�es�o�ccur�at�least�once�in��p�,�and��p�[�z�7��:=���q�[ٲ]��g�is�w���ell-t�yp�ed,����?�q�[����m���ust�C
ha�v�e�the�same�t�yp�Ge�as��z�p��,�namely��U��.�Next�w�e�will�sho�w�that��r�G���has����?t���yp�Ge�Eڵi�(�U���;���V�8�).�W��*�e�ha�v�e��r�G��Ͳ=�W�l�2`ambda�(�z�p�;���p�)���=��l�2`ambda�(�z�p�;���p�[ٲ)�E�(since�the�b�Gound����?v��q�ariable���z����is�not�in�the�domain�of���[ٲ).�W��*�e�ha���v�e���p��[�z�7��:=���q���]�=��p�[�z�7��:=��q��]���]��and�the����?t���yp�Ge�~�of�the�latter�term�is��V��p�as�sho�wn�ab�Go�v�e.�The�t�yp�Ge�of��A�[�z�|a�:=�ʵB��q�]�is�the�t�yp�Ge����?of�}�A�,�and�moreo���v�er�}�A�[�z�h�:=��Z�B��q�]�is�w���ell-t�yp�Ged�}pro�vided��A��and��B���are�w�ell-t�yp�Ged����?and�Uu�z���gets�the�same�t���yp�Ge�as��B��q�.�That�observ��q�ation�applies�here�with��A��N�=��p��N�and����?�B�SX�=���q�[���,��since�the�t���yp�Ge�of��z�f��is��U�
 �and�the�t�yp�Ge�of��q�[��Q޲is��U��.�Therefore�the�t�yp�Ge����?of��c�p�?<�is�the�same�as�the�t���yp�Ge�of��p�[ٲ[�z�$p�:=��ٵq���],��cwhic�h�is�the�same�as��p�[�z�$p�:=��ٵq�[ٲ]���,����?whic���h��has�t�yp�Ge�the�same�as��p�[�z�]��:=��h�q�[ٲ],�whic�h�w�e�sho�w�ed�ab�Go�v�e�to�b�Ge��V�8�.�Since����?�r�G�"�=���l�2`ambda�(�z�p�;���p�[ٲ),�߱and��z�PH�has�t���yp�e��U��,��r��;��has�t���yp�e��i�(�U���;���V�8�),�whic���h�w�as�what�had����?to�UUb�Ge�pro���v�ed.����N�src:527ImplicitTyping.tex(vi)��ZThere�are�t���w�o��Zcases�not�y���et�treated:�when��s��is��Ap�(�X�:�;���w�D�),�and�when����?�s�ۀ�is�a�v��q�ariable��X��b�o�Gccurring�in�the�con���text��Ap�(�X�:�;���w�D�).�W��*�e�will�treat�these�cases����?sim���ultaneously��*�.��As�describ�Ged�in�the�previous�section,�the�algorithm�will�(1)�select����?a�{masking�subterm��q�[��cT�of��t��(2)�unify��w�L^�and��q��with�result����(failing�if�this�fails),����?(3)���create�a�new�v��q�ariable��z�p��,�and�substitute��z�9r�for�some�or�all�o�Gccurrences�of��q�[�����?�in�6��t�[ٲ,�obtaining��r�G�,�and�(4)�pro�duce�the�unifying�substitution����вtogether�with����?�X����:=���l�2`ambda�(�z�p�;���r�G�).�����
���o#f����ܚ������4�XI�A�I�I����5#f����ܚ��N�src:536ImplicitTyping.tex�Assume�b�that��t��is�a�correctly�t���yp�Ged�term.�Then�ev�ery�o�Gccurrence�of��q��̲in��t����?�has���the�same�t���yp�Ge,�b�y�the�denition�of�correctly�t�yp�Ged.�Since�b�y�h�yp�Gothesis����?this��is�t���yp�Ge-safe�lam�b�Gda�unication,��q��and��w����ha�v�e�the�same�t�yp�Ge,�call�it��U��.����?Since��%�q���unies�with��w�D�,�b���y�the�induction�h�yp�Gothesis��q�[����and��w�D���are�correctly����?t���yp�Ged���and�get�the�same�t�yp�Ges�as��q�
��and��w�D�,�resp�ectiv���ely��*�,�namely��U��.�If��Ap�(�X�:�;���w�D�)����?has�I�t���yp�Ge��P�c�r�op�,�then�the�t���yp�e�of��s��and�that�of��t��are�the�same�b���y�h�yp�Gothesis.����?Otherwise,�&b�Goth�o�ccur�as�argumen���ts�of�some�function�or�predicate�sym�b�Gol��P�c��,�in����?corresp�Gonding��argumen���t�p�ositions,�and�hence,�b���y�the�coherence�of��S����,�they�are����?assigned�12the�same�(v��q�alue)�t���yp�Ge��V�8�.�Then��X���has�the�t�yp�Ge��i�(�U���;���V�8�).�W��*�e�no�w�assign����?the���fresh�v��q�ariable��z�`v�the�t���yp�Ge��U��;�then��r�6��is�also�correctly�t�yp�Ged,�and�gets�the�same����?t���yp�Ge��L�V�.0�as��s��and��t�,�since�it�is�obtained�b�y�substituting��z�e�for�some�o�Gccurrences����?of�Ł�q�[��!Z�in��t��.�F��*�or�this�last�conclusion�w���e�need�to�use�the�fact�that��q�!Z�is�a�prop�Ger����?subterm�Zof��t�,�b���y�the�denition�of�t�yp�Ge-safe�unication;�hence��r�]w�is�not�a�v��q�ariable,����?so���the�v��q�alue�t���yp�Ge�of��r�.�is�w�ell-dened,�since��S�{a�is�coheren�t.�Since��S�{a�is�coheren�t,����?there�p:is�a�t���yp�Ge�sp�ecication�in��S�Dzof�the�form��ty�[�pe�(�i�(�U���;���V�8�)�;�l�2`ambda�(�U�;�V�8�)).�p:Th���us����?the���term��l�2`ambda�(�z�p�;���r�G�)�can�b�e�correctly�t���yp�ed�with�t���yp�e��i�(�U���;���V�8�),�the�same�t���yp�e����?as�\��X���.�Hence��X���]�has�the�same�t���yp�Ge�as��X��,�and��s��]�has�the�same�t���yp�Ge�as��s�.�That����?completes�UUthe�pro�Gof�of�the�theorem.����N�src:556ImplicitTyping.texThe��next�theorem�men���tions��p��}'ar�amo�dulation���and��p��}'ar�amo�dulation��fr�om�a�vari-����?able�.��?Readers�not�already�familiar�with�these�terms�will�nd�them�explained�in����?the�UUlast�paragraph�of�the�pro�Gof�b�elo���w.��������?�Theorem��T4���z�D�src:558ImplicitTyping.tex(Implicit��?T��9yping�for�Lam�b�Q�da�Logic).��L��}'et��>�A��b�e�a�set�of�clauses,����?and�מlet��S�k+�b��}'e�a�c�oher�ent�set�of�typ�e�sp�e�cic�ations�such�that�e�ach�clause�in��A����?�is�wzc��}'orr�e�ctly�typ�able�with�r�esp�e�ct�to��S����.�Then�al���l�c�onclusions�derive�d�fr�om��A��by����?binary�U�r��}'esolution,�hyp�err�esolution,�factoring,�p�ar�amo�dulation,�and�demo�dulation����?(including�a�b��}'eta-r�e�duction),�using�typ�e-safe�lamb�da�unic�ation�in�these�rules�of����?infer��}'enc�e,���ar�e�c�orr�e�ctly�typ�able�with�r�esp�e�ct�to��S����,�pr�ovide�d�p�ar�amo�dulation�fr�om�or����?into�Avariables�ar��}'e�not�al���lowe�d,�and�p�ar�amo�dulation�into�or�fr�om�terms��Ap�(�X�:�;���w�D�)����?�with���X�[�a�variable�is�not�al���lowe��}'d,�and�demo�dulators�similarly�ar�e�not�al���lowe�d�to����?have���variables�or��Ap�(�X�:�;���w�D�)��terms�on�the�left.����?�src:564ImplicitTyping.texR��}'emark�.��#The�example�after�Theorem�3�sho���ws�that�the�second�restriction�on����?paramo�Gdulation��Tis�necessary:�otherwise�w���e�could�paramo�dulate�from��x�W��+�0��=��x����?�in���to�Es�Ap�(�X�:�;���x�)�getting��X����:=���l�2`ambda�(�x;�x��+�0),�Esbut�here��Ap��has�v��q�alue�t���yp�Ge��P�c�r�op�,����?whic���h�UUis�not�the�t�yp�Ge�of��x�8�+�0.����?�src:568ImplicitTyping.tex�Pr��}'o�of�.�u�Note�that�a�t���yping�assigns�t�yp�Ge�sym�b�Gols�to�v��q�ariables,�and�the�scop�e�of�a����?v��q�ariable�]+is�the�clause�in�whic���h�it�o�Gccurs,�so�as�usual�with�resolution,�w�e�assume����?that��all�the�v��q�ariables�are�renamed,�or�indexed�with�clause�n���um�b�Gers,��or�otherwise����?made�JSdistinct,�so�that�the�same�v��q�ariable�cannot�o�Gccur�in�dieren���t�clauses.�In����?that��case�the�originally�separate�correct�t���ypings��T�c��[�i�]�(eac�h�obtained�from��S�5��b�y����?assigning�o<v��q�alues�to�v�araibles�in�clause��C���[�i�])�can�b�Ge�com���bined�(b�y�union�of�their����?graphs)�ڒin���to�a�single�t�yping��T�c��.�W��*�e�claim�that�the�set�of�clauses��A��is�correctly����?t���yp�Ged��with�resp�ect�to�this�t���yping��T�c��.�T��*�o�pro�v�e�this�correctness�w�e�need�to�pro�v�e:����N�src:571ImplicitTyping.tex(i)�e��}'ach�io�c�curr�enc�e�of�a�variable�in��A��is�assigne�d�the�same�typ�e�by��T�c��.����This�fol-����?lo���ws���from�the�correctness�of��C���[�i�],�since�b�Gecause�the�v��q�ariables�ha�v�e�b�Geen�renamed,����?all�UUo�Gccurrences�of�an���y�giv�en�v��q�ariable�are�con�tained�in�a�single�clause��C���[�i�].�����ӕ�o#f����ܚ����?�XIV����5#f����ܚ��N�src:574ImplicitTyping.tex�(ii)��If�I͵r���is��f���(�u;���v�[ٲ)�,�and��r��o��}'c�curs�I�in��A�,�and��f���(�u;���v�[ٲ)�,�u�,�and��v����ar��}'e�assigne�d�typ�es����?�a�,�b�,�c��8�r��}'esp�e�ctively,�then�ther�e�is�a�typ�e�sp�e�cic�ation�in��S�!�of�the�form��ty�[�pe�(�a;���f���(�b;�c�))�.����?�If��=the�term��r�Z�o�Gccurs�in��A�,�then��r��o�Gccurs�in�some��C���[�i�],�so�b���y�the�correctness�of����?�T�c��[�i�],�UUthere�is�a�t���yp�Ge�sp�ecication�in��S���as�required.��
�<��N�src:577ImplicitTyping.tex(iii)��e��}'ach�2�o�c�curr�enc�e�of�e�ach�term��r�y�that�o�c�curs�in��A��has�the�same�value�typ�e�.����?This�J�follo���ws�from�the�coherence�of��S����.�The�dieren�t�t�ypings��T�c��[�i�]�are�not�allo�w�ed����?to�UUassign�dieren���t�v��q�alue�t�yp�Ges�to�the�same�sym�b�Gol�and�arit�y��*�.����N�src:579ImplicitTyping.texHence�UU�A��is�correctly�t���yp�Ged�with�resp�ect�to��T�c��.����N�src:581ImplicitTyping.texAll��references�to�correct�t���yping�in�the�rest�of�the�pro�Gof�refer�to�the�t�yping��T�c��.����N�src:583ImplicitTyping.texW��*�e���pro���v�e�b�y�induction�on�the�length�of�pro�Gofs�that�all�pro�ofs�from��A��using����?the���sp�Gecied�rules�of�inference�lead�to�correctly�t���yp�ed�conclusions.�The�base����?case��;of�the�induction�is�just�the�h���yp�Gothesis�that��A��is�correctly�t�ypable.�F��*�or�the����?induction���step,�w���e�tak�e�the�rules�of�inference�one�at�a�time.�W��*�e�b�Gegin�with�binary����?resolution.�tSupp�Gose�the�t���w�o�tclauses�b�eing�resolv���ed�are��P�c��j�Q��and���R�Ǹj�B��q�,�where����?substitution���� ϲis�pro�Gduced�b���y�lam�b�Gda�unication�and�satises��P�c����=��$�R���[ٲ.�Here����?�Q�xòand��B��4�can�stand�for�lists�of�more�than�one�literal,�in�other�w���ords�the�rest�of����?the���literals�in�the�clause,�and�the�fact�that�w���e�ha�v�e�sho�wn��P�W��and���R���as�the�rst����?literals��Din�the�clause�is�for�notational�con���v�enience��Donly��*�.�By�h���yp�Gothesis,��P�c��j�Q��is����?correctly���t���yp�Ged�with�resp�ect�to��S����,�and�so�is���R�Ǹj�B��q�,�and�b���y�Theorem�3,��P�c��[ٸj�Q����?�and��X��R���[ٸj�B��q��1�are�also�correctly�t���yp�Ged.�The�result�of�the�inference�is��Q��j�B��q��.����?But�rthe�union�of�correctly�t���yp�Ged�terms,�literals,�or�sets�of�literals�(with�resp�ect����?to�!a�coheren���t�set�of�t�yp�Ge�sp�ecications)�is�again�correctly�t���yp�ed,�b���y�the�same����?argumen���t��'as�in�the�rst�part�of�the�pro�Gof.�In�other�w�ords,�coherence�implies�that����?if�k�some�subterm��r���o�Gccurs�in�b�oth��Q�Ǯ�and�in��B��q��then��r���gets�the�same�v��q�alue����?t���yp�Ge���in�b�oth�o�ccurrences.�That�completes�the�induction�step�when�the�rule�of����?inference�UUis�binary�resolution.����N�src:587ImplicitTyping.texHyp�Gerresolution�6and�negativ���e�h�yp�Gerresolution�can�b�e�\sim���ulated"�b�y�a�se-����?quence�<�of�binary�resolutions,�so�the�case�in�whic���h�the�rule�of�inference�is�h�yp�Ger-����?resolution��^or�negativ���e�h�yp�Gerresolution�reduces�to�the�case�of�binary�resolution.����?The���rule�of�\factoring"�p�Germits�the�deriv��q�ation�of�a�new�clause�b���y�unifying�t�w�o����?literals��in�the�same�clause�that�ha���v�e��the�same�sign,�and�applying�the�resulting����?substitution�q�to�the�en���tire�clause.�By�Theorem�3,�a�clause�deriv�ed�in�this�w�a�y�is����?w���ell-t�yp�Ged�UUif�its�premise�is�w���ell-t�yp�ed.����N�src:592ImplicitTyping.texNo���w��nconsider�paramo�Gdulation.�In�that�case�w�e�ha�v�e�already�deduced��t���=��q����?�and�qA�P�c��[�z�7��:=���r�G�],�and�unication�of��t��and��r��^�pro�duces�a�substitution�����suc���h�that��t�"�=����?�r�G�[ٲ.��|The�conclusion�of�the�rule�is��P�c��[�z���:=�!Y�q���].�(This�is�the�promised�explanation����?of�,�p��}'ar�amo�dulation�.)�P���aramo�Gdulation��fr�om�Y�variables��is�the�case�in�whic���h��t��is�a����?v��q�ariable.�wP���aramo�Gdulation��into��ea�variable�w�is�the�case�in�whic�h��r���is�a�v��q�ariable.����?W��*�e��Pha���v�e�disallo�w�ed�paramo�Gdulation�from�or�in�to�v��q�ariables�in�the�statemen�t�of����?the�theorem;�therefore��t��and��r�]1�are�not�v��q�ariables.�Let�us�write��T�c�y�[�pe�(�t�)�for�the����?v��q�alue�K�t���yp�Ge�of�(an�y�term)��t�.�Because��t���=��q��{�is�K�correctly�t�yp�Ged,�w�e�ha�v�e��T�c�y�[�pe�(�t�)��=����?�T�c�y�[�pe�(�q��).��If�neither��t��nor��q�l��is�an��Ap��term,�then��T�y�[�pe�(�t��)��=��T�y�[�pe�(�q���),��since�they����?ha���v�e��[the�same�functor.�If�one�of�them�is�an��Ap��term,�then�b���y�h�yp�Gothesis�it�is����?not��of�the�form��Ap�(�X�:�;���w�D�),�with��X�P��a�v��q�ariable.�Then�b���y�Theorem�3,��T�c�y�[�pe�(�t��)��=����?�T�c�y�[�pe�(�t�)���and��T�y�[�pe�(�q���)�'=��T�y�[�pe�(�q��)�'=��T�y�[�pe�(�t�)�=��T�y�[�pe�(�t��).���Th���us�in�an�y�case������F�o#f����ܚ�����@^�XV����5#f����ܚ��?�T�c�y�[�pe�(�q���)��P=��T�y�[�pe�(�t��).��EThe�v��q�alue�t���yp�Ge�of��r��b�is�the�same�at�ev�ery�o�Gccurrence,����?since�8O�P�c��[�z�7��:=���r�G�]�is�correctly�t���yp�ed.�T��*�o�sho���w�that��P�c��[�z�7��:=���q�[���]�8Ois�correctly�t�yp�Ged,�it����?suces�k�to�sho���w�that��T�c�y�[�pe�(�q���)��=��T�y�[�pe�(�r�G�),�k�whic���h�is�the�same�as�the�t�yp�Ge�of��r��[ٲ.����?Since�m�the�terms��t��and��r����unify��*�,�and�neither�is�a�v��q�ariable,�their�main�sym���b�Gols�are����?the��vsame,�since�b���y�h�yp�Gothesis��r�蓲is�not�of�the�form��Ap�(�X�:�;���w�D�).�Hence��T�c�y�[�pe�(�r��)�E�=����?�T�c�y�[�pe�(�r�G��)��=��T�y�[�pe�(�t��)��=��T�y�[�pe�(�q���),�UUwhic���h�is�what�had�to�b�Ge�sho�wn.�����N�src:606ImplicitTyping.texNo���w�+0consider�demo�Gdulation.�In�this�case�w�e�ha�v�e�already�deduced��t���=��q��	�and����?�P�c��[�z�TB�:=�㫵t�[ٲ]�and�w���e�conclude��P��[�z�TB�:=�㫵q�[���],�where�the�substitution���[�is�pro�Gduced����?b���y�<lam�b�Gda�unication�of��t��with�some�subterm����of��P�c��[�z�7��:=����].�T��*�aking��r�5�=��t�[ٲ,�w���e����?see�Ȍthat�demo�Gdulation�is�a�sp�ecial�case�of�paramo�dulation,�so�w���e�ha�v�e�already����?pro���v�ed�UUwhat�is�required.�That�completes�the�pro�Gof�of�the�theorem.����N�src:612ImplicitTyping.tex�Example:�L\xe��}'d�p�oints�.��The�xed�p�Goin���t�argumen�t�whic�h�sho�ws�that�the�group����?axioms�Ӯare�con���tradictory�in�lam�b�Gda�logic�requires�a�term��Ap�(�f��V;���Ap�(�x;�x�)).�ӮThe����?part�Dof�this�that�is�problematic�is��Ap�(�x;���x�).�If�the�t���yp�Ge�sp�ecication�for��Ap��is����?�ty�[�pe�(�V��9;���Ap�(�i�(�U���;�V�8�)�;�U��)),��dthen�for��Ap�(�x;���x�)�to�b�Ge�correctly�t���yp�ed,�w���e�m�ust�ha�v�e����?�V����=�_�U�v2�=��i�(�U���;���U��).���If��U�ǣ�and��V��l�are�t���yp�Ge�sym�b�Gols,�this�can�nev�er�happ�Gen,�so�the����?xed�gp�Goin���t�construction�cannot�b�e�correctly�t���yp�ed.�It�follo���ws�from�the�theorem����?ab�Go���v�e�*Sthat�this�argumen���t�cannot�b�e�found�b���y�Otter-���from�a�correctly�t�yp�Ged����?input��yle.�In�particular,�in�lagrange3.in�w���e�ha�v�e�correctly�t�yp�Ged�axioms,�so�w�e����?will�UUnot�get�a�con���tradiction�from�a�xed�p�Goin�t�argumen�t.����N�src:616ImplicitTyping.texOn���the�other�hand,�in�le�lam���b�Gda4.in,�w�e�sho�w�that�Otter-���can�v�erify�the����?xed-p�Goin���t�UUconstruction.�The�input�le�con�tains�the�negated�goal������e�Ap�(�c;���Ap�(�l�2`ambda�(�x;�Ap�(�c;�Ap�(�x;�x�)))�;�l�ambda�(�x;�Ap�(�c;�Ap�(�x;�x�)))))��������Z�)�6�=�����e�Ap�(�l�2`ambda�(�x;���Ap�(�c;�Ap�(�x;�x�)))�;�l�ambda�(�x;�Ap�(�c;�Ap�(�x;�x�))))�:������?�src:621ImplicitTyping.tex�Since�E�this�con���tains�the�term��Ap�(�x;���x�),�it�cannot�b�Ge�correctly�t�yp�Ged�with�resp�ect����?to�sran���y�coheren�t�list�of�t�yp�Ge�sp�ecications��T�c��.�Otter-���do�es�nd�a�pro�of�using����?this���input�le,�whic���h�is�consisten�t�with�our�argumen�t�ab�Go�v�e�that�xed-p�Goin�t����?constructions�Ȍwill�not�o�Gccur�in�pro�ofs�from�correctly�t���ypable�input�les.�The�fact����?that��fthe�input�le�cannot�b�Ge�correctly�t���yp�ed,�whic���h�w�e�just�observ�ed�directly��*�,����?can�rtalso�b�Ge�seen�as�a�corollary�of�the�theorem,�since�Otter-���nds�a�pro�of.�The����?fact�athat�the�theoretical�result�agrees�with�the�results�of�running�the�program�is����?a�UUgo�Go�d�thing.����N�src:624ImplicitTyping.tex�R��}'emarks�.��N(1)�The�(unrelativized)�axioms�of�group�theory�are�con���tradictory����?in�v�lam���b�Gda�logic,�but�if�w�e�put�in�only�correctly-t�yp�Ged�axioms,�Otter-���will�nd����?only�όcorrectly�t���yp�Ged�pro�ofs,�whic���h�will�b�e�v��q�alid�in�the�nite�t���yp�e�structure�based����?on�UUan���y�group,�and�hence�will�not�b�Ge�pro�ofs�of�a�con���tradiction.����N�src:629ImplicitTyping.tex(2)��0W��*�e�already�knew�that�resolution�plus�factoring�plus�paramo�Gdulation�from����?non-v��q�ariables�W�is�not�refutation-complete,�ev���en�for�rst-order�logic;�and�w�e�re-����?mark���ed�@when�p�Goin�ting�that�out�that�this�p�Germits�t�yp�Ged�mo�dels�of�some�theories����?that�vcare�inconsisten���t�when�ev�ery�ob��8ject�m�ust�ha�v�e�the�same�t�yp�Ge.�Here�is�another����?illustration�UUof�that�phenomenon�in�the�con���text�of�lam�b�Gda�logic.����N�src:633ImplicitTyping.tex(3)�քOf�course�Otter-lam���b�Gda��c��}'an��nd�the�xed-p�oin���t�pro�of�that�giv���es�the����?con���tradiction;���but�to�mak�e�it�do�so,�w�e�need�to�put�in�some�non-w�ell-t�yp�Ged����?axiom,�UUsuc���h�as�the�negation�of�the�xed-p�Goin�t�equation.�������o#f����ܚ����?�XVI����5#f����ܚ���?�5��S@Enforcing��t��yp�`e-safet�y��z͍�?�src:637ImplicitTyping.tex�The�]theorems�ab�Go���v�e�]are�form���ulated�in�the�abstract,�rather�than�b�eing�theorems����?ab�Gout��a�particular�implemen���tation�of�a�particular�theorem-pro�v�er.�As�a�practical����?matter,��yw���e�wish�to�form�ulate�a�theorem�that�do�Ges�apply�to�Otter-���and�co�v�ers����?the���examples�p�Gosted�on�the�Otter-���w���ebsite,�some�of�whic�h�ha�v�e�b�Geen�men�tioned����?here.��Otter-���nev���er�uses�paramo�Gdulation�in�to�or�from�v��q�ariables,�so�that�h�yp�Goth-����?esis��1of�the�ab�Go���v�e��1theorems�is�alw���a�ys��1satised.�But�Otter-���do�es�not�alw���a�ys��1use����?only���t���yp�Ge-safe�lam�b�Gda�unication;�nor�w�ould�w�e�w�an�t�it�to�do�so,�since�it�can�nd����?some���un���t�yp�Ged�pro�ofs�of�in���terest,�e.g.�xed�p�oin���ts,�Russell's�parado�x,�etc.�Once����?Otter-��I��nds�a�correctly�t���ypable�pro�Gof,�w�e�can�c�hec�k�b�y�hand�(and�could�easily����?c���hec�k���b�y�mac�hine)�that�it�is�correctly�t�ypable.�Nev�ertheless�it�is�of�in�terest�to�b�Ge����?able��to�set�a�
ag�in�the�input�le�that�enforces�t���yp�Ge-safe�unication.�In�Otter-��,����?if��y���ou�put��set(types)��in�the�input�le,�then�only�certain�lam�b�Gda�unications����?will�UUb�Ge�p�erformed,�and�those�unications�will�alw���a�ys�UUb�e�t���yp�e-safe.����N�src:649ImplicitTyping.texSp�Gecally��*�,�Mv�r��}'estricte�d��lam���b�Gda�unication�means�that,�when�selecting�a�masking����?subterm,�]only�a�second�argumen���t�of��Ap��or�a�constan�t�will�b�Ge�c�hosen.�This�is�the����?restriction�Gfimp�Gosed�b���y�the�
ag��set(types)�.�W��*�e�no�w�pro�v�e�that�this�enforces����?t���yp�Ge�UUsafet�y�under�certain�conditions.��Y�����?�Theorem��T5���z�D�src:653ImplicitTyping.tex(T��9yp�Q�e�-fsafet�y�of�restricted�lam�b�Q�da�unication).��Supp��}'ose�
�that����?a��given�set�of�axioms�admits�a�c��}'oher�ent��typ�e�sp�e�cic�ation�in�which�ther�e�is�no�typ-����?ing��3of�the�form��Ap�(�U���;���U��)�,�and�al���l�c��}'onstants�r�e�c�eive�typ�e��U��.�Then�al���l�de�ductions����?fr��}'om�Othe�given�axioms�by�binary�r�esolution,�factoring,�hyp�err�esolution,�demo�du-����?lation��(including�b��}'eta-r�e�duction)��p�ar�amo�dulation�(exc�ept�into�or�fr�om�variables����?and�
��Ap��terms),�le��}'ad�to�c�orr�e�ctly�typ�able�c�onclusions,�pr�ovide�d�that�r�estricte�d����?lamb��}'da���unic�ation�is�use�d�in�those�rules�of�infer�enc�e.����?�src:658ImplicitTyping.texPr��}'o�of�.�R�It�suces�to�sho���w�that�lam�b�Gda�unications�will�b�e�t���yp�e-safe�under�these����?h���yp�Gotheses.���The�unication�of��Ap�(�x;���w�D�)�with��t��is�t�yp�Ge-safe�(b�y�denition)�if����?in�ozstep�(1)�of�the�denition�of�lam���b�Gda�unication,�the�masking�subterm��q��S�of����?�t��,�has�the�same�t���yp�Ge�as��w�D�.�No�w��q�%�is�either�a�constan�t�or�term�con�taining��x����?�that�˧app�Gears�as�a�second�argumen���t�of��Ap�,�since�those�are�the�\restrictions"�in����?restricted��+lam���b�Gda�unication.�If��q���is�a�v��q�ariable�then�it�m�ust�b�Ge��x�,�and�m�ust����?o�Gccur�u�as�a�second�argumen���t�of��Ap�;�but��x��o�ccurs�as�a�rst�argumen���t�of��Ap�,�and����?all�xsecond�argumen���ts�of��Ap��get�the�same�t�yp�Ge,�so�there�m�ust�b�Ge�a�t�yping�of����?the�y�form��ty�[�pe�(�T��V;���Ap�(�U���;�U��)).�y�But�suc���h�a�t�yping�is�not�allo�w�ed,�b�y�h�yp�Gothesis.����?Therefore�M�q�g&�is�not�a�v��q�ariable.�Then�if��q��con���tains��x�,�it�m�ust�o�Gccur�as�a�second����?argumen���t�@fof��Ap�,�as�do�Ges��w�D�;�hence�b�y�h�yp�Gothesis��w��I�and��q��?�get�the�same�t�yp�Ge.����?Hence�~�w���e�ma�y�assume��q�ڻ�is�a�constan�t.�But�b�y�h�yp�Gothesis,�all�constan�ts�get�the����?same�UUt���yp�Ge�as�the�second�argumen�ts�of��Ap�.�That�completes�the�pro�Gof.��z͍��?�6��S@Some��examples�co��v�ered��b�y�Theorem�5��z͍�?�src:674ImplicitTyping.tex�It�gremains�to�substan���tiate�the�claims�made�in�the�abstract�and�in�tro�Gduction,����?that�p�the�theorems�in�this�pap�Ger�justify�the�use�of�implicit�t���yping�in�Otter-���for�����
ߠo#f����ܚ�����Q�XVI�A�I����5#f����ܚ��?�the���v��q�arious�examples�men���tioned.�The�rst�theorems�apply�in�generalit�y�to�an�y����?partial�{
implemen���tation�of�non-deterministic�lam�b�Gda�unication,�used�in�com-����?bination��with�resolution�and�paramo�Gdulation,�but�disallo���wing�paramo�dulation����?in���to��tand�from�v��q�ariables.�Only�Theorem�5�applies�to�Otter-lam�b�Gda�sp�ecically��*�,����?when���the��set(typ��}'es)��command�is�in�the�input�le.�W��*�e�will�no���w�c�hec�k�explicitly����?that�UUin���teresting�examples�are�co�v�ered�b�y�this�theorem.��W���N�src:681ImplicitTyping.texLet�jus�start�with�the�\no�nilp�Goten���ts"�example.�It�app�ears��prima�bMfacie��not�to����?meet��the�h���yp�Gotheses�of�Theorem�5,�since�that�theorem�requires�that�all�constan�ts����?ha���v�e��the�same�t���yp�Ge�as�the�second�argumen�t�of��Ap�.�In�this�example�the�t�yp�Ge�of��Ap����?�is��@the�one�needed�for�mathematical�induction:��ty�[�pe�(�P�c�r�Gop;���Ap�(�i�(�N���;�P�r�Gop�)�;�N��)),��@so����?the��
t���yp�Ge�of�the�second�arg�of��Ap��is��N��;�but�the�axioms�include�a�constan�t��o��for����?the���zero�of�the�ring.�This�is�not�a�serious�problem:�w���e�can�simply�replace��o��in�the����?axioms��:b���y��z�p�er�Go�(0),�and�giv�e��z�p�er�Go��the�t�yp�Ge�sp�ecication��ty�[�pe�(�R��;���z�p�er�o�(�N��)).�The����?term��>�z�p�er�Go�(0)�is�not�a�constan���t,�so�it�w�on't�b�Ge�selected�as�a�masking�term�(where����?it��Ww���ould�in�terfere�with�the�pro�Gof�of�Theorem�5).�But�it�will�b�e�treated�essen���tially����?as��a�constan���t�elsewhere�in�the�inference�pro�Gcess;�and�if�w�e�w�ere�w�orried�ab�Gout����?that,�8�w���e�could�use�a�w�eigh�t�template�to�ensure�that�it�has�the�same�w�eigh�t�as�a����?constan���t�J�and�hence�will�b�Ge�treated��exactly��as�a�constan�t.�On�the�logical�side�w�e����?ha���v�e�UUthe�follo���wing�lemma�to�justify�the�claim:���w����?�Lemma��T1.���u���src:693ImplicitTyping.tex�L��}'et����T�cK�b�e�a�the�ory�with�at�le�ast�one�c�onstant��c�.�L�et��T��c���^��O!�cmsy7���	�/�b�e�obtaine�d����?fr��}'om��T�w�by�adding�a�new�function�symb�ol��f���,�but�no�new�axioms.�Then�(i)��T��c���^����	c�plus����?the���axioms��c���=��f���(�x�)���is�c��}'onservative�over��T�c��.����N�src:696ImplicitTyping.tex(ii)�v4If��T���c��}'ontains�another�c�onstant��b��and�we�let��A���^��o���b�e�the�r�esult�of�r�eplacing����?�c���by��f���(�b�)��in��A�,�then��T��v�pr��}'oves��A��if�and�only�if��T��c���^����	�Z�pr�oves��A���^��o��r}�.����N�src:699ImplicitTyping.tex(iii)�JTher��}'e�is�an�algorithm�for�tr�ansforming�any�pr�o�of�of��A���^��o�����in��T��c���^����	F��to�a�pr�o�of����?of���A��in��T�c��.��^�src:702ImplicitTyping.texPr��}'o�of�.��|(i)�Ev���ery�mo�Gdel�of��T�[�can�b�e�expanded�to�a�mo�del�of��T��c���^����	��plus��c��W�=��f���(�x�)����?b���y��Tin�terpreting��f�
�as�the�constan�t�function�whose�v��q�alue�is�the�in�terpretation�of��c�.����?The�UUcompleteness�theorem�then�yields�the�stated�conserv��q�ativ���e�extension�result.����N�src:706ImplicitTyping.tex(ii)�"��A���^��o���.�is�equiv��q�alen���t�to��A��in��T��c���^����	$�plus��c���=��f���(�x�),�"�so�b�y�(i),��A���^��o���.�is�pro�v��q�able�in��T��c���^�������?�plus�ȅ�c���=��f���(�x�)�if�and�only�if��T�,�pro���v�es��A�.�In�particular,�if��T��c���^����	��pro�v�es��A���^��o��;�then��T����?�pro���v�es��s�A�.�Con���v�ersely��*�,��sif��T�_�pro���v�es��s�A��and�w���e�just�replace��c��with��f���(�b�)�in�the�pro�Gof,����?w���e�UUget�a�pro�Gof�of��A���^��o���Ҳin��T��c���^�����s�.����N�src:710ImplicitTyping.tex(iii)�7The�algorithm�is�fairly�ob���vious:�simply�replace�ev�ery�term��f���(�t�)�in�the����?pro�Gof��|with��c�.�(Not�just�terms��f���(�b�)�but�an���y�term�with�functor��f���is�replaced�b�y��c�.)����?T��*�erms��Xthat�unify�b�Gefore�this�replacemen���t�will�still�unify�after�the�replacemen�t,����?so�{�resolution�pro�Gof�steps�will�remain�v��q�alid.�The�axioms�of��T��c���^����	x�plus��c���=��f���(�x�)�{�are����?con���v�erted�#�to�axioms�of��T����plus��c���=��c�.�#�P���aramo�Gdulation�steps�remain�paramo�d-����?ulation���steps�and�demo�Gdulations�remain�demo�dulations.�Since�no�v��q�ariables�are����?in���tro�Gduced,��)paramo�dulations�that�w���ere�not�from�or�in�to�v��q�ariables�are�still�not����?from�UUor�in���to�v��q�ariables.�That�completes�the�pro�Gof�of�the�lemma.����N�src:718ImplicitTyping.texThis�U�lemma�sho���ws�us�that�logically��*�,�the�form�ulation�of�the�no-nilp�Goten�ts�prob-����?lem�E�with��z�p�er�Go�(0)�for�the�ring�zero�is�equiv��q�alen���t�to�the�original�form�ulation�with����?a��hconstan���t��o��for�the�ring�zero;�and�Theorem�5�directly�applies�to�the�form�ulation�������o#f����ܚ����?�XVI�A�I�I����5#f����ܚ��?�with�oc�o�(0).�In�practice,�if�w���e�run�Otter-lam�b�Gda�with��o��replaced�b�y��z�p�er�Go�(0)�in����?the�<Einput�le,�w���e�nd�the�same�pro�Gof�as�b�efore,�but�with��o��replaced�b���y��z�p�er�o�(0).����?In��essence�this�amoun���ts�to�the�observ��q�ation�that��o��w�as�nev�er�used�as�a�masking����?term�s6in�lam���b�Gda�unication�in�the�original�pro�of.�T��*�ec���hnically�w�e�should�run�the����?input��Vle�with��z�p�er�Go�(0)�rst.�Theorem�5�guaran���tees�that�if�w�e�nd�a�pro�Gof,�it�will����?b�Ge�P�w���ell-t�yp�ed.�P�The�lemma�guaran���tees�that�w�e�can�con�v�ert�it�in�to�a�pro�Gof�of�the����?original�_form���ulation�using�a�text�editor�to�replace�all�terms�with�functor��z�p�er�Go����?�b���y�UUthe�original�constan�t��o�.��(,��N�src:729ImplicitTyping.texW��*�e�UUconclude�with�another�example.�Bernoulli's�inequalit���y�is��PW��m�F(1�8�+��nx�)���<��(1�8�+��x�)�����n���q��if�UU�x��>���1�and��n�>��0�is�an�in���teger.�����?�src:731ImplicitTyping.texOtter-lam���b�Gda,�R_in�a�v�ersion�that�calls�on�MathXp�Gert�[2]�for�\external�simplica-����?tion",���is�able�to�pro���v�e���this�inequalit���y�b�y�induction�on��n�,�b�Geing�giv�en�only�the����?clausal�form�of�P���eano's�induction�axiom,�with�a�v��q�ariable�for�the�induction�pred-����?icate.���The�in���terest�of�the�example�in�the�presen�t�con�text�is�the�fact�that�three����?t���yp�Ges��are�in�v�olv�ed:�real�n�um�b�Gers,�p�ositiv���e�in�tegers,�and�prop�Gositions.�The�prop�o-����?sitional��@functions�all�ha���v�e��@�N��,�the�non-negativ���e�in�tegers,�for�the�ground�t�yp�Ge,�but����?the�Xt���yp�Ges�are�not�disjoin�t:��N�o0�is�a�subset�of�the�reals��R�Dz.�Moreo�v�er,�the�left-hand����?side��of�the�inequalit���y�uses��n��in�m�ultiplication,�so�if�m�ultiplication�is�t�yp�Ged�to����?tak���e�UUt�w�o�real�argumen�ts,�the�inequalit�y�as�it�stands�will�not�b�Ge�w�ell-t�yp�Ged.����N�src:739ImplicitTyping.texThe��solution�is�to�in���tro�Gduce�a�sym�b�Gol�for�an�injection�map��i�2�:��N�J�!��R�Dz.��The����?inequalit���y�UUthen�b�Gecomes��PW����i(�i�(1)�8�+��i�(�n�)�x�)���<��(�i�(1)�8�+��x�)�����n�����?�src:741ImplicitTyping.tex�This��tform���ulation�is�w�ell-t�yp�Ged,�if�w�e�t�yp�Ge��i��as�a�function�from��N�
��to��R�Dz.�Again,�in����?the��pdenition�of�exp�Gonen���tiation�w�e�ha�v�e�to�use�0�for�the�natural�n�um�b�Ger�zero,����?and��׵z�p�er�Go�(0)�for�the�real�n���um�b�er���zero,�so�that�all�the�constan���ts�will�ha�v�e�t�yp�Ge��N��.����?If���that�is�done,�Theorem�5�applies,�and�w���e�can�b�Ge�assured�that�the�inference�steps����?p�Gerformed��b���y�Otter-lam�b�Gda�prop�er�will�lead�from�w���ell-t�yp�ed��form�ulas�to�w�ell-����?t���yp�Ged��form�ulas.�Ho�w�ev�er,�the�theorem�do�Ges�not�co�v�er�the�external�simplication����?steps���p�Gerformed�b���y�MathXp�ert.�T��*�o�ensure�that�these�do�not�lead�to�mis-t���yp�ed����?conclusions,���w���e�ha�v�e�to�discard�an�y�results�con�taining�a�min�us�sign�or�division����?sign,���as�that�migh���t�lead�out�of�the�domain�of�in�tegers.�Problems�in�v�olving�em-����?b�Gedded��subt���yp�es�also�arise�ev���en�in�t�yp�Ged�theorem�pro�v�ers�or�pro�Gof�c�hec�k�ers,�so����?it���is�in���teresting�that�those�problems�are�easily�solv�ed�in�lam�b�Gda�logic.�The�in�ter-����?ested��7reader�can�nd�the�input�and�output�les�for�this�and�other�examples�on����?the�UUOtter-lam���b�Gda�w�ebsite.�� �ڍ�?�References���ڍ���?�1.���K1��src:754ImplicitTyping.texBeeson,�:,M.,�Lam��9b�A�da�Logic,�in�Basin,�Da�vid;�Rusino�witc�h,�Mic�hael�(eds.)�Automated����K1�Reasoning:�	Second�In��9ternational�Join�t�Conference,�IJCAR�~�2004,�Cork,�Ireland,�July����K1�4-8,�ү2004,�Pro�A�ceedings.�Lecture�Notes�in�Articial�In��9telligence�3097,�pp.�460-474,����K1�Springer�T(2004).�����1�o#f����ܚ�����韻XIX����5#f����ܚ����?2.���K1��src:756ImplicitTyping.texMathXp�A�ert���Calculus�Assistan��9t,�soft�w�are�a�v��|railable�from�(and�describ�A�ed�at)����K1�www.HelpWithMath.com.������?3.���K1��src:759ImplicitTyping.texMcCune,�|�W.,�Otter�3.0�Reference�Man��9ual�and�Guide,�Argonne�National�Lab�A�oratory����K1�T��:�ec��9h.�TRep�A�ort�ANL-94/6,�1994.������?4.���K1��src:762ImplicitTyping.texWic��9k,�U�C.,�and�McCune,�W.,�Automated�reasoning�ab�A�out�elemen�tary�p�A�oin�t-set�top�A�ol-����K1�ogy��:�,�T��j��		cmti9�J.�N<A�Îutomate��d�R�e�asoning�T�5(2)��239{255,�1989.�����A����;�o#f����j��		cmti9���<x

cmtt10�5��"		cmmi9��Aa�cmr6��"V

cmbx10��':

cmti10���N�cmbx12�t�:		cmbx9�ߤN		cmtt9�o���		cmr9���N�ffcmbx12�
!",�

cmsy10�O!�cmsy7�
�b>

cmmi10�	0e�rcmmi7�K�`y

cmr10�ٓ�Rcmr7�D�������

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