# HG changeset patch # User haftmann # Date 1467654380 -7200 # Node ID 4c0cc2b356f0b1c04d8fe18c57d97c7819ad5848 # Parent 59803048b0e8adf425e1cc89302ad93c7831f157 default one-step rules for predicates on relations; clarified status of legacy input abbreviations diff -r 59803048b0e8 -r 4c0cc2b356f0 src/HOL/Relation.thy --- a/src/HOL/Relation.thy Mon Jul 04 19:46:20 2016 +0200 +++ b/src/HOL/Relation.thy Mon Jul 04 19:46:20 2016 +0200 @@ -51,6 +51,7 @@ declare Sup2_E [elim!] declare SUP2_E [elim!] + subsection \Fundamental\ subsubsection \Relations as sets of pairs\ @@ -141,6 +142,7 @@ lemma SUP_Sup_eq2 [pred_set_conv]: "(\i\S. (\x y. (x, y) \ i)) = (\x y. (x, y) \ \S)" by (simp add: fun_eq_iff) + subsection \Properties of relations\ subsubsection \Reflexivity\ @@ -161,7 +163,7 @@ "reflp (\x y. (x, y) \ r) \ refl r" by (simp add: refl_on_def reflp_def) -lemma refl_onI: "r \ A \ A ==> (!!x. x : A ==> (x, x) : r) ==> refl_on A r" +lemma refl_onI [intro?]: "r \ A \ A ==> (!!x. x : A ==> (x, x) : r) ==> refl_on A r" by (unfold refl_on_def) (iprover intro!: ballI) lemma refl_onD: "refl_on A r ==> a : A ==> (a, a) : r" @@ -173,7 +175,7 @@ lemma refl_onD2: "refl_on A r ==> (x, y) : r ==> y : A" by (unfold refl_on_def) blast -lemma reflpI: +lemma reflpI [intro?]: "(\x. r x x) \ reflp r" by (auto intro: refl_onI simp add: reflp_def) @@ -182,7 +184,7 @@ obtains "r x x" using assms by (auto dest: refl_onD simp add: reflp_def) -lemma reflpD: +lemma reflpD [dest?]: assumes "reflp r" shows "r x x" using assms by (auto elim: reflpE) @@ -222,6 +224,7 @@ lemma reflp_mono: "\ reflp R; \x y. R x y \ Q x y \ \ reflp Q" by(auto intro: reflpI dest: reflpD) + subsubsection \Irreflexivity\ definition irrefl :: "'a rel \ bool" @@ -236,11 +239,11 @@ "irreflp (\a b. (a, b) \ R) \ irrefl R" by (simp add: irrefl_def irreflp_def) -lemma irreflI: +lemma irreflI [intro?]: "(\a. (a, a) \ R) \ irrefl R" by (simp add: irrefl_def) -lemma irreflpI: +lemma irreflpI [intro?]: "(\a. \ R a a) \ irreflp R" by (fact irreflI [to_pred]) @@ -278,11 +281,11 @@ "symp (\x y. (x, y) \ r) \ sym r" by (simp add: sym_def symp_def) -lemma symI: +lemma symI [intro?]: "(\a b. (a, b) \ r \ (b, a) \ r) \ sym r" by (unfold sym_def) iprover -lemma sympI: +lemma sympI [intro?]: "(\a b. r a b \ r b a) \ symp r" by (fact symI [to_pred]) @@ -296,12 +299,12 @@ obtains "r a b" using assms by (rule symE [to_pred]) -lemma symD: +lemma symD [dest?]: assumes "sym r" and "(b, a) \ r" shows "(a, b) \ r" using assms by (rule symE) -lemma sympD: +lemma sympD [dest?]: assumes "symp r" and "r b a" shows "r a b" using assms by (rule symD [to_pred]) @@ -346,14 +349,14 @@ "antisym r \ (\x y. (x, y) \ r \ (y, x) \ r \ x = y)" abbreviation antisymP :: "('a \ 'a \ bool) \ bool" -where +where -- \FIXME proper logical operation\ "antisymP r \ antisym {(x, y). r x y}" -lemma antisymI: +lemma antisymI [intro?]: "(!!x y. (x, y) : r ==> (y, x) : r ==> x=y) ==> antisym r" by (unfold antisym_def) iprover -lemma antisymD: "antisym r ==> (a, b) : r ==> (b, a) : r ==> a = b" +lemma antisymD [dest?]: "antisym r ==> (a, b) : r ==> (b, a) : r ==> a = b" by (unfold antisym_def) iprover lemma antisym_subset: "r \ s ==> antisym s ==> antisym r" @@ -365,6 +368,7 @@ lemma antisymP_equality [simp]: "antisymP op =" by(auto intro: antisymI) + subsubsection \Transitivity\ definition trans :: "'a rel \ bool" @@ -379,15 +383,11 @@ "transp (\x y. (x, y) \ r) \ trans r" by (simp add: trans_def transp_def) -abbreviation transP :: "('a \ 'a \ bool) \ bool" -where \ \FIXME drop\ - "transP r \ trans {(x, y). r x y}" - -lemma transI: +lemma transI [intro?]: "(\x y z. (x, y) \ r \ (y, z) \ r \ (x, z) \ r) \ trans r" by (unfold trans_def) iprover -lemma transpI: +lemma transpI [intro?]: "(\x y z. r x y \ r y z \ r x z) \ transp r" by (fact transI [to_pred]) @@ -401,12 +401,12 @@ obtains "r x z" using assms by (rule transE [to_pred]) -lemma transD: +lemma transD [dest?]: assumes "trans r" and "(x, y) \ r" and "(y, z) \ r" shows "(x, z) \ r" using assms by (rule transE) -lemma transpD: +lemma transpD [dest?]: assumes "transp r" and "r x y" and "r y z" shows "r x z" using assms by (rule transD [to_pred]) @@ -436,6 +436,7 @@ lemma transp_equality [simp]: "transp op =" by(auto intro: transpI) + subsubsection \Totality\ definition total_on :: "'a set \ 'a rel \ bool" @@ -454,7 +455,8 @@ where "single_valued r \ (\x y. (x, y) \ r \ (\z. (x, z) \ r \ y = z))" -abbreviation single_valuedP :: "('a \ 'b \ bool) \ bool" where +abbreviation single_valuedP :: "('a \ 'b \ bool) \ bool" +where -- \FIXME proper logical operation\ "single_valuedP r \ single_valued {(x, y). r x y}" lemma single_valuedI: @@ -518,6 +520,7 @@ lemma Id_fstsnd_eq: "Id = {x. fst x = snd x}" by force + subsubsection \Diagonal: identity over a set\ definition Id_on :: "'a set \ 'a rel" @@ -684,6 +687,7 @@ lemma OO_eq: "R OO op = = R" by blast + subsubsection \Converse\ inductive_set converse :: "('a \ 'b) set \ ('b \ 'a) set" ("(_\)" [1000] 999) @@ -838,8 +842,6 @@ where DomainI [intro]: "(a, b) \ r \ a \ Domain r" -abbreviation (input) "DomainP \ Domainp" - lemmas DomainPI = Domainp.DomainI inductive_cases DomainE [elim!]: "a \ Domain r" @@ -850,8 +852,6 @@ where RangeI [intro]: "(a, b) \ r \ b \ Range r" -abbreviation (input) "RangeP \ Rangep" - lemmas RangePI = Rangep.RangeI inductive_cases RangeE [elim!]: "b \ Range r" @@ -1079,6 +1079,7 @@ lemma relcomp_Image: "(X O Y) `` Z = Y `` (X `` Z)" by auto + subsubsection \Inverse image\ definition inv_image :: "'b rel \ ('a \ 'b) \ 'a rel" @@ -1122,6 +1123,7 @@ lemmas Powp_mono [mono] = Pow_mono [to_pred] + subsubsection \Expressing relation operations via @{const Finite_Set.fold}\ lemma Id_on_fold: @@ -1196,4 +1198,17 @@ (auto simp: comp_fun_commute.fold_insert comp_fun_commute_relcomp_fold insert_relcomp_fold cong: if_cong) +text \Misc\ + +abbreviation (input) transP :: "('a \ 'a \ bool) \ bool" +where \ \FIXME drop\ + "transP r \ trans {(x, y). r x y}" + +abbreviation (input) + "RangeP \ Rangep" + +abbreviation (input) + "DomainP \ Domainp" + + end