equal
deleted
inserted
replaced
152 val ind_params = Inductive.params_of raw_induct; |
152 val ind_params = Inductive.params_of raw_induct; |
153 val raw_induct = atomize_induct ctxt raw_induct; |
153 val raw_induct = atomize_induct ctxt raw_induct; |
154 val elims = map (atomize_induct ctxt) elims; |
154 val elims = map (atomize_induct ctxt) elims; |
155 val monos = Inductive.get_monos ctxt; |
155 val monos = Inductive.get_monos ctxt; |
156 val eqvt_thms = NominalThmDecls.get_eqvt_thms ctxt; |
156 val eqvt_thms = NominalThmDecls.get_eqvt_thms ctxt; |
157 val _ = (case names \\ fold (Term.add_const_names o Thm.prop_of) eqvt_thms [] of |
157 val _ = (case subtract (op =) (fold (Term.add_const_names o Thm.prop_of) eqvt_thms []) names of |
158 [] => () |
158 [] => () |
159 | xs => error ("Missing equivariance theorem for predicate(s): " ^ |
159 | xs => error ("Missing equivariance theorem for predicate(s): " ^ |
160 commas_quote xs)); |
160 commas_quote xs)); |
161 val induct_cases = map fst (fst (RuleCases.get (the |
161 val induct_cases = map fst (fst (RuleCases.get (the |
162 (Induct.lookup_inductP ctxt (hd names))))); |
162 (Induct.lookup_inductP ctxt (hd names))))); |
168 val _ = (case duplicates (op = o pairself fst) avoids of |
168 val _ = (case duplicates (op = o pairself fst) avoids of |
169 [] => () |
169 [] => () |
170 | xs => error ("Duplicate case names: " ^ commas_quote (map fst xs))); |
170 | xs => error ("Duplicate case names: " ^ commas_quote (map fst xs))); |
171 val _ = assert_all (null o duplicates op = o snd) avoids |
171 val _ = assert_all (null o duplicates op = o snd) avoids |
172 (fn (a, _) => error ("Duplicate variable names for case " ^ quote a)); |
172 (fn (a, _) => error ("Duplicate variable names for case " ^ quote a)); |
173 val _ = (case map fst avoids \\ induct_cases of |
173 val _ = (case subtract (op =) induct_cases (map fst avoids) of |
174 [] => () |
174 [] => () |
175 | xs => error ("No such case(s) in inductive definition: " ^ commas_quote xs)); |
175 | xs => error ("No such case(s) in inductive definition: " ^ commas_quote xs)); |
176 val avoids' = if null induct_cases then replicate (length intrs) ("", []) |
176 val avoids' = if null induct_cases then replicate (length intrs) ("", []) |
177 else map (fn name => |
177 else map (fn name => |
178 (name, the_default [] (AList.lookup op = avoids name))) induct_cases; |
178 (name, the_default [] (AList.lookup op = avoids name))) induct_cases; |
604 let val atoms = map (Sign.intern_type thy) xatoms |
604 let val atoms = map (Sign.intern_type thy) xatoms |
605 in |
605 in |
606 (case duplicates op = atoms of |
606 (case duplicates op = atoms of |
607 [] => () |
607 [] => () |
608 | xs => error ("Duplicate atoms: " ^ commas xs); |
608 | xs => error ("Duplicate atoms: " ^ commas xs); |
609 case atoms \\ atoms' of |
609 case subtract (op =) atoms' atoms of |
610 [] => () |
610 [] => () |
611 | xs => error ("No such atoms: " ^ commas xs); |
611 | xs => error ("No such atoms: " ^ commas xs); |
612 atoms) |
612 atoms) |
613 end; |
613 end; |
614 val perm_pi_simp = PureThy.get_thms thy "perm_pi_simp"; |
614 val perm_pi_simp = PureThy.get_thms thy "perm_pi_simp"; |