src/FOLP/ex/If.thy
author wenzelm
Sat, 28 Jun 2008 22:52:03 +0200
changeset 27388 226835ea8d2b
parent 25991 31b38a39e589
child 35416 d8d7d1b785af
permissions -rw-r--r--
added ML/ml_thms.ML;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     1
(* $Id$ *)
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     2
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     3
theory If
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     4
imports FOLP
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     5
begin
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     6
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     7
constdefs
19796
d86e7b1fc472 quoted "if";
wenzelm
parents: 17480
diff changeset
     8
  "if" :: "[o,o,o]=>o"
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     9
  "if(P,Q,R) == P&Q | ~P&R"
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
    10
25991
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    11
lemma ifI:
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    12
  assumes "!!x. x : P ==> f(x) : Q"  "!!x. x : ~P ==> g(x) : R"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    13
  shows "?p : if(P,Q,R)"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    14
apply (unfold if_def)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    15
apply (tactic {* fast_tac (FOLP_cs addIs @{thms assms}) 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    16
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    17
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    18
lemma ifE:
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    19
  assumes 1: "p : if(P,Q,R)" and
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    20
    2: "!!x y. [| x : P; y : Q |] ==> f(x, y) : S" and
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    21
    3: "!!x y. [| x : ~P; y : R |] ==> g(x, y) : S"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    22
  shows "?p : S"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    23
apply (insert 1)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    24
apply (unfold if_def)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    25
apply (tactic {* fast_tac (FOLP_cs addIs [@{thm 2}, @{thm 3}]) 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    26
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    27
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    28
lemma if_commute: "?p : if(P, if(Q,A,B), if(Q,C,D)) <-> if(Q, if(P,A,C), if(P,B,D))"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    29
apply (rule iffI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    30
apply (erule ifE)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    31
apply (erule ifE)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    32
apply (rule ifI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    33
apply (rule ifI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    34
oops
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    35
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    36
ML {* val if_cs = FOLP_cs addSIs [@{thm ifI}] addSEs [@{thm ifE}] *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    37
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    38
lemma if_commute: "?p : if(P, if(Q,A,B), if(Q,C,D)) <-> if(Q, if(P,A,C), if(P,B,D))"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    39
apply (tactic {* fast_tac if_cs 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    40
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    41
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    42
lemma nested_ifs: "?p : if(if(P,Q,R), A, B) <-> if(P, if(Q,A,B), if(R,A,B))"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    43
apply (tactic {* fast_tac if_cs 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    44
done
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
    45
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
end