74 val hyps_of: thm -> term list |
74 val hyps_of: thm -> term list |
75 val prop_of: thm -> term |
75 val prop_of: thm -> term |
76 val tpairs_of: thm -> (term * term) list |
76 val tpairs_of: thm -> (term * term) list |
77 val concl_of: thm -> term |
77 val concl_of: thm -> term |
78 val prems_of: thm -> term list |
78 val prems_of: thm -> term list |
|
79 val take_prems_of: int -> thm -> term list |
79 val nprems_of: thm -> int |
80 val nprems_of: thm -> int |
80 val no_prems: thm -> bool |
81 val no_prems: thm -> bool |
|
82 val prem_of: thm -> int -> term |
81 val major_prem_of: thm -> term |
83 val major_prem_of: thm -> term |
82 val cprop_of: thm -> cterm |
84 val cprop_of: thm -> cterm |
83 val cprem_of: thm -> int -> cterm |
85 val cprem_of: thm -> int -> cterm |
84 val cconcl_of: thm -> cterm |
86 val cconcl_of: thm -> cterm |
85 val cprems_of: thm -> cterm list |
87 val cprems_of: thm -> cterm list |
|
88 val take_cprems_of: int -> thm -> cterm list |
86 val chyps_of: thm -> cterm list |
89 val chyps_of: thm -> cterm list |
87 val thm_ord: thm ord |
90 val thm_ord: thm ord |
88 exception CONTEXT of string * ctyp list * cterm list * thm list * Context.generic option |
91 exception CONTEXT of string * ctyp list * cterm list * thm list * Context.generic option |
89 val theory_of_cterm: cterm -> theory |
92 val theory_of_cterm: cterm -> theory |
90 val theory_of_thm: thm -> theory |
93 val theory_of_thm: thm -> theory |
517 val prop_of = #prop o rep_thm; |
520 val prop_of = #prop o rep_thm; |
518 val tpairs_of = #tpairs o rep_thm; |
521 val tpairs_of = #tpairs o rep_thm; |
519 |
522 |
520 val concl_of = Logic.strip_imp_concl o prop_of; |
523 val concl_of = Logic.strip_imp_concl o prop_of; |
521 val prems_of = Logic.strip_imp_prems o prop_of; |
524 val prems_of = Logic.strip_imp_prems o prop_of; |
|
525 fun take_prems_of n = Logic.take_imp_prems n o prop_of; |
522 val nprems_of = Logic.count_prems o prop_of; |
526 val nprems_of = Logic.count_prems o prop_of; |
523 val no_prems = Logic.no_prems o prop_of; |
527 val no_prems = Logic.no_prems o prop_of; |
524 |
528 |
|
529 fun prem_of th i = |
|
530 Logic.nth_prem (i, prop_of th) handle TERM _ => raise THM ("prem_of", i, [th]); |
|
531 |
525 fun major_prem_of th = |
532 fun major_prem_of th = |
526 (case prems_of th of |
533 (case take_prems_of 1 th of |
527 prem :: _ => Logic.strip_assums_concl prem |
534 prem :: _ => Logic.strip_assums_concl prem |
528 | [] => raise THM ("major_prem_of: rule with no premises", 0, [th])); |
535 | [] => raise THM ("major_prem_of: rule with no premises", 0, [th])); |
529 |
536 |
530 fun cprop_of (Thm (_, {cert, maxidx, shyps, prop, ...})) = |
537 fun cprop_of (Thm (_, {cert, maxidx, shyps, prop, ...})) = |
531 Cterm {cert = cert, maxidx = maxidx, T = propT, t = prop, sorts = shyps}; |
538 Cterm {cert = cert, maxidx = maxidx, T = propT, t = prop, sorts = shyps}; |
538 Cterm {cert = cert, maxidx = maxidx, T = propT, sorts = shyps, t = concl_of th}; |
545 Cterm {cert = cert, maxidx = maxidx, T = propT, sorts = shyps, t = concl_of th}; |
539 |
546 |
540 fun cprems_of (th as Thm (_, {cert, maxidx, shyps, ...})) = |
547 fun cprems_of (th as Thm (_, {cert, maxidx, shyps, ...})) = |
541 map (fn t => Cterm {cert = cert, maxidx = maxidx, T = propT, sorts = shyps, t = t}) |
548 map (fn t => Cterm {cert = cert, maxidx = maxidx, T = propT, sorts = shyps, t = t}) |
542 (prems_of th); |
549 (prems_of th); |
|
550 |
|
551 fun take_cprems_of n (th as Thm (_, {cert, maxidx, shyps, ...})) = |
|
552 map (fn t => Cterm {cert = cert, maxidx = maxidx, T = propT, sorts = shyps, t = t}) |
|
553 (take_prems_of n th); |
543 |
554 |
544 fun chyps_of (Thm (_, {cert, shyps, hyps, ...})) = |
555 fun chyps_of (Thm (_, {cert, shyps, hyps, ...})) = |
545 map (fn t => Cterm {cert = cert, maxidx = ~1, T = propT, sorts = shyps, t = t}) hyps; |
556 map (fn t => Cterm {cert = cert, maxidx = ~1, T = propT, sorts = shyps, t = t}) hyps; |
546 |
557 |
547 |
558 |