src/FOL/ex/Quantifiers_Int.thy
author wenzelm
Sun, 11 Jan 2009 21:49:59 +0100
changeset 29450 ac7f67be7f1f
parent 23914 3e0424305fa4
child 31974 e81979a703a4
permissions -rw-r--r--
tuned categories;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     1
(*  Title:      FOL/ex/Quantifiers_Int.thy
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     5
*)
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     6
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     7
header {* First-Order Logic: quantifier examples (intuitionistic version) *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     8
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     9
theory Quantifiers_Int
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    10
imports IFOL
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    11
begin
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    12
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    13
lemma "(ALL x y. P(x,y))  -->  (ALL y x. P(x,y))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    14
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    15
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    16
lemma "(EX x y. P(x,y)) --> (EX y x. P(x,y))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    17
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    18
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    19
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    20
-- {* Converse is false *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    21
lemma "(ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    22
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    23
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    24
lemma "(ALL x. P-->Q(x))  <->  (P--> (ALL x. Q(x)))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    25
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    26
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    27
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    28
lemma "(ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    29
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    30
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    31
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    32
text {* Some harder ones *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    33
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    34
lemma "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    35
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    36
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    37
-- {* Converse is false *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    38
lemma "(EX x. P(x)&Q(x)) --> (EX x. P(x))  &  (EX x. Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    39
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    40
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    41
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    42
text {* Basic test of quantifier reasoning *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    43
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    44
-- {* TRUE *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    45
lemma "(EX y. ALL x. Q(x,y)) -->  (ALL x. EX y. Q(x,y))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    46
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    47
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    48
lemma "(ALL x. Q(x))  -->  (EX x. Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    49
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    50
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    51
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    52
text {* The following should fail, as they are false! *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    53
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    54
lemma "(ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    55
  apply (tactic "IntPr.fast_tac 1")?
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    56
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    57
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    58
lemma "(EX x. Q(x))  -->  (ALL x. Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    59
  apply (tactic "IntPr.fast_tac 1")?
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    60
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    61
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    62
lemma "P(?a) --> (ALL x. P(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    63
  apply (tactic "IntPr.fast_tac 1")?
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    64
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    65
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    66
lemma "(P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    67
  apply (tactic "IntPr.fast_tac 1")?
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    68
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    69
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    70
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    71
text {* Back to things that are provable \dots *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    72
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    73
lemma "(ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    74
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    75
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    76
-- {* An example of why exI should be delayed as long as possible *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    77
lemma "(P --> (EX x. Q(x))) & P --> (EX x. Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    78
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    79
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    80
lemma "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    81
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    82
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    83
lemma "(ALL x. Q(x))  -->  (EX x. Q(x))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    84
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    85
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    86
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    87
text {* Some slow ones *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    88
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    89
-- {* Principia Mathematica *11.53 *}
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    90
lemma "(ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    91
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    92
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    93
(*Principia Mathematica *11.55  *)
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    94
lemma "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    95
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    96
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    97
(*Principia Mathematica *11.61  *)
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    98
lemma "(EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))"
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    99
  by (tactic "IntPr.fast_tac 1")
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
   100
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
   101
end