src/Pure/thm.ML
changeset 19861 620d90091788
parent 19525 0cd0bf32ac58
child 19881 47937afefdc9
equal deleted inserted replaced
19860:6e44610bdd76 19861:620d90091788
   949 (*Smash unifies the list of term pairs leaving no flex-flex pairs.
   949 (*Smash unifies the list of term pairs leaving no flex-flex pairs.
   950   Instantiates the theorem and deletes trivial tpairs.
   950   Instantiates the theorem and deletes trivial tpairs.
   951   Resulting sequence may contain multiple elements if the tpairs are
   951   Resulting sequence may contain multiple elements if the tpairs are
   952     not all flex-flex. *)
   952     not all flex-flex. *)
   953 fun flexflex_rule (th as Thm {thy_ref, der, maxidx, shyps, hyps, tpairs, prop}) =
   953 fun flexflex_rule (th as Thm {thy_ref, der, maxidx, shyps, hyps, tpairs, prop}) =
   954   Unify.smash_unifiers (Theory.deref thy_ref, Envir.empty maxidx, tpairs)
   954   Unify.smash_unifiers (Theory.deref thy_ref) tpairs (Envir.empty maxidx)
   955   |> Seq.map (fn env =>
   955   |> Seq.map (fn env =>
   956       if Envir.is_empty env then th
   956       if Envir.is_empty env then th
   957       else
   957       else
   958         let
   958         let
   959           val tpairs' = tpairs |> map (pairself (Envir.norm_term env))
   959           val tpairs' = tpairs |> map (pairself (Envir.norm_term env))
  1424            (*perform minimal copying here by examining env*)
  1424            (*perform minimal copying here by examining env*)
  1425            val (ntpairs, normp) =
  1425            val (ntpairs, normp) =
  1426              if Envir.is_empty env then (tpairs, (Bs @ As, C))
  1426              if Envir.is_empty env then (tpairs, (Bs @ As, C))
  1427              else
  1427              else
  1428              let val ntps = map (pairself normt) tpairs
  1428              let val ntps = map (pairself normt) tpairs
  1429              in if Envir.above (smax, env) then
  1429              in if Envir.above env smax then
  1430                   (*no assignments in state; normalize the rule only*)
  1430                   (*no assignments in state; normalize the rule only*)
  1431                   if lifted
  1431                   if lifted
  1432                   then (ntps, (Bs @ map (norm_term_skip env nlift) As, C))
  1432                   then (ntps, (Bs @ map (norm_term_skip env nlift) As, C))
  1433                   else (ntps, (Bs @ map normt As, C))
  1433                   else (ntps, (Bs @ map normt As, C))
  1434                 else if match then raise COMPOSE
  1434                 else if match then raise COMPOSE
  1437              end
  1437              end
  1438            val th =
  1438            val th =
  1439              Thm{thy_ref = thy_ref,
  1439              Thm{thy_ref = thy_ref,
  1440                  der = Pt.infer_derivs
  1440                  der = Pt.infer_derivs
  1441                    ((if Envir.is_empty env then I
  1441                    ((if Envir.is_empty env then I
  1442                      else if Envir.above (smax, env) then
  1442                      else if Envir.above env smax then
  1443                        (fn f => fn der => f (Pt.norm_proof' env der))
  1443                        (fn f => fn der => f (Pt.norm_proof' env der))
  1444                      else
  1444                      else
  1445                        curry op oo (Pt.norm_proof' env))
  1445                        curry op oo (Pt.norm_proof' env))
  1446                     (Pt.bicompose_proof flatten Bs oldAs As A n)) rder' sder,
  1446                     (Pt.bicompose_proof flatten Bs oldAs As A n)) rder' sder,
  1447                  maxidx = maxidx,
  1447                  maxidx = maxidx,