src/Pure/pattern.ML
changeset 52179 3b9c31867707
parent 52133 f8cd46077224
child 52220 c4264f71dc3b
equal deleted inserted replaced
52178:6228806b2605 52179:3b9c31867707
   240     | (t,Abs(nt,Tt,tt)) => unif thy ((nt,Tt)::binders) ((incr t)$Bound(0),tt) env
   240     | (t,Abs(nt,Tt,tt)) => unif thy ((nt,Tt)::binders) ((incr t)$Bound(0),tt) env
   241     | p => cases thy (binders,env,p)
   241     | p => cases thy (binders,env,p)
   242 
   242 
   243 and cases thy (binders,env,(s,t)) = case (strip_comb s,strip_comb t) of
   243 and cases thy (binders,env,(s,t)) = case (strip_comb s,strip_comb t) of
   244        ((Var(F,Fty),ss),(Var(G,Gty),ts)) =>
   244        ((Var(F,Fty),ss),(Var(G,Gty),ts)) =>
   245          if F = G then flexflex1(env,binders,F,Fty,ints_of' env ss,ints_of' env ts)
   245           if F = G then
   246                   else flexflex2(env,binders,F,Fty,ints_of' env ss,G,Gty,ints_of' env ts)
   246             let val env' = unify_types thy (Fty, Gty) env
       
   247             in flexflex1(env',binders,F,Fty,ints_of' env' ss,ints_of' env' ts) end
       
   248           else
       
   249             let val env' =
       
   250               unify_types thy
       
   251                (Envir.body_type env (length ss) Fty,
       
   252                 Envir.body_type env (length ts) Gty) env
       
   253             in flexflex2(env',binders,F,Fty,ints_of' env' ss,G,Gty,ints_of' env' ts) end
   247       | ((Var(F,Fty),ss),_)           => flexrigid thy (env,binders,F,Fty,ints_of' env ss,t)
   254       | ((Var(F,Fty),ss),_)           => flexrigid thy (env,binders,F,Fty,ints_of' env ss,t)
   248       | (_,(Var(F,Fty),ts))           => flexrigid thy (env,binders,F,Fty,ints_of' env ts,s)
   255       | (_,(Var(F,Fty),ts))           => flexrigid thy (env,binders,F,Fty,ints_of' env ts,s)
   249       | ((Const c,ss),(Const d,ts))   => rigidrigid thy (env,binders,c,d,ss,ts)
   256       | ((Const c,ss),(Const d,ts))   => rigidrigid thy (env,binders,c,d,ss,ts)
   250       | ((Free(f),ss),(Free(g),ts))   => rigidrigid thy (env,binders,f,g,ss,ts)
   257       | ((Free(f),ss),(Free(g),ts))   => rigidrigid thy (env,binders,f,g,ss,ts)
   251       | ((Bound(i),ss),(Bound(j),ts)) => rigidrigidB thy (env,binders,i,j,ss,ts)
   258       | ((Bound(i),ss),(Bound(j),ts)) => rigidrigidB thy (env,binders,i,j,ss,ts)