src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML
changeset 38549 d0385f2764d8
parent 38072 7b8c295af291
child 38558 32ad17fe2b9c
equal deleted inserted replaced
38548:dea0d2cca822 38549:d0385f2764d8
   522     val cases = map mk_case intros
   522     val cases = map mk_case intros
   523   in Logic.list_implies (assm :: cases, prop) end;
   523   in Logic.list_implies (assm :: cases, prop) end;
   524 
   524 
   525 fun dest_conjunct_prem th =
   525 fun dest_conjunct_prem th =
   526   case HOLogic.dest_Trueprop (prop_of th) of
   526   case HOLogic.dest_Trueprop (prop_of th) of
   527     (Const ("op &", _) $ t $ t') =>
   527     (Const (@{const_name "op &"}, _) $ t $ t') =>
   528       dest_conjunct_prem (th RS @{thm conjunct1})
   528       dest_conjunct_prem (th RS @{thm conjunct1})
   529         @ dest_conjunct_prem (th RS @{thm conjunct2})
   529         @ dest_conjunct_prem (th RS @{thm conjunct2})
   530     | _ => [th]
   530     | _ => [th]
   531 
   531 
   532 fun prove_casesrule ctxt (pred, (pre_cases_rule, nparams)) cases_rule =
   532 fun prove_casesrule ctxt (pred, (pre_cases_rule, nparams)) cases_rule =
   574     Const ("==>", _) $ _ $ _ => Conv.combination_conv (Conv.arg_conv cv) (imp_prems_conv cv) ct
   574     Const ("==>", _) $ _ $ _ => Conv.combination_conv (Conv.arg_conv cv) (imp_prems_conv cv) ct
   575   | _ => Conv.all_conv ct
   575   | _ => Conv.all_conv ct
   576 
   576 
   577 fun Trueprop_conv cv ct =
   577 fun Trueprop_conv cv ct =
   578   case Thm.term_of ct of
   578   case Thm.term_of ct of
   579     Const ("Trueprop", _) $ _ => Conv.arg_conv cv ct  
   579     Const (@{const_name "Trueprop"}, _) $ _ => Conv.arg_conv cv ct  
   580   | _ => raise Fail "Trueprop_conv"
   580   | _ => raise Fail "Trueprop_conv"
   581 
   581 
   582 fun preprocess_intro thy rule =
   582 fun preprocess_intro thy rule =
   583   Conv.fconv_rule
   583   Conv.fconv_rule
   584     (imp_prems_conv
   584     (imp_prems_conv
   585       (Trueprop_conv (Conv.try_conv (Conv.rewr_conv (Thm.symmetric @{thm Predicate.eq_is_eq})))))
   585       (Trueprop_conv (Conv.try_conv (Conv.rewr_conv (Thm.symmetric @{thm Predicate.eq_is_eq})))))
   586     (Thm.transfer thy rule)
   586     (Thm.transfer thy rule)
   587 
   587 
   588 fun preprocess_elim ctxt elimrule =
   588 fun preprocess_elim ctxt elimrule =
   589   let
   589   let
   590     fun replace_eqs (Const ("Trueprop", _) $ (Const ("op =", T) $ lhs $ rhs)) =
   590     fun replace_eqs (Const (@{const_name "Trueprop"}, _) $ (Const (@{const_name "op ="}, T) $ lhs $ rhs)) =
   591        HOLogic.mk_Trueprop (Const (@{const_name Predicate.eq}, T) $ lhs $ rhs)
   591        HOLogic.mk_Trueprop (Const (@{const_name Predicate.eq}, T) $ lhs $ rhs)
   592      | replace_eqs t = t
   592      | replace_eqs t = t
   593     val thy = ProofContext.theory_of ctxt
   593     val thy = ProofContext.theory_of ctxt
   594     val ((_, [elimrule]), ctxt') = Variable.import false [elimrule] ctxt
   594     val ((_, [elimrule]), ctxt') = Variable.import false [elimrule] ctxt
   595     val prems = Thm.prems_of elimrule
   595     val prems = Thm.prems_of elimrule