@@ -266,8 +266,8 @@ removes a hole from the head of the queue:
269−\MO{NewHole}\;=\;\RW{do}\;\AR{
269+\MO{NewHole}\;\vn\;=\;\RW{do}\;\AR{
270−(\vC,\Delta,\vP,\vQ)\gets\MO{Get}\\
270+(\vC,\Delta,\ve,\vP,\vQ)\gets\MO{Get}\\
271\MO{Put}\;(\vC,\Delta,\ve,\vP,\vn;\vQ)\\
271\MO{Put}\;(\vC,\Delta,\ve,\vP,\vn;\vQ)\\
@@ -312,7 +312,8 @@ given in Figure \ref{runtac} which
312locates the appropriate sub-term, applies the tactic with the context
312locates the appropriate sub-term, applies the tactic with the context
313local to this sub-term, and
313local to this sub-term, and
314replaces the sub-term with the term returned by the
314replaces the sub-term with the term returned by the
315−tactic.
315+tactic. Note that monadic lifting is left implicit in this Figure, so that
316+the details of the algorithm are not obscured.
316% It then updates the hole queue in the proof state, and updates holes which have
317% It then updates the hole queue in the proof state, and updates holes which have
317% been solved by unification. If the tactic creates new holes, these are automatically
318% been solved by unification. If the tactic creates new holes, these are automatically
318% added to the \remph{head} of the hole queue.
319% added to the \remph{head} of the hole queue.
@@ -322,7 +323,7 @@ tactic.
322\MO{Tactic}\;\VV{tac}\;=\;\RW{do}\;\AR{
323\MO{Tactic}\;\VV{tac}\;=\;\RW{do}\;\AR{
323\ve\Gets\MO{Term}\\
324\ve\Gets\MO{Term}\\
324\vh\Gets\MO{NextHole}\\
325\vh\Gets\MO{NextHole}\\
325−\ve'\Gets\MO{Tactic'}\;\langle\rangle\;\ve\;\VV{tac}\;\vh\\
326+\ve'\Gets\MO{Tactic'}\;\langle\rangle\;\ve\\
326\MO{SetTerm}\;\ve'
327\MO{SetTerm}\;\ve'
@@ -331,8 +332,23 @@ tactic.
331\RW{where} \\
332\RW{where} \\
332& \MO{Tactic'} & \Gamma & (\hole{\vx}{\vT}\SC\ve)
333& \MO{Tactic'} & \Gamma & (\hole{\vx}{\vT}\SC\ve)
333& \MoRet{\VV{tac}_\Gamma\;(\hole{\vx}{\vT}\SC\ve)\hg\mbox{if}\;\vx=\vh} \\
334& \MoRet{\VV{tac}_\Gamma\;(\hole{\vx}{\vT}\SC\ve)\hg\mbox{if}\;\vx=\vh} \\
335+& \MO{Tactic'} & \Gamma & (\hole{\vx}{\vT}\SC\ve)
337+\RW{do}\; \AR{\vT'\Gets\;\MO{Tactic'}\;\Gamma\;\vT\\
338+\RW{return}\;(\hole{\vx}{\vT'}\SC \MO{Tactic'}\;(\Gamma;\hole{\vx}{\vT'})\;\ve)
334& \MO{Tactic'} & \Gamma & (\guess{\vx}{\vT}{\vv}\SC\ve)
342& \MO{Tactic'} & \Gamma & (\guess{\vx}{\vT}{\vv}\SC\ve)
335& \MoRet{\VV{tac}_\Gamma\;(\guess{\vx}{\vT}{\vv}\SC\ve)\hg\mbox{if}\;\vx=\vh} \\
343& \MoRet{\VV{tac}_\Gamma\;(\guess{\vx}{\vT}{\vv}\SC\ve)\hg\mbox{if}\;\vx=\vh} \\
345+& \MO{Tactic'} & \Gamma & (\guess{\vx}{\vT}{\vv}\SC\ve)
346+& \MoRet{\RW{do}\;\AR{\vv'\Gets\;\MO{Tactic'}\;\Gamma\;\vv\\
347+\vT'\Gets\;\MO{Tactic'}\;\Gamma\;\vT\\
348+\RW{return}\;(\guess{\vx}{\vT'}{\vv'}\SC
349+\MO{Tactic'}\;(\Gamma;\guess{\vx}{\vT'}{\vv'}\;\ve)
350+\hg\RW{otherwise}}} \\
336& \MO{Tactic'} & \Gamma & (\lam{\vx}{\vT}\SC\ve)
352& \MO{Tactic'} & \Gamma & (\lam{\vx}{\vT}\SC\ve)
338\RW{do}\; \AR{\vT'\Gets\;\MO{Tactic'}\;\Gamma\;\vT\\
354\RW{do}\; \AR{\vT'\Gets\;\MO{Tactic'}\;\Gamma\;\vT\\
@@ -345,11 +361,11 @@ tactic.
345\RW{return}\;(\all{\vx}{\vT'}\SC \MO{Tactic'}\;(\Gamma;\all{\vx}{\vT'})\;\ve)}
361\RW{return}\;(\all{\vx}{\vT'}\SC \MO{Tactic'}\;(\Gamma;\all{\vx}{\vT'})\;\ve)}
348−& \MO{Tactic'} & \Gamma & (\LET\;\vx\defq\vt\Hab\vT\SC\ve)
364+& \MO{Tactic'} & \Gamma & (\LET\;\vx\defq\vv\Hab\vT\SC\ve)
349−& \MoRet{\RW{do}\;\AR{\vt'\Gets\;\MO{Tactic'}\;\Gamma\;\vt\\
365+& \MoRet{\RW{do}\;\AR{\vv'\Gets\;\MO{Tactic'}\;\Gamma\;\vv\\
350\vT'\Gets\;\MO{Tactic'}\;\Gamma\;\vT\\
366\vT'\Gets\;\MO{Tactic'}\;\Gamma\;\vT\\
351−\RW{return}\;(\LET\;\vx\defq\vt'\Hab\vT'\SC
367+\RW{return}\;(\LET\;\vx\defq\vv'\Hab\vT'\SC
352−\MO{Tactic'}\;(\Gamma;\LET\;\vx\defq\vt'\Hab\vT')\;\ve)}} \\
368+\MO{Tactic'}\;(\Gamma;\LET\;\vx\defq\vv'\Hab\vT')\;\ve)}} \\
353& \MO{Tactic'} & \Gamma & (\vf\;\va) &
369& \MO{Tactic'} & \Gamma & (\vf\;\va) &
354\MoRet{\RW{return}\;(\MO{Tactic'}\;\Gamma\;\vf)\; (\MO{Tactic'}\;\Gamma\;\va)}\\
370\MoRet{\RW{return}\;(\MO{Tactic'}\;\Gamma\;\vf)\; (\MO{Tactic'}\;\Gamma\;\va)}\\
355& \MO{Tactic'} & \Gamma & \vt & \MoRet{\RW{return}\;\vt}
371& \MO{Tactic'} & \Gamma & \vt & \MoRet{\RW{return}\;\vt}
@@ -429,7 +445,8 @@ keeping $\vx$ at the head:
429\PA{\A\A}{
445\PA{\A\A}{
430\MO{Claim}_\Gamma & (\vy \Hab\vS) & (\hole{\vx}{\vT}\SC\ve) &
446\MO{Claim}_\Gamma & (\vy \Hab\vS) & (\hole{\vx}{\vT}\SC\ve) &
431 \MoRet{\RW{do}\;\AR{\MO{NewHole}\;\vy\\
447 \MoRet{\RW{do}\;\AR{\MO{NewHole}\;\vy\\
432− \RW{return}\;\hole{\vx}{\vT}\SC\hole{\vy}{\vS}\SC\ve}} \\
449+ \RW{return}\;\hole{\vy}{\vS}\SC\hole{\vx}{\vT}\SC\ve}} \\
@@ -692,23 +709,21 @@ the goal type.
694\mbox{Initial state}
711\mbox{Initial state}
695−& \hole{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}\SC\vx
712+& \underline{\hole{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}\SC\vx}
696& \langle\vx\rangle \\
713& \langle\vx\rangle \\
698\MO{Attack} &
715\MO{Attack} &
700\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
716\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
701−\hole{\vh_0}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}\SC\vh_0
717+\underline{\hole{\vh_0}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}\SC\vh_0}
706\langle\vh_0,\vx\rangle\\
721\langle\vh_0,\vx\rangle\\
708\MO{Lambda}\;\vA &
723\MO{Lambda}\;\vA &
709\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
724\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
710−\underline{
725+\lam{\vA}{\Type}\SC\underline{
711−\lam{\vA}{\Type}\SC\hole{\vh_0}{\all{\va}{\vA}\SC\vA}\SC\vh_0
726+\hole{\vh_0}{\all{\va}{\vA}\SC\vA}\SC\vh_0
@@ -718,12 +733,12 @@ the goal type.
718\MO{Attack} &
733\MO{Attack} &
719\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
734\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
720\lam{\vA}{\Type}\SC
735\lam{\vA}{\Type}\SC
722\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
736\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
723−{\hole{\vh_1}{\all{\va}{\vA}\SC\vA}\SC\vh_1}
739+\hole{\vh_1}{\all{\va}{\vA}\SC\vA}\SC\vh_1}}
729\langle\vh_1,\vh_0,\vx\rangle\\
744\langle\vh_1,\vh_0,\vx\rangle\\
@@ -733,8 +748,8 @@ the goal type.
733\lam{\vA}{\Type}\SC
748\lam{\vA}{\Type}\SC
734\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
749\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
736−\underline{
751+\lam{\va}{\vA}\SC\underline{
737−\lam{\va}{\vA}\SC\hole{\vh_1}{\vA}\SC\vh_1
752+\hole{\vh_1}{\vA}\SC\vh_1
@@ -746,9 +761,10 @@ the goal type.
746\MO{Fill}\;\va &
761\MO{Fill}\;\va &
747\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
762\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
748\lam{\vA}{\Type}\SC
763\lam{\vA}{\Type}\SC
766+%\hg\hg\hg\hg\hg\hg\hg
751−\hg\hg\hg\hg\hg\hg\hg\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
767+\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
753\lam{\va}{\vA}\SC
769\lam{\va}{\vA}\SC
754\underline{
770\underline{
@@ -764,37 +780,35 @@ the goal type.
764\MO{Solve} &
780\MO{Solve} &
765\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
781\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
766\lam{\vA}{\Type}\SC
782\lam{\vA}{\Type}\SC
767\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
784\guess{\vh_0}{\all{\va}{\vA}\SC\vA}
769\lam{\va}{\vA}\SC
786\lam{\va}{\vA}\SC
778\langle\vh_0,\vx\rangle\\
794\langle\vh_0,\vx\rangle\\
780\MO{Solve} &
796\MO{Solve} &
781\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
798\guess{\vx}{\all{\vA}{\Type}\SC\all{\va}{\vA}\SC\vA}{
782\lam{\vA}{\Type}\SC
799\lam{\vA}{\Type}\SC
784\lam{\va}{\vA}\SC
800\lam{\va}{\vA}\SC
790\langle\vx\rangle\\
806\langle\vx\rangle\\
792\MO{Solve} &
808\MO{Solve} &
794\lam{\vA}{\Type}\SC
809\lam{\vA}{\Type}\SC
795\lam{\va}{\vA}\SC
810\lam{\va}{\vA}\SC
799\langle\rangle\\
813\langle\rangle\\