348 else ( |
348 else ( |
349 next_idx := Termtab.fold (Integer.max o snd) table 0; |
349 next_idx := Termtab.fold (Integer.max o snd) table 0; |
350 next_idx_is_valid := true; |
350 next_idx_is_valid := true; |
351 Unsynchronized.inc next_idx |
351 Unsynchronized.inc next_idx |
352 ) |
352 ) |
353 fun aux (Const (@{const_name True}, _)) table = (True, table) |
353 fun aux (Const (\<^const_name>\<open>True\<close>, _)) table = (True, table) |
354 | aux (Const (@{const_name False}, _)) table = (False, table) |
354 | aux (Const (\<^const_name>\<open>False\<close>, _)) table = (False, table) |
355 | aux (Const (@{const_name Not}, _) $ x) table = apfst Not (aux x table) |
355 | aux (Const (\<^const_name>\<open>Not\<close>, _) $ x) table = apfst Not (aux x table) |
356 | aux (Const (@{const_name HOL.disj}, _) $ x $ y) table = |
356 | aux (Const (\<^const_name>\<open>HOL.disj\<close>, _) $ x $ y) table = |
357 let |
357 let |
358 val (fm1, table1) = aux x table |
358 val (fm1, table1) = aux x table |
359 val (fm2, table2) = aux y table1 |
359 val (fm2, table2) = aux y table1 |
360 in |
360 in |
361 (Or (fm1, fm2), table2) |
361 (Or (fm1, fm2), table2) |
362 end |
362 end |
363 | aux (Const (@{const_name HOL.conj}, _) $ x $ y) table = |
363 | aux (Const (\<^const_name>\<open>HOL.conj\<close>, _) $ x $ y) table = |
364 let |
364 let |
365 val (fm1, table1) = aux x table |
365 val (fm1, table1) = aux x table |
366 val (fm2, table2) = aux y table1 |
366 val (fm2, table2) = aux y table1 |
367 in |
367 in |
368 (And (fm1, fm2), table2) |
368 (And (fm1, fm2), table2) |
388 (* Note: A more generic implementation should take another argument of type *) |
388 (* Note: A more generic implementation should take another argument of type *) |
389 (* Term.term Inttab.table (or so) that specifies HOL terms for some *) |
389 (* Term.term Inttab.table (or so) that specifies HOL terms for some *) |
390 (* Boolean variables in the formula, similar to 'prop_formula_of_term' *) |
390 (* Boolean variables in the formula, similar to 'prop_formula_of_term' *) |
391 (* (but the other way round). *) |
391 (* (but the other way round). *) |
392 |
392 |
393 fun term_of_prop_formula True = @{term True} |
393 fun term_of_prop_formula True = \<^term>\<open>True\<close> |
394 | term_of_prop_formula False = @{term False} |
394 | term_of_prop_formula False = \<^term>\<open>False\<close> |
395 | term_of_prop_formula (BoolVar i) = Free ("v" ^ string_of_int i, HOLogic.boolT) |
395 | term_of_prop_formula (BoolVar i) = Free ("v" ^ string_of_int i, HOLogic.boolT) |
396 | term_of_prop_formula (Not fm) = HOLogic.mk_not (term_of_prop_formula fm) |
396 | term_of_prop_formula (Not fm) = HOLogic.mk_not (term_of_prop_formula fm) |
397 | term_of_prop_formula (Or (fm1, fm2)) = |
397 | term_of_prop_formula (Or (fm1, fm2)) = |
398 HOLogic.mk_disj (term_of_prop_formula fm1, term_of_prop_formula fm2) |
398 HOLogic.mk_disj (term_of_prop_formula fm1, term_of_prop_formula fm2) |
399 | term_of_prop_formula (And (fm1, fm2)) = |
399 | term_of_prop_formula (And (fm1, fm2)) = |