src/HOLCF/Tools/pcpodef.ML
changeset 36323 655e2d74de3a
parent 36241 2a4cec6bcae2
child 36610 bafd82950e24
equal deleted inserted replaced
36322:81cba3921ba5 36323:655e2d74de3a
   326     val args = map (apsnd (prep_constraint ctxt)) raw_args;
   326     val args = map (apsnd (prep_constraint ctxt)) raw_args;
   327     val (goal1, goal2, make_result) =
   327     val (goal1, goal2, make_result) =
   328       prepare_cpodef prep_term def name (b, args, mx) set opt_morphs thy;
   328       prepare_cpodef prep_term def name (b, args, mx) set opt_morphs thy;
   329     fun after_qed [[th1, th2]] = ProofContext.theory (snd o make_result th1 th2)
   329     fun after_qed [[th1, th2]] = ProofContext.theory (snd o make_result th1 th2)
   330       | after_qed _ = raise Fail "cpodef_proof";
   330       | after_qed _ = raise Fail "cpodef_proof";
   331   in Proof.theorem_i NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
   331   in Proof.theorem NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
   332 
   332 
   333 fun gen_pcpodef_proof prep_term prep_constraint
   333 fun gen_pcpodef_proof prep_term prep_constraint
   334     ((def, name), (b, raw_args, mx), set, opt_morphs) thy =
   334     ((def, name), (b, raw_args, mx), set, opt_morphs) thy =
   335   let
   335   let
   336     val ctxt = ProofContext.init thy;
   336     val ctxt = ProofContext.init thy;
   337     val args = map (apsnd (prep_constraint ctxt)) raw_args;
   337     val args = map (apsnd (prep_constraint ctxt)) raw_args;
   338     val (goal1, goal2, make_result) =
   338     val (goal1, goal2, make_result) =
   339       prepare_pcpodef prep_term def name (b, args, mx) set opt_morphs thy;
   339       prepare_pcpodef prep_term def name (b, args, mx) set opt_morphs thy;
   340     fun after_qed [[th1, th2]] = ProofContext.theory (snd o make_result th1 th2)
   340     fun after_qed [[th1, th2]] = ProofContext.theory (snd o make_result th1 th2)
   341       | after_qed _ = raise Fail "pcpodef_proof";
   341       | after_qed _ = raise Fail "pcpodef_proof";
   342   in Proof.theorem_i NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
   342   in Proof.theorem NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
   343 
   343 
   344 in
   344 in
   345 
   345 
   346 fun cpodef_proof x = gen_cpodef_proof Syntax.check_term (K I) x;
   346 fun cpodef_proof x = gen_cpodef_proof Syntax.check_term (K I) x;
   347 fun cpodef_proof_cmd x = gen_cpodef_proof Syntax.read_term Typedecl.read_constraint x;
   347 fun cpodef_proof_cmd x = gen_cpodef_proof Syntax.read_term Typedecl.read_constraint x;