1536 prem_matches_name_thm prems |
1536 prem_matches_name_thm prems |
1537 end; |
1537 end; |
1538 |
1538 |
1539 (* ------------</filter constructions> *) |
1539 (* ------------</filter constructions> *) |
1540 |
1540 |
1541 (* collect all the Var statements in a term *) |
|
1542 fun vars_of_term (Const _) = [] |
|
1543 | vars_of_term (Free _) = [] |
|
1544 | vars_of_term (Bound _) = [] |
|
1545 | vars_of_term (Abs (_,_,t)) = vars_of_term t |
|
1546 | vars_of_term (v as (Var _)) = [v] |
|
1547 | vars_of_term (x $ y) = vars_of_term x @ (vars_of_term y); |
|
1548 |
|
1549 (* elimination rule: conclusion is a Var and |
1541 (* elimination rule: conclusion is a Var and |
1550 no Var in the conclusion appears in the major premise |
1542 no Var in the conclusion appears in the major premise |
1551 Note: only makes sense if the major premise already matched the assumption |
1543 Note: only makes sense if the major premise already matched the assumption |
1552 of some goal! *) |
1544 of some goal! *) |
1553 fun is_elim_rule thm = |
1545 fun is_elim_rule thm = |
1554 let |
1546 let |
1555 val {prop, ...} = rep_thm thm; |
1547 val {prop, ...} = rep_thm thm; |
1556 val concl = rem_top_c (Logic.strip_imp_concl prop); |
1548 val concl = rem_top_c (Logic.strip_imp_concl prop); |
1557 val major_prem = hd (Logic.strip_imp_prems prop); |
1549 val major_prem = hd (Logic.strip_imp_prems prop); |
1558 val prem_vars = distinct (vars_of_term major_prem); |
1550 val prem_vars = distinct (Drule.vars_of_terms [major_prem]); |
1559 val concl_vars = distinct (vars_of_term concl); |
1551 val concl_vars = distinct (Drule.vars_of_terms [concl]); |
1560 in |
1552 in |
1561 Term.is_Var concl andalso ((prem_vars inter concl_vars) = []) |
1553 Term.is_Var concl andalso (prem_vars inter concl_vars) = [] |
1562 end; |
1554 end; |
1563 |
1555 |
1564 fun crit2str (Name name) = "name:" ^ name |
1556 fun crit2str (Name name) = "name:" ^ name |
1565 | crit2str Elim = "elim" |
1557 | crit2str Elim = "elim" |
1566 | crit2str Intro = "intro" |
1558 | crit2str Intro = "intro" |