# HG changeset patch # User chaieb # Date 1202140801 -3600 # Node ID 08d52e2dba07ad44046bf562de827688c66f0943 # Parent a27710a07d10bc8d757ac9d32fa5a64e2f42b7ef replaced class by locale diff -r a27710a07d10 -r 08d52e2dba07 src/HOL/Dense_Linear_Order.thy --- a/src/HOL/Dense_Linear_Order.thy Mon Feb 04 12:13:08 2008 +0100 +++ b/src/HOL/Dense_Linear_Order.thy Mon Feb 04 17:00:01 2008 +0100 @@ -303,23 +303,32 @@ text {* Linear order without upper bounds *} -class linorder_no_ub = linorder + - assumes gt_ex: "\y. x < y" +locale linorder_stupid_syntax = linorder begin +notation + less_eq ("op \") and + less_eq ("(_/ \ _)" [51, 51] 50) and + less ("op \") and + less ("(_/ \ _)" [51, 51] 50) -lemma ge_ex: "\y. x \ y" using gt_ex by auto +end -text {* Theorems for @{text "\z. \x. z < x \ (P x \ P\<^bsub>+\\<^esub>)"} *} +locale linorder_no_ub = linorder_stupid_syntax + + assumes gt_ex: "\y. less x y" +begin +lemma ge_ex: "\y. x \ y" using gt_ex by auto + +text {* Theorems for @{text "\z. \x. z \ x \ (P x \ P\<^bsub>+\\<^esub>)"} *} lemma pinf_conj: - assumes ex1: "\z1. \x. z1 < x \ (P1 x \ P1')" - and ex2: "\z2. \x. z2 < x \ (P2 x \ P2')" - shows "\z. \x. z < x \ ((P1 x \ P2 x) \ (P1' \ P2'))" + assumes ex1: "\z1. \x. z1 \ x \ (P1 x \ P1')" + and ex2: "\z2. \x. z2 \ x \ (P2 x \ P2')" + shows "\z. \x. z \ x \ ((P1 x \ P2 x) \ (P1' \ P2'))" proof- - from ex1 ex2 obtain z1 and z2 where z1: "\x. z1 < x \ (P1 x \ P1')" - and z2: "\x. z2 < x \ (P2 x \ P2')" by blast - from gt_ex obtain z where z:"max z1 z2 < z" by blast - from z have zz1: "z1 < z" and zz2: "z2 < z" by simp_all - {fix x assume H: "z < x" + from ex1 ex2 obtain z1 and z2 where z1: "\x. z1 \ x \ (P1 x \ P1')" + and z2: "\x. z2 \ x \ (P2 x \ P2')" by blast + from gt_ex obtain z where z:"ord.max less_eq z1 z2 \ z" by blast + from z have zz1: "z1 \ z" and zz2: "z2 \ z" by simp_all + {fix x assume H: "z \ x" from less_trans[OF zz1 H] less_trans[OF zz2 H] have "(P1 x \ P2 x) \ (P1' \ P2')" using z1 zz1 z2 zz2 by auto } @@ -327,25 +336,25 @@ qed lemma pinf_disj: - assumes ex1: "\z1. \x. z1 < x \ (P1 x \ P1')" - and ex2: "\z2. \x. z2 < x \ (P2 x \ P2')" - shows "\z. \x. z < x \ ((P1 x \ P2 x) \ (P1' \ P2'))" + assumes ex1: "\z1. \x. z1 \ x \ (P1 x \ P1')" + and ex2: "\z2. \x. z2 \ x \ (P2 x \ P2')" + shows "\z. \x. z \ x \ ((P1 x \ P2 x) \ (P1' \ P2'))" proof- - from ex1 ex2 obtain z1 and z2 where z1: "\x. z1 < x \ (P1 x \ P1')" - and z2: "\x. z2 < x \ (P2 x \ P2')" by blast - from gt_ex obtain z where z:"max z1 z2 < z" by blast - from z have zz1: "z1 < z" and zz2: "z2 < z" by simp_all - {fix x assume H: "z < x" + from ex1 ex2 obtain z1 and z2 where z1: "\x. z1 \ x \ (P1 x \ P1')" + and z2: "\x. z2 \ x \ (P2 x \ P2')" by blast + from gt_ex obtain z where z:"ord.max less_eq z1 z2 \ z" by blast + from z have zz1: "z1 \ z" and zz2: "z2 \ z" by simp_all + {fix x assume H: "z \ x" from less_trans[OF zz1 H] less_trans[OF zz2 H] have "(P1 x \ P2 x) \ (P1' \ P2')" using z1 zz1 z2 zz2 by auto } thus ?thesis by blast qed -lemma pinf_ex: assumes ex:"\z. \x. z < x \ (P x \ P1)" and p1: P1 shows "\ x. P x" +lemma pinf_ex: assumes ex:"\z. \x. z \ x \ (P x \ P1)" and p1: P1 shows "\ x. P x" proof- - from ex obtain z where z: "\x. z < x \ (P x \ P1)" by blast - from gt_ex obtain x where x: "z < x" by blast + from ex obtain z where z: "\x. z \ x \ (P x \ P1)" by blast + from gt_ex obtain x where x: "z \ x" by blast from z x p1 show ?thesis by blast qed @@ -353,23 +362,22 @@ text {* Linear order without upper bounds *} -class linorder_no_lb = linorder + - assumes lt_ex: "\y. y < x" +locale linorder_no_lb = linorder_stupid_syntax + + assumes lt_ex: "\y. less y x" begin - -lemma le_ex: "\y. y \ x" using lt_ex by auto +lemma le_ex: "\y. y \ x" using lt_ex by auto -text {* Theorems for @{text "\z. \x. x < z \ (P x \ P\<^bsub>-\\<^esub>)"} *} +text {* Theorems for @{text "\z. \x. x \ z \ (P x \ P\<^bsub>-\\<^esub>)"} *} lemma minf_conj: - assumes ex1: "\z1. \x. x < z1 \ (P1 x \ P1')" - and ex2: "\z2. \x. x < z2 \ (P2 x \ P2')" - shows "\z. \x. x < z \ ((P1 x \ P2 x) \ (P1' \ P2'))" + assumes ex1: "\z1. \x. x \ z1 \ (P1 x \ P1')" + and ex2: "\z2. \x. x \ z2 \ (P2 x \ P2')" + shows "\z. \x. x \ z \ ((P1 x \ P2 x) \ (P1' \ P2'))" proof- - from ex1 ex2 obtain z1 and z2 where z1: "\x. x < z1 \ (P1 x \ P1')"and z2: "\x. x < z2 \ (P2 x \ P2')" by blast - from lt_ex obtain z where z:"z < min z1 z2" by blast - from z have zz1: "z < z1" and zz2: "z < z2" by simp_all - {fix x assume H: "x < z" + from ex1 ex2 obtain z1 and z2 where z1: "\x. x \ z1 \ (P1 x \ P1')"and z2: "\x. x \ z2 \ (P2 x \ P2')" by blast + from lt_ex obtain z where z:"z \ ord.min less_eq z1 z2" by blast + from z have zz1: "z \ z1" and zz2: "z \ z2" by simp_all + {fix x assume H: "x \ z" from less_trans[OF H zz1] less_trans[OF H zz2] have "(P1 x \ P2 x) \ (P1' \ P2')" using z1 zz1 z2 zz2 by auto } @@ -377,78 +385,81 @@ qed lemma minf_disj: - assumes ex1: "\z1. \x. x < z1 \ (P1 x \ P1')" - and ex2: "\z2. \x. x < z2 \ (P2 x \ P2')" - shows "\z. \x. x < z \ ((P1 x \ P2 x) \ (P1' \ P2'))" + assumes ex1: "\z1. \x. x \ z1 \ (P1 x \ P1')" + and ex2: "\z2. \x. x \ z2 \ (P2 x \ P2')" + shows "\z. \x. x \ z \ ((P1 x \ P2 x) \ (P1' \ P2'))" proof- - from ex1 ex2 obtain z1 and z2 where z1: "\x. x < z1 \ (P1 x \ P1')"and z2: "\x. x < z2 \ (P2 x \ P2')" by blast - from lt_ex obtain z where z:"z < min z1 z2" by blast - from z have zz1: "z < z1" and zz2: "z < z2" by simp_all - {fix x assume H: "x < z" + from ex1 ex2 obtain z1 and z2 where z1: "\x. x \ z1 \ (P1 x \ P1')"and z2: "\x. x \ z2 \ (P2 x \ P2')" by blast + from lt_ex obtain z where z:"z \ ord.min less_eq z1 z2" by blast + from z have zz1: "z \ z1" and zz2: "z \ z2" by simp_all + {fix x assume H: "x \ z" from less_trans[OF H zz1] less_trans[OF H zz2] have "(P1 x \ P2 x) \ (P1' \ P2')" using z1 zz1 z2 zz2 by auto } thus ?thesis by blast qed -lemma minf_ex: assumes ex:"\z. \x. x < z \ (P x \ P1)" and p1: P1 shows "\ x. P x" +lemma minf_ex: assumes ex:"\z. \x. x \ z \ (P x \ P1)" and p1: P1 shows "\ x. P x" proof- - from ex obtain z where z: "\x. x < z \ (P x \ P1)" by blast - from lt_ex obtain x where x: "x < z" by blast + from ex obtain z where z: "\x. x \ z \ (P x \ P1)" by blast + from lt_ex obtain x where x: "x \ z" by blast from z x p1 show ?thesis by blast qed end -class constr_dense_linear_order = linorder_no_lb + linorder_no_ub + +locale constr_dense_linear_order = linorder_no_lb + linorder_no_ub + fixes between - assumes between_less: "x < y \ x < between x y \ between x y < y" + assumes between_less: "less x y \ less x (between x y) \ less (between x y) y" and between_same: "between x x = x" -begin -subclass dense_linear_order +interpretation constr_dense_linear_order < dense_linear_order apply unfold_locales using gt_ex lt_ex between_less by (auto, rule_tac x="between x y" in exI, simp) +context constr_dense_linear_order +begin + lemma rinf_U: assumes fU: "finite U" - and lin_dense: "\x l u. (\ t. l < t \ t< u \ t \ U) \ l< x \ x < u \ P x - \ (\ y. l < y \ y < u \ P y )" - and nmpiU: "\x. \ MP \ \PP \ P x \ (\ u\ U. \ u' \ U. u \ x \ x \ u')" + and lin_dense: "\x l u. (\ t. l \ t \ t\ u \ t \ U) \ l\ x \ x \ u \ P x + \ (\ y. l \ y \ y \ u \ P y )" + and nmpiU: "\x. \ MP \ \PP \ P x \ (\ u\ U. \ u' \ U. u \ x \ x \ u')" and nmi: "\ MP" and npi: "\ PP" and ex: "\ x. P x" shows "\ u\ U. \ u' \ U. P (between u u')" proof- from ex obtain x where px: "P x" by blast - from px nmi npi nmpiU have "\ u\ U. \ u' \ U. u \ x \ x \ u'" by auto - then obtain u and u' where uU:"u\ U" and uU': "u' \ U" and ux:"u \ x" and xu':"x \ u'" by auto + from px nmi npi nmpiU have "\ u\ U. \ u' \ U. u \ x \ x \ u'" by auto + then obtain u and u' where uU:"u\ U" and uU': "u' \ U" and ux:"u \ x" and xu':"x \ u'" by auto from uU have Une: "U \ {}" by auto - let ?l = "Min U" - let ?u = "Max U" + term "linorder.Min less_eq" + let ?l = "linorder.Min less_eq U" + let ?u = "linorder.Max less_eq U" have linM: "?l \ U" using fU Une by simp have uinM: "?u \ U" using fU Une by simp - have lM: "\ t\ U. ?l \ t" using Une fU by auto - have Mu: "\ t\ U. t \ ?u" using Une fU by auto - have th:"?l \ u" using uU Une lM by auto - from order_trans[OF th ux] have lx: "?l \ x" . - have th: "u' \ ?u" using uU' Une Mu by simp - from order_trans[OF xu' th] have xu: "x \ ?u" . + have lM: "\ t\ U. ?l \ t" using Une fU by auto + have Mu: "\ t\ U. t \ ?u" using Une fU by auto + have th:"?l \ u" using uU Une lM by auto + from order_trans[OF th ux] have lx: "?l \ x" . + have th: "u' \ ?u" using uU' Une Mu by simp + from order_trans[OF xu' th] have xu: "x \ ?u" . from finite_set_intervals2[where P="P",OF px lx xu linM uinM fU lM Mu] have "(\ s\ U. P s) \ - (\ t1\ U. \ t2 \ U. (\ y. t1 < y \ y < t2 \ y \ U) \ t1 < x \ x < t2 \ P x)" . + (\ t1\ U. \ t2 \ U. (\ y. t1 \ y \ y \ t2 \ y \ U) \ t1 \ x \ x \ t2 \ P x)" . moreover { fix u assume um: "u\U" and pu: "P u" have "between u u = u" by (simp add: between_same) with um pu have "P (between u u)" by simp with um have ?thesis by blast} moreover{ - assume "\ t1\ U. \ t2 \ U. (\ y. t1 < y \ y < t2 \ y \ U) \ t1 < x \ x < t2 \ P x" + assume "\ t1\ U. \ t2 \ U. (\ y. t1 \ y \ y \ t2 \ y \ U) \ t1 \ x \ x \ t2 \ P x" then obtain t1 and t2 where t1M: "t1 \ U" and t2M: "t2\ U" - and noM: "\ y. t1 < y \ y < t2 \ y \ U" and t1x: "t1 < x" and xt2: "x < t2" and px: "P x" + and noM: "\ y. t1 \ y \ y \ t2 \ y \ U" and t1x: "t1 \ x" and xt2: "x \ t2" and px: "P x" by blast - from less_trans[OF t1x xt2] have t1t2: "t1 < t2" . + from less_trans[OF t1x xt2] have t1t2: "t1 \ t2" . let ?u = "between t1 t2" - from between_less t1t2 have t1lu: "t1 < ?u" and ut2: "?u < t2" by auto + from between_less t1t2 have t1lu: "t1 \ ?u" and ut2: "?u \ t2" by auto from lin_dense noM t1x xt2 px t1lu ut2 have "P ?u" by blast with t1M t2M have ?thesis by blast} ultimately show ?thesis by blast @@ -456,11 +467,11 @@ theorem fr_eq: assumes fU: "finite U" - and lin_dense: "\x l u. (\ t. l < t \ t< u \ t \ U) \ l< x \ x < u \ P x - \ (\ y. l < y \ y < u \ P y )" - and nmibnd: "\x. \ MP \ P x \ (\ u\ U. u \ x)" - and npibnd: "\x. \PP \ P x \ (\ u\ U. x \ u)" - and mi: "\z. \x. x < z \ (P x = MP)" and pi: "\z. \x. z < x \ (P x = PP)" + and lin_dense: "\x l u. (\ t. l \ t \ t\ u \ t \ U) \ l\ x \ x \ u \ P x + \ (\ y. l \ y \ y \ u \ P y )" + and nmibnd: "\x. \ MP \ P x \ (\ u\ U. u \ x)" + and npibnd: "\x. \PP \ P x \ (\ u\ U. x \ u)" + and mi: "\z. \x. x \ z \ (P x = MP)" and pi: "\z. \x. z \ x \ (P x = PP)" shows "(\ x. P x) \ (MP \ PP \ (\ u \ U. \ u'\ U. P (between u u')))" (is "_ \ (_ \ _ \ ?F)" is "?E \ ?D") proof- @@ -470,7 +481,7 @@ moreover {assume "MP \ PP" hence "?D" by blast} moreover {assume nmi: "\ MP" and npi: "\ PP" from npmibnd[OF nmibnd npibnd] - have nmpiU: "\x. \ MP \ \PP \ P x \ (\ u\ U. \ u' \ U. u \ x \ x \ u')" . + have nmpiU: "\x. \ MP \ \PP \ P x \ (\ u\ U. \ u' \ U. u \ x \ x \ u')" . from rinf_U[OF fU lin_dense nmpiU nmi npi px] have "?D" by blast} ultimately have "?D" by blast} moreover @@ -505,7 +516,7 @@ fun simps phi = map (Morphism.thm phi) [@{thm "not_less"}, @{thm "not_le"}] fun generic_whatis phi = let - val [lt, le] = map (Morphism.term phi) [@{term "op <"}, @{term "op \"}] + val [lt, le] = map (Morphism.term phi) [@{term "op \"}, @{term "op \"}] fun h x t = case term_of t of Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq