202 next_idx : int, |
202 next_idx : int, |
203 bounds : interpretation list, |
203 bounds : interpretation list, |
204 wellformed: prop_formula |
204 wellformed: prop_formula |
205 }; |
205 }; |
206 |
206 |
|
207 val default_parameters = |
|
208 [("itself", "1"), |
|
209 ("minsize", "1"), |
|
210 ("maxsize", "8"), |
|
211 ("maxvars", "10000"), |
|
212 ("maxtime", "60"), |
|
213 ("satsolver", "auto"), |
|
214 ("no_assms", "false")] |
|
215 |> Symtab.make |
207 |
216 |
208 structure Data = Theory_Data |
217 structure Data = Theory_Data |
209 ( |
218 ( |
210 type T = |
219 type T = |
211 {interpreters: (string * (Proof.context -> model -> arguments -> term -> |
220 {interpreters: (string * (Proof.context -> model -> arguments -> term -> |
212 (interpretation * model * arguments) option)) list, |
221 (interpretation * model * arguments) option)) list, |
213 printers: (string * (Proof.context -> model -> typ -> interpretation -> |
222 printers: (string * (Proof.context -> model -> typ -> interpretation -> |
214 (int -> bool) -> term option)) list, |
223 (int -> bool) -> term option)) list, |
215 parameters: string Symtab.table}; |
224 parameters: string Symtab.table}; |
216 val empty = {interpreters = [], printers = [], parameters = Symtab.empty}; |
225 val empty = |
|
226 {interpreters = [], printers = [], parameters = default_parameters}; |
217 val extend = I; |
227 val extend = I; |
218 fun merge |
228 fun merge |
219 ({interpreters = in1, printers = pr1, parameters = pa1}, |
229 ({interpreters = in1, printers = pr1, parameters = pa1}, |
220 {interpreters = in2, printers = pr2, parameters = pa2}) : T = |
230 {interpreters = in2, printers = pr2, parameters = pa2}) : T = |
221 {interpreters = AList.merge (op =) (K true) (in1, in2), |
231 {interpreters = AList.merge (op =) (K true) (in1, in2), |
415 (* ------------------------------------------------------------------------- *) |
425 (* ------------------------------------------------------------------------- *) |
416 (* is_const_of_class: returns 'true' iff 'Const (s, T)' is a constant that *) |
426 (* is_const_of_class: returns 'true' iff 'Const (s, T)' is a constant that *) |
417 (* denotes membership to an axiomatic type class *) |
427 (* denotes membership to an axiomatic type class *) |
418 (* ------------------------------------------------------------------------- *) |
428 (* ------------------------------------------------------------------------- *) |
419 |
429 |
420 fun is_const_of_class thy (s, T) = |
430 fun is_const_of_class thy (s, _) = |
421 let |
431 let |
422 val class_const_names = map Logic.const_of_class (Sign.all_classes thy) |
432 val class_const_names = map Logic.const_of_class (Sign.all_classes thy) |
423 in |
433 in |
424 (* I'm not quite sure if checking the name 's' is sufficient, *) |
434 (* I'm not quite sure if checking the name 's' is sufficient, *) |
425 (* or if we should also check the type 'T'. *) |
435 (* or if we should also check the type 'T'. *) |
444 (* ------------------------------------------------------------------------- *) |
454 (* ------------------------------------------------------------------------- *) |
445 (* is_IDT_recursor: returns 'true' iff 'Const (s, T)' is the recursion *) |
455 (* is_IDT_recursor: returns 'true' iff 'Const (s, T)' is the recursion *) |
446 (* operator of an inductive datatype in 'thy' *) |
456 (* operator of an inductive datatype in 'thy' *) |
447 (* ------------------------------------------------------------------------- *) |
457 (* ------------------------------------------------------------------------- *) |
448 |
458 |
449 fun is_IDT_recursor thy (s, T) = |
459 fun is_IDT_recursor thy (s, _) = |
450 let |
460 let |
451 val rec_names = Symtab.fold (append o #rec_names o snd) |
461 val rec_names = Symtab.fold (append o #rec_names o snd) |
452 (Datatype.get_all thy) [] |
462 (Datatype.get_all thy) [] |
453 in |
463 in |
454 (* I'm not quite sure if checking the name 's' is sufficient, *) |
464 (* I'm not quite sure if checking the name 's' is sufficient, *) |
623 orelse is_IDT_recursor thy (s, T) then |
633 orelse is_IDT_recursor thy (s, T) then |
624 t (* do not unfold IDT constructors/recursors *) |
634 t (* do not unfold IDT constructors/recursors *) |
625 (* unfold the constant if there is a defining equation *) |
635 (* unfold the constant if there is a defining equation *) |
626 else |
636 else |
627 case get_def thy (s, T) of |
637 case get_def thy (s, T) of |
628 SOME (axname, rhs) => |
638 SOME ((*axname*) _, rhs) => |
629 (* Note: if the term to be unfolded (i.e. 'Const (s, T)') *) |
639 (* Note: if the term to be unfolded (i.e. 'Const (s, T)') *) |
630 (* occurs on the right-hand side of the equation, i.e. in *) |
640 (* occurs on the right-hand side of the equation, i.e. in *) |
631 (* 'rhs', we must not use this equation to unfold, because *) |
641 (* 'rhs', we must not use this equation to unfold, because *) |
632 (* that would loop. Here would be the right place to *) |
642 (* that would loop. Here would be the right place to *) |
633 (* check this. However, getting this really right seems *) |
643 (* check this. However, getting this really right seems *) |
719 | Type ("fun", [T1, T2]) => collect_type_axioms T2 (collect_type_axioms T1 axs) |
729 | Type ("fun", [T1, T2]) => collect_type_axioms T2 (collect_type_axioms T1 axs) |
720 (* axiomatic type classes *) |
730 (* axiomatic type classes *) |
721 | Type ("itself", [T1]) => collect_type_axioms T1 axs |
731 | Type ("itself", [T1]) => collect_type_axioms T1 axs |
722 | Type (s, Ts) => |
732 | Type (s, Ts) => |
723 (case Datatype.get_info thy s of |
733 (case Datatype.get_info thy s of |
724 SOME info => (* inductive datatype *) |
734 SOME _ => (* inductive datatype *) |
725 (* only collect relevant type axioms for the argument types *) |
735 (* only collect relevant type axioms for the argument types *) |
726 fold collect_type_axioms Ts axs |
736 fold collect_type_axioms Ts axs |
727 | NONE => |
737 | NONE => |
728 (case get_typedef thy T of |
738 (case get_typedef thy T of |
729 SOME (axname, ax) => |
739 SOME (axname, ax) => |
970 else |
980 else |
971 Option.map (fn xs' => max :: xs') (make_first max (len-1) (sum-max)) |
981 Option.map (fn xs' => max :: xs') (make_first max (len-1) (sum-max)) |
972 (* enumerates all int lists with a fixed length, where 0<=x<='max' for *) |
982 (* enumerates all int lists with a fixed length, where 0<=x<='max' for *) |
973 (* all list elements x (unless 'max'<0) *) |
983 (* all list elements x (unless 'max'<0) *) |
974 (* int -> int -> int -> int list -> int list option *) |
984 (* int -> int -> int -> int list -> int list option *) |
975 fun next max len sum [] = |
985 fun next _ _ _ [] = |
976 NONE |
986 NONE |
977 | next max len sum [x] = |
987 | next max len sum [x] = |
978 (* we've reached the last list element, so there's no shift possible *) |
988 (* we've reached the last list element, so there's no shift possible *) |
979 make_first max (len+1) (sum+x+1) (* increment 'sum' by 1 *) |
989 make_first max (len+1) (sum+x+1) (* increment 'sum' by 1 *) |
980 | next max len sum (x1::x2::xs) = |
990 | next max len sum (x1::x2::xs) = |
1241 (a, T) :: strip_all_vars t |
1251 (a, T) :: strip_all_vars t |
1242 | strip_all_vars (Const (@{const_name Trueprop}, _) $ t) = |
1252 | strip_all_vars (Const (@{const_name Trueprop}, _) $ t) = |
1243 strip_all_vars t |
1253 strip_all_vars t |
1244 | strip_all_vars (Const (@{const_name All}, _) $ Abs (a, T, t)) = |
1254 | strip_all_vars (Const (@{const_name All}, _) $ Abs (a, T, t)) = |
1245 (a, T) :: strip_all_vars t |
1255 (a, T) :: strip_all_vars t |
1246 | strip_all_vars t = [] : (string * typ) list |
1256 | strip_all_vars _ = [] : (string * typ) list |
1247 val strip_t = strip_all_body ex_closure |
1257 val strip_t = strip_all_body ex_closure |
1248 val frees = Term.rename_wrt_term strip_t (strip_all_vars ex_closure) |
1258 val frees = Term.rename_wrt_term strip_t (strip_all_vars ex_closure) |
1249 val subst_t = Term.subst_bounds (map Free frees, strip_t) |
1259 val subst_t = Term.subst_bounds (map Free frees, strip_t) |
1250 in |
1260 in |
1251 find_model ctxt (actual_params ctxt params) assm_ts subst_t true |
1261 find_model ctxt (actual_params ctxt params) assm_ts subst_t true |
1468 | prop_formula_list_dot_product_interpretation_list (fm::fms,tr::trees) = |
1478 | prop_formula_list_dot_product_interpretation_list (fm::fms,tr::trees) = |
1469 interpretation_disjunction (prop_formula_times_interpretation (fm,tr), |
1479 interpretation_disjunction (prop_formula_times_interpretation (fm,tr), |
1470 prop_formula_list_dot_product_interpretation_list (fms,trees)) |
1480 prop_formula_list_dot_product_interpretation_list (fms,trees)) |
1471 | prop_formula_list_dot_product_interpretation_list (_,_) = |
1481 | prop_formula_list_dot_product_interpretation_list (_,_) = |
1472 raise REFUTE ("interpretation_apply", "empty list (in dot product)") |
1482 raise REFUTE ("interpretation_apply", "empty list (in dot product)") |
1473 (* concatenates 'x' with every list in 'xss', returning a new list of *) |
|
1474 (* lists *) |
|
1475 (* 'a -> 'a list list -> 'a list list *) |
|
1476 fun cons_list x xss = map (cons x) xss |
|
1477 (* returns a list of lists, each one consisting of one element from each *) |
1483 (* returns a list of lists, each one consisting of one element from each *) |
1478 (* element of 'xss' *) |
1484 (* element of 'xss' *) |
1479 (* 'a list list -> 'a list list *) |
1485 (* 'a list list -> 'a list list *) |
1480 fun pick_all [xs] = map single xs |
1486 fun pick_all [xs] = map single xs |
1481 | pick_all (xs::xss) = |
1487 | pick_all (xs::xss) = |
1533 (* simply typed lambda calculus: Isabelle's basic term syntax, with type *) |
1539 (* simply typed lambda calculus: Isabelle's basic term syntax, with type *) |
1534 (* variables, function types, and propT *) |
1540 (* variables, function types, and propT *) |
1535 |
1541 |
1536 fun stlc_interpreter ctxt model args t = |
1542 fun stlc_interpreter ctxt model args t = |
1537 let |
1543 let |
1538 val thy = Proof_Context.theory_of ctxt |
|
1539 val (typs, terms) = model |
1544 val (typs, terms) = model |
1540 val {maxvars, def_eq, next_idx, bounds, wellformed} = args |
1545 val {maxvars, def_eq, next_idx, bounds, wellformed} = args |
1541 (* Term.typ -> (interpretation * model * arguments) option *) |
1546 (* Term.typ -> (interpretation * model * arguments) option *) |
1542 fun interpret_groundterm T = |
1547 fun interpret_groundterm T = |
1543 let |
1548 let |
1614 (case t of |
1619 (case t of |
1615 Const (_, T) => interpret_groundterm T |
1620 Const (_, T) => interpret_groundterm T |
1616 | Free (_, T) => interpret_groundterm T |
1621 | Free (_, T) => interpret_groundterm T |
1617 | Var (_, T) => interpret_groundterm T |
1622 | Var (_, T) => interpret_groundterm T |
1618 | Bound i => SOME (nth (#bounds args) i, model, args) |
1623 | Bound i => SOME (nth (#bounds args) i, model, args) |
1619 | Abs (x, T, body) => |
1624 | Abs (_, T, body) => |
1620 let |
1625 let |
1621 (* create all constants of type 'T' *) |
1626 (* create all constants of type 'T' *) |
1622 val constants = make_constants ctxt model T |
1627 val constants = make_constants ctxt model T |
1623 (* interpret the 'body' separately for each constant *) |
1628 (* interpret the 'body' separately for each constant *) |
1624 val (bodies, (model', args')) = fold_map |
1629 val (bodies, (model', args')) = fold_map |
1677 in |
1682 in |
1678 (* we use either 'make_def_equality' or 'make_equality' *) |
1683 (* we use either 'make_def_equality' or 'make_equality' *) |
1679 SOME ((if #def_eq args then make_def_equality else make_equality) |
1684 SOME ((if #def_eq args then make_def_equality else make_equality) |
1680 (i1, i2), m2, a2) |
1685 (i1, i2), m2, a2) |
1681 end |
1686 end |
1682 | Const (@{const_name "=="}, _) $ t1 => |
1687 | Const (@{const_name "=="}, _) $ _ => |
1683 SOME (interpret ctxt model args (eta_expand t 1)) |
1688 SOME (interpret ctxt model args (eta_expand t 1)) |
1684 | Const (@{const_name "=="}, _) => |
1689 | Const (@{const_name "=="}, _) => |
1685 SOME (interpret ctxt model args (eta_expand t 2)) |
1690 SOME (interpret ctxt model args (eta_expand t 2)) |
1686 | Const (@{const_name "==>"}, _) $ t1 $ t2 => |
1691 | Const (@{const_name "==>"}, _) $ t1 $ t2 => |
1687 (* 3-valued logic *) |
1692 (* 3-valued logic *) |
1691 val fmTrue = Prop_Logic.SOr (toFalse i1, toTrue i2) |
1696 val fmTrue = Prop_Logic.SOr (toFalse i1, toTrue i2) |
1692 val fmFalse = Prop_Logic.SAnd (toTrue i1, toFalse i2) |
1697 val fmFalse = Prop_Logic.SAnd (toTrue i1, toFalse i2) |
1693 in |
1698 in |
1694 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1699 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1695 end |
1700 end |
1696 | Const (@{const_name "==>"}, _) $ t1 => |
1701 | Const (@{const_name "==>"}, _) $ _ => |
1697 SOME (interpret ctxt model args (eta_expand t 1)) |
1702 SOME (interpret ctxt model args (eta_expand t 1)) |
1698 | Const (@{const_name "==>"}, _) => |
1703 | Const (@{const_name "==>"}, _) => |
1699 SOME (interpret ctxt model args (eta_expand t 2)) |
1704 SOME (interpret ctxt model args (eta_expand t 2)) |
1700 | _ => NONE; |
1705 | _ => NONE; |
1701 |
1706 |
1757 val (i1, m1, a1) = interpret ctxt model args t1 |
1762 val (i1, m1, a1) = interpret ctxt model args t1 |
1758 val (i2, m2, a2) = interpret ctxt m1 a1 t2 |
1763 val (i2, m2, a2) = interpret ctxt m1 a1 t2 |
1759 in |
1764 in |
1760 SOME (make_equality (i1, i2), m2, a2) |
1765 SOME (make_equality (i1, i2), m2, a2) |
1761 end |
1766 end |
1762 | Const (@{const_name HOL.eq}, _) $ t1 => |
1767 | Const (@{const_name HOL.eq}, _) $ _ => |
1763 SOME (interpret ctxt model args (eta_expand t 1)) |
1768 SOME (interpret ctxt model args (eta_expand t 1)) |
1764 | Const (@{const_name HOL.eq}, _) => |
1769 | Const (@{const_name HOL.eq}, _) => |
1765 SOME (interpret ctxt model args (eta_expand t 2)) |
1770 SOME (interpret ctxt model args (eta_expand t 2)) |
1766 | Const (@{const_name HOL.conj}, _) $ t1 $ t2 => |
1771 | Const (@{const_name HOL.conj}, _) $ t1 $ t2 => |
1767 (* 3-valued logic *) |
1772 (* 3-valued logic *) |
1771 val fmTrue = Prop_Logic.SAnd (toTrue i1, toTrue i2) |
1776 val fmTrue = Prop_Logic.SAnd (toTrue i1, toTrue i2) |
1772 val fmFalse = Prop_Logic.SOr (toFalse i1, toFalse i2) |
1777 val fmFalse = Prop_Logic.SOr (toFalse i1, toFalse i2) |
1773 in |
1778 in |
1774 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1779 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1775 end |
1780 end |
1776 | Const (@{const_name HOL.conj}, _) $ t1 => |
1781 | Const (@{const_name HOL.conj}, _) $ _ => |
1777 SOME (interpret ctxt model args (eta_expand t 1)) |
1782 SOME (interpret ctxt model args (eta_expand t 1)) |
1778 | Const (@{const_name HOL.conj}, _) => |
1783 | Const (@{const_name HOL.conj}, _) => |
1779 SOME (interpret ctxt model args (eta_expand t 2)) |
1784 SOME (interpret ctxt model args (eta_expand t 2)) |
1780 (* this would make "undef" propagate, even for formulae like *) |
1785 (* this would make "undef" propagate, even for formulae like *) |
1781 (* "False & undef": *) |
1786 (* "False & undef": *) |
1788 val fmTrue = Prop_Logic.SOr (toTrue i1, toTrue i2) |
1793 val fmTrue = Prop_Logic.SOr (toTrue i1, toTrue i2) |
1789 val fmFalse = Prop_Logic.SAnd (toFalse i1, toFalse i2) |
1794 val fmFalse = Prop_Logic.SAnd (toFalse i1, toFalse i2) |
1790 in |
1795 in |
1791 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1796 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1792 end |
1797 end |
1793 | Const (@{const_name HOL.disj}, _) $ t1 => |
1798 | Const (@{const_name HOL.disj}, _) $ _ => |
1794 SOME (interpret ctxt model args (eta_expand t 1)) |
1799 SOME (interpret ctxt model args (eta_expand t 1)) |
1795 | Const (@{const_name HOL.disj}, _) => |
1800 | Const (@{const_name HOL.disj}, _) => |
1796 SOME (interpret ctxt model args (eta_expand t 2)) |
1801 SOME (interpret ctxt model args (eta_expand t 2)) |
1797 (* this would make "undef" propagate, even for formulae like *) |
1802 (* this would make "undef" propagate, even for formulae like *) |
1798 (* "True | undef": *) |
1803 (* "True | undef": *) |
1805 val fmTrue = Prop_Logic.SOr (toFalse i1, toTrue i2) |
1810 val fmTrue = Prop_Logic.SOr (toFalse i1, toTrue i2) |
1806 val fmFalse = Prop_Logic.SAnd (toTrue i1, toFalse i2) |
1811 val fmFalse = Prop_Logic.SAnd (toTrue i1, toFalse i2) |
1807 in |
1812 in |
1808 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1813 SOME (Leaf [fmTrue, fmFalse], m2, a2) |
1809 end |
1814 end |
1810 | Const (@{const_name HOL.implies}, _) $ t1 => |
1815 | Const (@{const_name HOL.implies}, _) $ _ => |
1811 SOME (interpret ctxt model args (eta_expand t 1)) |
1816 SOME (interpret ctxt model args (eta_expand t 1)) |
1812 | Const (@{const_name HOL.implies}, _) => |
1817 | Const (@{const_name HOL.implies}, _) => |
1813 SOME (interpret ctxt model args (eta_expand t 2)) |
1818 SOME (interpret ctxt model args (eta_expand t 2)) |
1814 (* this would make "undef" propagate, even for formulae like *) |
1819 (* this would make "undef" propagate, even for formulae like *) |
1815 (* "False --> undef": *) |
1820 (* "False --> undef": *) |
2051 in |
2056 in |
2052 case constrs2 of |
2057 case constrs2 of |
2053 [] => |
2058 [] => |
2054 (* 'Const (s, T)' is not a constructor of this datatype *) |
2059 (* 'Const (s, T)' is not a constructor of this datatype *) |
2055 NONE |
2060 NONE |
2056 | (_, ctypes)::cs => |
2061 | (_, ctypes)::_ => |
2057 let |
2062 let |
2058 (* int option -- only /recursive/ IDTs have an associated *) |
2063 (* int option -- only /recursive/ IDTs have an associated *) |
2059 (* depth *) |
2064 (* depth *) |
2060 val depth = AList.lookup (op =) typs (Type (s', Ts')) |
2065 val depth = AList.lookup (op =) typs (Type (s', Ts')) |
2061 (* this should never happen: at depth 0, this IDT fragment *) |
2066 (* this should never happen: at depth 0, this IDT fragment *) |
2142 (* the same in terms, for those elements *) |
2147 (* the same in terms, for those elements *) |
2143 val _ = |
2148 val _ = |
2144 let |
2149 let |
2145 fun search (x::xs) (y::ys) = |
2150 fun search (x::xs) (y::ys) = |
2146 if x = y then search xs ys else search (x::xs) ys |
2151 if x = y then search xs ys else search (x::xs) ys |
2147 | search (x::xs) [] = |
2152 | search (_::_) [] = |
2148 raise REFUTE ("IDT_constructor_interpreter", |
2153 raise REFUTE ("IDT_constructor_interpreter", |
2149 "element order not preserved") |
2154 "element order not preserved") |
2150 | search [] _ = () |
2155 | search [] _ = () |
2151 in search terms' terms end |
2156 in search terms' terms end |
2152 (* int * interpretation list *) |
2157 (* int * interpretation list *) |
2469 (* recursive argument is "rec_i params elem" *) |
2474 (* recursive argument is "rec_i params elem" *) |
2470 compute_array_entry i (find_index (fn x => x = True) xs) |
2475 compute_array_entry i (find_index (fn x => x = True) xs) |
2471 | rec_intr (Datatype.DtRec _) (Node _) = |
2476 | rec_intr (Datatype.DtRec _) (Node _) = |
2472 raise REFUTE ("IDT_recursion_interpreter", |
2477 raise REFUTE ("IDT_recursion_interpreter", |
2473 "interpretation for IDT is a node") |
2478 "interpretation for IDT is a node") |
2474 | rec_intr (Datatype.DtType ("fun", [dt1, dt2])) (Node xs) = |
2479 | rec_intr (Datatype.DtType ("fun", [_, dt2])) (Node xs) = |
2475 (* recursive argument is something like *) |
2480 (* recursive argument is something like *) |
2476 (* "\<lambda>x::dt1. rec_? params (elem x)" *) |
2481 (* "\<lambda>x::dt1. rec_? params (elem x)" *) |
2477 Node (map (rec_intr dt2) xs) |
2482 Node (map (rec_intr dt2) xs) |
2478 | rec_intr (Datatype.DtType ("fun", [_, _])) (Leaf _) = |
2483 | rec_intr (Datatype.DtType ("fun", [_, _])) (Leaf _) = |
2479 raise REFUTE ("IDT_recursion_interpreter", |
2484 raise REFUTE ("IDT_recursion_interpreter", |
2516 NONE |
2521 NONE |
2517 end; |
2522 end; |
2518 |
2523 |
2519 fun set_interpreter ctxt model args t = |
2524 fun set_interpreter ctxt model args t = |
2520 let |
2525 let |
2521 val (typs, terms) = model |
2526 val (_, terms) = model |
2522 in |
2527 in |
2523 case AList.lookup (op =) terms t of |
2528 case AList.lookup (op =) terms t of |
2524 SOME intr => |
2529 SOME intr => |
2525 (* return an existing interpretation *) |
2530 (* return an existing interpretation *) |
2526 SOME (intr, model, args) |
2531 SOME (intr, model, args) |
2532 | Const (@{const_name Collect}, _) => |
2537 | Const (@{const_name Collect}, _) => |
2533 SOME (interpret ctxt model args (eta_expand t 1)) |
2538 SOME (interpret ctxt model args (eta_expand t 1)) |
2534 (* 'op :' == application *) |
2539 (* 'op :' == application *) |
2535 | Const (@{const_name Set.member}, _) $ t1 $ t2 => |
2540 | Const (@{const_name Set.member}, _) $ t1 $ t2 => |
2536 SOME (interpret ctxt model args (t2 $ t1)) |
2541 SOME (interpret ctxt model args (t2 $ t1)) |
2537 | Const (@{const_name Set.member}, _) $ t1 => |
2542 | Const (@{const_name Set.member}, _) $ _ => |
2538 SOME (interpret ctxt model args (eta_expand t 1)) |
2543 SOME (interpret ctxt model args (eta_expand t 1)) |
2539 | Const (@{const_name Set.member}, _) => |
2544 | Const (@{const_name Set.member}, _) => |
2540 SOME (interpret ctxt model args (eta_expand t 2)) |
2545 SOME (interpret ctxt model args (eta_expand t 2)) |
2541 | _ => NONE) |
2546 | _ => NONE) |
2542 end; |
2547 end; |
2590 (* below is more efficient *) |
2595 (* below is more efficient *) |
2591 |
2596 |
2592 fun Finite_Set_finite_interpreter ctxt model args t = |
2597 fun Finite_Set_finite_interpreter ctxt model args t = |
2593 case t of |
2598 case t of |
2594 Const (@{const_name Finite_Set.finite}, |
2599 Const (@{const_name Finite_Set.finite}, |
2595 Type ("fun", [Type ("fun", [T, @{typ bool}]), |
2600 Type ("fun", [Type ("fun", [_, @{typ bool}]), |
2596 @{typ bool}])) $ _ => |
2601 @{typ bool}])) $ _ => |
2597 (* we only consider finite models anyway, hence EVERY set is *) |
2602 (* we only consider finite models anyway, hence EVERY set is *) |
2598 (* "finite" *) |
2603 (* "finite" *) |
2599 SOME (TT, model, args) |
2604 SOME (TT, model, args) |
2600 | Const (@{const_name Finite_Set.finite}, |
2605 | Const (@{const_name Finite_Set.finite}, |