src/Pure/Proof/proof_rewrite_rules.ML
changeset 11522 42fbb6abed5a
child 11539 0f17da240450
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/Pure/Proof/proof_rewrite_rules.ML	Fri Aug 31 16:17:05 2001 +0200
     1.3 @@ -0,0 +1,103 @@
     1.4 +(*  Title:      Pure/Proof/proof_rewrite_rules.ML
     1.5 +    ID:         $Id$
     1.6 +    Author:     Stefan Berghofer
     1.7 +    Copyright   2000  TU Muenchen
     1.8 +
     1.9 +Simplification function for partial proof terms involving
    1.10 +meta level rules.
    1.11 +*)
    1.12 +
    1.13 +signature PROOF_REWRITE_RULES =
    1.14 +sig
    1.15 +  val rprocs : (string * (typ list -> Proofterm.proof -> Proofterm.proof option)) list
    1.16 +end;
    1.17 +
    1.18 +structure ProofRewriteRules : PROOF_REWRITE_RULES =
    1.19 +struct
    1.20 +
    1.21 +open Proofterm;
    1.22 +
    1.23 +fun rew _ (PThm (("ProtoPure.rev_triv_goal", _), _, _, _) %% _ %
    1.24 +      (PThm (("ProtoPure.triv_goal", _), _, _, _) %% _ % prf)) = Some prf
    1.25 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% _ %% _ %
    1.26 +      (PAxm ("ProtoPure.equal_intr", _, _) %% _ %% _ % prf % _)) = Some prf
    1.27 +  | rew _ (PAxm ("ProtoPure.symmetric", _, _) %% _ %% _ %
    1.28 +      (PAxm ("ProtoPure.equal_intr", _, _) %% A %% B % prf1 % prf2)) =
    1.29 +          Some (equal_intr_axm %% B %% A % prf2 % prf1)
    1.30 +
    1.31 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% Some X %% Some Y %
    1.32 +      (PAxm ("ProtoPure.combination", _, _) %% _ %% _ %% _ %% _ %
    1.33 +        (PAxm ("ProtoPure.combination", _, _) %% Some (Const ("==>", _)) %% _ %% _ %% _ %
    1.34 +           (PAxm ("ProtoPure.reflexive", _, _) %% _) % prf1) % prf2)) =
    1.35 +      let
    1.36 +        val _ $ A $ C = Envir.beta_norm X;
    1.37 +        val _ $ B $ D = Envir.beta_norm Y
    1.38 +      in Some (AbsP ("H1", None, AbsP ("H2", None,
    1.39 +        equal_elim_axm %%% C %%% D % incr_pboundvars 2 0 prf2 %
    1.40 +          (PBound 1 % (equal_elim_axm %%% B %%% A %
    1.41 +            (symmetric_axm %% None %% None % incr_pboundvars 2 0 prf1) % PBound 0)))))
    1.42 +      end
    1.43 +
    1.44 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% Some X %% Some Y %
    1.45 +      (PAxm ("ProtoPure.symmetric", _, _) %% _ %% _ %
    1.46 +        (PAxm ("ProtoPure.combination", _, _) %% _ %% _ %% _ %% _ %
    1.47 +          (PAxm ("ProtoPure.combination", _, _) %% Some (Const ("==>", _)) %% _ %% _ %% _ %
    1.48 +             (PAxm ("ProtoPure.reflexive", _, _) %% _) % prf1) % prf2))) =
    1.49 +      let
    1.50 +        val _ $ A $ C = Envir.beta_norm Y;
    1.51 +        val _ $ B $ D = Envir.beta_norm X
    1.52 +      in Some (AbsP ("H1", None, AbsP ("H2", None,
    1.53 +        equal_elim_axm %%% D %%% C %
    1.54 +          (symmetric_axm %% None %% None % incr_pboundvars 2 0 prf2)
    1.55 +            % (PBound 1 % (equal_elim_axm %%% A %%% B % incr_pboundvars 2 0 prf1 % PBound 0)))))
    1.56 +      end
    1.57 +
    1.58 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% Some X %% Some Y %
    1.59 +      (PAxm ("ProtoPure.combination", _, _) %% Some (Const ("all", _)) %% _ %% _ %% _ %
    1.60 +        (PAxm ("ProtoPure.reflexive", _, _) %% _) %
    1.61 +          (PAxm ("ProtoPure.abstract_rule", _, _) %% _ %% _ % prf))) =
    1.62 +      let
    1.63 +        val _ $ P = Envir.beta_norm X;
    1.64 +        val _ $ Q = Envir.beta_norm Y;
    1.65 +      in Some (AbsP ("H", None, Abst ("x", None,
    1.66 +          equal_elim_axm %%% incr_boundvars 1 P $ Bound 0 %%% incr_boundvars 1 Q $ Bound 0 %
    1.67 +            (incr_pboundvars 1 1 prf %%% Bound 0) % (PBound 0 %%% Bound 0))))
    1.68 +      end
    1.69 +
    1.70 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% Some X %% Some Y %
    1.71 +      (PAxm ("ProtoPure.symmetric", _, _) %% _ %% _ %        
    1.72 +        (PAxm ("ProtoPure.combination", _, _) %% Some (Const ("all", _)) %% _ %% _ %% _ %
    1.73 +          (PAxm ("ProtoPure.reflexive", _, _) %% _) %
    1.74 +            (PAxm ("ProtoPure.abstract_rule", _, _) %% _ %% _ % prf)))) =
    1.75 +      let
    1.76 +        val _ $ P = Envir.beta_norm X;
    1.77 +        val _ $ Q = Envir.beta_norm Y;
    1.78 +      in Some (AbsP ("H", None, Abst ("x", None,
    1.79 +        equal_elim_axm %%% incr_boundvars 1 P $ Bound 0 %%% incr_boundvars 1 Q $ Bound 0 %
    1.80 +          (symmetric_axm %% None %% None % (incr_pboundvars 1 1 prf %%% Bound 0))
    1.81 +            % (PBound 0 %%% Bound 0))))
    1.82 +      end
    1.83 +
    1.84 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% Some A %% Some C %
    1.85 +      (PAxm ("ProtoPure.transitive", _, _) %% _ %% Some B %% _ % prf1 % prf2) % prf3) =
    1.86 +         Some (equal_elim_axm %%% B %%% C % prf2 %
    1.87 +           (equal_elim_axm %%% A %%% B % prf1 % prf3))
    1.88 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% Some A %% Some C %
    1.89 +      (PAxm ("ProtoPure.symmetric", _, _) %% _ %% _ %
    1.90 +        (PAxm ("ProtoPure.transitive", _, _) %% _ %% Some B %% _ % prf1 % prf2)) % prf3) =
    1.91 +         Some (equal_elim_axm %%% B %%% C % (symmetric_axm %% None %% None % prf1) %
    1.92 +           (equal_elim_axm %%% A %%% B % (symmetric_axm %% None %% None % prf2) % prf3))
    1.93 +
    1.94 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% _ %% _ %
    1.95 +      (PAxm ("ProtoPure.reflexive", _, _) %% _) % prf) = Some prf
    1.96 +  | rew _ (PAxm ("ProtoPure.equal_elim", _, _) %% _ %% _ %
    1.97 +      (PAxm ("ProtoPure.symmetric", _, _) %% _ %% _ %
    1.98 +        (PAxm ("ProtoPure.reflexive", _, _) %% _)) % prf) = Some prf
    1.99 +
   1.100 +  | rew _ _ = None;
   1.101 +
   1.102 +val rprocs = [("Pure/meta_equality", rew)];
   1.103 +
   1.104 +end;
   1.105 +
   1.106 +Proofterm.add_prf_rprocs ProtoPure.thy ProofRewriteRules.rprocs;