src/Tools/induct.ML
changeset 36602 0cbcdfd9e527
parent 35625 9c818cab0dd0
child 36960 01594f816e3a
equal deleted inserted replaced
36601:8a041e2d8122 36602:0cbcdfd9e527
    44   val induct_del: attribute
    44   val induct_del: attribute
    45   val coinduct_type: string -> attribute
    45   val coinduct_type: string -> attribute
    46   val coinduct_pred: string -> attribute
    46   val coinduct_pred: string -> attribute
    47   val coinduct_del: attribute
    47   val coinduct_del: attribute
    48   val map_simpset: (simpset -> simpset) -> Context.generic -> Context.generic
    48   val map_simpset: (simpset -> simpset) -> Context.generic -> Context.generic
    49   val add_simp_rule: attribute
    49   val induct_simp_add: attribute
       
    50   val induct_simp_del: attribute
    50   val no_simpN: string
    51   val no_simpN: string
    51   val casesN: string
    52   val casesN: string
    52   val inductN: string
    53   val inductN: string
    53   val coinductN: string
    54   val coinductN: string
    54   val typeN: string
    55   val typeN: string
   318 val coinduct_type = mk_att add_coinductT consumes0;
   319 val coinduct_type = mk_att add_coinductT consumes0;
   319 val coinduct_pred = mk_att add_coinductP consumes1;
   320 val coinduct_pred = mk_att add_coinductP consumes1;
   320 val coinduct_del = del_att map3;
   321 val coinduct_del = del_att map3;
   321 
   322 
   322 fun map_simpset f = InductData.map (map4 f);
   323 fun map_simpset f = InductData.map (map4 f);
   323 fun add_simp_rule (ctxt, thm) =
   324 
   324   (map_simpset (fn ss => ss addsimps [thm]) ctxt, thm);
   325 fun induct_simp f =
       
   326   Thm.declaration_attribute (fn thm => fn context =>
       
   327       (map_simpset
       
   328         (Simplifier.with_context (Context.proof_of context) (fn ss => f (ss, [thm]))) context));
       
   329 
       
   330 val induct_simp_add = induct_simp (op addsimps);
       
   331 val induct_simp_del = induct_simp (op delsimps);
   325 
   332 
   326 end;
   333 end;
   327 
   334 
   328 
   335 
   329 
   336 
   357     "declaration of cases rule" #>
   364     "declaration of cases rule" #>
   358   Attrib.setup @{binding induct} (attrib induct_type induct_pred induct_del)
   365   Attrib.setup @{binding induct} (attrib induct_type induct_pred induct_del)
   359     "declaration of induction rule" #>
   366     "declaration of induction rule" #>
   360   Attrib.setup @{binding coinduct} (attrib coinduct_type coinduct_pred coinduct_del)
   367   Attrib.setup @{binding coinduct} (attrib coinduct_type coinduct_pred coinduct_del)
   361     "declaration of coinduction rule" #>
   368     "declaration of coinduction rule" #>
   362   Attrib.setup @{binding induct_simp} (Scan.succeed add_simp_rule)
   369   Attrib.setup @{binding induct_simp} (Attrib.add_del induct_simp_add induct_simp_del)
   363     "declaration of rules for simplifying induction or cases rules";
   370     "declaration of rules for simplifying induction or cases rules";
   364 
   371 
   365 end;
   372 end;
   366 
   373 
   367 
   374