QuotMain.thy
changeset 362 7a3d86050e72
parent 360 07fb696efa3d
child 363 82cfedb16a99
equal deleted inserted replaced
360:07fb696efa3d 362:7a3d86050e72
  1526   in
  1526   in
  1527     lthy2
  1527     lthy2
  1528   end
  1528   end
  1529 *}
  1529 *}
  1530 
  1530 
       
  1531 ML {*
       
  1532 fun spec_frees_tac [] = []
       
  1533   | spec_frees_tac (x::xs) = 
       
  1534        let
       
  1535          val spec' =  Drule.instantiate' [SOME (ctyp_of_term x)] [NONE, SOME x] @{thm spec} 
       
  1536        in
       
  1537          (rtac spec')::(spec_frees_tac xs)
       
  1538        end
       
  1539 *}  
       
  1540 
       
  1541 ML {*
       
  1542 val prepare_tac = CSUBGOAL (fn (concl, i) =>
       
  1543     let
       
  1544       val vrs = Thm.add_cterm_frees concl []
       
  1545     in
       
  1546       EVERY' (ObjectLogic.full_atomize_tac::spec_frees_tac vrs) i
       
  1547     end)
       
  1548 *}
       
  1549 
  1531 lemma procedure:
  1550 lemma procedure:
  1532   assumes a: "A"
  1551   assumes a: "A"
  1533   and     b: "A \<Longrightarrow> B"
  1552   and     b: "A \<Longrightarrow> B"
  1534   and     c: "B = C"
  1553   and     c: "B = C"
  1535   and     d: "C = D"
  1554   and     d: "C = D"
  1550     [SOME (cterm_of thy rtrm'),
  1569     [SOME (cterm_of thy rtrm'),
  1551      SOME (cterm_of thy reg_goal),
  1570      SOME (cterm_of thy reg_goal),
  1552      SOME (cterm_of thy inj_goal)]
  1571      SOME (cterm_of thy inj_goal)]
  1553   @{thm procedure}
  1572   @{thm procedure}
  1554 end
  1573 end
  1555 
  1574 *}
  1556 fun procedure_tac rthm =
  1575   
       
  1576 ML {*
       
  1577 fun procedure_tac rthm ctxt =
       
  1578   prepare_tac THEN'
  1557   Subgoal.FOCUS (fn {context, concl, ...} =>
  1579   Subgoal.FOCUS (fn {context, concl, ...} =>
  1558     let
  1580     let
  1559       val rthm' = atomize_thm rthm
  1581       val rthm' = atomize_thm rthm
  1560       val rule = procedure_inst context (prop_of rthm') (term_of concl)
  1582       val rule = procedure_inst context (prop_of rthm') (term_of concl)
  1561     in
  1583     in
  1562       EVERY1 [rtac rule, rtac rthm']
  1584       EVERY1 [rtac rule, rtac rthm']
  1563     end)
  1585     end) ctxt
  1564 *}
  1586 *}
  1565 
  1587 
       
  1588 
       
  1589 ML {*
  1566 (* FIXME: allex_prs and lambda_prs can be one function *)
  1590 (* FIXME: allex_prs and lambda_prs can be one function *)
  1567 
       
  1568 ML {*
       
  1569 fun allex_prs_tac lthy quot =
  1591 fun allex_prs_tac lthy quot =
  1570   (EqSubst.eqsubst_tac lthy [0] @{thms FORALL_PRS[symmetric] EXISTS_PRS[symmetric]})
  1592   (EqSubst.eqsubst_tac lthy [0] @{thms FORALL_PRS[symmetric] EXISTS_PRS[symmetric]})
  1571   THEN' (quotient_tac quot);
  1593   THEN' (quotient_tac quot);
  1572 *}
  1594 *}
  1573 
  1595