src/Tools/induct.ML
changeset 30528 7173bf123335
parent 30515 bca05b17b618
child 30560 0cc3b7f03ade
equal deleted inserted replaced
30527:fae488569faf 30528:7173bf123335
   251 
   251 
   252 fun spec k arg =
   252 fun spec k arg =
   253   Scan.lift (Args.$$$ k -- Args.colon) |-- arg ||
   253   Scan.lift (Args.$$$ k -- Args.colon) |-- arg ||
   254   Scan.lift (Args.$$$ k) >> K "";
   254   Scan.lift (Args.$$$ k) >> K "";
   255 
   255 
   256 fun attrib add_type add_pred del = Attrib.syntax
   256 fun attrib add_type add_pred del =
   257  (spec typeN Args.tyname >> add_type ||
   257   spec typeN Args.tyname >> add_type ||
   258   spec predN Args.const >> add_pred ||
   258   spec predN Args.const >> add_pred ||
   259   spec setN Args.const >> add_pred ||
   259   spec setN Args.const >> add_pred ||
   260   Scan.lift Args.del >> K del);
   260   Scan.lift Args.del >> K del;
   261 
   261 
   262 val cases_att = attrib cases_type cases_pred cases_del;
   262 val cases_att = attrib cases_type cases_pred cases_del;
   263 val induct_att = attrib induct_type induct_pred induct_del;
   263 val induct_att = attrib induct_type induct_pred induct_del;
   264 val coinduct_att = attrib coinduct_type coinduct_pred coinduct_del;
   264 val coinduct_att = attrib coinduct_type coinduct_pred coinduct_del;
   265 
   265 
   266 in
   266 in
   267 
   267 
   268 val attrib_setup = Attrib.add_attributes
   268 val attrib_setup =
   269  [(casesN, cases_att, "declaration of cases rule"),
   269   Attrib.setup @{binding cases} cases_att "declaration of cases rule" #>
   270   (inductN, induct_att, "declaration of induction rule"),
   270   Attrib.setup @{binding induct} induct_att "declaration of induction rule" #>
   271   (coinductN, coinduct_att, "declaration of coinduction rule")];
   271   Attrib.setup @{binding coinduct} coinduct_att "declaration of coinduction rule";
   272 
   272 
   273 end;
   273 end;
   274 
   274 
   275 
   275 
   276 
   276