src/Pure/Isar/context_rules.ML
changeset 53171 a5e54d4d9081
parent 51798 ad3a241def73
child 56204 f70e69208a8c
equal deleted inserted replaced
53170:96f7adb55d72 53171:a5e54d4d9081
   196 val dest        = rule_add elimK Tactic.make_elim;
   196 val dest        = rule_add elimK Tactic.make_elim;
   197 val intro_query = rule_add intro_queryK I;
   197 val intro_query = rule_add intro_queryK I;
   198 val elim_query  = rule_add elim_queryK I;
   198 val elim_query  = rule_add elim_queryK I;
   199 val dest_query  = rule_add elim_queryK Tactic.make_elim;
   199 val dest_query  = rule_add elim_queryK Tactic.make_elim;
   200 
   200 
   201 val _ = Context.>> (Context.map_theory
   201 val _ = Theory.setup
   202   (snd o Global_Theory.add_thms [((Binding.empty, Drule.equal_intr_rule), [intro_query NONE])]));
   202   (snd o Global_Theory.add_thms [((Binding.empty, Drule.equal_intr_rule), [intro_query NONE])]);
   203 
   203 
   204 
   204 
   205 (* concrete syntax *)
   205 (* concrete syntax *)
   206 
   206 
   207 fun add a b c x =
   207 fun add a b c x =
   208   (Scan.lift ((Args.bang >> K a || Args.query >> K c || Scan.succeed b) --
   208   (Scan.lift ((Args.bang >> K a || Args.query >> K c || Scan.succeed b) --
   209     Scan.option Parse.nat) >> (fn (f, n) => f n)) x;
   209     Scan.option Parse.nat) >> (fn (f, n) => f n)) x;
   210 
   210 
   211 val _ = Context.>> (Context.map_theory
   211 val _ = Theory.setup
   212  (Attrib.setup (Binding.name "intro") (add intro_bang intro intro_query)
   212  (Attrib.setup (Binding.name "intro") (add intro_bang intro intro_query)
   213     "declaration of introduction rule" #>
   213     "declaration of introduction rule" #>
   214   Attrib.setup (Binding.name "elim") (add elim_bang elim elim_query)
   214   Attrib.setup (Binding.name "elim") (add elim_bang elim elim_query)
   215     "declaration of elimination rule" #>
   215     "declaration of elimination rule" #>
   216   Attrib.setup (Binding.name "dest") (add dest_bang dest dest_query)
   216   Attrib.setup (Binding.name "dest") (add dest_bang dest dest_query)
   217     "declaration of destruction rule" #>
   217     "declaration of destruction rule" #>
   218   Attrib.setup (Binding.name "rule") (Scan.lift Args.del >> K rule_del)
   218   Attrib.setup (Binding.name "rule") (Scan.lift Args.del >> K rule_del)
   219     "remove declaration of intro/elim/dest rule"));
   219     "remove declaration of intro/elim/dest rule");
   220 
   220 
   221 end;
   221 end;