@@ -48,7 +48,7 @@ data Tactic = Attack
48 | Intro Name
48 | Intro Name
49 | Forall Name Raw
49 | Forall Name Raw
50 | PatVar Name
50 | PatVar Name
51− | PatBind Name Raw
51+ | PatBind Name
52 | Focus Name
52 | Focus Name
53 | MoveLast Name
53 | MoveLast Name
54 | ProofState
54 | ProofState
@@ -239,12 +239,14 @@ patvar n ctxt env (Bind x (Hole t) sc) =
239 do action (\ps -> ps { holes = holes ps \\ [x] })
239 do action (\ps -> ps { holes = holes ps \\ [x] })
240 return $ Bind n (PVar t) (instantiate (P Bound n t) (pToV x sc))
240 return $ Bind n (PVar t) (instantiate (P Bound n t) (pToV x sc))
242−patbind :: Name -> Raw -> RunTactic
242+patbind :: Name -> RunTactic
243−patbind n ty ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' =
243+patbind n ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' =
244− do (tyv, tyt) <- lift $ check ctxt env ty
244+ do let t' = normalise ctxt env t
245− lift $ isSet ctxt env tyt
245+ case t' of
246+ Bind y (PVTy s) t -> let t' = instantiate (P Bound n s) (pToV y t) in
246− return $ Bind n (PVar tyv) (Bind x (Hole t) (P Bound x t))
247+ return $ Bind n (PVar s) (Bind x (Hole t') (P Bound x t'))
248+ _ -> fail "Nothing to pattern bind"
247−patbind n ty ctxt env _ = fail "Can't pattern bind here"
249+patbind n ctxt env _ = fail "Can't pattern bind here"
249compute :: RunTactic
251compute :: RunTactic
250compute ctxt env (Bind x (Hole ty) sc) =
252compute ctxt env (Bind x (Hole ty) sc) =
@@ -345,7 +347,7 @@ process t h = tactic (Just h) (mktac t)
345 mktac (Intro n) = intro n
347 mktac (Intro n) = intro n
346 mktac (Forall n t) = forall n t
348 mktac (Forall n t) = forall n t
347 mktac (PatVar n) = patvar n
349 mktac (PatVar n) = patvar n
348− mktac (PatBind n t) = patbind n t
350+ mktac (PatBind n) = patbind n
349 mktac (CheckIn r) = check_in r
351 mktac (CheckIn r) = check_in r
350 mktac (EvalIn r) = eval_in r
352 mktac (EvalIn r) = eval_in r
351 mktac (Focus n) = focus n
353 mktac (Focus n) = focus n