src/ZF/Induct/PropLog.thy
author paulson
Wed, 07 Nov 2001 12:29:07 +0100
changeset 12088 6f463d16cbd0
child 12560 5820841f21fd
permissions -rw-r--r--
reorganization of the ZF examples
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12088
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     1
(*  Title:      ZF/ex/PropLog.thy
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     2
    ID:         $Id$
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     3
    Author:     Tobias Nipkow & Lawrence C Paulson
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     5
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     6
Datatype definition of propositional logic formulae and inductive definition
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     7
of the propositional tautologies.
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     8
*)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
     9
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    10
PropLog = Main +
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    11
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    12
(** The datatype of propositions; note mixfix syntax **)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    13
consts
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    14
  prop     :: i
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    15
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    16
datatype
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    17
  "prop" = Fls
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    18
         | Var ("n \\<in> nat")                       ("#_" [100] 100)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    19
         | "=>" ("p \\<in> prop", "q \\<in> prop")          (infixr 90)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    20
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    21
(** The proof system **)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    22
consts
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    23
  thms     :: i => i
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    24
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    25
syntax
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    26
  "|-"     :: [i,i] => o                        (infixl 50)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    27
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    28
translations
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    29
  "H |- p" == "p \\<in> thms(H)"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    30
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    31
inductive
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    32
  domains "thms(H)" <= "prop"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    33
  intrs
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    34
    H  "[| p \\<in> H;  p \\<in> prop |] ==> H |- p"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    35
    K  "[| p \\<in> prop;  q \\<in> prop |] ==> H |- p=>q=>p"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    36
    S  "[| p \\<in> prop;  q \\<in> prop;  r \\<in> prop |] ==> H |- (p=>q=>r) => (p=>q) => p=>r"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    37
    DN "p \\<in> prop ==> H |- ((p=>Fls) => Fls) => p"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    38
    MP "[| H |- p=>q;  H |- p;  p \\<in> prop;  q \\<in> prop |] ==> H |- q"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    39
  type_intrs "prop.intrs"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    40
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    41
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    42
(** The semantics **)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    43
consts
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    44
  "|="        :: [i,i] => o                        (infixl 50)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    45
  hyps        :: [i,i] => i
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    46
  is_true_fun :: [i,i] => i
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    47
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    48
constdefs (*this definitionis necessary since predicates can't be recursive*)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    49
  is_true     :: [i,i] => o
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    50
    "is_true(p,t) == is_true_fun(p,t)=1"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    51
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    52
defs
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    53
  (*Logical consequence: for every valuation, if all elements of H are true
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    54
     then so is p*)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    55
  logcon_def  "H |= p == \\<forall>t. (\\<forall>q \\<in> H. is_true(q,t)) --> is_true(p,t)"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    56
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    57
primrec (** A finite set of hypotheses from t and the Vars in p **)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    58
  "hyps(Fls, t)    = 0"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    59
  "hyps(Var(v), t) = (if v \\<in> t then {#v} else {#v=>Fls})"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    60
  "hyps(p=>q, t)   = hyps(p,t) Un hyps(q,t)"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    61
 
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    62
primrec (** Semantics of propositional logic **)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    63
  "is_true_fun(Fls, t)    = 0"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    64
  "is_true_fun(Var(v), t) = (if v \\<in> t then 1 else 0)"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    65
  "is_true_fun(p=>q, t)   = (if is_true_fun(p,t)=1 then is_true_fun(q,t)
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    66
			     else 1)"
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    67
6f463d16cbd0 reorganization of the ZF examples
paulson
parents:
diff changeset
    68
end