src/FOLP/ex/If.thy
author haftmann
Mon, 01 Mar 2010 13:40:23 +0100
changeset 35416 d8d7d1b785af
parent 25991 31b38a39e589
child 35762 af3ff2ba4c54
permissions -rw-r--r--
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
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
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 25991
diff changeset
     7
definition "if" :: "[o,o,o]=>o" where
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     8
  "if(P,Q,R) == P&Q | ~P&R"
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
     9
25991
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    10
lemma ifI:
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    11
  assumes "!!x. x : P ==> f(x) : Q"  "!!x. x : ~P ==> g(x) : R"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    12
  shows "?p : if(P,Q,R)"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    13
apply (unfold if_def)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    14
apply (tactic {* fast_tac (FOLP_cs addIs @{thms assms}) 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    15
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    16
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    17
lemma ifE:
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    18
  assumes 1: "p : if(P,Q,R)" and
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    19
    2: "!!x y. [| x : P; y : Q |] ==> f(x, y) : S" and
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    20
    3: "!!x y. [| x : ~P; y : R |] ==> g(x, y) : S"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    21
  shows "?p : S"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    22
apply (insert 1)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    23
apply (unfold if_def)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    24
apply (tactic {* fast_tac (FOLP_cs addIs [@{thm 2}, @{thm 3}]) 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    25
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    26
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    27
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
    28
apply (rule iffI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    29
apply (erule ifE)
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 (rule ifI)
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
oops
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    34
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    35
ML {* val if_cs = FOLP_cs addSIs [@{thm ifI}] addSEs [@{thm ifE}] *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    36
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    37
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
    38
apply (tactic {* fast_tac if_cs 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    39
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    40
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    41
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
    42
apply (tactic {* fast_tac if_cs 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents: 19796
diff changeset
    43
done
17480
fd19f77dcf60 converted to Isar theory format;
wenzelm
parents: 0
diff changeset
    44
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
end