src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML
changeset 34974 18b41bba42b5
parent 34963 366a1a44aac2
child 35021 c839a4c670c6
equal deleted inserted replaced
34973:ae634fad947e 34974:18b41bba42b5
  1559     HOLogic.mk_Trueprop
  1559     HOLogic.mk_Trueprop
  1560       (HOLogic.mk_eq (list_comb (fun_const, in_ts @ additional_arguments), compilation))
  1560       (HOLogic.mk_eq (list_comb (fun_const, in_ts @ additional_arguments), compilation))
  1561   end;
  1561   end;
  1562 
  1562 
  1563 (* special setup for simpset *)                  
  1563 (* special setup for simpset *)                  
  1564 val HOL_basic_ss' = HOL_basic_ss addsimps (@{thms "HOL.simp_thms"} @ [@{thm Pair_eq}])
  1564 val HOL_basic_ss' = HOL_basic_ss addsimps (@{thms HOL.simp_thms} @ [@{thm Pair_eq}])
  1565   setSolver (mk_solver "all_tac_solver" (fn _ => fn _ => all_tac))
  1565   setSolver (mk_solver "all_tac_solver" (fn _ => fn _ => all_tac))
  1566   setSolver (mk_solver "True_solver" (fn _ => rtac @{thm TrueI}))
  1566   setSolver (mk_solver "True_solver" (fn _ => rtac @{thm TrueI}))
  1567 
  1567 
  1568 (* Definition of executable functions and their intro and elim rules *)
  1568 (* Definition of executable functions and their intro and elim rules *)
  1569 
  1569 
  1815   (* replace TRY by determining if it necessary - are there equations when calling compile match? *)
  1815   (* replace TRY by determining if it necessary - are there equations when calling compile match? *)
  1816   in
  1816   in
  1817      (* make this simpset better! *)
  1817      (* make this simpset better! *)
  1818     asm_full_simp_tac (HOL_basic_ss' addsimps simprules) 1
  1818     asm_full_simp_tac (HOL_basic_ss' addsimps simprules) 1
  1819     THEN print_tac' options "after prove_match:"
  1819     THEN print_tac' options "after prove_match:"
  1820     THEN (DETERM (TRY (EqSubst.eqsubst_tac (ProofContext.init thy) [0] [@{thm "HOL.if_P"}] 1
  1820     THEN (DETERM (TRY (EqSubst.eqsubst_tac (ProofContext.init thy) [0] [@{thm HOL.if_P}] 1
  1821            THEN (REPEAT_DETERM (rtac @{thm conjI} 1 THEN (SOLVED (asm_simp_tac HOL_basic_ss' 1))))
  1821            THEN (REPEAT_DETERM (rtac @{thm conjI} 1 THEN (SOLVED (asm_simp_tac HOL_basic_ss' 1))))
  1822            THEN print_tac' options "if condition to be solved:"
  1822            THEN print_tac' options "if condition to be solved:"
  1823            THEN (SOLVED (asm_simp_tac HOL_basic_ss' 1 THEN print_tac' options "after if simp; in SOLVED:"))
  1823            THEN (SOLVED (asm_simp_tac HOL_basic_ss' 1 THEN print_tac' options "after if simp; in SOLVED:"))
  1824            THEN check_format thy
  1824            THEN check_format thy
  1825            THEN print_tac' options "after if simplification - a TRY block")))
  1825            THEN print_tac' options "after if simplification - a TRY block")))
  1841         (all_input_of T))
  1841         (all_input_of T))
  1842         preds
  1842         preds
  1843   in 
  1843   in 
  1844     (* remove not_False_eq_True when simpset in prove_match is better *)
  1844     (* remove not_False_eq_True when simpset in prove_match is better *)
  1845     simp_tac (HOL_basic_ss addsimps
  1845     simp_tac (HOL_basic_ss addsimps
  1846       (@{thms "HOL.simp_thms"} @ (@{thm not_False_eq_True} :: @{thm eval_pred} :: defs))) 1 
  1846       (@{thms HOL.simp_thms} @ (@{thm not_False_eq_True} :: @{thm eval_pred} :: defs))) 1 
  1847     (* need better control here! *)
  1847     (* need better control here! *)
  1848   end
  1848   end
  1849 
  1849 
  1850 fun prove_clause options thy nargs modes mode (_, clauses) (ts, moded_ps) =
  1850 fun prove_clause options thy nargs modes mode (_, clauses) (ts, moded_ps) =
  1851   let
  1851   let
  2433     fn prem => fn additional_arguments =>
  2433     fn prem => fn additional_arguments =>
  2434     let
  2434     let
  2435       val [polarity, depth] = additional_arguments
  2435       val [polarity, depth] = additional_arguments
  2436       val polarity' = (case prem of Prem _ => I | Negprem _ => HOLogic.mk_not | _ => I) polarity
  2436       val polarity' = (case prem of Prem _ => I | Negprem _ => HOLogic.mk_not | _ => I) polarity
  2437       val depth' =
  2437       val depth' =
  2438         Const ("HOL.minus_class.minus", @{typ "code_numeral => code_numeral => code_numeral"})
  2438         Const ("Algebras.minus", @{typ "code_numeral => code_numeral => code_numeral"})
  2439           $ depth $ Const ("HOL.one_class.one", @{typ "Code_Numeral.code_numeral"})
  2439           $ depth $ Const ("Algebras.one", @{typ "Code_Numeral.code_numeral"})
  2440     in [polarity', depth'] end
  2440     in [polarity', depth'] end
  2441   }
  2441   }
  2442 
  2442 
  2443 val random_comp_modifiers = Comp_Mod.Comp_Modifiers
  2443 val random_comp_modifiers = Comp_Mod.Comp_Modifiers
  2444   {
  2444   {