Library NumAnalysis.Algebra.Finite_dim.Finite_dim_AS_def

This file is part of the Rocq Numerical Analysis library
Copyright (C) Boldo, Clément, Martin, Mayero, Mouhcine
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the COPYING file for more details.

Brief description

Definitions for finite-dimensional affine spaces.

Description

When there is a finite generator family, affine algebra is simplified. With the notions of basis and dimension (the cardinal of bases), many results are simplified.
Let K : Ring, V : ModuleSpace K and E : AffineSpace V. Let PE : E → Prop. Let A : 'E^n and A' : 'E^n.+1. Let B A0 A1 A2 : E.

Used logic axioms

  • ex_EX, an alias for constructive_indefinite_description.

Usage

This module may be used through the import of NumAnalysis.Algebra.Finite_dim.Finite_dim_AS, NumAnalysis.Algebra.Finite_dim.Finite_dim, NumAnalysis.Algebra.Algebra, NumAnalysis.Algebra.Algebra_wDep, NumAnalysis.LM.LM_wDep, or NumAnalysis.FEM.FEM_wDep, where it is exported.

From NumAnalysis Require Import ssr_wMC.

From Coquelicot Require Import Hierarchy.
Close Scope R_scope.

From NumAnalysis Require Import Subsets_wDep.
From NumAnalysis Require Import Hierarchy_compl.
From NumAnalysis Require Import Monoid Group Ring ModuleSpace AffineSpace.
From NumAnalysis Require Import Finite_dim_MS_def.

Local Open Scope Monoid_scope.
Local Open Scope Group_scope.
Local Open Scope Ring_scope.
Local Open Scope ModuleSpace_scope.
Local Open Scope AffineSpace_scope.

Section FD_AS_Def1.

Context {K : Ring}.
Context {V : ModuleSpace K}.
Context {E : AffineSpace V}.

Variant aff_span {n} (A : 'E^n) : E → Prop :=
  Aff_span : ∀ L, invertible (sum L) → aff_span A (barycenter L A).

Lemma aff_span_EX :
  ∀ {n} {A : 'E^n} {B},
    aff_span A B → { L | sum L = 1 ∧ B = barycenter L A }.
Proof.
move=>> Hx; apply ex_EX; induction Hx as [L HL];
    eexists; apply (baryc_normalized _ _ _ HL); easy.
Qed.

Lemma aff_span_ex :
  ∀ {n} (A : 'E^n) B,
    (∃ L, invertible (sum L) ∧ B = barycenter L A) → aff_span A B.
Proof. move=>> [L [HL1 HL2]]; rewrite HL2; easy. Qed.

Definition baryc_coord {n} (A : 'E^n) (B : E) : 'K^n :=
  match in_dec (aff_span A) B with
  | left HB ⇒ proj1_sig (aff_span_EX HB)
  | right _ ⇒ 0
  end.

Lemma bc_correct :
  ∀ {n} {A : 'E^n} {B}, aff_span A B →
    sum (baryc_coord A B) = 1 ∧ B = barycenter (baryc_coord A B) A.
Proof.
intros; unfold baryc_coord; destruct (in_dec _ _);
    [apply (proj2_sig (aff_span_EX _)) | easy].
Qed.

Lemma bc_0 : ∀ {n} {A : 'E^n} {B}, ¬ aff_span A B → baryc_coord A B = 0.
Proof. intros; unfold baryc_coord; destruct (in_dec _ _); easy. Qed.

Definition aff_point (A0 : E) : E → Prop := aff_span (singleF A0).
Definition aff_line (A0 A1 : E) : E → Prop := aff_span (coupleF A0 A1).
Definition aff_plane (A0 A1 A2 : E) : E → Prop := aff_span (tripleF A0 A1 A2).

Definition baryc_surjL (PE : E → Prop) {n} (A : 'E^n) : Prop :=
  ∀ G, PE G → ∃ L, sum L = 1 ∧ G = barycenter L A.
Definition baryc_injL {n} (A : 'E^n) : Prop :=
  ∀ L L', sum L = 1 → sum L' = 1 →
    barycenter L A = barycenter L' A → L = L'.
Definition baryc_bijL (PE : E → Prop) {n} (A : 'E^n) : Prop :=
  ∀ G, PE G → ∃! L, sum L = 1 ∧ G = barycenter L A.

Definition aff_gen (PE : E → Prop) {n} (A : 'E^n) : Prop := PE = aff_span A.

Lemma aff_gen_ext :
  ∀ {PE} {n} (A1 : 'E^n) {A2}, A1 = A2 → aff_gen PE A1 → aff_gen PE A2.
Proof. intros; subst; easy. Qed.

Lemma aff_gen_ext2 :
  ∀ PE1 {PE2} {n} (A1 : 'E^n) {A2},
    PE1 = PE2 → A1 = A2 → aff_gen PE1 A1 → aff_gen PE2 A2.
Proof. intros; subst; easy. Qed.

Definition aff_indep {n} (A : 'E^n.+1) : Prop := lin_indep (frameF ord0 A).

Lemma aff_indep_ext :
  ∀ {n} (A1 : 'E^n.+1) {A2}, A1 = A2 → aff_indep A1 → aff_indep A2.
Proof. intros; subst; easy. Qed.

Definition aff_dep {n} (A : 'E^n.+1) : Prop := ¬ aff_indep A.

Lemma aff_dep_ext :
  ∀ {n} (A1 : 'E^n.+1) {A2}, A1 = A2 → aff_dep A1 → aff_dep A2.
Proof. intros; subst; easy. Qed.

Definition aff_basis (PE : E → Prop) {n} (A : 'E^n.+1) : Prop :=
  aff_gen PE A ∧ aff_indep A.

Lemma aff_basis_ext :
  ∀ {PE} {n} (A1 : 'E^n.+1) {A2},
    A1 = A2 → aff_basis PE A1 → aff_basis PE A2.
Proof. intros; subst; easy. Qed.

Lemma aff_basis_ext2 :
  ∀ PE1 {PE2} {n} (A1 : 'E^n.+1) {A2},
    PE1 = PE2 → A1 = A2 → aff_basis PE1 A1 → aff_basis PE2 A2.
Proof. intros; subst; easy. Qed.

Variant has_aff_dim (PE : E → Prop) n : Prop :=
  Aff_dim : ∀ (A : 'E^n.+1), aff_basis PE A → has_aff_dim PE n.

Lemma has_aff_dim_EX :
  ∀ PE n, has_aff_dim PE n → { A : 'E^n.+1 | aff_basis PE A }.
Proof. move=>> H; apply ex_EX; induction H as [A H]; ∃ A; easy. Qed.

Lemma has_aff_dim_ex :
  ∀ PE n, (∃ A : 'E^n.+1, aff_basis PE A) → has_aff_dim PE n.
Proof. move=>> [A HA]. apply (Aff_dim _ _ A HA). Qed.

Lemma has_aff_dim_ext :
  ∀ {PE} n1 {n2}, n1 = n2 → has_aff_dim PE n1 → has_aff_dim PE n2.
Proof. intros; subst; easy. Qed.

Lemma has_aff_dim_ext2 :
  ∀ PE1 {PE2} n1 {n2},
    PE1 = PE2 → n1 = n2 → has_aff_dim PE1 n1 → has_aff_dim PE2 n2.
Proof. intros; subst; easy. Qed.

End FD_AS_Def1.

Section FD_AS_Def2.

Although functions to module spaces are instances of the ModuleSpace structure, and module spaces are also instances of the AffineSpace structure, functions to module spaces (such as finite families in module spaces, aka vectors) are not instances of the AffineSpace structure.
Helpers below avoids the use of fct_ModuleSpace type constraints. Try to only use them when strictly necessary. And use the correctness lemmas to be able to further apply regular results.

Context {K : Ring}.
Context {E : ModuleSpace K}.

Definition aff_span_ms {n} (A : 'E^n) : E → Prop := aff_span A.
Definition baryc_coord_ms {n} (A : 'E^n) (B : E) := baryc_coord A B.
Definition aff_gen_ms (PE : E → Prop) {n} (A : 'E^n) : Prop := aff_gen PE A.
Definition aff_indep_ms {n} (A : 'E^n.+1) : Prop := aff_indep A.
Definition aff_basis_ms (PE : E → Prop) {n} (A : 'E^n.+1) : Prop :=
  aff_basis PE A.
Definition has_aff_dim_ms (PE : E → Prop) n : Prop := has_aff_dim PE n.

Lemma aff_span_ms_correct : ∀ {n} (A : 'E^n), aff_span_ms A = aff_span A.
Proof. easy. Qed.

Lemma bc_ms_correct :
  ∀ {n} (A : 'E^n), baryc_coord_ms A = baryc_coord A.
Proof. easy. Qed.

Lemma aff_gen_ms_correct :
  ∀ PE {n} (A : 'E^n), aff_gen_ms PE A ↔ aff_gen PE A.
Proof. easy. Qed.

Lemma aff_indep_ms_correct :
  ∀ {n} (A : 'E^n.+1), aff_indep_ms A ↔ aff_indep A.
Proof. easy. Qed.

Lemma aff_basis_ms_correct :
  ∀ PE {n} (A : 'E^n.+1), aff_basis_ms PE A ↔ aff_basis PE A.
Proof. easy. Qed.

Lemma has_aff_dim_ms_correct :
  ∀ PE n, has_aff_dim_ms PE n ↔ has_aff_dim PE n.
Proof. easy. Qed.

End FD_AS_Def2.