392 Example: "EX x. x : A & x ~: B ==> sko A B : A & sko A B ~: B" [.] *) |
392 Example: "EX x. x : A & x ~: B ==> sko A B : A & sko A B ~: B" [.] *) |
393 fun skolem_of_def def = |
393 fun skolem_of_def def = |
394 let val (c,rhs) = Drule.dest_equals (cprop_of (freeze_thm def)) |
394 let val (c,rhs) = Drule.dest_equals (cprop_of (freeze_thm def)) |
395 val (ch, frees) = c_variant_abs_multi (rhs, []) |
395 val (ch, frees) = c_variant_abs_multi (rhs, []) |
396 val (chilbert,cabs) = Thm.dest_comb ch |
396 val (chilbert,cabs) = Thm.dest_comb ch |
397 val {sign,t, ...} = rep_cterm chilbert |
397 val {thy,t, ...} = rep_cterm chilbert |
398 val T = case t of Const ("Hilbert_Choice.Eps", Type("fun",[_,T])) => T |
398 val T = case t of Const ("Hilbert_Choice.Eps", Type("fun",[_,T])) => T |
399 | _ => raise THM ("skolem_of_def: expected Eps", 0, [def]) |
399 | _ => raise THM ("skolem_of_def: expected Eps", 0, [def]) |
400 val cex = Thm.cterm_of sign (HOLogic.exists_const T) |
400 val cex = Thm.cterm_of thy (HOLogic.exists_const T) |
401 val ex_tm = c_mkTrueprop (Thm.capply cex cabs) |
401 val ex_tm = c_mkTrueprop (Thm.capply cex cabs) |
402 and conc = c_mkTrueprop (Drule.beta_conv cabs (Drule.list_comb(c,frees))); |
402 and conc = c_mkTrueprop (Drule.beta_conv cabs (Drule.list_comb(c,frees))); |
403 fun tacf [prem] = rewrite_goals_tac [def] THEN rtac (prem RS someI_ex) 1 |
403 fun tacf [prem] = rewrite_goals_tac [def] THEN rtac (prem RS someI_ex) 1 |
404 in Goal.prove_raw [ex_tm] conc tacf |
404 in Goal.prove_raw [ex_tm] conc tacf |
405 |> forall_intr_list frees |
405 |> forall_intr_list frees |