From: Enrico Zoli Date: Tue, 31 Oct 2006 15:38:22 +0000 (+0000) Subject: Integration_algebras.ma split into 6 different files. X-Git-Tag: 0.4.95@7852~828 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=8b62b96fea74985e303e093d9b7ead91089c664e;p=helm.git Integration_algebras.ma split into 6 different files. --- diff --git a/matita/dama/fields.ma b/matita/dama/fields.ma new file mode 100644 index 000000000..0618f4923 --- /dev/null +++ b/matita/dama/fields.ma @@ -0,0 +1,59 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/fields/". + +include "rings.ma". + +record is_field (R:ring) (inv:∀x:R.x ≠ 0 → R) : Prop +≝ + { (* multiplicative abelian properties *) + mult_comm_: symmetric ? (mult R); + (* multiplicative group properties *) + inv_inverse_: ∀x.∀p: x ≠ 0. mult ? (inv x p) x = 1 + }. + +lemma opp_opp: \forall R:ring. \forall x:R. (-(-x))=x. +intros; +apply (cancellationlaw ? (-x) ? ?); +rewrite > (opp_inverse R x); +rewrite > plus_comm; +rewrite > opp_inverse; +reflexivity. +qed. + +let rec sum (C:Type) (plus:C→C→C) (zero,one:C) (n:nat) on n ≝ + match n with + [ O ⇒ zero + | (S m) ⇒ plus one (sum C plus zero one m) + ]. + +record field : Type \def + { f_ring:> ring; + inv: ∀x:f_ring. x ≠ 0 → f_ring; + field_properties: is_field f_ring inv + }. + +theorem mult_comm: ∀F:field.symmetric ? (mult F). + intro; + apply (mult_comm_ ? ? (field_properties F)). +qed. + +theorem inv_inverse: ∀F:field.∀x.∀p: x ≠ 0. mult ? (inv F x p) x = 1. + intro; + apply (inv_inverse_ ? ? (field_properties F)). +qed. + +definition sum_field ≝ + λF:field. sum ? (plus F) (zero F) (one F). diff --git a/matita/dama/groups.ma b/matita/dama/groups.ma new file mode 100644 index 000000000..8353ea676 --- /dev/null +++ b/matita/dama/groups.ma @@ -0,0 +1,104 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/groups/". + +include "higher_order_defs/functions.ma". +include "nat/nat.ma". +include "nat/orders.ma". + +definition left_neutral \def λC,op.λe:C. ∀x:C. op e x = x. + +definition right_neutral \def λC,op. λe:C. ∀x:C. op x e=x. + +definition left_inverse \def λC,op.λe:C.λinv:C→C. ∀x:C. op (inv x) x = e. + +definition right_inverse \def λC,op.λe:C.λ inv: C→ C. ∀x:C. op x (inv x)=e. + +definition distributive_left ≝ + λA:Type.λf:A→A→A.λg:A→A→A. + ∀x,y,z. f x (g y z) = g (f x y) (f x z). + +definition distributive_right ≝ + λA:Type.λf:A→A→A.λg:A→A→A. + ∀x,y,z. f (g x y) z = g (f x z) (f y z). + +record is_abelian_group (C:Type) (plus:C→C→C) (zero:C) (opp:C→C) : Prop \def + { (* abelian additive semigroup properties *) + plus_assoc_: associative ? plus; + plus_comm_: symmetric ? plus; + (* additive monoid properties *) + zero_neutral_: left_neutral ? plus zero; + (* additive group properties *) + opp_inverse_: left_inverse ? plus zero opp + }. + +record abelian_group : Type \def + { carrier:> Type; + plus: carrier → carrier → carrier; + zero: carrier; + opp: carrier → carrier; + ag_abelian_group_properties: is_abelian_group ? plus zero opp + }. + +notation "0" with precedence 89 +for @{ 'zero }. + +interpretation "Abelian group zero" 'zero = + (cic:/matita/groups/zero.con _). + +interpretation "Abelian group plus" 'plus a b = + (cic:/matita/groups/plus.con _ a b). + +interpretation "Abelian group opp" 'uminus a = + (cic:/matita/groups/opp.con _ a). + +definition minus ≝ + λG:abelian_group.λa,b:G. a + -b. + +interpretation "Abelian group minus" 'minus a b = + (cic:/matita/groups/minus.con _ a b). + +theorem plus_assoc: ∀G:abelian_group. associative ? (plus G). + intro; + apply (plus_assoc_ ? ? ? ? (ag_abelian_group_properties G)). +qed. + +theorem plus_comm: ∀G:abelian_group. symmetric ? (plus G). + intro; + apply (plus_comm_ ? ? ? ? (ag_abelian_group_properties G)). +qed. + +theorem zero_neutral: ∀G:abelian_group. left_neutral ? (plus G) 0. + intro; + apply (zero_neutral_ ? ? ? ? (ag_abelian_group_properties G)). +qed. + +theorem opp_inverse: ∀G:abelian_group. left_inverse ? (plus G) 0 (opp G). + intro; + apply (opp_inverse_ ? ? ? ? (ag_abelian_group_properties G)). +qed. + +lemma cancellationlaw: ∀G:abelian_group.∀x,y,z:G. x+y=x+z → y=z. +intros; +generalize in match (eq_f ? ? (λa.-x +a) ? ? H); +intros; clear H; +rewrite < plus_assoc in H1; +rewrite < plus_assoc in H1; +rewrite > opp_inverse in H1; +rewrite > zero_neutral in H1; +rewrite > zero_neutral in H1; +assumption. +qed. + diff --git a/matita/dama/integration_algebras.ma b/matita/dama/integration_algebras.ma index fa76d2d98..b2fb189e9 100644 --- a/matita/dama/integration_algebras.ma +++ b/matita/dama/integration_algebras.ma @@ -14,277 +14,7 @@ set "baseuri" "cic:/matita/integration_algebras/". -include "higher_order_defs/functions.ma". -include "nat/nat.ma". -include "nat/orders.ma". - -definition left_neutral \def λC,op.λe:C. ∀x:C. op e x = x. - -definition right_neutral \def λC,op. λe:C. ∀x:C. op x e=x. - -definition left_inverse \def λC,op.λe:C.λinv:C→C. ∀x:C. op (inv x) x = e. - -definition right_inverse \def λC,op.λe:C.λ inv: C→ C. ∀x:C. op x (inv x)=e. - -definition distributive_left ≝ - λA:Type.λf:A→A→A.λg:A→A→A. - ∀x,y,z. f x (g y z) = g (f x y) (f x z). - -definition distributive_right ≝ - λA:Type.λf:A→A→A.λg:A→A→A. - ∀x,y,z. f (g x y) z = g (f x z) (f y z). - -record is_abelian_group (C:Type) (plus:C→C→C) (zero:C) (opp:C→C) : Prop \def - { (* abelian additive semigroup properties *) - plus_assoc_: associative ? plus; - plus_comm_: symmetric ? plus; - (* additive monoid properties *) - zero_neutral_: left_neutral ? plus zero; - (* additive group properties *) - opp_inverse_: left_inverse ? plus zero opp - }. - -record abelian_group : Type \def - { carrier:> Type; - plus: carrier → carrier → carrier; - zero: carrier; - opp: carrier → carrier; - ag_abelian_group_properties: is_abelian_group ? plus zero opp - }. - -notation "0" with precedence 89 -for @{ 'zero }. - -interpretation "Ring zero" 'zero = - (cic:/matita/integration_algebras/zero.con _). - -interpretation "Ring plus" 'plus a b = - (cic:/matita/integration_algebras/plus.con _ a b). - -interpretation "Ring opp" 'uminus a = - (cic:/matita/integration_algebras/opp.con _ a). - -definition minus ≝ - λG:abelian_group.λa,b:G. a + -b. - -interpretation "Ring minus" 'minus a b = - (cic:/matita/integration_algebras/minus.con _ a b). - -theorem plus_assoc: ∀G:abelian_group. associative ? (plus G). - intro; - apply (plus_assoc_ ? ? ? ? (ag_abelian_group_properties G)). -qed. - -theorem plus_comm: ∀G:abelian_group. symmetric ? (plus G). - intro; - apply (plus_comm_ ? ? ? ? (ag_abelian_group_properties G)). -qed. - -theorem zero_neutral: ∀G:abelian_group. left_neutral ? (plus G) 0. - intro; - apply (zero_neutral_ ? ? ? ? (ag_abelian_group_properties G)). -qed. - -theorem opp_inverse: ∀G:abelian_group. left_inverse ? (plus G) 0 (opp G). - intro; - apply (opp_inverse_ ? ? ? ? (ag_abelian_group_properties G)). -qed. - -lemma cancellationlaw: ∀G:abelian_group.∀x,y,z:G. x+y=x+z → y=z. -intros; -generalize in match (eq_f ? ? (λa.-x +a) ? ? H); -intros; clear H; -rewrite < plus_assoc in H1; -rewrite < plus_assoc in H1; -rewrite > opp_inverse in H1; -rewrite > zero_neutral in H1; -rewrite > zero_neutral in H1; -assumption. -qed. - -(****************************** rings *********************************) - -record is_ring (G:abelian_group) (mult:G→G→G) (one:G) : Prop -≝ - { (* multiplicative monoid properties *) - mult_assoc_: associative ? mult; - one_neutral_left_: left_neutral ? mult one; - one_neutral_right_: right_neutral ? mult one; - (* ring properties *) - mult_plus_distr_left_: distributive_left ? mult (plus G); - mult_plus_distr_right_: distributive_right ? mult (plus G); - not_eq_zero_one_: (0 ≠ one) - }. - -record ring : Type \def - { r_abelian_group:> abelian_group; - mult: r_abelian_group → r_abelian_group → r_abelian_group; - one: r_abelian_group; - r_ring_properties: is_ring r_abelian_group mult one - }. - -theorem mult_assoc: ∀R:ring.associative ? (mult R). - intros; - apply (mult_assoc_ ? ? ? (r_ring_properties R)). -qed. - -theorem one_neutral_left: ∀R:ring.left_neutral ? (mult R) (one R). - intros; - apply (one_neutral_left_ ? ? ? (r_ring_properties R)). -qed. - -theorem one_neutral_right: ∀R:ring.right_neutral ? (mult R) (one R). - intros; - apply (one_neutral_right_ ? ? ? (r_ring_properties R)). -qed. - -theorem mult_plus_distr_left: ∀R:ring.distributive_left ? (mult R) (plus R). - intros; - apply (mult_plus_distr_left_ ? ? ? (r_ring_properties R)). -qed. - -theorem mult_plus_distr_right: ∀R:ring.distributive_right ? (mult R) (plus R). - intros; - apply (mult_plus_distr_right_ ? ? ? (r_ring_properties R)). -qed. - -theorem not_eq_zero_one: ∀R:ring.0 ≠ one R. - intros; - apply (not_eq_zero_one_ ? ? ? (r_ring_properties R)). -qed. - -interpretation "Ring mult" 'times a b = - (cic:/matita/integration_algebras/mult.con _ a b). - -notation "1" with precedence 89 -for @{ 'one }. - -interpretation "Field one" 'one = - (cic:/matita/integration_algebras/one.con _). - -lemma eq_mult_zero_x_zero: ∀R:ring.∀x:R.0*x=0. - intros; - generalize in match (zero_neutral R 0); intro; - generalize in match (eq_f ? ? (λy.y*x) ? ? H); intro; clear H; - rewrite > mult_plus_distr_right in H1; - generalize in match (eq_f ? ? (λy.-(0*x)+y) ? ? H1); intro; clear H1; - rewrite < plus_assoc in H; - rewrite > opp_inverse in H; - rewrite > zero_neutral in H; - assumption. -qed. - -lemma eq_mult_x_zero_zero: ∀R:ring.∀x:R.x*0=0. -intros; -generalize in match (zero_neutral R 0); -intro; -generalize in match (eq_f ? ? (\lambda y.x*y) ? ? H); intro; clear H; -rewrite > mult_plus_distr_left in H1; -generalize in match (eq_f ? ? (\lambda y. (-(x*0)) +y) ? ? H1);intro; -clear H1; -rewrite < plus_assoc in H; -rewrite > opp_inverse in H; -rewrite > zero_neutral in H; -assumption. -qed. - -record is_field (R:ring) (inv:∀x:R.x ≠ 0 → R) : Prop -≝ - { (* multiplicative abelian properties *) - mult_comm_: symmetric ? (mult R); - (* multiplicative group properties *) - inv_inverse_: ∀x.∀p: x ≠ 0. mult ? (inv x p) x = 1 - }. - -lemma opp_opp: \forall R:ring. \forall x:R. (-(-x))=x. -intros; -apply (cancellationlaw ? (-x) ? ?); -rewrite > (opp_inverse R x); -rewrite > plus_comm; -rewrite > opp_inverse; -reflexivity. -qed. - - -let rec sum (C:Type) (plus:C→C→C) (zero,one:C) (n:nat) on n ≝ - match n with - [ O ⇒ zero - | (S m) ⇒ plus one (sum C plus zero one m) - ]. - -record field : Type \def - { f_ring:> ring; - inv: ∀x:f_ring. x ≠ 0 → f_ring; - field_properties: is_field f_ring inv - }. - -theorem mult_comm: ∀F:field.symmetric ? (mult F). - intro; - apply (mult_comm_ ? ? (field_properties F)). -qed. - -theorem inv_inverse: ∀F:field.∀x.∀p: x ≠ 0. mult ? (inv F x p) x = 1. - intro; - apply (inv_inverse_ ? ? (field_properties F)). -qed. - -definition sum_field ≝ - λF:field. sum ? (plus F) (zero F) (one F). - -record is_ordered_field_ch0 (F:field) (le:F→F→Prop) : Prop \def - { of_mult_compat: ∀a,b. le 0 a → le 0 b → le 0 (a*b); - of_plus_compat: ∀a,b,c. le a b → le (a+c) (b+c); - of_weak_tricotomy : ∀a,b. a≠b → le a b ∨ le b a; - (* 0 characteristics *) - of_char0: ∀n. n > O → sum ? (plus F) 0 1 n ≠ 0 - }. - -record ordered_field_ch0 : Type \def - { of_field:> field; - of_le: of_field → of_field → Prop; - of_ordered_field_properties:> is_ordered_field_ch0 of_field of_le - }. - -interpretation "Ordered field le" 'leq a b = - (cic:/matita/integration_algebras/of_le.con _ a b). - -definition lt \def λF:ordered_field_ch0.λa,b:F.a ≤ b ∧ a ≠ b. - -interpretation "Ordered field lt" 'lt a b = - (cic:/matita/integration_algebras/lt.con _ a b). - -lemma le_zero_x_to_le_opp_x_zero: ∀F:ordered_field_ch0.∀x:F. 0 ≤ x → -x ≤ 0. -intros; - generalize in match (of_plus_compat ? ? F ? ? (-x) H); intro; - rewrite > zero_neutral in H1; - rewrite > plus_comm in H1; - rewrite > opp_inverse in H1; - assumption. -qed. - -lemma le_x_zero_to_le_zero_opp_x: ∀F:ordered_field_ch0.∀x:F. x ≤ 0 → 0 ≤ -x. - intros; - generalize in match (of_plus_compat ? ? F ? ? (-x) H); intro; - rewrite > zero_neutral in H1; - rewrite > plus_comm in H1; - rewrite > opp_inverse in H1; - assumption. -qed. - -(* -lemma eq_opp_x_times_opp_one_x: ∀F:ordered_field_ch0.∀x:F.-x = -1*x. - intros; - -lemma not_eq_x_zero_to_lt_zero_mult_x_x: - ∀F:ordered_field_ch0.∀x:F. x ≠ 0 → 0 < x * x. - intros; - elim (of_weak_tricotomy ? ? ? ? ? ? ? ? F ? ? H); - [ generalize in match (le_x_zero_to_le_zero_opp_x F ? H1); intro; - generalize in match (of_mult_compat ? ? ? ? ? ? ? ? F ? ? H2 H2); intro; -*) - -(* The ordering is not necessary. *) -axiom not_eq_sum_field_zero: ∀F:ordered_field_ch0.∀n. O O → sum ? (plus F) 0 1 n ≠ 0 + }. + +record ordered_field_ch0 : Type \def + { of_field:> field; + of_le: of_field → of_field → Prop; + of_ordered_field_properties:> is_ordered_field_ch0 of_field of_le + }. + +interpretation "Ordered field le" 'leq a b = + (cic:/matita/ordered_fields_ch0/of_le.con _ a b). + +definition lt \def λF:ordered_field_ch0.λa,b:F.a ≤ b ∧ a ≠ b. + +interpretation "Ordered field lt" 'lt a b = + (cic:/matita/ordered_fields_ch0/lt.con _ a b). + +lemma le_zero_x_to_le_opp_x_zero: ∀F:ordered_field_ch0.∀x:F. 0 ≤ x → -x ≤ 0. +intros; + generalize in match (of_plus_compat ? ? F ? ? (-x) H); intro; + rewrite > zero_neutral in H1; + rewrite > plus_comm in H1; + rewrite > opp_inverse in H1; + assumption. +qed. + +lemma le_x_zero_to_le_zero_opp_x: ∀F:ordered_field_ch0.∀x:F. x ≤ 0 → 0 ≤ -x. + intros; + generalize in match (of_plus_compat ? ? F ? ? (-x) H); intro; + rewrite > zero_neutral in H1; + rewrite > plus_comm in H1; + rewrite > opp_inverse in H1; + assumption. +qed. + +(* +lemma eq_opp_x_times_opp_one_x: ∀F:ordered_field_ch0.∀x:F.-x = -1*x. + intros; + +lemma not_eq_x_zero_to_lt_zero_mult_x_x: + ∀F:ordered_field_ch0.∀x:F. x ≠ 0 → 0 < x * x. + intros; + elim (of_weak_tricotomy ? ? ? ? ? ? ? ? F ? ? H); + [ generalize in match (le_x_zero_to_le_zero_opp_x F ? H1); intro; + generalize in match (of_mult_compat ? ? ? ? ? ? ? ? F ? ? H2 H2); intro; +*) + +(* The ordering is not necessary. *) +axiom not_eq_sum_field_zero: ∀F:ordered_field_ch0.∀n. O abelian_group; + mult: r_abelian_group → r_abelian_group → r_abelian_group; + one: r_abelian_group; + r_ring_properties: is_ring r_abelian_group mult one + }. + +theorem mult_assoc: ∀R:ring.associative ? (mult R). + intros; + apply (mult_assoc_ ? ? ? (r_ring_properties R)). +qed. + +theorem one_neutral_left: ∀R:ring.left_neutral ? (mult R) (one R). + intros; + apply (one_neutral_left_ ? ? ? (r_ring_properties R)). +qed. + +theorem one_neutral_right: ∀R:ring.right_neutral ? (mult R) (one R). + intros; + apply (one_neutral_right_ ? ? ? (r_ring_properties R)). +qed. + +theorem mult_plus_distr_left: ∀R:ring.distributive_left ? (mult R) (plus R). + intros; + apply (mult_plus_distr_left_ ? ? ? (r_ring_properties R)). +qed. + +theorem mult_plus_distr_right: ∀R:ring.distributive_right ? (mult R) (plus R). + intros; + apply (mult_plus_distr_right_ ? ? ? (r_ring_properties R)). +qed. + +theorem not_eq_zero_one: ∀R:ring.0 ≠ one R. + intros; + apply (not_eq_zero_one_ ? ? ? (r_ring_properties R)). +qed. + +interpretation "Ring mult" 'times a b = + (cic:/matita/rings/mult.con _ a b). + +notation "1" with precedence 89 +for @{ 'one }. + +interpretation "Ring one" 'one = + (cic:/matita/rings/one.con _). + +lemma eq_mult_zero_x_zero: ∀R:ring.∀x:R.0*x=0. + intros; + generalize in match (zero_neutral R 0); intro; + generalize in match (eq_f ? ? (λy.y*x) ? ? H); intro; clear H; + rewrite > mult_plus_distr_right in H1; + generalize in match (eq_f ? ? (λy.-(0*x)+y) ? ? H1); intro; clear H1; + rewrite < plus_assoc in H; + rewrite > opp_inverse in H; + rewrite > zero_neutral in H; + assumption. +qed. + +lemma eq_mult_x_zero_zero: ∀R:ring.∀x:R.x*0=0. +intros; +generalize in match (zero_neutral R 0); +intro; +generalize in match (eq_f ? ? (\lambda y.x*y) ? ? H); intro; clear H; +rewrite > mult_plus_distr_left in H1; +generalize in match (eq_f ? ? (\lambda y. (-(x*0)) +y) ? ? H1);intro; +clear H1; +rewrite < plus_assoc in H; +rewrite > opp_inverse in H; +rewrite > zero_neutral in H; +assumption. +qed. +