164 val (classess, (superclasses, inst_params)) = |
164 val (classess, (superclasses, inst_params)) = |
165 obtain_instance thy arities inst; |
165 obtain_instance thy arities inst; |
166 in |
166 in |
167 vardeps_data |
167 vardeps_data |
168 |> (apsnd o apsnd) (insert (op =) inst) |
168 |> (apsnd o apsnd) (insert (op =) inst) |
169 |> fold_index (fn (k, classes) => |
169 |> fold_index (fn (k, _) => |
170 apfst (Vargraph.new_node ((Inst (class, tyco), k), ([] ,[]))) |
170 apfst (Vargraph.new_node ((Inst (class, tyco), k), ([] ,[])))) classess |
171 ) classess |
|
172 |> fold (fn superclass => assert_inst thy arities eqngr (superclass, tyco)) superclasses |
171 |> fold (fn superclass => assert_inst thy arities eqngr (superclass, tyco)) superclasses |
173 |> fold (assert_fun thy arities eqngr) inst_params |
172 |> fold (assert_fun thy arities eqngr) inst_params |
174 |> fold_index (fn (k, classes) => |
173 |> fold_index (fn (k, classes) => |
175 add_classes thy arities eqngr (Inst (class, tyco), k) classes |
174 add_classes thy arities eqngr (Inst (class, tyco), k) classes |
176 #> fold (fn superclass => |
175 #> fold (fn superclass => |
201 val ((lhs, rhss), eqns) = obtain_eqns thy eqngr c; |
200 val ((lhs, rhss), eqns) = obtain_eqns thy eqngr c; |
202 val rhss' = (map o apsnd o map) (styp_of (SOME (c, lhs))) rhss; |
201 val rhss' = (map o apsnd o map) (styp_of (SOME (c, lhs))) rhss; |
203 in |
202 in |
204 vardeps_data |
203 vardeps_data |
205 |> (apsnd o apfst) (Symtab.update_new (c, (lhs, eqns))) |
204 |> (apsnd o apfst) (Symtab.update_new (c, (lhs, eqns))) |
|
205 |> fold_index (fn (k, _) => |
|
206 apfst (Vargraph.new_node ((Fun c, k), ([] ,[])))) lhs |
206 |> fold_index (fn (k, (_, sort)) => |
207 |> fold_index (fn (k, (_, sort)) => |
207 apfst (Vargraph.new_node ((Fun c, k), ([] ,[]))) |
208 add_classes thy arities eqngr (Fun c, k) (complete_proper_sort thy sort)) lhs |
208 #> add_classes thy arities eqngr (Fun c, k) (complete_proper_sort thy sort)) lhs |
|
209 |> fold (assert_rhs thy arities eqngr) rhss' |
209 |> fold (assert_rhs thy arities eqngr) rhss' |
210 end; |
210 end; |
211 |
211 |
212 |
212 |
213 (* applying instantiations *) |
213 (* applying instantiations *) |