src/HOL/Isar_examples/BasicLogic.thy
changeset 7748 5b9c45b21782
parent 7740 2fbe5ce9845f
child 7761 7fab9592384f
equal deleted inserted replaced
7747:ca4e3b75345a 7748:5b9c45b21782
     3     Author:     Markus Wenzel, TU Muenchen
     3     Author:     Markus Wenzel, TU Muenchen
     4 
     4 
     5 Basic propositional and quantifier reasoning.
     5 Basic propositional and quantifier reasoning.
     6 *)
     6 *)
     7 
     7 
       
     8 header {* Basic reasoning *};
       
     9 
     8 theory BasicLogic = Main:;
    10 theory BasicLogic = Main:;
     9 
       
    10 
    11 
    11 subsection {* Some trivialities *};
    12 subsection {* Some trivialities *};
    12 
    13 
    13 text {* Just a few toy examples to get an idea of how Isabelle/Isar
    14 text {* Just a few toy examples to get an idea of how Isabelle/Isar
    14   proof documents may look like. *};
    15   proof documents may look like. *};
    16 lemma I: "A --> A";
    17 lemma I: "A --> A";
    17 proof;
    18 proof;
    18   assume A;
    19   assume A;
    19   show A; .;
    20   show A; .;
    20 qed;
    21 qed;
    21 
       
    22 
    22 
    23 lemma K: "A --> B --> A";
    23 lemma K: "A --> B --> A";
    24 proof;
    24 proof;
    25   assume A;
    25   assume A;
    26   show "B --> A";
    26   show "B --> A";
    42 qed;
    42 qed;
    43 
    43 
    44 lemma K''': "A --> B --> A";
    44 lemma K''': "A --> B --> A";
    45   by intro;
    45   by intro;
    46 
    46 
    47 
       
    48 lemma S: "(A --> B --> C) --> (A --> B) --> A --> C";
    47 lemma S: "(A --> B --> C) --> (A --> B) --> A --> C";
    49 proof;
    48 proof;
    50   assume "A --> B --> C";
    49   assume "A --> B --> C";
    51   show "(A --> B) --> A --> C";
    50   show "(A --> B) --> A --> C";
    52   proof;
    51   proof;
    60         show B; by (rule mp);
    59         show B; by (rule mp);
    61       qed;
    60       qed;
    62     qed;
    61     qed;
    63   qed;
    62   qed;
    64 qed;
    63 qed;
    65 
       
    66 
    64 
    67 text {* Variations of backward vs.\ forward reasoning \dots *};
    65 text {* Variations of backward vs.\ forward reasoning \dots *};
    68 
    66 
    69 lemma "A & B --> B & A";
    67 lemma "A & B --> B & A";
    70 proof;
    68 proof;
   176     from ab; show A; ..;
   174     from ab; show A; ..;
   177     from ab; show B; ..;
   175     from ab; show B; ..;
   178   qed;
   176   qed;
   179 qed;
   177 qed;
   180 
   178 
   181 
       
   182 end;
   179 end;