equal
deleted
inserted
replaced
76 structure DatatypeTactics : DATATYPE_TACTICS = |
76 structure DatatypeTactics : DATATYPE_TACTICS = |
77 struct |
77 struct |
78 |
78 |
79 fun datatype_info_sg sign name = |
79 fun datatype_info_sg sign name = |
80 (case Symtab.lookup (DatatypesData.get_sg sign, name) of |
80 (case Symtab.lookup (DatatypesData.get_sg sign, name) of |
81 Some info => info |
81 SOME info => info |
82 | None => error ("Unknown datatype " ^ quote name)); |
82 | NONE => error ("Unknown datatype " ^ quote name)); |
83 |
83 |
84 |
84 |
85 (*Given a variable, find the inductive set associated it in the assumptions*) |
85 (*Given a variable, find the inductive set associated it in the assumptions*) |
86 exception Find_tname of string |
86 exception Find_tname of string |
87 |
87 |
90 (v, #1 (dest_Const (head_of A))) |
90 (v, #1 (dest_Const (head_of A))) |
91 | mk_pair _ = raise Match |
91 | mk_pair _ = raise Match |
92 val pairs = mapfilter (try (mk_pair o FOLogic.dest_Trueprop)) |
92 val pairs = mapfilter (try (mk_pair o FOLogic.dest_Trueprop)) |
93 (#2 (strip_context Bi)) |
93 (#2 (strip_context Bi)) |
94 in case assoc (pairs, var) of |
94 in case assoc (pairs, var) of |
95 None => raise Find_tname ("Cannot determine datatype of " ^ quote var) |
95 NONE => raise Find_tname ("Cannot determine datatype of " ^ quote var) |
96 | Some t => t |
96 | SOME t => t |
97 end; |
97 end; |
98 |
98 |
99 (** generic exhaustion and induction tactic for datatypes |
99 (** generic exhaustion and induction tactic for datatypes |
100 Differences from HOL: |
100 Differences from HOL: |
101 (1) no checking if the induction var occurs in premises, since it always |
101 (1) no checking if the induction var occurs in premises, since it always |