src/HOL/Tools/Quotient/quotient_term.ML
changeset 37609 ebc157ab01b0
parent 37592 e16495cfdde0
child 37677 c5a8b612e571
equal deleted inserted replaced
37608:165cd386288d 37609:ebc157ab01b0
   732         matches trm_subst
   732         matches trm_subst
   733       end
   733       end
   734 
   734 
   735 (* generate type and term substitutions out of the
   735 (* generate type and term substitutions out of the
   736    qtypes involved in a quotient; the direction flag 
   736    qtypes involved in a quotient; the direction flag 
   737    indicates in which direction the substitution work: 
   737    indicates in which direction the substitutions work: 
   738    
   738    
   739      true:  quotient -> raw
   739      true:  quotient -> raw
   740      false: raw -> quotient
   740      false: raw -> quotient
   741 *)
   741 *)
   742 fun mk_ty_subst qtys direction ctxt =
   742 fun mk_ty_subst qtys direction ctxt =
   746    |> map (if direction then swap else I)
   746    |> map (if direction then swap else I)
   747 
   747 
   748 fun mk_trm_subst qtys direction ctxt =
   748 fun mk_trm_subst qtys direction ctxt =
   749 let
   749 let
   750   val subst_typ' = subst_typ ctxt (mk_ty_subst qtys direction ctxt)
   750   val subst_typ' = subst_typ ctxt (mk_ty_subst qtys direction ctxt)
   751   fun proper (t1, t2) = (subst_typ' (fastype_of t1) = fastype_of t2)
   751   fun proper (t1, t2) = subst_typ' (fastype_of t1) = fastype_of t2
   752 
   752 
   753   val const_substs = 
   753   val const_substs = 
   754     Quotient_Info.qconsts_dest ctxt
   754     Quotient_Info.qconsts_dest ctxt
   755      |> map (fn x => (#rconst x, #qconst x))
   755      |> map (fn x => (#rconst x, #qconst x))
   756      |> map (if direction then swap else I)
   756      |> map (if direction then swap else I)