src/FOL/ex/Quantifiers_Int.thy
author wenzelm
Thu, 23 Jul 2015 14:25:05 +0200
changeset 60770 240563fbf41d
parent 58889 5b7a9633cfa8
child 61337 4645502c3c64
permissions -rw-r--r--
isabelle update_cartouches;
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
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     3
    Copyright   1991  University of Cambridge
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     4
*)
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     5
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
     6
section \<open>First-Order Logic: quantifier examples (intuitionistic version)\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     7
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     8
theory Quantifiers_Int
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
     9
imports IFOL
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    10
begin
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    11
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    12
lemma "(ALL x y. P(x,y))  -->  (ALL y x. P(x,y))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    13
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    14
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    15
lemma "(EX x y. P(x,y)) --> (EX y x. P(x,y))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    16
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    17
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    18
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    19
-- \<open>Converse is false\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    20
lemma "(ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    21
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    22
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    23
lemma "(ALL x. P-->Q(x))  <->  (P--> (ALL x. Q(x)))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    24
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    25
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
lemma "(ALL x. P(x)-->Q)  <->  ((EX x. P(x)) --> Q)"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    28
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    29
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    30
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    31
text \<open>Some harder ones\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    32
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    33
lemma "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    34
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    35
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    36
-- \<open>Converse is false\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    37
lemma "(EX x. P(x)&Q(x)) --> (EX x. P(x))  &  (EX x. Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    38
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    39
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    40
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    41
text \<open>Basic test of quantifier reasoning\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    42
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    43
-- \<open>TRUE\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    44
lemma "(EX y. ALL x. Q(x,y)) -->  (ALL x. EX y. Q(x,y))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    45
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    46
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    47
lemma "(ALL x. Q(x))  -->  (EX x. Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    48
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    49
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    50
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    51
text \<open>The following should fail, as they are false!\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    52
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    53
lemma "(ALL x. EX y. Q(x,y))  -->  (EX y. ALL x. Q(x,y))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    54
  apply (tactic "IntPr.fast_tac @{context} 1")?
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    55
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    56
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    57
lemma "(EX x. Q(x))  -->  (ALL x. Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    58
  apply (tactic "IntPr.fast_tac @{context} 1")?
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    59
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    60
36319
8feb2c4bef1a mark schematic statements explicitly;
wenzelm
parents: 31974
diff changeset
    61
schematic_lemma "P(?a) --> (ALL x. P(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    62
  apply (tactic "IntPr.fast_tac @{context} 1")?
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    63
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    64
36319
8feb2c4bef1a mark schematic statements explicitly;
wenzelm
parents: 31974
diff changeset
    65
schematic_lemma "(P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    66
  apply (tactic "IntPr.fast_tac @{context} 1")?
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    67
  oops
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    68
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    69
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    70
text \<open>Back to things that are provable \dots\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    71
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    72
lemma "(ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    73
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    74
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    75
-- \<open>An example of why exI should be delayed as long as possible\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    76
lemma "(P --> (EX x. Q(x))) & P --> (EX x. Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    77
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    78
36319
8feb2c4bef1a mark schematic statements explicitly;
wenzelm
parents: 31974
diff changeset
    79
schematic_lemma "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    80
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    81
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    82
lemma "(ALL x. Q(x))  -->  (EX x. Q(x))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    83
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    84
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    85
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    86
text \<open>Some slow ones\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    87
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
    88
-- \<open>Principia Mathematica *11.53\<close>
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    89
lemma "(ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    90
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    91
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    92
(*Principia Mathematica *11.55  *)
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    93
lemma "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    94
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    95
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    96
(*Principia Mathematica *11.61  *)
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    97
lemma "(EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 36319
diff changeset
    98
  by (tactic "IntPr.fast_tac @{context} 1")
23914
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
    99
3e0424305fa4 turned ex/prop.ML, ex/quant.ML into proper theories;
wenzelm
parents:
diff changeset
   100
end